فهرست منبع

拣货出库、呼叫拣货

andy 2 سال پیش
والد
کامیت
9ace408683

+ 5 - 0
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java

@@ -277,6 +277,11 @@ public class WarehouseTest {
         System.out.println(JSON.toJSONString(invLotLocIdList));
     }
 
+    @Test
+    public void clear() {
+        
+    }
+
     @Test
     public void testInitData() {
         initDocAsnData();

+ 2 - 1
ruoyi-ui/src/views/ams/flowConfig/index.vue

@@ -495,7 +495,8 @@ export default {
         {label : 'AGV入库上架', value : 'ASN'},
         {label : '标准入库上架', value : 'BASASN'},
         {label : 'AGV拣货出库', value : 'SO'},
-        {label : 'AGV按单出库', value : 'BATCHSO'}
+        {label : 'AGV按单出库', value : 'BATCHSO'},
+        {label : '移库', value : 'MV'}
       ],
       flowDict: [],
       attShowFlag: true,

+ 28 - 1
ruoyi-ui/src/views/ams/inv/invLotLocId/index.vue

@@ -19,6 +19,16 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
+      <el-form-item label="是否满拖" prop="isFull">
+        <el-select v-model="form.isFull" placeholder="请选择是否满拖">
+          <el-option
+            v-for="dict in dict.type.sys_yes_no"
+            :key="dict.value"
+            :label="dict.label"
+            :value="dict.value"
+          ></el-option>
+        </el-select>
+      </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
@@ -48,6 +58,17 @@
         >库存移动
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          @click="handleTally"
+          v-hasPermi="['ams:invLotLocId:move']"
+        >库内理货
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -200,6 +221,7 @@ import adjDialog from "@/views/ams/inv/invLotLocId/adjDialog";
 export default {
   name: "InvLotLocId",
   components: { adjDialog },
+  dicts: ['sys_yes_no'],
   data() {
     return {
       // 遮罩层
@@ -229,7 +251,8 @@ export default {
         pageNum: 1,
         pageSize: 10,
         sku: null,
-        locationNo: null
+        locationNo: null,
+        isFull: null
       },
       // 表单参数
       form: {},
@@ -383,6 +406,10 @@ export default {
       this.download('ams/invLotLocId/export', {
         ...this.queryParams
       }, `invLotLocId_${new Date().getTime()}.xlsx`)
+    },
+    /** 库内理货*/
+    handleTally() {
+
     }
   }
 };

+ 5 - 4
ruoyi-ui/src/views/wms/docOrder/index.vue

@@ -361,10 +361,11 @@ export default {
       let obj = {}
       obj.orderNo = row.orderNo
       this.$modal.confirm('是否确认要进行分配库存').then(function() {
-        doAllocation(obj).then(response => {
-          this.$modal.msgSuccess(response.msg);
-          this.getList();
-        });
+        return doAllocation(obj);
+      }).then((data) => {
+        console.log(data)
+        this.getList();
+        this.$modal.msgSuccess(data.msg);
       }).catch(() => {});
     }
   }

+ 73 - 2
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -137,7 +137,7 @@ public class BusinessServiceImpl implements IBusinessService {
                         locationTo = locationAllocationStrategy.filterLockLocation(locationToList, token);
                         wcsTaskList.addAll(this.genTask(b.getLocationInfo(), locationTo, flowConfigHeaderVO, token));
                     }
-                } else if (flowConfigHeaderVO.getFlowType().equals("MV")) {
+                } else if (flowConfigHeaderVO.getFlowType().equals("MVCALL")) {
                     for (AgvCallItemDTO agvCall : agvCallDTO.getAgvCallItemDTOList()) {
                         Double totalQty = agvCall.getQty();
                         int trySize = 100;
@@ -201,6 +201,11 @@ public class BusinessServiceImpl implements IBusinessService {
                     }
                     //生成任务
                     this.genTask(locationFrom, locationTo, flowConfigHeaderVO, token);
+                } else if (flowConfigHeaderVO.getFlowType().equals("MV")) {
+                    AgvCallItemDTO agvCall = agvCallDTO.getAgvCallItemDTOList().get(0);
+                    locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "MV", asnSoStrategy, agvCall, token);
+                    locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "MV", asnSoStrategy, agvCall, token);
+                    wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, token));
                 }
             }
             return AjaxResult.success("任务下发成功");
@@ -209,6 +214,21 @@ public class BusinessServiceImpl implements IBusinessService {
         }
     }
 
+    @Override
+    public AjaxResult agvCall(FlowConfigHeaderVO flowConfigHeaderVO, AgvCallDTO agvCallDTO) {
+        List<AgvCallDTO> agvCallDTOList = new ArrayList<>();
+        List<AgvCallItemDTO> callItemDTOList = new ArrayList<>();
+        AgvCallItemDTO callItemDTO = new AgvCallItemDTO();
+        callItemDTO.setLocationFrom(agvCallDTO.getLocationFrom());
+        callItemDTO.setLocationTo(agvCallDTO.getLocationTo());
+        callItemDTO.setWarehouseId(agvCallDTO.getWarehouseId());
+        callItemDTO.setLotattDTO(new LotattDTO());
+        callItemDTOList.add(callItemDTO);
+        agvCallDTO.setAgvCallItemDTOList(callItemDTOList);
+        agvCallDTOList.add(agvCallDTO);
+        return businessService.agvCall(flowConfigHeaderVO, agvCallDTOList);
+    }
+
     @Transactional
     @Override
     public BaseLocationInfo inLocationAllocation(InWarehouseDTO inWarehouseDTO, Long token) {
@@ -358,7 +378,18 @@ public class BusinessServiceImpl implements IBusinessService {
             }
         } else { //移库
             if (locationType.equals("locationFrom")) {
-
+                //TODO 代码一样如果有新需求再加
+                for (BaseLocationInfo b : locationInfoList) {
+                    if (!b.getStockStatus().equals("00") || !b.getIsEmpty().equals("N") || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + b.getId())) {
+                        continue;
+                    }
+                    redisCache.lockCacheObject(RedisKey.LOCK_LOCATION + b.getId(), b.getId().toString(), token);
+                    locationInfo = b;
+                    break;
+                }
+                if (locationInfo == null) {
+                    throw new ServiceException("没有可以分配的库位", token);
+                }
             } else {
                 for (BaseLocationInfo b : locationInfoList) {
                     if (!b.getStockStatus().equals("00") || !b.getIsEmpty().equals("Y") || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + b.getId())) {
@@ -497,8 +528,48 @@ public class BusinessServiceImpl implements IBusinessService {
         }
     }
 
+    @Override
+    public AjaxResult addTaskList(List<WcsTask> wcsTaskList) {
+        for (WcsTask wcsTask : wcsTaskList) {
+            //锁定库位
+            if (!StringUtils.isEmpty(wcsTask.getLocationFrom())) {
+                baseLocationInfoService.updateLocationStockStatus(Long.parseLong(wcsTask.getLocationFrom()), Constant.STOCK_STATUS.STOCK10.getValue());
+            }
+            if (!StringUtils.isEmpty(wcsTask.getLocationTo())) {
+                baseLocationInfoService.updateLocationStockStatus(Long.parseLong(wcsTask.getLocationTo()), Constant.STOCK_STATUS.STOCK10.getValue());
+            }
+
+            Integer priority = 1;
+            if (!wcsTask.getTaskType().equals("OB")) {
+                if (wcsTask.getPriority() == 99) {
+                    int current = wcsTaskMapper.selectCurrentPriority();
+                    priority = current - 100;
+                } else {
+                    int current = wcsTaskMapper.selectCurrentPriority();
+                    priority = current + 10;
+                }
+            } else {
+                //倒库任务顺序由原任务中间插入不需要获取
+                priority = wcsTask.getPriority().intValue();
+            }
+            wcsTask.setPriority((long) priority);
+            int result = wcsTaskMapper.insertWcsTask(wcsTask);
+            if (result > 0) {
+                return AjaxResult.success("任务生成成功");
+            } else {
+                throw new ServiceException("任务生成失败");
+            }
+        }
+        return AjaxResult.success("");
+    }
+
     @Override
     public AjaxResult sendTask(WcsTask wcsTask) {
         return AjaxResult.success();
     }
+
+    @Override
+    public AjaxResult sendTaskList(List<WcsTask> wcsTaskList) {
+        return null;
+    }
 }

+ 22 - 0
warewms-ams/src/main/java/com/ruoyi/ams/business/IBusinessService.java

@@ -29,6 +29,14 @@ public interface IBusinessService {
      */
     AjaxResult agvCall(FlowConfigHeaderVO flowConfigHeaderVO, List<AgvCallDTO> agvCallDTOList);
 
+    /**
+     * AGV呼叫业务
+     * @param flowConfigHeaderVO
+     * @param agvCallDTO
+     * @return
+     */
+    AjaxResult agvCall(FlowConfigHeaderVO flowConfigHeaderVO, AgvCallDTO agvCallDTO);
+
     /**
      * 入库库位分配
      *
@@ -77,6 +85,13 @@ public interface IBusinessService {
      */
     AjaxResult addTask(WcsTask wcsTask);
 
+    /**
+     * 新增任务列表
+     * @param wcsTaskList
+     * @return
+     */
+    AjaxResult addTaskList(List<WcsTask> wcsTaskList);
+
     /**
      * 下发任务
      *
@@ -84,4 +99,11 @@ public interface IBusinessService {
      * @return
      */
     AjaxResult sendTask(WcsTask wcsTask);
+
+    /**
+     * 批量下发任务
+     * @param wcsTaskList
+     * @return
+     */
+    AjaxResult sendTaskList(List<WcsTask> wcsTaskList);
 }

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/form/InvLocIdSearchFrom.java

@@ -9,6 +9,7 @@ public class InvLocIdSearchFrom {
     private String sku;
     private String zoneId;
     private String locationNo;
+    private String isFull;
 
     public String getSku() {
         return sku;
@@ -33,4 +34,12 @@ public class InvLocIdSearchFrom {
     public void setLocationNo(String locationNo) {
         this.locationNo = locationNo;
     }
+
+    public String getIsFull() {
+        return isFull;
+    }
+
+    public void setIsFull(String isFull) {
+        this.isFull = isFull;
+    }
 }

+ 11 - 1
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java

@@ -244,7 +244,17 @@ public interface IInvLotLocIdService {
      *
      * @param locationFrom
      * @param locationTo
+     * @param lotnum
+     * @param qty
+     * @param boxNo
+     * @return
+     */
+    AjaxResult stockTransferPick(Long locationFrom, Long locationTo, String lotnum, BigDecimal qty, String boxNo);
+
+    /**
+     * 保存或者更新
+     * @param invLotLocId
      * @return
      */
-    AjaxResult stockTransferPick(Long locationFrom, Long locationTo, String lotnum, BigDecimal qty);
+    AjaxResult saveOrUpdate(InvLotLocId invLotLocId);
 }

+ 38 - 20
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -375,6 +375,22 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         return invLotLocIdMapper.insertInvLotLocId(invLotLocId);
     }
 
+    @Override
+    public AjaxResult saveOrUpdate(InvLotLocId invLotLocId) {
+        //TODO 如果相同就更新
+        InvLotLocId query = new InvLotLocId();
+        query.setLotnum(invLotLocId.getLotnum());
+        query.setSku(invLotLocId.getSku());
+        query.setLocationId(invLotLocId.getLocationId());
+        List<InvLotLocId> queryList = invLotLocIdService.selectInvLotLocIdList(query);
+        if (queryList == null || queryList.size() == 0) {
+            invLotLocIdMapper.insertInvLotLocId(invLotLocId);
+        } else {
+            invLotLocIdMapper.updateInvLotLocId(queryList.get(0));
+        }
+        return AjaxResult.success("");
+    }
+
     /**
      * 修改库位库存信息
      *
@@ -492,32 +508,34 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         return AjaxResult.success("解绑成功");
     }
 
+    @Transactional
     @Override
-    public AjaxResult stockTransferPick(Long locationFrom, Long locationTo, String lotnum, BigDecimal qty) {
+    public AjaxResult stockTransferPick(Long locationFrom, Long locationTo, String lotnum, BigDecimal qty, String boxNo) {
         List<InvLotLocId> invLotLocIds = invLotLocIdMapper.selectInvLotLocIdByLotnum(lotnum);
         if (invLotLocIds != null && invLotLocIds.size() > 0) {
             for (InvLotLocId inv : invLotLocIds) {
-                BigDecimal current = inv.getQty().subtract(inv.getQtyallocated());
-                if (current.compareTo(qty) == 1) { //大于
-                    BigDecimal temp = current.subtract(qty);
-                    InvLotLocId copy = new InvLotLocId();
-                    BeanUtils.copyProperties(inv, copy);
-                    copy.setLocationId(locationTo.toString());
-                    copy.setQty(temp);
-                    copy.setQtyEach(temp);
-                    invLotLocIdService.insertInvLotLocId(copy);
-
-                    inv.setQty(temp);
-                    inv.setQtyEach(temp);
-                    invLotLocIdService.updateInvLotLocId(inv);
-                    //TODO 进行退回
-                    return AjaxResult.success("操作成功");
-                } else { //小于
-                    invLotLocIdService.stockTransfer(locationFrom, locationTo);
-                    return AjaxResult.success("操作成功");
+                //TODO 多次拣货更新
+                BigDecimal invallqty = inv.getQtyallocated();
+                InvLotLocId copy = new InvLotLocId();
+                BeanUtils.copyProperties(inv, copy);
+                copy.setLocationId(locationTo.toString());
+                copy.setQty(qty);
+                copy.setQtyEach(qty);
+                copy.setQtyallocated(qty);
+                copy.setQtyallocatedEach(qty);
+                invLotLocIdService.insertInvLotLocId(copy);
+
+                BigDecimal invqty = inv.getQty();
+                inv.setQty(invqty.subtract(qty));
+                inv.setQtyEach(invqty.subtract(qty));
+                inv.setQtyallocated(inv.getQtyallocated().subtract(qty));
+                inv.setQtyallocatedEach(inv.getQtyallocatedEach().subtract(qty));
+                invLotLocIdService.updateInvLotLocId(inv);
+                if (invallqty.compareTo(qty) == 1 || invallqty.compareTo(qty) == 0) {
+                    break;
                 }
             }
-            throw new ServiceException("查询不到库存信息");
+            return AjaxResult.success("");
         } else {
             throw new ServiceException("查询不到库存信息");
         }

+ 3 - 2
warewms-ams/src/main/java/com/ruoyi/ams/order/form/ArrangeStockForm.java

@@ -4,9 +4,10 @@ import lombok.Data;
 
 @Data
 public class ArrangeStockForm {
-    private String allocationId;
+    //private String allocationId;
     private String orderNo;
-    private String palletNo;
+    private String palletNoFrom;
+    private String palletNoTo;
     //箱号
     private String boxNo;
     private String sn;

+ 79 - 16
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -1,11 +1,18 @@
 package com.ruoyi.ams.order.service.impl;
 
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.mapper.WmsBoxInfoMapper;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
+import com.ruoyi.ams.business.IBusinessService;
+import com.ruoyi.ams.config.domain.FlowConfigHeader;
+import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
+import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
+import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.mapper.InvLotAttMapper;
@@ -20,10 +27,16 @@ import com.ruoyi.ams.order.form.PickInfoForm;
 import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
 import com.ruoyi.ams.order.service.IActAllocationDetailsService;
 import com.ruoyi.ams.order.vo.StockOrderVO;
+import com.ruoyi.ams.task.domain.WcsTask;
+import com.ruoyi.ams.task.service.IWcsTaskService;
 import com.ruoyi.base.constant.Constant;
+import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.vo.CodeSkuRelationshipVO;
 import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.base.service.ICodeSkuRelationshipService;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.SecurityUtils;
 import com.ruoyi.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -60,7 +73,13 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
     @Autowired
     private InvLotAttMapper invLotAttMapper;
     @Autowired
+    private IBusinessService businessService;
+    @Autowired
     private IBaseLocationInfoService baseLocationInfoService;
+    @Autowired
+    private IFlowConfigHeaderService flowConfigHeaderService;
+    @Autowired
+    private ICodeSkuRelationshipService codeSkuRelationshipService;
 
     /**
      * 查询出库单头
@@ -184,10 +203,13 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         for (WmsDocOrderDetails o : orderDetails) {
             AjaxResult result = wmsDocOrderHeaderService.doAllocationDetails(orderHeader, o);
             if ((int) result.get(AjaxResult.CODE_TAG) != 500) {
+                isAllocation = true;
                 BigDecimal current = new BigDecimal(result.get(AjaxResult.DATA_TAG).toString());
                 total = total.subtract(current);
                 if (total.compareTo(BigDecimal.ZERO) == 1) {
                     isbf = true;
+                } else {
+                    isbf = false;
                 }
             }
         }
@@ -243,6 +265,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                             orderQty = orderQty.subtract(allocatedQty);
                             //修改出库单状态
                             details.setQtyAllocated(details.getQtyAllocated().add(allocatedQty));
+                            details.setQtyAllocatedEach(details.getQtyAllocatedEach().add(allocatedQty));
                             details.setLineStatus("10");
                             wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(details);
 
@@ -264,6 +287,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                             //修改出库单状态
                             details.setLineStatus("20");
                             details.setQtyAllocated(details.getQtyAllocated().add(allocatedQty));
+                            details.setQtyAllocatedEach(details.getQtyAllocatedEach().add(allocatedQty));
                             wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(details);
 
                             header.setOrderStatus("20");
@@ -277,6 +301,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                         BigDecimal currentQty = orderQty;
                         inv.setQtyallocated(inv.getQtyallocated().add(currentQty));
                         inv.setQtyallocatedEach(inv.getQtyallocatedEach().add(currentQty));
+                        details.setQtyAllocatedEach(details.getQtyAllocatedEach().add(currentQty));
                         if (invLotLocIdService.updateInvLotLocId(inv) > 0) {
                             //修改出库单状态
                             details.setLineStatus("10");
@@ -301,14 +326,12 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
     @Override
     public AjaxResult toPick(PickForm pickForm) {
         List<PickInfoForm> pickInfoFormList = pickForm.getPickInfoFormList();
+        Map<String, String> exitsMap = new HashMap<>();
         for (PickInfoForm p : pickInfoFormList) {
             String locationTo = p.getLocationTo();
-            if (StringUtils.isEmpty(locationTo)) {
-                //TODO 分配可用库位
-            }
-
-            //查询对应的分配明细表
+            //TODO 任务完成后更新 查询对应的分配明细表
             ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(p.getAllocationId());
+            String location = actAllocationDetails.getLocationId().toString();
             //qty = actAllocationDetails.getPickQty();
             //actAllocationDetails.setPickQty(actAllocationDetails.getPickQty().add(new BigDecimal(p.getQty())));
             //actAllocationDetails.setPickToLocation(locationTo);
@@ -330,8 +353,21 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             invLotLocIdService.stockTransfer(actAllocationDetails.getLocationId(), Long.parseLong(locationTo));
             //托盘进行绑定修改
             wmsBoxInfoMapper.updateLocationBind(actAllocationDetails.getLocationId(), Long.parseLong(locationTo), null);
-            //TODO 是否需要生成任务
-
+            if (!exitsMap.containsKey(location)) {
+                exitsMap.put(location, location);
+                //生成任务退回
+                FlowConfigHeaderVO flowConfigHeader = flowConfigHeaderService.selectFlowConfigHeaderById(4L);
+                AgvCallDTO agvCallDTO = new AgvCallDTO();
+                agvCallDTO.setId(flowConfigHeader.getId());
+                agvCallDTO.setLocationFrom(location);
+                agvCallDTO.setLocationTo(p.getLocationTo());
+                agvCallDTO.setPalletNo(actAllocationDetails.getUserdefine1());
+                agvCallDTO.setWarehouseId(Constant.WAREHOUSE_ID);
+                AjaxResult result = businessService.agvCall(flowConfigHeader, agvCallDTO);
+                if ((int) result.get(AjaxResult.CODE_TAG) == 500) {
+                    throw new ServiceException("任务生成失败");
+                }
+            }
         }
         return AjaxResult.success("操作成功");
     }
@@ -413,15 +449,42 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
     @Transactional
     @Override
     public AjaxResult arrangeStock(ArrangeStockForm arrangeStockForm) {
-        //把拣货库位上的库存移动到一个新的托盘上
-        ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(arrangeStockForm.getAllocationId());
-        WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(arrangeStockForm.getPalletNo());
-        //修改托盘状态
-        wmsBoxInfo.setIsFull("N");
-        wmsBoxInfoService.updateWmsBoxInfo(wmsBoxInfo);
-        //库存进行移动
-        invLotLocIdService.stockTransferPick(Long.parseLong(actAllocationDetails.getPickToLocation()), wmsBoxInfo.getLocationId(), actAllocationDetails.getLotnum(), new BigDecimal(arrangeStockForm.getQty()));
-        //TODO 生成任务退回
+        //查询托盘
+        WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(arrangeStockForm.getPalletNoTo());
+        //物料绑定关系
+        CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(arrangeStockForm.getSn());
+        String sku = codeSkuRelationshipVO.getSku();
+        //查询分配记录
+        ActAllocationDetails query = new ActAllocationDetails();
+        query.setMaterial(sku);
+        query.setOrderNo(arrangeStockForm.getOrderNo());
+        query.setUserdefine1(arrangeStockForm.getPalletNoFrom());
+        List<ActAllocationDetails> actAllocationDetailsList = actAllocationDetailsService.selectActAllocationDetailsList(query);
+        if (actAllocationDetailsList == null || actAllocationDetailsList.size() == 0) {
+            return AjaxResult.error("查询不到分配记录");
+        }
+        for (ActAllocationDetails actAllocationDetails : actAllocationDetailsList) {
+            //把拣货库位上的库存移动到一个新的托盘上
+            actAllocationDetails.setPickToLocation(wmsBoxInfo.getLocationId().toString());
+            actAllocationDetails.setPickQty(new BigDecimal(arrangeStockForm.getQty()));
+            actAllocationDetails.setStatus("40");
+            actAllocationDetailsService.updateActAllocationDetails(actAllocationDetails);
+            //修改托盘状态
+            wmsBoxInfo.setIsFull("N");
+            wmsBoxInfo.setUserdefine1(arrangeStockForm.getBoxNo());
+            wmsBoxInfoService.updateWmsBoxInfo(wmsBoxInfo);
+            //库存进行移动
+            invLotLocIdService.stockTransferPick(actAllocationDetails.getLocationId(), wmsBoxInfo.getLocationId(), actAllocationDetails.getLotnum(), new BigDecimal(arrangeStockForm.getQty()), arrangeStockForm.getBoxNo());
+        }
         return AjaxResult.success("操作成功");
+        //ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(arrangeStockForm.getAllocationId());
+        //生成任务退回
+        /*FlowConfigHeaderVO flowConfigHeader = flowConfigHeaderService.selectFlowConfigHeaderById(3L);
+        AgvCallDTO agvCallDTO = new AgvCallDTO();
+        agvCallDTO.setId(flowConfigHeader.getId());
+        agvCallDTO.setLocationFrom(actAllocationDetails.getLocationId().toString());
+        agvCallDTO.setPalletNo(arrangeStockForm.getPalletNo());
+        agvCallDTO.setWarehouseId(Constant.WAREHOUSE_ID);
+        return businessService.agvCall(flowConfigHeader, agvCallDTO);*/
     }
 }

+ 62 - 54
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -266,24 +266,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <where>
             <if test="sku != null  and sku != ''"> and sk.sku = #{sku}</if>
             <if test="skuType != null  and skuType != ''"> and skt.item_code = #{skuType}</if>
-            <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
-            <if test="lotattDTO.lotatt02 != null  and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
-            <if test="lotattDTO.lotatt03 != null  and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
-            <if test="lotattDTO.lotatt04 != null  and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
-            <if test="lotattDTO.lotatt05 != null  and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
-            <if test="lotattDTO.lotatt06 != null  and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
-            <if test="lotattDTO.lotatt07 != null  and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
-            <if test="lotattDTO.lotatt08 != null  and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
-            <if test="lotattDTO.lotatt09 != null  and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
-            <if test="lotattDTO.lotatt10 != null  and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
-            <if test="lotattDTO.lotatt11 != null  and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
-            <if test="lotattDTO.lotatt12 != null  and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
-            <if test="lotattDTO.lotatt13 != null  and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
-            <if test="lotattDTO.lotatt14 != null  and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
-            <if test="lotattDTO.lotatt15 != null  and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
-            <if test="lotattDTO.lotatt16 != null  and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
-            <if test="lotattDTO.lotatt17 != null  and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
-            <if test="lotattDTO.lotatt18 != null  and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
+            <if test="lotattDTO != null">
+                <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
+                <if test="lotattDTO.lotatt02 != null  and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
+                <if test="lotattDTO.lotatt03 != null  and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
+                <if test="lotattDTO.lotatt04 != null  and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
+                <if test="lotattDTO.lotatt05 != null  and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
+                <if test="lotattDTO.lotatt06 != null  and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
+                <if test="lotattDTO.lotatt07 != null  and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
+                <if test="lotattDTO.lotatt08 != null  and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
+                <if test="lotattDTO.lotatt09 != null  and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
+                <if test="lotattDTO.lotatt10 != null  and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
+                <if test="lotattDTO.lotatt11 != null  and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
+                <if test="lotattDTO.lotatt12 != null  and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
+                <if test="lotattDTO.lotatt13 != null  and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
+                <if test="lotattDTO.lotatt14 != null  and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
+                <if test="lotattDTO.lotatt15 != null  and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
+                <if test="lotattDTO.lotatt16 != null  and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
+                <if test="lotattDTO.lotatt17 != null  and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
+                <if test="lotattDTO.lotatt18 != null  and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
+            </if>
         </where>
         and bz.userdefine1 = 'INV'
     </select>
@@ -299,10 +301,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join base_sku_type skt on sk.sku_type = skt.item_code
         left join (select dict_label,dict_value from sys_dict_data where dict_type = 'ams_inv_quality') lot05_dict on att.lotatt05 = lot05_dict.dict_value
         left join (select * from base_supplier) supp on att.lotatt06 = supp.supplier_id
+        left join wms_box_info w on inv.location_id = w.location_id
         <where>
             <if test="zoneId != null  and zoneId != ''"> and b.zone_id = #{zoneId}</if>
             <if test="sku != null  and sku != ''"> and (sk.sku like concat('%', #{sku}, '%') or sk.desc1 like concat('%', #{sku}, '%'))</if>
             <if test="locationNo != null  and locationNo != ''"> and b.location_no like concat('%', #{locationNo}, '%')</if>
+            <if test="isFull != null  and isFull != ''"> and w.is_full = #{isFull}</if>
         </where>
         order by lpad(b.row_no, 11, '0'),b.row_index,lpad(b.shift_no, 11, '0'),b.shift_index,lpad(b.col_no, 11, '0'),b.col_index desc
     </select>
@@ -349,24 +353,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join base_location_zone bz on b.zone_id = bz.zone_id
         <where>
             <if test="sku != null  and sku != ''"> and sk.sku = #{sku}</if>
-            <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
-            <if test="lotattDTO.lotatt02 != null  and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
-            <if test="lotattDTO.lotatt03 != null  and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
-            <if test="lotattDTO.lotatt04 != null  and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
-            <if test="lotattDTO.lotatt05 != null  and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
-            <if test="lotattDTO.lotatt06 != null  and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
-            <if test="lotattDTO.lotatt07 != null  and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
-            <if test="lotattDTO.lotatt08 != null  and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
-            <if test="lotattDTO.lotatt09 != null  and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
-            <if test="lotattDTO.lotatt10 != null  and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
-            <if test="lotattDTO.lotatt11 != null  and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
-            <if test="lotattDTO.lotatt12 != null  and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
-            <if test="lotattDTO.lotatt13 != null  and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
-            <if test="lotattDTO.lotatt14 != null  and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
-            <if test="lotattDTO.lotatt15 != null  and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
-            <if test="lotattDTO.lotatt16 != null  and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
-            <if test="lotattDTO.lotatt17 != null  and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
-            <if test="lotattDTO.lotatt18 != null  and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
+            <if test="lotattDTO != null">
+                <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
+                <if test="lotattDTO.lotatt02 != null  and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
+                <if test="lotattDTO.lotatt03 != null  and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
+                <if test="lotattDTO.lotatt04 != null  and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
+                <if test="lotattDTO.lotatt05 != null  and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
+                <if test="lotattDTO.lotatt06 != null  and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
+                <if test="lotattDTO.lotatt07 != null  and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
+                <if test="lotattDTO.lotatt08 != null  and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
+                <if test="lotattDTO.lotatt09 != null  and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
+                <if test="lotattDTO.lotatt10 != null  and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
+                <if test="lotattDTO.lotatt11 != null  and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
+                <if test="lotattDTO.lotatt12 != null  and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
+                <if test="lotattDTO.lotatt13 != null  and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
+                <if test="lotattDTO.lotatt14 != null  and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
+                <if test="lotattDTO.lotatt15 != null  and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
+                <if test="lotattDTO.lotatt16 != null  and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
+                <if test="lotattDTO.lotatt17 != null  and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
+                <if test="lotattDTO.lotatt18 != null  and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
+            </if>
             and bz.zone_id  in
             <foreach  item="item" index="index" collection="zoneIdList" open="(" separator="," close=" )">
                 #{item}
@@ -386,24 +392,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join base_location_zone bz on b.zone_id = bz.zone_id
         <where>
             <if test="sku != null  and sku != ''"> and sk.sku = #{sku}</if>
-            <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
-            <if test="lotattDTO.lotatt02 != null  and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
-            <if test="lotattDTO.lotatt03 != null  and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
-            <if test="lotattDTO.lotatt04 != null  and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
-            <if test="lotattDTO.lotatt05 != null  and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
-            <if test="lotattDTO.lotatt06 != null  and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
-            <if test="lotattDTO.lotatt07 != null  and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
-            <if test="lotattDTO.lotatt08 != null  and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
-            <if test="lotattDTO.lotatt09 != null  and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
-            <if test="lotattDTO.lotatt10 != null  and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
-            <if test="lotattDTO.lotatt11 != null  and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
-            <if test="lotattDTO.lotatt12 != null  and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
-            <if test="lotattDTO.lotatt13 != null  and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
-            <if test="lotattDTO.lotatt14 != null  and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
-            <if test="lotattDTO.lotatt15 != null  and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
-            <if test="lotattDTO.lotatt16 != null  and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
-            <if test="lotattDTO.lotatt17 != null  and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
-            <if test="lotattDTO.lotatt18 != null  and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
+            <if test="lotattDTO != null">
+                <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
+                <if test="lotattDTO.lotatt02 != null  and lotattDTO.lotatt02 != ''"> and att.lotatt02 = #{lotattDTO.lotatt02}</if>
+                <if test="lotattDTO.lotatt03 != null  and lotattDTO.lotatt03 != ''"> and att.lotatt03 = #{lotattDTO.lotatt03}</if>
+                <if test="lotattDTO.lotatt04 != null  and lotattDTO.lotatt04 != ''"> and att.lotatt04 = #{lotattDTO.lotatt04}</if>
+                <if test="lotattDTO.lotatt05 != null  and lotattDTO.lotatt05 != ''"> and att.lotatt05 = #{lotattDTO.lotatt05}</if>
+                <if test="lotattDTO.lotatt06 != null  and lotattDTO.lotatt06 != ''"> and att.lotatt06 = #{lotattDTO.lotatt06}</if>
+                <if test="lotattDTO.lotatt07 != null  and lotattDTO.lotatt07 != ''"> and att.lotatt07 = #{lotattDTO.lotatt07}</if>
+                <if test="lotattDTO.lotatt08 != null  and lotattDTO.lotatt08 != ''"> and att.lotatt08 = #{lotattDTO.lotatt08}</if>
+                <if test="lotattDTO.lotatt09 != null  and lotattDTO.lotatt09 != ''"> and att.lotatt09 = #{lotattDTO.lotatt09}</if>
+                <if test="lotattDTO.lotatt10 != null  and lotattDTO.lotatt10 != ''"> and att.lotatt10 = #{lotattDTO.lotatt10}</if>
+                <if test="lotattDTO.lotatt11 != null  and lotattDTO.lotatt11 != ''"> and att.lotatt11 = #{lotattDTO.lotatt11}</if>
+                <if test="lotattDTO.lotatt12 != null  and lotattDTO.lotatt12 != ''"> and att.lotatt12 = #{lotattDTO.lotatt12}</if>
+                <if test="lotattDTO.lotatt13 != null  and lotattDTO.lotatt13 != ''"> and att.lotatt13 = #{lotattDTO.lotatt13}</if>
+                <if test="lotattDTO.lotatt14 != null  and lotattDTO.lotatt14 != ''"> and att.lotatt14 = #{lotattDTO.lotatt14}</if>
+                <if test="lotattDTO.lotatt15 != null  and lotattDTO.lotatt15 != ''"> and att.lotatt15 = #{lotattDTO.lotatt15}</if>
+                <if test="lotattDTO.lotatt16 != null  and lotattDTO.lotatt16 != ''"> and att.lotatt16 = #{lotattDTO.lotatt16}</if>
+                <if test="lotattDTO.lotatt17 != null  and lotattDTO.lotatt17 != ''"> and att.lotatt17 = #{lotattDTO.lotatt17}</if>
+                <if test="lotattDTO.lotatt18 != null  and lotattDTO.lotatt18 != ''"> and att.lotatt18 = #{lotattDTO.lotatt18}</if>
+            </if>
             and b.id = #{locationId}
             group by sk.sku
         </where>