huang 3 долоо хоног өмнө
parent
commit
ca70244350
100 өөрчлөгдсөн 3209 нэмэгдсэн , 1183 устгасан
  1. 73 4
      docs/new_sql.sql
  2. 7 0
      pom.xml
  3. 17 3
      src/main/java/com/jsh/erp/constants/ExceptionConstants.java
  4. 3 0
      src/main/java/com/jsh/erp/controller/DepotHeadController.java
  5. 17 15
      src/main/java/com/jsh/erp/controller/DepotItemController.java
  6. 2 2
      src/main/java/com/jsh/erp/controller/MaterialCategoryController.java
  7. 125 107
      src/main/java/com/jsh/erp/controller/MaterialController.java
  8. 0 5
      src/main/java/com/jsh/erp/controller/MaterialExtendController.java
  9. 44 0
      src/main/java/com/jsh/erp/controller/MaterialInputController.java
  10. 1 1
      src/main/java/com/jsh/erp/controller/MsgController.java
  11. 1 1
      src/main/java/com/jsh/erp/controller/UnitController.java
  12. 74 0
      src/main/java/com/jsh/erp/controller/audit/AuditController.java
  13. 78 23
      src/main/java/com/jsh/erp/controller/pda/PdaController.java
  14. 18 0
      src/main/java/com/jsh/erp/controller/stocktaking/StocktakingController.java
  15. 18 0
      src/main/java/com/jsh/erp/datasource/dto/AuditDTO.java
  16. 31 0
      src/main/java/com/jsh/erp/datasource/dto/AuditQueryDTO.java
  17. 1 3
      src/main/java/com/jsh/erp/datasource/dto/DepotHeadDTO.java
  18. 26 0
      src/main/java/com/jsh/erp/datasource/dto/DepotItemDTO.java
  19. 9 0
      src/main/java/com/jsh/erp/datasource/dto/MaterialInputDto.java
  20. 46 0
      src/main/java/com/jsh/erp/datasource/entities/Audit.java
  21. 50 0
      src/main/java/com/jsh/erp/datasource/entities/AuditNode.java
  22. 13 3
      src/main/java/com/jsh/erp/datasource/entities/DepotHead.java
  23. 6 0
      src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
  24. 6 6
      src/main/java/com/jsh/erp/datasource/entities/Material.java
  25. 0 60
      src/main/java/com/jsh/erp/datasource/entities/MaterialInitialStock.java
  26. 70 0
      src/main/java/com/jsh/erp/datasource/entities/MaterialInput.java
  27. 7 3
      src/main/java/com/jsh/erp/datasource/entities/MaterialUnit.java
  28. 2 1
      src/main/java/com/jsh/erp/datasource/entities/MaterialUpc.java
  29. 19 13
      src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
  30. 8 7
      src/main/java/com/jsh/erp/datasource/entities/Msg.java
  31. 38 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditMapper.java
  32. 6 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditNodeConfigMapper.java
  33. 18 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditNodeMapper.java
  34. 7 0
      src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java
  35. 2 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialCategoryMapper.java
  36. 2 1
      src/main/java/com/jsh/erp/datasource/mappers/MaterialCategoryMapperEx.java
  37. 1 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialCurrentStockMapperEx.java
  38. 5 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialExtendMapper.java
  39. 1 1
      src/main/java/com/jsh/erp/datasource/mappers/MaterialInitialStockMapper.java
  40. 1 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialInitialStockMapperEx.java
  41. 8 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialInputMapper.java
  42. 5 2
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java
  43. 2 2
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
  44. 6 1
      src/main/java/com/jsh/erp/datasource/mappers/MsgMapper.java
  45. 10 1
      src/main/java/com/jsh/erp/datasource/mappers/OrgaUserRelMapperEx.java
  46. 1 0
      src/main/java/com/jsh/erp/datasource/mappers/UnitMapper.java
  47. 2 0
      src/main/java/com/jsh/erp/datasource/mappers/UserMapper.java
  48. 4 0
      src/main/java/com/jsh/erp/datasource/pda/dto/PDADepotHeadDTO.java
  49. 15 0
      src/main/java/com/jsh/erp/datasource/pda/dto/PDAGoodsInputDTO.java
  50. 9 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotHeadVO.java
  51. 3 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotItemVO.java
  52. 45 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDAMaterialVo.java
  53. 25 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDAMsgListVO.java
  54. 28 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDAMsgVO.java
  55. 13 0
      src/main/java/com/jsh/erp/datasource/vo/AuditNodeVo.java
  56. 31 0
      src/main/java/com/jsh/erp/datasource/vo/AuditVo.java
  57. 1 1
      src/main/java/com/jsh/erp/datasource/vo/MaterialExcelVo.java
  58. 2 2
      src/main/java/com/jsh/erp/datasource/vo/TaskStocktakingItemVO.java
  59. 2 0
      src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
  60. 67 0
      src/main/java/com/jsh/erp/service/AuditService.java
  61. 22 3
      src/main/java/com/jsh/erp/service/DepotHeadService.java
  62. 16 7
      src/main/java/com/jsh/erp/service/DepotItemService.java
  63. 12 3
      src/main/java/com/jsh/erp/service/DepotService.java
  64. 4 7
      src/main/java/com/jsh/erp/service/MaterialBatchService.java
  65. 15 10
      src/main/java/com/jsh/erp/service/MaterialCategoryService.java
  66. 16 3
      src/main/java/com/jsh/erp/service/MaterialExtendService.java
  67. 27 0
      src/main/java/com/jsh/erp/service/MaterialInputService.java
  68. 57 33
      src/main/java/com/jsh/erp/service/MaterialService.java
  69. 22 286
      src/main/java/com/jsh/erp/service/MsgService.java
  70. 11 1
      src/main/java/com/jsh/erp/service/OrgaUserRelService.java
  71. 1 1
      src/main/java/com/jsh/erp/service/OrganizationService.java
  72. 1 1
      src/main/java/com/jsh/erp/service/SequenceService.java
  73. 5 2
      src/main/java/com/jsh/erp/service/SerialNumberService.java
  74. 5 1
      src/main/java/com/jsh/erp/service/SupplierService.java
  75. 6 6
      src/main/java/com/jsh/erp/service/SystemConfigService.java
  76. 6 0
      src/main/java/com/jsh/erp/service/TaskStocktakingService.java
  77. 1 1
      src/main/java/com/jsh/erp/service/UnitService.java
  78. 8 0
      src/main/java/com/jsh/erp/service/UserService.java
  79. 12 2
      src/main/java/com/jsh/erp/service/impl/AuditProcessServiceImpl.java
  80. 383 0
      src/main/java/com/jsh/erp/service/impl/AuditServiceImpl.java
  81. 68 31
      src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java
  82. 134 61
      src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
  83. 9 5
      src/main/java/com/jsh/erp/service/impl/DepotServiceImpl.java
  84. 1 1
      src/main/java/com/jsh/erp/service/impl/LogServiceImpl.java
  85. 23 4
      src/main/java/com/jsh/erp/service/impl/MaterialBatchServiceImpl.java
  86. 17 14
      src/main/java/com/jsh/erp/service/impl/MaterialCategoryServiceImpl.java
  87. 16 2
      src/main/java/com/jsh/erp/service/impl/MaterialExtendServiceImpl.java
  88. 87 0
      src/main/java/com/jsh/erp/service/impl/MaterialInputServiceImpl.java
  89. 432 422
      src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java
  90. 0 1
      src/main/java/com/jsh/erp/service/impl/MaterialUpcServiceImpl.java
  91. 363 0
      src/main/java/com/jsh/erp/service/impl/MsgServiceImpl.java
  92. 1 1
      src/main/java/com/jsh/erp/service/impl/SequenceServiceImpl.java
  93. 1 1
      src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java
  94. 43 2
      src/main/java/com/jsh/erp/service/impl/TaskStocktakingServiceImpl.java
  95. 18 0
      src/main/java/com/jsh/erp/service/impl/UserServiceImpl.java
  96. 54 0
      src/main/java/com/jsh/erp/util/poi/ExcelUtil.java
  97. 36 0
      src/main/java/com/jsh/erp/utils/DateUtils.java
  98. 0 3
      src/main/java/com/jsh/erp/utils/ErpInfo.java
  99. 135 0
      src/main/resources/mapper_xml/AuditMapper.xml
  100. 9 0
      src/main/resources/mapper_xml/AuditNodeConfigMapper.xml

+ 73 - 4
docs/new_sql.sql

@@ -250,7 +250,7 @@ ALTER TABLE material_batch
 INSERT INTO `jsh_sequence` (`seq_name`, `min_value`, `max_value`, `current_val`, `increment_val`, `remark`) VALUES ('supplier_number_seq', '1', '999999999999999999', '1', '1', '供应商编号sequence');
 
 -- 2025-05-22
--- 商品价格拓展表 新增修改价格,库存类型
+-- 商品价格拓展表 新增规格、颜色、型号、重量、启用标识
 ALTER TABLE jsh_material_extend
   ADD COLUMN standard VARCHAR(100) DEFAULT NULL COMMENT '规格',
   ADD COLUMN color VARCHAR(50) DEFAULT NULL COMMENT '颜色',
@@ -258,7 +258,16 @@ ALTER TABLE jsh_material_extend
   ADD COLUMN model VARCHAR(100) DEFAULT NULL COMMENT '型号',
   ADD COLUMN enabled TINYINT DEFAULT 1 COMMENT '启用 0-禁用  1-启用';
 
--- 商品UPC表
+-- 商品表 系统sku改spu
+ALTER TABLE jsh_material
+  RENAME COLUMN system_sku TO system_spu;
+
+-- 商品拓展表  删除原sku列,将bar_code改为sku
+ALTER TABLE jsh_material_extend
+  RENAME COLUMN sku TO old_sku,
+  RENAME COLUMN bar_code TO sku;
+
+-- 新增商品UPC表
 DROP TABLE IF EXISTS `material_upc`;
 CREATE TABLE `material_upc` (
   `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
@@ -274,7 +283,6 @@ DROP TABLE IF EXISTS `material_unit`;
 CREATE TABLE `material_unit` (
   `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
   `material_extend_id` BIGINT DEFAULT NULL COMMENT '商品拓展id',
-  `unit_id` BIGINT DEFAULT NULL COMMENT '单位id',
   `ratio` INT DEFAULT 1 COMMENT '单位比例',
   `name` varchar(50) DEFAULT NULL COMMENT '名称',
   `delete_flag`  TINYINT DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
@@ -297,7 +305,7 @@ CREATE TABLE `audit_process` (
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='审核流程表';
 
--- 审核流程
+-- 审核节点配置
 DROP TABLE IF EXISTS `audit_node_config`;
 CREATE TABLE `audit_node_config` (
   `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
@@ -312,6 +320,67 @@ CREATE TABLE `audit_node_config` (
   PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='审核节点配置表';
 
+-- 审核实例表
+DROP TABLE IF EXISTS `audit`;
+CREATE TABLE `audit` (
+  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `process_id` BIGINT DEFAULT NULL COMMENT '流程ID',
+  `business_id` BIGINT DEFAULT NULL COMMENT '业务ID',
+  `business_number` VARCHAR(255) DEFAULT NULL COMMENT '业务单号',
+  `type` VARCHAR(50) DEFAULT NULL COMMENT '业务类型',
+  `audit_status` INT DEFAULT NULL COMMENT '审核状态(0:进行中 1:已通过 2:未通过)',
+  `submit_user` BIGINT DEFAULT NULL COMMENT '提交人',
+  `submit_time` datetime DEFAULT NULL COMMENT '提交时间',
+  `complete_time` datetime DEFAULT NULL COMMENT '完成时间',
+  `delete_flag`  TINYINT DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='审核实例表';
+
+-- 审核节点实例表
+DROP TABLE IF EXISTS `audit_node`;
+CREATE TABLE `audit_node` (
+  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `audit_id` BIGINT DEFAULT NULL COMMENT '审核实例ID',
+  `node_id` BIGINT DEFAULT NULL COMMENT '节点配置ID',
+  `node_order` INT DEFAULT NULL COMMENT '节点顺序',
+  `auditor_user` BIGINT DEFAULT NULL COMMENT '审批用户',
+  `audit_result` INT DEFAULT 0 COMMENT '审批结果(0:进行中 1:已通过 2:未通过)',
+  `audit_comment` VARCHAR(500) DEFAULT NULL COMMENT '审批意见',
+  `audit_time` datetime DEFAULT NULL COMMENT '审批时间',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `delete_flag`  TINYINT DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='审核节点实例表';
+
+-- 2025-06-09
+-- 商品录入表
+DROP TABLE IF EXISTS `material_input`;
+CREATE TABLE `material_input` (
+  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `number` varchar(255) DEFAULT NULL COMMENT '录入单号',
+  `name` VARCHAR(100) DEFAULT NULL COMMENT '商品名称',
+  `bar_code` VARCHAR(50) DEFAULT NULL COMMENT '商品条码',
+  `standard` VARCHAR(100) DEFAULT NULL COMMENT '规格',
+  `production_date` datetime DEFAULT NULL COMMENT '生产日期',
+  `img_name` TEXT DEFAULT NULL COMMENT '图片名称',
+  `depot_id` BIGINT DEFAULT NULL COMMENT '仓库id',
+  `position` VARCHAR(255) DEFAULT NULL COMMENT '仓位货架',
+  `status` INT DEFAULT 0 COMMENT '录入状态 0.待审核,1.正常,2.已驳回',
+  `category_id` BIGINT DEFAULT NULL COMMENT '类别id',
+  `default_purchase_decimal` DECIMAL(24,2) DEFAULT NULL COMMENT '默认采购价格',
+  `default_wholesale_decimal` DECIMAL(24,2) DEFAULT NULL COMMENT '默认销售价格',
+  `commodity_unit` VARCHAR(50) DEFAULT NULL COMMENT '商品单位',
+  `create_by` BIGINT DEFAULT NULL COMMENT '创建人',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `delete_flag`  TINYINT DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='商品录入表';
+
+-- 2025-06-10
+-- 订单表 新增驳回原因
+ALTER TABLE jsh_depot_head
+  ADD COLUMN reject VARCHAR(1000) DEFAULT NULL COMMENT '驳回原因',
+  ADD COLUMN reject_time datetime DEFAULT NULL COMMENT '驳回时间';
 
 
 

+ 7 - 0
pom.xml

@@ -160,6 +160,13 @@
 			<version>3.4.1</version>
 		</dependency>
 
+		<!-- excel工具 -->
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi-ooxml</artifactId>
+			<version>4.1.2</version>
+		</dependency>
+
 	</dependencies>
 
 	<build>

+ 17 - 3
src/main/java/com/jsh/erp/constants/ExceptionConstants.java

@@ -304,7 +304,7 @@ public class ExceptionConstants {
     public static final String MATERIAL_NAME_EMPTY_MSG = "第%s行名称为空";
     //基本单位为空
     public static final int MATERIAL_UNIT_EMPTY_CODE = 8000011;
-    public static final String MATERIAL_UNIT_EMPTY_MSG = "第%s行基单位为空";
+    public static final String MATERIAL_UNIT_EMPTY_MSG = "第%s行基单位为空";
     //状态格式错误
     public static final int MATERIAL_ENABLED_ERROR_CODE = 8000012;
     public static final String MATERIAL_ENABLED_ERROR_MSG = "第%s行状态格式错误";
@@ -352,7 +352,7 @@ public class ExceptionConstants {
     public static final String MATERIAL_BARCODE_IS_NOT_EXIST_MSG = "商品条码%s不存在,请重新选择";
     //基本条码为空
     public static final int MATERIAL_BARCODE_EMPTY_CODE = 8000027;
-    public static final String MATERIAL_BARCODE_EMPTY_MSG = "第%s行商品条码为空";
+    public static final String MATERIAL_BARCODE_EMPTY_MSG = "第%s行UPC1为空";
     //EXCEL中有副条码在系统中已存在(除自身商品之外)
     public static final int MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_CODE = 80000028;
     public static final String MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG = "抱歉,EXCEL中有副条码在系统中已存在,具体副条码为:%s";
@@ -373,7 +373,7 @@ public class ExceptionConstants {
     public static final String MATERIAL_ERP_SKU_NOT_DECIMAL_MSG = "商品erp_sku[%s]不存在";
     //EXCEL中有条码在系统中已存在
     public static final int MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_CODE = 80000033;
-    public static final String MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG = "抱歉,EXCEL中有条码在系统中已存在,具体条码为:%s";
+    public static final String MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG = "抱歉,EXCEL中upc在系统中已存在,具体upc为:%s";
     //默认采购价为空
     public static final int MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_CODE = 80000034;
     public static final String MATERIAL_DEFAULT_PURCHASE_DECIMAL_EMPTY_MSG = "第%s行默认采购价不存在";
@@ -613,6 +613,20 @@ public class ExceptionConstants {
     public static final String SYSTEM_CONFIG_TEST_USER_MSG = "演示用户禁止操作";
 
 
+    //审核
+    //本部门领导不存在
+    public static final int AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_CODE = 12000000;
+    public static final String AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_MSG = "没有找到本部门最高领导";
+    public static final int AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_CODE = 12000001;
+    public static final String AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_MSG = "没有找到上级部门最高领导";
+
+
+
+    //盘点
+    //盘点任务-当前状态下不能修改
+    public static final int TASK_STOCKTAKING_BILL_CANNOT_EDIT_CODE = 12500000;
+    public static final String TASK_STOCKTAKING_BILL_CANNOT_EDIT_MSG = "抱歉,盘点任务当前状态下不能修改";
+
     /**
      * 标准正常返回/操作成功返回
      * @return

+ 3 - 0
src/main/java/com/jsh/erp/controller/DepotHeadController.java

@@ -2,11 +2,14 @@ package com.jsh.erp.controller;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
 import com.jsh.erp.base.BaseController;
 import com.jsh.erp.base.TableDataInfo;
 import com.jsh.erp.constants.BusinessConstants;
 import com.jsh.erp.constants.ExceptionConstants;
 import com.jsh.erp.datasource.dto.DepotHeadDTO;
+import com.jsh.erp.datasource.dto.DepotItemDTO;
 import com.jsh.erp.datasource.entities.DepotHead;
 import com.jsh.erp.datasource.entities.DepotHeadVo4Body;
 import com.jsh.erp.datasource.entities.DepotItem;

+ 17 - 15
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -359,22 +359,24 @@ public class DepotItemController {
                     diEx.setMaterialOther(depotItemService.getOtherInfo(mpArr, diEx));
                     //库存
                     diEx.setStock(materialService.getMaterialStockByMid(diEx.getMaterialId()));
-                    //
-                    diEx.setMType(diEx.getMaterialType());
+                    //原数量
+                    diEx.setPreNumber(diEx.getOperNumber());
+                    //完成数量
+                    Unit unitInfo = materialService.findUnit(diEx.getMaterialId()); //查询多单位信息
+                    String materialUnit = diEx.getMaterialUnit();
+                    diEx.setFinishNumber(depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType));
                     JSONObject item = new JSONObject();
-//                    item.put("id", diEx.getId());
-//                    item.put("materialExtendId", diEx.getMaterialExtendId() == null ? "" : diEx.getMaterialExtendId());
+                    item.put("id", diEx.getId());
+                    item.put("materialExtendId", diEx.getMaterialExtendId() == null ? "" : diEx.getMaterialExtendId());
 //                    item.put("barCode", diEx.getBarCode());
-//                    item.put("name", diEx.getMName());
-//                    item.put("standard", diEx.getMStandard());
-//                    item.put("model", diEx.getMModel());
-//                    item.put("color", diEx.getMColor());
-//                    item.put("brand", diEx.getBrand());
+                    item.put("name", diEx.getMName());
+                    item.put("standard", diEx.getMStandard());
+                    item.put("model", diEx.getMModel());
+                    item.put("color", diEx.getMColor());
+                    item.put("brand", diEx.getBrand());
 //                    item.put("mfrs", diEx.getMMfrs());
                     item.put("materialOther", depotItemService.getOtherInfo(mpArr, diEx));
                     BigDecimal stock;
-                    Unit unitInfo = materialService.findUnit(diEx.getMaterialId()); //查询多单位信息
-                    String materialUnit = diEx.getMaterialUnit();
                     if(StringUtil.isNotEmpty(diEx.getSku())){
                         stock = depotItemService.getSkuStockByParam(diEx.getDepotId(),diEx.getMaterialExtendId(),null,null);
                     } else {
@@ -386,11 +388,11 @@ public class DepotItemController {
                     item.put("stock", stock);
                     item.put("unit", diEx.getMaterialUnit());
                     item.put("snList", diEx.getSnList());
-                    item.put("batchNumber", diEx.getBatchNumber());
+//                    item.put("batchNumber", diEx.getBatchNumber());
                     item.put("expirationDate", Tools.parseDateToStr(diEx.getExpirationDate()));
                     item.put("sku", diEx.getSku());
                     item.put("enableSerialNumber", diEx.getEnableSerialNumber());
-                    item.put("enableBatchNumber", diEx.getEnableBatchNumber());
+//                    item.put("enableBatchNumber", diEx.getEnableBatchNumber());
                     item.put("operNumber", diEx.getOperNumber());
                     item.put("basicNumber", diEx.getBasicNumber());
                     item.put("preNumber", diEx.getOperNumber()); //原数量
@@ -443,7 +445,7 @@ public class DepotItemController {
                     item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
                     item.put("defaultPurchaseDecimal",diEx.getDefaultPurchaseDecimal());
                     item.put("defaultWholesaleDecimal",diEx.getDefaultWholesaleDecimal());
-                    dataArray.add(item);
+                    dataArray.add(diEx);
                     //合计数据汇总
                     totalOperNumber = totalOperNumber.add(diEx.getOperNumber()==null?BigDecimal.ZERO:diEx.getOperNumber());
                     totalAllPrice = totalAllPrice.add(diEx.getAllPrice()==null?BigDecimal.ZERO:diEx.getAllPrice());
@@ -1237,7 +1239,7 @@ public class DepotItemController {
                     }
                     Map<String, String> materialMap = new HashMap<>();
                     materialMap.put("depotName", depotName);
-                    materialMap.put("barCode", barCode);
+                    materialMap.put("sku", barCode);
                     materialMap.put("num", num);
                     materialMap.put("unitPrice", unitPrice);
                     materialMap.put("taxRate", taxRate);

+ 2 - 2
src/main/java/com/jsh/erp/controller/MaterialCategoryController.java

@@ -1,6 +1,5 @@
 package com.jsh.erp.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.jsh.erp.base.BaseController;
@@ -161,12 +160,13 @@ public class MaterialCategoryController extends BaseController {
         }
         return res;
     }
+
     /**
      * 获取商品类别树数据
      */
     @RequestMapping(value = "/getMaterialCategoryTree")
     @ApiOperation(value = "获取商品类别树数据")
-    public JSONArray getMaterialCategoryTree(@RequestParam("id") Long id) throws Exception{
+    public JSONArray getMaterialCategoryTree(@RequestParam("id") Long id) {
        List<TreeNode> materialCategoryTree = materialCategoryService.getMaterialCategoryTree(id);
         return TreeNodeUtils.conversion(materialCategoryTree);
     }

+ 125 - 107
src/main/java/com/jsh/erp/controller/MaterialController.java

@@ -6,7 +6,6 @@ import com.jsh.erp.base.AjaxResult;
 import com.jsh.erp.base.BaseController;
 import com.jsh.erp.base.TableDataInfo;
 import com.jsh.erp.datasource.dto.MaterialDTO;
-import com.jsh.erp.datasource.dto.MaterialQueryDTO;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
 import com.jsh.erp.service.*;
@@ -61,16 +60,15 @@ public class MaterialController extends BaseController {
     @Resource
     private MaterialUnitService materialUnitService;
 
-    @Value(value="${file.uploadType}")
+    @Value(value = "${file.uploadType}")
     private Long fileUploadType;
 
     @GetMapping(value = "/info")
     @ApiOperation(value = "根据id获取信息")
-    public String getList(@RequestParam("id") Long id,
-                          HttpServletRequest request) throws Exception {
+    public String getList(@RequestParam("id") Long id) throws Exception {
         Material material = materialService.getMaterial(id);
         Map<String, Object> objectMap = new HashMap<>();
-        if(material != null) {
+        if (material != null) {
             objectMap.put("info", material);
             return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
         } else {
@@ -103,21 +101,21 @@ public class MaterialController extends BaseController {
 
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增")
-    public AjaxResult addResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request)throws Exception {
+    public AjaxResult addResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request) throws Exception {
         materialService.insertMaterial(materialDTO, request);
         return AjaxResult.success();
     }
 
     @PutMapping(value = "/update")
     @ApiOperation(value = "修改")
-    public AjaxResult updateResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request)throws Exception {
+    public AjaxResult updateResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request) throws Exception {
         materialService.updateMaterial(materialDTO, request);
-        return  AjaxResult.success();
+        return AjaxResult.success();
     }
 
     @DeleteMapping(value = "/delete")
     @ApiOperation(value = "删除")
-    public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request)throws Exception {
+    public String deleteResource(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         int delete = materialService.deleteMaterial(id, request);
         return returnStr(objectMap, delete);
@@ -125,7 +123,7 @@ public class MaterialController extends BaseController {
 
     @DeleteMapping(value = "/deleteBatch")
     @ApiOperation(value = "批量删除")
-    public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request)throws Exception {
+    public String batchDeleteResource(@RequestParam("ids") String ids, HttpServletRequest request) throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         int delete = materialService.batchDeleteMaterial(ids, request);
         return returnStr(objectMap, delete);
@@ -133,11 +131,11 @@ public class MaterialController extends BaseController {
 
     @GetMapping(value = "/checkIsNameExist")
     @ApiOperation(value = "检查名称是否存在")
-    public String checkIsNameExist(@RequestParam Long id, @RequestParam(value ="name", required = false) String name,
-                                   HttpServletRequest request)throws Exception {
+    public String checkIsNameExist(@RequestParam Long id, @RequestParam(value = "name", required = false) String name,
+                                   HttpServletRequest request) throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         int exist = materialService.checkIsNameExist(id, name);
-        if(exist > 0) {
+        if (exist > 0) {
             objectMap.put("status", true);
         } else {
             objectMap.put("status", false);
@@ -147,6 +145,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 检查商品是否存在
+     *
      * @param id
      * @param name
      * @param model
@@ -168,13 +167,13 @@ public class MaterialController extends BaseController {
                                @RequestParam("model") String model, @RequestParam("color") String color,
                                @RequestParam("standard") String standard, @RequestParam("mfrs") String mfrs,
                                @RequestParam("otherField1") String otherField1, @RequestParam("otherField2") String otherField2,
-                               @RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit,@RequestParam("unitId") Long unitId,
-                               HttpServletRequest request)throws Exception {
+                               @RequestParam("otherField3") String otherField3, @RequestParam("unit") String unit, @RequestParam("unitId") Long unitId,
+                               HttpServletRequest request) throws Exception {
         Map<String, Object> objectMap = new HashMap<String, Object>();
         int exist = materialService.checkIsExist(id, name, StringUtil.toNull(model), StringUtil.toNull(color),
                 StringUtil.toNull(standard), StringUtil.toNull(mfrs), StringUtil.toNull(otherField1),
                 StringUtil.toNull(otherField2), StringUtil.toNull(otherField3), StringUtil.toNull(unit), unitId);
-        if(exist > 0) {
+        if (exist > 0) {
             objectMap.put("status", true);
         } else {
             objectMap.put("status", false);
@@ -184,6 +183,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量设置状态-启用或者禁用
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -192,12 +192,12 @@ public class MaterialController extends BaseController {
     @PostMapping(value = "/batchSetStatus")
     @ApiOperation(value = "批量设置状态-启用或者禁用")
     public String batchSetStatus(@RequestBody JSONObject jsonObject,
-                                 HttpServletRequest request)throws Exception {
+                                 HttpServletRequest request) throws Exception {
         Boolean status = jsonObject.getBoolean("status");
         String ids = jsonObject.getString("ids");
         Map<String, Object> objectMap = new HashMap<>();
         int res = materialService.batchSetStatus(status, ids);
-        if(res > 0) {
+        if (res > 0) {
             return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
         } else {
             return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
@@ -206,19 +206,20 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据id来查询商品名称
+     *
      * @param id
      * @param request
      * @return
      */
     @GetMapping(value = "/findById")
     @ApiOperation(value = "根据id来查询商品名称")
-    public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception{
+    public BaseResponseInfo findById(@RequestParam("id") Long id, HttpServletRequest request) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             List<MaterialVo4Unit> list = materialService.findById(id);
             res.code = 200;
             res.data = list;
-        } catch(Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
             res.code = 500;
             res.data = "获取数据失败";
@@ -228,6 +229,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据meId来查询商品名称
+     *
      * @param meId
      * @param request
      * @return
@@ -236,19 +238,19 @@ public class MaterialController extends BaseController {
     @ApiOperation(value = "根据meId来查询商品名称")
     public BaseResponseInfo findByIdWithBarCode(@RequestParam("meId") Long meId,
                                                 @RequestParam("mpList") String mpList,
-                                                HttpServletRequest request) throws Exception{
+                                                HttpServletRequest request) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             String[] mpArr = mpList.split(",");
             MaterialVo4Unit mu = new MaterialVo4Unit();
             List<MaterialVo4Unit> list = materialService.findByIdWithBarCode(meId);
-            if(list!=null && list.size()>0) {
+            if (list != null && list.size() > 0) {
                 mu = list.get(0);
                 mu.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mu));
             }
             res.code = 200;
             res.data = mu;
-        } catch(Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
             res.code = 500;
             res.data = "获取数据失败";
@@ -258,6 +260,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据关键词查找商品信息-条码、名称、规格、型号
+     *
      * @param q
      * @param request
      * @return
@@ -265,7 +268,7 @@ public class MaterialController extends BaseController {
     @GetMapping(value = "/getMaterialByParam")
     @ApiOperation(value = "根据关键词查找商品信息")
     public BaseResponseInfo getMaterialByParam(@RequestParam("q") String q,
-                                   HttpServletRequest request) throws Exception{
+                                               HttpServletRequest request) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             JSONArray arr = materialService.getMaterialByParam(q);
@@ -400,6 +403,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 查找商品信息-下拉框
+     *
      * @param mpList
      * @param request
      * @return
@@ -418,18 +422,18 @@ public class MaterialController extends BaseController {
                                    @RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
                                    @RequestParam("page") Integer currentPage,
                                    @RequestParam("rows") Integer pageSize,
-                                   HttpServletRequest request) throws Exception{
+                                   HttpServletRequest request) throws Exception {
         JSONObject object = new JSONObject();
         try {
             String[] mpArr = new String[]{};
-            if(StringUtil.isNotEmpty(mpList)){
-                mpArr= mpList.split(",");
+            if (StringUtil.isNotEmpty(mpList)) {
+                mpArr = mpList.split(",");
             }
             List<MaterialVo4Unit> dataList = materialService.findBySelectWithSku(categoryId, q, StringUtil.toNull(standardOrModel),
                     StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
-                    (currentPage-1)*pageSize, pageSize,depotId);
+                    (currentPage - 1) * pageSize, pageSize, depotId);
             int total = materialService.findBySelectWithSkuCount(categoryId, q, StringUtil.toNull(standardOrModel),
-                    StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,depotId);
+                    StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber, depotId);
             object.put("total", total);
             JSONArray dataArray = new JSONArray();
             //存放数据json数组
@@ -447,19 +451,19 @@ public class MaterialController extends BaseController {
                         unit = unitService.getUnit(material.getUnitId());
                         //拼接副单位的比例
                         String commodityUnit = material.getCommodityUnit();
-                        if(commodityUnit.equals(unit.getBasicUnit())) {
+                        if (commodityUnit.equals(unit.getBasicUnit())) {
                             ratioStr = "[基本]";
                             ratio = new BigDecimal("1");
                         }
-                        if(commodityUnit.equals(unit.getOtherUnit()) && unit.getRatio()!=null) {
+                        if (commodityUnit.equals(unit.getOtherUnit()) && unit.getRatio() != null) {
                             ratioStr = "[" + unit.getRatio().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
                             ratio = unit.getRatio();
                         }
-                        if(commodityUnit.equals(unit.getOtherUnitTwo()) && unit.getRatioTwo()!=null) {
+                        if (commodityUnit.equals(unit.getOtherUnitTwo()) && unit.getRatioTwo() != null) {
                             ratioStr = "[" + unit.getRatioTwo().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
                             ratio = unit.getRatioTwo();
                         }
-                        if(commodityUnit.equals(unit.getOtherUnitThree()) && unit.getRatioThree()!=null) {
+                        if (commodityUnit.equals(unit.getOtherUnitThree()) && unit.getRatioThree() != null) {
                             ratioStr = "[" + unit.getRatioThree().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
                             ratio = unit.getRatioThree();
                         }
@@ -489,11 +493,11 @@ public class MaterialController extends BaseController {
 //                    item.put("unitId",material.getUnitId());
 //                    item.put("inventory",materialService.getMaterialStockByMid(material.getId()).divide(ratio,2,BigDecimal.ROUND_HALF_UP));
                     BigDecimal stock;
-                    if(StringUtil.isNotEmpty(material.getSku())){
-                        stock = depotItemService.getSkuStockByParam(depotId,material.getMeId(),null,null);
+                    if (StringUtil.isNotEmpty(material.getSku())) {
+                        stock = depotItemService.getSkuStockByParam(depotId, material.getMeId(), null, null);
                     } else {
                         stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
-                        if (material.getUnitId()!=null){
+                        if (material.getUnitId() != null) {
                             String commodityUnit = material.getCommodityUnit();
                             stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
                         }
@@ -511,6 +515,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据商品id查找商品信息
+     *
      * @param meId
      * @param request
      * @return
@@ -520,14 +525,14 @@ public class MaterialController extends BaseController {
     @ApiOperation(value = "根据商品id查找商品信息")
     public JSONObject getMaterialByMeId(@RequestParam(value = "meId", required = false) Long meId,
                                         @RequestParam("mpList") String mpList,
-                                        HttpServletRequest request) throws Exception{
+                                        HttpServletRequest request) throws Exception {
         JSONObject item = new JSONObject();
         try {
             String[] mpArr = mpList.split(",");
             List<MaterialVo4Unit> materialList = materialService.getMaterialByMeId(meId);
-            if(materialList!=null && materialList.size()!=1) {
+            if (materialList != null && materialList.size() != 1) {
                 return item;
-            } else if(materialList.size() == 1) {
+            } else if (materialList.size() == 1) {
                 MaterialVo4Unit material = materialList.get(0);
                 item.put("Id", material.getMeId()); //商品扩展表的id
                 String ratio; //比例
@@ -558,6 +563,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 生成excel表格
+     *
      * @param categoryId
      * @param materialParam
      * @param color
@@ -597,6 +603,7 @@ public class MaterialController extends BaseController {
 
     /**
      * excel表格导入产品(含初始库存)
+     *
      * @param file
      * @param request
      * @param response
@@ -605,7 +612,7 @@ public class MaterialController extends BaseController {
     @PostMapping(value = "/importExcel")
     @ApiOperation(value = "excel表格导入产品")
     public BaseResponseInfo importExcel(MultipartFile file,
-                            HttpServletRequest request, HttpServletResponse response) throws Exception{
+                                        HttpServletRequest request, HttpServletResponse response) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             res = materialService.importExcelTwo(file, request);
@@ -617,6 +624,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 获取商品序列号
+     *
      * @param q
      * @param currentPage
      * @param pageSize
@@ -628,14 +636,14 @@ public class MaterialController extends BaseController {
     @GetMapping(value = "/getMaterialEnableSerialNumberList")
     @ApiOperation(value = "获取商品序列号")
     public JSONObject getMaterialEnableSerialNumberList(
-                                @RequestParam(value = "q", required = false) String q,
-                                @RequestParam("page") Integer currentPage,
-                                @RequestParam("rows") Integer pageSize,
-                                HttpServletRequest request,
-                                HttpServletResponse response)throws Exception {
-        JSONObject object= new JSONObject();
+            @RequestParam(value = "q", required = false) String q,
+            @RequestParam("page") Integer currentPage,
+            @RequestParam("rows") Integer pageSize,
+            HttpServletRequest request,
+            HttpServletResponse response) throws Exception {
+        JSONObject object = new JSONObject();
         try {
-            List<MaterialVo4Unit> list = materialService.getMaterialEnableSerialNumberList(q, (currentPage-1)*pageSize, pageSize);
+            List<MaterialVo4Unit> list = materialService.getMaterialEnableSerialNumberList(q, (currentPage - 1) * pageSize, pageSize);
             Long count = materialService.getMaterialEnableSerialNumberCount(q);
             object.put("rows", list);
             object.put("total", count);
@@ -647,6 +655,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 获取最大条码
+     *
      * @return
      * @throws Exception
      */
@@ -664,6 +673,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 商品名称模糊匹配
+     *
      * @return
      * @throws Exception
      */
@@ -687,6 +697,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据条码查询商品信息
+     *
      * @return
      * @throws Exception
      */
@@ -709,8 +720,8 @@ public class MaterialController extends BaseController {
 //                barCode = materialExtend.getBarCode();
 //            }
             List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
-            if(list!=null && list.size()>0) {
-                for(MaterialVo4Unit mvo: list) {
+            if (list != null && list.size() > 0) {
+                for (MaterialVo4Unit mvo : list) {
                     mvo.setMaterialOther(materialService.getMaterialOtherByParam(mpArr, mvo));
                     if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
                         //零售价
@@ -718,15 +729,15 @@ public class MaterialController extends BaseController {
                     } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
                         //采购价
                         mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
-                    } else if("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
+                    } else if ("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
                             || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
                         //采购价-给录入界面按权限屏蔽
-                       // mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
+                        // mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getPurchaseDecimal(), "buy", priceLimit, request));
                         mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
                     }
                     if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
                         //销售价
-                        if(organId == null) {
+                        if (organId == null) {
                             mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
                         } else {
                             //查询最后一单的销售价,实现不同的客户不同的销售价
@@ -734,7 +745,7 @@ public class MaterialController extends BaseController {
                             mvo.setBillPrice(lastUnitPrice != null ? lastUnitPrice : mvo.getDefaultWholesaleDecimal());
                         }
                         //销售价-给录入界面按权限屏蔽价格
-                        if("QTCK".equals(prefixNo)) {
+                        if ("QTCK".equals(prefixNo)) {
                             //mvo.setBillPrice(roleService.parseBillPriceByLimit(mvo.getWholesaleDecimal(), "sale", priceLimit, request));
                             mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
                         }
@@ -765,7 +776,7 @@ public class MaterialController extends BaseController {
             }
             res.code = 200;
             res.data = list;
-        } catch(Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
             res.code = 500;
             res.data = "获取数据失败";
@@ -775,6 +786,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据sku查询商品信息
+     *
      * @return
      * @throws Exception
      */
@@ -783,25 +795,25 @@ public class MaterialController extends BaseController {
     public AjaxResult getMaterialBySku(@RequestParam("sku") String sku,
                                        @RequestParam(value = "depotId", required = false) Long depotId,
                                        @RequestParam(required = false, value = "prefixNo") String prefixNo) {
-            List<MaterialVo4Unit> list = materialService.getMaterialBySku(sku);
-            if(list != null && list.size() > 0) {
-                for(MaterialVo4Unit mvo: list) {
-                    //包装规格
-                    mvo.setUnitName(materialUnitService.getStandardByMeId(mvo.getMeId()));
-                    if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
-                        //零售价
-                        mvo.setBillPrice(mvo.getCommodityDecimal());
-                    } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
-                        //采购价
-                        mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
-                    } else if("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
-                            || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
-                        mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
-                    }
-                    if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
-                        mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
-                    }
-                    //仓库id
+        List<MaterialVo4Unit> list = materialService.getMaterialBySku(sku);
+        if (list != null && list.size() > 0) {
+            for (MaterialVo4Unit mvo : list) {
+                //包装规格
+                mvo.setUnitName(materialUnitService.getStandardByMeId(mvo.getMeId()));
+                if ("LSCK".equals(prefixNo) || "LSTH".equals(prefixNo)) {
+                    //零售价
+                    mvo.setBillPrice(mvo.getCommodityDecimal());
+                } else if ("CGDD".equals(prefixNo) || "CGRK".equals(prefixNo) || "CGTH".equals(prefixNo)) {
+                    //采购价
+                    mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
+                } else if ("QTRK".equals(prefixNo) || "DBCK".equals(prefixNo) || "ZZD".equals(prefixNo) || "CXD".equals(prefixNo)
+                        || "PDLR".equals(prefixNo) || "PDFP".equals(prefixNo)) {
+                    mvo.setBillPrice(mvo.getDefaultPurchaseDecimal());
+                }
+                if ("XSDD".equals(prefixNo) || "XSCK".equals(prefixNo) || "XSTH".equals(prefixNo) || "QTCK".equals(prefixNo)) {
+                    mvo.setBillPrice(mvo.getDefaultWholesaleDecimal());
+                }
+                //仓库id
 //                    if (depotId == null) {
 //                        JSONArray depotArr = depotService.findDepotByCurrentUser();
 //                        for (Object obj : depotArr) {
@@ -821,13 +833,14 @@ public class MaterialController extends BaseController {
 //                    } else {
 //                        mvo.setDepotId(depotId);
 //                    }
-                }
             }
+        }
         return AjaxResult.success(list);
     }
 
     /**
      * 根据商品信息获取库存,进行赋值
+     *
      * @param mvo
      * @throws Exception
      */
@@ -848,6 +861,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 商品库存查询
+     *
      * @param currentPage
      * @param pageSize
      * @param depotIds
@@ -871,42 +885,42 @@ public class MaterialController extends BaseController {
                                              @RequestParam("zeroStock") Integer zeroStock,
                                              @RequestParam(value = "column", required = false, defaultValue = "createTime") String column,
                                              @RequestParam(value = "order", required = false, defaultValue = "desc") String order,
-                                             HttpServletRequest request)throws Exception {
+                                             HttpServletRequest request) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         Map<String, Object> map = new HashMap<>();
         try {
             List<Long> idList = new ArrayList<>();
             List<Long> depotList = new ArrayList<>();
-            if(categoryId != null){
+            if (categoryId != null) {
                 idList = materialService.getListByParentId(categoryId);
             }
-            if(StringUtil.isNotEmpty(depotIds)) {
+            if (StringUtil.isNotEmpty(depotIds)) {
                 depotList = StringUtil.strToLongList(depotIds);
             } else {
                 //未选择仓库时默认为当前用户有权限的仓库
                 JSONArray depotArr = depotService.findDepotByCurrentUser();
-                for(Object obj: depotArr) {
+                for (Object obj : depotArr) {
                     JSONObject object = JSONObject.parseObject(obj.toString());
                     depotList.add(object.getLong("id"));
                 }
             }
             Boolean moveAvgPriceFlag = systemConfigService.getMoveAvgPriceFlag();
             List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam),
-                    moveAvgPriceFlag, zeroStock, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
+                    moveAvgPriceFlag, zeroStock, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage - 1) * pageSize, pageSize);
             int total = materialService.getListWithStockCount(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam), zeroStock);
-            MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam));
+            MaterialVo4Unit materialVo4Unit = materialService.getTotalStockAndPrice(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam));
             map.put("total", total);
-            map.put("currentStock", materialVo4Unit.getCurrentStock()!=null?materialVo4Unit.getCurrentStock():BigDecimal.ZERO);
-            if(moveAvgPriceFlag) {
-                map.put("currentStockPrice", materialVo4Unit.getCurrentStockMovePrice()!=null?materialVo4Unit.getCurrentStockMovePrice():BigDecimal.ZERO);
+            map.put("currentStock", materialVo4Unit.getCurrentStock() != null ? materialVo4Unit.getCurrentStock() : BigDecimal.ZERO);
+            if (moveAvgPriceFlag) {
+                map.put("currentStockPrice", materialVo4Unit.getCurrentStockMovePrice() != null ? materialVo4Unit.getCurrentStockMovePrice() : BigDecimal.ZERO);
             } else {
-                map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice()!=null?materialVo4Unit.getCurrentStockPrice():BigDecimal.ZERO);
+                map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice() != null ? materialVo4Unit.getCurrentStockPrice() : BigDecimal.ZERO);
             }
-            map.put("currentWeight", materialVo4Unit.getCurrentWeight()!=null?materialVo4Unit.getCurrentWeight():BigDecimal.ZERO);
+            map.put("currentWeight", materialVo4Unit.getCurrentWeight() != null ? materialVo4Unit.getCurrentWeight() : BigDecimal.ZERO);
             map.put("rows", dataList);
             res.code = 200;
             res.data = map;
-        } catch(Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
             res.code = 500;
             res.data = "获取数据失败";
@@ -916,6 +930,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量设置商品当前的实时库存(按每个仓库)
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -924,11 +939,11 @@ public class MaterialController extends BaseController {
     @PostMapping(value = "/batchSetMaterialCurrentStock")
     @ApiOperation(value = "批量设置商品当前的实时库存(按每个仓库)")
     public String batchSetMaterialCurrentStock(@RequestBody JSONObject jsonObject,
-                                 HttpServletRequest request)throws Exception {
+                                               HttpServletRequest request) throws Exception {
         String ids = jsonObject.getString("ids");
         Map<String, Object> objectMap = new HashMap<>();
         int res = materialService.batchSetMaterialCurrentStock(ids);
-        if(res > 0) {
+        if (res > 0) {
             return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
         } else {
             return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
@@ -937,6 +952,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量设置商品当前的成本价
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -945,11 +961,11 @@ public class MaterialController extends BaseController {
     @PostMapping(value = "/batchSetMaterialCurrentUnitPrice")
     @ApiOperation(value = "批量设置商品当前的成本价")
     public String batchSetMaterialCurrentUnitPrice(@RequestBody JSONObject jsonObject,
-                                               HttpServletRequest request)throws Exception {
+                                                   HttpServletRequest request) throws Exception {
         String ids = jsonObject.getString("ids");
         Map<String, Object> objectMap = new HashMap<>();
         int res = materialService.batchSetMaterialCurrentUnitPrice(ids);
-        if(res > 0) {
+        if (res > 0) {
             return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
         } else {
             return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
@@ -958,6 +974,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量更新商品信息
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -966,10 +983,10 @@ public class MaterialController extends BaseController {
     @PostMapping(value = "/batchUpdate")
     @ApiOperation(value = "批量更新商品信息")
     public String batchUpdate(@RequestBody JSONObject jsonObject,
-                              HttpServletRequest request)throws Exception {
+                              HttpServletRequest request) throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
         int res = materialService.batchUpdate(jsonObject);
-        if(res > 0) {
+        if (res > 0) {
             return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
         } else {
             return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
@@ -978,17 +995,18 @@ public class MaterialController extends BaseController {
 
     /**
      * 转换名称为拼音
+     *
      * @param jsonObject
      */
     @PostMapping(value = "/changeNameToPinYin")
     @ApiOperation(value = "转换名称为拼音")
-    public BaseResponseInfo changeNameToPinYin(@RequestBody JSONObject jsonObject)throws Exception {
+    public BaseResponseInfo changeNameToPinYin(@RequestBody JSONObject jsonObject) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             String name = jsonObject.getString("name");
             res.code = 200;
             res.data = PinYinUtil.getFirstLettersLo(name);
-        } catch(Exception e){
+        } catch (Exception e) {
             logger.error(e.getMessage(), e);
             res.code = 500;
             res.data = "获取数据失败";
@@ -999,7 +1017,7 @@ public class MaterialController extends BaseController {
 
     @GetMapping(value = "/getMaterialByBatchNumber")
     @ApiOperation(value = "根据批次号查询商品信息")
-    public TableDataInfo getMaterialByBatchNumber(@RequestParam("batchNumber") String batchNumber){
+    public TableDataInfo getMaterialByBatchNumber(@RequestParam("batchNumber") String batchNumber) {
         String[] batchNumbers = batchNumber.split(",");
         startPage();
         List<TaskStocktakingItemVO> list = materialBatchService.getMaterialByBatchNumber(batchNumbers);
@@ -1009,7 +1027,7 @@ public class MaterialController extends BaseController {
     @GetMapping(value = "/getMaterialById")
     @ApiOperation(value = "根据商品id查询商品及子表信息")
     public BaseResponseInfo getMaterialById(@RequestParam("mid") Long materialId,
-                                          HttpServletRequest request)throws Exception {
+                                            HttpServletRequest request) throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         res.code = 200;
         res.data = materialService.getMaterialById(materialId);
@@ -1018,7 +1036,7 @@ public class MaterialController extends BaseController {
 
     @GetMapping(value = "/getMaterialWarn")
     @ApiOperation(value = "获取商品提醒")
-    public BaseResponseInfo getMaterialWarn()throws Exception {
+    public BaseResponseInfo getMaterialWarn() throws Exception {
         BaseResponseInfo res = new BaseResponseInfo();
         res.code = 200;
         res.data = materialService.getMaterialWarn();
@@ -1028,20 +1046,20 @@ public class MaterialController extends BaseController {
     @GetMapping(value = "/findBatchNumbersBySelect")
     @ApiOperation(value = "商品选择全选获取商品批次号")
     public BaseResponseInfo findBatchNumberSBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
-                                           @RequestParam(value = "q", required = false) String q,
-                                           @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
-                                           @RequestParam(value = "depotId", required = false) Long depotId,
-                                           @RequestParam(value = "color", required = false) String color,
-                                           @RequestParam(value = "brand", required = false) String brand,
-                                           @RequestParam(value = "mfrs", required = false) String mfrs,
-                                           @RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
-                                           @RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
-                                           HttpServletRequest request){
+                                                     @RequestParam(value = "q", required = false) String q,
+                                                     @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
+                                                     @RequestParam(value = "depotId", required = false) Long depotId,
+                                                     @RequestParam(value = "color", required = false) String color,
+                                                     @RequestParam(value = "brand", required = false) String brand,
+                                                     @RequestParam(value = "mfrs", required = false) String mfrs,
+                                                     @RequestParam(value = "enableSerialNumber", required = false) String enableSerialNumber,
+                                                     @RequestParam(value = "enableBatchNumber", required = false) String enableBatchNumber,
+                                                     HttpServletRequest request) {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             List<MaterialVo4Unit> dataList = materialBatchService.findBySelectWithBarCode(categoryId, q, StringUtil.toNull(standardOrModel),
                     StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
-                    null, null,depotId);
+                    null, null, depotId);
             StringBuffer str = new StringBuffer();
             //存放数据json数组
             if (null != dataList) {

+ 0 - 5
src/main/java/com/jsh/erp/controller/MaterialExtendController.java

@@ -1,19 +1,15 @@
 package com.jsh.erp.controller;
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.jsh.erp.base.AjaxResult;
 import com.jsh.erp.datasource.entities.MaterialExtend;
 import com.jsh.erp.datasource.entities.MaterialUpc;
 import com.jsh.erp.datasource.vo.MaterialExtendVo;
-import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
 import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.service.MaterialExtendService;
 import com.jsh.erp.service.MaterialUpcService;
 import com.jsh.erp.utils.BaseResponseInfo;
-import com.jsh.erp.utils.DateUtils;
 import com.jsh.erp.utils.ErpInfo;
-import com.jsh.erp.utils.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
@@ -22,7 +18,6 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;

+ 44 - 0
src/main/java/com/jsh/erp/controller/MaterialInputController.java

@@ -0,0 +1,44 @@
+package com.jsh.erp.controller;
+
+import com.jsh.erp.base.AjaxResult;
+import com.jsh.erp.datasource.dto.MaterialDTO;
+import com.jsh.erp.datasource.dto.MaterialInputDto;
+import com.jsh.erp.service.MaterialInputService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+
+@RestController
+@RequestMapping(value = "/materialInput")
+@Api(tags = {"商品录入管理"})
+public class MaterialInputController {
+
+    @Resource
+    private MaterialInputService materialInputService;
+
+    /**
+     * 查询任务详情
+     * @param number
+     * @return
+     */
+    @ApiOperation("商品录入详情")
+    @GetMapping("/detail/{number}")
+    public AjaxResult detailByNumber(@PathVariable("number") String number) {
+        return AjaxResult.success(materialInputService.getDetailByNumber(number));
+    }
+
+    @PostMapping(value = "/update")
+    @ApiOperation(value = "修改货物录入信息")
+    public AjaxResult updateResource(@RequestBody MaterialInputDto materialInputDto) {
+        boolean b = materialInputService.updateMaterialInput(materialInputDto);
+        if (!b){
+            return AjaxResult.error("修改货物录入信息失败");
+        }
+        return AjaxResult.success();
+    }
+
+
+}

+ 1 - 1
src/main/java/com/jsh/erp/controller/MsgController.java

@@ -148,7 +148,7 @@ public class MsgController extends BaseController {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             String ids = jsonObject.getString("ids");
-            String status = jsonObject.getString("status");
+            Integer status = jsonObject.getInteger("status");
             msgService.batchUpdateStatus(ids, status);
             res.code = 200;
             res.data = "更新成功";

+ 1 - 1
src/main/java/com/jsh/erp/controller/UnitController.java

@@ -103,7 +103,7 @@ public class UnitController extends BaseController {
 
     @GetMapping(value = "/getAllList")
     @ApiOperation(value = "单位列表")
-    public BaseResponseInfo getAllList() throws Exception{
+    public BaseResponseInfo getAllList() {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             List<Unit> unitList = unitService.unitList();

+ 74 - 0
src/main/java/com/jsh/erp/controller/audit/AuditController.java

@@ -0,0 +1,74 @@
+package com.jsh.erp.controller.audit;
+
+
+import com.jsh.erp.base.AjaxResult;
+import com.jsh.erp.base.BaseController;
+import com.jsh.erp.base.TableDataInfo;
+import com.jsh.erp.datasource.dto.AuditDTO;
+import com.jsh.erp.datasource.dto.AuditQueryDTO;
+import com.jsh.erp.datasource.vo.AuditVo;
+import com.jsh.erp.service.AuditService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+@RestController
+@RequestMapping(value = "/audit")
+@Api(tags = {"审核接口"})
+public class AuditController extends BaseController {
+
+    @Resource
+    private AuditService auditService;
+
+    //待我审批列表
+    @ApiOperation("待我审批列表")
+    @PostMapping("/pendingApprovalList")
+    public TableDataInfo pendingApprovalList(@RequestBody AuditQueryDTO auditQueryDTO){
+        List<AuditVo> list = auditService.pendingApprovalList(auditQueryDTO);
+        return getDataTable(list);
+    }
+
+    //待我审批列表
+    @ApiOperation("待我审批数量")
+    @GetMapping("/pendingApprovalCount")
+    public AjaxResult pendingApprovalCount(){
+        Long count = auditService.pendingApprovalCount();
+        return AjaxResult.success(count);
+    }
+
+    //已处理审批列表
+    @ApiOperation("已处理审批列表")
+    @PostMapping("/processedApprovalList")
+    public TableDataInfo processedApprovalList(@RequestBody AuditQueryDTO auditQueryDTO){
+        List<AuditVo> list = auditService.processedApprovalList(auditQueryDTO);
+        return getDataTable(list);
+    }
+
+    //我发起的任务列表
+    @ApiOperation("我发起的任务列表")
+    @PostMapping("/myApprovalList")
+    public TableDataInfo myApprovalList(@RequestBody AuditQueryDTO auditQueryDTO){
+        List<AuditVo> list = auditService.myApprovalList(auditQueryDTO);
+        return getDataTable(list);
+    }
+
+    //审核历史
+    @ApiOperation("审核历史")
+    @GetMapping("/auditHistory")
+    public AjaxResult auditHistory(@RequestParam(value = "id") Long id){
+        return AjaxResult.success(auditService.getAuditHistory(id));
+    }
+
+    @ApiOperation("设置审核状态")
+    @PostMapping("/setStatus")
+    public AjaxResult setStatus(@RequestBody AuditDTO auditDTO, HttpServletRequest request) {
+        boolean b = auditService.setStatus(auditDTO);
+        return AjaxResult.success(b);
+    }
+
+
+}

+ 78 - 23
src/main/java/com/jsh/erp/controller/pda/PdaController.java

@@ -1,9 +1,7 @@
 package com.jsh.erp.controller.pda;
 
 import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.jsh.erp.base.AjaxResult;
 import com.jsh.erp.base.BaseController;
@@ -11,10 +9,7 @@ import com.jsh.erp.base.TableDataInfo;
 import com.jsh.erp.datasource.entities.DepotHead;
 import com.jsh.erp.datasource.entities.Supplier;
 import com.jsh.erp.datasource.entities.*;
-import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
-import com.jsh.erp.datasource.pda.dto.PDAInventoryDTO;
-import com.jsh.erp.datasource.pda.dto.PDATaskStocktakingDTO;
-import com.jsh.erp.datasource.pda.dto.PDATaskStocktakingItemDTO;
+import com.jsh.erp.datasource.pda.dto.*;
 import com.jsh.erp.datasource.pda.vo.*;
 import com.jsh.erp.datasource.vo.SpinnerVO;
 import com.jsh.erp.datasource.vo.TaskStocktakingVO;
@@ -50,39 +45,32 @@ public class PdaController extends BaseController {
 
     @Resource
     private DepotHeadService depotHeadService;
-
     @Resource
     private DepotItemService depotItemService;
-
     @Resource
     private SupplierService supplierService;
-
     @Resource
     private MaterialService materialService;
-
     @Resource
     private TaskStocktakingService taskStocktakingService;
-
     @Resource
     private TaskStocktakingItemService taskStocktakingItemService;
-
     @Resource
     private UserService userService;
-
     @Resource
     private MaterialCategoryService materialCategoryService;
-
-    @Resource
-    private MaterialExtendService materialExtendService;
-
     @Resource
     private ApkVersionService apkVersionService;
-
     @Resource
     private DepotService depotService;
-
     @Resource
     private MaterialBatchService materialBatchService;
+    @Resource
+    private MaterialInputService materialInputService;
+    @Resource
+    private MaterialExtendService materialExtendService;
+    @Resource
+    private MsgService msgService;
 
     @PostMapping ("/purchaseInventory")
     @ApiOperation(value = "采购入库")
@@ -115,6 +103,9 @@ public class PdaController extends BaseController {
         if (depotHead.getOperId() != null) {
             depotHead.setOperName(userService.getOne(new LambdaQueryWrapperX<User>().eq(User::getId, depotHead.getOperId())).getUsername());
         }
+        if (depotHead.getAuditor() != null) {
+            depotHead.setAuditorName(userService.getOne(new LambdaQueryWrapperX<User>().eq(User::getId, depotHead.getAuditor())).getUsername());
+        }
         return AjaxResult.success(depotHead);
     }
 
@@ -272,12 +263,8 @@ public class PdaController extends BaseController {
     @PostMapping("/inventoryInquiry")
     @ApiOperation("存货查询-商品存货查询")
     public TableDataInfo inventoryInquiry(@RequestBody PDAInventoryDTO pdaInventoryDTO){
-        if (StringUtil.isNotEmpty(pdaInventoryDTO.getPosition())){
-            pdaInventoryDTO.setMaterialIds(materialService.selectMaterialIdByPosition(pdaInventoryDTO.getPosition()));
-        }
         //查询类型id的子类型
         pdaInventoryDTO.setCategoryIds(materialService.selectCategoryIds(pdaInventoryDTO.getCategoryId()));
-        startPage();
         List<PDADepotItemVO> list = materialService.inventoryInquiry(pdaInventoryDTO);
         return getDataTable(list);
     }
@@ -357,4 +344,72 @@ public class PdaController extends BaseController {
         return AjaxResult.success(pdaPrintVo);
     }
 
+    @ApiOperation("货物信息录入保存")
+    @PostMapping("/goodsSave")
+    public AjaxResult goodsSave(@RequestBody MaterialInput materialInput) {
+        boolean b = materialInputService.add(materialInput);
+        if (!b){
+            return AjaxResult.success("保存失败");
+        }
+        return AjaxResult.success("保存成功");
+    }
+
+    @PostMapping("/goodsInputList")
+    @ApiOperation("货物录入列表")
+    public TableDataInfo goodsInputList(@RequestBody PDAGoodsInputDTO pdaInventoryDTO){
+        startPage();
+        List<MaterialInput> list = materialInputService.list(new LambdaQueryWrapperX<MaterialInput>().eq(MaterialInput::getDepotId,pdaInventoryDTO.getDepotId()));
+        return getDataTable(list);
+    }
+
+    @PostMapping("/reviewTaskList")
+    @ApiOperation("复核任务列表")
+    public TableDataInfo reviewTaskList(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO){
+        List<PDADepotHeadVO> list = depotHeadService.reviewTaskList(pdaDepotHeadDTO);
+        return getDataTable(list);
+    }
+
+    @PostMapping("/setReviewTask")
+    @ApiOperation("设置复核任务状态")
+    public AjaxResult setReview(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO){
+        Long userId = userService.getCurrentUser().getId();
+        DepotHead depotHead = depotHeadService.getDepotHead(pdaDepotHeadDTO.getId());
+        if (depotHead.getCreator() == userId){
+            return AjaxResult.error("提交人不能和复核人为同一账号");
+        }
+
+        depotHeadService.update(new UpdateWrapper<DepotHead>()
+                .set("status",pdaDepotHeadDTO.getStatus())
+                .set("reject",pdaDepotHeadDTO.getReject())
+                .set("auditor",userId)
+                .set("reject_time",new Date())
+                .eq("id",pdaDepotHeadDTO.getId()));
+        return AjaxResult.success();
+    }
+
+    @GetMapping("/getSkuByUpc")
+    @ApiOperation("根据upc获取sku")
+    public AjaxResult getSkuByUpc(@RequestParam("upc") String upc){
+        String sku = materialExtendService.getSkuByUpc(upc);
+        if (StringUtil.isEmpty(sku)){
+            return AjaxResult.error("系统没有找到对应的sku");
+        }
+        return AjaxResult.success("操作成功",sku);
+    }
+
+    @GetMapping("/getMsgList")
+    @ApiOperation("获取用户消息列表")
+    public TableDataInfo getMsgList(){
+        List<PDAMsgListVO> list = msgService.pdaMsgList();
+        return getDataTable(list);
+    }
+
+
+
+
+
+
+
+
+
 }

+ 18 - 0
src/main/java/com/jsh/erp/controller/stocktaking/StocktakingController.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.jsh.erp.base.AjaxResult;
 import com.jsh.erp.base.BaseController;
 import com.jsh.erp.base.TableDataInfo;
+import com.jsh.erp.constants.ExceptionConstants;
 import com.jsh.erp.datasource.dto.TaskStocktakingDTO;
 import com.jsh.erp.datasource.dto.TaskStocktakingItemDTO;
 import com.jsh.erp.datasource.dto.TaskStocktakingItemQueryDTO;
@@ -67,6 +68,7 @@ public class StocktakingController extends BaseController {
         return AjaxResult.success(spinnerVOList);
     }
 
+
     /**
      * 查询任务详情
      * @param id
@@ -79,6 +81,17 @@ public class StocktakingController extends BaseController {
     }
 
     /**
+     * 查询任务详情
+     * @param number
+     * @return
+     */
+    @ApiOperation("任务详情")
+    @GetMapping("/detail/number/{number}")
+    public AjaxResult detailByNumber(@PathVariable("number") String number) {
+        return AjaxResult.success(taskStocktakingService.detail(number));
+    }
+
+    /**
      * 任务详情-商品列表
      * @param taskStocktakingItemQueryDTO 筛选数据
      * @return
@@ -95,6 +108,11 @@ public class StocktakingController extends BaseController {
     @ApiOperation("任务详情-修改")
     @PostMapping("/detailUpdate")
     public AjaxResult detailUpdate(@RequestBody TaskStocktakingDTO taskStocktakingDTO) {
+        //校验盘点状态,如果不是未审核或审核失败则提示
+        TaskStocktaking taskStocktaking = taskStocktakingService.getById(taskStocktakingDTO.getId());
+        if(!taskStocktaking.getTaskStatus().equals(0) && !taskStocktaking.getTaskStatus().equals(8)) {
+            return AjaxResult.error(ExceptionConstants.TASK_STOCKTAKING_BILL_CANNOT_EDIT_MSG);
+        }
         boolean b = taskStocktakingService.detailUpdate(taskStocktakingDTO);
         if (!b){
             return AjaxResult.error("修改失败,请联系系统管理员");

+ 18 - 0
src/main/java/com/jsh/erp/datasource/dto/AuditDTO.java

@@ -0,0 +1,18 @@
+package com.jsh.erp.datasource.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class AuditDTO {
+
+    @ApiModelProperty("主键")
+    private Long id;
+
+    @ApiModelProperty("状态 1:已通过 2:未通过")
+    private Integer status;
+
+    @ApiModelProperty("备注")
+    private String auditComment;
+
+}

+ 31 - 0
src/main/java/com/jsh/erp/datasource/dto/AuditQueryDTO.java

@@ -0,0 +1,31 @@
+package com.jsh.erp.datasource.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class AuditQueryDTO {
+
+    @ApiModelProperty("单据号")
+    private String number;
+
+    @ApiModelProperty("流程类型")
+    private String type;
+
+    @ApiModelProperty("发起人")
+    private String initiatorName;
+
+    @ApiModelProperty("状态")
+    private Integer auditStatus;
+
+    @ApiModelProperty("开始时间")
+    private Date beginTime;
+
+    @ApiModelProperty("结束时间")
+    private Date endTime;
+
+    private Long uid;
+
+}

+ 1 - 3
src/main/java/com/jsh/erp/datasource/dto/DepotHeadDTO.java

@@ -2,11 +2,9 @@ package com.jsh.erp.datasource.dto;
 
 
 import com.jsh.erp.datasource.entities.DepotHead;
-import com.jsh.erp.datasource.entities.DepotItem;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
-import java.math.BigDecimal;
 import java.util.List;
 
 /**
@@ -19,6 +17,6 @@ public class DepotHeadDTO {
     private DepotHead info;
 
     @ApiModelProperty("单据子表信息")
-    private List<DepotItem> rows;
+    private List<DepotItemDTO> rows;
 
 }

+ 26 - 0
src/main/java/com/jsh/erp/datasource/dto/DepotItemDTO.java

@@ -0,0 +1,26 @@
+package com.jsh.erp.datasource.dto;
+
+import com.jsh.erp.datasource.entities.DepotItem;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class DepotItemDTO extends DepotItem {
+
+    private String unit;
+
+    private BigDecimal preNumber;
+
+    private BigDecimal finishNumber;
+
+    private String mType;
+
+    public void setId(String id) {
+        if (id != null && id.length() > 19){
+            super.setId(null);
+        }else {
+            super.setId(Long.parseLong(id));
+        }
+    }
+}

+ 9 - 0
src/main/java/com/jsh/erp/datasource/dto/MaterialInputDto.java

@@ -0,0 +1,9 @@
+package com.jsh.erp.datasource.dto;
+
+import com.jsh.erp.datasource.entities.MaterialInput;
+
+public class MaterialInputDto extends MaterialInput {
+
+
+
+}

+ 46 - 0
src/main/java/com/jsh/erp/datasource/entities/Audit.java

@@ -0,0 +1,46 @@
+package com.jsh.erp.datasource.entities;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 审核
+ */
+@Data
+public class Audit {
+
+    @ApiModelProperty("主键ID")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("流程ID")
+    private Long processId;
+
+    @ApiModelProperty("业务ID")
+    private Long businessId;
+
+    @ApiModelProperty("业务单号")
+    private String businessNumber;
+
+    @ApiModelProperty("流程类型")
+    private String type;
+
+    @ApiModelProperty("审核状态(0:进行中 1:已通过 2:未通过)")
+    private Integer auditStatus;
+
+    @ApiModelProperty("提交用户")
+    private Long submitUser;
+
+    @ApiModelProperty("提交时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date submitTime;
+
+    @ApiModelProperty("删除标记,0正常,1删除")
+    private Boolean deleteFlag;
+
+}

+ 50 - 0
src/main/java/com/jsh/erp/datasource/entities/AuditNode.java

@@ -0,0 +1,50 @@
+package com.jsh.erp.datasource.entities;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 审核节点
+ */
+@Data
+public class AuditNode {
+
+    @ApiModelProperty("主键ID")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("审核ID")
+    private Long auditId;
+
+    @ApiModelProperty("节点配置ID")
+    private Long nodeId;
+
+    @ApiModelProperty("审批用户")
+    private Long auditorUser;
+
+    @ApiModelProperty("审批结果(0:进行中 1:已通过 2:未通过)")
+    private Integer auditResult;
+
+    @ApiModelProperty("审批意见")
+    private String auditComment;
+
+    @ApiModelProperty("审批时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date auditTime;
+
+    @ApiModelProperty("创建时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    @ApiModelProperty("删除标记,0正常,1删除")
+    private Boolean deleteFlag;
+
+    @ApiModelProperty("节点顺序")
+    private int nodeOrder;
+
+}

+ 13 - 3
src/main/java/com/jsh/erp/datasource/entities/DepotHead.java

@@ -93,7 +93,7 @@ public class DepotHead {
     @ApiModelProperty("订金")
     private BigDecimal deposit;
 
-    @ApiModelProperty("状态,0未审核、1已审核、2完成采购|销售、3部分采购|销售、9审核中")
+    @ApiModelProperty("状态,0未审核、1已审核、2完成采购|销售、3部分采购|销售、4入库中、6待复核、7复核驳回、8审核失败、9审核中")
     private String status;
 
     @ApiModelProperty("采购状态,0未采购、2完成采购、3部分采购")
@@ -128,11 +128,11 @@ public class DepotHead {
     private String supplierName;
 
     @TableField(exist = false)
-    @ApiModelProperty("供应商名称")
+    @ApiModelProperty("操作名称")
     private String operName;
 
     @TableField(exist = false)
-    @ApiModelProperty("供应商名称")
+    @ApiModelProperty("创建人名称")
     private String createName;
 
     @ApiModelProperty("集采订单编号")
@@ -163,6 +163,16 @@ public class DepotHead {
     @ApiModelProperty("税率")
     private BigDecimal taxRate;
 
+    @ApiModelProperty("驳回原因")
+    private String reject;
+
+    @ApiModelProperty("驳回时间")
+    private Date rejectTime;
+
+    @TableField(exist = false)
+    @ApiModelProperty("复核人名称")
+    private String auditorName;
+
 
     public Long getId() {
         return id;

+ 6 - 0
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -90,6 +90,12 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
     @ApiModelProperty("入库人名字")
     private String warehousingUserName;
 
+    @ApiModelProperty("完成数量")
+    private BigDecimal finishNumber;
+
+    @ApiModelProperty("原数量")
+    private BigDecimal preNumber;
+
     //商品信息
     @ApiModelProperty("商品名称")
     private String name;

+ 6 - 6
src/main/java/com/jsh/erp/datasource/entities/Material.java

@@ -123,9 +123,9 @@ public class Material {
     }
 
 
-    public void setUnit(String unit) {
-        this.unit = unit == null ? null : unit.trim();
-    }
+//    public void setUnit(String unit) {
+//        this.unit = unit == null ? null : unit.trim();
+//    }
 
     public void setRemark(String remark) {
         this.remark = remark == null ? null : remark.trim();
@@ -151,9 +151,9 @@ public class Material {
         this.enableSerialNumber = enableSerialNumber == null ? null : enableSerialNumber.trim();
     }
 
-    public void setEnableBatchNumber(String enableBatchNumber) {
-        this.enableBatchNumber = enableBatchNumber == null ? null : enableBatchNumber.trim();
-    }
+//    public void setEnableBatchNumber(String enableBatchNumber) {
+//        this.enableBatchNumber = enableBatchNumber == null ? null : enableBatchNumber.trim();
+//    }
 
     public void setDeleteFlag(String deleteFlag) {
         this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();

+ 0 - 60
src/main/java/com/jsh/erp/datasource/entities/MaterialInitialStock.java

@@ -42,66 +42,6 @@ public class MaterialInitialStock {
     @ApiModelProperty("仓位货架")
     private String position;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Long getMaterialId() {
-        return materialId;
-    }
-
-    public void setMaterialId(Long materialId) {
-        this.materialId = materialId;
-    }
-
-    public Long getDepotId() {
-        return depotId;
-    }
-
-    public void setDepotId(Long depotId) {
-        this.depotId = depotId;
-    }
-
-    public BigDecimal getNumber() {
-        return number;
-    }
-
-    public void setNumber(BigDecimal number) {
-        this.number = number;
-    }
-
-    public BigDecimal getLowSafeStock() {
-        return lowSafeStock;
-    }
-
-    public void setLowSafeStock(BigDecimal lowSafeStock) {
-        this.lowSafeStock = lowSafeStock;
-    }
-
-    public BigDecimal getHighSafeStock() {
-        return highSafeStock;
-    }
-
-    public void setHighSafeStock(BigDecimal highSafeStock) {
-        this.highSafeStock = highSafeStock;
-    }
-
-    public Long getTenantId() {
-        return tenantId;
-    }
-
-    public void setTenantId(Long tenantId) {
-        this.tenantId = tenantId;
-    }
-
-    public String getDeleteFlag() {
-        return deleteFlag;
-    }
-
     public void setDeleteFlag(String deleteFlag) {
         this.deleteFlag = deleteFlag == null ? null : deleteFlag.trim();
     }

+ 70 - 0
src/main/java/com/jsh/erp/datasource/entities/MaterialInput.java

@@ -0,0 +1,70 @@
+package com.jsh.erp.datasource.entities;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 商品录入
+ */
+@Data
+public class MaterialInput {
+
+    @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("录入单号")
+    private String number;
+
+    @ApiModelProperty("商品名称")
+    private String name;
+
+    @ApiModelProperty("商品条码")
+    private String barCode;
+
+    @ApiModelProperty("规格")
+    private String standard;
+
+    @ApiModelProperty("生产日期")
+    private Date productionDate;
+
+    @ApiModelProperty("图片名称")
+    private String imgName;
+
+    @ApiModelProperty("仓库id")
+    private Long depotId;
+
+    @ApiModelProperty("仓位货架")
+    private String position;
+
+    @ApiModelProperty("录入状态 0.待审核,1.正常,2.已驳回")
+    private Integer status;
+
+    @ApiModelProperty("类别id")
+    private Long categoryId;
+
+    @ApiModelProperty("默认采购价格")
+    private BigDecimal defaultPurchaseDecimal;
+
+    @ApiModelProperty("默认销售价格")
+    private BigDecimal defaultWholesaleDecimal;
+
+    @ApiModelProperty("商品单位")
+    private String commodityUnit;
+
+    @ApiModelProperty("创建人")
+    private Long createBy;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("删除标记,0正常,1删除")
+    private Boolean deleteFlag;
+
+
+}

+ 7 - 3
src/main/java/com/jsh/erp/datasource/entities/MaterialUnit.java

@@ -18,9 +18,6 @@ public class MaterialUnit {
     @ApiModelProperty("商品扩展id")
     private Long materialExtendId;
 
-    @ApiModelProperty("单位id")
-    private Long unitId;
-
     @ApiModelProperty("单位比例")
     private Integer ratio;
 
@@ -30,4 +27,11 @@ public class MaterialUnit {
     @ApiModelProperty("删除标记,0未删除,1删除")
     private Boolean deleteFlag;
 
+    public MaterialUnit() {
+    }
+
+    public MaterialUnit(String name, Integer ratio) {
+        this.ratio = ratio;
+        this.name = name;
+    }
 }

+ 2 - 1
src/main/java/com/jsh/erp/datasource/entities/MaterialUpc.java

@@ -4,11 +4,13 @@ import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import lombok.experimental.Accessors;
 
 /**
  * 商品UPC
  */
 @Data
+@Accessors(chain = true)
 public class MaterialUpc {
 
     @ApiModelProperty("主键id")
@@ -28,5 +30,4 @@ public class MaterialUpc {
     private Boolean deleteFlag;
 
 
-
 }

+ 19 - 13
src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java

@@ -17,10 +17,7 @@ import java.util.List;
 @Accessors(chain = true)
 public class MaterialVo4Unit extends Material{
 
-    private String unitName;
-
-    private BigDecimal ratio;
-
+    //商品信息
     @ApiModelProperty("类型名称")
     private String categoryName;
     @ApiModelProperty("拓展信息")
@@ -38,12 +35,29 @@ public class MaterialVo4Unit extends Material{
     private String color;
     @ApiModelProperty("基础重量(kg)")
     private BigDecimal weight;
+    @ApiModelProperty("商品单位")
+    private String commodityUnit;
 
     //库存信息
     @ApiModelProperty("商品当前库存")
     private BigDecimal stock;
     @ApiModelProperty("商品初始库存")
     private BigDecimal initialStock;
+    /**
+     * 换算为大单位的库存
+     */
+    private String bigUnitStock;
+
+    /**
+     * 换算为大单位的初始库存
+     */
+    private String bigUnitInitialStock;
+
+    private String unitName;
+
+    private BigDecimal ratio;
+
+
 
     private BigDecimal purchaseDecimal;
 
@@ -57,7 +71,7 @@ public class MaterialVo4Unit extends Material{
 
     private String mBarCode;
 
-    private String commodityUnit;
+
 
     private Long meId;
 
@@ -75,15 +89,7 @@ public class MaterialVo4Unit extends Material{
 
 //    private Long depotId;
 
-    /**
-     * 换算为大单位的库存
-     */
-    private String bigUnitStock;
 
-    /**
-     * 换算为大单位的初始库存
-     */
-    private String bigUnitInitialStock;
 
     @ApiModelProperty("生产日期")
     private String productionDate;

+ 8 - 7
src/main/java/com/jsh/erp/datasource/entities/Msg.java

@@ -1,7 +1,12 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
 import java.util.Date;
 
+@Data
+@TableName("jsh_msg")
 public class Msg {
     private Long id;
 
@@ -15,7 +20,7 @@ public class Msg {
 
     private Long userId;
 
-    private String status;
+    private Integer status;
 
     private Long tenantId;
 
@@ -69,12 +74,8 @@ public class Msg {
         this.userId = userId;
     }
 
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status == null ? null : status.trim();
+    public void setStatus(Integer status) {
+        this.status = status == null ? null : status;
     }
 
     public Long getTenantId() {

+ 38 - 0
src/main/java/com/jsh/erp/datasource/mappers/AuditMapper.java

@@ -0,0 +1,38 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.dto.AuditQueryDTO;
+import com.jsh.erp.datasource.entities.Audit;
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
+import com.jsh.erp.datasource.vo.AuditVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface AuditMapper extends BaseMapperX<Audit> {
+
+    /**
+     * 待处理审批列表
+     * @return
+     */
+    List<AuditVo> pendingApprovalList(AuditQueryDTO auditQueryDTO);
+
+    /**
+     * 待处理审批列表
+     * @return
+     */
+    List<AuditVo> processedApprovalList(AuditQueryDTO auditQueryDTO);
+
+    /**
+     * 待处理审批列表
+     * @return
+     */
+    List<AuditVo> myApprovalList(AuditQueryDTO auditQueryDTO);
+
+    /**
+     * pda复核任务列表
+     * @return
+     */
+    List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO);
+
+}

+ 6 - 0
src/main/java/com/jsh/erp/datasource/mappers/AuditNodeConfigMapper.java

@@ -2,6 +2,7 @@ package com.jsh.erp.datasource.mappers;
 
 import com.jsh.erp.datasource.entities.AuditNodeConfig;
 import com.jsh.erp.datasource.vo.AuditNodeConfigVo;
+import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
 
@@ -11,6 +12,11 @@ public interface AuditNodeConfigMapper extends BaseMapperX<AuditNodeConfig> {
 
     int updateBatchById(List<AuditNodeConfig> list);
 
+    /**
+     * 根据审核id和顺序查询审核节点流程配置
+     */
+    AuditNodeConfig getAuditNodeConfigByAuditIdAndOrder(@Param("id") Long id,
+                                                        @Param("order") int order);
 
 
 }

+ 18 - 0
src/main/java/com/jsh/erp/datasource/mappers/AuditNodeMapper.java

@@ -0,0 +1,18 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.entities.AuditNode;
+import com.jsh.erp.datasource.vo.AuditNodeVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+public interface AuditNodeMapper extends BaseMapperX<AuditNode> {
+
+    /**
+     * 根据审核id获取审核历史
+     * @param id  审核实例id
+     */
+    List<AuditNodeVo> getAuditHistoryByAuditId(@Param("id") Long id);
+
+
+}

+ 7 - 0
src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java

@@ -24,6 +24,13 @@ public interface DepotHeadMapper extends BaseMapperX<DepotHead> {
      */
     PDADepotHeadVO pdaDetail(@Param("id")Long id);
 
+    /**
+     * PDA查询订单
+     * @param pdaDepotHeadDTO 筛选条件
+     * @return
+     */
+    List<PDADepotHeadVO> reviewTaskList(PDADepotHeadDTO pdaDepotHeadDTO);
+
     long countByExample(DepotHeadExample example);
 
     int deleteByExample(DepotHeadExample example);

+ 2 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialCategoryMapper.java

@@ -17,8 +17,10 @@ public interface MaterialCategoryMapper extends BaseMapperX<MaterialCategory> {
 
     int insertSelective(MaterialCategory record);
 
+    //根据条件查询商品类型集合
     List<MaterialCategory> selectByExample(MaterialCategoryExample example);
 
+    //根据主键id查询商品类别
     MaterialCategory selectByPrimaryKey(Long id);
 
     int updateByExampleSelective(@Param("record") MaterialCategory record, @Param("example") MaterialCategoryExample example);

+ 2 - 1
src/main/java/com/jsh/erp/datasource/mappers/MaterialCategoryMapperEx.java

@@ -19,7 +19,8 @@ public interface MaterialCategoryMapperEx {
             @Param("name") String name,
             @Param("parentId") Integer parentId);
 
-    List<TreeNode> getNodeTree(@Param("currentId")Long currentId);
+    //获取除当前类型的商品树类型数据
+    List<TreeNode> getNodeTree(@Param("currentId") Long currentId);
     List<TreeNode> getNextNodeTree(Map<String, Object> parameterMap);
 
     int addMaterialCategory(MaterialCategory mc);

+ 1 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialCurrentStockMapperEx.java

@@ -11,6 +11,7 @@ public interface MaterialCurrentStockMapperEx {
 
     int batchInsert(List<MaterialCurrentStock> list);
 
+    //根据商品id集合获取商品当前库存集合
     List<MaterialCurrentStock> getCurrentStockMapByIdList(
             @Param("materialIdList") List<Long> materialIdList);
 

+ 5 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialExtendMapper.java

@@ -52,4 +52,9 @@ public interface MaterialExtendMapper extends BaseMapperX<MaterialExtend>{
     BigDecimal getInventorySumByDepotAndMid(@Param("depotList") List<Long> depotList,
                                             @Param("mid") long mid);
 
+    /**
+     * 根据UPC获取sku
+     */
+    String getSkuByUpc(String upc);
+
 }

+ 1 - 1
src/main/java/com/jsh/erp/datasource/mappers/MaterialInitialStockMapper.java

@@ -1,6 +1,5 @@
 package com.jsh.erp.datasource.mappers;
 
-import com.jsh.erp.datasource.entities.Material;
 import com.jsh.erp.datasource.entities.MaterialInitialStock;
 import com.jsh.erp.datasource.entities.MaterialInitialStockExample;
 import java.util.List;
@@ -15,6 +14,7 @@ public interface MaterialInitialStockMapper extends BaseMapperX<MaterialInitialS
 
     int insert(MaterialInitialStock record);
 
+    //添加商品初始库存
     int insertSelective(MaterialInitialStock record);
 
     List<MaterialInitialStock> selectByExample(MaterialInitialStockExample example);

+ 1 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialInitialStockMapperEx.java

@@ -11,6 +11,7 @@ public interface MaterialInitialStockMapperEx {
 
     int batchInsert(List<MaterialInitialStock> list);
 
+    //根据商品id集合获取商品初始库存集合
     List<MaterialInitialStock> getInitialStockMapByIdList(
             @Param("materialIdList") List<Long> materialIdList);
 

+ 8 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialInputMapper.java

@@ -0,0 +1,8 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.entities.MaterialInput;
+
+public interface MaterialInputMapper extends BaseMapperX<MaterialInput> {
+
+
+}

+ 5 - 2
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java

@@ -20,16 +20,19 @@ public interface MaterialMapper extends BaseMapperX<Material>{
 
     int insertSelective(Material record);
 
-    //根据条件查询商品集合
+    //根据条件查询商品集合 0
     List<Material> selectByExample(MaterialExample example);
 
+    /**
+     * 根据主键id查询商品
+     */
     Material selectByPrimaryKey(Long id);
 
     int updateByExampleSelective(@Param("record") Material record, @Param("example") MaterialExample example);
 
     int updateByExample(@Param("record") Material record, @Param("example") MaterialExample example);
 
-    //商品信息 - 修改
+    //修改商品信息
     int updateByPrimaryKeySelective(Material record);
 
     int updateByPrimaryKey(Material record);

+ 2 - 2
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java

@@ -23,7 +23,7 @@ import java.util.Map;
  */
 public interface MaterialMapperEx {
 
-    //商品信息 - 列表
+    //按条件查询商品信息列表
     List<MaterialVo4Unit> selectByConditionMaterial(
             @Param("materialParam") String materialParam,
             @Param("standard") String standard,
@@ -40,7 +40,7 @@ public interface MaterialMapperEx {
             @Param("mpList") String mpList,
             @Param("reminder") String reminder);
 
-    //商品信息 - 新增
+    //添加商品信息
     Long insertSelectiveEx(Material record);
 
     List<Unit> findUnitList(@Param("mId") Long mId);

+ 6 - 1
src/main/java/com/jsh/erp/datasource/mappers/MsgMapper.java

@@ -3,9 +3,11 @@ package com.jsh.erp.datasource.mappers;
 import com.jsh.erp.datasource.entities.Msg;
 import com.jsh.erp.datasource.entities.MsgExample;
 import java.util.List;
+
+import com.jsh.erp.datasource.pda.vo.PDAMsgVO;
 import org.apache.ibatis.annotations.Param;
 
-public interface MsgMapper {
+public interface MsgMapper extends BaseMapperX<Msg> {
     long countByExample(MsgExample example);
 
     int deleteByExample(MsgExample example);
@@ -27,4 +29,7 @@ public interface MsgMapper {
     int updateByPrimaryKeySelective(Msg record);
 
     int updateByPrimaryKey(Msg record);
+
+    //获取pda用户所有消息
+    List<PDAMsgVO> pdaMsgList(Long uid);
 }

+ 10 - 1
src/main/java/com/jsh/erp/datasource/mappers/OrgaUserRelMapperEx.java

@@ -1,6 +1,9 @@
 package com.jsh.erp.datasource.mappers;
 
-import com.jsh.erp.datasource.entities.OrgaUserRel; /**
+import com.jsh.erp.datasource.entities.OrgaUserRel;
+import com.jsh.erp.datasource.entities.Organization;
+
+/**
  * Description
  *
  * @Author: cjl
@@ -11,4 +14,10 @@ public interface OrgaUserRelMapperEx {
     int addOrgaUserRel(OrgaUserRel orgaUserRel);
 
     int updateOrgaUserRel(OrgaUserRel orgaUserRel);
+
+    /**
+     * 根据用户id获取用户机构信息
+     * @param uid 用户id
+     */
+    Organization getOrganizationByUid(Long uid);
 }

+ 1 - 0
src/main/java/com/jsh/erp/datasource/mappers/UnitMapper.java

@@ -16,6 +16,7 @@ public interface UnitMapper extends BaseMapperX<Unit> {
 
     int insertSelective(Unit record);
 
+    //根据条件查询单位列表
     List<Unit> selectByExample(UnitExample example);
 
     Unit selectByPrimaryKey(Long id);

+ 2 - 0
src/main/java/com/jsh/erp/datasource/mappers/UserMapper.java

@@ -31,4 +31,6 @@ public interface UserMapper extends BaseMapperX<User> {
     int updateByPrimaryKey(User record);
 
     List<SpinnerVO> creatorSpinnerList();
+
+    Long getAuditUserIds(@Param(value = "orgaId") Long orgaId);
 }

+ 4 - 0
src/main/java/com/jsh/erp/datasource/pda/dto/PDADepotHeadDTO.java

@@ -43,6 +43,10 @@ public class PDADepotHeadDTO {
     @ApiModelProperty("仓库id")
     private Long depotId;
 
+    @ApiModelProperty("用户id")
+    private Long uid;
 
+    @ApiModelProperty("驳回原因")
+    private String reject;
 
 }

+ 15 - 0
src/main/java/com/jsh/erp/datasource/pda/dto/PDAGoodsInputDTO.java

@@ -0,0 +1,15 @@
+package com.jsh.erp.datasource.pda.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class PDAGoodsInputDTO {
+
+    @ApiModelProperty("关键字")
+    private String keyword;
+
+    @ApiModelProperty("仓库id")
+    private Long depotId;
+
+}

+ 9 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotHeadVO.java

@@ -42,4 +42,13 @@ public class PDADepotHeadVO {
     @ApiModelProperty("配送地址")
     private String receiverAddress;
 
+    @ApiModelProperty("订单类型")
+    private String type;
+
+    @ApiModelProperty("操作人id")
+    private Long operId;
+
+    @ApiModelProperty("操作人名字")
+    private String operName;
+
 }

+ 3 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotItemVO.java

@@ -78,5 +78,8 @@ public class PDADepotItemVO{
     @ApiModelProperty("仓库id")
     private Long depotId;
 
+    @ApiModelProperty("商品sku")
+    private String sku;
+
 
 }

+ 45 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDAMaterialVo.java

@@ -0,0 +1,45 @@
+package com.jsh.erp.datasource.pda.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class PDAMaterialVo {
+
+    @ApiModelProperty("商品ID")
+    private Long materialId;
+
+    @ApiModelProperty("商品条码ID")
+    private Long materialExtendId;
+
+    @ApiModelProperty("商品名称")
+    private String materialName;
+
+    @ApiModelProperty("商品规格")
+    private String materialStandard;
+
+    @ApiModelProperty("sku")
+    private String sku;
+
+    @ApiModelProperty("生产日期")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date productionDate;
+
+    @ApiModelProperty("库存单位")
+    private String commodityUnit;
+
+    @ApiModelProperty("商品库存")
+    private String inventory;
+
+    @ApiModelProperty("商品图片")
+    private String imgName;
+
+    @ApiModelProperty("商品库位")
+    private String position;
+
+
+
+}

+ 25 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDAMsgListVO.java

@@ -0,0 +1,25 @@
+package com.jsh.erp.datasource.pda.vo;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class PDAMsgListVO {
+
+    //日期
+    private String date;
+    //消息列表
+    List<PDAMsgVO> msgList;
+
+    public PDAMsgListVO() {
+
+    }
+
+    public PDAMsgListVO(String date, List<PDAMsgVO> msgList) {
+        this.date = date;
+        this.msgList = msgList;
+    }
+}

+ 28 - 0
src/main/java/com/jsh/erp/datasource/pda/vo/PDAMsgVO.java

@@ -0,0 +1,28 @@
+package com.jsh.erp.datasource.pda.vo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class PDAMsgVO {
+
+    @ApiModelProperty("主键id")
+    private Long id;
+
+    @ApiModelProperty("标题")
+    private String title;
+
+    @ApiModelProperty("时间")
+    private Date time;
+
+    @ApiModelProperty("内容")
+    private String content;
+
+    @ApiModelProperty("状态 1未读 2已读")
+    private String status;
+
+    @ApiModelProperty("类型")
+    private String type;
+}

+ 13 - 0
src/main/java/com/jsh/erp/datasource/vo/AuditNodeVo.java

@@ -0,0 +1,13 @@
+package com.jsh.erp.datasource.vo;
+
+import com.jsh.erp.datasource.entities.AuditNode;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class AuditNodeVo extends AuditNode {
+
+    @ApiModelProperty("审核人名称")
+    private String auditorName;
+
+}

+ 31 - 0
src/main/java/com/jsh/erp/datasource/vo/AuditVo.java

@@ -0,0 +1,31 @@
+package com.jsh.erp.datasource.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.jsh.erp.datasource.entities.Audit;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class AuditVo extends Audit {
+
+    @ApiModelProperty("单据号")
+    private String number;
+
+    @ApiModelProperty("节点顺序")
+    private int nodeOrder;
+
+    @ApiModelProperty("发起人名称")
+    private String initiatorName;
+
+    @ApiModelProperty("审核人名称")
+    private String auditorName;
+
+    @ApiModelProperty("审批时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date auditTime;
+
+
+
+}

+ 1 - 1
src/main/java/com/jsh/erp/datasource/vo/MaterialExcelVo.java

@@ -11,6 +11,6 @@ import lombok.Data;
 @Data
 public class MaterialExcelVo extends Material{
 
-    private MaterialExtend materialExtend;
+    
 
 }

+ 2 - 2
src/main/java/com/jsh/erp/datasource/vo/TaskStocktakingItemVO.java

@@ -25,7 +25,7 @@ public class TaskStocktakingItemVO {
     private String materialName;
 
     @ApiModelProperty("系统编码")
-    private String systemSku;
+    private String systemSpu;
 
     @ApiModelProperty("商品单位")
     private String commodityUnit;
@@ -37,7 +37,7 @@ public class TaskStocktakingItemVO {
     private String batchNumber;
 
     @ApiModelProperty("生产日期")
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
     private Date productionDate;
 
     @ApiModelProperty("供应商名称")

+ 2 - 0
src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java

@@ -41,4 +41,6 @@ public class GlobalExceptionHandler {
         log.error("Global Exception Occured => url : {}", request.getRequestURL(), e);
         return status;
     }
+
+
 }

+ 67 - 0
src/main/java/com/jsh/erp/service/AuditService.java

@@ -0,0 +1,67 @@
+package com.jsh.erp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.dto.AuditDTO;
+import com.jsh.erp.datasource.dto.AuditQueryDTO;
+import com.jsh.erp.datasource.entities.Audit;
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
+import com.jsh.erp.datasource.vo.AuditNodeVo;
+import com.jsh.erp.datasource.vo.AuditVo;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.List;
+
+public interface AuditService extends IService<Audit> {
+
+    /**
+     * 根据审核业务id和类型生成审核实例及节点实例
+     * @return
+     */
+    boolean generateAuditByItemId(String businessNumber, String type);
+
+    /**
+     * 待我审批列表
+     * @return
+     */
+    List<AuditVo> pendingApprovalList(AuditQueryDTO auditQueryDTO);
+
+    /**
+     * 待我审批列表
+     * @return
+     */
+    Long pendingApprovalCount();
+
+    /**
+     * 已处理审批列表
+     * @return
+     */
+    List<AuditVo> processedApprovalList(AuditQueryDTO auditQueryDTO);
+
+    /**
+     * 我发起的任务列表
+     * @return
+     */
+    List<AuditVo> myApprovalList(AuditQueryDTO auditQueryDTO);
+
+    /**
+     * 根据审核id获取审核历史
+     */
+    List<AuditNodeVo> getAuditHistory(Long id);
+
+    /**
+     * 设置审核状态
+     * @param auditDTO
+     * @return
+     */
+    boolean setStatus(AuditDTO auditDTO);
+
+    /**
+     * pda复核任务列表
+     */
+    List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO);
+
+
+
+
+}

+ 22 - 3
src/main/java/com/jsh/erp/service/DepotHeadService.java

@@ -2,6 +2,7 @@ package com.jsh.erp.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.dto.DepotItemDTO;
 import com.jsh.erp.datasource.entities.DepotHead;
 import com.jsh.erp.datasource.entities.DepotItem;
 import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
@@ -36,7 +37,15 @@ public interface DepotHeadService extends IService<DepotHead> {
      */
     PDADepotHeadVO pdaDetail(Long id);
 
-    DepotHead getDepotHead(long id)throws Exception;
+    /**
+     * pda复核任务列表
+     */
+    List<PDADepotHeadVO> reviewTaskList(PDADepotHeadDTO pdaDepotHeadDTO);
+
+    /**
+     * 根据id获取订单主表信息
+     */
+    DepotHead getDepotHead(long id);
 
     List<DepotHead> getDepotHead()throws Exception;
 
@@ -88,6 +97,9 @@ public interface DepotHeadService extends IService<DepotHead> {
 
     Map<Long,BigDecimal> getMaterialCountListMapByHeaderIdList(List<Long> idList)throws Exception;
 
+    /**
+     * 按条件查询出入库明细
+     */
     List<DepotHeadVo4InDetail> findInOutDetail(String beginTime, String endTime, String type, String[] creatorArray,
                                                String[] organArray, List<Long> categoryList, Boolean forceFlag, Boolean inOutManageFlag,
                                                String materialParam, List<Long> depotList, Integer oId, String number,
@@ -153,17 +165,24 @@ public interface DepotHeadService extends IService<DepotHead> {
      * @param beanJson 主表信息
      * @param rows  子表信息
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void addDepotHeadAndDetail(String beanJson, String rows,
                                HttpServletRequest request) throws Exception;
 
+    /**
+     * 更新单据主表及单据子表信息
+     * @param beanJson 主表信息
+     * @param rows 子表信息
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void updateDepotHeadAndDetail(String beanJson, String rows, HttpServletRequest request)throws Exception;
 
     Map<String, Object> getBuyAndSaleStatistics(String today, String monthFirstDay, String yesterdayBegin, String yesterdayEnd,
                                                 String yearBegin, String yearEnd, HttpServletRequest request) throws Exception;
 
-    DepotHead getDepotHead(String number)throws Exception;
+    /**
+     * 根据单据号获取单据主表信息
+     */
+    DepotHead getDepotHead(String number);
 
     List<DepotHeadVo4List> debtList(Long organId, String materialParam, String number, String beginTime, String endTime,
                                     String status, Integer offset, Integer rows);

+ 16 - 7
src/main/java/com/jsh/erp/service/DepotItemService.java

@@ -3,6 +3,7 @@ package com.jsh.erp.service;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.dto.DepotItemDTO;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
 import com.jsh.erp.datasource.pda.vo.PDAPrintVo;
@@ -47,7 +48,10 @@ public interface DepotItemService extends IService<DepotItem> {
      */
     PDAPrintVo pdaPrintMaterial(Long depotItemId);
 
-    DepotItem getDepotItem(long id)throws Exception;
+    /**
+     * 根据id获取单据子表信息
+     */
+    DepotItem getDepotItem(long id);
 
     List<DepotItem> getDepotItem()throws Exception;
 
@@ -121,7 +125,7 @@ public interface DepotItemService extends IService<DepotItem> {
      * @param actionType    操作类型
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    void saveDetials(String rows, Long headerId, String actionType, HttpServletRequest request) throws Exception;
+    void saveDetails(String rows, Long headerId, String actionType, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void saveOrderItem(DepotHeadXsddRequestVO order, List<DepotItemXsddRequestVO> itemList) throws Exception;
@@ -140,14 +144,17 @@ public interface DepotItemService extends IService<DepotItem> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void deleteDepotItemHeadId(Long headerId)throws Exception;
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    void deleteOrCancelSerialNumber(String actionType, DepotHead depotHead, Long headerId) throws Exception;
+    void deleteOrCancelSerialNumber(String actionType, DepotHead depotHead, Long headerId);
 
     void checkAssembleWithMaterialType(JSONArray rowArr, String subType);
 
+    void checkAssembleWithMaterialType(List<DepotItemDTO> depotItems, String subType);
+
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void updateMaterialExtendPrice(Long meId, String subType, String billType, JSONObject rowObj) throws Exception;
 
+    void updateMaterialExtendPrice(Long meId, String subType, String billType, DepotItem depotItem) throws Exception;
+
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     List<DepotItemStockWarningCount> findStockWarningCount(Integer offset, Integer rows, String materialParam, List<Long> depotList, List<Long> categoryList);
 
@@ -163,7 +170,7 @@ public interface DepotItemService extends IService<DepotItem> {
     Map<String, BigDecimal> getIntervalMapByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    void updateCurrentStock(DepotItem depotItem) throws Exception;
+    void updateCurrentStock(DepotItem depotItem);
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void updateCurrentUnitPrice(DepotItem depotItem) throws Exception;
@@ -173,9 +180,11 @@ public interface DepotItemService extends IService<DepotItem> {
      * @param mId 商品id
      * @param dId 仓库id
      */
-    void updateCurrentStockFun(Long mId, Long dId) throws Exception;
+    void updateCurrentStockFun(Long mId, Long dId);
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    /**
+     * 获取完成数量
+     */
     BigDecimal getFinishNumber(Long meId, Long id, Long headerId, Unit unitInfo, String materialUnit, String linkType);
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)

+ 12 - 3
src/main/java/com/jsh/erp/service/DepotService.java

@@ -20,7 +20,7 @@ public interface DepotService extends IService<Depot> {
      */
     List<SpinnerVO> depotSpinnerList();
 
-    Depot getDepot(long id)throws Exception;
+    Depot getDepot(long id);
 
     List<Depot> getDepotListByIds(String ids)throws Exception;
 
@@ -29,7 +29,11 @@ public interface DepotService extends IService<Depot> {
      */
     List<Depot> getDepot()throws Exception;
 
-    List<Depot> getAllList()throws Exception;
+    /**
+     * 获取启用状态仓库列表
+     * @return 启用状态仓库列表
+     */
+    List<Depot> getAllList();
 
     List<DepotEx> select(String name, Integer type, String remark)throws Exception;
 
@@ -61,7 +65,12 @@ public interface DepotService extends IService<Depot> {
 
     Long getIdByName(String name);
 
-    List<Long> parseDepotList(Long depotId) throws Exception;
+    /**
+     * 解析仓库列表
+     * @param depotId 仓库id
+     * @return 仓库id为空,返回当前用户有权限的仓库,不为空返回仓库id的集合
+     */
+    List<Long> parseDepotList(Long depotId);
 
     JSONArray findDepotByCurrentUser();
 

+ 4 - 7
src/main/java/com/jsh/erp/service/MaterialBatchService.java

@@ -16,18 +16,16 @@ public interface MaterialBatchService extends IService<MaterialBatch> {
 
 
     /**
-     * 根据单据子表id生成商品批次数据
+     * 根据单据子表id生成商品批次数据(入库)
      * @param depotItem 单据子表id
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    void generateMaterialBatchByDepotItemId(DepotItem depotItem, Long supplierId) throws Exception;
+    void generateMaterialBatchByDepotItemId(DepotItem depotItem, Long supplierId);
 
     /**
-     * 根据单据子表id处理商品批次数据
+     * 根据单据子表id处理商品批次数据(出库)
      * @param diId 单据子表id
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    void handleMaterialBatchByDepotItemId(Long diId) throws Exception;
+    void handleMaterialBatchByDepotItemId(Long diId);
 
     /**
      * 修改商品批次库存
@@ -35,7 +33,6 @@ public interface MaterialBatchService extends IService<MaterialBatch> {
      * @param diId 单据子表id
      * @param materialBatch 商品批次信息
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void updateInventory(String type, Long diId, MaterialBatch materialBatch) throws Exception;
 
     /**

+ 15 - 10
src/main/java/com/jsh/erp/service/MaterialCategoryService.java

@@ -14,19 +14,19 @@ public interface MaterialCategoryService extends IService<MaterialCategory> {
     /**
      * 根据id查询商品类别
      */
-    MaterialCategory getMaterialCategory(long id)throws Exception;
+    MaterialCategory getMaterialCategory(long id);
 
     /**
-     * 根据id集合查询商品类别
+     * 根据id集合查询商品类别 0
      */
     List<MaterialCategory> getMaterialCategoryListByIds(String ids)throws Exception;
 
     List<MaterialCategory> getMaterialCategory()throws Exception;
 
     /**
-     * 根据类型ID查询全部子类型集合
+     * 根据商品类型ID查询全部子类型集合
      */
-    List<MaterialCategory> getAllList(Long parentId)throws Exception;
+    List<MaterialCategory> getAllList(Long parentId);
 
     List<MaterialCategory> getMCList(Long parentId)throws Exception;
 
@@ -34,14 +34,14 @@ public interface MaterialCategoryService extends IService<MaterialCategory> {
 
     /**
      * 新增商品类别
-     * @param materialCategory 商品类别数据
+     * @param materialCategory 商品类别数据 0
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int insertMaterialCategory(MaterialCategory materialCategory, HttpServletRequest request)throws Exception;
 
     /**
      * 修改商品类别
-     * @param obj 商品类别数据
+     * @param obj 商品类别数据 0
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int updateMaterialCategory(MaterialCategory obj, HttpServletRequest request) throws Exception;
@@ -56,13 +56,13 @@ public interface MaterialCategoryService extends IService<MaterialCategory> {
     int batchDeleteMaterialCategoryByIds(String ids) throws Exception;
 
     /**
-     * 检查类别名称是否存在
+     * 检查类别名称是否存在 0
      */
     int checkIsNameExist(Long id, String name)throws Exception;
 
 
     /**
-     * 根据类别id来查询类别信息
+     * 根据类别id来查询类别信息 0
      * @param id 类别id
      */
     List<MaterialCategory> findById(Long id)throws Exception;
@@ -70,12 +70,17 @@ public interface MaterialCategoryService extends IService<MaterialCategory> {
     /**
      * 获取商品类别树数据
      */
-    List<TreeNode> getMaterialCategoryTree(Long id) throws Exception;
+    /**
+     * 获取除当前类型的商品树类型数据
+     * @param id 当前商品类型id  id为空查询所有类型
+     * @return 商品类别树数据
+     */
+    List<TreeNode> getMaterialCategoryTree(Long id);
 
     void  checkMaterialCategorySerialNo(MaterialCategory mc)throws Exception;
 
     /**
-     * 根据名称获取类型
+     * 根据名称获取类型 0
      * @param name
      */
     Long getCategoryIdByName(String name);

+ 16 - 3
src/main/java/com/jsh/erp/service/MaterialExtendService.java

@@ -12,7 +12,10 @@ import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 
 public interface MaterialExtendService extends IService<MaterialExtend> {
-    MaterialExtend getMaterialExtend(long id)throws Exception;
+    /**
+     * 根据id查询商品拓展信息
+     */
+    MaterialExtend getMaterialExtend(long id);
 
     /**
      * 根据产品id查询产品价格拓展信息
@@ -55,8 +58,11 @@ public interface MaterialExtendService extends IService<MaterialExtend> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int insertMaterialExtend(MaterialExtendDTO materialExtendDTO);
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int updateMaterialExtend(MaterialExtend materialExtend) throws Exception;
+    /**
+     * 修改商品拓展
+     */
+
+    int updateMaterialExtend(MaterialExtend materialExtend);
 
     /**
      *  修改商品子信息
@@ -105,4 +111,11 @@ public interface MaterialExtendService extends IService<MaterialExtend> {
      * @param barCodeList 商品条码
      */
     List<Long> selectIdsByBarCode(List<String> barCodeList);
+
+    /**
+     * 根据UPC获取sku
+     * @param upc
+     * @return
+     */
+    String getSkuByUpc(String upc);
 }

+ 27 - 0
src/main/java/com/jsh/erp/service/MaterialInputService.java

@@ -0,0 +1,27 @@
+package com.jsh.erp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.dto.MaterialInputDto;
+import com.jsh.erp.datasource.entities.MaterialInput;
+
+public interface MaterialInputService extends IService<MaterialInput> {
+
+    /**
+     * 添加商品录入信息
+     * @param materialInput
+     */
+    boolean add(MaterialInput materialInput);
+
+    /**
+     * 根据单据号查询商品录入信息详情
+     * @param number 录入单号
+     */
+    MaterialInput getDetailByNumber(String number);
+
+    /**
+     * 编辑货物信息录入
+     * @param materialInputDto
+     */
+    boolean updateMaterialInput(MaterialInputDto materialInputDto);
+
+}

+ 57 - 33
src/main/java/com/jsh/erp/service/MaterialService.java

@@ -5,11 +5,9 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.jsh.erp.datasource.dto.MaterialDTO;
-import com.jsh.erp.datasource.dto.MaterialQueryDTO;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.pda.dto.PDAInventoryDTO;
 import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
-import com.jsh.erp.datasource.vo.MaterialAndExtendVo;
 import com.jsh.erp.datasource.vo.MaterialCurrentStock4SystemSku;
 import com.jsh.erp.datasource.pda.vo.PDATypeTree;
 import com.jsh.erp.datasource.vo.MaterialWarnListVo;
@@ -24,14 +22,18 @@ import java.util.List;
 import java.util.Map;
 
 public interface MaterialService extends IService<Material> {
-    Material getMaterial(long id)throws Exception;
 
-    List<Material> getMaterialListByIds(String ids)throws Exception;
+    /**
+     * 根据id获取商品信息
+     */
+    Material getMaterial(long id);
+
+    List<Material> getMaterialListByIds(String ids) throws Exception;
 
     List<Material> getMaterial() throws Exception;
 
     /**
-     * 查询商品管理-商品信息列表查询
+     * 按条件查询商品列表
      */
     List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand,
                                  String materialOther, String weight, String expiryNum, String enableSerialNumber,
@@ -54,36 +56,40 @@ public interface MaterialService extends IService<Material> {
      * 删除商品
      * @param id 商品id
      */
-    int deleteMaterial(Long id, HttpServletRequest request)throws Exception;
+    int deleteMaterial(Long id, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int batchDeleteMaterial(String ids, HttpServletRequest request)throws Exception;
+    int batchDeleteMaterial(String ids, HttpServletRequest request) throws Exception;
 
     /**
      * 根据id集合批量删除商品
+     *
      * @param ids
      */
     int batchDeleteMaterialByIds(String ids) throws Exception;
 
     /**
-     * 检查名称是否存在
+     * 检查名称是否存在 0
      */
-    int checkIsNameExist(Long id, String name)throws Exception;
+    int checkIsNameExist(Long id, String name) throws Exception;
 
     int checkIsExist(Long id, String name, String model, String color, String standard, String mfrs,
-                     String otherField1, String otherField2, String otherField3, String unit, Long unitId)throws Exception;
+                     String otherField1, String otherField2, String otherField3, String unit, Long unitId) throws Exception;
 
 
     /**
      * 批量设置状态-启用或者禁用
      */
-    int batchSetStatus(Boolean status, String ids)throws Exception;
+    int batchSetStatus(Boolean status, String ids) throws Exception;
 
-    Unit findUnit(Long mId)throws Exception;
+    /**
+     * 根据商品id获取商品多单位
+     */
+    Unit findUnit(Long mId);
 
-    List<MaterialVo4Unit> findById(Long id)throws Exception;
+    List<MaterialVo4Unit> findById(Long id) throws Exception;
 
-    List<MaterialVo4Unit> findByIdWithBarCode(Long meId)throws Exception;
+    List<MaterialVo4Unit> findByIdWithBarCode(Long meId) throws Exception;
 
     List<Long> getListByParentId(Long parentId);
 
@@ -93,6 +99,7 @@ public interface MaterialService extends IService<Material> {
 
     /**
      * 商品选择-查找商品信息
+     *
      * @param categoryId
      * @param q
      * @param standardOrModel
@@ -113,14 +120,15 @@ public interface MaterialService extends IService<Material> {
 
     /**
      * 商品选择-查找商品信息  按sku分类
+     *
      * @param offset
      * @param rows
      * @return
      * @throws Exception
      */
     List<MaterialVo4Unit> findBySelectWithSku(Long categoryId, String q, String standardOrModel, String color,
-                                                  String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
-                                                  Integer offset, Integer rows, Long depotId) throws Exception;
+                                              String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
+                                              Integer offset, Integer rows, Long depotId) throws Exception;
 
     int findBySelectWithBarCodeCount(Long categoryId, String q, String standardOrModel, String color,
                                      String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
@@ -129,14 +137,17 @@ public interface MaterialService extends IService<Material> {
      * 商品选择-查找商品数量  按sku分类
      */
     int findBySelectWithSkuCount(Long categoryId, String q, String standardOrModel, String color,
-                                     String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
+                                 String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
 
     void exportExcel(String categoryId, String materialParam, String color, String materialOther, String weight,
                      String expiryNum, String enabled, String enableSerialNumber, String enableBatchNumber,
-                     String remark, HttpServletResponse response)throws Exception;
+                     String remark, HttpServletResponse response) throws Exception;
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    BaseResponseInfo importExcel(MultipartFile file, HttpServletRequest request) throws Exception;
+    /**
+     * 导入
+     */
+//    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+//    BaseResponseInfo importExcel(MultipartFile file, HttpServletRequest request) throws Exception;
 
     void batchCheckExistMaterialListByParam(List<MaterialWithInitStock> mList, String name, String standard,
                                             String model, String color, String unit, String sku);
@@ -144,6 +155,8 @@ public interface MaterialService extends IService<Material> {
     void batchCheckExistBarCodeByParam(List<MaterialWithInitStock> mList,
                                        String barCode, String manyBarCode) throws Exception;
 
+    void batchCheckExistUpcByParam(List<MaterialDTO> mList, String barCode, List<MaterialUpc> currentUpcList);
+
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void insertOrUpdateMaterialExtend(JSONObject materialExObj, String type, String defaultFlag, Long mId, User user) throws Exception;
 
@@ -161,9 +174,9 @@ public interface MaterialService extends IService<Material> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     void batchDeleteCurrentStockByMaterialList(List<Long> mIdList);
 
-    List<MaterialVo4Unit> getMaterialEnableSerialNumberList(String q, Integer offset, Integer rows)throws Exception;
+    List<MaterialVo4Unit> getMaterialEnableSerialNumberList(String q, Integer offset, Integer rows) throws Exception;
 
-    Long getMaterialEnableSerialNumberCount(String q)throws Exception;
+    Long getMaterialEnableSerialNumberCount(String q) throws Exception;
 
     BigDecimal parseBigDecimalEx(String str) throws Exception;
 
@@ -175,14 +188,15 @@ public interface MaterialService extends IService<Material> {
 
     BigDecimal getCurrentStockByMaterialIdAndDepotId(Long materialId, Long depotId);
 
-    Map<Long,BigDecimal> getInitialStockMapByMaterialList(List<MaterialVo4Unit> list);
+    Map<Long, BigDecimal> getInitialStockMapByMaterialList(List<MaterialVo4Unit> list);
 
-    Map<Long,BigDecimal> getCurrentStockMapByMaterialList(List<MaterialVo4Unit> list);
+    Map<Long, BigDecimal> getCurrentStockMapByMaterialList(List<MaterialVo4Unit> list);
 
     /**
-     * 根据商品和仓库获取安全库存信息
+     * 根据商品和仓库获取安全库存信息 0
+     *
      * @param materialId 商品id
-     * @param depotId 仓库id
+     * @param depotId    仓库id
      * @return
      */
     MaterialInitialStock getSafeStock(Long materialId, Long depotId);
@@ -196,7 +210,8 @@ public interface MaterialService extends IService<Material> {
     List<MaterialVo4Unit> getMaterialByBarCode(String barCode);
 
     /**
-     * 根据sku查询商品信息
+     * 根据sku查询商品信息 0
+     *
      * @param sku 商品sku
      */
     List<MaterialVo4Unit> getMaterialBySku(String sku);
@@ -218,7 +233,7 @@ public interface MaterialService extends IService<Material> {
     String getBigUnitStock(BigDecimal stock, Long unitId) throws Exception;
 
     /**
-     * 构造扩展信息
+     * 构造扩展信息 0
      */
     String getMaterialOtherByParam(String[] mpArr, MaterialVo4Unit m);
 
@@ -229,7 +244,8 @@ public interface MaterialService extends IService<Material> {
     int batchSetMaterialCurrentUnitPrice(String ids) throws Exception;
 
     /**
-     * 批量编辑
+     * 批量编辑 0
+     *
      * @param jsonObject
      */
     int batchUpdate(JSONObject jsonObject);
@@ -237,7 +253,7 @@ public interface MaterialService extends IService<Material> {
     MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);
 
     /**
-     * 根据商品id查询主表及子表信息
+     * 根据商品id查询主表及子表信息 0
      */
     Material getMaterialById(Long id);
 
@@ -246,13 +262,15 @@ public interface MaterialService extends IService<Material> {
     List<MaterialCurrentStock4SystemSku> getMaterialCurrentPriceByIdList(List<Long> idList);
 
     /**
-     * 获取商品提醒
+     * 获取商品提醒 0
+     *
      * @return
      */
     MaterialWarnListVo getMaterialWarn();
 
     /**
      * 导入商品信息
+     *
      * @param file excel表格
      * @return
      */
@@ -261,12 +279,14 @@ public interface MaterialService extends IService<Material> {
     /**
      * PDA库存查询
      * pdaInventoryDTO
+     *
      * @return
      */
     List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO);
 
     /**
      * 根据库位查询商品id集合
+     *
      * @param position
      * @return
      */
@@ -274,18 +294,20 @@ public interface MaterialService extends IService<Material> {
 
     /**
      * 根据类型id查询子类型集合
+     *
      * @param id 类型id
      * @return
      */
     List<Long> selectCategoryIds(Long id);
 
     /**
-     * 查询库位树
+     * 查询库位树 0
      */
     List<PDATypeTree> selectPosition(Long depotId);
 
     /**
      * 获取仓库id、商品id获取商品库位信息
+     *
      * @param did 仓库id
      * @param mid 商品id
      * @return 库位
@@ -294,6 +316,7 @@ public interface MaterialService extends IService<Material> {
 
     /**
      * 根据商品id查询商品库存
+     *
      * @param mid 商品id
      * @return 商品库存
      */
@@ -301,9 +324,10 @@ public interface MaterialService extends IService<Material> {
 
     /**
      * 根据商品id和仓库id查询商品当前库存
+     *
      * @param mid 商品id
      * @param did 仓库id
      * @return 商品库存
      */
-    BigDecimal getMaterialStockByMidAndDid(Long mid,Long did);
+    BigDecimal getMaterialStockByMidAndDid(Long mid, Long did);
 }

+ 22 - 286
src/main/java/com/jsh/erp/service/MsgService.java

@@ -1,318 +1,54 @@
 package com.jsh.erp.service;
 
 import com.alibaba.fastjson.JSONObject;
-import com.jsh.erp.constants.BusinessConstants;
-import com.jsh.erp.constants.ExceptionConstants;
+import com.baomidou.mybatisplus.extension.service.IService;
 import com.jsh.erp.datasource.entities.Msg;
 import com.jsh.erp.datasource.entities.MsgEx;
-import com.jsh.erp.datasource.entities.MsgExample;
-import com.jsh.erp.datasource.entities.User;
-import com.jsh.erp.datasource.mappers.MsgMapper;
-import com.jsh.erp.datasource.mappers.MsgMapperEx;
-import com.jsh.erp.exception.BusinessRunTimeException;
-import com.jsh.erp.utils.PageUtils;
-import com.jsh.erp.utils.StringUtil;
-import com.jsh.erp.utils.Tools;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
+import com.jsh.erp.datasource.pda.vo.PDAMsgListVO;
 import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
 
-import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 
-import static com.jsh.erp.utils.Tools.getCenternTime;
+public interface MsgService extends IService<Msg> {
 
-@Service
-public class MsgService {
-    private Logger logger = LoggerFactory.getLogger(MsgService.class);
-    @Resource
-    private MsgMapper msgMapper;
+    Msg getMsg(long id)throws Exception;
 
-    @Resource
-    private MsgMapperEx msgMapperEx;
+    List<Msg> getMsg()throws Exception;
 
-    @Resource
-    private DepotHeadService depotHeadService;
-
-    @Resource
-    private UserService userService;
-
-    @Resource
-    private LogService logService;
-
-    public Msg getMsg(long id)throws Exception {
-        Msg result=null;
-        try{
-            result=msgMapper.selectByPrimaryKey(id);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return result;
-    }
-
-    public List<Msg> getMsg()throws Exception {
-        MsgExample example = new MsgExample();
-        example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Msg> list=null;
-        try{
-            list=msgMapper.selectByExample(example);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return list;
-    }
-
-    public List<MsgEx> select(String name)throws Exception {
-        List<MsgEx> list=null;
-        try{
-            User userInfo = userService.getCurrentUser();
-            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
-                PageUtils.startPage();
-                list = msgMapperEx.selectByConditionMsg(userInfo.getId(), name);
-                if (null != list) {
-                    for (MsgEx msgEx : list) {
-                        if (msgEx.getCreateTime() != null) {
-                            msgEx.setCreateTimeStr(getCenternTime(msgEx.getCreateTime()));
-                        }
-                    }
-                }
-            }
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return list;
-    }
+    List<MsgEx> select(String name)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertMsg(JSONObject obj, HttpServletRequest request)throws Exception {
-        Msg msg = JSONObject.parseObject(obj.toJSONString(), Msg.class);
-        int result=0;
-        try{
-            User userInfo = userService.getCurrentUser();
-            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
-                msg.setCreateTime(new Date());
-                msg.setStatus("1");
-                result=msgMapper.insertSelective(msg);
-                logService.insertLog("消息",
-                        new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(msg.getMsgTitle()).toString(), request);
-            }
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-        return result;
-    }
+    int insertMsg(JSONObject obj, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateMsg(JSONObject obj, HttpServletRequest request) throws Exception{
-        Msg msg = JSONObject.parseObject(obj.toJSONString(), Msg.class);
-        int result=0;
-        try{
-            result=msgMapper.updateByPrimaryKeySelective(msg);
-            logService.insertLog("消息",
-                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(msg.getMsgTitle()).toString(), request);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-        return result;
-    }
+    int updateMsg(JSONObject obj, HttpServletRequest request) throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int deleteMsg(Long id, HttpServletRequest request)throws Exception {
-        int result=0;
-        try{
-            result=msgMapper.deleteByPrimaryKey(id);
-            logService.insertLog("消息",
-                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-        return result;
-    }
+    int deleteMsg(Long id, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteMsg(String ids, HttpServletRequest request) throws Exception{
-        List<Long> idList = StringUtil.strToLongList(ids);
-        MsgExample example = new MsgExample();
-        example.createCriteria().andIdIn(idList);
-        int result=0;
-        try{
-            result=msgMapper.deleteByExample(example);
-            logService.insertLog("消息", "批量删除,id集:" + ids, request);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-        return result;
-    }
+    int batchDeleteMsg(String ids, HttpServletRequest request) throws Exception;
 
-    public int checkIsNameExist(Long id, String name)throws Exception {
-        MsgExample example = new MsgExample();
-        example.createCriteria().andIdNotEqualTo(id).andMsgTitleEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-        List<Msg> list=null;
-        try{
-            list= msgMapper.selectByExample(example);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return list==null?0:list.size();
-    }
+    int checkIsNameExist(Long id, String name)throws Exception;
 
-    /**
-     * create by: qiankunpingtai
-     *  逻辑删除角色信息
-     * create time: 2019/3/28 15:44
-     * @Param: ids
-     * @return int
-     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int batchDeleteMsgByIds(String ids) throws Exception{
-        logService.insertLog("序列号",
-                new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
-                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
-        String [] idArray=ids.split(",");
-        int result=0;
-        try{
-            result=msgMapperEx.batchDeleteMsgByIds(idArray);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-        return result;
-    }
+    int batchDeleteMsgByIds(String ids) throws Exception;
 
-    public List<MsgEx> getMsgByStatus(String status)throws Exception {
-        List<MsgEx> resList=new ArrayList<>();
-        try{
-            User userInfo = userService.getCurrentUser();
-            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
-                MsgExample example = new MsgExample();
-                example.createCriteria().andStatusEqualTo(status).andUserIdEqualTo(userInfo.getId())
-                        .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-                example.setOrderByClause("id desc");
-                List<Msg> list = msgMapper.selectByExample(example);
-                if (null != list) {
-                    for (Msg msg : list) {
-                        if (msg.getCreateTime() != null) {
-                            MsgEx msgEx = new MsgEx();
-                            msgEx.setId(msg.getId());
-                            msgEx.setMsgTitle(msg.getMsgTitle());
-                            msgEx.setMsgContent(msg.getMsgContent());
-                            msgEx.setStatus(msg.getStatus());
-                            msgEx.setType(msg.getType());
-                            msgEx.setCreateTimeStr(Tools.getCenternTime(msg.getCreateTime()));
-                            resList.add(msgEx);
-                        }
-                    }
-                }
-            }
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return resList;
-    }
+    List<MsgEx> getMsgByStatus(String status)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void batchUpdateStatus(String ids, String status) throws Exception{
-        List<Long> idList = StringUtil.strToLongList(ids);
-        Msg msg = new Msg();
-        msg.setStatus(status);
-        MsgExample example = new MsgExample();
-        example.createCriteria().andIdIn(idList);
-        try{
-            msgMapper.updateByExampleSelective(msg, example);
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-    }
+    void batchUpdateStatus(String ids, Integer status) throws Exception;
 
-    public Long getMsgCountByStatus(String status)throws Exception {
-        Long result=null;
-        try{
-            User userInfo=userService.getCurrentUser();
-            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
-                result = msgMapperEx.getMsgCountByStatus(status, userInfo.getId());
-            }
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return result;
-    }
+    Long getMsgCountByStatus(String status)throws Exception;
 
-    public Integer getMsgCountByType(String type)throws Exception {
-        int msgCount = 0;
-        try{
-            User userInfo = userService.getCurrentUser();
-            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
-                MsgExample example = new MsgExample();
-                example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
-                List<Msg> list = msgMapper.selectByExample(example);
-                msgCount = list.size();
-            }
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
-                    ExceptionConstants.DATA_READ_FAIL_MSG);
-        }
-        return msgCount;
-    }
+    Integer getMsgCountByType(String type)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void readAllMsg() throws Exception{
-        try{
-            User userInfo = userService.getCurrentUser();
-            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
-                Msg msg = new Msg();
-                msg.setStatus("2");
-                MsgExample example = new MsgExample();
-                example.createCriteria();
-                msgMapper.updateByExampleSelective(msg, example);
-            }
-        }catch(Exception e){
-            logger.error("异常码[{}],异常提示[{}],异常[{}]",
-                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
-            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
-                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
-        }
-    }
+    void readAllMsg() throws Exception;
+
+    /**
+     * PDA获取用户消息列表
+     */
+    List<PDAMsgListVO> pdaMsgList();
 }

+ 11 - 1
src/main/java/com/jsh/erp/service/OrgaUserRelService.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.jsh.erp.constants.BusinessConstants;
 import com.jsh.erp.datasource.entities.OrgaUserRel;
 import com.jsh.erp.datasource.entities.OrgaUserRelExample;
+import com.jsh.erp.datasource.entities.Organization;
 import com.jsh.erp.datasource.entities.User;
 import com.jsh.erp.datasource.mappers.OrgaUserRelMapper;
 import com.jsh.erp.datasource.mappers.OrgaUserRelMapperEx;
@@ -41,7 +42,7 @@ public class OrgaUserRelService {
     @Resource
     private LogService logService;
 
-    public OrgaUserRel getOrgaUserRel(long id) throws Exception{
+    public OrgaUserRel getOrgaUserRel(long id) {
         return orgaUserRelMapper.selectByPrimaryKey(id);
     }
 
@@ -213,4 +214,13 @@ public class OrgaUserRelService {
         }
         return  userIdList;
     }
+
+    /**
+     * 根据用户id获取用户机构信息
+     * @param uid 用户id
+     * @return
+     */
+    public Organization getOrganizationByUid(Long uid){
+        return orgaUserRelMapperEx.getOrganizationByUid(uid);
+    }
 }

+ 1 - 1
src/main/java/com/jsh/erp/service/OrganizationService.java

@@ -41,7 +41,7 @@ public class OrganizationService {
     @Resource
     private LogService logService;
 
-    public Organization getOrganization(long id) throws Exception {
+    public Organization getOrganization(long id) {
         return organizationMapper.selectByPrimaryKey(id);
     }
 

+ 1 - 1
src/main/java/com/jsh/erp/service/SequenceService.java

@@ -8,7 +8,7 @@ public interface SequenceService {
      * 获取单据编号
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    String buildOnlyNumber()throws Exception;
+    String buildOnlyNumber();
 
     /**
      * 构建供应商编号

+ 5 - 2
src/main/java/com/jsh/erp/service/SerialNumberService.java

@@ -161,7 +161,7 @@ public class SerialNumberService {
      * @Param: Count 卖出或者赎回的数量
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int cancelSerialNumber(Long materialId, String outBillNo,int count,User user) throws Exception{
+    public int cancelSerialNumber(Long materialId, String outBillNo,int count,User user) {
         int result=0;
         try{
             result = serialNumberMapperEx.cancelSerialNumber(materialId,outBillNo,count,new Date(),user==null?null:user.getId());
@@ -238,7 +238,10 @@ public class SerialNumberService {
         return count;
     }
 
-    public void addSerialNumberByBill(String type, String subType, String inBillNo, Long materialId, Long depotId, BigDecimal inPrice, String snList) throws Exception {
+    /**
+     * 新增序列号
+     */
+    public void addSerialNumberByBill(String type, String subType, String inBillNo, Long materialId, Long depotId, BigDecimal inPrice, String snList) {
         //录入序列号的时候不能和库里面的重复-入库
         if ((BusinessConstants.SUB_TYPE_PURCHASE.equals(subType) ||
                 BusinessConstants.SUB_TYPE_OTHER.equals(subType) ||

+ 5 - 1
src/main/java/com/jsh/erp/service/SupplierService.java

@@ -14,7 +14,11 @@ import java.util.List;
 import java.util.Map;
 
 public interface SupplierService extends IService<Supplier> {
-    Supplier getSupplier(long id)throws Exception;
+
+    /**
+     * 根据ID获取供应商信息
+     */
+    Supplier getSupplier(long id);
 
     List<Supplier> getSupplierListByIds(String ids)throws Exception;
 

+ 6 - 6
src/main/java/com/jsh/erp/service/SystemConfigService.java

@@ -512,7 +512,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getMinusStockFlag() throws Exception {
+    public boolean getMinusStockFlag() {
         boolean minusStockFlag = false;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {
@@ -529,7 +529,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getUpdateUnitPriceFlag() throws Exception {
+    public boolean getUpdateUnitPriceFlag() {
         boolean updateUnitPriceFlag = true;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {
@@ -546,7 +546,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getOverLinkBillFlag() throws Exception {
+    public boolean getOverLinkBillFlag()  {
         boolean overLinkBillFlag = false;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {
@@ -563,7 +563,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getForceApprovalFlag() throws Exception {
+    public boolean getForceApprovalFlag() {
         boolean forceApprovalFlag = false;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {
@@ -597,7 +597,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getInOutManageFlag() throws Exception {
+    public boolean getInOutManageFlag()  {
         boolean inOutManageFlag = false;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {
@@ -614,7 +614,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getMoveAvgPriceFlag() throws Exception {
+    public boolean getMoveAvgPriceFlag() {
         boolean moveAvgPriceFlag = false;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {

+ 6 - 0
src/main/java/com/jsh/erp/service/TaskStocktakingService.java

@@ -36,6 +36,12 @@ public interface TaskStocktakingService extends IService<TaskStocktaking> {
     TaskStocktakingVO detail(Long id) throws Exception;
 
     /**
+     * 任务-详情
+     * @param number 任务编号
+     */
+    TaskStocktakingVO detail(String number);
+
+    /**
      * 任务详情-修改
      * @param taskStocktakingDTO
      * @return

+ 1 - 1
src/main/java/com/jsh/erp/service/UnitService.java

@@ -17,7 +17,7 @@ public interface UnitService extends IService<Unit> {
     /**
      * 所有单位集合
      */
-    List<Unit> unitList()throws Exception;
+    List<Unit> unitList();
 
     List<Unit> select(String name)throws Exception;
 

+ 8 - 0
src/main/java/com/jsh/erp/service/UserService.java

@@ -102,4 +102,12 @@ public interface UserService extends IService<User> {
     User getUserByWeixinCode(String weixinCode) throws Exception;
 
     int weixinBind(String loginName, String password, String weixinCode) throws Exception;
+
+    /**
+     * 根据用户id回去审批用户id
+     * @param uid 用户id
+     * @param isParent 是否查询父级 true查询,false不查询
+     * @return
+     */
+    Long getAuditUserIds(Long uid, boolean isParent);
 }

+ 12 - 2
src/main/java/com/jsh/erp/service/impl/AuditProcessServiceImpl.java

@@ -3,19 +3,20 @@ package com.jsh.erp.service.impl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jsh.erp.datasource.dto.AuditProcessDTO;
 import com.jsh.erp.datasource.dto.AuditProcessQueryDTO;
-import com.jsh.erp.datasource.entities.AuditNodeConfig;
 import com.jsh.erp.datasource.entities.AuditProcess;
+import com.jsh.erp.datasource.entities.User;
 import com.jsh.erp.datasource.mappers.AuditNodeConfigMapper;
 import com.jsh.erp.datasource.mappers.AuditProcessMapper;
 import com.jsh.erp.datasource.vo.AuditProcessVo;
-import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.service.AuditProcessService;
+import com.jsh.erp.service.UserService;
 import com.jsh.erp.utils.PageUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 @Service
@@ -26,6 +27,10 @@ public class AuditProcessServiceImpl extends ServiceImpl<AuditProcessMapper,Audi
     private AuditProcessMapper auditProcessMapper;
     @Resource
     private AuditNodeConfigMapper auditNodeConfigMapper;
+
+    @Resource
+    private UserService userService;
+
     /**
      * 查询审核流程列表
      * @param auditProcessQueryDTO 筛选条件
@@ -48,9 +53,14 @@ public class AuditProcessServiceImpl extends ServiceImpl<AuditProcessMapper,Audi
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public boolean add(AuditProcessDTO auditProcessDTO) {
         try {
+            User user = userService.getCurrentUser();
+            auditProcessDTO.setCreateBy(user.getId());
+            auditProcessDTO.setCreateTime(new Date());
             this.save(auditProcessDTO);
             auditProcessDTO.getAuditNodes().forEach(v -> {
                 v.setProcessId(auditProcessDTO.getId());
+                v.setCreateBy(user.getId());
+                v.setCreateTime(new Date());
             });
             auditNodeConfigMapper.insertBatch(auditProcessDTO.getAuditNodes());
         }catch (Exception e){

+ 383 - 0
src/main/java/com/jsh/erp/service/impl/AuditServiceImpl.java

@@ -0,0 +1,383 @@
+package com.jsh.erp.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.constants.BusinessConstants;
+import com.jsh.erp.constants.ExceptionConstants;
+import com.jsh.erp.datasource.dto.AuditDTO;
+import com.jsh.erp.datasource.dto.AuditQueryDTO;
+import com.jsh.erp.datasource.dto.MaterialDTO;
+import com.jsh.erp.datasource.dto.MaterialExtendDTO;
+import com.jsh.erp.datasource.entities.*;
+import com.jsh.erp.datasource.mappers.AuditMapper;
+import com.jsh.erp.datasource.mappers.AuditNodeConfigMapper;
+import com.jsh.erp.datasource.mappers.AuditNodeMapper;
+import com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO;
+import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
+import com.jsh.erp.datasource.vo.AuditNodeVo;
+import com.jsh.erp.datasource.vo.AuditVo;
+import com.jsh.erp.exception.BusinessRunTimeException;
+import com.jsh.erp.query.LambdaQueryWrapperX;
+import com.jsh.erp.query.QueryWrapperX;
+import com.jsh.erp.service.*;
+import com.jsh.erp.utils.PageUtils;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements AuditService {
+
+    private final AuditMapper auditMapper;
+
+    private final AuditNodeConfigMapper auditNodeConfigMapper;
+
+    private final AuditNodeMapper auditNodeMapper;
+
+    private final AuditProcessService auditProcessService;
+
+    private final DepotHeadService depotHeadService;
+
+    private final DepotItemService depotItemService;
+
+    private final UserService userService;
+
+    private final MaterialBatchService materialBatchService;
+    @Resource
+    private TaskStocktakingService taskStocktakingService;
+    @Resource
+    private MaterialInputService materialInputService;
+    @Resource
+    private MaterialService materialService;
+
+
+    /**
+     * 根据审核业务单号和类型生成审核实例及节点实例
+     * @param businessNumber 业务单号
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public boolean generateAuditByItemId(String businessNumber, String type) {
+        try {
+            //获取失败审核
+            Audit a = getOne(new LambdaQueryWrapperX<Audit>()
+                    .eq(Audit::getBusinessNumber,businessNumber)
+                    .eq(Audit::getAuditStatus,2)
+                    .eq(Audit::getDeleteFlag,false));
+            if (a != null){
+                //删除审核
+                update(new UpdateWrapper<Audit>().set("delete_flag",true).eq("id",a.getId()));
+            }
+            //业务id
+            Long bid = null;
+            if (type.equals("盘点任务")){
+                bid = taskStocktakingService.getOne(new LambdaQueryWrapperX<TaskStocktaking>().eq(TaskStocktaking::getNumber,businessNumber)).getId();
+            }else if (type.equals("pda维护商品")){
+                bid = materialInputService.getOne(new LambdaQueryWrapperX<MaterialInput>().eq(MaterialInput::getNumber,businessNumber)).getId();
+            }else {
+                bid = depotHeadService.getDepotHead(businessNumber).getId();
+            }
+
+            AuditProcess auditProcess = auditProcessService.getOne(new LambdaQueryWrapperX<AuditProcess>()
+                    .eq(AuditProcess::getType, type)
+                    .eq(AuditProcess::getDeleteFlag, false));
+            //判断是否有审核流程
+            if (auditProcess != null) {
+                //有审核流程,根据流程创建审核实力及第一个节点实例
+                Audit audit = new Audit();
+                audit.setProcessId(auditProcess.getId());
+                audit.setBusinessId(bid);
+                audit.setBusinessNumber(businessNumber);
+                audit.setType(auditProcess.getType());
+                audit.setAuditStatus(0);
+                User user = userService.getCurrentUser();
+                audit.setSubmitUser(user.getId());
+                audit.setSubmitTime(new Date());
+                //添加节点实例
+                auditMapper.insert(audit);
+                AuditNodeConfig auditNodeConfig = auditNodeConfigMapper.selectOne(new LambdaQueryWrapperX<AuditNodeConfig>()
+                        .eq(AuditNodeConfig::getProcessId, auditProcess.getId())
+                        .eq(AuditNodeConfig::getNodeOrder, 1));
+                AuditNode auditNode = buildAuditNode(audit.getId(), auditNodeConfig, user);
+                auditNodeMapper.insert(auditNode);
+            } else {
+                //无审核流程,算审核通过
+                if (type.equals("盘点任务")){
+                    taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status",1).eq("id",bid));
+                }else if (type.equals("pda维护商品")){
+                    materialInputService.update(new UpdateWrapper<MaterialInput>().set("status",1).eq("id",bid));
+                }else {
+                    //处理单据数据
+                    depotHeadApproved(bid);
+                }
+            }
+        } catch (Exception e) {
+            log.error("创建审核流程失败", e);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 待我审批列表
+     */
+    @Override
+    public List<AuditVo> pendingApprovalList(AuditQueryDTO auditQueryDTO) {
+        User user = userService.getCurrentUser();
+        auditQueryDTO.setUid(user.getId());
+        PageUtils.startPage();
+        List<AuditVo> list = auditMapper.pendingApprovalList(auditQueryDTO);
+        list.forEach(v -> {
+            v.setAuditorName(user.getUsername());
+        });
+        return list;
+    }
+
+    /**
+     * 待我审批数量
+     *
+     * @return
+     */
+    @Override
+    public Long pendingApprovalCount() {
+        User user = userService.getCurrentUser();
+        Long count =auditNodeMapper.selectCount(AuditNode::getAuditorUser,user.getId(),AuditNode::getAuditResult,0);
+        return count;
+    }
+
+    /**
+     * 已处理审批列表
+     */
+    @Override
+    public List<AuditVo> processedApprovalList(AuditQueryDTO auditQueryDTO) {
+        User user = userService.getCurrentUser();
+        auditQueryDTO.setUid(user.getId());
+        PageUtils.startPage();
+        List<AuditVo> list = auditMapper.processedApprovalList(auditQueryDTO);
+        list.forEach(v -> {
+            v.setAuditorName(user.getUsername());
+        });
+        return list;
+    }
+
+    /**
+     * 我发起的任务列表
+     */
+    @Override
+    public List<AuditVo> myApprovalList(AuditQueryDTO auditQueryDTO) {
+        User user = userService.getCurrentUser();
+        auditQueryDTO.setUid(user.getId());
+        PageUtils.startPage();
+        List<AuditVo> list = auditMapper.myApprovalList(auditQueryDTO);
+        list.forEach(v -> {
+            v.setInitiatorName(user.getUsername());
+        });
+        return list;
+    }
+
+    /**
+     * 根据审核id获取审核历史
+     */
+    @Override
+    public List<AuditNodeVo> getAuditHistory(Long id) {
+        return auditNodeMapper.getAuditHistoryByAuditId(id);
+    }
+
+    /**
+     * 设置审核状态
+     * @param auditDTO
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public boolean setStatus(AuditDTO auditDTO) {
+
+        User user = userService.getCurrentUser();
+        //获取当前审核节点
+        AuditNode auditNode = auditNodeMapper.selectOne(new LambdaQueryWrapperX<AuditNode>()
+                .eq(AuditNode::getAuditId, auditDTO.getId())
+                .eq(AuditNode::getAuditResult, 0)
+                .eq(AuditNode::getDeleteFlag, false));
+        //修改当前节点状态
+        auditNode.setAuditorUser(user.getId());
+        auditNode.setAuditResult(auditDTO.getStatus());
+        auditNode.setAuditTime(new Date());
+        auditNode.setAuditComment(auditDTO.getAuditComment());
+        auditNodeMapper.updateById(auditNode);
+        if (auditDTO.getStatus() == 1) {  //审批通过
+            //获取下一个节点配置,判定是否有下一节点审核
+            AuditNodeConfig auditNodeConfig = auditNodeConfigMapper.getAuditNodeConfigByAuditIdAndOrder(auditDTO.getId(), auditNode.getNodeOrder());
+            if (auditNodeConfig != null && auditNodeConfig.getAuditorType() != null) {
+                //有,根据节点配置生成下一节点
+                AuditNode newAuditNode = buildAuditNode(auditDTO.getId(), auditNodeConfig, user);
+                auditNodeMapper.insert(newAuditNode);
+            } else {
+                //无下一节点,审核阶段结束,修改对应审核内容状态
+                //修改审核状态
+                this.update(new UpdateWrapper<Audit>().set("audit_status", 1).eq("id", auditDTO.getId()));
+                //生成批次信息
+                Audit audit = auditMapper.selectById(auditDTO.getId());
+                Long dhId = audit.getBusinessId();
+                if (audit.getType().equals("盘点任务")){
+                    taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status",1).eq("id",dhId));
+                }else if (audit.getType().equals("pda维护商品")){
+                    materialInputService.update(new UpdateWrapper<MaterialInput>().set("status",1).eq("id",dhId));
+                    materialInputApproved(dhId);
+                }else {
+                    depotHeadApproved(dhId);
+                }
+            }
+        } else {  //审批未通过
+            //修改审核状态
+            this.update(new UpdateWrapper<Audit>().set("audit_status", 2).eq("id", auditDTO.getId()));
+            //修改单据状态
+            Audit audit = auditMapper.selectById(auditDTO.getId());
+            Long dhId = audit.getBusinessId();
+            if (audit.getType().equals("盘点任务")){
+                taskStocktakingService.update(new UpdateWrapper<TaskStocktaking>().set("task_status",8).eq("id",dhId));
+            }else if (audit.getType().equals("pda维护商品")){
+                materialInputService.update(new UpdateWrapper<MaterialInput>().set("status",8).eq("id",dhId));
+            }else {
+                depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", 8).eq("id", dhId));
+            }
+        }
+        return true;
+    }
+
+    /**
+     * pda复核任务列表
+     * @param pdaDepotHeadDTO
+     */
+    @Override
+    public List<PDADepotHeadVO> pdaList(PDADepotHeadDTO pdaDepotHeadDTO) {
+        List<PDADepotHeadVO> list = auditMapper.pdaList(pdaDepotHeadDTO);
+        return list;
+    }
+
+
+    /**
+     * 根据节点配置构建审核节点实例
+     * @param aid             审核id
+     * @param auditNodeConfig 审核节点配置
+     * @param user            当前用户
+     */
+    private AuditNode buildAuditNode(Long aid, AuditNodeConfig auditNodeConfig, User user) {
+        AuditNode auditNode = new AuditNode();
+        auditNode.setAuditId(aid);
+        auditNode.setNodeId(auditNodeConfig.getId());
+        auditNode.setNodeOrder(auditNodeConfig.getNodeOrder());
+        if (auditNodeConfig.getAuditor() == null) {
+            if (auditNodeConfig.getAuditorType().equals(2)) {
+                //上级部门最高领导审核
+                Long id = userService.getAuditUserIds(user.getId(), true);
+                if (id == null) {
+                    throw new BusinessRunTimeException(ExceptionConstants.AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_CODE,
+                            ExceptionConstants.AUDIT_APPROVAL_HIGHER_DEPARTMENTS_LEADER_IS_NOT_EXIST_MSG);
+                }
+                auditNode.setAuditorUser(id);
+            } else if (auditNodeConfig.getAuditorType().equals(3)) {
+                //本部门最高领导审核
+                Long id = userService.getAuditUserIds(user.getId(), false);
+                if (id == null) {
+                    throw new BusinessRunTimeException(ExceptionConstants.AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_CODE,
+                            ExceptionConstants.AUDIT_APPROVAL_DEPARTMENT_LEADER_IS_NOT_EXIST_MSG);
+                }
+                auditNode.setAuditorUser(id);
+            }
+        } else {
+            auditNode.setAuditorUser(auditNodeConfig.getAuditor());
+        }
+        auditNode.setCreateTime(new Date());
+        return auditNode;
+    }
+
+    /**
+     * 单据审核通过 处理批次信息
+     * @param id 单据主表id
+     */
+    private void depotHeadApproved(Long id) {
+        DepotHead depotHead = depotHeadService.getDepotHead(id);
+        depotHeadService.update(new UpdateWrapper<DepotHead>().set("status", 1).eq("id", id));
+        List<DepotItem> list = depotItemService.list(new LambdaQueryWrapperX<DepotItem>().eq(DepotItem::getHeaderId, id));
+        //处理批次商品信息
+        if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())) {
+            for (DepotItem depotItem : list) {
+                //表单入库,新增批次商品信息
+                materialBatchService.generateMaterialBatchByDepotItemId(depotItem, depotHead.getOrganId());
+                //更新当前库存
+                depotItemService.updateCurrentStock(depotItem);
+            }
+        } else if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
+            for (DepotItem depotItem : list) {
+                //表单出库,修改商品库存
+                materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
+            }
+        }
+    }
+
+    /**
+     * 单据审核通过 处理商品录入信息
+     * @param id 单据主表id
+     */
+    private void materialInputApproved(Long id) {
+        MaterialInput materialInput = materialInputService.getById(id);
+        materialInputService.update(new UpdateWrapper<MaterialInput>().set("status", 1).eq("id", id));
+        //商品信息
+        MaterialDTO materialDTO = new MaterialDTO();
+        materialDTO.setName(materialInput.getName());
+        materialDTO.setImgName(materialInput.getImgName());
+        materialDTO.setCategoryId(materialInput.getCategoryId());
+        materialDTO.setDefaultPurchaseDecimal(materialInput.getDefaultPurchaseDecimal());
+        materialDTO.setDefaultWholesaleDecimal(materialInput.getDefaultWholesaleDecimal());
+        //商品拓展信息
+        MaterialExtendDTO materialExtend = new MaterialExtendDTO();
+        materialExtend.setStandard(materialInput.getStandard());
+        materialExtend.setCommodityUnit(materialInput.getCommodityUnit());
+        //商品upc
+        MaterialUpc materialUpc = new MaterialUpc();
+        materialUpc.setUpc(materialInput.getBarCode());
+        //商品单位
+        MaterialUnit materialUnit = new MaterialUnit();
+        materialUnit.setName(materialInput.getCommodityUnit());
+        materialUnit.setRatio(1);
+        List<MaterialUnit> unitList = new ArrayList<>();
+        unitList.add(materialUnit);
+        materialExtend.setUnitList(unitList);
+        List<MaterialUpc> upcList = new ArrayList<>();
+        upcList.add(materialUpc);
+        materialExtend.setUpcList(upcList);
+        List<MaterialExtendDTO> materialExtendDTOList = new ArrayList<>();
+        materialExtendDTOList.add(materialExtend);
+        materialDTO.setMeList(materialExtendDTOList);
+        //商品初始库存
+        MaterialInitialStock materialInitialStock = new MaterialInitialStock();
+        materialInitialStock.setId(materialInput.getDepotId());
+        materialInitialStock.setPosition(materialInput.getPosition());
+        List<MaterialInitialStock> initialStockList = new ArrayList<>();
+        initialStockList.add(materialInitialStock);
+        materialDTO.setStock(initialStockList);
+        materialService.insertMaterial(materialDTO,null);
+        //处理批次商品信息
+//        if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())) {
+//            for (DepotItem depotItem : list) {
+//                //表单入库,新增批次商品信息
+//                materialBatchService.generateMaterialBatchByDepotItemId(depotItem, depotHead.getOrganId());
+//                //更新当前库存
+//                depotItemService.updateCurrentStock(depotItem);
+//            }
+//        } else if (BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
+//            for (DepotItem depotItem : list) {
+//                //表单出库,修改商品库存
+//                materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
+//            }
+//        }
+    }
+
+}

+ 68 - 31
src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java

@@ -91,6 +91,8 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
     private MaterialBatchService materialBatchService;
     @Resource
     private MaterialCategoryService materialCategoryService;
+    @Resource
+    private AuditService auditService;
 
     /**
      * PDA查询订单
@@ -107,8 +109,22 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         return depotHeadMapper.pdaDetail(id);
     }
 
+    /**
+     * pda复核任务列表
+     * @param pdaDepotHeadDTO  筛选条件
+     */
     @Override
-    public DepotHead getDepotHead(long id)throws Exception {
+    public List<PDADepotHeadVO> reviewTaskList(PDADepotHeadDTO pdaDepotHeadDTO) {
+        pdaDepotHeadDTO.setUid(userService.getCurrentUser().getId());
+        PageUtils.startPage();
+        return depotHeadMapper.reviewTaskList(pdaDepotHeadDTO);
+    }
+
+    /**
+     * 根据id获取订单主表信息
+     */
+    @Override
+    public DepotHead getDepotHead(long id) {
         DepotHead result=null;
         try{
             result=depotHeadMapper.selectByPrimaryKey(id);
@@ -645,7 +661,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
      * @throws Exception
      */
     @Override
-    public int checkIsBillNumberExist(Long id, String number)throws Exception {
+    public int checkIsBillNumberExist(Long id, String number) {
         DepotHeadExample example = new DepotHeadExample();
         example.createCriteria().andIdNotEqualTo(id).andNumberEqualTo(number).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
         List<DepotHead> list = null;
@@ -752,6 +768,9 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         return materialCountListMap;
     }
 
+    /**
+     * 按条件查询出入库明细
+     */
     @Override
     public List<DepotHeadVo4InDetail> findInOutDetail(String beginTime, String endTime, String type, String[] creatorArray,
                                                       String[] organArray, List<Long> categoryList, Boolean forceFlag, Boolean inOutManageFlag,
@@ -1123,7 +1142,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         }
         String subType = depotHead.getSubType();
         //结算账户校验
-        if("采购".equals(subType) || "采购退货".equals(subType) || "销售".equals(subType) || "销售退货".equals(subType)) {
+        if("采购订单".equals(subType) || "采购".equals(subType) || "采购退货".equals(subType) || "销售订单".equals(subType) || "销售".equals(subType) || "销售退货".equals(subType)) {
             if (StringUtil.isEmpty(depotHead.getAccountIdList()) && depotHead.getAccountId() == null) {
                 throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_CODE,
                         String.format(ExceptionConstants.DEPOT_HEAD_ACCOUNT_FAILED_MSG));
@@ -1133,6 +1152,8 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         User userInfo=userService.getCurrentUser();
         //创建人
         depotHead.setCreator(userInfo==null?null:userInfo.getId());
+        //修改操作人
+        depotHead.setOperId(userInfo.getId());
         //创建时间
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
         //订单状态
@@ -1142,7 +1163,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         //采购状态
         depotHead.setPurchaseStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
         //付款类型
-        depotHead.setPayType(depotHead.getPayType()==null?"现付":depotHead.getPayType());
+        depotHead.setPayType(depotHead.getPayType() == null ? "现付" : depotHead.getPayType());
         if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
             depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
         }
@@ -1194,7 +1215,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         if(BusinessConstants.PAY_TYPE_PREPAID.equals(depotHead.getPayType())){
             if(depotHead.getOrganId()!=null) {
                 BigDecimal currentAdvanceIn = supplierService.getSupplier(depotHead.getOrganId()).getAdvanceIn();
-                if(currentAdvanceIn.compareTo(depotHead.getTotalPrice())>=0) {
+                if(currentAdvanceIn.compareTo(depotHead.getTotalPrice()) >= 0) {
                     //更新会员的预付款
                     supplierService.updateAdvanceIn(depotHead.getOrganId());
                 } else {
@@ -1207,13 +1228,15 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         DepotHeadExample dhExample = new DepotHeadExample();
         dhExample.createCriteria().andNumberEqualTo(depotHead.getNumber()).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
         List<DepotHead> list = depotHeadMapper.selectByExample(dhExample);
-        if(list!=null) {
+        if(list != null) {
             Long headId = list.get(0).getId();
             /**入库和出库处理单据子表信息*/
-            depotItemService.saveDetials(rows,headId, "add",request);
+            depotItemService.saveDetails(rows,headId, "add",request);
+            //订单申请审核
+            applyAudit(depotHead);
         }
         //修改订单总额
-        updateTotalPriceById(list.get(0));
+        //updateTotalPriceById(list.get(0));
         logService.insertLog("单据",
                 new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(depotHead.getNumber()).toString(),
                 ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -1242,7 +1265,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                     String.format(ExceptionConstants.DEPOT_ITEM_EXIST_REPEAT_NO_FAILED_MSG));
         }
         //校验单据状态,如果不是未审核则提示
-        if(!"0".equals(getDepotHead(depotHead.getId()).getStatus())) {
+        if(!"0".equals(getDepotHead(depotHead.getId()).getStatus()) && !"8".equals(getDepotHead(depotHead.getId()).getStatus())) {
             throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BILL_CANNOT_EDIT_CODE,
                     String.format(ExceptionConstants.DEPOT_HEAD_BILL_CANNOT_EDIT_MSG));
         }
@@ -1329,13 +1352,9 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             }
         }
         /**入库和出库处理单据子表信息*/
-        depotItemService.saveDetials(rows,depotHead.getId(), "update",request);
-        //修改订单总额
-//        if (depotHead.getSubType().equals("采购") || depotHead.getSubType().equals("销售")){
-//            updateTotalPriceById(depotHead);
-//        }
-
-        updateTotalPriceById(depotHead);
+        depotItemService.saveDetails(rows,depotHead.getId(), "update",request);
+        //保存并申请审核
+        applyAudit(depotHead);
         logService.insertLog("单据",
                 new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(depotHead.getNumber()).toString(),
                 ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
@@ -1437,8 +1456,11 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
     }
 
 
+    /**
+     * 根据单据号获取单据主表信息
+     */
     @Override
-    public DepotHead getDepotHead(String number)throws Exception {
+    public DepotHead getDepotHead(String number) {
         DepotHead depotHead = new DepotHead();
         try{
             DepotHeadExample example = new DepotHeadExample();
@@ -1855,7 +1877,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             if(list!=null) {
                 Long headId = list.get(0).getId();
                 /**入库和出库处理单据子表信息*/
-                depotItemService.saveDetials(rows, headId, "add", request);
+                depotItemService.saveDetails(rows, headId, "add", request);
             }
         }
         logService.insertLog("单据",
@@ -1914,6 +1936,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         DepotHead depotHead = depotHeadMapper.selectOne(new LambdaQueryWrapperX<DepotHead>().eq(DepotHead::getId, pdaDepotHeadDTO.getId()));
         //根据单据id获取单据子表信息
         List<DepotItem> depotItems = depotItemService.getListByHeaderId(depotHead.getId());
+        //将主表信息改为出入库单据主表
         //设置单据主表信息
         depotHead.setId(null);
         //设置关联订单
@@ -1963,7 +1986,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             depotHead.setStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
         }
         depotHead.setPurchaseStatus(BusinessConstants.BILLS_STATUS_UN_AUDIT);
-        depotHead.setPayType(depotHead.getPayType()==null?"现付":depotHead.getPayType());
+        depotHead.setPayType(depotHead.getPayType() == null ? "现付" : depotHead.getPayType());
         if(StringUtil.isNotEmpty(depotHead.getAccountIdList())){
             depotHead.setAccountIdList(depotHead.getAccountIdList().replace("[", "").replace("]", "").replaceAll("\"", ""));
         }
@@ -2001,7 +2024,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         depotHead.setVoucherPicture(pdaDepotHeadDTO.getVoucherPicture());
         depotHead.setRemark(pdaDepotHeadDTO.getRemark());
         depotHead.setCreateTime(new Timestamp(System.currentTimeMillis()));
-        depotHead.setStatus("2");
+        depotHead.setStatus("6");
         //添加主表
         depotHeadMapper.insertSelective(depotHead);
         //根据单据编号查询单据id
@@ -2011,7 +2034,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             //获取子表单商品
             MaterialExtend materialExtend = materialExtendService.getMaterialExtend(depotItem.getMaterialExtendId());
             //获取商品条码
-            String barCode = materialExtend.getBarCode();
+            String barCode = materialExtend.getSku();
             //校验商品保质期
             if (depotHead.getType().equals("入库")){
                 //修改采购订单的生产日期和库位
@@ -2022,7 +2045,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                 Material m = materialService.getMaterial(materialExtend.getMaterialId());
                 //获取商品类别
                 MaterialCategory mc = materialCategoryService.getMaterialCategory(m.getCategoryId());
-                if (mc.getExpiryThreshold() != null && mc.getExpiryThreshold() > 0){
+                if (mc.getExpiryThreshold() != null && mc.getExpiryThreshold() > 0 && depotItem.getExpiryNum() != null){
                     //商品生产天数
                     int productionDay = DateUtils.differentDaysByMillisecond(depotItem.getProductionDate(),new Date());
                     //保质期剩余天数
@@ -2077,14 +2100,14 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
             depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxMoney()));
             //添加单据子表
             depotItemService.insertDepotItemWithObj(depotItem);
-            if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())){
-                //表单入库,新增批次商品信息
-                materialBatchService.generateMaterialBatchByDepotItemId(depotItem,depotHead.getOrganId());
-            }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
-                //表单出库,修改商品库存
-                //materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
-                materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
-            }
+//            if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())){
+//                //表单入库,新增批次商品信息
+//                materialBatchService.generateMaterialBatchByDepotItemId(depotItem,depotHead.getOrganId());
+//            }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
+//                //表单出库,修改商品库存
+//                //materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
+//                materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
+//            }
             //更新当前库存
             depotItemService.updateCurrentStock(depotItem);
             //更新当前成本价
@@ -2095,7 +2118,7 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
         //修改订单总额
         updateTotalPriceById(depotHead);
         //修改采购订单状态、操作人、操作时间,数额
-        this.update(new UpdateWrapper<DepotHead>().set("status", "2").set("oper_id",userInfo.getId()).set("submit_time",new Date()).eq("id", pdaDepotHeadDTO.getId()));
+        this.update(new UpdateWrapper<DepotHead>().set("status", "6").set("oper_id",userInfo.getId()).set("submit_time",new Date()).eq("id", pdaDepotHeadDTO.getId()));
         return true;
     }
 
@@ -2119,7 +2142,21 @@ public class DepotHeadServiceImpl extends ServiceImpl<DepotHeadMapper, DepotHead
                 totalPrice = totalPrice.negate();
             }
             this.update(new UpdateWrapper<DepotHead>().set("total_price",totalPrice).set("discount_last_money",sum).eq("id",depotHead.getId()));
+    }
+
 
+    /**
+     * 订单审核审核
+     * @param depotHead 订单数据
+     */
+    private void applyAudit(DepotHead depotHead){
+        if (depotHead.getStatus().equals("9")){
+            String type = depotHead.getSubType();
+            if (depotHead.getType().equals("入库") || depotHead.getType().equals("出库")) {
+                type += depotHead.getType();
+            }
+            auditService.generateAuditByItemId(depotHead.getNumber(),type);
+        }
     }
 
 }

+ 134 - 61
src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.jsh.erp.constants.BusinessConstants;
 import com.jsh.erp.constants.ExceptionConstants;
+import com.jsh.erp.datasource.dto.DepotItemDTO;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.mappers.*;
 import com.jsh.erp.datasource.pda.vo.PDADepotItemVO;
@@ -143,8 +144,11 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         return materialMapperEx.pdaPrintMaterial(depotItemId);
     }
 
+    /**
+     * 根据id获取单据子表信息
+     */
     @Override
-    public DepotItem getDepotItem(long id)throws Exception {
+    public DepotItem getDepotItem(long id) {
         DepotItem result=null;
         try{
             result=depotItemMapper.selectByPrimaryKey(id);
@@ -291,9 +295,15 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         return result;
     }
 
+    /**
+     * 添加单据子表
+     * @param depotItem 单据子表
+     * @return
+     * @throws Exception
+     */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int insertDepotItemWithObj(DepotItem depotItem)throws Exception {
+    public int insertDepotItemWithObj(DepotItem depotItem) {
         User user = userService.getCurrentUser();
         //创建时间
         depotItem.setCreateTime(new Date());
@@ -375,7 +385,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      * @throws Exception
      */
     @Override
-    public DepotItem getPreItemByHeaderIdAndMaterial(String linkStr, Long meId, Long linkId)throws Exception {
+    public DepotItem getPreItemByHeaderIdAndMaterial(String linkStr, Long meId, Long linkId) {
         DepotItem depotItem = new DepotItem();
         try{
             DepotHead depotHead = depotHeadService.getDepotHead(linkStr);
@@ -507,9 +517,9 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void saveDetials(String rows, Long headerId, String actionType, HttpServletRequest request) throws Exception{
+    public void saveDetails(String rows, Long headerId, String actionType, HttpServletRequest request) throws Exception{
         //查询单据主表信息
-        DepotHead depotHead =depotHeadMapper.selectByPrimaryKey(headerId);
+        DepotHead depotHead = depotHeadService.getDepotHead(headerId);
         //删除序列号和回收序列号
         deleteOrCancelSerialNumber(actionType, depotHead, headerId);
         //删除单据的明细
@@ -538,14 +548,14 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 //商品单位
                 depotItem.setMaterialUnit(rowObj.getString("unit"));
                 //实际出入库数量
-                depotItem.setActualQuantityInStorage(rowObj.getBigDecimal("actualQuantityInStorage"));
+//                depotItem.setActualQuantityInStorage(rowObj.getBigDecimal("actualQuantityInStorage"));
                 //出入库差异
-                depotItem.setWarehousingVariance(rowObj.getBigDecimal("warehousingVariance"));
+//                depotItem.setWarehousingVariance(rowObj.getBigDecimal("warehousingVariance"));
                 //出入库差异原因
-                depotItem.setReasonOfDifference(rowObj.getString("reasonOfDifference"));
+//                depotItem.setReasonOfDifference(rowObj.getString("reasonOfDifference"));
                 //出入库用户
                 depotItem.setWarehousingUser(rowObj.getLong("warehousingUser"));
-                //warehousingTime
+                //出入库时间
                 depotItem.setWarehousingTime(rowObj.getDate("warehousingTime"));
                 //生产日期
                 depotItem.setProductionDate(rowObj.getDate("productionDate"));
@@ -578,7 +588,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     }
                 }
                 if (StringUtil.isExist(rowObj.get("snList"))) {
-                    depotItem.setSnList(rowObj.getString("snList"));
+//                    depotItem.setSnList(rowObj.getString("snList"));
                     if(StringUtil.isExist(rowObj.get("depotId"))) {
                         String [] snArray = depotItem.getSnList().split(",");
                         int operNum = rowObj.getInteger("operNumber");
@@ -595,50 +605,52 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                                     String.format(ExceptionConstants.DEPOT_HEAD_SN_NUMBERE_FAILED_MSG, barCode));
                         }
                     }
-                } else {
+                }
+//                else {
                     //入库或出库
-                    if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) ||
-                            BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
+//                    if (BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) ||
+//                            BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
                         //序列号不能为空  先去掉校验
-                        if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
+//                        if (BusinessConstants.ENABLE_SERIAL_NUMBER_ENABLED.equals(material.getEnableSerialNumber())) {
                             //如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
-                            if(systemConfigService.getInOutManageFlag() &&
-                                    (BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
-                                            ||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
-                                            ||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
-                                            ||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
-                                //跳过
-                            }
+//                            if(systemConfigService.getInOutManageFlag() &&
+//                                    (BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
+//                                            ||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
+//                                            ||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
+//                                            ||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
+//                                //跳过
+//                            }
 //                            else {
 //                                throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_CODE,
 //                                        String.format(ExceptionConstants.MATERIAL_SERIAL_NUMBERE_EMPTY_MSG, barCode));
 //                            }
-                        }
-                    }
-                }
+//                        }
+//                    }
+//                }
                 if (StringUtil.isExist(rowObj.get("batchNumber"))) {
                     //设置基础单位数量
                     depotItem.setBatchNumber(rowObj.getString("batchNumber"));
-                } else {
+                }
+//                else {
                     //入库或出库
-                    if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) ||
-                            BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
+//                    if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType()) ||
+//                            BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())) {
                         //批号不能为空
-                        if (BusinessConstants.ENABLE_BATCH_NUMBER_ENABLED.equals(material.getEnableBatchNumber())) {
-                            //如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
-                            if(systemConfigService.getInOutManageFlag() &&
-                                    (BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
-                                            ||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
-                                            ||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
-                                            ||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
-                                //跳过
-                            } else {
-                                throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE,
-                                        String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, barCode));
-                            }
-                        }
-                    }
-                }
+//                        if (BusinessConstants.ENABLE_BATCH_NUMBER_ENABLED.equals(material.getEnableBatchNumber())) {
+//                            //如果开启出入库管理,并且类型等于采购、采购退货、销售、销售退货,则跳过
+//                            if(systemConfigService.getInOutManageFlag() &&
+//                                    (BusinessConstants.SUB_TYPE_PURCHASE.equals(depotHead.getSubType())
+//                                            ||BusinessConstants.SUB_TYPE_PURCHASE_RETURN.equals(depotHead.getSubType())
+//                                            ||BusinessConstants.SUB_TYPE_SALES.equals(depotHead.getSubType())
+//                                            ||BusinessConstants.SUB_TYPE_SALES_RETURN.equals(depotHead.getSubType()))) {
+//                                //跳过
+//                            } else {
+//                                throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_CODE,
+//                                        String.format(ExceptionConstants.DEPOT_HEAD_BATCH_NUMBERE_EMPTY_MSG, barCode));
+//                            }
+//                        }
+//                    }
+//                }
                 //设置有效期
                 if (StringUtil.isExist(rowObj.get("expirationDate"))) {
                     depotItem.setExpirationDate(rowObj.getDate("expirationDate"));
@@ -748,7 +760,8 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 //总金额,不含税
                 if (StringUtil.isExist(rowObj.get("allPrice"))) {
                     //基本单位数量*单价
-                    depotItem.setAllPrice(depotItem.getBasicNumber().multiply(depotItem.getUnitPrice()));
+                    depotItem.setAllPrice(rowObj.getBigDecimal("allPrice"));
+                    //depotItem.setAllPrice(depotItem.getBasicNumber().multiply(depotItem.getUnitPrice()));
                 }
                 if (StringUtil.isExist(rowObj.get("depotId"))) {
                     depotItem.setDepotId(rowObj.getLong("depotId"));
@@ -777,18 +790,18 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 if (StringUtil.isExist(rowObj.get("taxRate"))) {
                     depotItem.setTaxRate(rowObj.getBigDecimal("taxRate"));
                     //金额*税率
-                    depotItem.setTaxMoney(depotItem.getAllPrice().multiply(depotItem.getTaxRate()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
+                    //depotItem.setTaxMoney(depotItem.getAllPrice().multiply(depotItem.getTaxRate()).divide(new BigDecimal("100"),2,BigDecimal.ROUND_HALF_UP));
                 }
                 //税额
                 if (StringUtil.isExist(rowObj.get("taxMoney"))) {
-                    //depotItem.setTaxMoney(rowObj.getBigDecimal("taxMoney"));
+                    depotItem.setTaxMoney(rowObj.getBigDecimal("taxMoney"));
 
                 }
                 //价税合计
                 if (StringUtil.isExist(rowObj.get("taxLastMoney"))) {
                     //单价总额 + 税额
-                    //depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
-                    depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxMoney() == null ? BigDecimal.ZERO : depotItem.getTaxMoney()));
+                    depotItem.setTaxLastMoney(rowObj.getBigDecimal("taxLastMoney"));
+                    //depotItem.setTaxLastMoney(depotItem.getAllPrice().add(depotItem.getTaxMoney() == null ? BigDecimal.ZERO : depotItem.getTaxMoney()));
                 }
                 if (StringUtil.isExist(rowObj.get("mType"))) {
                     depotItem.setMaterialType(rowObj.getString("mType"));
@@ -800,10 +813,10 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
                     String stockMsg = material.getName() + "-" + barCode;
                     BigDecimal stock = getCurrentStockByParam(depotItem.getDepotId(),depotItem.getMaterialId());
-                    if(StringUtil.isNotEmpty(depotItem.getSku())) {
-                        //对于sku商品要换个方式计算库存
-                        stock = getSkuStockByParam(depotItem.getDepotId(),depotItem.getMaterialExtendId(),null,null);
-                    }
+//                    if(StringUtil.isNotEmpty(depotItem.getSku())) {
+//                        //对于sku商品要换个方式计算库存
+//                        stock = getSkuStockByParam(depotItem.getDepotId(),depotItem.getMaterialExtendId(),null,null);
+//                    }
                     if(StringUtil.isNotEmpty(depotItem.getBatchNumber())) {
                         //对于批次商品要换个方式计算库存
                         stock = getOneBatchNumberStock(depotItem.getDepotId(), barCode, depotItem.getBatchNumber());
@@ -814,7 +827,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                         //对于批次商品,直接使用当前填写的数量
                         thisRealNumber = depotItem.getOperNumber()==null?BigDecimal.ZERO:depotItem.getOperNumber();
                     }
-                    if(!systemConfigService.getMinusStockFlag() && stock.compareTo(thisRealNumber)<0){
+                    if(!systemConfigService.getMinusStockFlag() && stock.compareTo(thisRealNumber) < 0){
                         throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_CODE,
                                 String.format(ExceptionConstants.MATERIAL_STOCK_NOT_ENOUGH_MSG, stockMsg));
                     }
@@ -1036,7 +1049,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void deleteDepotItemHeadId(Long headerId)throws Exception {
+    public void deleteDepotItemHeadId(Long headerId) {
         try{
             //1、查询删除前的单据明细
             List<DepotItem> depotItemList = getListByHeaderId(headerId);
@@ -1060,7 +1073,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void deleteOrCancelSerialNumber(String actionType, DepotHead depotHead, Long headerId) throws Exception {
+    public void deleteOrCancelSerialNumber(String actionType, DepotHead depotHead, Long headerId) {
         if(actionType.equals("update")) {
             User userInfo = userService.getCurrentUser();
             if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())){
@@ -1111,6 +1124,33 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
     }
 
     /**
+     * 针对组装单、拆卸单校验是否存在组合件和普通子件
+     * @param depotItems
+     * @param subType
+     */
+    @Override
+    public void checkAssembleWithMaterialType(List<DepotItemDTO> depotItems, String subType) {
+        if(BusinessConstants.SUB_TYPE_ASSEMBLE.equals(subType) ||
+                BusinessConstants.SUB_TYPE_DISASSEMBLE.equals(subType)) {
+            if(depotItems.size() > 1) {
+                DepotItem firstItem = depotItems.get(0);
+//                JSONObject firstRowObj = JSONObject.parseObject(rowArr.getString(0));
+                DepotItem secondItem = depotItems.get(1);
+//                JSONObject secondRowObj = JSONObject.parseObject(rowArr.getString(1));
+                String firstMaterialType = firstItem.getMaterialType();
+                String secondMaterialType = secondItem.getMaterialType();
+                if(!"组合件".equals(firstMaterialType) || !"普通子件".equals(secondMaterialType)) {
+                    throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE,
+                            String.format(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG));
+                }
+            } else {
+                throw new BusinessRunTimeException(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_CODE,
+                        String.format(ExceptionConstants.DEPOT_HEAD_CHECK_ASSEMBLE_EMPTY_MSG));
+            }
+        }
+    }
+
+    /**
      * 更新商品的价格
      * @param meId
      * @param subType
@@ -1144,6 +1184,39 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         }
     }
 
+    /**
+     * 更新商品的价格
+     * @param meId
+     * @param subType
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void updateMaterialExtendPrice(Long meId, String subType, String billType, DepotItem depotItem) {
+        if(systemConfigService.getUpdateUnitPriceFlag()) {
+            if (StringUtil.isExist(depotItem.getUnitPrice())) {
+                BigDecimal unitPrice = depotItem.getUnitPrice();
+                MaterialExtend materialExtend = new MaterialExtend();
+                materialExtend.setId(meId);
+                if(BusinessConstants.SUB_TYPE_PURCHASE.equals(subType)) {
+                    materialExtend.setPurchaseDecimal(unitPrice);
+                }
+                if(BusinessConstants.SUB_TYPE_SALES.equals(subType)) {
+                    materialExtend.setWholesaleDecimal(unitPrice);
+                }
+                if(BusinessConstants.SUB_TYPE_RETAIL.equals(subType)) {
+                    materialExtend.setCommodityDecimal(unitPrice);
+                }
+                //其它入库-生产入库的情况更新采购单价
+                if(BusinessConstants.SUB_TYPE_OTHER.equals(subType)) {
+                    if(BusinessConstants.BILL_TYPE_PRODUCE_IN.equals(billType)) {
+                        materialExtend.setPurchaseDecimal(unitPrice);
+                    }
+                }
+                materialExtendService.updateMaterialExtend(materialExtend);
+            }
+        }
+    }
+
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public List<DepotItemStockWarningCount> findStockWarningCount(Integer offset, Integer rows, String materialParam, List<Long> depotList, List<Long> categoryList) {
@@ -1209,7 +1282,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      * @return
      */
     @Override
-    public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime) throws Exception {
+    public BigDecimal getStockByParam(Long depotId, Long mId, String beginTime, String endTime) {
         List<Long> depotList = depotService.parseDepotList(depotId);
         return getStockByParamWithDepotList(depotList, mId, beginTime, endTime);
     }
@@ -1223,7 +1296,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      * @return
      */
     @Override
-    public BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception {
+    public BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) {
         Boolean forceFlag = systemConfigService.getForceApprovalFlag();
         Boolean inOutManageFlag = systemConfigService.getInOutManageFlag();
         //初始库存
@@ -1298,7 +1371,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public void updateCurrentStock(DepotItem depotItem) throws Exception {
+    public void updateCurrentStock(DepotItem depotItem) {
         updateCurrentStockFun(depotItem.getMaterialId(), depotItem.getDepotId());
         if(depotItem.getAnotherDepotId()!=null){
             updateCurrentStockFun(depotItem.getMaterialId(), depotItem.getAnotherDepotId());
@@ -1379,7 +1452,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      * @param dId
      */
     @Override
-    public void updateCurrentStockFun(Long mId, Long dId) throws Exception {
+    public void updateCurrentStockFun(Long mId, Long dId) {
         if(mId!=null && dId!=null) {
             //-先清除再插入,防止商品仓库变更,数据对不上
             materialCurrentStockMapper.delete(new LambdaQueryWrapperX<MaterialCurrentStock>().eq(MaterialCurrentStock::getMaterialId,mId).eqIfPresent(MaterialCurrentStock::getDepotId,dId));
@@ -1517,7 +1590,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
      * @throws Exception
      */
     @Override
-    public BigDecimal getOneBatchNumberStock(Long depotId, String barCode, String batchNumber) throws Exception {
+    public BigDecimal getOneBatchNumberStock(Long depotId, String barCode, String batchNumber) {
         BigDecimal totalNum = BigDecimal.ZERO;
         Boolean forceFlag = systemConfigService.getForceApprovalFlag();
         Boolean inOutManageFlag = systemConfigService.getInOutManageFlag();
@@ -1554,7 +1627,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         //仓库集合
         Map<String, Long> depotMap = new HashMap<>();
         for (MaterialVo4Unit material: list) {
-            materialMap.put(material.getBarCode(), material);
+            materialMap.put(material.getSku(), material);
         }
         //获取当前用户所有仓库
         JSONArray depotArr = depotService.findDepotByCurrentUser();
@@ -1566,7 +1639,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
         }
         for (Map<String, String> detailMap: detailList) {
             JSONObject item = new JSONObject();
-            String barCode = detailMap.get("barCode");
+            String barCode = detailMap.get("sku");
             if(StringUtil.isNotEmpty(barCode)) {
                 MaterialVo4Unit m = materialMap.get(barCode);
                 if(m!=null) {

+ 9 - 5
src/main/java/com/jsh/erp/service/impl/DepotServiceImpl.java

@@ -58,7 +58,7 @@ public class DepotServiceImpl extends ServiceImpl<DepotMapper, Depot> implements
     }
 
     @Override
-    public Depot getDepot(long id)throws Exception {
+    public Depot getDepot(long id) {
         Depot result=null;
         try{
             result=depotMapper.selectByPrimaryKey(id);
@@ -89,14 +89,18 @@ public class DepotServiceImpl extends ServiceImpl<DepotMapper, Depot> implements
         return list;
     }
 
+    /**
+     * 获取启用状态仓库列表
+     * @return 启用状态仓库列表
+     */
     @Override
-    public List<Depot> getAllList()throws Exception {
+    public List<Depot> getAllList() {
         DepotExample example = new DepotExample();
         example.createCriteria().andEnabledEqualTo(true).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
         example.setOrderByClause("sort asc, id desc");
-        List<Depot> list=null;
+        List<Depot> list = null;
         try{
-            list=depotMapper.selectByExample(example);
+            list = depotMapper.selectByExample(example);
         }catch(Exception e){
             JshException.readFail(logger, e);
         }
@@ -308,7 +312,7 @@ public class DepotServiceImpl extends ServiceImpl<DepotMapper, Depot> implements
      * @return 仓库id为空,返回当前用户有权限的仓库,不为空返回仓库id的集合
      */
     @Override
-    public List<Long> parseDepotList(Long depotId) throws Exception {
+    public List<Long> parseDepotList(Long depotId) {
         List<Long> depotList = new ArrayList<>();
         if(depotId !=null) {
             depotList.add(depotId);

+ 1 - 1
src/main/java/com/jsh/erp/service/impl/LogServiceImpl.java

@@ -147,7 +147,7 @@ public class LogServiceImpl extends ServiceImpl<LogMapper, Log> implements LogSe
                 String clientIp = getLocalIp(request);
                 String createTime = Tools.getNow3();
                 Long count = logMapperEx.getCountByIpAndDate(userId, moduleName, clientIp, createTime);
-                if(count > 0) {
+                if(count > 0 && !moduleName.equals("商品")) {
                     //如果某个用户某个IP在同1秒内连续操作两遍,此时需要删除该redis记录,使其退出,防止恶意攻击
                     redisService.deleteObjectByUserAndIp(userId, clientIp);
                 } else {

+ 23 - 4
src/main/java/com/jsh/erp/service/impl/MaterialBatchServiceImpl.java

@@ -2,10 +2,12 @@ package com.jsh.erp.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.constants.ExceptionConstants;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.mappers.MaterialBatchMapper;
 import com.jsh.erp.datasource.mappers.MaterialInitialStockMapper;
 import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
+import com.jsh.erp.exception.BusinessRunTimeException;
 import com.jsh.erp.exception.JshException;
 import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.query.QueryWrapperX;
@@ -16,6 +18,7 @@ import com.jsh.erp.utils.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
 import java.math.BigDecimal;
@@ -50,7 +53,8 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
      * 根据单据子表id生成商品批次数据
      */
     @Override
-    public void generateMaterialBatchByDepotItemId(DepotItem depotItem, Long supplierId) throws Exception {
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void generateMaterialBatchByDepotItemId(DepotItem depotItem, Long supplierId) {
         //获取条码信息
         MaterialExtend materialExtend = materialExtendService.getMaterialExtend(depotItem.getMaterialExtendId());
         //创建批次信息
@@ -87,12 +91,17 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
         materialBatch.setPosition(depotItem.getPosition());
         //条码
         materialBatch.setBarCode(materialExtend.getBarCode());
+        materialBatch.setSku(depotItem.getSku());
         materialBatch.setMaterialExtendId(materialExtend.getId());
         materialBatchMapper.insert(materialBatch);
     }
 
+    /**
+     * 根据单据子表id处理商品批次数据(出库)
+     */
     @Override
-    public void handleMaterialBatchByDepotItemId(Long diId) throws Exception {
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void handleMaterialBatchByDepotItemId(Long diId) {
         DepotItem depotItem = depotItemService.getDepotItem(diId);
         //获取商品期初库存
         MaterialInitialStock mis = materialInitialStockMapper.selectOne(new LambdaQueryWrapperX<MaterialInitialStock>()
@@ -129,11 +138,21 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
                     updateInventory("出库",diId,materialBatch);
                 }
             }
+            if (basicNumber.compareTo(BigDecimal.ZERO) > 0){
+                throw new BusinessRunTimeException(ExceptionConstants.SERVICE_SYSTEM_ERROR_CODE,
+                        "商品库存不足");
+            }
         }
     }
 
+    /**
+     * 修改商品批次库存
+     * @param type 操作记录
+     * @param materialBatch 商品批次信息
+     */
     @Override
-    public synchronized void updateInventory(String type, Long id, MaterialBatch materialBatch) throws Exception {
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public synchronized void updateInventory(String type, Long id, MaterialBatch materialBatch) {
         if (materialBatch.getInventory() != null){
             //获取修改前库存
             int originalStock = materialBatchMapper.selectOne("id",materialBatch.getId()).getInventory().intValue();
@@ -193,7 +212,7 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
             barCodeList = Arrays.asList(barCodes.split(","));
         }
         //List<Long> ids = materialExtendService.selectIdsByBarCode(barCodeList);
-        List<MaterialBatch> list = materialBatchMapper.selectList(new LambdaQueryWrapperX<MaterialBatch>().eq(MaterialBatch::getDepotId,depotId).inIfPresent(MaterialBatch::getBarCode,barCodeList).gt(MaterialBatch::getInventory,BigDecimal.ZERO));
+        List<MaterialBatch> list = materialBatchMapper.selectList(new LambdaQueryWrapperX<MaterialBatch>().eq(MaterialBatch::getDepotId,depotId).inIfPresent(MaterialBatch::getSku,barCodeList).gt(MaterialBatch::getInventory,BigDecimal.ZERO));
         return list;
     }
 

+ 17 - 14
src/main/java/com/jsh/erp/service/impl/MaterialCategoryServiceImpl.java

@@ -48,7 +48,7 @@ public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMap
      * 根据id查询商品类别
      */
     @Override
-    public MaterialCategory getMaterialCategory(long id)throws Exception {
+    public MaterialCategory getMaterialCategory(long id) {
         MaterialCategory result = null;
         try{
             result = materialCategoryMapper.selectByPrimaryKey(id);
@@ -84,9 +84,12 @@ public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMap
         return list;
     }
 
+    /**
+     * 根据商品类型ID查询全部子类型集合
+     */
     @Override
-    public List<MaterialCategory> getAllList(Long parentId)throws Exception {
-        List<MaterialCategory> list=null;
+    public List<MaterialCategory> getAllList(Long parentId) {
+        List<MaterialCategory> list = null;
         try{
             list = getMCList(parentId);
         }catch(Exception e){
@@ -95,19 +98,20 @@ public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMap
         return list;
     }
 
+    //根据商品类型获取子类型集合
     @Override
     public List<MaterialCategory> getMCList(Long parentId)throws Exception {
-        List<MaterialCategory> res= new ArrayList<MaterialCategory>();
-        List<MaterialCategory> list=null;
+        List<MaterialCategory> res = new ArrayList<MaterialCategory>();
+        List<MaterialCategory> list = null;
         MaterialCategoryExample example = new MaterialCategoryExample();
         example.createCriteria().andParentIdEqualTo(parentId).andIdNotEqualTo(1L);
         example.setOrderByClause("id");
-        list=materialCategoryMapper.selectByExample(example);
-        if(list!=null && list.size()>0) {
+        list = materialCategoryMapper.selectByExample(example);
+        if(list != null && list.size() > 0) {
             res.addAll(list);
             for(MaterialCategory mc : list) {
                 List<MaterialCategory> mcList = getMCList(mc.getId());
-                if(mcList!=null && mcList.size()>0) {
+                if(mcList != null && mcList.size() > 0) {
                     res.addAll(mcList);
                 }
             }
@@ -252,21 +256,20 @@ public class MaterialCategoryServiceImpl extends ServiceImpl<MaterialCategoryMap
     }
 
     /**
-     * description:
-     * 获取商品类别树数据
+     * 获取除当前类型的商品树类型数据
      */
     @Override
-    public List<TreeNode> getMaterialCategoryTree(Long id) throws Exception{
-        List<TreeNode> list=null;
+    public List<TreeNode> getMaterialCategoryTree(Long id){
+        List<TreeNode> list = null;
         try{
-            list=materialCategoryMapperEx.getNodeTree(id);
+            list = materialCategoryMapperEx.getNodeTree(id);
         }catch(Exception e){
             JshException.readFail(logger, e);
         }
        return list;
     }
     /**
-     * 根据商品类别编号判断商品类别是否已存在
+     * 根据商品类别编号判断商品类别是否已存在 0
      * */
     @Override
     public void  checkMaterialCategorySerialNo(MaterialCategory mc)throws Exception {

+ 16 - 2
src/main/java/com/jsh/erp/service/impl/MaterialExtendServiceImpl.java

@@ -60,8 +60,11 @@ public class MaterialExtendServiceImpl extends ServiceImpl<MaterialExtendMapper,
     @Resource
     private MaterialUpcService materialUpcService;
 
+    /**
+     * 根据id查询商品拓展信息
+     */
     @Override
-    public MaterialExtend getMaterialExtend(long id)throws Exception {
+    public MaterialExtend getMaterialExtend(long id) {
         MaterialExtend result=null;
         try{
             result=materialExtendMapper.selectByPrimaryKey(id);
@@ -446,7 +449,7 @@ public class MaterialExtendServiceImpl extends ServiceImpl<MaterialExtendMapper,
      */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    public int updateMaterialExtend(MaterialExtend materialExtend) throws Exception{
+    public int updateMaterialExtend(MaterialExtend materialExtend) {
         User user = userService.getCurrentUser();
         materialExtend.setUpdateTime(System.currentTimeMillis());
         materialExtend.setUpdateSerial(user.getLoginName());
@@ -669,6 +672,17 @@ public class MaterialExtendServiceImpl extends ServiceImpl<MaterialExtendMapper,
     }
 
     /**
+     * 根据UPC获取sku
+     *
+     * @param upc
+     * @return
+     */
+    @Override
+    public String getSkuByUpc(String upc) {
+        return materialExtendMapper.getSkuByUpc(upc);
+    }
+
+    /**
      * 设置当前库存
      * @param depotId 仓库id
      * @param mId 商品id

+ 87 - 0
src/main/java/com/jsh/erp/service/impl/MaterialInputServiceImpl.java

@@ -0,0 +1,87 @@
+package com.jsh.erp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.datasource.dto.MaterialInputDto;
+import com.jsh.erp.datasource.entities.MaterialInput;
+import com.jsh.erp.datasource.entities.User;
+import com.jsh.erp.datasource.mappers.MaterialInputMapper;
+import com.jsh.erp.query.LambdaQueryWrapperX;
+import com.jsh.erp.service.AuditService;
+import com.jsh.erp.service.MaterialInputService;
+import com.jsh.erp.service.SequenceService;
+import com.jsh.erp.service.UserService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.Date;
+
+@Service
+@Slf4j
+public class MaterialInputServiceImpl extends ServiceImpl<MaterialInputMapper,MaterialInput> implements MaterialInputService {
+
+    @Resource
+    private MaterialInputMapper materialInputMapper;
+
+    @Resource
+    private SequenceService sequenceService;
+
+    @Resource
+    private AuditService auditService;
+
+    @Resource
+    private UserService userService;
+
+
+
+    /**
+     * 添加商品录入信息
+     * @param materialInput
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public boolean add(MaterialInput materialInput) {
+        try{
+            //生成单据编号
+            materialInput.setNumber("HWLR" + sequenceService.buildOnlyNumber());
+            //设置创建时间
+            materialInput.setCreateTime(new Date());
+            //设置创建人
+            User user = userService.getCurrentUser();
+            materialInput.setCreateBy(user.getId());
+            materialInputMapper.insert(materialInput);
+            auditService.generateAuditByItemId(materialInput.getNumber(),"pda维护商品");
+        }catch (Exception e){
+            log.info("添加商品录入信息失败!",e);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 根据单据号查询商品录入信息详情
+     * @param number 录入单号
+     */
+    @Override
+    public MaterialInput getDetailByNumber(String number) {
+        MaterialInput materialInput = this.getOne(new LambdaQueryWrapperX<MaterialInput>().eq(MaterialInput::getNumber,number).eq(MaterialInput::getDeleteFlag,false));
+        return materialInput;
+    }
+
+    /**
+     * 编辑货物信息录入
+     * @param materialInputDto
+     */
+    @Override
+    public boolean updateMaterialInput(MaterialInputDto materialInputDto) {
+        try {
+            this.updateById(materialInputDto);
+        }catch (Exception e){
+            log.info("修改货物信息录入失败!",e);
+            return false;
+        }
+        return true;
+    }
+
+}

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 432 - 422
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java


+ 0 - 1
src/main/java/com/jsh/erp/service/impl/MaterialUpcServiceImpl.java

@@ -2,7 +2,6 @@ package com.jsh.erp.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.jsh.erp.datasource.entities.MaterialUnit;
 import com.jsh.erp.datasource.entities.MaterialUpc;
 import com.jsh.erp.datasource.mappers.MaterialUpcMapper;
 import com.jsh.erp.service.MaterialUpcService;

+ 363 - 0
src/main/java/com/jsh/erp/service/impl/MsgServiceImpl.java

@@ -0,0 +1,363 @@
+package com.jsh.erp.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.constants.BusinessConstants;
+import com.jsh.erp.constants.ExceptionConstants;
+import com.jsh.erp.datasource.entities.Msg;
+import com.jsh.erp.datasource.entities.MsgEx;
+import com.jsh.erp.datasource.entities.MsgExample;
+import com.jsh.erp.datasource.entities.User;
+import com.jsh.erp.datasource.mappers.MsgMapper;
+import com.jsh.erp.datasource.mappers.MsgMapperEx;
+import com.jsh.erp.datasource.pda.vo.PDAMsgListVO;
+import com.jsh.erp.datasource.pda.vo.PDAMsgVO;
+import com.jsh.erp.exception.BusinessRunTimeException;
+import com.jsh.erp.service.DepotHeadService;
+import com.jsh.erp.service.LogService;
+import com.jsh.erp.service.MsgService;
+import com.jsh.erp.service.UserService;
+import com.jsh.erp.utils.DateUtils;
+import com.jsh.erp.utils.PageUtils;
+import com.jsh.erp.utils.StringUtil;
+import com.jsh.erp.utils.Tools;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.jsh.erp.utils.Tools.getCenternTime;
+
+@Service
+public class MsgServiceImpl extends ServiceImpl<MsgMapper,Msg> implements MsgService {
+    private Logger logger = LoggerFactory.getLogger(MsgServiceImpl.class);
+    @Resource
+    private MsgMapper msgMapper;
+
+    @Resource
+    private MsgMapperEx msgMapperEx;
+
+    @Resource
+    private DepotHeadService depotHeadService;
+
+    @Resource
+    private UserService userService;
+
+    @Resource
+    private LogService logService;
+
+    @Override
+    public Msg getMsg(long id)throws Exception {
+        Msg result=null;
+        try{
+            result=msgMapper.selectByPrimaryKey(id);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    public List<Msg> getMsg()throws Exception {
+        MsgExample example = new MsgExample();
+        example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Msg> list=null;
+        try{
+            list=msgMapper.selectByExample(example);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return list;
+    }
+
+    @Override
+    public List<MsgEx> select(String name)throws Exception {
+        List<MsgEx> list=null;
+        try{
+            User userInfo = userService.getCurrentUser();
+            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
+                PageUtils.startPage();
+                list = msgMapperEx.selectByConditionMsg(userInfo.getId(), name);
+                if (null != list) {
+                    for (MsgEx msgEx : list) {
+                        if (msgEx.getCreateTime() != null) {
+                            msgEx.setCreateTimeStr(getCenternTime(msgEx.getCreateTime()));
+                        }
+                    }
+                }
+            }
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return list;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int insertMsg(JSONObject obj, HttpServletRequest request)throws Exception {
+        Msg msg = JSONObject.parseObject(obj.toJSONString(), Msg.class);
+        int result=0;
+        try{
+            User userInfo = userService.getCurrentUser();
+            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
+                msg.setCreateTime(new Date());
+                msg.setStatus(1);
+                result=msgMapper.insertSelective(msg);
+                logService.insertLog("消息",
+                        new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_ADD).append(msg.getMsgTitle()).toString(), request);
+            }
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int updateMsg(JSONObject obj, HttpServletRequest request) throws Exception{
+        Msg msg = JSONObject.parseObject(obj.toJSONString(), Msg.class);
+        int result=0;
+        try{
+            result=msgMapper.updateByPrimaryKeySelective(msg);
+            logService.insertLog("消息",
+                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_EDIT).append(msg.getMsgTitle()).toString(), request);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int deleteMsg(Long id, HttpServletRequest request)throws Exception {
+        int result=0;
+        try{
+            result=msgMapper.deleteByPrimaryKey(id);
+            logService.insertLog("消息",
+                    new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(id).toString(), request);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchDeleteMsg(String ids, HttpServletRequest request) throws Exception{
+        List<Long> idList = StringUtil.strToLongList(ids);
+        MsgExample example = new MsgExample();
+        example.createCriteria().andIdIn(idList);
+        int result=0;
+        try{
+            result=msgMapper.deleteByExample(example);
+            logService.insertLog("消息", "批量删除,id集:" + ids, request);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    public int checkIsNameExist(Long id, String name)throws Exception {
+        MsgExample example = new MsgExample();
+        example.createCriteria().andIdNotEqualTo(id).andMsgTitleEqualTo(name).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+        List<Msg> list=null;
+        try{
+            list= msgMapper.selectByExample(example);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return list==null?0:list.size();
+    }
+
+    /**
+     * create by: qiankunpingtai
+     *  逻辑删除角色信息
+     * create time: 2019/3/28 15:44
+     * @Param: ids
+     * @return int
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public int batchDeleteMsgByIds(String ids) throws Exception{
+        logService.insertLog("序列号",
+                new StringBuffer(BusinessConstants.LOG_OPERATION_TYPE_DELETE).append(ids).toString(),
+                ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest());
+        String [] idArray=ids.split(",");
+        int result=0;
+        try{
+            result=msgMapperEx.batchDeleteMsgByIds(idArray);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    public List<MsgEx> getMsgByStatus(String status)throws Exception {
+        List<MsgEx> resList=new ArrayList<>();
+        try{
+            User userInfo = userService.getCurrentUser();
+            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
+                MsgExample example = new MsgExample();
+                example.createCriteria().andStatusEqualTo(status).andUserIdEqualTo(userInfo.getId())
+                        .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+                example.setOrderByClause("id desc");
+                List<Msg> list = msgMapper.selectByExample(example);
+                if (null != list) {
+                    for (Msg msg : list) {
+                        if (msg.getCreateTime() != null) {
+                            MsgEx msgEx = new MsgEx();
+                            msgEx.setId(msg.getId());
+                            msgEx.setMsgTitle(msg.getMsgTitle());
+                            msgEx.setMsgContent(msg.getMsgContent());
+                            msgEx.setStatus(msg.getStatus());
+                            msgEx.setType(msg.getType());
+                            msgEx.setCreateTimeStr(Tools.getCenternTime(msg.getCreateTime()));
+                            resList.add(msgEx);
+                        }
+                    }
+                }
+            }
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return resList;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void batchUpdateStatus(String ids, Integer status) throws Exception{
+        List<Long> idList = StringUtil.strToLongList(ids);
+        Msg msg = new Msg();
+        msg.setStatus(status);
+        MsgExample example = new MsgExample();
+        example.createCriteria().andIdIn(idList);
+        try{
+            msgMapper.updateByExampleSelective(msg, example);
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+    }
+
+    @Override
+    public Long getMsgCountByStatus(String status)throws Exception {
+        Long result=null;
+        try{
+            User userInfo=userService.getCurrentUser();
+            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
+                result = msgMapperEx.getMsgCountByStatus(status, userInfo.getId());
+            }
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return result;
+    }
+
+    @Override
+    public Integer getMsgCountByType(String type)throws Exception {
+        int msgCount = 0;
+        try{
+            User userInfo = userService.getCurrentUser();
+            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
+                MsgExample example = new MsgExample();
+                example.createCriteria().andTypeEqualTo(type).andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
+                List<Msg> list = msgMapper.selectByExample(example);
+                msgCount = list.size();
+            }
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_READ_FAIL_CODE, ExceptionConstants.DATA_READ_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_READ_FAIL_CODE,
+                    ExceptionConstants.DATA_READ_FAIL_MSG);
+        }
+        return msgCount;
+    }
+
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public void readAllMsg() throws Exception{
+        try{
+            User userInfo = userService.getCurrentUser();
+            if(!BusinessConstants.DEFAULT_MANAGER.equals(userInfo.getLoginName())) {
+                Msg msg = new Msg();
+                msg.setStatus(2);
+                MsgExample example = new MsgExample();
+                example.createCriteria();
+                msgMapper.updateByExampleSelective(msg, example);
+            }
+        }catch(Exception e){
+            logger.error("异常码[{}],异常提示[{}],异常[{}]",
+                    ExceptionConstants.DATA_WRITE_FAIL_CODE, ExceptionConstants.DATA_WRITE_FAIL_MSG,e);
+            throw new BusinessRunTimeException(ExceptionConstants.DATA_WRITE_FAIL_CODE,
+                    ExceptionConstants.DATA_WRITE_FAIL_MSG);
+        }
+    }
+
+    /**
+     * PDA获取用户消息列表
+     */
+    @Override
+    public List<PDAMsgListVO> pdaMsgList() {
+        User user = userService.getCurrentUser();
+        Map<String,List<PDAMsgVO>> map = new HashMap<>();
+        //获取用户所有消息
+        PageUtils.startPage();
+        List<PDAMsgVO> msgVOList = msgMapper.pdaMsgList(user.getId());
+        msgVOList.forEach(v ->{
+            String date = DateUtils.dateTime(v.getTime()) + DateUtils.getWeekStr(v.getTime());
+            if (map.get(date) == null){
+                List<PDAMsgVO> list = new ArrayList<>();
+                map.put(date,list);
+            }
+            map.get(date).add(v);
+        });
+        List<PDAMsgListVO> msgListVOList = map.entrySet().stream()
+                .map(v -> new PDAMsgListVO(v.getKey(),v.getValue()))
+                .collect(Collectors.toList());
+        return msgListVOList;
+    }
+}

+ 1 - 1
src/main/java/com/jsh/erp/service/impl/SequenceServiceImpl.java

@@ -29,7 +29,7 @@ public class SequenceServiceImpl implements SequenceService {
      * */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     @Override
-    public String buildOnlyNumber()throws Exception{
+    public String buildOnlyNumber(){
         Long buildOnlyNumber=null;
         synchronized (this){
             try{

+ 1 - 1
src/main/java/com/jsh/erp/service/impl/SupplierServiceImpl.java

@@ -60,7 +60,7 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
     private SequenceService sequenceService;
 
     @Override
-    public Supplier getSupplier(long id)throws Exception {
+    public Supplier getSupplier(long id) {
         Supplier result=null;
         try{
             result=supplierMapper.selectByPrimaryKey(id);

+ 43 - 2
src/main/java/com/jsh/erp/service/impl/TaskStocktakingServiceImpl.java

@@ -2,6 +2,7 @@ package com.jsh.erp.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.constants.ExceptionConstants;
 import com.jsh.erp.datasource.dto.TaskStocktakingDTO;
 import com.jsh.erp.datasource.dto.TaskStocktakingItemQueryDTO;
 import com.jsh.erp.datasource.dto.TaskStocktakingQueryDTO;
@@ -12,6 +13,7 @@ import com.jsh.erp.datasource.pda.vo.PDATaskStocktakingItemVO;
 import com.jsh.erp.datasource.pda.vo.PDATaskStocktakingVO;
 import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
 import com.jsh.erp.datasource.vo.TaskStocktakingVO;
+import com.jsh.erp.exception.BusinessRunTimeException;
 import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.service.*;
 import lombok.RequiredArgsConstructor;
@@ -20,6 +22,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.ArrayList;
@@ -52,6 +55,8 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
 
     private final MaterialBatchMapper materialBatchMapper;
 
+    private final AuditService auditService;
+
     @Override
     public List<TaskStocktakingVO> listBy(TaskStocktakingQueryDTO taskStocktakingQueryDTO) {
         return taskStocktakingMapper.listBy(taskStocktakingQueryDTO);
@@ -95,7 +100,6 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
             User currentUser = userService.getCurrentUser();
             taskStocktakingDTO.setCreateBy(currentUser.getId());
             taskStocktakingDTO.setCreateTime(new Date());
-            taskStocktakingDTO.setTaskStatus(1);
             //生成单据编号
             taskStocktakingDTO.setNumber("PDRW"+sequenceService.buildOnlyNumber());
             //生成任务
@@ -109,6 +113,9 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
                 taskStocktakingItemList.add(taskStocktakingItem);
             });
             taskStocktakingItemMapper.insertBatch(taskStocktakingItemList);
+            if (taskStocktakingDTO.getTaskStatus().equals(9)){
+                auditService.generateAuditByItemId(taskStocktakingDTO.getNumber(),"盘点任务");
+            }
         } catch (Exception e) {
             log.error("创建盘点任务失败", e);
             return false;
@@ -150,11 +157,43 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
     }
 
     /**
+     * 任务-详情
+     * @param number 任务编号
+     */
+    @Override
+    public TaskStocktakingVO detail(String number) {
+        TaskStocktaking one = getOne(new LambdaQueryWrapperX<TaskStocktaking>().eq(TaskStocktaking::getNumber, number));
+        TaskStocktakingVO taskStocktakingVO = new TaskStocktakingVO();
+        BeanUtils.copyProperties(one, taskStocktakingVO);
+        //获取负责人名称
+        User user = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getCreator()));
+        if (user != null) {
+            taskStocktakingVO.setCreatorName(user.getUsername());
+        }
+        //获取创建人名称
+        User user1 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getCreateBy()));
+        if (user1 != null) {
+            taskStocktakingVO.setCreateByName(user1.getUsername());
+        }
+        //获取盘点人名称
+        User user2 = userMapper.selectOne(new LambdaQueryWrapper<User>().eq(User::getId, one.getOperBy()));
+        if (user2 != null) {
+            taskStocktakingVO.setOperByName(user2.getUsername());
+        }
+        //获取仓库名称
+        Depot depot = depotService.getDepot(one.getDepotId());
+        taskStocktakingVO.setDepotName(depot.getName());
+        //当任务类型是抽盘时,返回商品盘点信息
+        return taskStocktakingVO;
+    }
+
+    /**
      * 任务详情-修改
      * @param taskStocktakingDTO
      * @return
      */
     @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public boolean detailUpdate(TaskStocktakingDTO taskStocktakingDTO) {
         try {
             List<String> collect;
@@ -186,7 +225,6 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
             User currentUser = userService.getCurrentUser();
             taskStocktakingDTO.setCreateBy(currentUser.getId());
             taskStocktakingDTO.setCreateTime(new Date());
-            taskStocktakingDTO.setTaskStatus(1);
             //生成任务
             this.updateById(taskStocktakingDTO);
             List<Long> taskStocktakingItemIdList = taskStocktakingItemMapper.selectList(new LambdaQueryWrapperX<TaskStocktakingItem>().eq(TaskStocktakingItem::getTaskStocktakingId, taskStocktakingDTO.getId())).stream().map(TaskStocktakingItem::getId).collect(Collectors.toList());
@@ -212,6 +250,9 @@ public class TaskStocktakingServiceImpl extends ServiceImpl<TaskStocktakingMappe
             if (addTaskStocktakingItemList.size() > 0) {
                 taskStocktakingItemMapper.insertBatch(addTaskStocktakingItemList);
             }
+            if (taskStocktakingDTO.getTaskStatus().equals(9)){
+                auditService.generateAuditByItemId(taskStocktakingDTO.getNumber(),"盘点任务");
+            }
         } catch (Exception e) {
             log.error("修改盘点任务失败", e);
             return false;

+ 18 - 0
src/main/java/com/jsh/erp/service/impl/UserServiceImpl.java

@@ -58,6 +58,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     private PlatformConfigService platformConfigService;
     @Resource
     private RedisService redisService;
+    @Resource
+    private OrganizationService organizationService;
 
     @Value("${tenant.userNumLimit}")
     private Integer userNumLimit;
@@ -959,4 +961,20 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         }
         return 0;
     }
+
+    /**
+     * 根据用户id回去审批用户id
+     * @param uid 用户id
+     * @param isParent 是否查询父级 true查询,false不查询
+     * @return
+     */
+    @Override
+    public Long getAuditUserIds(Long uid, boolean isParent) {
+        Organization organization = orgaUserRelService.getOrganizationByUid(uid);
+        Long orgaId = organization.getId();
+        if (isParent){
+            orgaId = organization.getParentId();
+        }
+        return userMapper.getAuditUserIds(orgaId);
+    }
 }

+ 54 - 0
src/main/java/com/jsh/erp/util/poi/ExcelUtil.java

@@ -0,0 +1,54 @@
+package com.jsh.erp.util.poi;
+
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.CellType;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.springframework.util.StringUtils;
+
+public class ExcelUtil {
+
+    public static String getContent(Sheet src, int rowNum, int colNum) {
+        Row row = src.getRow(rowNum);
+        if(row != null && colNum < row.getLastCellNum()) {
+            Cell cell = src.getRow(rowNum).getCell(colNum);
+            if (cell != null){
+                String str = null;
+                if (cell.getCellType().toString().equals("NUMERIC")){
+                    str = String.valueOf(src.getRow(rowNum).getCell(colNum).getNumericCellValue()).trim();
+                }else{
+                    str = src.getRow(rowNum).getCell(colNum).getStringCellValue().trim();
+                }
+                return str;
+            }
+        }
+            return null;
+    }
+
+    /**
+     * 获取真实的行数,剔除掉空白行
+     * @param sheet
+     * @return
+     */
+    public static int getRightRows(Sheet sheet) {
+        int rsRows = sheet.getLastRowNum(); //行数
+        //int rsCols = src.get(); //列数
+        int rowCount = 0;
+        for (int i = sheet.getFirstRowNum(); i <= rsRows; i++) { //统计行中为空的单元格数
+            Row row = sheet.getRow(i);
+            if (row != null) { // 确保行存在
+                boolean isEmptyRow = true;
+                for (Cell cell : row) {
+                    if (cell.getCellType() != CellType.BLANK && cell.toString().trim().length() > 0) { // 检查单元格不为空且不为空字符串
+                        isEmptyRow = false;
+                        break;
+                    }
+                }
+                if (!isEmptyRow) {
+                    rowCount++;
+                }
+            }
+        }
+        return rowCount;
+    }
+}

+ 36 - 0
src/main/java/com/jsh/erp/utils/DateUtils.java

@@ -333,4 +333,40 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
         }
         return true;
     }
+
+    /**
+     * 获取指定日期的中文星期数
+     * @param date 指定日期
+     * @return 星期数,如:星期一
+     */
+    public static String getWeekStr(Date date) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        int week = calendar.get(7);
+        --week;
+        String weekStr = "";
+        switch (week) {
+            case 0:
+                weekStr = "星期日";
+                break;
+            case 1:
+                weekStr = "星期一";
+                break;
+            case 2:
+                weekStr = "星期二";
+                break;
+            case 3:
+                weekStr = "星期三";
+                break;
+            case 4:
+                weekStr = "星期四";
+                break;
+            case 5:
+                weekStr = "星期五";
+                break;
+            case 6:
+                weekStr = "星期六";
+        }
+        return weekStr;
+    }
 }

+ 0 - 3
src/main/java/com/jsh/erp/utils/ErpInfo.java

@@ -1,8 +1,5 @@
 package com.jsh.erp.utils;
 
-/**
- *
- */
 public enum ErpInfo {
     //通过构造传递参数
     OK(200, "成功"),

+ 135 - 0
src/main/resources/mapper_xml/AuditMapper.xml

@@ -0,0 +1,135 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jsh.erp.datasource.mappers.AuditMapper">
+
+    <select id="pendingApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
+        SELECT
+        a.*,
+        a.business_number AS 'number',
+        u.username AS 'initiatorName',
+        an.node_order
+        FROM audit_node an
+        LEFT JOIN audit a ON an.audit_id = a.id
+        LEFT JOIN jsh_user u ON a.submit_user = u.id
+        <where>
+            an.auditor_user = #{uid} AND an.audit_result = 0 AND a.delete_flag = 0
+            <if test="number != null and number != ''">
+                AND a.business_number LIKE CONCAT('%',#{number},'%')
+            </if>
+            <if test="type != null and type != ''">
+                AND a.type LIKE CONCAT('%',#{type},'%')
+            </if>
+            <if test="initiatorName != null and initiatorName != ''">
+                AND u.username LIKE CONCAT('%',#{initiatorName},'%')
+            </if>
+        </where>
+        ORDER BY a.submit_time DESC
+    </select>
+
+    <select id="processedApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
+        SELECT
+        a.*,
+        a.business_number AS 'number',
+        an.audit_time,
+        an.node_order,
+        u.username AS 'initiatorName'
+        FROM audit_node an
+        LEFT JOIN audit a ON an.audit_id = a.id
+        LEFT JOIN jsh_user u ON a.submit_user = u.id
+        <where>
+            an.auditor_user = #{uid} AND an.audit_result != 0 AND a.delete_flag = 0
+            <if test="number != null and number != ''">
+                AND a.business_number LIKE CONCAT('%',#{number},'%')
+            </if>
+            <if test="type != null and type != ''">
+                AND a.type LIKE CONCAT('%',#{type},'%')
+            </if>
+            <if test="initiatorName != null and initiatorName != ''">
+                AND u.username LIKE CONCAT('%',#{initiatorName},'%')
+            </if>
+            <if test="auditStatus != null">
+                AND an.audit_result = #{auditStatus}
+            </if>
+            <if test="beginTime != null">
+                AND an.audit_time >= #{beginTime}
+            </if>
+            <if test="endTime != null">
+                AND an.audit_time &lt;= #{endTime}
+            </if>
+        </where>
+        ORDER BY an.audit_time DESC
+    </select>
+
+    <select id="myApprovalList" parameterType="com.jsh.erp.datasource.dto.AuditQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditVo">
+        SELECT
+        a.*,
+        a.business_number AS 'number',
+        an.audit_time,
+        an.node_order,
+        u.username AS 'auditorName'
+        FROM audit a
+        LEFT JOIN (SELECT MAX(id) AS 'id',audit_id FROM audit_node GROUP BY audit_id) tb ON a.id = tb.audit_id
+        LEFT JOIN audit_node an ON tb.id = an.id
+        LEFT JOIN jsh_user u ON an.auditor_user = u.id
+        <where>
+            a.submit_user = #{uid} AND a.delete_flag = 0
+            <if test="number != null and number != ''">
+                AND a.business_number LIKE CONCAT('%',#{number},'%')
+            </if>
+            <if test="type != null and type != ''">
+                AND a.type LIKE CONCAT('%',#{type},'%')
+            </if>
+            <if test="auditStatus != null">
+                AND an.audit_result = #{auditStatus}
+            </if>
+            <if test="beginTime != null">
+                AND an.audit_time >= #{beginTime}
+            </if>
+            <if test="endTime != null">
+                AND an.audit_time &lt;= #{endTime}
+            </if>
+        </where>
+        ORDER BY a.submit_time DESC
+    </select>
+
+    <select id="pdaList" parameterType="com.jsh.erp.datasource.pda.dto.PDADepotHeadDTO" resultType="com.jsh.erp.datasource.pda.vo.PDADepotHeadVO">
+        SELECT
+        dh.id,
+        dh.number,
+        dh.create_time,
+        dh.goods_quantity,
+        dh.goods_type_count,
+        dh.oper_time,
+        s.supplier AS supplier_name,
+        dh.status,
+        dh.receiver_address,
+        dh.type,
+        dh.oper_id,
+        u.username AS 'operName'
+        FROM audit_node an
+        LEFT JOIN audit a ON an.audit_id = a.id
+        LEFT JOIN jsh_depot_head dh ON a.business_id = dh.id
+        LEFT JOIN jsh_supplier s ON dh.organ_id = s.id
+        LEFT JOIN jsh_user u ON dh.oper_id = u.id
+        <where>
+            an.auditor_user = #{uid}
+            AND (a.type = '采购' OR a.type = '销售')
+            AND an.delete_flag = 0
+            <if test="number != null and number != ''">
+                AND dh.number like CONCAT('%',#{number},'%')
+            </if>
+            <if test="status != null and status != ''">
+                AND dh.status = #{status}
+            </if>
+            <if test="beginTime != null and beginTime != ''">
+                AND dh.create_time between #{beginTime} and #{endTime}
+            </if>
+            <if test="depotId != null and depotId !=0">
+                AND dh.depot_id = #{depotId}
+            </if>
+        </where>
+        GROUP BY dh.id
+        ORDER BY dh.create_time DESC
+    </select>
+
+</mapper>

+ 9 - 0
src/main/resources/mapper_xml/AuditNodeConfigMapper.xml

@@ -21,4 +21,13 @@
         </foreach>
     </update>
 
+    <select id="getAuditNodeConfigByAuditIdAndOrder" resultType="com.jsh.erp.datasource.entities.AuditNodeConfig">
+        SELECT * FROM audit_node_config
+        <where>
+            process_id = (SELECT process_id FROM audit WHERE id = #{id})
+            AND node_order > #{order} AND IFNULL(auditor_type,0) != 0
+        </where>
+        ORDER BY node_order ASC LIMIT 1
+    </select>
+
 </mapper>

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно