Browse Source

出入库、质检任务生成

dfsfs 1 year ago
parent
commit
5ba079b3ea
57 changed files with 1176 additions and 663 deletions
  1. 52 54
      base/sql/bsl_sql/bsl_ddl_v1.0.0.sql
  2. 22 2
      base/sql/bsl_sql/bsl_dml_v1.0.0.sql
  3. 34 0
      ruoyi-admin/src/main/java/com/ruoyi/bionutrition/pda/controller/PdaAgvCallController.java
  4. 53 0
      ruoyi-admin/src/main/java/com/ruoyi/bionutrition/pda/controller/PdaDocQcController.java
  5. 20 18
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/InvLotLocIdController.java
  6. 5 12
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java
  7. 5 2
      ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaInvLotLocIdController.java
  8. 11 11
      ruoyi-admin/src/main/resources/application-prod.yml
  9. 15 0
      ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java
  10. 1 1
      warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/AciService.java
  11. 6 5
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/domain/BionutritionDocDetails.java
  12. 5 4
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/BionutritionDocDetailsDTO.java
  13. 3 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/DocExcelQueryDTO.java
  14. 49 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/DocLotattDTO.java
  15. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/FinishedProductReceiptDetailsDTO.java
  16. 6 5
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/ProductionPickingReceiptDetailsDTO.java
  17. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/ProductionReturnOrderDetailsDTO.java
  18. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/PurchaseOrderDetailsDTO.java
  19. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/PurchaseReceiptDetailsDTO.java
  20. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/SaleOutboundOrderDetailsDTO.java
  21. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/SaleReturnOrderDetailsDTO.java
  22. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/FinishedProductReceiptDetailsExcel.java
  23. 6 5
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/ProductionPickingReceiptDetailsExcel.java
  24. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/ProductionReturnOrderDetailsExcel.java
  25. 2 5
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/PurchaseOrderDetailsExcel.java
  26. 2 5
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/PurchaseReceiptDetailsExcel.java
  27. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/SaleOutboundOrderDetailsExcel.java
  28. 2 2
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/SaleReturnOrderDetailsExcel.java
  29. 7 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/factory/BionutritionDocFactory.java
  30. 10 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/BionutritionDocDetailsService.java
  31. 9 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/BionutritionDocHeaderService.java
  32. 24 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/impl/BionutritionDocDetailsServiceImpl.java
  33. 45 3
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/impl/BionutritionDocHeaderServiceImpl.java
  34. 44 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/AsnAgvCallDTO.java
  35. 33 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/DocQcDTO.java
  36. 36 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/OrderAgvCallDTO.java
  37. 14 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/IPdaAgvCallService.java
  38. 23 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/IPdaDocQcService.java
  39. 179 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/impl/PdaAgvCallServiceImpl.java
  40. 114 0
      warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/impl/PdaDocQcServiceImpl.java
  41. 15 16
      warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java
  42. 33 0
      warewms-ams/src/main/java/com/ruoyi/ams/config/domain/dto/LotattDTO.java
  43. 9 162
      warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/InvLotLocId.java
  44. 8 56
      warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/form/InvLocIdSearchFrom.java
  45. 4 247
      warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/vo/InvLotLocIdLotattVO.java
  46. 4 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/dto/InvMoveDTO.java
  47. 22 10
      warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotAttMapper.java
  48. 7 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java
  49. 22 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotAttService.java
  50. 10 1
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotLocIdService.java
  51. 16 0
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotAttServiceImpl.java
  52. 96 7
      warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java
  53. 4 3
      warewms-ams/src/main/java/com/ruoyi/ams/task/service/IWcsTaskService.java
  54. 9 7
      warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java
  55. 17 0
      warewms-ams/src/main/resources/mapper/ams/InvLotAttMapper.xml
  56. 9 0
      warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml
  57. 36 2
      warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

+ 52 - 54
base/sql/bsl_sql/bsl_ddl_v1.0.0.sql

@@ -425,33 +425,32 @@ CREATE TABLE `base_warehouse`  (
 -- Table structure for bsl_doc_details
 -- ----------------------------
 DROP TABLE IF EXISTS `bsl_doc_details`;
-CREATE TABLE `bsl_doc_details`  (
+CREATE TABLE `bsl_doc_details` (
   `id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'id',
-  `doc_header_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '单据头id',
-  `doc_line_no` int(64) NULL DEFAULT NULL COMMENT '明细行号',
-  `sku_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料编码',
-  `sku_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料名称',
-  `sku_qty` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '物料数量',
-  `original_lot_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '原厂批号',
-  `income_lot_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '进厂批号',
-  `product_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品名称',
-  `product_lot_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '产品批号',
-  `measure_unit` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '计量单位',
-  `manufacture_date` datetime(0) NULL DEFAULT NULL COMMENT '生产日期',
-  `receiver` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '收货人',
-  `specification` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '规格',
-  `quality_inspection_doc` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '质检单号/检验单号',
-  `returner` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '退库人',
-  `price_include_tax` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '含税价',
-  `warehouse_person` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '入库人',
-  `reviewer_next` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '复审人',
-  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '备注',
-  `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
-  `create_date` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-  `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
-  `update_date` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
+  `doc_header_id` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '单据头id',
+  `doc_line_no` int(64) DEFAULT NULL COMMENT '明细行号',
+  `sku_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '物料编码',
+  `sku_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '物料名称',
+  `sku_qty` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '物料数量',
+  `original_lot_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '原厂批号',
+  `batch_number` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '批号',
+  `product_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '产品名称',
+  `measure_unit` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '计量单位',
+  `manufacture_date` datetime DEFAULT NULL COMMENT '生产日期',
+  `receiver` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '收货人',
+  `specification` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '规格',
+  `quality_inspection_doc` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '质检单号/检验单号',
+  `returner` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '退库人',
+  `price_include_tax` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '含税价',
+  `warehouse_person` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '入库人',
+  `reviewer_next` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '复审人',
+  `remark` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '备注',
+  `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
+  `create_date` datetime DEFAULT NULL COMMENT '创建时间',
+  `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
+  `update_date` datetime DEFAULT NULL COMMENT '更新时间',
   PRIMARY KEY (`id`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '佰穗莱单据明细表' ROW_FORMAT = Dynamic;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='佰穗莱单据明细表';
 
 -- ----------------------------
 -- Table structure for bsl_doc_header
@@ -565,36 +564,35 @@ CREATE TABLE `flow_config_header`  (
 -- ----------------------------
 -- Table structure for inv_lot_att
 -- ----------------------------
-DROP TABLE IF EXISTS `inv_lot_att`;
-CREATE TABLE `inv_lot_att`  (
-  `lotnum` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '主键',
-  `customer_id` varchar(30) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '货主代码',
-  `sku` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '物料编码',
-  `lotatt01` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt02` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt03` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt04` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt05` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt06` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt07` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt08` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt09` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt10` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt11` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt12` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt13` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt14` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt15` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt16` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt17` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `lotatt18` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
-  `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
-  `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
-  `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
-  `update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
-  `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
+CREATE TABLE `inv_lot_att` (
+  `lotnum` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '主键',
+  `customer_id` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '货主代码',
+  `sku` varchar(50) CHARACTER SET utf8 NOT NULL COMMENT '物料编码',
+  `lotatt01` varchar(20) CHARACTER SET utf8 DEFAULT NULL COMMENT '客户编码',
+  `lotatt02` varchar(20) CHARACTER SET utf8 DEFAULT NULL COMMENT '批号',
+  `lotatt03` varchar(20) CHARACTER SET utf8 DEFAULT NULL COMMENT '生产日期',
+  `lotatt04` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '有效期',
+  `lotatt05` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '检验状态',
+  `lotatt06` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '入库日期',
+  `lotatt07` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '规格型号',
+  `lotatt08` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '收货日期',
+  `lotatt09` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '总净重',
+  `lotatt10` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '总毛重',
+  `lotatt11` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '总皮重',
+  `lotatt12` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `lotatt13` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `lotatt14` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `lotatt15` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `lotatt16` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `lotatt17` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `lotatt18` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
+  `create_by` varchar(64) DEFAULT '' COMMENT '创建者',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_by` varchar(64) DEFAULT '' COMMENT '更新者',
+  `update_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
   PRIMARY KEY (`lotnum`) USING BTREE
-) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '批次属性' ROW_FORMAT = Dynamic;
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='批次属性';
 
 -- ----------------------------
 -- Table structure for inv_lot_loc_id

File diff suppressed because it is too large
+ 22 - 2
base/sql/bsl_sql/bsl_dml_v1.0.0.sql


+ 34 - 0
ruoyi-admin/src/main/java/com/ruoyi/bionutrition/pda/controller/PdaAgvCallController.java

@@ -0,0 +1,34 @@
+package com.ruoyi.bionutrition.pda.controller;
+
+import cn.hutool.core.lang.Assert;
+import com.ruoyi.ams.bionutrition.dto.AsnAgvCallDTO;
+import com.ruoyi.ams.bionutrition.pda.IPdaAgvCallService;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+
+/**
+ * 佰穗莱pda入库接口
+ */
+@Slf4j
+@RestController
+@RequestMapping("/pda/agvCall")
+@Valid
+public class PdaAgvCallController {
+
+    @Autowired
+    private IPdaAgvCallService pdaAgvCallService;
+
+    @ApiOperation("pda入库任务")
+    @PostMapping("/intoStorage")
+    public AjaxResult createIntoStorageTask(@RequestBody @Valid AsnAgvCallDTO asnAgvCallDTO) {
+        pdaAgvCallService.createIntoStorageTask(asnAgvCallDTO);
+        return AjaxResult.success("入库任务下发成功");
+    }
+
+}

+ 53 - 0
ruoyi-admin/src/main/java/com/ruoyi/bionutrition/pda/controller/PdaDocQcController.java

@@ -0,0 +1,53 @@
+package com.ruoyi.bionutrition.pda.controller;
+
+import com.ruoyi.ams.bionutrition.dto.AsnAgvCallDTO;
+import com.ruoyi.ams.bionutrition.dto.DocQcDTO;
+import com.ruoyi.ams.bionutrition.pda.IPdaAgvCallService;
+import com.ruoyi.ams.bionutrition.pda.IPdaDocQcService;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.StringUtils;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.validation.Valid;
+import java.util.List;
+
+/**
+ * 佰穗莱pda质检接口
+ */
+@Slf4j
+@RestController
+@RequestMapping("/pda/qc")
+@Valid
+public class PdaDocQcController extends BaseController {
+
+    @Autowired
+    private IPdaDocQcService pdaDocQcService;
+
+    /**
+     * 获取质检列表
+     *
+     * @return
+     */
+    @GetMapping("/getQcList")
+    public AjaxResult getQcList(@RequestParam String sku) {
+        List<DocQcDTO> qcList = pdaDocQcService.getQcList(sku);
+        return AjaxResult.success("获取成功!", qcList);
+    }
+
+    /**
+     * 质检提交
+     * @param docQcDTO
+     * @return
+     */
+    @ApiOperation("pda质检")
+    @PostMapping("/submit")
+    public AjaxResult docQcSubmit(@RequestBody @Valid DocQcDTO docQcDTO) {
+        pdaDocQcService.docQcSubmit(docQcDTO, "111");
+        return AjaxResult.success();
+    }
+
+}

+ 20 - 18
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/InvLotLocIdController.java

@@ -1,5 +1,6 @@
 package com.ruoyi.web.controller.warewms.ams;
 
+import cn.hutool.core.lang.Assert;
 import com.ruoyi.ams.inv.domain.InvLotLocId;
 import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
@@ -13,6 +14,7 @@ import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -45,6 +47,16 @@ public class InvLotLocIdController extends BaseController {
         return getDataTable(list);
     }
 
+    /**
+     * 查询库位库存是否有过期
+     */
+    @PreAuthorize("@ss.hasPermi('ams:invLotLocId:list')")
+    @GetMapping("/getInvLocIfExpire")
+    public AjaxResult getExpireList() {
+        String msg = invLotLocIdService.getInvLocIfExpire();
+        return AjaxResult.success(msg);
+    }
+
     /**
      * 库存调整
      */
@@ -57,10 +69,8 @@ public class InvLotLocIdController extends BaseController {
         return invLotLocIdService.adj(invLotLocIdAdjForm);
     }
 
-    /**
-     * 库存移动
-     */
-    @PreAuthorize("@ss.hasPermi('ams:invLotLocId:move')")
+
+/*    @PreAuthorize("@ss.hasPermi('ams:invLotLocId:move')")
     @Log(title = "库位库存移动", businessType = BusinessType.UPDATE)
     @PostMapping("/move")
     public AjaxResult move(@RequestBody InvLotLocIdMoveForm invLotLocIdMoveForm) {
@@ -73,24 +83,16 @@ public class InvLotLocIdController extends BaseController {
         } else {
             return invLotLocIdService.moveDirect(invLotLocIdMoveForm);
         }
-    }
+    }*/
 
+    /**
+     * 库存移动
+     */
     @PreAuthorize("@ss.hasPermi('ams:invLotLocId:move')")
-    @Log(title = "库位库存移动(呼叫agv场景专用)", businessType = BusinessType.UPDATE)
+    @Log(title = "库位库存移动", businessType = BusinessType.UPDATE)
     @PostMapping("/moveLocInv")
     public AjaxResult moveLocInv(@RequestBody InvMoveDTO invMoveDTO) {
-        InvLotLocIdMoveForm invLotLocIdMoveForm = buildInvLotLocIdMoveForm(invMoveDTO.getSourceLocationId(), invMoveDTO.getTargetLocationId());
-        return invLotLocIdService.move(invLotLocIdMoveForm);
-    }
-
-    private InvLotLocIdMoveForm buildInvLotLocIdMoveForm(String sourceLocationId, String targetLocationId) {
-        InvLotLocIdMoveForm invLotLocIdMoveForm = new InvLotLocIdMoveForm();
-        invLotLocIdMoveForm.setLocationFrom(sourceLocationId);
-        invLotLocIdMoveForm.setLocationTo(targetLocationId);
-        invLotLocIdMoveForm.setUpdateBy(getUsername());
-        invLotLocIdMoveForm.setWarehouseId(Constant.WAREHOUSE_ID);
-        invLotLocIdMoveForm.setIsCallCar(Constant.IS_YES.Y.getValue());
-        return invLotLocIdMoveForm;
+        return invLotLocIdService.move(invMoveDTO, getUsername());
     }
 
     /**

+ 5 - 12
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/WcsTaskController.java

@@ -4,9 +4,11 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+import javax.validation.Valid;
 import javax.validation.constraints.Min;
 import javax.validation.constraints.NotNull;
 
+import com.ruoyi.ams.bionutrition.dto.OrderAgvCallDTO;
 import com.ruoyi.ams.task.domain.form.TaskDispositionForm;
 import com.ruoyi.ams.task.form.AddTaskForm;
 import com.ruoyi.base.constant.Constant;
@@ -205,21 +207,12 @@ public class WcsTaskController extends BaseController {
     /**
      * 根据单号创建出库任务
      *
-     * @param wcsTask
+     * @param orderAgvCallDTO
      * @return
      */
     @PostMapping("/createOutboundTaskByDoc")
-    public AjaxResult createOutboundTaskByDoc(@RequestBody WcsTask wcsTask) {
-        if (StringUtils.isEmpty(wcsTask.getWhNoFrom())) {
-            return AjaxResult.error("缺省单据编号");
-        }
-        if (StringUtils.isEmpty(wcsTask.getExt7())) {
-            return AjaxResult.error("缺省物料信息");
-        }
-        if (StringUtils.isEmpty(wcsTask.getLocationTo())) {
-            return AjaxResult.error("缺省目标库位");
-        }
-        return wcsTaskService.createOutboundTaskByDoc(wcsTask);
+    public AjaxResult createOutboundTaskByDoc(@RequestBody @Valid OrderAgvCallDTO orderAgvCallDTO) {
+        return wcsTaskService.createOutboundTaskByDoc(orderAgvCallDTO);
     }
 
     public static class ToChargeForm {

+ 5 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/pda/PdaInvLotLocIdController.java

@@ -4,10 +4,12 @@ import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.inv.dto.InvMoveDTO;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 import com.ruoyi.base.constant.Constant;
 import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.StringUtils;
@@ -28,7 +30,7 @@ import java.util.stream.Collectors;
 @Api("库内作业")
 @RestController
 @RequestMapping("/pda/inv")
-public class PdaInvLotLocIdController {
+public class PdaInvLotLocIdController extends BaseController {
 
     @Autowired
     private IInvLotLocIdService invLotLocIdService;
@@ -112,7 +114,8 @@ public class PdaInvLotLocIdController {
         // 判断是否叫车
         if (invLotLocIdMoveForm.getIsCallCar() == null
                 || invLotLocIdMoveForm.getIsCallCar().equals(Constant.IS_YES.Y.getValue())) {
-            return invLotLocIdService.move(invLotLocIdMoveForm);
+            InvMoveDTO invMoveDTO = new InvMoveDTO(invLotLocIdMoveForm.getLocationFrom(), invLotLocIdMoveForm.getLocationTo());
+            return invLotLocIdService.move(invMoveDTO, getUsername());
         } else {
             return invLotLocIdService.moveDirect(invLotLocIdMoveForm);
         }

+ 11 - 11
ruoyi-admin/src/main/resources/application-prod.yml

@@ -6,8 +6,8 @@ spring:
         druid:
             # 主库数据源
             master:
-                url: jdbc:mysql://localhost:3306/warewms-hualan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
-                username: warewms
+                url: jdbc:mysql://localhost:3306/warewms-baisuilai?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
+                username: root
                 password: warewms123
             # 从库数据源
             slave:
@@ -93,44 +93,44 @@ init-task:
 modbus:
     tcp-master:
         first: # 自动门(靠马路)
-            open: true
+            open: false
             host: 192.168.42.201
             port: 9000
         second: # 自动门(靠里面)
-            open: true
+            open: false
             host: 192.168.42.202
             port: 9000
         sixth: # 自动门(靠马路-第二层)
-            open: true
+            open: false
             host: 192.168.42.210
             port: 9000
         seventh: # 卷帘门
-            open: true
+            open: false
             host: 192.168.42.211
             port: 9000
         third: # 按钮盒
-            open: true
+            open: false
             host: 192.168.42.205
             port: 9000
         fourth: # 充电机(三向车)
-            open: true
+            open: false
             host: 192.168.42.208
             port: 8899
         fifth: # 充电机(迷你堆垛)
-            open: true
+            open: false
             host: 192.168.42.209
             port: 8899
 
 
 rfid:
     first: # 靠马路
-        open: true
+        open: false
         host: 192.168.42.203
         port: 5084
         number-of-tags: 3 # 一次读取标签的数量
         timeout-milliseconds: 5000
     second: # 靠里面
-        open: true
+        open: false
         host: 192.168.42.204
         port: 5084
         number-of-tags: 3 # 一次读取标签的数量

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

@@ -9,6 +9,9 @@ import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 import com.ruoyi.ams.asn.domain.WmsDocAsnDetails;
 import com.ruoyi.ams.asn.domain.WmsDocAsnHeader;
 import com.ruoyi.ams.asn.service.IWmsDocAsnHeaderService;
+import com.ruoyi.ams.bionutrition.dto.AsnAgvCallDTO;
+import com.ruoyi.ams.bionutrition.pda.IPdaAgvCallService;
+import com.ruoyi.ams.bionutrition.pda.impl.PdaAgvCallServiceImpl;
 import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.business.domain.FilterLockInvLocationDTO;
 import com.ruoyi.ams.config.domain.AsnSoStrategy;
@@ -316,4 +319,16 @@ public class WarehouseTest {
 
     }
 
+    @Autowired
+    private IPdaAgvCallService pdaAgvCallService;
+
+    @Test
+    public void testAgvIntoStorage(){
+        AsnAgvCallDTO asnAgvCallDTO = new AsnAgvCallDTO();
+        asnAgvCallDTO.setDocNo("i_00909889");
+        asnAgvCallDTO.setLocationFrom("101339");
+        asnAgvCallDTO.setSkuCode("测试物料1");
+        pdaAgvCallService.createIntoStorageTask(asnAgvCallDTO);
+    }
+
 }

+ 1 - 1
warewms-ams/src/main/java/com/ruoyi/ams/agv/ndc/AciService.java

@@ -37,7 +37,7 @@ public class AciService {
 
     private static final int BUFF_SIZE = 2048;
 
-    private static final String IP_ADDR = "192.168.1.58";
+    private static final String IP_ADDR = "169.254.95.120";
 
     private static final int IP_PORT = 30002;
 

+ 6 - 5
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/domain/BionutritionDocDetails.java

@@ -32,15 +32,16 @@ public class BionutritionDocDetails extends WarewmsExtEntity {
     @ApiModelProperty("原厂批号")
     private String originalLotNumber;
 
-    @ApiModelProperty("进厂批号")
-    private String incomeLotNumber;
+    /*    @ApiModelProperty("进厂批号")
+        private String incomeLotNumber;
+        @ApiModelProperty("产品批号")
+        private String productLotNumber;*/
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("产品名称")
     private String productName;
 
-    @ApiModelProperty("产品批号")
-    private String productLotNumber;
-
     @ApiModelProperty("计量单位")
     private String measureUnit;
 

+ 5 - 4
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/BionutritionDocDetailsDTO.java

@@ -28,15 +28,16 @@ public class BionutritionDocDetailsDTO extends WarewmsExtDTO {
     @ApiModelProperty("原厂批号")
     private String originalLotNumber;
 
-    @ApiModelProperty("进厂批号")
+/*    @ApiModelProperty("进厂批号")
     private String incomeLotNumber;
+    @ApiModelProperty("产品批号")
+    private String productLotNumber;*/
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("产品名称")
     private String productName;
 
-    @ApiModelProperty("产品批号")
-    private String productLotNumber;
-
     @ApiModelProperty("计量单位")
     private String measureUnit;
 

+ 3 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/DocExcelQueryDTO.java

@@ -6,6 +6,9 @@ import lombok.Data;
 import javax.validation.constraints.NotBlank;
 import java.io.Serializable;
 
+/**
+ * 单据导出查询对象
+ */
 @Data
 public class DocExcelQueryDTO implements Serializable {
 

+ 49 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/DocLotattDTO.java

@@ -0,0 +1,49 @@
+package com.ruoyi.ams.bionutrition.doc.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 批次属性对象
+ */
+@Data
+public class DocLotattDTO implements Serializable {
+    private static final long serialVersionUID = 7169914453413091188L;
+
+    /**
+     * 供应商编码
+     */
+    private String vendorCode;
+    /**
+     * 批号
+     */
+    private String batchNumber;
+    /**
+     * 规格
+     */
+    private String specification;
+    /**
+     * 有效期
+     */
+    private Integer skuShelflife;
+    /**
+     * 皮重
+     */
+    private BigDecimal skuTare;
+    /**
+     * 毛重
+     */
+    private BigDecimal skuGrossweight;
+    /**
+     * 净重
+     */
+    private BigDecimal skuNetweight;
+    /**
+     * 生产日期
+     */
+    private Date manufactureDate;
+
+}

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/FinishedProductReceiptDetailsDTO.java

@@ -10,8 +10,8 @@ import lombok.Data;
 @Data
 public class FinishedProductReceiptDetailsDTO extends BionutritionDocDetailsBaseDTO {
 
-    @ApiModelProperty("产品批号")
-    private String productLotNumber;
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("收货人")
     private String receiver;

+ 6 - 5
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/ProductionPickingReceiptDetailsDTO.java

@@ -12,11 +12,12 @@ import java.util.Date;
 @Data
 public class ProductionPickingReceiptDetailsDTO extends BionutritionDocDetailsBaseDTO {
 
-    @ApiModelProperty("进厂批号")
-    private String incomeLotNumber;
-
-    @ApiModelProperty("产品批号")
-    private String productLotNumber;
+    /*    @ApiModelProperty("进厂批号")
+     private String incomeLotNumber;
+     @ApiModelProperty("产品批号")
+     private String productLotNumber;*/
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/ProductionReturnOrderDetailsDTO.java

@@ -10,8 +10,8 @@ import lombok.Data;
 @Data
 public class ProductionReturnOrderDetailsDTO extends BionutritionDocDetailsBaseDTO {
 
-    @ApiModelProperty("进厂批号")
-    private String incomeLotNumber;
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/PurchaseOrderDetailsDTO.java

@@ -15,8 +15,8 @@ public class PurchaseOrderDetailsDTO extends BionutritionDocDetailsBaseDTO {
     @ApiModelProperty("原厂批号")
     private String originalLotNumber;
 
-    @ApiModelProperty("进厂批号")
-    private String incomeLotNumber;
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/PurchaseReceiptDetailsDTO.java

@@ -16,8 +16,8 @@ public class PurchaseReceiptDetailsDTO extends BionutritionDocDetailsBaseDTO {
     @ApiModelProperty("原厂批号")
     private String originalLotNumber;
 
-    @ApiModelProperty("进厂批号")
-    private String incomeLotNumber;
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/SaleOutboundOrderDetailsDTO.java

@@ -13,8 +13,8 @@ public class SaleOutboundOrderDetailsDTO extends BionutritionDocDetailsBaseDTO {
     @ApiModelProperty("产品名称")
     private String productName;
 
-    @ApiModelProperty("产品批号")
-    private String productLotNumber;
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/dto/detail/SaleReturnOrderDetailsDTO.java

@@ -10,8 +10,8 @@ import lombok.Data;
 @Data
 public class SaleReturnOrderDetailsDTO extends BionutritionDocDetailsBaseDTO {
 
-    @ApiModelProperty("产品批号")
-    private String productLotNumber;
+    @ApiModelProperty("批号")
+    private String batchNumber;
 
     @ApiModelProperty("计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/FinishedProductReceiptDetailsExcel.java

@@ -16,8 +16,8 @@ import java.util.Map;
 @Data
 public class FinishedProductReceiptDetailsExcel extends BionutritionDocDetailsBaseExcel {
 
-    @Excel(name = "产品批号")
-    private String productLotNumber;
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "收货人")
     private String receiver;

+ 6 - 5
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/ProductionPickingReceiptDetailsExcel.java

@@ -16,11 +16,12 @@ import java.util.Map;
 @Data
 public class ProductionPickingReceiptDetailsExcel extends BionutritionDocDetailsBaseExcel {
 
-    @Excel(name = "进厂批号")
-    private String incomeLotNumber;
-
-    @Excel(name = "产品批号")
-    private String productLotNumber;
+    /*    @ApiModelProperty("进厂批号")
+        private String incomeLotNumber;
+        @ApiModelProperty("产品批号")
+        private String productLotNumber;*/
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/ProductionReturnOrderDetailsExcel.java

@@ -16,8 +16,8 @@ import java.util.Map;
 @Data
 public class ProductionReturnOrderDetailsExcel extends BionutritionDocDetailsBaseExcel {
 
-    @Excel(name = "进厂批号")
-    private String incomeLotNumber;
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "计量单位")
     private String measureUnit;

+ 2 - 5
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/PurchaseOrderDetailsExcel.java

@@ -16,11 +16,8 @@ import java.util.Map;
 @Data
 public class PurchaseOrderDetailsExcel extends BionutritionDocDetailsBaseExcel {
 
-    @Excel(name = "原厂批号")
-    private String originalLotNumber;
-
-    @Excel(name = "进厂批号")
-    private String incomeLotNumber;
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "计量单位")
     private String measureUnit;

+ 2 - 5
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/PurchaseReceiptDetailsExcel.java

@@ -17,11 +17,8 @@ import java.util.Map;
 @Data
 public class PurchaseReceiptDetailsExcel extends BionutritionDocDetailsBaseExcel {
 
-    @Excel(name = "原厂批号")
-    private String originalLotNumber;
-
-    @Excel(name = "进厂批号")
-    private String incomeLotNumber;
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/SaleOutboundOrderDetailsExcel.java

@@ -19,8 +19,8 @@ public class SaleOutboundOrderDetailsExcel extends BionutritionDocDetailsBaseExc
     @Excel(name = "产品名称")
     private String productName;
 
-    @Excel(name = "产品批号")
-    private String productLotNumber;
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "计量单位")
     private String measureUnit;

+ 2 - 2
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/excel/detail/SaleReturnOrderDetailsExcel.java

@@ -16,8 +16,8 @@ import java.util.Map;
 @Data
 public class SaleReturnOrderDetailsExcel extends BionutritionDocDetailsBaseExcel {
 
-    @Excel(name = "产品批号")
-    private String productLotNumber;
+    @Excel(name = "批号")
+    private String batchNumber;
 
     @Excel(name = "计量单位")
     private String measureUnit;

+ 7 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/factory/BionutritionDocFactory.java

@@ -0,0 +1,7 @@
+package com.ruoyi.ams.bionutrition.doc.factory;
+
+public class BionutritionDocFactory {
+    public void test(String type){
+
+    }
+}

+ 10 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/BionutritionDocDetailsService.java

@@ -22,6 +22,14 @@ public interface BionutritionDocDetailsService extends CrudService<BionutritionD
 
     List<BionutritionDocDetailsDTO> getBionutritionDocDetailsDTOList(List<String> docHeaderIdList);
 
+    /**
+     * 根据物料编码和批号获取明细信息
+     * @param skuCode
+     * @param batchNumber
+     * @return
+     */
+    List<BionutritionDocDetailsDTO> selectDocDetailsDTOList(String skuCode, String batchNumber);
+
     /**
      * 插入单据明细
      * @param docDetailsDTO
@@ -44,4 +52,6 @@ public interface BionutritionDocDetailsService extends CrudService<BionutritionD
     int updateDocDetails(BionutritionDocDetailsDTO docDetailsDTO);
 
     BionutritionDocDetailsDTO selectDocDetailsByLineNo(String docHeaderId, String docLineNo);
+
+    int deleteByHeaderIds(String[] ids);
 }

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/BionutritionDocHeaderService.java

@@ -72,4 +72,13 @@ public interface BionutritionDocHeaderService extends CrudService<BionutritionDo
      * 导出单据excel方法
      */
     <E>void exportExcel(HttpServletResponse response, DocExcelQueryDTO docExcelQueryDTO) throws ClassNotFoundException;
+
+    /**
+     * 根据物料编码、批号、单据类型获取单据信息
+     * @param skuCode
+     * @param batchNumber
+     * @param docType
+     * @return
+     */
+    BionutritionDocBaseDTO selectDocBySkuAndBatchNumber(String skuCode, String batchNumber, String docType);
 }

+ 24 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/impl/BionutritionDocDetailsServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.ams.bionutrition.doc.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -20,6 +21,7 @@ import com.ruoyi.framework.service.impl.CrudServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 
@@ -43,6 +45,22 @@ public class BionutritionDocDetailsServiceImpl extends CrudServiceImpl<Bionutrit
         return getBionutritionDocDetailsDTOList(docHeaderIdList, Lists.newArrayList());
     }
 
+    /**
+     * 根据物料和批号查询单据明细信息
+     * @param skuCode
+     * @param batchNumber
+     * @return
+     */
+    @Override
+    public List<BionutritionDocDetailsDTO> selectDocDetailsDTOList(String skuCode, String batchNumber) {
+        Assert.isTrue(StringUtils.isNotBlank(skuCode), "物料编码为空");
+        Assert.isTrue(StringUtils.isNotBlank(batchNumber), "批号为空");
+        List<BionutritionDocDetails> docDetailsList = baseDao.selectList(Wrappers.<BionutritionDocDetails>lambdaQuery()
+                .eq(BionutritionDocDetails::getSkuCode, skuCode)
+                .eq(BionutritionDocDetails::getBatchNumber, batchNumber));
+        return ConvertUtils.sourceToTarget(docDetailsList, BionutritionDocDetailsDTO.class);
+    }
+
     /**
      * 查找同单头的明细中最大的行号
      *
@@ -116,6 +134,12 @@ public class BionutritionDocDetailsServiceImpl extends CrudServiceImpl<Bionutrit
         return ConvertUtils.sourceToTarget(bionutritionDocDetails, BionutritionDocDetailsDTO.class);
     }
 
+    @Override
+    public int deleteByHeaderIds(String[] ids) {
+        return baseDao.delete(Wrappers.<BionutritionDocDetails>lambdaQuery()
+                .in(ArrayUtil.isNotEmpty(ids), BionutritionDocDetails::getDocHeaderId, Arrays.asList(ids)));
+    }
+
     public List<BionutritionDocDetailsDTO> getBionutritionDocDetailsDTOList(List<String> docHeaderIdList, String skuCode) {
         return getBionutritionDocDetailsDTOList(docHeaderIdList, Lists.newArrayList(skuCode));
     }

+ 45 - 3
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/doc/service/impl/BionutritionDocHeaderServiceImpl.java

@@ -1,11 +1,14 @@
 package com.ruoyi.ams.bionutrition.doc.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.bean.copier.CopyOptions;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.lang.Assert;
+import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.ArrayUtil;
 import cn.hutool.core.util.NumberUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -20,6 +23,7 @@ import com.ruoyi.ams.bionutrition.doc.dto.BionutritionDocHeaderDTO;
 import com.ruoyi.ams.bionutrition.doc.dto.DocExcelQueryDTO;
 import com.ruoyi.ams.bionutrition.doc.dto.detail.BionutritionDocDetailsBaseDTO;
 import com.ruoyi.ams.bionutrition.doc.dto.header.BionutritionDocHeaderBaseDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.header.FinishedProductReceiptHeaderDTO;
 import com.ruoyi.ams.bionutrition.doc.excel.BionutritionDocBaseExcel;
 import com.ruoyi.ams.bionutrition.doc.excel.detail.BionutritionDocDetailsBaseExcel;
 import com.ruoyi.ams.bionutrition.doc.excel.header.BionutritionDocHeaderBaseExcel;
@@ -113,7 +117,6 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
     public int updateDoc(BionutritionDocHeaderDTO docHeaderDTO) {
         UpdateWrapper<BionutritionDocHeader> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().eq(StringUtils.isNotBlank(docHeaderDTO.getId()), BionutritionDocHeader::getId, docHeaderDTO.getId());
-//                .eq(StringUtils.isNotBlank(docHeaderDTO.getDocNo()), BionutritionDocHeader::getDocNo, docHeaderDTO.getDocNo());
         return baseDao.update(ConvertUtils.sourceToTarget(docHeaderDTO, BionutritionDocHeader.class), updateWrapper);
     }
 
@@ -125,7 +128,7 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
      */
     @Override
     public int deleteDocByIds(String[] ids) {
-        bionutritionDocDetailsService.deleteBatchIds(Arrays.asList(ids));
+        bionutritionDocDetailsService.deleteByHeaderIds(ids);
         return baseDao.deleteBatchIds(Arrays.asList(ids));
     }
 
@@ -133,7 +136,6 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
     public List<BionutritionDocBaseDTO> getDocList(DocExcelQueryDTO docExcelQueryDTO) {
         List<BionutritionDocHeaderDTO> docHeaderDTOList = getBionutritionDocHeaderDTOList(docExcelQueryDTO.getDocType());
         return buildBionutritionDocSameTypeList(docHeaderDTOList);
-//        return buildBionutritionDocDifferentTypeList(docHeaderDTOList);
     }
 
     /**
@@ -150,6 +152,25 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
         return buildBionutritionDocDifferentTypeList(docHeaderDTOList);
     }
 
+
+    /**
+     * 根据物料编码和批号获取单据信息
+     * @param skuCode
+     * @param batchNumber
+     * @return
+     */
+    @Override
+    public BionutritionDocBaseDTO selectDocBySkuAndBatchNumber(String skuCode, String batchNumber, String docType) {
+        List<BionutritionDocDetailsDTO> docDetailsDTOList = bionutritionDocDetailsService.selectDocDetailsDTOList(skuCode, batchNumber);
+        Assert.isTrue(CollUtil.isNotEmpty(docDetailsDTOList), "对应单据明细不存在");
+        List<String> headerIds = docDetailsDTOList.stream().map(item -> item.getDocHeaderId()).collect(Collectors.toList());
+        Assert.isTrue(CollUtil.isNotEmpty(headerIds), "明细对应单据头id不存在");
+        BionutritionDocHeaderDTO bionutritionDocHeaderDTO = getBionutritionDocHeaderDTOList(headerIds).stream()
+                .filter(docHeaderDTO -> StringUtils.equals(docHeaderDTO.getDocType(), docType)).findFirst().orElse(null);
+        Assert.isTrue(ObjectUtil.isNotEmpty(bionutritionDocHeaderDTO), "明细对应单据头不存在或单据类型不对应");
+        return buildBionutritionDocBaseDTO(bionutritionDocHeaderDTO);
+    }
+
     /**
      * 单据导出excel
      *
@@ -252,6 +273,7 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
             cell.setCellValue(docFieldRemarkMap.get(totalFields[i].getName()));
         }
 
+
         startRow = 3;
         try {
             // 4.设置数据
@@ -259,6 +281,9 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
 
                 BionutritionDocHeaderBaseExcel headerExcel = baseExcel.getBionutritionDocHeaderBaseExcelDTO();
                 List<BionutritionDocDetailsBaseExcel> detailsExcelList = baseExcel.getBionutritionDocDetailsBaseExcelList();
+                // Todo 导出对象转map获取值
+//                DocToMap(headerExcel,docExcelQueryDTO.getDocType());
+
                 // 获取当前单头字段值
                 Map<String, Object> headerPropertyMap = getPropertyMap(docHeaderClass, (Object) totalHeaderFields, headerExcel);
                 log.info("单头字段值:{}", headerPropertyMap);
@@ -308,6 +333,23 @@ public class BionutritionDocHeaderServiceImpl extends CrudServiceImpl<Bionutriti
             e.printStackTrace();
         }
 
+    }
+
+    private void DocToMap(BionutritionDocHeaderBaseExcel headerExcel, String docType) throws ClassNotFoundException {
+        /*Map<String, Object> map = BeanUtil.beanToMap(headerExcel);
+
+        String docFieldRemark = sysConfigService.selectConfigByKey(Constant.SYS_DOC_FIELD_REMARK);
+        log.info("单据字段对应配置信息:{}",docFieldRemark);
+        Assert.isTrue(StringUtils.isNotBlank(docFieldRemark),"单据中文字段配置信息获取失败");
+        Map<String, String> docFieldRemarkMap = JSONObject.parseObject(docFieldRemark, Map.class);
+        Map<String, Object> remarkValueMap = docFieldRemarkMap.entrySet().stream().collect(Collectors.toMap(Map.Entry::getValue, item -> map.get(item.getKey())));
+        remarkValueMap.forEach(item -> cell.setcell());
+
+
+        map.entrySet().forEach(e-> System.out.println(e.getKey()+":"+e.getValue()));*/
+//        BeanUtil.mapToBean(map, docHeaderClass, true, CopyOptions.create());
+
+
     }
 
     /**

+ 44 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/AsnAgvCallDTO.java

@@ -0,0 +1,44 @@
+package com.ruoyi.ams.bionutrition.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+@Data
+public class AsnAgvCallDTO implements Serializable {
+
+    private static final long serialVersionUID = -4456436886909836579L;
+    /**
+     * 单据号
+     */
+    private String docNo ;
+    /**
+     * 起始库位
+     */
+    @NotBlank(message = "请选择起始点位")
+    private String locationFrom;
+    /**
+     * 目标库位
+     */
+    private String locationTo;
+    /**
+     * 产品批号
+     */
+    @NotBlank(message = "请填写产品批号")
+    private String batchNumber ;
+    /**
+     * 数量
+     */
+    private String qty;
+    /**
+     * 物料编号
+     */
+    @NotBlank(message = "请填写物料信息")
+    private String skuCode;
+    /**
+     * 单据类型
+     */
+    @NotBlank(message = "单据类型不确定")
+    private String docType;
+}

+ 33 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/DocQcDTO.java

@@ -0,0 +1,33 @@
+package com.ruoyi.ams.bionutrition.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+/**
+ * 单据质检参数对象
+ */
+@Data
+public class DocQcDTO implements Serializable {
+
+    private static final long serialVersionUID = -35010226008676367L;
+
+    /**
+     * 物料编码
+     */
+    @NotBlank(message = "物料编码不能为空")
+    private String skuCode;
+    /**
+     * 批次状态
+     * HG:合格 BHG:不合格 DJ:待检{@link com.ruoyi.base.constant.Constant.QUALITY_STATUS}
+     */
+    @NotBlank(message = "状态不能为空")
+    private String status;
+    /**
+     * 批次号
+     */
+    @NotBlank(message = "批次号不能为空")
+    private String batchNumber;
+
+}

+ 36 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/dto/OrderAgvCallDTO.java

@@ -0,0 +1,36 @@
+package com.ruoyi.ams.bionutrition.dto;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import java.io.Serializable;
+
+@Data
+public class OrderAgvCallDTO implements Serializable {
+    private static final long serialVersionUID = 3317702320870220836L;
+
+    /**
+     * 目标库位
+     */
+    @NotBlank(message = "请选择目标库位")
+    private String locationTo;
+    /**
+     * 产品批号
+     */
+    @NotBlank(message = "请填写产品批号")
+    private String batchNumber ;
+    /**
+     * 数量
+     */
+    private String qty;
+    /**
+     * 物料编号
+     */
+    @NotBlank(message = "请填写物料信息")
+    private String skuCode;
+    /**
+     * 单据类型
+     */
+    @NotBlank(message = "单据类型不确定")
+    private String docType;
+}

+ 14 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/IPdaAgvCallService.java

@@ -0,0 +1,14 @@
+package com.ruoyi.ams.bionutrition.pda;
+
+import com.ruoyi.ams.bionutrition.dto.AsnAgvCallDTO;
+
+/**
+ * 佰穗莱pda呼叫AGV生成搬运任务
+ */
+public interface IPdaAgvCallService {
+    /**
+     * 创建入库任务
+     * @param asnAgvCallDTO
+     */
+    void createIntoStorageTask(AsnAgvCallDTO asnAgvCallDTO);
+}

+ 23 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/IPdaDocQcService.java

@@ -0,0 +1,23 @@
+package com.ruoyi.ams.bionutrition.pda;
+
+import com.ruoyi.ams.bionutrition.dto.DocQcDTO;
+
+import java.util.List;
+
+/**
+ * 佰穗莱pda呼叫AGV生成搬运任务
+ */
+public interface IPdaDocQcService {
+
+    /**
+     * 质检提交
+     * @param docQcDTO
+     */
+    void docQcSubmit(DocQcDTO docQcDTO, String updateBy);
+
+    /**
+     * 获取质检列表
+     * @return
+     */
+    List<DocQcDTO> getQcList(String sku);
+}

+ 179 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/impl/PdaAgvCallServiceImpl.java

@@ -0,0 +1,179 @@
+package com.ruoyi.ams.bionutrition.pda.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.json.JSONArray;
+import cn.hutool.json.JSONObject;
+import cn.hutool.json.JSONUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.ruoyi.ams.bionutrition.doc.domain.BionutritionDocDetails;
+import com.ruoyi.ams.bionutrition.doc.domain.BionutritionDocHeader;
+import com.ruoyi.ams.bionutrition.doc.dto.BionutritionDocBaseDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.BionutritionDocDetailsDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.BionutritionDocHeaderDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.DocLotattDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.detail.BionutritionDocDetailsBaseDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.detail.FinishedProductReceiptDetailsDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.detail.PurchaseOrderDetailsDTO;
+import com.ruoyi.ams.bionutrition.doc.dto.header.BionutritionDocHeaderBaseDTO;
+import com.ruoyi.ams.bionutrition.doc.service.BionutritionDocDetailsService;
+import com.ruoyi.ams.bionutrition.doc.service.BionutritionDocHeaderService;
+import com.ruoyi.ams.bionutrition.dto.AsnAgvCallDTO;
+import com.ruoyi.ams.bionutrition.pda.IPdaAgvCallService;
+import com.ruoyi.ams.business.IBusinessService;
+import com.ruoyi.ams.config.domain.dto.AgvCallDTO;
+import com.ruoyi.ams.config.domain.dto.AgvCallItemDTO;
+import com.ruoyi.ams.config.domain.dto.LotattDTO;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.base.constant.type.BizEnum;
+import com.ruoyi.base.domain.BaseSku;
+import com.ruoyi.base.service.IBaseSkuService;
+import com.ruoyi.common.constant.base.EnumUtils;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.ConvertUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.service.ISysConfigService;
+import lombok.extern.slf4j.Slf4j;
+import org.jetbrains.annotations.NotNull;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Service
+public class PdaAgvCallServiceImpl implements IPdaAgvCallService {
+
+    @Autowired
+    private BionutritionDocHeaderService bionutritionDocHeaderService;
+    @Autowired
+    private BionutritionDocDetailsService bionutritionDocDetailsService;
+    @Autowired
+    private IBusinessService businessService;
+    @Autowired
+    private ISysConfigService iSysConfigService;
+    @Autowired
+    private IBaseSkuService skuService;
+
+    /**
+     * 入库单据类型
+     */
+    private final List<String> IntoStorageDocTypeList = Arrays.asList("FinishedProductReceipt", "ProductionReturnOrder", "PurchaseOrder", "SaleReturnOrder");
+
+    /**
+     * 入库
+     * @param asnAgvCallDTO
+     */
+    @Override
+    @Transactional(rollbackFor = RuntimeException.class)
+    public void createIntoStorageTask(AsnAgvCallDTO asnAgvCallDTO) {
+        // 根据单号查询单据 || 根据物料编码和批次号查询单据信息
+//        BionutritionDocBaseDTO bionutritionDocBaseDTO = bionutritionDocHeaderService.selectDocByDocNo(asnAgvCallDTO.getDocNo());
+        BionutritionDocBaseDTO bionutritionDocBaseDTO = bionutritionDocHeaderService.selectDocBySkuAndBatchNumber(
+                asnAgvCallDTO.getSkuCode(),asnAgvCallDTO.getBatchNumber(), asnAgvCallDTO.getDocType());
+        // 校验参数
+        Assert.isTrue(ObjectUtil.isNotNull(bionutritionDocBaseDTO), "该单据不存在");
+        String docType = bionutritionDocBaseDTO.getBionutritionDocHeaderBaseDTO().getDocType();
+        Assert.isTrue(StringUtils.isNotEmpty(docType), "单据信息中物料类型为空");
+        Assert.isTrue(IntoStorageDocTypeList.contains(docType), "该单据不是入库单据");
+        List<BionutritionDocDetailsBaseDTO> docDetailsList = bionutritionDocBaseDTO.getBionutritionDocDetailsBaseDTOList();
+        Assert.isTrue(CollUtil.isNotEmpty(docDetailsList), "单据明细数据为空");
+        // 如果是采购入库 需要根据采购单生成采购入库单
+        if (StringUtils.equals(docType, BizEnum.BionutritionExcelDocTitleEnum.PURCHASE_ORDER.getDocType())) {
+            addPurchaseReceiptDoc(bionutritionDocBaseDTO, docDetailsList);
+        }
+        // 获取配置信息单据类型对应流程id
+        Long flowId = getFlowIdByDocType(docType);
+        // 生成agv呼叫对象,生成对应wcs任务
+        AgvCallDTO agvCallDTO = getAgvCallDTO(asnAgvCallDTO, docDetailsList.get(0));
+        businessService.agvCall(flowId, agvCallDTO);
+    }
+
+    /**
+     * 根据单据类型获取流程id
+     * @param docType
+     * @return
+     */
+    @NotNull
+    private Long getFlowIdByDocType(String docType) {
+        JSONArray docTypeFlowObjects = JSONUtil.parseArray(iSysConfigService.selectConfigByKey("sys.docType.corresponding.business"));
+        JSONObject jsonObject = docTypeFlowObjects.stream().map(o -> JSONUtil.parseObj(o.toString()))
+                .filter(entry -> StringUtils.equals(docType, (String) entry.get("docType"))).findFirst().orElse(null);
+        Assert.notNull(jsonObject, "未查找到该单据号对应单据类型");
+        Assert.notNull(jsonObject.get("flowId"), "未找到对应的任务下发流程");
+        Long flowId = Long.parseLong(jsonObject.get("flowId").toString());
+        return flowId;
+    }
+
+    /**
+     * 添加采购入库单
+     * @param bionutritionDocBaseDTO
+     * @param docDetailsList
+     */
+    private void addPurchaseReceiptDoc(BionutritionDocBaseDTO bionutritionDocBaseDTO, List<BionutritionDocDetailsBaseDTO> docDetailsList) {
+        // 单头、明细设置新id主键
+        BionutritionDocHeaderBaseDTO docHeaderBaseDTO = bionutritionDocBaseDTO.getBionutritionDocHeaderBaseDTO();
+        String headerId = IdWorker.getIdStr();
+        docHeaderBaseDTO.setId(headerId);
+        docDetailsList.stream().forEach(detail->{
+            detail.setDocHeaderId(headerId);
+            detail.setId(IdWorker.getIdStr());
+        });
+        // 生成采购入库单
+        bionutritionDocDetailsService.insertBatch(ConvertUtils.sourceToTarget(docDetailsList, BionutritionDocDetails.class));
+        BionutritionDocHeaderDTO bionutritionDocHeaderDTO = ConvertUtils.sourceToTarget(docHeaderBaseDTO, BionutritionDocHeaderDTO.class);
+        bionutritionDocHeaderDTO.setDocType(BizEnum.BionutritionExcelDocTitleEnum.PURCHASE_RECEIPT.getDocType());
+        bionutritionDocHeaderService.insertDocHeader(bionutritionDocHeaderDTO);
+    }
+
+    /**
+     * 生成agv呼叫对象
+     * @param asnAgvCallDTO
+     * @return
+     */
+    private AgvCallDTO getAgvCallDTO(AsnAgvCallDTO asnAgvCallDTO, BionutritionDocDetailsBaseDTO docDetailsBaseDTO) {
+        DocLotattDTO docLotattDTO = ConvertUtils.sourceToTarget(docDetailsBaseDTO, DocLotattDTO.class);
+        // 根据物料编码查询物料信息
+        BaseSku baseSku = skuService.selectBaseSkuByCustomerId("default", docDetailsBaseDTO.getSkuCode());
+        Assert.isTrue(ObjectUtil.isNotEmpty(baseSku), "物料信息未找到");
+        List<AgvCallItemDTO> agvCallItemDTOList = new ArrayList<>();
+        AgvCallItemDTO agvCallItemDTO = new AgvCallItemDTO();
+        // 构建批次属性
+        LotattDTO lotattDTO = buildLotattArgument(docDetailsBaseDTO, docLotattDTO, baseSku);
+
+        agvCallItemDTO.setSku(asnAgvCallDTO.getSkuCode());
+        agvCallItemDTO.setLotattDTO(lotattDTO);
+        agvCallItemDTOList.add(agvCallItemDTO);
+        AgvCallDTO agvCallDTO = new AgvCallDTO();
+        agvCallDTO.setLocationFrom(asnAgvCallDTO.getLocationFrom());
+        agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
+        return agvCallDTO;
+    }
+
+    /**
+     * 构建批次属性
+     * @param docDetailsBaseDTO
+     * @param docLotattDTO
+     * @param baseSku
+     */
+    private LotattDTO buildLotattArgument(BionutritionDocDetailsBaseDTO docDetailsBaseDTO, DocLotattDTO docLotattDTO, BaseSku baseSku) {
+        LotattDTO lotattDTO = new LotattDTO();
+        lotattDTO.setLotatt01(docLotattDTO.getVendorCode());// 供应商编码
+        lotattDTO.setLotatt02(docLotattDTO.getBatchNumber());// 批号
+        lotattDTO.setLotatt03(DateUtil.format(docLotattDTO.getManufactureDate(), "yyyy-MM-dd"));// 生产日期
+        lotattDTO.setLotatt04(String.valueOf(baseSku.getSkuShelflife()));// 有效期
+        lotattDTO.setLotatt05(Constant.QUALITY_STATUS.DJ.getValue());// 质检状态
+        lotattDTO.setLotatt06(DateUtil.format(new Date(), "yyyy-MM-dd"));// 入库日期
+        lotattDTO.setLotatt07(StringUtils.isNotEmpty(docLotattDTO.getSpecification())
+                ? docLotattDTO.getSpecification() : baseSku.getSkuSpecs());// 规格型号
+        lotattDTO.setLotatt08(DateUtil.format(docDetailsBaseDTO.getCreateDate(), "yyyy-MM-dd"));// 收货日期
+        return lotattDTO;
+    }
+}

+ 114 - 0
warewms-ams/src/main/java/com/ruoyi/ams/bionutrition/pda/impl/PdaDocQcServiceImpl.java

@@ -0,0 +1,114 @@
+package com.ruoyi.ams.bionutrition.pda.impl;
+
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Assert;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.ruoyi.ams.bionutrition.dto.DocQcDTO;
+import com.ruoyi.ams.bionutrition.pda.IPdaDocQcService;
+import com.ruoyi.ams.business.IBusinessService;
+import com.ruoyi.ams.inv.domain.InvLotAtt;
+import com.ruoyi.ams.inv.domain.InvLotLocId;
+import com.ruoyi.ams.inv.dto.InvMoveDTO;
+import com.ruoyi.ams.inv.service.IInvLotAttService;
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
+import com.ruoyi.base.constant.Constant;
+import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.service.IBaseLocationInfoService;
+import com.ruoyi.common.core.redis.RedisKey;
+import com.ruoyi.common.exception.ServiceException;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+
+@Slf4j
+@Service
+public class PdaDocQcServiceImpl implements IPdaDocQcService {
+
+    @Autowired
+    private IInvLotAttService invLotAttService;
+    @Autowired
+    private IInvLotLocIdService invLotLocIdService;
+    @Autowired
+    private IBusinessService businessService;
+    @Autowired
+    private IBaseLocationInfoService baseLocationInfoService;
+
+    /**
+     * PDA质检
+     * @param docQcDTO
+     * @param updateBy
+     */
+    @Override
+    @Transactional(rollbackFor = RuntimeException.class)
+    public void docQcSubmit(DocQcDTO docQcDTO, String updateBy) {
+        // 根据物料编码和批号查询批次信息
+        List<InvLotAtt> invLotAttList = invLotAttService.selectInvLotAttByBatchNum(docQcDTO.getBatchNumber(), docQcDTO.getSkuCode());
+        Assert.isTrue(CollUtil.isNotEmpty(invLotAttList), "所属批次信息未找到");
+        for (InvLotAtt invLotAtt : invLotAttList) {
+            String lotnum = invLotAtt.getLotnum();
+            // 根据批次号查询库存信息
+            List<InvLotLocId> invLotLocIds = invLotLocIdService.selectInvLotLocIdByLotnum(lotnum);
+            // 如果没有对应的库存信息,遍历下一条批次数据 因为根据物料和批号会匹配到多条仅仅是质检状态不同批次数据
+            if (CollUtil.isNotEmpty(invLotLocIds)) continue;
+            // 设置状态
+            invLotAtt.setLotatt05(docQcDTO.getStatus());
+            String lotNumNew = IdWorker.getIdStr();
+            // 更新批次号
+            invLotAtt.setLotnum(lotNumNew);
+            // 插入一条批次信息
+            invLotAttService.insertInvLotAtt(invLotAtt);
+            // 修改库存表对应的批次号
+            invLotLocIdService.updateInvLotLocIdByLotNum(lotnum, lotNumNew);
+            // 如果是不合格 生成搬运任务到不合格区
+            if (StringUtils.equals(docQcDTO.getStatus(), Constant.QUALITY_STATUS.BHG.getValue())) {
+                createConveyTaskToBHGZone(updateBy, lotNumNew);
+            }
+        }
+    }
+
+    /**
+     * 生成搬运任务到不合格区
+     *
+     * @param updateBy
+     * @param lotNumNew
+     */
+    private void createConveyTaskToBHGZone(String updateBy, String lotNumNew) {
+        List<InvLotLocId> invLotLocIdList = invLotLocIdService.selectInvLotLocIdByLotnum(lotNumNew);
+        Assert.isTrue(CollUtil.isNotEmpty(invLotLocIdList), "未找到批号对应库存");
+        int availableLocNumber = 0;
+        // 同一批次多个库位库存都需要搬运至不合格区
+        for (InvLotLocId invLotLocId : invLotLocIdList) {
+            // 获取所有不合格区库位
+            List<BaseLocationInfo> baseLocationToList = baseLocationInfoService.selectSortedLocatinListByZoneId(
+                    Long.parseLong(Constant.LOCATION_ZONE.BHG_ZONE.getValue()), Constant.WAREHOUSE_ID, null);
+            BaseLocationInfo locationInfo = null;
+            for (BaseLocationInfo b : baseLocationToList) {
+                // 获取一个没有任务且为空的库位
+                if (StringUtils.equals(b.getStockStatus(), Constant.STOCK_STATUS.STOCK00.getValue())
+                        && StringUtils.equals(b.getIsEmpty(), Constant.IS_YES.Y.name())) {
+                    locationInfo = b;
+                    availableLocNumber++;
+                    break;
+                }
+            }
+            //没有可分配库位 后续不合格库存暂时不生成任务
+            if (locationInfo == null) {
+                throw new ServiceException("当前批次库存有" + invLotLocIdList.size() + "托,不合格区可用库位有"+availableLocNumber+"个");
+            }
+            InvMoveDTO invMoveDTO = new InvMoveDTO(invLotLocId.getLocationId(), String.valueOf(locationInfo.getId()));
+            invLotLocIdService.move(invMoveDTO, updateBy);
+        }
+    }
+
+    @Override
+    public List<DocQcDTO> getQcList(String sku) {
+        return invLotAttService.getQcList(sku);
+    }
+}

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

@@ -12,6 +12,7 @@ import com.ruoyi.ams.config.domain.vo.FlowConfigHeaderVO;
 import com.ruoyi.ams.config.mapper.AsnSoStrategyMapper;
 import com.ruoyi.ams.config.service.IFlowConfigHeaderService;
 import com.ruoyi.ams.config.service.LocationAllocationStrategy;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IInvLotAttService;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
@@ -141,19 +142,17 @@ public class BusinessServiceImpl implements IBusinessService {
                 }
 
                 if (flowConfigHeaderVO.getFlowType().equals("ASN")) {
-                    // 统计入库箱数
-                    List<AgvCallItemDTO> agvCallItemDTOList = agvCallDTO.getAgvCallItemDTOList();
-                    int boxNum = agvCallItemDTOList.size();
-//                    int boxNum = agvCallItemDTOList.stream()
-//                            .mapToInt(v -> v.getQty().intValue())
-//                            .reduce(Integer::sum).getAsInt();
-                    asnSoStrategy.setAsnHeightLimit(boxNum + "");
-                    log.info("统计箱数量:" + boxNum);
 
                     List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
                     List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), "shift_no+ 0,shift_index");
+
                     locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "ASN", asnSoStrategy, token);
                     locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "ASN", asnSoStrategy, token);
+                    // 初始化库存
+                    // 删除起始点库存
+                    invLotLocIdService.deleteInvLotLocIdById(locationFrom.getId());
+                    // 添加批次和库存信息
+                    invLotLocIdService.initInv(locationFrom.getId().toString(), agvCallDTO);
                     wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, agvCallDTO, token));
 
                 } else if (flowConfigHeaderVO.getFlowType().equals("SO")) {
@@ -176,7 +175,7 @@ public class BusinessServiceImpl implements IBusinessService {
                     locationTo = this.zoneLocationAllocation(locationToList, "locationTo", "SO", asnSoStrategy, token);
                     wcsTaskList.addAll(this.genTask(locationFrom, locationTo, flowConfigHeaderVO, agvCallDTO, token));
 
-                }else if (flowConfigHeaderVO.getFlowType().equals("MV")) {
+                } else if (flowConfigHeaderVO.getFlowType().equals("MV")) {
                     List<BaseLocationInfo> locationFromList = this.convertLocation(paramLocationFrom, agvCallDTO.getWarehouseId(), null);
                     List<BaseLocationInfo> locationToList = this.convertLocation(paramLocationTo, agvCallDTO.getWarehouseId(), null);
                     locationFrom = this.zoneLocationAllocation(locationFromList, "locationFrom", "MV", asnSoStrategy, token);
@@ -193,10 +192,8 @@ public class BusinessServiceImpl implements IBusinessService {
             return AjaxResult.success("任务下发成功");
         } catch (Exception e) {
             redisCache.unlockCacheObject(token); // 异常捕获的话就不能释放锁
-//            throw new ServiceException(e.getMessage(), token);
-            e.printStackTrace();
+            throw new ServiceException(e.getMessage(), token);
         }
-        return AjaxResult.error();
     }
 
     @Transactional
@@ -315,8 +312,10 @@ public class BusinessServiceImpl implements IBusinessService {
                     if (!b.getStockStatus().equals("00") || !b.getIsEmpty().equals("Y") || redisCache.checkIsLock(RedisKey.LOCK_LOCATION + b.getId())) {
                         continue;
                     }
+                    // 优先分配
+
                     // 第六层不能放数量超过2的货
-                    int boxNum = Integer.parseInt(asnSoStrategy.getAsnHeightLimit());
+                    /*int boxNum = Integer.parseInt(asnSoStrategy.getAsnHeightLimit());
                     if (b.getShiftNo().equals("6")) {
                         if (boxNum > 2) continue;
                     } else {
@@ -325,7 +324,7 @@ public class BusinessServiceImpl implements IBusinessService {
                             log.error("入库箱数量不能超过6!");
                             continue;
                         }
-                    }
+                    }*/
                     if (!redisCache.lockCacheObject(RedisKey.LOCK_LOCATION + b.getId(), b.getId().toString(), token)) {
                         continue;
                     }
@@ -469,7 +468,7 @@ public class BusinessServiceImpl implements IBusinessService {
             wcsTask.setExt6(StringUtils.isNotEmpty(agvCallDTO.getToArea()) ? agvCallDTO.getToArea() : "");
             // 三向车叉尺方向(货叉朝左1,朝右2,中位或其他0)
             // 如果起始点是仓储区,左1,右2,我们系统A是靠马路也就是叉尺的右边
-            if (locationFrom.getZoneId() != null
+            /*if (locationFrom.getZoneId() != null
                     && Objects.equals(locationFrom.getZoneId(), Constant.ZONE_TYPE.STORAGE.getValue())) {
                 wcsTask.setExt4(locationFrom.getRowNo().equals("A") ? "2" : "1");
             }
@@ -477,7 +476,7 @@ public class BusinessServiceImpl implements IBusinessService {
             if (locationFrom.getZoneId() != null
                     && Objects.equals(locationFrom.getZoneId(), Constant.ZONE_TYPE.TRANSIT.getValue())) {
                 wcsTask.setExt4("1");
-            }
+            }*/
             wcsTask.setExtParam(agvCallDTO.getExtParam());
             wcsTaskList.add(wcsTask);
             businessService.addTask(wcsTask);

+ 33 - 0
warewms-ams/src/main/java/com/ruoyi/ams/config/domain/dto/LotattDTO.java

@@ -10,16 +10,49 @@ import java.util.Map;
  */
 public class LotattDTO {
 
+    /**
+     * 客户编码
+     */
     private String lotatt01;
+    /**
+     * 批号
+     */
     private String lotatt02;
+    /**
+     * 生产日期
+     */
     private String lotatt03;
+    /**
+     * 有效期
+     */
     private String lotatt04;
+    /**
+     * 检验状态
+     */
     private String lotatt05;
+    /**
+     * 入库日期
+     */
     private String lotatt06;
+    /**
+     * 规格型号
+     */
     private String lotatt07;
+    /**
+     * 收货日期
+     */
     private String lotatt08;
+    /**
+     * 总净重
+     */
     private String lotatt09;
+    /**
+     * 总毛重
+     */
     private String lotatt10;
+    /**
+     * 总皮重
+     */
     private String lotatt11;
     private String lotatt12;
     private String lotatt13;

+ 9 - 162
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/InvLotLocId.java

@@ -1,6 +1,8 @@
 package com.ruoyi.ams.inv.domain;
 
 import java.math.BigDecimal;
+
+import lombok.Data;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.annotation.Excel;
@@ -8,10 +10,11 @@ import com.ruoyi.common.core.domain.BaseEntity;
 
 /**
  * 库位库存信息对象 inv_lot_loc_id
- * 
+ *
  * @author andy
  * @date 2022-03-03
  */
+@Data
 public class InvLotLocId extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
@@ -52,6 +55,11 @@ public class InvLotLocId extends BaseEntity
     @Excel(name = "上架数量")
     private BigDecimal qtypa;
 
+    /**
+     * 是否过期
+     */
+    private String isExpire;
+
     /** $column.columnComment */
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private BigDecimal qtyrpin;
@@ -72,165 +80,4 @@ public class InvLotLocId extends BaseEntity
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
     private BigDecimal qtyonhold;
 
-    public void setLotnum(String lotnum) 
-    {
-        this.lotnum = lotnum;
-    }
-
-    public String getLotnum() 
-    {
-        return lotnum;
-    }
-    public void setLocationId(String locationId) 
-    {
-        this.locationId = locationId;
-    }
-
-    public String getLocationId() 
-    {
-        return locationId;
-    }
-    public void setTraceid(String traceid) 
-    {
-        this.traceid = traceid;
-    }
-
-    public String getTraceid() 
-    {
-        return traceid;
-    }
-    public void setCustomerId(String customerId) 
-    {
-        this.customerId = customerId;
-    }
-
-    public String getCustomerId() 
-    {
-        return customerId;
-    }
-    public void setSku(String sku) 
-    {
-        this.sku = sku;
-    }
-
-    public String getSku() 
-    {
-        return sku;
-    }
-    public void setQty(BigDecimal qty) 
-    {
-        this.qty = qty;
-    }
-
-    public BigDecimal getQty() 
-    {
-        return qty;
-    }
-    public void setQtyEach(BigDecimal qtyEach) 
-    {
-        this.qtyEach = qtyEach;
-    }
-
-    public BigDecimal getQtyEach() 
-    {
-        return qtyEach;
-    }
-    public void setQtyallocated(BigDecimal qtyallocated) 
-    {
-        this.qtyallocated = qtyallocated;
-    }
-
-    public BigDecimal getQtyallocated() 
-    {
-        return qtyallocated;
-    }
-    public void setQtyallocatedEach(BigDecimal qtyallocatedEach) 
-    {
-        this.qtyallocatedEach = qtyallocatedEach;
-    }
-
-    public BigDecimal getQtyallocatedEach() 
-    {
-        return qtyallocatedEach;
-    }
-    public void setQtypa(BigDecimal qtypa) 
-    {
-        this.qtypa = qtypa;
-    }
-
-    public BigDecimal getQtypa() 
-    {
-        return qtypa;
-    }
-    public void setQtyrpin(BigDecimal qtyrpin) 
-    {
-        this.qtyrpin = qtyrpin;
-    }
-
-    public BigDecimal getQtyrpin() 
-    {
-        return qtyrpin;
-    }
-    public void setQtyrpout(BigDecimal qtyrpout) 
-    {
-        this.qtyrpout = qtyrpout;
-    }
-
-    public BigDecimal getQtyrpout() 
-    {
-        return qtyrpout;
-    }
-    public void setQtymvin(BigDecimal qtymvin) 
-    {
-        this.qtymvin = qtymvin;
-    }
-
-    public BigDecimal getQtymvin() 
-    {
-        return qtymvin;
-    }
-    public void setQtymvout(BigDecimal qtymvout) 
-    {
-        this.qtymvout = qtymvout;
-    }
-
-    public BigDecimal getQtymvout() 
-    {
-        return qtymvout;
-    }
-    public void setQtyonhold(BigDecimal qtyonhold) 
-    {
-        this.qtyonhold = qtyonhold;
-    }
-
-    public BigDecimal getQtyonhold() 
-    {
-        return qtyonhold;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("lotnum", getLotnum())
-            .append("locationId", getLocationId())
-            .append("traceid", getTraceid())
-            .append("customerId", getCustomerId())
-            .append("sku", getSku())
-            .append("qty", getQty())
-            .append("qtyEach", getQtyEach())
-            .append("qtyallocated", getQtyallocated())
-            .append("qtyallocatedEach", getQtyallocatedEach())
-            .append("qtypa", getQtypa())
-            .append("qtyrpin", getQtyrpin())
-            .append("qtyrpout", getQtyrpout())
-            .append("qtymvin", getQtymvin())
-            .append("qtymvout", getQtymvout())
-            .append("qtyonhold", getQtyonhold())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
 }

+ 8 - 56
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/form/InvLocIdSearchFrom.java

@@ -1,12 +1,15 @@
 package com.ruoyi.ams.inv.domain.form;
 
 import com.ruoyi.ams.config.domain.dto.LotattDTO;
+import com.ruoyi.base.constant.Constant;
+import lombok.Data;
 
 /**
  * Created by IntelliJ IDEA.
  * User: andy.qu
  * Date: 2022/3/14
  */
+@Data
 public class InvLocIdSearchFrom {
     private String sku;
     private String zoneId;
@@ -15,60 +18,9 @@ public class InvLocIdSearchFrom {
     private LotattDTO lotattDTO;
     private String palletNo;
     private String qualityStatus;
-
-    public String getSku() {
-        return sku;
-    }
-
-    public void setSku(String sku) {
-        this.sku = sku;
-    }
-
-    public String getZoneId() {
-        return zoneId;
-    }
-
-    public void setZoneId(String zoneId) {
-        this.zoneId = zoneId;
-    }
-
-    public String getLocationNo() {
-        return locationNo;
-    }
-
-    public void setLocationNo(String locationNo) {
-        this.locationNo = locationNo;
-    }
-
-    public String getIsFull() {
-        return isFull;
-    }
-
-    public void setIsFull(String isFull) {
-        this.isFull = isFull;
-    }
-
-    public LotattDTO getLotattDTO() {
-        return lotattDTO;
-    }
-
-    public void setLotattDTO(LotattDTO lotattDTO) {
-        this.lotattDTO = lotattDTO;
-    }
-
-    public String getPalletNo() {
-        return palletNo;
-    }
-
-    public void setPalletNo(String palletNo) {
-        this.palletNo = palletNo;
-    }
-
-    public String getQualityStatus() {
-        return qualityStatus;
-    }
-
-    public void setQualityStatus(String qualityStatus) {
-        this.qualityStatus = qualityStatus;
-    }
+    /**
+     * 是否过期 EXPIRED-过期;UNEXPIRED-未过期;WITHIN_THIRTY_DAYS-三十天内过期
+     * {@link Constant.EXPIRE_STATUS}
+     */
+    private String isExpire;
 }

+ 4 - 247
warewms-ams/src/main/java/com/ruoyi/ams/inv/domain/vo/InvLotLocIdLotattVO.java

@@ -1,10 +1,13 @@
 package com.ruoyi.ams.inv.domain.vo;
 
+import lombok.Data;
+
 /**
  * Created by IntelliJ IDEA.
  * User: andy.qu
  * Date: 2022/3/14
  */
+@Data
 public class InvLotLocIdLotattVO {
     private Long locationId;
     private String lotnum;
@@ -19,6 +22,7 @@ public class InvLotLocIdLotattVO {
     private Double weight;
     private String palletNo;
     private String isFull;
+    private String isExpire;
     private String lotatt01;
     private String lotatt02;
     private String lotatt03;
@@ -38,251 +42,4 @@ public class InvLotLocIdLotattVO {
     private String lotatt17;
     private String lotatt18;
 
-    public String getLotatt01() {
-        return lotatt01;
-    }
-
-    public void setLotatt01(String lotatt01) {
-        this.lotatt01 = lotatt01;
-    }
-
-    public String getLotatt02() {
-        return lotatt02;
-    }
-
-    public void setLotatt02(String lotatt02) {
-        this.lotatt02 = lotatt02;
-    }
-
-    public String getLotatt03() {
-        return lotatt03;
-    }
-
-    public void setLotatt03(String lotatt03) {
-        this.lotatt03 = lotatt03;
-    }
-
-    public String getLotatt04() {
-        return lotatt04;
-    }
-
-    public void setLotatt04(String lotatt04) {
-        this.lotatt04 = lotatt04;
-    }
-
-    public String getLotatt05() {
-        return lotatt05;
-    }
-
-    public void setLotatt05(String lotatt05) {
-        this.lotatt05 = lotatt05;
-    }
-
-    public String getLotatt06() {
-        return lotatt06;
-    }
-
-    public void setLotatt06(String lotatt06) {
-        this.lotatt06 = lotatt06;
-    }
-
-    public String getLotatt07() {
-        return lotatt07;
-    }
-
-    public void setLotatt07(String lotatt07) {
-        this.lotatt07 = lotatt07;
-    }
-
-    public String getLotatt08() {
-        return lotatt08;
-    }
-
-    public void setLotatt08(String lotatt08) {
-        this.lotatt08 = lotatt08;
-    }
-
-    public String getLotatt09() {
-        return lotatt09;
-    }
-
-    public void setLotatt09(String lotatt09) {
-        this.lotatt09 = lotatt09;
-    }
-
-    public String getLotatt10() {
-        return lotatt10;
-    }
-
-    public void setLotatt10(String lotatt10) {
-        this.lotatt10 = lotatt10;
-    }
-
-    public String getLotatt11() {
-        return lotatt11;
-    }
-
-    public void setLotatt11(String lotatt11) {
-        this.lotatt11 = lotatt11;
-    }
-
-    public String getLotatt12() {
-        return lotatt12;
-    }
-
-    public void setLotatt12(String lotatt12) {
-        this.lotatt12 = lotatt12;
-    }
-
-    public String getLotatt13() {
-        return lotatt13;
-    }
-
-    public void setLotatt13(String lotatt13) {
-        this.lotatt13 = lotatt13;
-    }
-
-    public String getLotatt14() {
-        return lotatt14;
-    }
-
-    public void setLotatt14(String lotatt14) {
-        this.lotatt14 = lotatt14;
-    }
-
-    public String getLotatt15() {
-        return lotatt15;
-    }
-
-    public void setLotatt15(String lotatt15) {
-        this.lotatt15 = lotatt15;
-    }
-
-    public String getLotatt16() {
-        return lotatt16;
-    }
-
-    public void setLotatt16(String lotatt16) {
-        this.lotatt16 = lotatt16;
-    }
-
-    public String getLotatt17() {
-        return lotatt17;
-    }
-
-    public void setLotatt17(String lotatt17) {
-        this.lotatt17 = lotatt17;
-    }
-
-    public String getLotatt18() {
-        return lotatt18;
-    }
-
-    public void setLotatt18(String lotatt18) {
-        this.lotatt18 = lotatt18;
-    }
-
-    public String getLotnum() {
-        return lotnum;
-    }
-
-    public void setLotnum(String lotnum) {
-        this.lotnum = lotnum;
-    }
-
-    public String getCustomerId() {
-        return customerId;
-    }
-
-    public void setCustomerId(String customerId) {
-        this.customerId = customerId;
-    }
-
-    public String getSku() {
-        return sku;
-    }
-
-    public void setSku(String sku) {
-        this.sku = sku;
-    }
-
-    public String getLocationNo() {
-        return locationNo;
-    }
-
-    public void setLocationNo(String locationNo) {
-        this.locationNo = locationNo;
-    }
-
-    public Double getQty() {
-        return qty;
-    }
-
-    public void setQty(Double qty) {
-        this.qty = qty;
-    }
-
-    public Double getQtyallocated() {
-        return qtyallocated;
-    }
-
-    public void setQtyallocated(Double qtyallocated) {
-        this.qtyallocated = qtyallocated;
-    }
-
-    public Long getLocationId() {
-        return locationId;
-    }
-
-    public void setLocationId(Long locationId) {
-        this.locationId = locationId;
-    }
-
-    public String getSkuName() {
-        return skuName;
-    }
-
-    public void setSkuName(String skuName) {
-        this.skuName = skuName;
-    }
-
-    public String getSkuTypeName() {
-        return skuTypeName;
-    }
-
-    public void setSkuTypeName(String skuTypeName) {
-        this.skuTypeName = skuTypeName;
-    }
-
-    public String getPalletNo() {
-        return palletNo;
-    }
-
-    public void setPalletNo(String palletNo) {
-        this.palletNo = palletNo;
-    }
-
-    public String getIsFull() {
-        return isFull;
-    }
-
-    public void setIsFull(String isFull) {
-        this.isFull = isFull;
-    }
-
-    public String getZoneName() {
-        return zoneName;
-    }
-
-    public void setZoneName(String zoneName) {
-        this.zoneName = zoneName;
-    }
-
-    public Double getWeight() {
-        return weight;
-    }
-
-    public void setWeight(Double weight) {
-        this.weight = weight;
-    }
 }

+ 4 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/dto/InvMoveDTO.java

@@ -1,10 +1,14 @@
 package com.ruoyi.ams.inv.dto;
 
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 
 @Data
+@NoArgsConstructor
+@AllArgsConstructor
 public class InvMoveDTO implements Serializable {
 
     private static final long serialVersionUID = 6430246122918220656L;

+ 22 - 10
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotAttMapper.java

@@ -1,7 +1,10 @@
 package com.ruoyi.ams.inv.mapper;
 
 import java.util.List;
+
+import com.ruoyi.ams.bionutrition.dto.DocQcDTO;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 批次属性Mapper接口
@@ -9,15 +12,14 @@ import com.ruoyi.ams.inv.domain.InvLotAtt;
  * @author andy
  * @date 2022-03-09
  */
-public interface InvLotAttMapper
-{
+public interface InvLotAttMapper {
     /**
      * 查询批次属性
      *
      * @param lotnum 批次属性主键
      * @return 批次属性
      */
-     InvLotAtt selectInvLotAttByLotnum(String lotnum);
+    InvLotAtt selectInvLotAttByLotnum(String lotnum);
 
     /**
      * 查询批次属性列表
@@ -25,7 +27,7 @@ public interface InvLotAttMapper
      * @param invLotAtt 批次属性
      * @return 批次属性集合
      */
-     List<InvLotAtt> selectInvLotAttList(InvLotAtt invLotAtt);
+    List<InvLotAtt> selectInvLotAttList(InvLotAtt invLotAtt);
 
     /**
      * 新增批次属性
@@ -33,7 +35,7 @@ public interface InvLotAttMapper
      * @param invLotAtt 批次属性
      * @return 结果
      */
-     int insertInvLotAtt(InvLotAtt invLotAtt);
+    int insertInvLotAtt(InvLotAtt invLotAtt);
 
     /**
      * 修改批次属性
@@ -41,7 +43,7 @@ public interface InvLotAttMapper
      * @param invLotAtt 批次属性
      * @return 结果
      */
-     int updateInvLotAtt(InvLotAtt invLotAtt);
+    int updateInvLotAtt(InvLotAtt invLotAtt);
 
     /**
      * 删除批次属性
@@ -49,15 +51,15 @@ public interface InvLotAttMapper
      * @param lotnum 批次属性主键
      * @return 结果
      */
-     int deleteInvLotAttByLotnum(String lotnum);
+    int deleteInvLotAttByLotnum(String lotnum);
 
-     /**
+    /**
      * 删除批次属性
      *
      * @param locationId
      * @return 结果
      */
-     int deleteInvLotAttBylocationId(Long locationId);
+    int deleteInvLotAttBylocationId(Long locationId);
 
     /**
      * 批量删除批次属性
@@ -65,5 +67,15 @@ public interface InvLotAttMapper
      * @param lotnums 需要删除的数据主键集合
      * @return 结果
      */
-     int deleteInvLotAttByLotnums(String[] lotnums);
+    int deleteInvLotAttByLotnums(String[] lotnums);
+
+    /**
+     * 根据物料编码和批号查询批次信息
+     * @param sku
+     * @param batchNumber
+     * @return
+     */
+    List<InvLotAtt> selectInvLotAttBySkuAndBatchNumber(@Param("sku") String sku, @Param("batchNumber") String batchNumber);
+
+    List<DocQcDTO> getQcList(@Param("sku") String sku);
 }

+ 7 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -315,4 +315,11 @@ public interface InvLotLocIdMapper {
      */
     int updateAllocationBy(@Param("lotnum") String lotnum, @Param("locationId") Long locationId, @Param("qty") BigDecimal qty);
 
+    /**
+     * 修改批次号
+     * @param lotnum
+     * @param lotNumNew
+     * @return
+     */
+    int updateInvLotLocIdByLotNum(@Param("lotnum")String lotnum, @Param("lotNumNew")String lotNumNew);
 }

+ 22 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/IInvLotAttService.java

@@ -2,6 +2,7 @@ package com.ruoyi.ams.inv.service;
 
 import java.util.List;
 
+import com.ruoyi.ams.bionutrition.dto.DocQcDTO;
 import com.ruoyi.ams.inv.domain.InvLotAtt;
 
 /**
@@ -66,4 +67,25 @@ public interface IInvLotAttService {
      * @return
      */
     int deleteInvLotAttBylocationId(Long locationId);
+
+    /**
+     * 根据产品批号和物料编码匹配批次
+     * @param batchNumber
+     * @param sku
+     * @return
+     */
+    List<InvLotAtt> selectInvLotAttByBatchNum(String batchNumber, String sku);
+
+    /**
+     * 添加批次信息
+     * @param invLotAtt
+     * @return
+     */
+    int insertInvLotAtt(InvLotAtt invLotAtt);
+
+    /**
+     * 获取质检列表
+     * @return
+     */
+    List<DocQcDTO> getQcList(String sku);
 }

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

@@ -13,6 +13,7 @@ import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.inv.dto.InvMoveDTO;
 import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -88,7 +89,7 @@ public interface IInvLotLocIdService {
      *
      * @return
      */
-    AjaxResult move(InvLotLocIdMoveForm invLotLocIdMoveForm);
+    AjaxResult move(InvMoveDTO invMoveDTO, String updateBy);
 
 
     /**
@@ -282,4 +283,12 @@ public interface IInvLotLocIdService {
      * @return true 代表质检没有问题,可以出库
      */
     boolean verifyInventoryCanOutbound(String locationId);
+
+    int updateInvLotLocIdByLotNum(String lotnum, String lotNumNew);
+
+    /**
+     * 查询是否有过期库存
+     * @return
+     */
+    String getInvLocIfExpire();
 }

+ 16 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotAttServiceImpl.java

@@ -2,6 +2,7 @@ package com.ruoyi.ams.inv.service.impl;
 
 import java.util.List;
 
+import com.ruoyi.ams.bionutrition.dto.DocQcDTO;
 import com.ruoyi.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -96,4 +97,19 @@ public class InvLotAttServiceImpl implements IInvLotAttService {
     public int deleteInvLotAttBylocationId(Long locationId) {
         return invLotAttMapper.deleteInvLotAttBylocationId(locationId);
     }
+
+    @Override
+    public List<InvLotAtt> selectInvLotAttByBatchNum(String batchNumber, String sku) {
+        return invLotAttMapper.selectInvLotAttBySkuAndBatchNumber(sku, batchNumber);
+    }
+
+    @Override
+    public int insertInvLotAtt(InvLotAtt invLotAtt) {
+        return invLotAttMapper.insertInvLotAtt(invLotAtt);
+    }
+
+    @Override
+    public List<DocQcDTO> getQcList(String sku) {
+        return invLotAttMapper.getQcList(sku);
+    }
 }

+ 96 - 7
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -1,5 +1,11 @@
 package com.ruoyi.ams.inv.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUnit;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.lang.Assert;
+import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.ruoyi.ams.box.domain.WmsBoxInfo;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.business.IBusinessService;
@@ -12,6 +18,7 @@ import com.ruoyi.ams.inv.domain.form.InvLocIdSearchFrom;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdAdjForm;
 import com.ruoyi.ams.inv.domain.form.InvLotLocIdMoveForm;
 import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.inv.dto.InvMoveDTO;
 import com.ruoyi.ams.inv.mapper.InvLotAttMapper;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
@@ -23,6 +30,7 @@ import com.ruoyi.base.utils.IdSequenceUtils;
 import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.ServiceException;
+import com.ruoyi.common.utils.ConvertUtils;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
@@ -32,9 +40,13 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
+import java.util.Collections;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collector;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * 库位库存信息Service业务层处理
@@ -115,7 +127,37 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
 
     @Override
     public List<InvLotLocIdLotattVO> selectInvLocIdLotattList(InvLocIdSearchFrom invLocIdSearchFrom) {
-        return invLotLocIdMapper.selectInvLocIdLotattList(invLocIdSearchFrom);
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdMapper.selectInvLocIdLotattList(invLocIdSearchFrom);
+        // 检查更新库位过期状态
+        return refreshExpireStatus(invLotLocIdLotattVOS);
+    }
+
+    /**
+     * 更新库存过期状态
+     *
+     * @param invLotLocIdLotattVOS
+     */
+    private List<InvLotLocIdLotattVO> refreshExpireStatus(List<InvLotLocIdLotattVO> invLotLocIdLotattVOS) {
+        List<InvLotLocIdLotattVO> lotLocIdLotattVOS = invLotLocIdLotattVOS.stream().map(item -> {
+            Long shelfLife = Long.valueOf(item.getLotatt04());// 有效期
+            DateTime manufactureDate = DateUtil.parse(item.getLotatt03());// 生产日期
+            DateTime now = DateUtil.date();
+            // 剩余有效期
+            Long validityDay = shelfLife - DateUtil.between(now, manufactureDate, DateUnit.DAY);
+            // 有效期大于30天
+            if (validityDay > 30) {
+                item.setIsExpire(Constant.EXPIRE_STATUS.UNEXPIRED.getValue());
+            } else if (validityDay < 30 && validityDay > 0) { // 有效期在30天以内
+                item.setIsExpire(Constant.EXPIRE_STATUS.WITHIN_THIRTY_DAYS.getValue());
+            } else { // 已过期
+                item.setIsExpire(Constant.EXPIRE_STATUS.EXPIRED.getValue());
+            }
+            InvLotLocId invLotLocId = new InvLotLocId();
+            BeanUtils.copyProperties(item, invLotLocId);
+            invLotLocIdMapper.updateInvLotLocId(invLotLocId);
+            return item;
+        }).collect(Collectors.toList());
+        return lotLocIdLotattVOS;
     }
 
     /**
@@ -182,15 +224,20 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
     /**
      * 库存移动
      *
-     * @param invLotLocIdMoveForm
+     * @param invMoveDTO
      * @return
      */
     @Override
-    public AjaxResult move(InvLotLocIdMoveForm invLotLocIdMoveForm) {
+    public AjaxResult move(InvMoveDTO invMoveDTO, String updateBy) {
+
+        Boolean isEmpty = StringUtils.isEmpty(invMoveDTO.getSourceLocationId()) || StringUtils.isEmpty(invMoveDTO.getTargetLocationId());
+        Assert.isFalse(isEmpty, "起始点或者终点不能为空");
+        Assert.isFalse(StringUtils.equals(invMoveDTO.getSourceLocationId(), invMoveDTO.getTargetLocationId()), "起始点和终点点位不能相同");
+        InvLotLocIdMoveForm invLotLocIdMoveForm = buildInvLotLocIdMoveForm(invMoveDTO.getSourceLocationId(), invMoveDTO.getTargetLocationId(), updateBy);
+
         String locationFrom = invLotLocIdMoveForm.getLocationFrom();
         String locationTo = invLotLocIdMoveForm.getLocationTo();
         String reason = invLotLocIdMoveForm.getReason();
-        String updateBy = invLotLocIdMoveForm.getUpdateBy();
         Long warehouseId = invLotLocIdMoveForm.getWarehouseId();
         BaseLocationInfo baseLocationFrom = null;
         BaseLocationInfo baseLocationTo = null;
@@ -209,12 +256,14 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         if (isInStock) {
             return AjaxResult.error("目标库位有货!");
         }
+
+
         // 起始和目标库位
         baseLocationFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, warehouseId);
         baseLocationTo = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationTo, warehouseId);
 
         // 下发移库任务
-        String taskNo = System.currentTimeMillis() + "";
+        String taskNo = String.valueOf(System.currentTimeMillis());
         WcsTask wcsTask = new WcsTask();
         wcsTask.setTaskNo(taskNo);
         if (locationFrom != null) {
@@ -242,6 +291,24 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         return AjaxResult.success("执行成功");
     }
 
+    /**
+     * 构建库存库位移动对象
+     *
+     * @param sourceLocationId
+     * @param targetLocationId
+     * @param updateBy
+     * @return
+     */
+    public InvLotLocIdMoveForm buildInvLotLocIdMoveForm(String sourceLocationId, String targetLocationId, String updateBy) {
+        InvLotLocIdMoveForm invLotLocIdMoveForm = new InvLotLocIdMoveForm();
+        invLotLocIdMoveForm.setLocationFrom(sourceLocationId);
+        invLotLocIdMoveForm.setLocationTo(targetLocationId);
+        invLotLocIdMoveForm.setUpdateBy(updateBy);
+        invLotLocIdMoveForm.setWarehouseId(Constant.WAREHOUSE_ID);
+        invLotLocIdMoveForm.setIsCallCar(Constant.IS_YES.Y.getValue());
+        return invLotLocIdMoveForm;
+    }
+
     @Override
     public AjaxResult moveDirect(InvLotLocIdMoveForm invLotLocIdMoveForm) {
         String locationFrom = invLotLocIdMoveForm.getLocationFrom();
@@ -309,9 +376,12 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         moveForm.setReason(reason);
         moveForm.setWarehouseId(warehouseId);
         moveForm.setUpdateBy(updateBy);
+        InvMoveDTO invMoveDTO = new InvMoveDTO();
+        invMoveDTO.setSourceLocationId(locationFrom);
+        invMoveDTO.setTargetLocationId(locationTo);
         // 是否叫车
         if (callCar) {
-            return this.move(moveForm);
+            return this.move(invMoveDTO, updateBy);
         }
         return this.moveDirect(moveForm);
     }
@@ -476,7 +546,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             String sku = agvCallItemDTO.getSku();
             Double qty = agvCallItemDTO.getQty() == null ? 1D : agvCallItemDTO.getQty();
             // 批次表
-            String lotnum = idSequenceUtils.generateId("LOTNUMBER");
+            String lotnum = IdWorker.getIdStr();
             LotattDTO lotattDTO = agvCallItemDTO.getLotattDTO();
             InvLotAtt invLotAtt = new InvLotAtt();
             BeanUtils.copyProperties(lotattDTO, invLotAtt);
@@ -497,6 +567,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             invLotLocId.setQtyallocatedEach(BigDecimal.ZERO);
             invLotLocId.setQtypa(BigDecimal.ZERO);
             invLotLocId.setQtyrpin(BigDecimal.ZERO);
+            invLotLocId.setIsExpire(Constant.EXPIRE_STATUS.UNEXPIRED.getValue());
             invLotLocId.setCreateTime(new Date());
             invLotLocIdMapper.insertInvLotLocId(invLotLocId);
         }
@@ -659,4 +730,22 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         List<InvLotLocIdLotattVO> lotattVOList = selectInvLocIdLotattList(invLocIdSearchFrom);
         return lotattVOList.stream().allMatch(v -> !v.getLotatt05().equals("DJ"));
     }
+
+    @Override
+    public int updateInvLotLocIdByLotNum(String lotnum, String lotNumNew) {
+        return invLotLocIdMapper.updateInvLotLocIdByLotNum(lotnum, lotNumNew);
+    }
+
+    /**
+     * 查询是否有过期的库存信息
+     *
+     * @return
+     */
+    @Override
+    public String getInvLocIfExpire() {
+        InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
+        invLocIdSearchFrom.setIsExpire("Y");
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdMapper.selectInvLocIdLotattList(invLocIdSearchFrom);
+        return invLotLocIdLotattVOS.size() > 0 ? "存在即将过期的库存" : StringUtils.EMPTY;
+    }
 }

+ 4 - 3
warewms-ams/src/main/java/com/ruoyi/ams/task/service/IWcsTaskService.java

@@ -3,6 +3,7 @@ package com.ruoyi.ams.task.service;
 import java.util.List;
 
 import com.ruoyi.ams.agv.ndc.entity.CallbackResult;
+import com.ruoyi.ams.bionutrition.dto.OrderAgvCallDTO;
 import com.ruoyi.ams.task.domain.WcsTask;
 import com.ruoyi.ams.task.dto.WcsTaskLocationDTO;
 import com.ruoyi.common.core.domain.AjaxResult;
@@ -177,9 +178,9 @@ public interface IWcsTaskService {
     AjaxResult moveStartingPointToDestination(WcsTask wcsTask);
 
     /**
-     * 根据单号生成AGVchu任务
-     * @param wcsTask
+     * 根据单号生成AGV出库任务
+     * @param orderAgvCallDTO
      * @return
      */
-    AjaxResult createOutboundTaskByDoc(WcsTask wcsTask);
+    AjaxResult createOutboundTaskByDoc(OrderAgvCallDTO orderAgvCallDTO);
 }

+ 9 - 7
warewms-ams/src/main/java/com/ruoyi/ams/task/service/impl/WcsTaskServiceImpl.java

@@ -16,6 +16,7 @@ import com.ruoyi.ams.agv.ndc.service.IAmsTaskService;
 import com.ruoyi.ams.bionutrition.doc.dto.BionutritionDocBaseDTO;
 import com.ruoyi.ams.bionutrition.doc.dto.detail.BionutritionDocDetailsBaseDTO;
 import com.ruoyi.ams.bionutrition.doc.service.BionutritionDocHeaderService;
+import com.ruoyi.ams.bionutrition.dto.OrderAgvCallDTO;
 import com.ruoyi.ams.box.service.IWmsBoxInfoService;
 import com.ruoyi.ams.business.IBusinessService;
 import com.ruoyi.ams.config.domain.FlowConfigEvent;
@@ -86,7 +87,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
     @Autowired
     private BionutritionDocHeaderService bionutritionDocHeaderService;
 
-    private List<String> outboundDocTypeList  = Arrays.asList("SaleOutboundOrder");
+    private List<String> outboundDocTypeList  = Arrays.asList("SaleOutboundOrder","ProductionPickingReceipt");
 
     @Autowired
     private ISysConfigService iSysConfigService;
@@ -615,13 +616,14 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
 
     /**
      * 根据单号生成AGV出库任务
-     * @param wcsTask
+     * @param orderAgvCallDTO
      * @return
      */
     @Override
-    public synchronized AjaxResult createOutboundTaskByDoc(WcsTask wcsTask) {
+    public synchronized AjaxResult createOutboundTaskByDoc(OrderAgvCallDTO orderAgvCallDTO) {
         //校验单号
-        BionutritionDocBaseDTO bionutritionDocBaseDTO = bionutritionDocHeaderService.selectDocByDocNo(wcsTask.getWhNoFrom());
+        BionutritionDocBaseDTO bionutritionDocBaseDTO = bionutritionDocHeaderService.selectDocBySkuAndBatchNumber(
+                orderAgvCallDTO.getSkuCode(),orderAgvCallDTO.getBatchNumber(), orderAgvCallDTO.getDocType());
         if (ObjectUtil.isEmpty(bionutritionDocBaseDTO)){
            return AjaxResult.error("单据不存在");
         }
@@ -630,7 +632,7 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         }
         String skuCode = null;
         for (BionutritionDocDetailsBaseDTO bionutritionDocDetailsBaseDTO : bionutritionDocBaseDTO.getBionutritionDocDetailsBaseDTOList()) {
-           if(wcsTask.getExt7().equals( bionutritionDocDetailsBaseDTO.getSkuCode())){
+           if(StringUtils.equals(orderAgvCallDTO.getSkuCode(), bionutritionDocDetailsBaseDTO.getSkuCode())){
                skuCode = bionutritionDocDetailsBaseDTO.getSkuCode();
            }
         }
@@ -650,10 +652,10 @@ public class WcsTaskServiceImpl implements IWcsTaskService {
         }
         List<AgvCallItemDTO> agvCallItemDTOList = new ArrayList<>();
         AgvCallItemDTO agvCallItemDTO = new AgvCallItemDTO();
-        agvCallItemDTO.setSku(wcsTask.getExt7());
+        agvCallItemDTO.setSku(orderAgvCallDTO.getSkuCode());
         agvCallItemDTOList.add(agvCallItemDTO);
         AgvCallDTO agvCallDTO = new AgvCallDTO();
-        agvCallDTO.setLocationTo(wcsTask.getLocationTo());
+        agvCallDTO.setLocationTo(orderAgvCallDTO.getLocationTo());
         agvCallDTO.setAgvCallItemDTOList(agvCallItemDTOList);
         return iBusinessService.agvCall(flowId, agvCallDTO);
     }

+ 17 - 0
warewms-ams/src/main/resources/mapper/ams/InvLotAttMapper.xml

@@ -67,6 +67,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectInvLotAttVo"/>
         where lotnum = #{lotnum}
     </select>
+    <select id="selectInvLotAttBySkuAndBatchNumber" resultType="com.ruoyi.ams.inv.domain.InvLotAtt">
+        <include refid="selectInvLotAttVo"/>
+        where sku = #{sku} and lotatt02 = #{batchNumber}
+    </select>
+
+    <select id="getQcList" resultMap="InvLotAttResult">
+        select att.sku, att.lotatt02 from inv_lot_att att
+        left join inv_lot_loc_id lot on att.lotnum = lot.lotnum
+        <where>
+            lot.lotnum = att.lotnum
+            <if test="sku != null  and sku != ''">
+             and att.sku like concat('%', #{sku}, '%')
+            </if>
+        </where>
+        group by att.lotatt02
+        order by att.lotatt06
+    </select>
 
     <insert id="insertInvLotAtt" parameterType="InvLotAtt">
         insert into inv_lot_att

+ 9 - 0
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="weight"    column="weight"    />
         <result property="palletNo"    column="box_no"    />
         <result property="isFull"    column="is_full"    />
+        <result property="isExpire"    column="is_expire"    />
         <result property="lotnum"    column="lotnum"    />
         <result property="lotatt01"    column="lotatt01"    />
         <result property="lotatt02"    column="lotatt02"    />
@@ -170,6 +171,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="qtymvin != null">qtymvin,</if>
             <if test="qtymvout != null">qtymvout,</if>
             <if test="qtyonhold != null">qtyonhold,</if>
+            <if test="isExpire != null">is_expire,</if>
             <if test="createBy != null">create_by,</if>
             <if test="createTime != null">create_time,</if>
             <if test="updateBy != null">update_by,</if>
@@ -192,6 +194,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="qtymvin != null">#{qtymvin},</if>
             <if test="qtymvout != null">#{qtymvout},</if>
             <if test="qtyonhold != null">#{qtyonhold},</if>
+            <if test="isExpire != null">#{isExpire},</if>
             <if test="createBy != null">#{createBy},</if>
             <if test="createTime != null">#{createTime},</if>
             <if test="updateBy != null">#{updateBy},</if>
@@ -217,6 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="qtymvin != null">qtymvin = #{qtymvin},</if>
             <if test="qtymvout != null">qtymvout = #{qtymvout},</if>
             <if test="qtyonhold != null">qtyonhold = #{qtyonhold},</if>
+            <if test="isExpire != null">is_expire = #{isExpire},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
             <if test="createTime != null">create_time = #{createTime},</if>
             <if test="updateBy != null">update_by = #{updateBy},</if>
@@ -349,6 +353,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <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.id = #{locationNo}</if>
+            <if test="isExpire != null and isExpire != ''"> and inv.is_expire in('1','2')</if>
             <if test="isFull != null  and isFull != ''"> and w.is_full = #{isFull}</if>
             <if test="lotattDTO != null">
                 <if test="lotattDTO.lotatt01 != null  and lotattDTO.lotatt01 != ''"> and att.lotatt01 = #{lotattDTO.lotatt01}</if>
@@ -604,6 +609,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         update inv_lot_loc_id set qtyallocated = qtyallocated + #{qty},qtyallocated_each = qtyallocated_each + #{qty}
         where lotnum = #{lotnum} and location_id = #{locationId}
     </update>
+    <update id="updateInvLotLocIdByLotNum">
+        update inv_lot_loc_id set lotnum = #{lotNumNew}
+        where lotnum = #{lotnum}
+    </update>
 
     <select id="querySameTypeByPalletNo" resultMap="InvLotLocIdResult">
         select inv.*

+ 36 - 2
warewms-base/src/main/java/com/ruoyi/base/constant/Constant.java

@@ -26,6 +26,9 @@ public class Constant {
      */
     public static final Long LOC_MIDDLE_CACHE = 99999l;
 
+    /**
+     * 系统配置信息单据字段描述的key值
+     */
     public static final String SYS_DOC_FIELD_REMARK = "sys.doc.field.remark";
 
     /**
@@ -299,8 +302,11 @@ public class Constant {
         /**
          * 桶装入库缓存区
          */
-        TZ_ASN_CACHE("4");
-
+        TZ_ASN_CACHE("4"),
+        /**
+         * 不合格区
+         */
+        BHG_ZONE("5");
         private String value;
 
         LOCATION_ZONE(String value) {
@@ -623,4 +629,32 @@ public class Constant {
         }
     }
 
+    /**
+     * 质量状态
+     */
+    public enum EXPIRE_STATUS {
+        /***
+         * 已过期
+         */
+        EXPIRED("1"),
+        /***
+         * 三十天内过期
+         */
+        WITHIN_THIRTY_DAYS("2"),
+        /***
+         * 未过期
+         */
+        UNEXPIRED("3");
+
+        private String value;
+
+        EXPIRE_STATUS(String value) {
+            this.value = value;
+        }
+
+        public String getValue() {
+            return value;
+        }
+    }
+
 }