瀏覽代碼

Merge remote-tracking branch 'origin/dev_hjj_522'

# Conflicts:
#	src/main/java/com/jsh/erp/controller/DepotItemController.java
#	src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
#	src/main/java/com/jsh/erp/service/impl/DepotHeadServiceImpl.java
#	src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
#	src/main/resources/mapper_xml/DepotItemMapper.xml
#	src/main/resources/mapper_xml/DepotItemMapperEx.xml
yangzhi 3 周之前
父節點
當前提交
82f7fbc9fc
共有 100 個文件被更改,包括 2725 次插入907 次删除
  1. 131 0
      docs/new_sql.sql
  2. 7 0
      pom.xml
  3. 21 5
      src/main/java/com/jsh/erp/constants/ExceptionConstants.java
  4. 5 3
      src/main/java/com/jsh/erp/controller/DepotHeadController.java
  5. 199 37
      src/main/java/com/jsh/erp/controller/DepotItemController.java
  6. 2 2
      src/main/java/com/jsh/erp/controller/MaterialCategoryController.java
  7. 333 150
      src/main/java/com/jsh/erp/controller/MaterialController.java
  8. 75 51
      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. 18 34
      src/main/java/com/jsh/erp/controller/UnitController.java
  12. 74 0
      src/main/java/com/jsh/erp/controller/audit/AuditController.java
  13. 77 0
      src/main/java/com/jsh/erp/controller/audit/AuditProcessController.java
  14. 90 28
      src/main/java/com/jsh/erp/controller/pda/PdaController.java
  15. 18 0
      src/main/java/com/jsh/erp/controller/stocktaking/StocktakingController.java
  16. 18 0
      src/main/java/com/jsh/erp/datasource/dto/AuditDTO.java
  17. 19 0
      src/main/java/com/jsh/erp/datasource/dto/AuditProcessDTO.java
  18. 12 0
      src/main/java/com/jsh/erp/datasource/dto/AuditProcessQueryDTO.java
  19. 31 0
      src/main/java/com/jsh/erp/datasource/dto/AuditQueryDTO.java
  20. 2 6
      src/main/java/com/jsh/erp/datasource/dto/DepotHeadDTO.java
  21. 26 0
      src/main/java/com/jsh/erp/datasource/dto/DepotItemDTO.java
  22. 7 4
      src/main/java/com/jsh/erp/datasource/dto/MaterialDTO.java
  23. 23 0
      src/main/java/com/jsh/erp/datasource/dto/MaterialExtendDTO.java
  24. 9 0
      src/main/java/com/jsh/erp/datasource/dto/MaterialInputDto.java
  25. 2 4
      src/main/java/com/jsh/erp/datasource/dto/MaterialQueryDTO.java
  26. 46 0
      src/main/java/com/jsh/erp/datasource/entities/Audit.java
  27. 50 0
      src/main/java/com/jsh/erp/datasource/entities/AuditNode.java
  28. 44 0
      src/main/java/com/jsh/erp/datasource/entities/AuditNodeConfig.java
  29. 2 2
      src/main/java/com/jsh/erp/datasource/entities/AuditProcess.java
  30. 13 3
      src/main/java/com/jsh/erp/datasource/entities/DepotHead.java
  31. 56 18
      src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
  32. 35 42
      src/main/java/com/jsh/erp/datasource/entities/Material.java
  33. 38 18
      src/main/java/com/jsh/erp/datasource/entities/MaterialExtend.java
  34. 0 60
      src/main/java/com/jsh/erp/datasource/entities/MaterialInitialStock.java
  35. 70 0
      src/main/java/com/jsh/erp/datasource/entities/MaterialInput.java
  36. 37 0
      src/main/java/com/jsh/erp/datasource/entities/MaterialUnit.java
  37. 33 0
      src/main/java/com/jsh/erp/datasource/entities/MaterialUpc.java
  38. 39 28
      src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
  39. 14 7
      src/main/java/com/jsh/erp/datasource/entities/Msg.java
  40. 22 6
      src/main/java/com/jsh/erp/datasource/entities/Unit.java
  41. 38 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditMapper.java
  42. 22 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditNodeConfigMapper.java
  43. 18 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditNodeMapper.java
  44. 12 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditProcessMapper.java
  45. 7 0
      src/main/java/com/jsh/erp/datasource/mappers/DepotHeadMapper.java
  46. 2 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialCategoryMapper.java
  47. 2 1
      src/main/java/com/jsh/erp/datasource/mappers/MaterialCategoryMapperEx.java
  48. 1 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialCurrentStockMapperEx.java
  49. 5 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialExtendMapper.java
  50. 6 2
      src/main/java/com/jsh/erp/datasource/mappers/MaterialExtendMapperEx.java
  51. 1 1
      src/main/java/com/jsh/erp/datasource/mappers/MaterialInitialStockMapper.java
  52. 1 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialInitialStockMapperEx.java
  53. 8 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialInputMapper.java
  54. 5 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java
  55. 37 3
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
  56. 9 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialUnitMapper.java
  57. 7 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialUpcMapper.java
  58. 6 1
      src/main/java/com/jsh/erp/datasource/mappers/MsgMapper.java
  59. 10 1
      src/main/java/com/jsh/erp/datasource/mappers/OrgaUserRelMapperEx.java
  60. 2 1
      src/main/java/com/jsh/erp/datasource/mappers/UnitMapper.java
  61. 2 0
      src/main/java/com/jsh/erp/datasource/mappers/UserMapper.java
  62. 4 0
      src/main/java/com/jsh/erp/datasource/pda/dto/PDADepotHeadDTO.java
  63. 15 0
      src/main/java/com/jsh/erp/datasource/pda/dto/PDAGoodsInputDTO.java
  64. 3 0
      src/main/java/com/jsh/erp/datasource/pda/dto/PDATaskStocktakingItemDTO.java
  65. 12 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotHeadVO.java
  66. 3 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDADepotItemVO.java
  67. 45 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDAMaterialVo.java
  68. 25 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDAMsgListVO.java
  69. 28 0
      src/main/java/com/jsh/erp/datasource/pda/vo/PDAMsgVO.java
  70. 13 0
      src/main/java/com/jsh/erp/datasource/vo/AuditNodeConfigVo.java
  71. 13 0
      src/main/java/com/jsh/erp/datasource/vo/AuditNodeVo.java
  72. 19 0
      src/main/java/com/jsh/erp/datasource/vo/AuditProcessVo.java
  73. 31 0
      src/main/java/com/jsh/erp/datasource/vo/AuditVo.java
  74. 36 0
      src/main/java/com/jsh/erp/datasource/vo/MaterialAndExtendVo.java
  75. 1 1
      src/main/java/com/jsh/erp/datasource/vo/MaterialExcelVo.java
  76. 20 0
      src/main/java/com/jsh/erp/datasource/vo/MaterialExtendVo.java
  77. 2 2
      src/main/java/com/jsh/erp/datasource/vo/TaskStocktakingItemVO.java
  78. 2 0
      src/main/java/com/jsh/erp/exception/GlobalExceptionHandler.java
  79. 30 0
      src/main/java/com/jsh/erp/service/AuditProcessService.java
  80. 67 0
      src/main/java/com/jsh/erp/service/AuditService.java
  81. 36 9
      src/main/java/com/jsh/erp/service/DepotHeadService.java
  82. 23 8
      src/main/java/com/jsh/erp/service/DepotItemService.java
  83. 13 4
      src/main/java/com/jsh/erp/service/DepotService.java
  84. 1 1
      src/main/java/com/jsh/erp/service/LogService.java
  85. 10 7
      src/main/java/com/jsh/erp/service/MaterialBatchService.java
  86. 15 10
      src/main/java/com/jsh/erp/service/MaterialCategoryService.java
  87. 58 6
      src/main/java/com/jsh/erp/service/MaterialExtendService.java
  88. 27 0
      src/main/java/com/jsh/erp/service/MaterialInputService.java
  89. 116 38
      src/main/java/com/jsh/erp/service/MaterialService.java
  90. 26 0
      src/main/java/com/jsh/erp/service/MaterialUnitService.java
  91. 21 0
      src/main/java/com/jsh/erp/service/MaterialUpcService.java
  92. 22 286
      src/main/java/com/jsh/erp/service/MsgService.java
  93. 11 1
      src/main/java/com/jsh/erp/service/OrgaUserRelService.java
  94. 1 1
      src/main/java/com/jsh/erp/service/OrganizationService.java
  95. 1 1
      src/main/java/com/jsh/erp/service/SequenceService.java
  96. 5 2
      src/main/java/com/jsh/erp/service/SerialNumberService.java
  97. 5 1
      src/main/java/com/jsh/erp/service/SupplierService.java
  98. 2 2
      src/main/java/com/jsh/erp/service/SyncTescoSystemService.java
  99. 8 8
      src/main/java/com/jsh/erp/service/SystemConfigService.java
  100. 11 0
      src/main/java/com/jsh/erp/service/TaskStocktakingService.java

+ 131 - 0
docs/new_sql.sql

@@ -249,7 +249,138 @@ ALTER TABLE material_batch
 -- 2025-05-21 编号表添加供应商编号
 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 '颜色',
+  ADD COLUMN weight DECIMAL(24,2) DEFAULT NULL COMMENT '基础重量(kg)',
+  ADD COLUMN model VARCHAR(100) DEFAULT NULL COMMENT '型号',
+  ADD COLUMN enabled TINYINT DEFAULT 1 COMMENT '启用 0-禁用  1-启用';
+
+-- 商品表 系统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 '主键',
+  `material_extend_id` BIGINT DEFAULT NULL COMMENT '商品拓展id',
+  `upc` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT 'upc值',
+  `default_flag` TINYINT DEFAULT NULL COMMENT '是否默认',
+  `delete_flag`  TINYINT DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='商品UPC表';
+
+-- 商品单位表
+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',
+  `ratio` INT DEFAULT 1 COMMENT '单位比例',
+  `name` varchar(50) DEFAULT NULL COMMENT '名称',
+  `delete_flag`  TINYINT DEFAULT 0 COMMENT '删除标记,0未删除,1删除',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='商品单位表';
+
+-- 2025-05-28
+-- 审核流程表
+DROP TABLE IF EXISTS `audit_process`;
+CREATE TABLE `audit_process` (
+  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `name` varchar(100) DEFAULT NULL COMMENT '流程名称',
+  `type` varchar(20) DEFAULT NULL COMMENT '流程类型',
+  `description` varchar(500) DEFAULT NULL COMMENT '流程描述',
+  `enable` TINYINT DEFAULT 1 COMMENT '是否启用(1启用,0停用)',
+  `create_by` BIGINT DEFAULT NULL COMMENT '创建人',
+  `create_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `update_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_config`;
+CREATE TABLE `audit_node_config` (
+  `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `process_id` BIGINT DEFAULT NULL COMMENT '流程ID',
+  `name` VARCHAR(100) DEFAULT NULL COMMENT '节点名称',
+  `node_order` INT DEFAULT NULL COMMENT '节点顺序',
+  `auditor_type` INT DEFAULT NULL COMMENT '审批人类型(1:指定用户 2:上级部门最高领导审核 3:部门最高领导审核)',
+  `auditor` BIGINT 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='审核节点配置表';
+
+-- 审核实例表
+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>

+ 21 - 5
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行默认采购价不存在";
@@ -479,7 +479,7 @@ public class ExceptionConstants {
     //单据录入-单据最新状态不能进行批量操作
     public static final int DEPOT_ITEM_EXIST_NEW_STATUS_FAILED_CODE = 8500030;
     public static final String DEPOT_ITEM_EXIST_NEW_STATUS_FAILED_MSG = "抱歉,单据:%s最新状态不能进行批量操作";
-
+    //单据录入-单据不存在
     public static final int DEPOT_HEAD_NOT_EXIST_CODE = 8500031;
     public static final String DEPOT_HEAD_NOT_EXIST_MSG = "抱歉,单据不存在";
 
@@ -512,10 +512,12 @@ public class ExceptionConstants {
     //原关联单据已被修改,请重新关联
     public static final int DEPOT_ITEM_PRE_BILL_IS_CHANGE_CODE = 9000007;
     public static final String DEPOT_ITEM_PRE_BILL_IS_CHANGE_MSG = "抱歉,原关联单据已被修改,请重新关联";
-
     //单据明细-明细中生产日期格式错误
     public static final int DEPOT_ITEM_PRODUCTION_DATE_TIME_CODE = 9000008;
     public static final String DEPOT_ITEM_PRODUCTION_DATE_TIME_MSG = "抱歉,第%s行生产日期格式错误";
+    //单据明细-明细中商品条码未填写
+    public static final int DEPOT_ITEM_BARCODE_EMPTY_CODE = 9000009;
+    public static final String DEPOT_ITEM_BARCODE_EMPTY_MSG = "第%s行条码为空";
 
     /**
      *  财务信息
@@ -613,6 +615,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

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

@@ -2,12 +2,17 @@ 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;
 import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
 import com.jsh.erp.datasource.vo.DepotHeadVo4InOutMCount;
 import com.jsh.erp.datasource.vo.DepotHeadVo4List;
@@ -467,9 +472,6 @@ public class DepotHeadController extends BaseController {
 
     /**
      * 根据编号查询单据信息
-     * @param number
-     * @param request
-     * @return
      */
     @GetMapping(value = "/getDetailByNumber")
     @ApiOperation(value = "根据编号查询单据信息")

+ 199 - 37
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -2,6 +2,7 @@ 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.constants.BusinessConstants;
 import com.jsh.erp.constants.ExceptionConstants;
 import com.jsh.erp.datasource.entities.*;
@@ -65,6 +66,11 @@ public class DepotItemController {
     @Resource
     private SystemConfigService systemConfigService;
 
+    @Resource
+    private MaterialUnitService materialUnitService;
+    @Resource
+    private MaterialExtendService materialExtendService;
+
     @Value(value="${file.uploadType}")
     private Long fileUploadType;
 
@@ -132,19 +138,18 @@ public class DepotItemController {
     }
 
     /**
-     * 根据商品条码和仓库id查询库存数量
+     * 根据商品sku和仓库id查询库存数量
      * @param depotId
      * @param barCode
      * @param request
      * @return
      * @throws Exception
      */
-    @GetMapping(value = "/findStockByDepotAndBarCode")
+    @GetMapping(value = "/findStockByDepotAndSku")
     @ApiOperation(value = "根据商品条码和仓库id查询库存数量")
-    public BaseResponseInfo findStockByDepotAndBarCode(
-            @RequestParam(value = "depotId",required = false) Long depotId,
-            @RequestParam("barCode") String barCode,
-            HttpServletRequest request) throws Exception{
+    public BaseResponseInfo findStockByDepotAndBarCode(@RequestParam(value = "depotId",required = false) Long depotId,
+                                                       @RequestParam("sku") String barCode,
+                                                       HttpServletRequest request) throws Exception{
         BaseResponseInfo res = new BaseResponseInfo();
         Map<String, Object> map = new HashMap<String, Object>();
         try {
@@ -153,9 +158,9 @@ public class DepotItemController {
             List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
             if(list!=null && list.size()>0) {
                 MaterialVo4Unit materialVo4Unit = list.get(0);
-                if(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
-                    stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
-                } else {
+//                if(StringUtil.isNotEmpty(materialVo4Unit.getSku())){
+//                    stock = depotItemService.getSkuStockByParam(depotId,materialVo4Unit.getMeId(),null,null);
+//                } else {
                     stock = depotItemService.getCurrentStockByParam(depotId, materialVo4Unit.getId());
                     if(materialVo4Unit.getUnitId()!=null) {
                         Unit unit = unitService.getUnit(materialVo4Unit.getUnitId());
@@ -163,7 +168,7 @@ public class DepotItemController {
                         stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
                     }
                     position = materialService.getPositionByDidAndMid(depotId,materialVo4Unit.getId());
-                }
+//                }
             }
             map.put("stock", stock);
             map.put("position", position);
@@ -178,20 +183,157 @@ public class DepotItemController {
     }
 
     /**
-     * 单据明细列表
-     * @param headerId
-     * @param mpList
-     * @param request
-     * @return
-     * @throws Exception
+     * 根据单据主表id获取单据明细列表
+     */
+//    @GetMapping(value = "/getDetailList")
+//    @ApiOperation(value = "单据明细列表")
+//    public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
+//                              @RequestParam("mpList") String mpList,
+//                              @RequestParam(value = "linkType", required = false) String linkType,
+//                              @RequestParam(value = "isReadOnly", required = false) String isReadOnly,
+//                              HttpServletRequest request)throws Exception {
+//        BaseResponseInfo res = new BaseResponseInfo();
+//        try {
+//            Long userId = userService.getUserId(request);
+//            String priceLimit = userService.getRoleTypeByUserId(userId).getPriceLimit();
+//            List<DepotItemVo4WithInfoEx> dataList = new ArrayList<>();
+//            String billCategory = depotHeadService.getBillCategory(depotHeadService.getDepotHead(headerId).getSubType());
+//            if(headerId != 0) {
+//                dataList = depotItemService.getDetailList(headerId);
+//            }
+//            String[] mpArr = mpList.split(",");
+//            JSONObject outer = new JSONObject();
+//            outer.put("total", dataList.size());
+//            //存放数据json数组
+//            JSONArray dataArray = new JSONArray();
+//            if (null != dataList) {
+//                BigDecimal totalOperNumber = BigDecimal.ZERO;
+//                BigDecimal totalAllPrice = BigDecimal.ZERO;
+//                BigDecimal totalTaxMoney = BigDecimal.ZERO;
+//                BigDecimal totalTaxLastMoney = BigDecimal.ZERO;
+//                BigDecimal totalWeight = BigDecimal.ZERO;
+//                for (DepotItemVo4WithInfoEx diEx : dataList) {
+//                    JSONObject item = new JSONObject();
+//                    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("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 {
+//                        stock = depotItemService.getCurrentStockByParam(diEx.getDepotId(),diEx.getMaterialId());
+//                        if (StringUtil.isNotEmpty(unitInfo.getName())) {
+//                            stock = unitService.parseStockByUnit(stock, unitInfo, materialUnit);
+//                        }
+//                    }
+//                    item.put("stock", stock);
+//                    item.put("unit", diEx.getMaterialUnit());
+//                    item.put("snList", diEx.getSnList());
+//                    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("operNumber", diEx.getOperNumber());
+//                    item.put("basicNumber", diEx.getBasicNumber());
+//                    item.put("preNumber", diEx.getOperNumber()); //原数量
+//                    item.put("finishNumber", depotItemService.getFinishNumber(diEx.getMaterialExtendId(), diEx.getId(), diEx.getHeaderId(), unitInfo, materialUnit, linkType)); //已入库|已出库
+//                    item.put("purchaseDecimal", roleService.parseBillPriceByLimit(diEx.getPurchaseDecimal(), billCategory, priceLimit, request));  //采购价
+//                    if("basic".equals(linkType) || "1".equals(isReadOnly)) {
+//                        //正常情况显示金额,而以销定购的情况不能显示金额
+//                        item.put("unitPrice", roleService.parseBillPriceByLimit(diEx.getUnitPrice(), billCategory, priceLimit, request));
+//                        item.put("taxUnitPrice", roleService.parseBillPriceByLimit(diEx.getTaxUnitPrice(), billCategory, priceLimit, request));
+//                        item.put("allPrice", roleService.parseBillPriceByLimit(diEx.getAllPrice(), billCategory, priceLimit, request));
+//                        item.put("taxRate", roleService.parseBillPriceByLimit(diEx.getTaxRate(), billCategory, priceLimit, request));
+//                        item.put("taxMoney", roleService.parseBillPriceByLimit(diEx.getTaxMoney(), billCategory, priceLimit, request));
+//                        item.put("taxLastMoney", roleService.parseBillPriceByLimit(diEx.getTaxLastMoney(), billCategory, priceLimit, request));
+//                    }
+//                    BigDecimal allWeight = diEx.getBasicNumber()==null||diEx.getWeight()==null?BigDecimal.ZERO:diEx.getBasicNumber().multiply(diEx.getWeight());
+//                    item.put("weight", allWeight);
+//                    item.put("position", diEx.getPosition());
+//                    item.put("remark", diEx.getRemark());
+//                    item.put("imgName", diEx.getImgName());
+//                    if(fileUploadType == 2) {
+//                        item.put("imgSmall", "small");
+//                        item.put("imgLarge", "large");
+//                    } else {
+//                        item.put("imgSmall", "");
+//                        item.put("imgLarge", "");
+//                    }
+//                    item.put("linkId", diEx.getLinkId());
+//                    item.put("depotId", diEx.getDepotId() == null ? "" : diEx.getDepotId());
+//                    item.put("depotName", diEx.getDepotId() == null ? "" : diEx.getDepotName());
+//                    item.put("anotherDepotId", diEx.getAnotherDepotId() == null ? "" : diEx.getAnotherDepotId());
+//                    item.put("anotherDepotName", diEx.getAnotherDepotId() == null ? "" : diEx.getAnotherDepotName());
+//                    item.put("mType", diEx.getMaterialType());
+//                    item.put("op", 1);
+//                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",diEx.getProductionDate());
+//                    item.put("productionDate",productionDate);
+//                    item.put("expiryNum",diEx.getExpiryNum());
+//                    item.put("supplierId",diEx.getSupplierId());
+//                    item.put("batchNumber",diEx.getBatchNumber());
+//                    item.put("inventory",materialService.getMaterialStockByMid(diEx.getMaterialId()));
+//                    item.put("supplierName",diEx.getSupplierName());
+//                    item.put("unitId",diEx.getUnitId());
+//                    item.put("unitList",diEx.getUnitId() == null ? null : unitService.getUnitListByID(diEx.getUnitId()));
+//                    item.put("unitName", diEx.getUnitName());
+//                    item.put("actualQuantityInStorage",diEx.getActualQuantityInStorage());
+//                    item.put("warehousingVariance",diEx.getWarehousingVariance());
+//                    item.put("reasonOfDifference",diEx.getReasonOfDifference());
+//                    item.put("warehousingUser",diEx.getWarehousingUser());
+//                    item.put("warehousingTime",diEx.getWarehousingTime());
+//                    item.put("warehousingUserName",diEx.getWarehousingUserName());
+//                    item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
+//                    item.put("defaultPurchaseDecimal",diEx.getDefaultPurchaseDecimal());
+//                    item.put("defaultWholesaleDecimal",diEx.getDefaultWholesaleDecimal());
+//                    dataArray.add(item);
+//                    //合计数据汇总
+//                    totalOperNumber = totalOperNumber.add(diEx.getOperNumber()==null?BigDecimal.ZERO:diEx.getOperNumber());
+//                    totalAllPrice = totalAllPrice.add(diEx.getAllPrice()==null?BigDecimal.ZERO:diEx.getAllPrice());
+//                    totalTaxMoney = totalTaxMoney.add(diEx.getTaxMoney()==null?BigDecimal.ZERO:diEx.getTaxMoney());
+//                    totalTaxLastMoney = totalTaxLastMoney.add(diEx.getTaxLastMoney()==null?BigDecimal.ZERO:diEx.getTaxLastMoney());
+//                    totalWeight = totalWeight.add(allWeight);
+//                }
+//                if(StringUtil.isNotEmpty(isReadOnly) && "1".equals(isReadOnly)) {
+//                    JSONObject footItem = new JSONObject();
+//                    footItem.put("operNumber", totalOperNumber);
+//                    footItem.put("allPrice", roleService.parseBillPriceByLimit(totalAllPrice, billCategory, priceLimit, request));
+//                    footItem.put("taxMoney", roleService.parseBillPriceByLimit(totalTaxMoney, billCategory, priceLimit, request));
+//                    footItem.put("taxLastMoney", roleService.parseBillPriceByLimit(totalTaxLastMoney, billCategory, priceLimit, request));
+//                    footItem.put("weight", totalWeight);
+//                    dataArray.add(footItem);
+//                }
+//            }
+//            outer.put("rows", dataArray);
+//            res.code = 200;
+//            res.data = outer;
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(), e);
+//            res.code = 500;
+//            res.data = "获取数据失败";
+//        }
+//        return res;
+//    }
+
+    /**
+     * 根据单据主表id获取单据明细列表
      */
     @GetMapping(value = "/getDetailList")
     @ApiOperation(value = "单据明细列表")
     public BaseResponseInfo getDetailList(@RequestParam("headerId") Long headerId,
-                              @RequestParam("mpList") String mpList,
-                              @RequestParam(value = "linkType", required = false) String linkType,
-                              @RequestParam(value = "isReadOnly", required = false) String isReadOnly,
-                              HttpServletRequest request)throws Exception {
+                                    @RequestParam("mpList") String mpList,
+                                    @RequestParam(value = "linkType", required = false) String linkType,
+                                    @RequestParam(value = "isReadOnly", required = false) String isReadOnly,
+                                    HttpServletRequest request) {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
             Long userId = userService.getUserId(request);
@@ -213,20 +355,30 @@ public class DepotItemController {
                 BigDecimal totalTaxLastMoney = BigDecimal.ZERO;
                 BigDecimal totalWeight = BigDecimal.ZERO;
                 for (DepotItemVo4WithInfoEx diEx : dataList) {
+                    //包装规格
+                    diEx.setUnitName(materialUnitService.getStandardByMeId(diEx.getMaterialExtendId()));
+                    //拓展信息
+                    diEx.setMaterialOther(depotItemService.getOtherInfo(mpArr, diEx));
+                    //库存
+                    diEx.setStock(materialService.getMaterialStockByMid(diEx.getMaterialId()));
+                    //原数量
+                    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("barCode", diEx.getBarCode());
+//                    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("mfrs", diEx.getMMfrs());
+//                    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 {
@@ -238,11 +390,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()); //原数量
@@ -276,7 +428,7 @@ public class DepotItemController {
                     item.put("anotherDepotName", diEx.getAnotherDepotId() == null ? "" : diEx.getAnotherDepotName());
                     item.put("mType", diEx.getMaterialType());
                     item.put("op", 1);
-                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd",diEx.getProductionDate());
+                    String productionDate = diEx.getProductionDate() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",diEx.getProductionDate());
                     item.put("productionDate",productionDate);
                     item.put("expiryNum",diEx.getExpiryNum());
                     item.put("supplierId",diEx.getSupplierId());
@@ -290,13 +442,12 @@ public class DepotItemController {
                     item.put("warehousingVariance",diEx.getWarehousingVariance());
                     item.put("reasonOfDifference",diEx.getReasonOfDifference());
                     item.put("warehousingUser",diEx.getWarehousingUser());
-                    item.put("warehousingTime",diEx.getWarehousingTime() == null ? null : DateUtils.parseDateToStr("yyyy-MM-dd",diEx.getWarehousingTime()));
+                    item.put("warehousingTime",diEx.getWarehousingTime());
                     item.put("warehousingUserName",diEx.getWarehousingUserName());
                     item.put("wholesaleDecimal",diEx.getWholesaleDecimal());
                     item.put("defaultPurchaseDecimal",diEx.getDefaultPurchaseDecimal());
                     item.put("defaultWholesaleDecimal",diEx.getDefaultWholesaleDecimal());
-                    item.put("ratio",diEx.getRatio());
-                    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());
@@ -1030,13 +1181,24 @@ public class DepotItemController {
                 List<Map<String, String>> detailList = new ArrayList<>();
                 for (int i = 2; i < src.getRows(); i++) {
                     String depotName = "", barCode = "",productionDate = "", num = "", unitPrice = "", taxRate = "", remark = "";
+                    barCode = ExcelUtils.getContent(src, i, 0);
+                    if (StringUtil.isEmpty(barCode)){
+                        throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_EMPTY_CODE,
+                                String.format(ExceptionConstants.DEPOT_ITEM_BARCODE_EMPTY_MSG, barCode));
+                    }
+                    String sku = materialExtendService.getSkuByUpc(barCode);
+                    if (StringUtil.isEmpty(sku)){
+                        throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_CODE,
+                                String.format(ExceptionConstants.DEPOT_ITEM_BARCODE_IS_NOT_EXIST_MSG, barCode));
+                    }
+                    barCode = sku;
                     if("QGD".equals(prefixNo)) {
-                        barCode = ExcelUtils.getContent(src, i, 0);
+                        //barCode = ExcelUtils.getContent(src, i, 0);
                         num = ExcelUtils.getContent(src, i, 2);
                         remark = ExcelUtils.getContent(src, i, 3);
                     }
                     if("CGDD".equals(prefixNo) || "XSDD".equals(prefixNo)) {
-                        barCode = ExcelUtils.getContent(src, i, 0);
+                        //barCode = ExcelUtils.getContent(src, i, 0);
                         num = ExcelUtils.getContent(src, i, 2);
                         unitPrice = ExcelUtils.getContent(src, i, 3);
                         taxRate = ExcelUtils.getContent(src, i, 4);
@@ -1045,7 +1207,7 @@ public class DepotItemController {
                     if("CGRK".equals(prefixNo)) {
                         //采购入库
                         depotName = ExcelUtils.getContent(src, i, 0);
-                        barCode = ExcelUtils.getContent(src, i, 1);
+                        //barCode = ExcelUtils.getContent(src, i, 1);
                         productionDate = ExcelUtils.getContent(src, i, 3);
                         String format = "yyyy-MM-dd";
                         //校验日期格式
@@ -1061,7 +1223,7 @@ public class DepotItemController {
                     if("QTRK".equals(prefixNo)) {
                         //其他入库
                         depotName = ExcelUtils.getContent(src, i, 0);
-                        barCode = ExcelUtils.getContent(src, i, 1);
+                        //barCode = ExcelUtils.getContent(src, i, 1);
                         productionDate = ExcelUtils.getContent(src, i, 3);
                         String format = "yyyy-MM-dd";
                         //校验日期格式
@@ -1075,7 +1237,7 @@ public class DepotItemController {
                     }
                     if("XSCK".equals(prefixNo)) {
                         depotName = ExcelUtils.getContent(src, i, 0);
-                        barCode = ExcelUtils.getContent(src, i, 1);
+                        //barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
                         unitPrice = ExcelUtils.getContent(src, i, 4);
                         taxRate = ExcelUtils.getContent(src, i, 5);
@@ -1083,14 +1245,14 @@ public class DepotItemController {
                     }
                     if("QTCK".equals(prefixNo)) {
                         depotName = ExcelUtils.getContent(src, i, 0);
-                        barCode = ExcelUtils.getContent(src, i, 1);
+                        //barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
                         unitPrice = ExcelUtils.getContent(src, i, 4);
                         remark = ExcelUtils.getContent(src, i, 5);
                     }
                     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);
     }

+ 333 - 150
src/main/java/com/jsh/erp/controller/MaterialController.java

@@ -2,9 +2,10 @@ 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.base.BaseController;
 import com.jsh.erp.base.TableDataInfo;
-import com.jsh.erp.datasource.dto.MaterialDto;
+import com.jsh.erp.datasource.dto.MaterialDTO;
 import com.jsh.erp.datasource.entities.*;
 import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
 import com.jsh.erp.service.*;
@@ -56,16 +57,18 @@ public class MaterialController extends BaseController {
     @Resource
     private MaterialBatchService materialBatchService;
 
-    @Value(value="${file.uploadType}")
+    @Resource
+    private MaterialUnitService materialUnitService;
+
+    @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 {
@@ -73,50 +76,46 @@ public class MaterialController extends BaseController {
         }
     }
 
+    //商品信息 - 列表
     @GetMapping(value = "/list")
     @ApiOperation(value = "获取信息列表")
-    public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search)throws Exception {
+    public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search) {
         String categoryId = StringUtil.getInfo(search, "categoryId");
         String materialParam = StringUtil.getInfo(search, "materialParam");
         String standard = StringUtil.getInfo(search, "standard");
         String model = StringUtil.getInfo(search, "model");
         String color = StringUtil.getInfo(search, "color");
         String brand = StringUtil.getInfo(search, "brand");
-        String mfrs = StringUtil.getInfo(search, "mfrs");
         String materialOther = StringUtil.getInfo(search, "materialOther");
         String weight = StringUtil.getInfo(search, "weight");
         String expiryNum = StringUtil.getInfo(search, "expiryNum");
         String enableSerialNumber = StringUtil.getInfo(search, "enableSerialNumber");
-        String enableBatchNumber = StringUtil.getInfo(search, "enableBatchNumber");
-        String position = StringUtil.getInfo(search, "position");
         String enabled = StringUtil.getInfo(search, "enabled");
         String remark = StringUtil.getInfo(search, "remark");
         String mpList = StringUtil.getInfo(search, "mpList");
         String reminder = StringUtil.getInfo(search, "reminder");
-        List<MaterialVo4Unit> list = materialService.select(materialParam, standard, model, color, brand, mfrs, materialOther, weight, expiryNum,
-                enableSerialNumber, enableBatchNumber, position, enabled, remark, categoryId, mpList, reminder);
+        List<MaterialVo4Unit> list = materialService.select(materialParam, standard, model, color, brand, materialOther, weight, expiryNum,
+                enableSerialNumber, enabled, remark, categoryId, mpList, reminder);
         return getDataTable(list);
     }
 
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增")
-    public String addResource(@RequestBody MaterialDto obj, HttpServletRequest request)throws Exception {
-        Map<String, Object> objectMap = new HashMap<>();
-        int insert = materialService.insertMaterial(obj, request);
-        return returnStr(objectMap, insert);
+    public AjaxResult addResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request) throws Exception {
+        materialService.insertMaterial(materialDTO, request);
+        return AjaxResult.success();
     }
 
     @PutMapping(value = "/update")
     @ApiOperation(value = "修改")
-    public String updateResource(@RequestBody MaterialDto obj, HttpServletRequest request)throws Exception {
-        Map<String, Object> objectMap = new HashMap<>();
-        int update = materialService.updateMaterial(obj, request);
-        return returnStr(objectMap, update);
+    public AjaxResult updateResource(@RequestBody MaterialDTO materialDTO, HttpServletRequest request) throws Exception {
+        materialService.updateMaterial(materialDTO, request);
+        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);
@@ -124,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);
@@ -132,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);
@@ -146,6 +145,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 检查商品是否存在
+     *
      * @param id
      * @param name
      * @param model
@@ -167,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);
@@ -183,6 +183,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量设置状态-启用或者禁用
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -191,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);
@@ -205,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 = "获取数据失败";
@@ -227,6 +229,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据meId来查询商品名称
+     *
      * @param meId
      * @param request
      * @return
@@ -235,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 = "获取数据失败";
@@ -257,6 +260,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据关键词查找商品信息-条码、名称、规格、型号
+     *
      * @param q
      * @param request
      * @return
@@ -264,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);
@@ -284,40 +288,160 @@ public class MaterialController extends BaseController {
      * @param request
      * @return
      */
+//    @GetMapping(value = "/findBySelect")
+//    @ApiOperation(value = "查找商品信息")
+//    public JSONObject findBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
+//                                  @RequestParam(value = "q", required = false) String q,
+//                                  @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
+//                                  @RequestParam(value = "mpList", required = false) String mpList,
+//                                  @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,
+//                                  @RequestParam("page") Integer currentPage,
+//                                  @RequestParam("rows") Integer pageSize,
+//                                  HttpServletRequest request) throws Exception{
+//        JSONObject object = new JSONObject();
+//        try {
+//            String[] mpArr = new String[]{};
+//            if(StringUtil.isNotEmpty(mpList)){
+//                mpArr= mpList.split(",");
+//            }
+//            List<MaterialVo4Unit> dataList = materialService.findBySelectWithBarCode(categoryId, q, StringUtil.toNull(standardOrModel),
+//                    StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,
+//                    (currentPage-1)*pageSize, pageSize,depotId);
+//            int total = materialService.findBySelectWithBarCodeCount(categoryId, q, StringUtil.toNull(standardOrModel),
+//                    StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,depotId);
+//            object.put("total", total);
+//            JSONArray dataArray = new JSONArray();
+//            //存放数据json数组
+//            if (null != dataList) {
+//                for (MaterialVo4Unit material : dataList) {
+//                    JSONObject item = new JSONObject();
+//                    item.put("id", material.getMeId()); //商品扩展表的id
+//                    item.put("mid", material.getId()); //商品扩展表的id
+//                    String ratioStr = ""; //比例
+//                    Unit unit = new Unit();
+//                    BigDecimal ratio = new BigDecimal("1");
+//                    if (material.getUnitId() == null) {
+//                        ratioStr = "";
+//                    } else {
+//                        unit = unitService.getUnit(material.getUnitId());
+//                        //拼接副单位的比例
+//                        String commodityUnit = material.getCommodityUnit();
+//                        if(commodityUnit.equals(unit.getBasicUnit())) {
+//                            ratioStr = "[基本]";
+//                            ratio = new BigDecimal("1");
+//                        }
+//                        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) {
+//                            ratioStr = "[" + unit.getRatioTwo().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
+//                            ratio = unit.getRatioTwo();
+//                        }
+//                        if(commodityUnit.equals(unit.getOtherUnitThree()) && unit.getRatioThree()!=null) {
+//                            ratioStr = "[" + unit.getRatioThree().stripTrailingZeros().toPlainString() + unit.getBasicUnit() + "]";
+//                            ratio = unit.getRatioThree();
+//                        }
+//                    }
+//                    item.put("barCode", material.getBarCode());
+//                    item.put("name", material.getName());
+//                    item.put("mnemonic", material.getMnemonic());
+//                    item.put("categoryName", material.getCategoryName());
+//                    item.put("standard", material.getStandard());
+//                    item.put("model", material.getModel());
+//                    item.put("color", material.getColor());
+//                    item.put("brand", material.getBrand());
+//                    //item.put("mfrs", material.getMfrs());
+//                    item.put("unit", material.getCommodityUnit() + ratioStr);
+//                    item.put("sku", material.getSku());
+//                    item.put("enableSerialNumber", material.getEnableSerialNumber());
+//                    item.put("enableBatchNumber", material.getEnableBatchNumber());
+//                    item.put("productionDate",material.getProductionDate());
+//                    item.put("expiryNum",material.getExpiryNum());
+//                    item.put("batchNumber",material.getBatchNumber());
+//                    item.put("position",material.getPosition());
+//                    item.put("supplierId",material.getSupplierId());
+//                    item.put("supplierName",material.getSupplierName());
+//                    item.put("depotId",material.getDepotId());
+//                    item.put("depotName",material.getDepotName());
+//                    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);
+//                    } else {
+//                        stock = depotItemService.getCurrentStockByParam(depotId, material.getId());
+//                        if (material.getUnitId()!=null){
+//                            String commodityUnit = material.getCommodityUnit();
+//                            stock = unitService.parseStockByUnit(stock, unit, commodityUnit);
+//                        }
+//                    }
+//                    item.put("stock", stock);
+//                    item.put("expand", materialService.getMaterialOtherByParam(mpArr, material));
+//                    item.put("imgName", material.getImgName());
+//                    if(fileUploadType == 2) {
+//                        item.put("imgSmall", "small");
+//                        item.put("imgLarge", "large");
+//                    } else {
+//                        item.put("imgSmall", "");
+//                        item.put("imgLarge", "");
+//                    }
+//                    dataArray.add(item);
+//                }
+//            }
+//            object.put("rows", dataArray);
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(), e);
+//        }
+//        return object;
+//    }
+
+    /**
+     * 查找商品信息-下拉框
+     *
+     * @param mpList
+     * @param request
+     * @return
+     */
     @GetMapping(value = "/findBySelect")
     @ApiOperation(value = "查找商品信息")
     public JSONObject findBySelect(@RequestParam(value = "categoryId", required = false) Long categoryId,
-                                  @RequestParam(value = "q", required = false) String q,
-                                  @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
-                                  @RequestParam(value = "mpList", required = false) String mpList,
-                                  @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,
-                                  @RequestParam("page") Integer currentPage,
-                                  @RequestParam("rows") Integer pageSize,
-                                  HttpServletRequest request) throws Exception{
+                                   @RequestParam(value = "q", required = false) String q,
+                                   @RequestParam(value = "standardOrModel", required = false) String standardOrModel,
+                                   @RequestParam(value = "mpList", required = false) String mpList,
+                                   @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,
+                                   @RequestParam("page") Integer currentPage,
+                                   @RequestParam("rows") Integer pageSize,
+                                   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.findBySelectWithBarCode(categoryId, q, StringUtil.toNull(standardOrModel),
+            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);
-            int total = materialService.findBySelectWithBarCodeCount(categoryId, q, StringUtil.toNull(standardOrModel),
-                    StringUtil.toNull(color), StringUtil.toNull(brand), StringUtil.toNull(mfrs), enableSerialNumber, enableBatchNumber,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);
             object.put("total", total);
             JSONArray dataArray = new JSONArray();
             //存放数据json数组
             if (null != dataList) {
                 for (MaterialVo4Unit material : dataList) {
-                    JSONObject item = new JSONObject();
-                    item.put("id", material.getMeId()); //商品扩展表的id
-                    item.put("mid", material.getId()); //商品扩展表的id
+//                    JSONObject item = new JSONObject();
+//                    item.put("id", material.getMeId()); //商品扩展表的id
+//                    item.put("mid", material.getId()); //商品扩展表的id
                     String ratioStr = ""; //比例
                     Unit unit = new Unit();
                     BigDecimal ratio = new BigDecimal("1");
@@ -327,78 +451,71 @@ 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();
                         }
                     }
-                    item.put("barCode", material.getBarCode());
-                    item.put("name", material.getName());
-                    item.put("mnemonic", material.getMnemonic());
-                    item.put("categoryName", material.getCategoryName());
-                    item.put("standard", material.getStandard());
-                    item.put("model", material.getModel());
-                    item.put("color", material.getColor());
-                    item.put("brand", material.getBrand());
-                    //item.put("mfrs", material.getMfrs());
-                    item.put("unit", material.getCommodityUnit() + ratioStr);
-                    item.put("sku", material.getSku());
-                    item.put("enableSerialNumber", material.getEnableSerialNumber());
-                    item.put("enableBatchNumber", material.getEnableBatchNumber());
-                    item.put("productionDate",material.getProductionDate());
-                    item.put("expiryNum",material.getExpiryNum());
-                    item.put("batchNumber",material.getBatchNumber());
-                    item.put("position",material.getPosition());
-                    item.put("supplierId",material.getSupplierId());
-                    item.put("supplierName",material.getSupplierName());
-                    item.put("depotId",material.getDepotId());
-                    item.put("depotName",material.getDepotName());
-                    item.put("unitId",material.getUnitId());
-                    item.put("inventory",materialService.getMaterialStockByMid(material.getId()).divide(ratio,2,BigDecimal.ROUND_HALF_UP));
+//                    item.put("barCode", material.getBarCode());
+//                    item.put("name", material.getName());
+//                    item.put("mnemonic", material.getMnemonic());
+//                    item.put("categoryName", material.getCategoryName());
+//                    item.put("standard", material.getStandard());
+//                    item.put("model", material.getModel());
+//                    item.put("color", material.getColor());
+//                    item.put("brand", material.getBrand());
+//                    item.put("mfrs", material.getMfrs());
+//                    item.put("unit", material.getCommodityUnit() + ratioStr);
+                    material.setUnit(material.getCommodityUnit());
+//                    item.put("sku", material.getSku());
+//                    item.put("enableSerialNumber", material.getEnableSerialNumber());
+//                    item.put("enableBatchNumber", material.getEnableBatchNumber());
+//                    item.put("productionDate",material.getProductionDate());
+//                    item.put("expiryNum",material.getExpiryNum());
+//                    item.put("batchNumber",material.getBatchNumber());
+//                    item.put("position",material.getPosition());
+//                    item.put("supplierId",material.getSupplierId());
+//                    item.put("supplierName",material.getSupplierName());
+//                    item.put("depotId",material.getDepotId());
+//                    item.put("depotName",material.getDepotName());
+//                    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);
                         }
                     }
-                    item.put("stock", stock);
-                    item.put("expand", materialService.getMaterialOtherByParam(mpArr, material));
-                    item.put("imgName", material.getImgName());
-                    if(fileUploadType == 2) {
-                        item.put("imgSmall", "small");
-                        item.put("imgLarge", "large");
-                    } else {
-                        item.put("imgSmall", "");
-                        item.put("imgLarge", "");
-                    }
-                    dataArray.add(item);
+                    material.setStock(materialService.getMaterialStockByMid(material.getId()));
                 }
             }
-            object.put("rows", dataArray);
+            object.put("rows", dataList);
         } catch (Exception e) {
             logger.error(e.getMessage(), e);
         }
         return object;
     }
 
+
     /**
      * 根据商品id查找商品信息
+     *
      * @param meId
      * @param request
      * @return
@@ -408,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; //比例
@@ -446,6 +563,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 生成excel表格
+     *
      * @param categoryId
      * @param materialParam
      * @param color
@@ -485,6 +603,7 @@ public class MaterialController extends BaseController {
 
     /**
      * excel表格导入产品(含初始库存)
+     *
      * @param file
      * @param request
      * @param response
@@ -493,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);
@@ -505,6 +624,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 获取商品序列号
+     *
      * @param q
      * @param currentPage
      * @param pageSize
@@ -516,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);
@@ -535,6 +655,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 获取最大条码
+     *
      * @return
      * @throws Exception
      */
@@ -552,6 +673,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 商品名称模糊匹配
+     *
      * @return
      * @throws Exception
      */
@@ -575,12 +697,13 @@ public class MaterialController extends BaseController {
 
     /**
      * 根据条码查询商品信息
+     *
      * @return
      * @throws Exception
      */
     @GetMapping(value = "/getMaterialByBarCode")
     @ApiOperation(value = "根据条码查询商品信息")
-    public BaseResponseInfo getMaterialByBarCode(@RequestParam("barCode") String barCode,
+    public BaseResponseInfo getMaterialByBarCode(@RequestParam("sku") String barCode,
                                                  @RequestParam(value = "organId", required = false) Long organId,
                                                  @RequestParam(value = "depotId", required = false) Long depotId,
                                                  @RequestParam("mpList") String mpList,
@@ -597,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)) {
                         //零售价
@@ -606,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 {
                             //查询最后一单的销售价,实现不同的客户不同的销售价
@@ -622,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());
                         }
@@ -653,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 = "获取数据失败";
@@ -662,7 +785,62 @@ public class MaterialController extends BaseController {
     }
 
     /**
+     * 根据sku查询商品信息
+     *
+     * @return
+     * @throws Exception
+     */
+    @GetMapping(value = "/getMaterialBySku")
+    @ApiOperation(value = "根据sku查询商品信息")
+    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
+//                    if (depotId == null) {
+//                        JSONArray depotArr = depotService.findDepotByCurrentUser();
+//                        for (Object obj : depotArr) {
+//                            JSONObject depotObj = JSONObject.parseObject(obj.toString());
+//                            if (depotObj.get("isDefault") != null) {
+//                                Boolean isDefault = depotObj.getBoolean("isDefault");
+//                                if (isDefault) {
+//                                    Long id = depotObj.getLong("id");
+//                                    if (!"CGDD".equals(prefixNo) && !"XSDD".equals(prefixNo)) {
+//                                        //除订单之外的单据才有仓库
+//                                        mvo.setDepotId(id);
+//                                    }
+//                                    //getStockByMaterialInfo(mvo);
+//                                }
+//                            }
+//                        }
+//                    } else {
+//                        mvo.setDepotId(depotId);
+//                    }
+            }
+        }
+        return AjaxResult.success(list);
+    }
+
+    /**
      * 根据商品信息获取库存,进行赋值
+     *
      * @param mvo
      * @throws Exception
      */
@@ -683,6 +861,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 商品库存查询
+     *
      * @param currentPage
      * @param pageSize
      * @param depotIds
@@ -706,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 = "获取数据失败";
@@ -751,6 +930,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量设置商品当前的实时库存(按每个仓库)
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -759,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);
@@ -772,6 +952,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量设置商品当前的成本价
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -780,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);
@@ -793,6 +974,7 @@ public class MaterialController extends BaseController {
 
     /**
      * 批量更新商品信息
+     *
      * @param jsonObject
      * @param request
      * @return
@@ -801,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);
@@ -813,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 = "获取数据失败";
@@ -834,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);
@@ -844,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);
@@ -853,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();
@@ -863,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) {

+ 75 - 51
src/main/java/com/jsh/erp/controller/MaterialExtendController.java

@@ -1,14 +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.vo.MaterialExtendVo4List;
+import com.jsh.erp.datasource.entities.MaterialUpc;
+import com.jsh.erp.datasource.vo.MaterialExtendVo;
+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;
@@ -17,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;
@@ -35,6 +35,8 @@ public class MaterialExtendController {
     private Logger logger = LoggerFactory.getLogger(MaterialExtendController.class);
     @Resource
     private MaterialExtendService materialExtendService;
+    @Resource
+    private MaterialUpcService materialUpcService;
 
     @GetMapping(value = "/info")
     @ApiOperation(value = "根据id获取信息")
@@ -82,56 +84,65 @@ public class MaterialExtendController {
         return returnStr(objectMap, delete);
     }
 
+//    @GetMapping(value = "/getDetailList")
+//    @ApiOperation(value = "价格信息列表")
+//    public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId,
+//                                          HttpServletRequest request)throws Exception {
+//        BaseResponseInfo res = new BaseResponseInfo();
+//        try {
+//            List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>();
+//            if(materialId!=0) {
+//                dataList = materialExtendService.getDetailList(materialId);
+//            }
+//            JSONObject outer = new JSONObject();
+//            outer.put("total", dataList.size());
+//            //存放数据json数组
+//            JSONArray dataArray = new JSONArray();
+//            if (null != dataList) {
+//                for (MaterialExtendVo4List md : dataList) {
+//                    JSONObject item = new JSONObject();
+//                    item.put("id", md.getId());
+//                    item.put("barCode", md.getBarCode());
+//                    item.put("commodityUnit", md.getCommodityUnit());
+//                    if(StringUtil.isNotEmpty(md.getSku())){
+//                        item.put("sku", md.getSku());
+//                    }
+//                    item.put("purchaseDecimal", md.getPurchaseDecimal());
+//                    item.put("commodityDecimal", md.getCommodityDecimal());
+//                    item.put("wholesaleDecimal", md.getWholesaleDecimal());
+//                    item.put("lowDecimal", md.getLowDecimal());
+//                    item.put("productionDate", md.getProductionDate() == null ? "": DateUtils.dateTime(md.getProductionDate()));
+//                    item.put("expiryNum",md.getExpiryNum());
+//                    item.put("supplierId",md.getSupplierId());
+//                    item.put("barCode",md.getBarCode());
+//                    item.put("batchNumber",md.getBatchNumber());
+//                    item.put("inventory",md.getInventory());
+//                    item.put("depotId",md.getDepotId());
+//                    item.put("position",md.getPosition());
+//                    item.put("ratio",md.getRatio());
+//                    dataArray.add(item);
+//                }
+//            }
+//            outer.put("rows", dataArray);
+//            res.code = 200;
+//            res.data = outer;
+//        } catch (Exception e) {
+//            logger.error(e.getMessage(), e);
+//            res.code = 500;
+//            res.data = "获取数据失败";
+//        }
+//        return res;
+//    }
+
     @GetMapping(value = "/getDetailList")
     @ApiOperation(value = "价格信息列表")
-    public BaseResponseInfo getDetailList(@RequestParam("materialId") Long materialId,
-                                          HttpServletRequest request)throws Exception {
-        BaseResponseInfo res = new BaseResponseInfo();
-        try {
-            List<MaterialExtendVo4List> dataList = new ArrayList<MaterialExtendVo4List>();
-            if(materialId!=0) {
-                dataList = materialExtendService.getDetailList(materialId);
-            }
-            JSONObject outer = new JSONObject();
-            outer.put("total", dataList.size());
-            //存放数据json数组
-            JSONArray dataArray = new JSONArray();
-            if (null != dataList) {
-                for (MaterialExtendVo4List md : dataList) {
-                    JSONObject item = new JSONObject();
-                    item.put("id", md.getId());
-                    item.put("barCode", md.getBarCode());
-                    item.put("commodityUnit", md.getCommodityUnit());
-                    if(StringUtil.isNotEmpty(md.getSku())){
-                        item.put("sku", md.getSku());
-                    }
-                    item.put("purchaseDecimal", md.getPurchaseDecimal());
-                    item.put("commodityDecimal", md.getCommodityDecimal());
-                    item.put("wholesaleDecimal", md.getWholesaleDecimal());
-                    item.put("lowDecimal", md.getLowDecimal());
-                    item.put("productionDate", md.getProductionDate() == null ? "": DateUtils.dateTime(md.getProductionDate()));
-                    item.put("expiryNum",md.getExpiryNum());
-                    item.put("supplierId",md.getSupplierId());
-                    item.put("barCode",md.getBarCode());
-                    item.put("batchNumber",md.getBatchNumber());
-                    item.put("inventory",md.getInventory());
-                    item.put("depotId",md.getDepotId());
-                    item.put("position",md.getPosition());
-                    item.put("ratio",md.getRatio());
-                    dataArray.add(item);
-                }
-            }
-            outer.put("rows", dataArray);
-            res.code = 200;
-            res.data = outer;
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-            res.code = 500;
-            res.data = "获取数据失败";
-        }
-        return res;
+    public AjaxResult getDetailList(@RequestParam("materialId") Long materialId) {
+        List<MaterialExtendVo> list = materialExtendService.getDetailList(materialId);
+        return AjaxResult.success(list);
     }
 
+
+
     /**
      * 根据条码查询商品信息
      * @param barCode
@@ -188,4 +199,17 @@ public class MaterialExtendController {
         }
         return res;
     }
+
+    @GetMapping(value = "/checkIsUpcExist")
+    @ApiOperation(value = "检查UPC是否存在")
+    public AjaxResult checkIsNameExist(@RequestParam(value = "id", required = false) Long id,
+                                       @RequestParam("upc") String upc) {
+        MaterialUpc materialUpc = materialUpcService.getOne(new LambdaQueryWrapperX<MaterialUpc>().eq(MaterialUpc::getUpc,upc).eq(MaterialUpc::getDeleteFlag,false));
+        if(materialUpc == null) {
+            return AjaxResult.success("UPC不存在",false);
+        }else if (materialUpc != null && id != null && materialUpc.getId().equals(id)){
+            return AjaxResult.success("UPC不存在",false);
+        }
+        return AjaxResult.success("UPC已存在",true);
+    }
 }

+ 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 = "更新成功";

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

@@ -1,10 +1,10 @@
 package com.jsh.erp.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.jsh.erp.base.AjaxResult;
 import com.jsh.erp.base.BaseController;
 import com.jsh.erp.base.TableDataInfo;
 import com.jsh.erp.datasource.entities.Unit;
-import com.jsh.erp.datasource.vo.UnitListVo;
 import com.jsh.erp.service.UnitService;
 import com.jsh.erp.utils.*;
 import io.swagger.annotations.Api;
@@ -15,8 +15,6 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.math.BigDecimal;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -55,8 +53,7 @@ public class UnitController extends BaseController {
 
     @GetMapping(value = "/list")
     @ApiOperation(value = "获取信息列表")
-    public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search,
-                                 HttpServletRequest request)throws Exception {
+    public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search)throws Exception {
         String name = StringUtil.getInfo(search, "name");
         List<Unit> list = unitService.select(name);
         return getDataTable(list);
@@ -64,18 +61,17 @@ public class UnitController extends BaseController {
 
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增")
-    public String addResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
-        Map<String, Object> objectMap = new HashMap<>();
-        int insert = unitService.insertUnit(obj, request);
-        return returnStr(objectMap, insert);
+    public AjaxResult addResource(@RequestBody Unit unit, HttpServletRequest request)throws Exception {
+        int insert = unitService.insertUnit(unit, request);
+        return AjaxResult.success();
     }
 
     @PutMapping(value = "/update")
     @ApiOperation(value = "修改")
-    public String updateResource(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception {
+    public AjaxResult updateResource(@RequestBody Unit unit, HttpServletRequest request)throws Exception {
         Map<String, Object> objectMap = new HashMap<>();
-        int update = unitService.updateUnit(obj, request);
-        return returnStr(objectMap, update);
+        int update = unitService.updateUnit(unit, request);
+        return AjaxResult.success();
     }
 
     @DeleteMapping(value = "/delete")
@@ -96,30 +92,21 @@ public class UnitController extends BaseController {
 
     @GetMapping(value = "/checkIsNameExist")
     @ApiOperation(value = "检查名称是否存在")
-    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 = unitService.checkIsNameExist(id, name);
+    public AjaxResult checkIsNameExist(@RequestParam(value ="name") String name) {
+        int exist = unitService.checkIsNameExist(name);
         if(exist > 0) {
-            objectMap.put("status", true);
-        } else {
-            objectMap.put("status", false);
+           return AjaxResult.error("单位名称已存在",true);
         }
-        return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
+        return AjaxResult.success("单位名称不存在",false);
     }
 
-    /**
-     * 单位列表
-     * @param request
-     * @return
-     * @throws Exception
-     */
+
     @GetMapping(value = "/getAllList")
     @ApiOperation(value = "单位列表")
-    public BaseResponseInfo getAllList(HttpServletRequest request) throws Exception{
+    public BaseResponseInfo getAllList() {
         BaseResponseInfo res = new BaseResponseInfo();
         try {
-            List<Unit> unitList = unitService.getUnit();
+            List<Unit> unitList = unitService.unitList();
             res.code = 200;
             res.data = unitList;
         } catch(Exception e){
@@ -133,21 +120,18 @@ public class UnitController extends BaseController {
     /**
      * 批量设置状态-启用或者禁用
      * @param jsonObject
-     * @param request
      * @return
      */
     @PostMapping(value = "/batchSetStatus")
     @ApiOperation(value = "批量设置状态")
-    public String batchSetStatus(@RequestBody JSONObject jsonObject,
-                                 HttpServletRequest request)throws Exception {
+    public AjaxResult batchSetStatus(@RequestBody JSONObject jsonObject) {
         Boolean status = jsonObject.getBoolean("status");
         String ids = jsonObject.getString("ids");
-        Map<String, Object> objectMap = new HashMap<>();
         int res = unitService.batchSetStatus(status, ids);
         if(res > 0) {
-            return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
+            return AjaxResult.success();
         } else {
-            return returnJson(objectMap, ErpInfo.ERROR.name, ErpInfo.ERROR.code);
+            return AjaxResult.error();
         }
     }
 

+ 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);
+    }
+
+
+}

+ 77 - 0
src/main/java/com/jsh/erp/controller/audit/AuditProcessController.java

@@ -0,0 +1,77 @@
+package com.jsh.erp.controller.audit;
+
+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.datasource.dto.AuditProcessDTO;
+import com.jsh.erp.datasource.dto.AuditProcessQueryDTO;
+import com.jsh.erp.datasource.entities.AuditProcess;
+import com.jsh.erp.datasource.vo.AuditProcessVo;
+import com.jsh.erp.query.LambdaQueryWrapperX;
+import com.jsh.erp.service.AuditProcessService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+
+@RestController
+@RequestMapping(value = "/auditProcess")
+@Api(tags = {"审核流程接口"})
+public class AuditProcessController extends BaseController {
+
+    @Resource
+    private AuditProcessService auditProcessService;
+
+    @ApiOperation("审核流程列表")
+    @PostMapping("/list")
+    public TableDataInfo list(@RequestBody AuditProcessQueryDTO auditProcessQueryDTO){
+        List<AuditProcessVo> list = auditProcessService.listBy(auditProcessQueryDTO);
+        return getDataTable(list);
+    }
+
+    @ApiOperation("新增审核流程")
+    @PostMapping("/add")
+    public AjaxResult add(@RequestBody AuditProcessDTO auditProcessDTO) {
+        AuditProcess auditProcess = auditProcessService.getOne(new LambdaQueryWrapperX<AuditProcess>().eq(AuditProcess::getType,auditProcessDTO.getType()).eq(AuditProcess::getDeleteFlag,false));
+        if (auditProcess != null){
+            return AjaxResult.error("该类型审核流程已存在");
+        }
+        boolean b = auditProcessService.add(auditProcessDTO);
+        if (!b){
+            return AjaxResult.error("创建失败,请联系系统管理员");
+        }
+        return AjaxResult.success();
+    }
+
+    @ApiOperation("修改审核流程及节点详情")
+    @PostMapping("/detailUpdate")
+    public AjaxResult detailUpdate(@RequestBody AuditProcessDTO auditProcessDTO) {
+        boolean b = auditProcessService.detailUpdate(auditProcessDTO);
+        if (!b){
+            return AjaxResult.error("修改失败,请联系系统管理员");
+        }
+        return AjaxResult.success();
+    }
+
+    @ApiOperation(value = "删除审核流程")
+    @DeleteMapping(value = "/delete")
+    public AjaxResult deleteResource(@RequestParam("id") Long id) {
+        auditProcessService.update(new UpdateWrapper<AuditProcess>().eq("id",id).set("delete_flag",true));
+        return AjaxResult.success();
+    }
+
+    @ApiOperation(value = "批量删除审核流程")
+    @DeleteMapping(value = "/deleteBatch")
+    public AjaxResult batchDeleteResource(@RequestParam("ids") String ids) {
+        String[] idArray = ids.split(",");
+        Arrays.asList(idArray).forEach(id -> {
+            auditProcessService.update(new UpdateWrapper<AuditProcess>().eq("id",id).set("delete_flag",true));
+        });
+        return AjaxResult.success();
+    }
+
+}

+ 90 - 28
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,16 +9,14 @@ 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;
 import com.jsh.erp.datasource.vo.TreeNode;
 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.StringUtil;
 import com.jsh.erp.utils.TreeNodeUtils;
@@ -50,39 +46,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 +104,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);
     }
 
@@ -163,7 +155,6 @@ public class PdaController extends BaseController {
     @ApiOperation(value = "盘点任务详情-商品列表")
     @PostMapping("/taskStocktakingItemList")
     public TableDataInfo taskStocktakingItemList(@RequestBody PDATaskStocktakingItemDTO pdaTaskStocktakingItemDTO){
-        startPage();
         List<PDATaskStocktakingItemVO> list = taskStocktakingService.pdaItemList(pdaTaskStocktakingItemDTO);
         return getDataTable(list);
     }
@@ -215,6 +206,10 @@ public class PdaController extends BaseController {
         if (materialBatch == null) {
             return AjaxResult.error("商品信息不存在");
         }
+//        TaskStocktakingItem item = taskStocktakingItemService.getById(taskStocktakingItem.getId());
+//        if (item != null && item.getStatus() > 1){
+//            return AjaxResult.error("该商品已盘点!");
+//        }
         UpdateWrapper<TaskStocktakingItem> updateWrapper = new UpdateWrapper<>();
         updateWrapper.eq("id", taskStocktakingItem.getId())
                 .set("creator", currentUser.getId())
@@ -252,19 +247,22 @@ public class PdaController extends BaseController {
         return AjaxResult.success(spinnerVOList);
     }
 
-    /**
-     * PDA订单提交
-     */
     @PostMapping ("/orderSubmit")
     @ApiOperation(value = "订单提交")
     public AjaxResult orderSubmit(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO) {
         try {
+            long count = depotHeadService.count(new LambdaQueryWrapperX<DepotHead>()
+                    .eq(DepotHead::getLinkNumber,pdaDepotHeadDTO.getNumber())
+                    .eq(DepotHead::getDeleteFlag,false));
+            if (count > 0){
+                return AjaxResult.error("订单已提交");
+            }
             depotHeadService.pdaOrderSubmit(pdaDepotHeadDTO);
         }catch (BusinessRunTimeException e) {
             return AjaxResult.error(e.getMessage());
         }catch (Exception e) {
             e.printStackTrace();
-            return AjaxResult.error("入库失败");
+            return AjaxResult.error("提交失败");
         }
         return AjaxResult.success();
     }
@@ -272,12 +270,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 +351,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 setReviewStatus(@RequestBody PDADepotHeadDTO pdaDepotHeadDTO){
+        Long userId = userService.getCurrentUser().getId();
+        DepotHead depotHead = depotHeadService.getDepotHead(pdaDepotHeadDTO.getId());
+        if (!depotHead.getStatus().equals("6")){
+            return AjaxResult.error("该复核任务已被处理");
+        }
+        if (depotHead.getCreator() == userId){
+            return AjaxResult.error("提交人不能和复核人为同一账号");
+        }
+        boolean b = depotHeadService.setReviewStatus(pdaDepotHeadDTO);
+        if (!b){
+            return AjaxResult.error("审核失败!");
+        }
+        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;
+
+}

+ 19 - 0
src/main/java/com/jsh/erp/datasource/dto/AuditProcessDTO.java

@@ -0,0 +1,19 @@
+package com.jsh.erp.datasource.dto;
+
+import com.jsh.erp.datasource.entities.AuditNodeConfig;
+import com.jsh.erp.datasource.entities.AuditProcess;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 审核流程信息
+ */
+@Data
+public class AuditProcessDTO extends AuditProcess{
+
+    @ApiModelProperty("审核节点集合")
+    private List<AuditNodeConfig> auditNodes;
+
+}

+ 12 - 0
src/main/java/com/jsh/erp/datasource/dto/AuditProcessQueryDTO.java

@@ -0,0 +1,12 @@
+package com.jsh.erp.datasource.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class AuditProcessQueryDTO {
+
+    @ApiModelProperty("流程名称")
+    private String type;
+
+}

+ 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;
+
+}

+ 2 - 6
src/main/java/com/jsh/erp/datasource/dto/DepotHeadDto.java → src/main/java/com/jsh/erp/datasource/dto/DepotHeadDTO.java

@@ -2,25 +2,21 @@ 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;
 
 /**
  * 单据信息
  */
 @Data
-public class DepotHeadDto {
+public class DepotHeadDTO {
 
     @ApiModelProperty("单据主表信息")
     private DepotHead info;
 
     @ApiModelProperty("单据子表信息")
-    private List<DepotItem> rows;
-
-    private BigDecimal preTotalPrice;
+    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));
+        }
+    }
+}

+ 7 - 4
src/main/java/com/jsh/erp/datasource/dto/MaterialDto.java → src/main/java/com/jsh/erp/datasource/dto/MaterialDTO.java

@@ -2,7 +2,6 @@ package com.jsh.erp.datasource.dto;
 
 import com.alibaba.fastjson.JSONArray;
 import com.jsh.erp.datasource.entities.Material;
-import com.jsh.erp.datasource.entities.MaterialBatch;
 import com.jsh.erp.datasource.entities.MaterialExtend;
 import com.jsh.erp.datasource.entities.MaterialInitialStock;
 import io.swagger.annotations.ApiModelProperty;
@@ -14,16 +13,20 @@ import java.util.List;
  * 商品信息
  */
 @Data
-public class MaterialDto extends Material {
+public class MaterialDTO extends Material {
 
     @ApiModelProperty("商品条码信息")
-    private List<MaterialExtend> mbList;
+    private List<MaterialExtendDTO> meList;
 
-    @ApiModelProperty("商品库存信息")
+    @ApiModelProperty("商品初始库存信息")
     private List<MaterialInitialStock> stock;
 
+    //以下字段去除
     private JSONArray sortList;
 
+    @ApiModelProperty("商品条码信息")
+    private List<MaterialExtend> mbList;
+
 
 
 }

+ 23 - 0
src/main/java/com/jsh/erp/datasource/dto/MaterialExtendDTO.java

@@ -0,0 +1,23 @@
+package com.jsh.erp.datasource.dto;
+
+import com.jsh.erp.datasource.entities.MaterialExtend;
+import com.jsh.erp.datasource.entities.MaterialUnit;
+import com.jsh.erp.datasource.entities.MaterialUpc;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 商品拓展信息
+ */
+@Data
+public class MaterialExtendDTO extends MaterialExtend {
+
+    @ApiModelProperty("商品UPC集合")
+    private List<MaterialUpc> upcList;
+
+    @ApiModelProperty("商品单位集合")
+    private List<MaterialUnit> unitList;
+
+}

+ 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 {
+
+
+
+}

+ 2 - 4
src/main/java/com/jsh/erp/datasource/dto/MaterialQueryDTO.java

@@ -2,6 +2,7 @@ package com.jsh.erp.datasource.dto;
 
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
@@ -9,7 +10,7 @@ import java.util.List;
 public class MaterialQueryDTO {
 
     @ApiModelProperty("商品类别ID")
-    private String categoryId;
+    private Long categoryId;
 
     @ApiModelProperty("关键字")
     private String materialParam;
@@ -59,7 +60,4 @@ public class MaterialQueryDTO {
     private String mpList;
 
 
-
-
-
 }

+ 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;
+
+}

+ 44 - 0
src/main/java/com/jsh/erp/datasource/entities/AuditNodeConfig.java

@@ -0,0 +1,44 @@
+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.util.Date;
+
+/**
+ * 审核节点配置
+ */
+@Data
+public class AuditNodeConfig {
+
+    @ApiModelProperty("主键ID")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("流程ID")
+    private Long processId;
+
+    @ApiModelProperty("节点名称")
+    private String name;
+
+    @ApiModelProperty("节点顺序")
+    private int nodeOrder;
+
+    @ApiModelProperty("审批人类型(1:指定用户 2:上级部门最高领导审核 3:部门最高领导审核)")
+    private Integer auditorType;
+
+    @ApiModelProperty("审批人")
+    private Long auditor;
+
+    @ApiModelProperty("创建人")
+    private Long createBy;
+
+    @ApiModelProperty("创建时间")
+    private Date createTime;
+
+    @ApiModelProperty("删除标记,0.未删除,1.已删除")
+    private Boolean deleteFlag;
+
+}

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

@@ -8,7 +8,7 @@ import lombok.Data;
 import java.util.Date;
 
 /**
- * 审核流程实体类
+ * 审核流程表
  */
 @Data
 public class AuditProcess {
@@ -33,7 +33,7 @@ public class AuditProcess {
     private Date createTime;
 
     @ApiModelProperty("删除标记,0.未删除,1.已删除")
-    private Boolean deletedFlag;
+    private Boolean deleteFlag;
 
 
 

+ 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;

+ 56 - 18
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -1,12 +1,14 @@
 package com.jsh.erp.datasource.entities;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
 import java.util.Date;
 
+/**
+ * 单据子表及商品信息
+ */
 @Data
 public class DepotItemVo4WithInfoEx extends DepotItem{
 
@@ -40,8 +42,6 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
 
     private Long UnitId;
 
-    private String unitName;
-
     private Integer ratio;
 
     private String otherUnit;
@@ -56,44 +56,82 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
 
     private BigDecimal weight;
 
-    private String imgName;
-
     private String brand;
 
-    @ApiModelProperty("生产日期")
-    @JsonFormat(pattern = "yyyy-MM-dd")
-    private Date productionDate;
 
-    @ApiModelProperty("保质期天数")
+//    private Date productionDate;
+
+
     private Integer expiryNum;
 
-    @ApiModelProperty("供应商id")
+
     private Long supplierId;
 
-    @ApiModelProperty("商品条码")
+
     private String barCode;
 
-    @ApiModelProperty("批次号")
+
     private String batchNumber;
 
-    @ApiModelProperty("库存")
+
     private BigDecimal inventory;
 
-    @ApiModelProperty("仓位货架")
+
     private String position;
 
-    @ApiModelProperty("供应商名称")
+
     private String supplierName;
 
-    @ApiModelProperty("入库人名称")
+    //单据信息
+    private int op = 1;
+
+    private String mType;
+
+    @ApiModelProperty("入库人名字")
     private String warehousingUserName;
 
-    @ApiModelProperty("默认销售价格")
+    @ApiModelProperty("完成数量")
+    private BigDecimal finishNumber;
+
+    @ApiModelProperty("原数量")
+    private BigDecimal preNumber;
+
+    //商品信息
+    @ApiModelProperty("商品名称")
+    private String name;
+
+    @ApiModelProperty("商品图片")
+    private String imgName;
+
+    @ApiModelProperty("拓展信息")
+    private String materialOther;
+
+    @ApiModelProperty("默认采购价")
     private BigDecimal defaultPurchaseDecimal;
 
-    @ApiModelProperty("默认采购价格")
+    @ApiModelProperty("默认销售价")
     private BigDecimal defaultWholesaleDecimal;
 
+    //商品子信息
+    @ApiModelProperty("商品规格")
+    private String standard;
+
+    @ApiModelProperty("商品型号")
+    private String model;
+
+    @ApiModelProperty("商品颜色")
+    private String color;
+
+    @ApiModelProperty("商品单位")
+    private String unit;
+
+    @ApiModelProperty("单位名/包装规格")
+    private String unitName;
+
+    //库存信息
+    @ApiModelProperty("库存")
+    private BigDecimal stock;
+
     public Long getMId() {
         return MId;
     }

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

@@ -1,6 +1,8 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -11,7 +13,7 @@ import java.util.List;
 import java.util.Map;
 
 /**
- * 产品表实体类(商品信息)
+ * 商品表实体类
  */
 @Data
 @Accessors(chain = true)
@@ -19,6 +21,7 @@ import java.util.Map;
 public class Material {
 
     @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
     private Long id;
 
     @ApiModelProperty("产品类型id")
@@ -27,36 +30,18 @@ public class Material {
     @ApiModelProperty("产品名称")
     private String name;
 
-    @ApiModelProperty("型号")
-    private String model;
-
-    @ApiModelProperty("规格")
-    private String standard;
-
     @ApiModelProperty("品牌")
     private String brand;
 
     @ApiModelProperty("助记码")
     private String mnemonic;
 
-    @ApiModelProperty("颜色")
-    private String color;
-
-    @ApiModelProperty("单位-单个")
-    private String unit;
-
     @ApiModelProperty("备注")
     private String remark;
 
     @ApiModelProperty("图片名称")
     private String imgName;
 
-    @ApiModelProperty("计量单位Id")
-    private Long unitId;
-
-    @ApiModelProperty("基础重量(kg)")
-    private BigDecimal weight;
-
     @ApiModelProperty("启用 0-禁用  1-启用")
     private Boolean enabled;
 
@@ -72,23 +57,20 @@ public class Material {
     @ApiModelProperty("是否开启序列号,0否,1是")
     private String enableSerialNumber;
 
-    @ApiModelProperty("是否开启批号,0否,1是")
-    private String enableBatchNumber;
-
     @ApiModelProperty("租户id")
     private Long tenantId;
 
     @ApiModelProperty("删除标记,0未删除,1删除")
     private String deleteFlag;
 
-    @ApiModelProperty("系统sku")
-    private String systemSku;
+    @ApiModelProperty("系统spu")
+    private String systemSpu;
 
     @ApiModelProperty("无动销提醒周期")
     private String movingPinReminderCycle;
 
     @ApiModelProperty("保质期天数")
-    private int expiryNum;
+    private Integer expiryNum;
 
     @ApiModelProperty("默认采购价格")
     private BigDecimal defaultPurchaseDecimal;
@@ -105,17 +87,31 @@ public class Material {
     @TableField(exist = false)
     private Map<Long,String> depotMap;
 
+    //以下字段去除
+//    @ApiModelProperty("型号")
+//    private String model;
+//
+//    @ApiModelProperty("规格")
+//    private String standard;
+//
+//    @ApiModelProperty("颜色")
+//    private String color;
 
-    public void setName(String name) {
-        this.name = name == null ? null : name.trim();
-    }
+    @ApiModelProperty("单位-单个")
+    private String unit;
 
-    public void setModel(String model) {
-        this.model = model == null ? null : model.trim();
-    }
+    @ApiModelProperty("计量单位Id")
+    private Long unitId;
+
+//    @ApiModelProperty("基础重量(kg)")
+//    private BigDecimal weight;
 
-    public void setStandard(String standard) {
-        this.standard = standard == null ? null : standard.trim();
+    @ApiModelProperty("是否开启批号,0否,1是")
+    private String enableBatchNumber;
+
+
+    public void setName(String name) {
+        this.name = name == null ? null : name.trim();
     }
 
     public void setBrand(String brand) {
@@ -126,13 +122,10 @@ public class Material {
         this.mnemonic = mnemonic == null ? null : mnemonic.trim();
     }
 
-    public void setColor(String color) {
-        this.color = color == null ? null : color.trim();
-    }
 
-    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();
@@ -158,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();

+ 38 - 18
src/main/java/com/jsh/erp/datasource/entities/MaterialExtend.java

@@ -1,5 +1,7 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModelProperty;
@@ -18,28 +20,17 @@ import java.util.Date;
 public class MaterialExtend {
 
     @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
     private Long id;
 
     @ApiModelProperty("商品id")
     private Long materialId;
 
-    @ApiModelProperty("商品单位")
-    private String commodityUnit;
-
-    @ApiModelProperty("商品属性")
+    @ApiModelProperty("sku")
     private String sku;
 
-    @ApiModelProperty("采购价格")
-    private BigDecimal purchaseDecimal;
-
-    @ApiModelProperty("零售价格")
-    private BigDecimal commodityDecimal;
-
-    @ApiModelProperty("销售价格")
-    private BigDecimal wholesaleDecimal;
-
-    @ApiModelProperty("最低售价")
-    private BigDecimal lowDecimal;
+    @ApiModelProperty("商品单位")
+    private String commodityUnit;
 
     @ApiModelProperty("是否为默认单位,1是,0否")
     private String defaultFlag;
@@ -63,6 +54,35 @@ public class MaterialExtend {
     @ApiModelProperty("删除标记,0未删除,1删除")
     private String deleteFlag;
 
+    @ApiModelProperty("规格")
+    private String standard;
+
+    @ApiModelProperty("颜色")
+    private String color;
+
+    @ApiModelProperty("基础重量(kg)")
+    private BigDecimal weight;
+
+    @ApiModelProperty("型号")
+    private String model;
+
+    @ApiModelProperty("启用 0-禁用  1-启用")
+    private Boolean enabled;
+
+    //以下字段去除
+
+    @ApiModelProperty("采购价格")
+    private BigDecimal purchaseDecimal;
+
+    @ApiModelProperty("零售价格")
+    private BigDecimal commodityDecimal;
+
+    @ApiModelProperty("销售价格")
+    private BigDecimal wholesaleDecimal;
+
+    @ApiModelProperty("最低售价")
+    private BigDecimal lowDecimal;
+
     @ApiModelProperty("生产日期")
     @JsonFormat(pattern = "yyyy-MM-dd")
     private Date productionDate;
@@ -73,9 +93,6 @@ public class MaterialExtend {
     @ApiModelProperty("供应商id")
     private Long supplierId;
 
-    @ApiModelProperty("商品条码")
-    private String barCode;
-
     @ApiModelProperty("批次号")
     private String batchNumber;
 
@@ -91,6 +108,9 @@ public class MaterialExtend {
     @ApiModelProperty("单位比例")
     private Integer ratio;
 
+    @ApiModelProperty("商品条码")
+    private String barCode;
+
     public void setBarCode(String barCode) {
         this.barCode = barCode == null ? null : barCode.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;
+
+
+}

+ 37 - 0
src/main/java/com/jsh/erp/datasource/entities/MaterialUnit.java

@@ -0,0 +1,37 @@
+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;
+
+/**
+ * 商品单位
+ */
+@Data
+public class MaterialUnit {
+
+    @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("商品扩展id")
+    private Long materialExtendId;
+
+    @ApiModelProperty("单位比例")
+    private Integer ratio;
+
+    @ApiModelProperty("名称")
+    private String name;
+
+    @ApiModelProperty("删除标记,0未删除,1删除")
+    private Boolean deleteFlag;
+
+    public MaterialUnit() {
+    }
+
+    public MaterialUnit(String name, Integer ratio) {
+        this.ratio = ratio;
+        this.name = name;
+    }
+}

+ 33 - 0
src/main/java/com/jsh/erp/datasource/entities/MaterialUpc.java

@@ -0,0 +1,33 @@
+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 lombok.experimental.Accessors;
+
+/**
+ * 商品UPC
+ */
+@Data
+@Accessors(chain = true)
+public class MaterialUpc {
+
+    @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
+    private Long id;
+
+    @ApiModelProperty("商品扩展id")
+    private Long materialExtendId;
+
+    @ApiModelProperty("upc值")
+    private String upc;
+
+    @ApiModelProperty("是否默认")
+    private Boolean defaultFlag;
+
+    @ApiModelProperty("删除标记,0未删除,1删除")
+    private Boolean deleteFlag;
+
+
+}

+ 39 - 28
src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java

@@ -10,20 +10,54 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * 商品信息 - 列表
+ */
 @Data
 @Accessors(chain = true)
 public class MaterialVo4Unit extends Material{
 
+    //商品信息
+    @ApiModelProperty("类型名称")
+    private String categoryName;
+    @ApiModelProperty("拓展信息")
+    private String materialOther;
+    //图片属性
+    private String imgSmall;
+    private String imgLarge;
+
+    //商品条码信息
+    @ApiModelProperty("型号")
+    private String model;
+    @ApiModelProperty("规格")
+    private String standard;
+    @ApiModelProperty("颜色")
+    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 String categoryName;
 
-    private String materialOther;
-
-    private BigDecimal stock;
 
     private BigDecimal purchaseDecimal;
 
@@ -37,11 +71,9 @@ public class MaterialVo4Unit extends Material{
 
     private String mBarCode;
 
-    private String commodityUnit;
 
-    private Long meId;
 
-    private BigDecimal initialStock;
+    private Long meId;
 
     private BigDecimal currentUnitPrice;
 
@@ -57,19 +89,7 @@ public class MaterialVo4Unit extends Material{
 
 //    private Long depotId;
 
-    /**
-     * 换算为大单位的库存
-     */
-    private String bigUnitStock;
-
-    /**
-     * 换算为大单位的初始库存
-     */
-    private String bigUnitInitialStock;
-
-    private String imgSmall;
 
-    private String imgLarge;
 
     @ApiModelProperty("生产日期")
     private String productionDate;
@@ -98,15 +118,6 @@ public class MaterialVo4Unit extends Material{
     @ApiModelProperty("仓库名称")
     private String depotName;
 
-    @ApiModelProperty("实际出入库数量")
-    private String actualQuantityInStorage = "";
-
-    @ApiModelProperty("出入库差异")
-    private String warehousingVariance = "";
-
-    @ApiModelProperty("出入库差异原因")
-    private String reasonOfDifference = "";
-
     @ApiModelProperty("出入库用户")
     private String warehousingUser = "";
 

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

@@ -1,8 +1,19 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
 import java.util.Date;
 
+@Data
+@TableName("jsh_msg")
 public class Msg {
+
+    @ApiModelProperty("主键id")
+    @TableId(type = IdType.AUTO)
     private Long id;
 
     private String msgTitle;
@@ -15,7 +26,7 @@ public class Msg {
 
     private Long userId;
 
-    private String status;
+    private Integer status;
 
     private Long tenantId;
 
@@ -69,12 +80,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() {

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

@@ -1,12 +1,34 @@
 package com.jsh.erp.datasource.entities;
 
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
 import java.math.BigDecimal;
 
+/**
+ * 多单位实体类
+ */
+@Data
+@TableName("jsh_unit")
 public class Unit {
+
+    @ApiModelProperty("主键id")
     private Long id;
 
+    @ApiModelProperty("单位名称")
     private String name;
 
+    @ApiModelProperty("启用")
+    private Boolean enabled;
+
+    @ApiModelProperty("租户id")
+    private Long tenantId;
+
+    @ApiModelProperty("删除标记,0未删除,1删除")
+    private String deleteFlag;
+
+    //以下字段去除
     private String basicUnit;
 
     private String otherUnit;
@@ -21,12 +43,6 @@ public class Unit {
 
     private BigDecimal ratioThree;
 
-    private Boolean enabled;
-
-    private Long tenantId;
-
-    private String deleteFlag;
-
     public Long getId() {
         return id;
     }

+ 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);
+
+}

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

@@ -0,0 +1,22 @@
+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;
+
+public interface AuditNodeConfigMapper extends BaseMapperX<AuditNodeConfig> {
+
+    List<AuditNodeConfigVo> listByProcessId(Long processId);
+
+    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);
+
+
+}

+ 12 - 0
src/main/java/com/jsh/erp/datasource/mappers/AuditProcessMapper.java

@@ -0,0 +1,12 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.dto.AuditProcessQueryDTO;
+import com.jsh.erp.datasource.entities.AuditProcess;
+import com.jsh.erp.datasource.vo.AuditProcessVo;
+
+import java.util.List;
+
+public interface AuditProcessMapper extends BaseMapperX<AuditProcess> {
+
+    List<AuditProcessVo> listBy(AuditProcessQueryDTO auditProcessQueryDTO);
+}

+ 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);
+
 }

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

@@ -2,6 +2,7 @@ package com.jsh.erp.datasource.mappers;
 
 import com.jsh.erp.datasource.entities.DepotItem;
 import com.jsh.erp.datasource.entities.MaterialExtend;
+import com.jsh.erp.datasource.vo.MaterialExtendVo;
 import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
 import org.apache.ibatis.annotations.Param;
 
@@ -16,8 +17,11 @@ public interface MaterialExtendMapperEx {
      */
     int batchDeleteMaterialExtendByIds(@Param("ids") String ids[]);
 
-    List<MaterialExtendVo4List> getDetailList(
-            @Param("materialId") Long materialId);
+    /**
+     * 根据商品ID获取拓展信息明细
+     * @param materialId 商品id
+     */
+    List<MaterialExtendVo> getDetailList(@Param("materialId") Long materialId);
 
     Long getMaxTimeByTenantAndTime(
             @Param("tenantId") Long tenantId,

+ 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 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java

@@ -20,14 +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);

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

@@ -1,9 +1,11 @@
 package com.jsh.erp.datasource.mappers;
 
+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.pda.vo.PDAPrintVo;
+import com.jsh.erp.datasource.vo.MaterialAndExtendVo;
 import com.jsh.erp.datasource.vo.MaterialCurrentStock4SystemSku;
 import com.jsh.erp.datasource.vo.MaterialVoSearch;
 import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
@@ -21,25 +23,24 @@ import java.util.Map;
  */
 public interface MaterialMapperEx {
 
+    //按条件查询商品信息列表
     List<MaterialVo4Unit> selectByConditionMaterial(
             @Param("materialParam") String materialParam,
             @Param("standard") String standard,
             @Param("model") String model,
             @Param("color") String color,
             @Param("brand") String brand,
-            @Param("mfrs") String mfrs,
             @Param("materialOther") String materialOther,
             @Param("weight") String weight,
             @Param("expiryNum") String expiryNum,
             @Param("enableSerialNumber") String enableSerialNumber,
-            @Param("enableBatchNumber") String enableBatchNumber,
-            @Param("position") String position,
             @Param("enabled") String enabled,
             @Param("remark") String remark,
             @Param("idList") List<Long> idList,
             @Param("mpList") String mpList,
             @Param("reminder") String reminder);
 
+    //添加商品信息
     Long insertSelectiveEx(Material record);
 
     List<Unit> findUnitList(@Param("mId") Long mId);
@@ -62,6 +63,21 @@ public interface MaterialMapperEx {
                                                   @Param("rows") Integer rows,
                                                   @Param("depotId") Long depotId);
 
+    /**
+     * 查询商品信息 - 按sku归类
+     */
+    List<MaterialVo4Unit> findBySelectWithSku(@Param("idList") List<Long> idList,
+                                                  @Param("q") String q,
+                                                  @Param("standardOrModel") String standardOrModel,
+                                                  @Param("color") String color,
+                                                  @Param("brand") String brand,
+                                                  @Param("mfrs") String mfrs,
+                                                  @Param("enableSerialNumber") String enableSerialNumber,
+                                                  @Param("enableBatchNumber") String enableBatchNumber,
+                                                  @Param("offset") Integer offset,
+                                                  @Param("rows") Integer rows,
+                                                  @Param("depotId") Long depotId);
+
     int findBySelectWithBarCodeCount(@Param("idList") List<Long> idList,
                                      @Param("q") String q,
                                      @Param("standardOrModel") String standardOrModel,
@@ -72,6 +88,19 @@ public interface MaterialMapperEx {
                                      @Param("enableBatchNumber") String enableBatchNumber,
                                      @Param("depotId") Long depotId);
 
+    /**
+     * 查询商品信息数量 - 按sku归类
+     */
+    int findBySelectWithSkuCount(@Param("idList") List<Long> idList,
+                                     @Param("q") String q,
+                                     @Param("standardOrModel") String standardOrModel,
+                                     @Param("color") String color,
+                                     @Param("brand") String brand,
+                                     @Param("mfrs") String mfrs,
+                                     @Param("enableSerialNumber") String enableSerialNumber,
+                                     @Param("enableBatchNumber") String enableBatchNumber,
+                                     @Param("depotId") Long depotId);
+
     List<MaterialVo4Unit> exportExcel(
             @Param("materialParam") String materialParam,
             @Param("color") String color,
@@ -118,6 +147,11 @@ public interface MaterialMapperEx {
 
     List<MaterialVo4Unit> getMaterialByBarCode(@Param("barCodeArray") String [] barCodeArray);
 
+    /**
+     * 根据sku数据查询商品信息
+     */
+    List<MaterialVo4Unit> getMaterialBySku(@Param("skuArray") String [] skuArray);
+
     List<MaterialVo4Unit> getMaterialByBarCodeAndWithOutMId(
             @Param("barCodeArray") String [] barCodeArray,
             @Param("mId") Long mId);

+ 9 - 0
src/main/java/com/jsh/erp/datasource/mappers/MaterialUnitMapper.java

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

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

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

+ 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);
 }

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

@@ -5,7 +5,7 @@ import com.jsh.erp.datasource.entities.UnitExample;
 import java.util.List;
 import org.apache.ibatis.annotations.Param;
 
-public interface UnitMapper {
+public interface UnitMapper extends BaseMapperX<Unit> {
     long countByExample(UnitExample example);
 
     int deleteByExample(UnitExample example);
@@ -16,6 +16,7 @@ public interface UnitMapper {
 
     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;
+
+}

+ 3 - 0
src/main/java/com/jsh/erp/datasource/pda/dto/PDATaskStocktakingItemDTO.java

@@ -28,4 +28,7 @@ public class PDATaskStocktakingItemDTO {
 
     @ApiModelProperty("库位")
     private String position;
+
+    @ApiModelProperty("商品拓展id")
+    private Long materialExtendId;
 }

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

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

+ 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/AuditNodeConfigVo.java

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

+ 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;
+
+}

+ 19 - 0
src/main/java/com/jsh/erp/datasource/vo/AuditProcessVo.java

@@ -0,0 +1,19 @@
+package com.jsh.erp.datasource.vo;
+
+import com.jsh.erp.datasource.entities.AuditNodeConfig;
+import com.jsh.erp.datasource.entities.AuditProcess;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 审核流程
+ */
+@Data
+public class AuditProcessVo extends AuditProcess {
+
+    @ApiModelProperty("审核节点集合")
+    private List<AuditNodeConfigVo> auditNodes;
+
+}

+ 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;
+
+
+
+}

+ 36 - 0
src/main/java/com/jsh/erp/datasource/vo/MaterialAndExtendVo.java

@@ -0,0 +1,36 @@
+package com.jsh.erp.datasource.vo;
+
+import com.jsh.erp.datasource.entities.Material;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 商品及拓展信息
+ */
+@Data
+public class MaterialAndExtendVo extends Material {
+
+    @ApiModelProperty("sku")
+    private String sku;
+
+    @ApiModelProperty("类型名称")
+    private String categoryName;
+
+    @ApiModelProperty("型号")
+    private String model;
+
+    @ApiModelProperty("颜色")
+    private String color;
+
+    @ApiModelProperty("品牌")
+    private String brand;
+
+    @ApiModelProperty("单位")
+    private String commodityUnit;
+
+    @ApiModelProperty("库存")
+    private BigDecimal stock;
+
+}

+ 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;
+    
 
 }

+ 20 - 0
src/main/java/com/jsh/erp/datasource/vo/MaterialExtendVo.java

@@ -0,0 +1,20 @@
+package com.jsh.erp.datasource.vo;
+
+import com.jsh.erp.datasource.entities.MaterialExtend;
+import com.jsh.erp.datasource.entities.MaterialUnit;
+import com.jsh.erp.datasource.entities.MaterialUpc;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class MaterialExtendVo extends MaterialExtend {
+
+    @ApiModelProperty("商品UPC集合")
+    private List<MaterialUpc> upcList;
+
+    @ApiModelProperty("商品单位集合")
+    private List<MaterialUnit> unitList;
+
+}

+ 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;
     }
+
+
 }

+ 30 - 0
src/main/java/com/jsh/erp/service/AuditProcessService.java

@@ -0,0 +1,30 @@
+package com.jsh.erp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.dto.AuditProcessDTO;
+import com.jsh.erp.datasource.dto.AuditProcessQueryDTO;
+import com.jsh.erp.datasource.entities.AuditProcess;
+import com.jsh.erp.datasource.vo.AuditProcessVo;
+
+import java.util.List;
+
+public interface AuditProcessService extends IService<AuditProcess> {
+
+    /**
+     * 查询审核流程列表
+     * @param auditProcessQueryDTO 筛选条件
+     * @return
+     */
+    List<AuditProcessVo> listBy(AuditProcessQueryDTO auditProcessQueryDTO);
+
+    /**
+     * 新增审核流程
+     */
+    boolean add(AuditProcessDTO auditProcessDTO);
+
+    /**
+     * 修改审核流程及节点详情
+     */
+    boolean detailUpdate(AuditProcessDTO auditProcessDTO);
+
+}

+ 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);
+
+
+
+
+}

+ 36 - 9
src/main/java/com/jsh/erp/service/DepotHeadService.java

@@ -2,7 +2,9 @@ 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;
 import com.jsh.erp.datasource.pda.vo.PDADepotHeadVO;
 import com.jsh.erp.datasource.vo.DepotHeadVo4InDetail;
@@ -35,7 +37,27 @@ public interface DepotHeadService extends IService<DepotHead> {
      */
     PDADepotHeadVO pdaDetail(Long id);
 
-    DepotHead getDepotHead(long id)throws Exception;
+    /**
+     * pda订单提交
+     * @param pdaDepotHeadDTO
+     * @return
+     */
+    boolean pdaOrderSubmit(PDADepotHeadDTO pdaDepotHeadDTO) throws Exception;
+
+    /**
+     * pda复核任务列表
+     */
+    List<PDADepotHeadVO> reviewTaskList(PDADepotHeadDTO pdaDepotHeadDTO);
+
+    /**
+     * pda设置复核任务状态
+     */
+    boolean setReviewStatus(PDADepotHeadDTO pdaDepotHeadDTO);
+
+    /**
+     * 根据id获取订单主表信息
+     */
+    DepotHead getDepotHead(long id);
 
     List<DepotHead> getDepotHead()throws Exception;
 
@@ -87,6 +109,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,
@@ -152,17 +177,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);
@@ -197,10 +229,5 @@ public interface DepotHeadService extends IService<DepotHead> {
      */
     DepotHead getDepotLastByMaterialId(long mid);
 
-    /**
-     * pda订单提交
-     * @param pdaDepotHeadDTO
-     * @return
-     */
-    boolean pdaOrderSubmit(PDADepotHeadDTO pdaDepotHeadDTO) throws Exception;
+    void sendMsg(Long dhId);
 }

+ 23 - 8
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;
 
@@ -85,12 +89,15 @@ public interface DepotItemService extends IService<DepotItem> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int updateDepotItemWithObj(DepotItem depotItem)throws Exception;
 
-    List<DepotItem> getListByHeaderId(Long headerId)throws Exception;
+    List<DepotItem> getListByHeaderId(Long headerId);
 
     DepotItem getItemByHeaderIdAndMaterial(Long headerId, Long meId)throws Exception;
 
     DepotItem getPreItemByHeaderIdAndMaterial(String linkStr, Long meId, Long linkId)throws Exception;
 
+    /**
+     * 根据单据主表id获取单据明细
+     */
     List<DepotItemVo4WithInfoEx> getDetailList(Long headerId)throws Exception;
 
     List<DepotItemVo4WithInfoEx> getInOutStock(String materialParam, List<Long> categoryIdList, String endTime, Integer offset, Integer rows)throws Exception;
@@ -118,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;
@@ -137,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);
 
@@ -160,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;
@@ -170,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)
@@ -197,5 +209,8 @@ public interface DepotItemService extends IService<DepotItem> {
 
     BigDecimal getCurrentStockByParam(Long depotId, Long mId);
 
+    /**
+     * 获取商品拓展信息
+     */
     String getOtherInfo(String[] mpArr, DepotItemVo4WithInfoEx diEx)throws Exception;
 }

+ 13 - 4
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,9 +65,14 @@ 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() throws Exception;
+    JSONArray findDepotByCurrentUser();
 
     String findDepotStrByCurrentUser() throws Exception;
 

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

@@ -30,7 +30,7 @@ public interface LogService extends IService<Log> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int batchDeleteLog(String ids, HttpServletRequest request)throws Exception;
 
-    void insertLog(String moduleName, String content, HttpServletRequest request)throws Exception;
+    void insertLog(String moduleName, String content, HttpServletRequest request);
 
     void insertLogWithUserId(Long userId, Long tenantId, String moduleName, String content, HttpServletRequest request)throws Exception;
 }

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

@@ -16,18 +16,22 @@ 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 dhId 单据主表id
+     */
+    void generateMaterialBatchByDepotHeadId(Long dhId);
+
+    /**
+     * 根据单据子表id处理商品批次数据(出库)
      * @param diId 单据子表id
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    void handleMaterialBatchByDepotItemId(Long diId) throws Exception;
+    void handleMaterialBatchByDepotItemId(Long diId);
 
     /**
      * 修改商品批次库存
@@ -35,7 +39,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);

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

@@ -2,10 +2,9 @@ package com.jsh.erp.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.jsh.erp.datasource.dto.MaterialDto;
-import com.jsh.erp.datasource.entities.Log;
-import com.jsh.erp.datasource.entities.MaterialBatch;
+import com.jsh.erp.datasource.dto.MaterialExtendDTO;
 import com.jsh.erp.datasource.entities.MaterialExtend;
+import com.jsh.erp.datasource.vo.MaterialExtendVo;
 import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -13,24 +12,64 @@ 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);
 
-    List<MaterialExtendVo4List> getDetailList(Long materialId);
+    /**
+     * 根据产品id查询产品价格拓展信息
+     * @param materialId 商品ID
+     */
+    List<MaterialExtendVo> getDetailList(Long materialId);
 
     List<MaterialExtend> getListByMIds(List<Long> idList);
 
+    /**
+     * 保存商品拓展信息
+     * @param materialExtends 商品拓展信息
+     * @param sortList
+     * @param materialId 商品id
+     * @param type 操作类型
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     String saveDetails(List<MaterialExtend> materialExtends, String sortList, Long materialId, String type) throws Exception;
 
     /**
+     * 保存商品拓展信息
+     * @param materialExtends 商品拓展信息
+     * @param materialId 商品id
+     * @param type 操作类型
+     */
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    String saveDetails(List<MaterialExtendDTO> materialExtends, Long materialId, String type);
+
+    /**
      *  添加商品子信息
      * @param materialExtend 商品子信息
      */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int insertMaterialExtend(MaterialExtend materialExtend)throws Exception;
 
+    /**
+     *  添加商品子信息
+     * @param materialExtendDTO 商品子信息
+     */
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int updateMaterialExtend(MaterialExtend materialExtend) throws Exception;
+    int insertMaterialExtend(MaterialExtendDTO materialExtendDTO);
+
+    /**
+     * 修改商品拓展
+     */
+
+    int updateMaterialExtend(MaterialExtend materialExtend);
+
+    /**
+     *  修改商品子信息
+     * @param materialExtendDTO 商品子信息
+     */
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    int updateMaterialExtend(MaterialExtendDTO materialExtendDTO);
 
     int checkIsBarCodeExist(Long id, String barCode)throws Exception;
 
@@ -57,6 +96,12 @@ public interface MaterialExtendService extends IService<MaterialExtend> {
 
     MaterialExtend getInfoByBarCode(String barCode)throws Exception;
 
+    /**
+     * 根据sku获取商品拓展信息
+     * @param sku 商品sku
+     */
+    MaterialExtend getInfoBySku(String sku);
+
     int getCountByManyBarCodeWithoutUs(String manyBarCode, String barCode);
 
     MaterialExtend getInfoByBatchNumber(String batchNumber)throws Exception;
@@ -66,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);
+
+}

+ 116 - 38
src/main/java/com/jsh/erp/service/MaterialService.java

@@ -4,14 +4,13 @@ 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.MaterialDto;
+import com.jsh.erp.datasource.dto.MaterialDTO;
 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.MaterialCurrentStock4SystemSku;
 import com.jsh.erp.datasource.pda.vo.PDATypeTree;
 import com.jsh.erp.datasource.vo.MaterialWarnListVo;
-import com.jsh.erp.datasource.vo.TaskStocktakingItemVO;
 import com.jsh.erp.utils.BaseResponseInfo;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -23,56 +22,74 @@ 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 mfrs,
+    List<MaterialVo4Unit> select(String materialParam, String standard, String model, String color, String brand,
                                  String materialOther, String weight, String expiryNum, String enableSerialNumber,
-                                 String enableBatchNumber, String position, String enabled, String remark, String categoryId,
+                                 String enabled, String remark, String categoryId,
                                  String mpList, String reminder);
 
     /**
      * 新增商品
-     * @param obj
+     * @param materialDTO
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int insertMaterial(MaterialDto obj, HttpServletRequest request)throws Exception;
+    boolean insertMaterial(MaterialDTO materialDTO, HttpServletRequest request);
 
     /**
      * 修改商品
-     * @param obj
+     * @param materialDTO
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int updateMaterial(MaterialDto obj, HttpServletRequest request) throws Exception;
+    boolean updateMaterial(MaterialDTO materialDTO, HttpServletRequest request);
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int deleteMaterial(Long id, HttpServletRequest request)throws Exception;
+    /**
+     * 删除商品
+     * @param id 商品id
+     */
+    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;
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    /**
+     * 根据id集合批量删除商品
+     *
+     * @param ids
+     */
     int batchDeleteMaterialByIds(String ids) throws Exception;
 
-    int checkIsNameExist(Long id, String name)throws Exception;
+    /**
+     * 检查名称是否存在 0
+     */
+    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;
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
-    int batchSetStatus(Boolean status, String ids)throws Exception;
 
-    Unit findUnit(Long mId)throws Exception;
+    /**
+     * 批量设置状态-启用或者禁用
+     */
+    int batchSetStatus(Boolean status, String ids) 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);
 
@@ -80,19 +97,57 @@ public interface MaterialService extends IService<Material> {
 
     JSONArray getMaterialByParam(String materialParam);
 
+    /**
+     * 商品选择-查找商品信息
+     *
+     * @param categoryId
+     * @param q
+     * @param standardOrModel
+     * @param color
+     * @param brand
+     * @param mfrs
+     * @param enableSerialNumber
+     * @param enableBatchNumber
+     * @param offset
+     * @param rows
+     * @param depotId
+     * @return
+     * @throws Exception
+     */
     List<MaterialVo4Unit> findBySelectWithBarCode(Long categoryId, String q, String standardOrModel, String color,
                                                   String brand, String mfrs, String enableSerialNumber, String enableBatchNumber,
                                                   Integer offset, Integer rows, Long depotId) throws Exception;
 
+    /**
+     * 商品选择-查找商品信息  按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;
+
     int findBySelectWithBarCodeCount(Long categoryId, String q, String standardOrModel, String color,
                                      String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception;
 
+    /**
+     * 商品选择-查找商品数量  按sku分类
+     */
+    int findBySelectWithSkuCount(Long categoryId, String q, String standardOrModel, String color,
+                                 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);
@@ -100,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;
 
@@ -117,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;
 
@@ -131,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);
@@ -151,6 +209,13 @@ public interface MaterialService extends IService<Material> {
 
     List<MaterialVo4Unit> getMaterialByBarCode(String barCode);
 
+    /**
+     * 根据sku查询商品信息 0
+     *
+     * @param sku 商品sku
+     */
+    List<MaterialVo4Unit> getMaterialBySku(String sku);
+
     List<MaterialVo4Unit> getMaterialByBarCode(List<String> barCodeList);
 
     List<MaterialVo4Unit> getMaterialByBarCodeAndWithOutMId(String barCode, Long mId);
@@ -168,7 +233,7 @@ public interface MaterialService extends IService<Material> {
     String getBigUnitStock(BigDecimal stock, Long unitId) throws Exception;
 
     /**
-     * 构造扩展信息
+     * 构造扩展信息 0
      */
     String getMaterialOtherByParam(String[] mpArr, MaterialVo4Unit m);
 
@@ -178,12 +243,17 @@ public interface MaterialService extends IService<Material> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int batchSetMaterialCurrentUnitPrice(String ids) throws Exception;
 
+    /**
+     * 批量编辑 0
+     *
+     * @param jsonObject
+     */
     int batchUpdate(JSONObject jsonObject);
 
     MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);
 
     /**
-     * 根据商品id查询主表及子表信息
+     * 根据商品id查询主表及子表信息 0
      */
     Material getMaterialById(Long id);
 
@@ -192,13 +262,15 @@ public interface MaterialService extends IService<Material> {
     List<MaterialCurrentStock4SystemSku> getMaterialCurrentPriceByIdList(List<Long> idList);
 
     /**
-     * 获取商品提醒
+     * 获取商品提醒 0
+     *
      * @return
      */
     MaterialWarnListVo getMaterialWarn();
 
     /**
      * 导入商品信息
+     *
      * @param file excel表格
      * @return
      */
@@ -207,12 +279,14 @@ public interface MaterialService extends IService<Material> {
     /**
      * PDA库存查询
      * pdaInventoryDTO
+     *
      * @return
      */
     List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO);
 
     /**
      * 根据库位查询商品id集合
+     *
      * @param position
      * @return
      */
@@ -220,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 库位
@@ -240,6 +316,7 @@ public interface MaterialService extends IService<Material> {
 
     /**
      * 根据商品id查询商品库存
+     *
      * @param mid 商品id
      * @return 商品库存
      */
@@ -247,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);
 }

+ 26 - 0
src/main/java/com/jsh/erp/service/MaterialUnitService.java

@@ -0,0 +1,26 @@
+package com.jsh.erp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.entities.MaterialUnit;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface MaterialUnitService extends IService<MaterialUnit> {
+
+    /**
+     * 保存商品单位
+     * @param units 商品单位集合
+     * @param meId  商品拓展id
+     */
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    Boolean saveDetails(List<MaterialUnit> units, Long meId);
+
+    /**
+     * 获取商品包装规格
+     */
+    String getStandardByMeId(Long meId);
+
+    int batchDeleteMaterialUnitByMIds();
+
+}

+ 21 - 0
src/main/java/com/jsh/erp/service/MaterialUpcService.java

@@ -0,0 +1,21 @@
+package com.jsh.erp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.jsh.erp.datasource.entities.MaterialUnit;
+import com.jsh.erp.datasource.entities.MaterialUpc;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+public interface MaterialUpcService extends IService<MaterialUpc> {
+
+    /**
+     * 保存商品UPC
+     * @param upcList 商品UPC集合
+     * @param meId  商品拓展id
+     */
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    Boolean saveDetails(List<MaterialUpc> upcList, Long meId);
+
+
+}

+ 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;
 

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

@@ -104,7 +104,7 @@ public class SyncTescoSystemService {
                 for (MaterialVo4Unit material : materialList) {
                     JSONObject item = new JSONObject();
                     item.put("barCode", material.getmBarCode());
-                    item.put("systemSku", material.getSystemSku());
+                    item.put("systemSku", material.getSystemSpu());
                     dataArray.add(item);
                 }
             } else {
@@ -383,7 +383,7 @@ public class SyncTescoSystemService {
         // 1. 获取所有商品信息
         List<String> systemSkuList = reqVOItems.stream().map(ErpXsddReqVO.OrderItem::getErpSku).collect(Collectors.toList());
         List<MaterialVo4Unit> materialList = materialService.getMaterialBySystemSku(systemSkuList);
-        Map<String, List<MaterialVo4Unit>> skuToMaterialMap = materialList.stream().collect(Collectors.groupingBy(MaterialVo4Unit::getSystemSku));
+        Map<String, List<MaterialVo4Unit>> skuToMaterialMap = materialList.stream().collect(Collectors.groupingBy(MaterialVo4Unit::getSystemSpu));
 
         // 2. 处理每个订单项
         for (ErpXsddReqVO.OrderItem reqVOItem : reqVOItems) {

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

@@ -89,7 +89,7 @@ public class SystemConfigService {
         return result;
     }
 
-    public List<SystemConfig> getSystemConfig()throws Exception {
+    public List<SystemConfig> getSystemConfig() {
         SystemConfigExample example = new SystemConfigExample();
         example.createCriteria().andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
         List<SystemConfig> list=null;
@@ -478,7 +478,7 @@ public class SystemConfigService {
      * @return
      * @throws Exception
      */
-    public boolean getDepotFlag() throws Exception {
+    public boolean getDepotFlag() {
         boolean depotFlag = false;
         List<SystemConfig> list = getSystemConfig();
         if(list.size()>0) {
@@ -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) {

+ 11 - 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
@@ -65,6 +71,11 @@ public interface TaskStocktakingService extends IService<TaskStocktaking> {
      */
     TaskStocktakingVO pdaDetail(Long id) throws Exception;
 
+    /**
+     * PDA-盘点任务详情-商品列表
+     * @param pdaTaskStocktakingItemDTO
+     * @return
+     */
     List<PDATaskStocktakingItemVO> pdaItemList(PDATaskStocktakingItemDTO pdaTaskStocktakingItemDTO);
 
 

Some files were not shown because too many files changed in this diff