Browse Source

测试修改

k 2 years ago
parent
commit
69324f3f61

+ 37 - 5
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaController.java

@@ -113,6 +113,9 @@ public class PdaController {
     public AjaxResult stock(@RequestBody StockForm stockForm) {
         // ERP号转换为wms系统入库单号ASNNO
         List<String> asnNoList = wmsDocAsnHeaderService.changeErpNoToAsnNo(stockForm.getAsnNo());
+        if (asnNoList.size() == 0) {
+            return AjaxResult.error("请扫描正确的入库单号");
+        }
         stockForm.setAsnNo(asnNoList);
         if (stockForm.getStockTag().equals("Y") && StringUtils.isEmpty(stockForm.getOrderNo())) {
             return AjaxResult.error("码盘备货必须输入出库单号");
@@ -130,6 +133,9 @@ public class PdaController {
     public AjaxResult snCheck(@Validated @RequestBody SnCheckForm snCheckForm) {
         // ERP号转换为wms系统入库单号ASNNO
         List<String> asnNoList = wmsDocAsnHeaderService.changeErpNoToAsnNo(snCheckForm.getAsnNoList());
+        if (asnNoList.size() == 0) {
+            return AjaxResult.error("请扫描正确的入库单号");
+        }
         snCheckForm.setAsnNoList(asnNoList);
         CodeSkuRelationshipVO codeSkuRelationshipVO = wmsDocAsnHeaderService.searchSn(snCheckForm);
         return AjaxResult.success(codeSkuRelationshipVO);
@@ -189,9 +195,14 @@ public class PdaController {
                 paForm.setPalletNo(lform.getPalletNo());
                 paForm.setLocationFrom(Constant.LOC_STAGE_CACHE.toString());
                 paForm.setLocationTo(lform.getLocationFrom());
-                doPa(paForm);
+                paForm.setFlowId(lineCallForm.getFlowId().intValue());
+                AjaxResult ajaxResult = doPa(paForm);
+                if (!ajaxResult.isSuccess()) {
+                    return ajaxResult;
+                }
             }
 
+
             if (flowConfigHeaderVO.getFlowType().equals("ASN") && org.apache.commons.lang3.StringUtils.isEmpty(lform.getLocationFrom())) {
                 return AjaxResult.error("入库任务必须选择起始库位");
             }
@@ -304,6 +315,9 @@ public class PdaController {
     public AjaxResult docAsnInfo(@RequestParam String asnNo) {
         // ERP号转换为wms系统入库单号ASNNO
         String endAsnNo = wmsDocAsnHeaderService.changeErpNoToAsnNo(asnNo);
+        if (StringUtils.isEmpty(endAsnNo)) {
+            return AjaxResult.error("请扫描正确的入库单号");
+        }
         WmsDocAsnHeader header = wmsDocAsnHeaderService.selectWmsDocAsnHeaderByAsnNo(endAsnNo);
         return AjaxResult.success(header);
     }
@@ -318,6 +332,9 @@ public class PdaController {
     public AjaxResult stockingList(@RequestBody StockingListForm stockingListForm) {
         // ERP号转换为wms系统入库单号ASNNO
         List<String> asnNoList = wmsDocAsnHeaderService.changeErpNoToAsnNo(stockingListForm.getAsnNoList());
+        if (asnNoList.size() == 0) {
+            return AjaxResult.error("请扫描正确的入库单号");
+        }
         stockingListForm.setAsnNoList(asnNoList);
         List<WmsDocAsnDetails> detailsList = wmsDocAsnHeaderService.selectStockingList(stockingListForm.getAsnNoList());
         return AjaxResult.success(detailsList);
@@ -338,6 +355,9 @@ public class PdaController {
     public AjaxResult doAllocation(@RequestParam String orderNos) {
         List<String> orderList = JSONArray.parseArray(orderNos, String.class);
         List<String> orderNoList = wmsDocOrderHeaderService.changeErpNoToOrderNo(orderList);
+        if (orderNoList.size() == 0) {
+            return AjaxResult.error("请扫描正确的出库单号");
+        }
         return wmsDocOrderHeaderService.doAllocation(orderNoList);
     }
 
@@ -350,6 +370,9 @@ public class PdaController {
     public AjaxResult checkOutList(@RequestParam String orderNos) {
         List<String> orderList = JSONArray.parseArray(orderNos, String.class);
         List<String> orderNoList = wmsDocOrderHeaderService.changeErpNoToOrderNo(orderList);
+        if (orderNoList.size() == 0) {
+            return AjaxResult.error("请扫描正确的出库单号");
+        }
         List<CheckOutVO> checkOutVOList = wmsDocOrderHeaderService.checkOutList(orderNoList);
         return AjaxResult.success(checkOutVOList);
     }
@@ -375,6 +398,9 @@ public class PdaController {
     public AjaxResult toPick(@Validated @RequestBody PickForm pickForm) {
         // ERP号转换为wms系统出库单号orderNo
         String orderNo = wmsDocOrderHeaderService.changeErpNoToOrderNo(pickForm.getOrderNo());
+        if (StringUtils.isEmpty(orderNo)) {
+            return AjaxResult.error("请扫描正确的出库单号");
+        }
         pickForm.setOrderNo(orderNo);
         if (StringUtils.isEmpty(orderNo)) {
             return AjaxResult.error("请扫描正确的出库单号!");
@@ -391,6 +417,9 @@ public class PdaController {
     public AjaxResult groupDisk(GroupDiskFrom groupDiskFrom) {
         if (StringUtils.isNotEmpty(groupDiskFrom.getOrderNo())) {
             String orderNo = wmsDocOrderHeaderService.changeErpNoToOrderNo(groupDiskFrom.getOrderNo());
+            if (StringUtils.isEmpty(orderNo)) {
+                return AjaxResult.error("请扫描正确的出库单号");
+            }
             groupDiskFrom.setOrderNo(orderNo);
         }
         return wmsDocOrderHeaderService.groupDisk(groupDiskFrom);
@@ -404,6 +433,9 @@ public class PdaController {
     @PostMapping("/docOrder/arrangeStock")
     public AjaxResult arrangeStock(@RequestBody ArrangeStockForm arrangeStockForm) {
         String orderNo = wmsDocOrderHeaderService.changeErpNoToOrderNo(arrangeStockForm.getOrderNo());
+        if (StringUtils.isEmpty(orderNo)) {
+            return AjaxResult.error("请扫描正确的出库单号");
+        }
         arrangeStockForm.setOrderNo(orderNo);
         return wmsDocOrderHeaderService.arrangeStock(arrangeStockForm);
     }
@@ -439,10 +471,10 @@ public class PdaController {
      * @param locationId
      * @return
      */
-    @PostMapping("/docOrder/locationUntie")
-    public AjaxResult locationUntie(String locationId) {
-        return invLotLocIdService.clear(locationId, Constant.WAREHOUSE_ID, "PDA");
-    }
+//    @PostMapping("/docOrder/locationUntie")
+//    public AjaxResult locationUntie(String locationId) {
+//        return invLotLocIdService.clear(locationId, Constant.WAREHOUSE_ID, "PDA");
+//    }
 
     /**
      * 条码检测(出库)

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysConfigServiceImpl.java

@@ -218,6 +218,9 @@ public class SysConfigServiceImpl implements ISysConfigService {
         SysConfig sysConfigQuery = new SysConfig();
         sysConfigQuery.setConfigKey(gratingConfigKey);
         SysConfig sysConfig = this.selectByConfigKey(sysConfigQuery);
+        if (sysConfig.getConfigName().contains("关")) {
+            return false;
+        }
 
         // 检测之前需要开启检测开关
         SysConfig sysConfigUpdate = new SysConfig();

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

@@ -133,7 +133,7 @@
       <!--<el-table-column label="lotnum" align="center" prop="lotnum" width="200"/>-->
       <el-table-column type="selection" />
       <el-table-column label="库区" align="center" prop="zoneName"/>
-      <el-table-column label="库位" align="center" prop="locationNo"/>
+      <el-table-column label="库位" align="center" prop="locationNo"width="150"/>
 <!--      <el-table-column label="托盘号" align="center" prop="palletNo"/>-->
       <el-table-column label="物料编号" align="center" prop="sku" width="200"/>
       <el-table-column label="物料名称" align="center" prop="skuName" width="200"/>
@@ -147,7 +147,7 @@
         v-for="(item, index) in tableOption"
         :key="index"
         :label="item.label"
-        align="center" :prop="item.prop" width="200">
+        align="center" :prop="item.prop" width="150">
       </el-table-column>
       <el-table-column label="备注" align="center" prop="remark" />
       <!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">

+ 3 - 3
ruoyi-ui/src/views/ams/inv/locationView/index.vue

@@ -34,9 +34,9 @@
                 </div>
                 <div v-show="o.isEmpty=='N'" :class="{'locDiv': true,'colorRed': o.isEmptyPlate != 'Y', 'colorYellow': o.stockStatus!='00'}">
                   <div class="divMinFontBox" v-show="o.isEmpty=='N' && o.isEmptyPlate != 'Y' ">
-<!--                    <div style="color: #FFFFFF;font-size:10px;">{{o.lotatt01}}&nbsp;&nbsp; </div>-->
-                    <div v-show="o.skuName!=null" style="color: #FFFFFF;font-size:10px;">{{o.skuName}}</div>
-<!--                    <div v-show="o.lotatt01!=null" style="color: #FFFFFF">{{o.lotatt01}}</div>-->
+                    <div style="color: #FFFFFF;font-size:10px;">{{o.lotatt07}}&nbsp;&nbsp; </div>
+                    <div v-show="o.sku!=null" style="color: #FFFFFF;font-size:10px;">{{o.sku}}</div>
+                    <div v-show="o.lotatt02!=null" style="color: #FFFFFF;font-size:10px;">{{o.lotatt02}}</div>
 <!--                    <div v-show="o.lotatt05!=null" style="color: #FFFFFF">{{o.lotatt05}}</div>-->
 <!--                    <div v-show="o.lotatt08!=null" style="color: #FFFFFF">{{o.lotatt08}}</div>-->
                   </div>

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

@@ -106,8 +106,9 @@
       </el-table-column>
       <el-table-column label="分配数量" align="center" prop="qty" />
       <el-table-column label="拣货数量" align="center" prop="pickQty" />
-      <el-table-column label="已拣库位" align="center" prop="pickToLocation" />
-      <el-table-column label="拣货事务" align="center" prop="pickTransactionId" />
+      <el-table-column label="待检库位" align="center" prop="locationId" />
+<!--      <el-table-column label="已拣库位" align="center" prop="pickToLocation" />-->
+<!--      <el-table-column label="拣货事务" align="center" prop="pickTransactionId" />-->
       <el-table-column
         v-for="(item, index) in tableOption"
         :key="index"
@@ -115,8 +116,7 @@
         align="center" :prop="item.prop" width="200">
       </el-table-column>
       <el-table-column label="lotnum" align="center" prop="lotnum" />
-      <!--<el-table-column label="待检库位" align="center" prop="locationId" />
-      <el-table-column label="叫料待检事务id" align="center" prop="callTransactionId" />-->
+      <!--<el-table-column label="叫料待检事务id" align="center" prop="callTransactionId" />-->
       <el-table-column label="创建时间" align="center" prop="createDate" width="180">
         <template slot-scope="scope">
           <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d}') }}</span>

+ 1 - 1
ruoyi-ui/src/views/wms/docOrder/docOrderHeader-add-or-update.vue

@@ -100,7 +100,7 @@
         roleList: [],
         dataFormHead: {
           orderNo: '',
-          orderType: 'OD',
+          orderType: 'ZC',
           orderStatus: '',
           shipmentTime: '',
           soReference1: '',

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/asn/form/PaForm.java

@@ -7,4 +7,8 @@ public class PaForm {
     private String palletNo;
     private String locationFrom;
     private String locationTo;
+    /**
+     * 5 入库 9 回库
+     */
+    private int flowId;
 }

+ 51 - 23
warewms-ams/src/main/java/com/ruoyi/ams/asn/service/impl/WmsDocAsnHeaderServiceImpl.java

@@ -26,6 +26,7 @@ import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.ams.order.domain.WmsDocOrderDetails;
 import com.ruoyi.ams.order.domain.WmsDocOrderHeader;
 import com.ruoyi.ams.order.dto.WmsDocOrderDTO;
+import com.ruoyi.ams.order.form.ActAllocationDetailsFrom;
 import com.ruoyi.ams.order.mapper.WmsDocOrderDetailsMapper;
 import com.ruoyi.ams.order.service.IActAllocationDetailsService;
 import com.ruoyi.ams.order.service.IWmsDocOrderHeaderService;
@@ -391,11 +392,11 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
         if (stockForm.getAsnNo() != null && stockForm.getAsnNo().size() > 0) {
             List<WmsDocAsnDetails> list = wmsDocAsnDetailsMapper.selectDetailsListByAsnNos(stockForm.getAsnNo(), codeSkuRelationshipVO.getSku());
             if (list == null || list.size() == 0) {
-                return AjaxResult.error("没有可以接收的入库单");
+                return AjaxResult.error("没有可以接收的入库单,产品 :" + codeSkuRelationshipVO.getSku());
             } else {
                 for (WmsDocAsnDetails details : list) {
                     // 成品条码,扫码新托盘的时候,自动解绑老托盘数据。
-                    if(codeSkuRelationshipVO.isProduct()) {
+                    if (codeSkuRelationshipVO.isProduct()) {
                         InvLotAtt attQuery = new InvLotAtt();
                         attQuery.setSku(codeSkuRelationshipVO.getSku());
 //                        attQuery.setLotatt07(stockForm.getPalletNo());
@@ -437,10 +438,10 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
                             String asnStatus;
                             if (details.getExpectedQty().compareTo(details.getReceivedQty().add(current)) == 1) {
                                 //部分接收
-                                asnStatus = "30";
+                                asnStatus = Constant.ASN_STS.STS30.getValue();
                             } else {
                                 //接收完成
-                                asnStatus = "40";
+                                asnStatus = Constant.ASN_STS.STS40.getValue();
                             }
                             //更新入库单接收数量及状态
                             int result = wmsDocAsnDetailsMapper.updateWmsReceivedQty(details.getAsnNo(), details.getAsnLineNo().intValue(), current, asnStatus);
@@ -464,8 +465,8 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
                             detailsQuery.setAsnNo(details.getAsnNo());
                             List<WmsDocAsnDetails> detailsCheckList = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(detailsQuery);
                             for (WmsDocAsnDetails d : detailsCheckList) {
-                                if (!d.getLineStatus().equals("40")) {
-                                    asnStatus = "30";
+                                if (!d.getLineStatus().equals(Constant.ASN_STS.STS40.getValue())) {
+                                    asnStatus = Constant.ASN_STS.STS30.getValue();
                                     break;
                                 }
                             }
@@ -478,9 +479,9 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
 
                             //生成库存
                             LotattDTO lotattDTO = new LotattDTO();
-                            if (codeSkuRelationshipVO.isProduct()) {
+//                            if (codeSkuRelationshipVO.isProduct()) {
                                 lotattDTO.setLotatt02(stockForm.getSkuSn());
-                            }
+//                            }
                             lotattDTO.setLotatt05("90");
                             lotattDTO.setLotatt07(stockForm.getPalletNo());
                             lotattDTO.setLotatt08(details.getAsnNo());
@@ -525,6 +526,8 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
     @Transactional
     @Override
     public AjaxResult doPa(PaForm paForm) {
+        int flowId = paForm.getFlowId();
+        LoginUser loginUser = SecurityUtils.getLoginUser();
         //绑定托盘
         String palletNo = paForm.getPalletNo();
         WmsBoxInfo wmsBoxInfo = new WmsBoxInfo();
@@ -533,18 +536,19 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
         if (wmsBoxInfo == null) {
             throw new ServiceException("托盘不存在");
         }
-
-        BaseLocationInfo locationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(paForm.getLocationTo(),Constant.WAREHOUSE_ID);
-        if (locationTo != null) {
-            locationTo.setIsEmpty("N");
-            baseLocationInfoService.updateBaseLocationInfo(locationTo);
-        }
+        BaseLocationInfo locationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(paForm.getLocationTo(), Constant.WAREHOUSE_ID);
 
         //获取库存当前的托盘位置
         InvLotAtt lotAtt = new InvLotAtt();
         lotAtt.setLotatt07(paForm.getPalletNo());
         List<InvLotLocId> invLotLocIdList = invLotLocIdService.queryInvByInvLotatt(lotAtt);
         for (InvLotLocId inv : invLotLocIdList) {
+            // 判断上架的库存是否已经上架
+            BaseLocationInfo baseLocInfo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(inv.getLocationId(), Constant.WAREHOUSE_ID);
+            if (baseLocInfo.getZoneId().equals(Constant.ZONE_TYPE.ZONE_INV.getValue())) {
+                return AjaxResult.error("库存已经在货架上:" + baseLocInfo.getLocationNo());
+            }
+
             InvLotAtt invLotAtt = invLotAttService.selectInvLotAttByLotnum(inv.getLotnum());
             invLotAtt.setLotatt12("Y");
             invLotAttService.updateInvLotAtt(invLotAtt);
@@ -554,20 +558,44 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
             //invLotLocIdMapper.updateInvLotLocIdLocationId(Long.parseLong(inv.getLocationId()), Long.parseLong(paForm.getLocationTo()));
             invLotLocIdMapper.updateInvLotLocIdToByLotnum(inv.getLotnum(), locationTo.getId());
 
+            // 回库不修改入库单据
+            if (flowId == Constant.FLOW_ID_RSO) {
+                continue;
+            }
+
+            // 修改入库单状态
             WmsDocAsnDetails query = new WmsDocAsnDetails();
             query.setAsnNo(invLotAtt.getLotatt08());
             query.setSku(invLotAtt.getSku());
             List<WmsDocAsnDetails> detailsList = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(query);
             if (detailsList != null && detailsList.size() > 0) {
                 for (WmsDocAsnDetails de : detailsList) {
-                    de.setLineStatus("60");
+                    de.setLineStatus(Constant.ASN_STS.STS60.getValue());
                     wmsDocAsnDetailsMapper.updateWmsDocAsnDetails(de);
                 }
             }
-            WmsDocAsnHeader updateStatus = new WmsDocAsnHeader();
-            updateStatus.setAsnStatus("99");
-            updateStatus.setAsnNo(invLotAtt.getLotatt08());
-            wmsDocAsnHeaderMapper.updateWmsDocAsnHeader(updateStatus);
+            //修改头单状态
+            String asnStatus = Constant.ASN_STS.STS99.getValue();
+            WmsDocAsnDetails detailsQuery = new WmsDocAsnDetails();
+            detailsQuery.setAsnNo(invLotAtt.getLotatt08());
+            List<WmsDocAsnDetails> detailsCheckList = wmsDocAsnDetailsMapper.selectWmsDocAsnDetailsList(detailsQuery);
+            for (WmsDocAsnDetails d : detailsCheckList) {
+                if (!d.getLineStatus().equals(Constant.ASN_STS.STS60.getValue())) {
+                    asnStatus = Constant.ASN_STS.STS50.getValue();
+                    break;
+                }
+            }
+            WmsDocAsnHeader headerUpdate = new WmsDocAsnHeader();
+            headerUpdate.setAsnNo(invLotAtt.getLotatt08());
+            headerUpdate.setAsnStatus(asnStatus);
+            headerUpdate.setUpdateBy(loginUser.getUsername());
+            headerUpdate.setUpdateTime(new Date());
+            wmsDocAsnHeaderMapper.updateWmsDocAsnHeader(headerUpdate);
+        }
+
+        if (locationTo != null) {
+            locationTo.setIsEmpty("N");
+            baseLocationInfoService.updateBaseLocationInfo(locationTo);
         }
 
         wmsBoxInfo.setLocationId(locationTo.getId());
@@ -706,7 +734,7 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
             details.setdEdi04(erpOrder.getVaild());         //单据状态
             details.setdEdi05(erpOrder.getStockId());       //仓库编号
             details.setdEdi06(erpOrder.getOrderState());    //是否扫描完成
-            details.setdEdi07(erpOrder.getOrderNo()+"");    //项次
+            details.setdEdi07(erpOrder.getOrderNo() + "");    //项次
             details.setdEdi08(erpOrder.getOrderType());     //erp单据类型
             details.setdEdi09(erpOrder.getInout());         //erp出入库类型
             wmsDocAsnDetailsMapper.insertWmsDocAsnDetails(details);
@@ -749,9 +777,9 @@ public class WmsDocAsnHeaderServiceImpl implements IWmsDocAsnHeaderService {
             erpBarcodes = new ErpBarcodes();
 
             /*
-            * 1,若当前SKU是成品
-            * 入库数代表插入多少条扫描记录
-            **/
+             * 1,若当前SKU是成品
+             * 入库数代表插入多少条扫描记录
+             **/
             boolean isProduct = false;
             for (InvLotAtt invLotAtt : serialNumAttributes) {
 

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

@@ -87,7 +87,7 @@ public class BusinessServiceImpl implements IBusinessService {
             return res;
         }
     }
-
+    @Transactional
     @Override
     public AjaxResult agvCall(AgvCallItem agvCallItem, Long flowId) {
         //查询所属流程
@@ -107,7 +107,7 @@ public class BusinessServiceImpl implements IBusinessService {
         list.add(agvCallDTO);
         return this.agvCall(flowConfigHeaderVO, list);
     }
-
+    @Transactional
     @Override
     public AjaxResult agvCall(FlowConfigHeaderVO flowConfigHeaderVO, AgvCallDTO agvCallDTO) {
         List<AgvCallDTO> agvCallDTOList = new ArrayList<>();

+ 1 - 0
warewms-ams/src/main/java/com/ruoyi/ams/order/service/IWmsDocOrderHeaderService.java

@@ -191,6 +191,7 @@ public interface IWmsDocOrderHeaderService {
 
     /**
      * 组盘
+     * 备货和库内理货都没有出库,所以不需要修改拣货
      *
      * @param groupDiskFrom
      * @return

+ 22 - 24
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -236,6 +236,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         for (WmsDocOrderDetails o : orderDetails) {
             total = total.add(o.getQtyOrdered().subtract(o.getQtyAllocated()));
         }
+        String sku = "";
         for (WmsDocOrderDetails o : orderDetails) {
             AjaxResult result = wmsDocOrderHeaderService.doAllocationDetails(orderHeader, o);
             if ((int) result.get(AjaxResult.CODE_TAG) != 500) {
@@ -243,6 +244,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 BigDecimal current = new BigDecimal(result.get(AjaxResult.DATA_TAG).toString());
                 total = total.subtract(current);
                 if (total.compareTo(BigDecimal.ZERO) == 1) {
+                    sku = o.getSku();
                     isbf = true;
                 } else {
                     isbf = false;
@@ -253,7 +255,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             orderHeader.setOrderStatus(Constant.ORDER_STS.STS10.getValue());
             wmsDocOrderHeaderService.updateWmsDocOrderHeader(orderHeader);
             // TODO 改成可以部分分配
-            throw new ServiceException("库存数量不足,分配失败!" + orderNo);
+            throw new ServiceException("库存数量不足,分配失败!" + orderNo + ",品号:" + sku);
         }
         if (isAllocation) {
             orderHeader.setOrderStatus(Constant.ORDER_STS.STS20.getValue());
@@ -275,7 +277,8 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             }
         }
         if (builder.length() > 0) {
-            return AjaxResult.error(builder.toString());
+            // 这里必须返回成功,不然PDA没有办法下出库任务
+            return AjaxResult.success(builder.toString());
         }
         return AjaxResult.success("分配成功");
     }
@@ -495,7 +498,6 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         return wmsDocOrderHeaderMapper.selectCheckOutList(orderNoList);
     }
 
-    @Transactional
     @Override
     public AjaxResult doCheckout(CheckOutForm checkOutForm) {
         for (CheckOutInfoForm check : checkOutForm.getCheckOutInfoFormList()) {
@@ -513,26 +515,20 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             agvCallDTO.setExtParam("");
             AjaxResult result = businessService.agvCall(flowConfigHeaderVO, agvCallDTO);
             if ((int) result.get(AjaxResult.CODE_TAG) == 500) {
-                throw new ServiceException("任务生成失败");
+                throw new ServiceException("任务生成失败" + result.getMsg() + ",库位:" + baseLocationInfo.getLocationNo());
             }
 
-            /*ActAllocationDetails actAllocationDetails = actAllocationDetailsService.selectActAllocationDetailsByAllocationId(check.getActAllocationId());
-            //清空库存
-            WmsBoxInfo wmsBoxInfo = wmsBoxInfoService.selectWmsBoxInfoByBoxNo(actAllocationDetails.getUserdefine1());
-            invLotLocIdService.clear(wmsBoxInfo.getLocationId().toString(), Constant.WAREHOUSE_ID, "");
-
-            WmsDocOrderDetails wmsDocOrderDetails = new WmsDocOrderDetails();
-            wmsDocOrderDetails.setQtyShipped(actAllocationDetails.getPickQty());
-            wmsDocOrderDetails.setQtyShippedEach(actAllocationDetails.getPickQty());
-            wmsDocOrderDetails.setLineStatus("99");
-            wmsDocOrderDetails.setOrderNo(actAllocationDetails.getOrderNo());
-            wmsDocOrderDetails.setOrderLineNo(new BigDecimal(actAllocationDetails.getLineNo()));
-            wmsDocOrderDetailsMapper.updateWmsDocOrderDetails(wmsDocOrderDetails);*/
-
-            //修改出库单状态为完成
-//            WmsDocOrderHeader header = wmsDocOrderHeaderService.selectWmsDocOrderHeaderByOrderNo(check.getOrderNo());
-//            header.setOrderStatus("99");
-//            wmsDocOrderHeaderMapper.updateWmsDocOrderHeader(header);
+            // 将分配明细由分配完成改为任务生成
+            ActAllocationDetails actAllocationDetails = new ActAllocationDetails();
+            actAllocationDetails.setOrderNo(check.getOrderNo());
+            actAllocationDetails.setLocationId(baseLocationInfo.getId());
+            List<ActAllocationDetails> actAllocationDetailsList = actAllocationDetailsService.selectActAllocationDetailsList(actAllocationDetails);
+            for (ActAllocationDetails allocationDetails : actAllocationDetailsList) {
+                ActAllocationDetails allocationDetailsUpdate = new ActAllocationDetails();
+                allocationDetailsUpdate.setAllocationId(allocationDetails.getAllocationId());
+                allocationDetailsUpdate.setStatus(Constant.ORDER_STS.STS21.getValue());
+                actAllocationDetailsService.updateActAllocationDetails(allocationDetailsUpdate);
+            }
         }
 
 
@@ -608,15 +604,16 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
         String palletNoTo = groupDiskFrom.getPalletNoTo(); // 目标托盘
         String sn = groupDiskFrom.getSn(); // 条码号
         String orderNo = ""; // 出库单号(备货才会传入)
-///        String sku = ""; // 物料编码
+        String sku = ""; // 物料编码
         if (StringUtils.isNotEmpty(groupDiskFrom.getOrderNo())) {
             groupDiskFrom.getOrderNo();
         }
         /// 根据条码获取物料号
-//        CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
-//        sku = codeSkuRelationshipVO.getSku();
+        CodeSkuRelationshipVO codeSkuRelationshipVO = codeSkuRelationshipService.checkIsProduct(sn);
+        sku = codeSkuRelationshipVO.getSku();
         // 根据起始托盘,条码号查出库存
         InvLocIdSearchFrom locIdSearchFrom = new InvLocIdSearchFrom();
+        locIdSearchFrom.setSku(sku);
         LotattDTO lotattDTO = new LotattDTO();
         lotattDTO.setLotatt07(palletNoFrom);
         lotattDTO.setLotatt02(sn);
@@ -653,6 +650,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 if (!orderNo.equals("")) {
                     invLotAtt.setLotatt14(orderNo); // 备货对应的出库单号
                 }
+                invLotAtt.setLotatt15(lotnum); // 老批次
                 invLotAtt.setCreateTime(DateUtils.getNowDate());
                 if (invLotAttMapper.insertInvLotAtt(invLotAtt) > 0) {
                     for (InvLotLocIdLotattVO v : invLocIdList) {

+ 2 - 1
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -527,7 +527,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="queryInvByInvLotatt" resultMap="InvLotLocIdResult">
-        select li.* from inv_lot_loc_id li
+        select li.*
+        from inv_lot_loc_id li
         left join inv_lot_att att on li.lotnum = att.lotnum
         <where>
             <if test="lotattDTO != null">

+ 1 - 1
warewms-ams/src/main/resources/mapper/docOrder/ActAllocationDetailsMapper.xml

@@ -256,7 +256,7 @@
     <select id="queryAllocationDetailsToPickByPalletNo" parameterType="String" resultMap="ActAllocationDetailsResult">
         select al.*
         from act_allocation_details al
-        where al.userdefine1 = #{palletNo} and status = '20'
+        where al.userdefine1 = #{palletNo} and status = '21'
     </select>
 
     <select id="queryAllocationDetailsByOrderNo" parameterType="String" resultMap="ActAllocationDetailsResult">

+ 9 - 7
warewms-ams/src/main/resources/mapper/docOrder/WmsDocOrderHeaderMapper.xml

@@ -375,18 +375,20 @@
     </select>
 
     <select id="selectCheckOutList" parameterType="java.util.List" resultMap="CheckOutVOResult">
-        select de.order_no,w.box_no,b.location_no
+        select
+               de.order_no,w.box_no,b.location_no
         from wms_doc_order_details de
-                 left join base_sku sk on de.sku = sk.sku
-                 left join act_allocation_details act on de.order_no = act.order_no and de.order_line_no = act.line_no
-                 left join inv_lot_att att on act.lotnum = att.lotnum
-                 left join wms_box_info w on act.location_id = w.location_id
-                 left join base_location_info b on b.id = w.location_id
+        left join base_sku sk on de.sku = sk.sku
+        left join act_allocation_details act on de.order_no = act.order_no and de.order_line_no = act.line_no
+        right join inv_lot_loc_id lotinv on lotinv.sku = de.sku and lotinv.lotnum = act.lotnum and lotinv.location_id = act.location_id
+        left join inv_lot_att att on act.lotnum = att.lotnum
+        left join wms_box_info w on act.location_id = w.location_id
+        left join base_location_info b on b.id = act.location_id
         where de.order_no in
         <foreach item="orderNo" collection="list" open="(" separator="," close=")">
             #{orderNo}
         </foreach>
-        and de.line_status = '20'
+        and de.line_status = '20' and b.stock_status = '00' and b.is_empty = 'N'
         group by de.order_no,w.box_no,b.location_no
     </select>
 </mapper>

+ 22 - 0
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -10,6 +10,20 @@ public class Constant {
     public static final Long WAREHOUSE_ID = 1L;
 
 
+    /**
+     * 入库
+     */
+    public static final int FLOW_ID_ASN = 5;
+    /**
+     * 出库
+     */
+    public static final int FLOW_ID_SO = 6;
+    /**
+     * 回库
+     */
+    public static final int FLOW_ID_RSO = 9;
+
+
     /**
      * 入库缓存位
      */
@@ -174,6 +188,10 @@ public class Constant {
          * 完全分配
          */
         STS20("20"),
+        /**
+         * 任务生成
+         */
+        STS21("21"),
         /**
          * 部分拣货
          */
@@ -377,6 +395,10 @@ public class Constant {
     }
 
     public enum ZONE_TYPE {
+        /**
+         * 仓储区域
+         */
+        ZONE_INV(2L),
         /**
          * 入库区域
          */