Browse Source

三期:出入库订单接口跳转,审核-流程设计模块功能开发

huang 1 tháng trước cách đây
mục cha
commit
0a7cd50085
41 tập tin đã thay đổi với 1215 bổ sung249 xóa
  1. 31 0
      docs/new_sql.sql
  2. 2 3
      src/main/java/com/jsh/erp/controller/DepotHeadController.java
  3. 168 19
      src/main/java/com/jsh/erp/controller/DepotItemController.java
  4. 194 90
      src/main/java/com/jsh/erp/controller/MaterialController.java
  5. 18 0
      src/main/java/com/jsh/erp/controller/MaterialExtendController.java
  6. 77 0
      src/main/java/com/jsh/erp/controller/audit/AuditProcessController.java
  7. 19 0
      src/main/java/com/jsh/erp/datasource/dto/AuditProcessDTO.java
  8. 12 0
      src/main/java/com/jsh/erp/datasource/dto/AuditProcessQueryDTO.java
  9. 0 2
      src/main/java/com/jsh/erp/datasource/dto/DepotHeadDTO.java
  10. 44 0
      src/main/java/com/jsh/erp/datasource/entities/AuditNodeConfig.java
  11. 2 2
      src/main/java/com/jsh/erp/datasource/entities/AuditProcess.java
  12. 2 1
      src/main/java/com/jsh/erp/datasource/entities/DepotItem.java
  13. 50 16
      src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java
  14. 11 22
      src/main/java/com/jsh/erp/datasource/entities/Material.java
  15. 22 16
      src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java
  16. 16 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditNodeConfigMapper.java
  17. 12 0
      src/main/java/com/jsh/erp/datasource/mappers/AuditProcessMapper.java
  18. 2 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapper.java
  19. 35 0
      src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java
  20. 13 0
      src/main/java/com/jsh/erp/datasource/vo/AuditNodeConfigVo.java
  21. 19 0
      src/main/java/com/jsh/erp/datasource/vo/AuditProcessVo.java
  22. 30 0
      src/main/java/com/jsh/erp/service/AuditProcessService.java
  23. 1 0
      src/main/java/com/jsh/erp/service/DepotHeadService.java
  24. 6 0
      src/main/java/com/jsh/erp/service/DepotItemService.java
  25. 1 1
      src/main/java/com/jsh/erp/service/DepotService.java
  26. 6 0
      src/main/java/com/jsh/erp/service/MaterialExtendService.java
  27. 29 9
      src/main/java/com/jsh/erp/service/MaterialService.java
  28. 5 0
      src/main/java/com/jsh/erp/service/MaterialUnitService.java
  29. 2 2
      src/main/java/com/jsh/erp/service/SystemConfigService.java
  30. 1 1
      src/main/java/com/jsh/erp/service/UserBusinessService.java
  31. 79 0
      src/main/java/com/jsh/erp/service/impl/AuditProcessServiceImpl.java
  32. 3 3
      src/main/java/com/jsh/erp/service/impl/DepotItemServiceImpl.java
  33. 2 2
      src/main/java/com/jsh/erp/service/impl/DepotServiceImpl.java
  34. 11 1
      src/main/java/com/jsh/erp/service/impl/MaterialExtendServiceImpl.java
  35. 89 22
      src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java
  36. 20 0
      src/main/java/com/jsh/erp/service/impl/MaterialUnitServiceImpl.java
  37. 24 0
      src/main/resources/mapper_xml/AuditNodeConfigMapper.xml
  38. 16 0
      src/main/resources/mapper_xml/AuditProcessMapper.xml
  39. 10 5
      src/main/resources/mapper_xml/DepotItemMapperEx.xml
  40. 27 24
      src/main/resources/mapper_xml/MaterialMapper.xml
  41. 104 8
      src/main/resources/mapper_xml/MaterialMapperEx.xml

+ 31 - 0
docs/new_sql.sql

@@ -281,6 +281,37 @@ CREATE TABLE `material_unit` (
   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='审核节点配置表';
+
 
 
 

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

@@ -6,8 +6,10 @@ 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.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 +469,6 @@ public class DepotHeadController extends BaseController {
 
     /**
      * 根据编号查询单据信息
-     * @param number
-     * @param request
-     * @return
      */
     @GetMapping(value = "/getDetailByNumber")
     @ApiOperation(value = "根据编号查询单据信息")

+ 168 - 19
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,9 @@ public class DepotItemController {
     @Resource
     private SystemConfigService systemConfigService;
 
+    @Resource
+    private MaterialUnitService materialUnitService;
+
     @Value(value="${file.uploadType}")
     private Long fileUploadType;
 
@@ -177,20 +181,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);
@@ -212,16 +353,24 @@ 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.setMType(diEx.getMaterialType());
                     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("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()); //查询多单位信息

+ 194 - 90
src/main/java/com/jsh/erp/controller/MaterialController.java

@@ -58,6 +58,9 @@ public class MaterialController extends BaseController {
     @Resource
     private MaterialBatchService materialBatchService;
 
+    @Resource
+    private MaterialUnitService materialUnitService;
+
     @Value(value="${file.uploadType}")
     private Long fileUploadType;
 
@@ -75,6 +78,7 @@ public class MaterialController extends BaseController {
         }
     }
 
+    //商品信息 - 列表
     @GetMapping(value = "/list")
     @ApiOperation(value = "获取信息列表")
     public TableDataInfo getList(@RequestParam(value = Constants.SEARCH, required = false) String search) {
@@ -281,40 +285,159 @@ 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(",");
             }
-            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),
+            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");
@@ -341,29 +464,30 @@ public class MaterialController extends BaseController {
                             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);
@@ -374,20 +498,10 @@ public class MaterialController extends BaseController {
                             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);
         }
@@ -665,16 +779,15 @@ public class MaterialController extends BaseController {
      * @throws Exception
      */
     @GetMapping(value = "/getMaterialBySku")
-    @ApiOperation(value = "根据条码查询商品信息")
-    public BaseResponseInfo getMaterialBySku(@RequestParam("sku") String barCode,
-                                             @RequestParam(value = "depotId", required = false) Long depotId,
-                                             @RequestParam(required = false, value = "prefixNo") String prefixNo,
-                                             HttpServletRequest request) throws Exception {
-        BaseResponseInfo res = new BaseResponseInfo();
-        try {
-            List<MaterialVo4Unit> list = materialService.getMaterialByBarCode(barCode);
-            if(list!=null && list.size()>0) {
+    @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());
@@ -689,37 +802,28 @@ public class MaterialController extends BaseController {
                         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);
-                        getStockByMaterialInfo(mvo);
-                    }
-                    mvo.setInventory(mvo.getStock());
+//                    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);
+//                    }
                 }
             }
-            res.code = 200;
-            res.data = list;
-        } catch(Exception e){
-            logger.error(e.getMessage(), e);
-            res.code = 500;
-            res.data = "获取数据失败";
-        }
-        return res;
+        return AjaxResult.success(list);
     }
 
     /**

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

@@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.jsh.erp.base.AjaxResult;
 import com.jsh.erp.datasource.entities.MaterialExtend;
+import com.jsh.erp.datasource.entities.MaterialUpc;
 import com.jsh.erp.datasource.vo.MaterialExtendVo;
 import com.jsh.erp.datasource.vo.MaterialExtendVo4List;
+import com.jsh.erp.query.LambdaQueryWrapperX;
 import com.jsh.erp.service.MaterialExtendService;
+import com.jsh.erp.service.MaterialUpcService;
 import com.jsh.erp.utils.BaseResponseInfo;
 import com.jsh.erp.utils.DateUtils;
 import com.jsh.erp.utils.ErpInfo;
@@ -37,6 +40,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获取信息")
@@ -199,4 +204,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);
+    }
 }

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

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

+ 0 - 2
src/main/java/com/jsh/erp/datasource/dto/DepotHeadDTO.java

@@ -21,6 +21,4 @@ public class DepotHeadDTO {
     @ApiModelProperty("单据子表信息")
     private List<DepotItem> rows;
 
-    private BigDecimal preTotalPrice;
-
 }

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

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

@@ -103,7 +103,8 @@ public class DepotItem {
     private Long warehousingUser;
 
     @ApiModelProperty("出入库时间")
-    private String warehousingTime;
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    private Date warehousingTime;
 
     @ApiModelProperty("创建时间")
     private Date createTime;

+ 50 - 16
src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4WithInfoEx.java

@@ -6,6 +6,9 @@ import lombok.Data;
 import java.math.BigDecimal;
 import java.util.Date;
 
+/**
+ * 单据子表及商品信息
+ */
 @Data
 public class DepotItemVo4WithInfoEx extends DepotItem{
 
@@ -39,8 +42,6 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
 
     private Long UnitId;
 
-    private String unitName;
-
     private Integer ratio;
 
     private String otherUnit;
@@ -55,43 +56,76 @@ public class DepotItemVo4WithInfoEx extends DepotItem{
 
     private BigDecimal weight;
 
-    private String imgName;
-
     private String brand;
 
-    @ApiModelProperty("生产日期")
-    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 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;
     }

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

@@ -70,7 +70,7 @@ public class Material {
     private String movingPinReminderCycle;
 
     @ApiModelProperty("保质期天数")
-    private int expiryNum;
+    private Integer expiryNum;
 
     @ApiModelProperty("默认采购价格")
     private BigDecimal defaultPurchaseDecimal;
@@ -88,14 +88,14 @@ public class Material {
     private Map<Long,String> depotMap;
 
     //以下字段去除
-    @ApiModelProperty("型号")
-    private String model;
-
-    @ApiModelProperty("规格")
-    private String standard;
-
-    @ApiModelProperty("颜色")
-    private String color;
+//    @ApiModelProperty("型号")
+//    private String model;
+//
+//    @ApiModelProperty("规格")
+//    private String standard;
+//
+//    @ApiModelProperty("颜色")
+//    private String color;
 
     @ApiModelProperty("单位-单个")
     private String unit;
@@ -103,8 +103,8 @@ public class Material {
     @ApiModelProperty("计量单位Id")
     private Long unitId;
 
-    @ApiModelProperty("基础重量(kg)")
-    private BigDecimal weight;
+//    @ApiModelProperty("基础重量(kg)")
+//    private BigDecimal weight;
 
     @ApiModelProperty("是否开启批号,0否,1是")
     private String enableBatchNumber;
@@ -114,14 +114,6 @@ public class Material {
         this.name = name == null ? null : name.trim();
     }
 
-    public void setModel(String model) {
-        this.model = model == null ? null : model.trim();
-    }
-
-    public void setStandard(String standard) {
-        this.standard = standard == null ? null : standard.trim();
-    }
-
     public void setBrand(String brand) {
         this.brand = brand == null ? null : brand.trim();
     }
@@ -130,9 +122,6 @@ 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();

+ 22 - 16
src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java

@@ -10,6 +10,9 @@ import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
+/**
+ * 商品信息 - 列表
+ */
 @Data
 @Accessors(chain = true)
 public class MaterialVo4Unit extends Material{
@@ -18,11 +21,29 @@ public class MaterialVo4Unit extends Material{
 
     private BigDecimal ratio;
 
+    @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 BigDecimal stock;
+    @ApiModelProperty("商品初始库存")
+    private BigDecimal initialStock;
 
     private BigDecimal purchaseDecimal;
 
@@ -40,8 +61,6 @@ public class MaterialVo4Unit extends Material{
 
     private Long meId;
 
-    private BigDecimal initialStock;
-
     private BigDecimal currentUnitPrice;
 
     private BigDecimal currentStock;
@@ -66,10 +85,6 @@ public class MaterialVo4Unit extends Material{
      */
     private String bigUnitInitialStock;
 
-    private String imgSmall;
-
-    private String imgLarge;
-
     @ApiModelProperty("生产日期")
     private String productionDate;
 
@@ -97,15 +112,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 = "";
 

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

@@ -0,0 +1,16 @@
+package com.jsh.erp.datasource.mappers;
+
+import com.jsh.erp.datasource.entities.AuditNodeConfig;
+import com.jsh.erp.datasource.vo.AuditNodeConfigVo;
+
+import java.util.List;
+
+public interface AuditNodeConfigMapper extends BaseMapperX<AuditNodeConfig> {
+
+    List<AuditNodeConfigVo> listByProcessId(Long processId);
+
+    int updateBatchById(List<AuditNodeConfig> list);
+
+
+
+}

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

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

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

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

@@ -23,6 +23,7 @@ import java.util.Map;
  */
 public interface MaterialMapperEx {
 
+    //商品信息 - 列表
     List<MaterialVo4Unit> selectByConditionMaterial(
             @Param("materialParam") String materialParam,
             @Param("standard") String standard,
@@ -39,6 +40,7 @@ public interface MaterialMapperEx {
             @Param("mpList") String mpList,
             @Param("reminder") String reminder);
 
+    //商品信息 - 新增
     Long insertSelectiveEx(Material record);
 
     List<Unit> findUnitList(@Param("mId") Long mId);
@@ -61,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,
@@ -71,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,
@@ -117,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);

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

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

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

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

@@ -3,6 +3,7 @@ package com.jsh.erp.service;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.extension.service.IService;
 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;

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

@@ -91,6 +91,9 @@ public interface DepotItemService extends IService<DepotItem> {
 
     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;
@@ -197,5 +200,8 @@ public interface DepotItemService extends IService<DepotItem> {
 
     BigDecimal getCurrentStockByParam(Long depotId, Long mId);
 
+    /**
+     * 获取商品拓展信息
+     */
     String getOtherInfo(String[] mpArr, DepotItemVo4WithInfoEx diEx)throws Exception;
 }

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

@@ -63,7 +63,7 @@ public interface DepotService extends IService<Depot> {
 
     List<Long> parseDepotList(Long depotId) throws Exception;
 
-    JSONArray findDepotByCurrentUser() throws Exception;
+    JSONArray findDepotByCurrentUser();
 
     String findDepotStrByCurrentUser() throws Exception;
 

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

@@ -90,6 +90,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;

+ 29 - 9
src/main/java/com/jsh/erp/service/MaterialService.java

@@ -42,35 +42,41 @@ public interface MaterialService extends IService<Material> {
      * 新增商品
      * @param materialDTO
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     boolean insertMaterial(MaterialDTO materialDTO, HttpServletRequest request);
 
     /**
      * 修改商品
      * @param materialDTO
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     boolean updateMaterial(MaterialDTO materialDTO, HttpServletRequest request);
 
     /**
      * 删除商品
      * @param id 商品id
      */
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int deleteMaterial(Long id, HttpServletRequest request)throws Exception;
 
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     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;
 
     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;
 
-    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+
+    /**
+     * 批量设置状态-启用或者禁用
+     */
     int batchSetStatus(Boolean status, String ids)throws Exception;
 
     Unit findUnit(Long mId)throws Exception;
@@ -106,17 +112,25 @@ public interface MaterialService extends IService<Material> {
                                                   Integer offset, Integer rows, Long depotId) throws Exception;
 
     /**
-     * 商品选择-查找商品信息
+     * 商品选择-查找商品信息  按sku分类
      * @param offset
      * @param rows
      * @return
      * @throws Exception
      */
-    List<MaterialVo4Unit> findBySelectWithBarCode(MaterialQueryDTO materialQueryDTO, Integer offset, Integer rows) 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;
@@ -179,11 +193,13 @@ public interface MaterialService extends IService<Material> {
 
     List<String> getMaterialNameList();
 
+    List<MaterialVo4Unit> getMaterialByBarCode(String barCode);
+
     /**
      * 根据sku查询商品信息
-     * @param barCode 商品sku
+     * @param sku 商品sku
      */
-    List<MaterialVo4Unit> getMaterialByBarCode(String barCode);
+    List<MaterialVo4Unit> getMaterialBySku(String sku);
 
     List<MaterialVo4Unit> getMaterialByBarCode(List<String> barCodeList);
 
@@ -212,6 +228,10 @@ public interface MaterialService extends IService<Material> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     int batchSetMaterialCurrentUnitPrice(String ids) throws Exception;
 
+    /**
+     * 批量编辑
+     * @param jsonObject
+     */
     int batchUpdate(JSONObject jsonObject);
 
     MaterialExtend getMaterialExtendBySerialNumber(String serialNumber);

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

@@ -16,6 +16,11 @@ public interface MaterialUnitService extends IService<MaterialUnit> {
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     Boolean saveDetails(List<MaterialUnit> units, Long meId);
 
+    /**
+     * 获取商品包装规格
+     */
+    String getStandardByMeId(Long meId);
+
     int batchDeleteMaterialUnitByMIds();
 
 }

+ 2 - 2
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) {

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

@@ -120,7 +120,7 @@ public class UserBusinessService {
         return 1;
     }
 
-    public List<UserBusiness> getBasicData(String keyId, String type)throws Exception{
+    public List<UserBusiness> getBasicData(String keyId, String type){
         List<UserBusiness> list=null;
         try{
             list= userBusinessMapperEx.getBasicDataByKeyIdAndType(keyId, type);

+ 79 - 0
src/main/java/com/jsh/erp/service/impl/AuditProcessServiceImpl.java

@@ -0,0 +1,79 @@
+package com.jsh.erp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.jsh.erp.datasource.dto.AuditProcessDTO;
+import com.jsh.erp.datasource.dto.AuditProcessQueryDTO;
+import com.jsh.erp.datasource.entities.AuditNodeConfig;
+import com.jsh.erp.datasource.entities.AuditProcess;
+import com.jsh.erp.datasource.mappers.AuditNodeConfigMapper;
+import com.jsh.erp.datasource.mappers.AuditProcessMapper;
+import com.jsh.erp.datasource.vo.AuditProcessVo;
+import com.jsh.erp.query.LambdaQueryWrapperX;
+import com.jsh.erp.service.AuditProcessService;
+import com.jsh.erp.utils.PageUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+@Service
+@Slf4j
+public class AuditProcessServiceImpl extends ServiceImpl<AuditProcessMapper,AuditProcess> implements AuditProcessService {
+
+    @Resource
+    private AuditProcessMapper auditProcessMapper;
+    @Resource
+    private AuditNodeConfigMapper auditNodeConfigMapper;
+    /**
+     * 查询审核流程列表
+     * @param auditProcessQueryDTO 筛选条件
+     */
+    @Override
+    public List<AuditProcessVo> listBy(AuditProcessQueryDTO auditProcessQueryDTO) {
+        PageUtils.startPage();
+        List<AuditProcessVo> list = auditProcessMapper.listBy(auditProcessQueryDTO);
+        for (AuditProcessVo auditProcessVo : list) {
+            auditProcessVo.setAuditNodes(auditNodeConfigMapper.listByProcessId(auditProcessVo.getId()));
+        }
+        return list;
+    }
+
+    /**
+     * 新增审核流程
+     * @param auditProcessDTO
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public boolean add(AuditProcessDTO auditProcessDTO) {
+        try {
+            this.save(auditProcessDTO);
+            auditProcessDTO.getAuditNodes().forEach(v -> {
+                v.setProcessId(auditProcessDTO.getId());
+            });
+            auditNodeConfigMapper.insertBatch(auditProcessDTO.getAuditNodes());
+        }catch (Exception e){
+            log.error("创建审核流程失败", e);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * 修改审核流程及节点详情
+     * @param auditProcessDTO
+     */
+    @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
+    public boolean detailUpdate(AuditProcessDTO auditProcessDTO) {
+        try {
+            this.updateById(auditProcessDTO);
+            auditNodeConfigMapper.updateBatchById(auditProcessDTO.getAuditNodes());
+        }catch (Exception e){
+            log.error("修改审核流程失败", e);
+            return false;
+        }
+        return true;
+    }
+}

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

@@ -520,9 +520,9 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
             checkAssembleWithMaterialType(rowArr, depotHead.getSubType());
             for (int i = 0; i < rowArr.size(); i++) {
                 JSONObject rowObj = JSONObject.parseObject(rowArr.getString(i));
-                String barCode = rowObj.getString("barCode");
+                String barCode = rowObj.getString("sku");
                 //根据条码获取商品信息
-                MaterialExtend materialExtend = materialExtendService.getInfoByBarCode(barCode);
+                MaterialExtend materialExtend = materialExtendService.getInfoBySku(barCode);
                 if(materialExtend == null) {
                     throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_CODE,
                             String.format(ExceptionConstants.MATERIAL_BARCODE_IS_NOT_EXIST_MSG, barCode));
@@ -546,7 +546,7 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                 //出入库用户
                 depotItem.setWarehousingUser(rowObj.getLong("warehousingUser"));
                 //warehousingTime
-                depotItem.setWarehousingTime(rowObj.getString("warehousingTime"));
+                depotItem.setWarehousingTime(rowObj.getDate("warehousingTime"));
                 //生产日期
                 depotItem.setProductionDate(rowObj.getDate("productionDate"));
                 //保质期天数

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

@@ -245,7 +245,7 @@ public class DepotServiceImpl extends ServiceImpl<DepotMapper, Depot> implements
     }
 
     @Override
-    public List<Depot> findUserDepot()throws Exception{
+    public List<Depot> findUserDepot(){
         DepotExample example = new DepotExample();
         example.createCriteria().andTypeEqualTo(0).andEnabledEqualTo(true)
                 .andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
@@ -324,7 +324,7 @@ public class DepotServiceImpl extends ServiceImpl<DepotMapper, Depot> implements
     }
 
     @Override
-    public JSONArray findDepotByCurrentUser() throws Exception {
+    public JSONArray findDepotByCurrentUser() {
         JSONArray arr = new JSONArray();
         String type = "UserDepot";
         Long userId = userService.getCurrentUser().getId();

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

@@ -619,6 +619,16 @@ public class MaterialExtendServiceImpl extends ServiceImpl<MaterialExtendMapper,
     }
 
     /**
+     * 根据sku获取商品拓展信息
+     * @param sku 商品sku
+     */
+    @Override
+    public MaterialExtend getInfoBySku(String sku) {
+        MaterialExtend materialExtend = getOne(new LambdaQueryWrapperX<MaterialExtend>().eq(MaterialExtend::getSku,sku).eq(MaterialExtend::getDeleteFlag,"0"));
+        return materialExtend;
+    }
+
+    /**
      * 商品的副条码和数据库里面的商品条码存在重复(除自身商品之外)
      * @param manyBarCode
      * @param barCode
@@ -757,7 +767,7 @@ public class MaterialExtendServiceImpl extends ServiceImpl<MaterialExtendMapper,
     private String getSku(Long mid){
         MaterialExtend materialExtend = getOne(new LambdaQueryWrapperX<MaterialExtend>()
                 .eq(MaterialExtend::getMaterialId,mid).eq(MaterialExtend::getDeleteFlag,"0")
-                .orderByDesc(MaterialExtend::getId));
+                .orderByDesc(MaterialExtend::getId).last("limit 1"));
         if (materialExtend == null){
             Material material = materialService.getMaterialById(mid);
             return material.getSystemSpu() + "01";

+ 89 - 22
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java

@@ -147,7 +147,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                                         String mpList,String reminder) {
         String[] mpArr = new String[]{};
         if(StringUtil.isNotEmpty(mpList)){
-            mpArr= mpList.split(",");
+            mpArr = mpList.split(",");
         }
         List<MaterialVo4Unit> list = new ArrayList<>();
         try{
@@ -157,7 +157,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 idList = getListByParentId(Long.parseLong(categoryId));
             }
             PageUtils.startPage();
-            list= materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, materialOther, weight, expiryNum,
+            list = materialMapperEx.selectByConditionMaterial(materialParam, standard, model, color, brand, materialOther, weight, expiryNum,
                     enableSerialNumber, enabled, remark, idList, mpList,reminder);
             if (null != list && list.size()>0) {
                 Map<Long,BigDecimal> initialStockMap = getInitialStockMapByMaterialList(list);
@@ -284,6 +284,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
     }
 
     @Override
+    @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public int deleteMaterial(Long id, HttpServletRequest request)throws Exception {
         return batchDeleteMaterialByIds(id.toString());
     }
@@ -294,6 +295,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         return batchDeleteMaterialByIds(ids);
     }
 
+    /**
+     * 根据id集合批量删除商品
+     * @param ids
+     */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public int batchDeleteMaterialByIds(String ids){
@@ -341,6 +346,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         }
     }
 
+    /**
+     * 检查名称是否存在
+     */
     @Override
     public int checkIsNameExist(Long id, String name)throws Exception {
         MaterialExample example = new MaterialExample();
@@ -361,6 +369,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 otherField2, otherField3, unit, unitId);
     }
 
+    /**
+     * 批量设置状态-启用或者禁用
+     */
     @Override
     @Transactional(value = "transactionManager", rollbackFor = Exception.class)
     public int batchSetStatus(Boolean status, String ids)throws Exception {
@@ -500,17 +511,35 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
     }
 
     /**
-     * 商品选择-查找商品信息
+     * 商品选择-查找商品信息  按sku分类
      *
-     * @param materialQueryDTO
+     * @param categoryId
+     * @param q
+     * @param standardOrModel
+     * @param color
+     * @param brand
+     * @param mfrs
+     * @param enableSerialNumber
+     * @param enableBatchNumber
      * @param offset
      * @param rows
-     * @return
+     * @param depotId            @return
      * @throws Exception
      */
     @Override
-    public List<MaterialVo4Unit> findBySelectWithBarCode(MaterialQueryDTO materialQueryDTO, Integer offset, Integer rows) throws Exception {
-        return null;
+    public 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 {
+        List<Long> idList = new ArrayList<>();
+        if(categoryId!=null){
+            Long parentId = categoryId;
+            idList = getListByParentId(parentId);
+        }
+        if(StringUtil.isNotEmpty(q)) {
+            q = q.replace("'", "");
+            q = q.trim();
+        }
+        List<MaterialVo4Unit> list = materialMapperEx.findBySelectWithSku(idList, q, standardOrModel, color, brand, mfrs,
+                enableSerialNumber, enableBatchNumber, offset, rows,depotId);
+        return list;
     }
 
     @Override
@@ -538,6 +567,32 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
     }
 
     /**
+     * 商品选择-查找商品数量  按sku分类
+     */
+    @Override
+    public int findBySelectWithSkuCount(Long categoryId, String q, String standardOrModel, String color, String brand, String mfrs, String enableSerialNumber, String enableBatchNumber, Long depotId) throws Exception {
+        int result=0;
+        try{
+            List<Long> idList = new ArrayList<>();
+            if(categoryId!=null){
+                Long parentId = categoryId;
+                idList = getListByParentId(parentId);
+            }
+            if(StringUtil.isNotEmpty(q)) {
+                q = q.replace("'", "");
+            }
+            result = materialMapperEx.findBySelectWithSkuCount(idList, q, standardOrModel, color, brand, mfrs,
+                    enableSerialNumber, enableBatchNumber,depotId);
+        }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;
+    }
+
+    /**
      * 导出商品信息
      * @param categoryId
      * @param materialParam
@@ -706,9 +761,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 }
                 MaterialWithInitStock m = new MaterialWithInitStock();
                 m.setName(name);
-                m.setStandard(standard);
-                m.setModel(model);
-                m.setColor(color);
+//                m.setStandard(standard);
+//                m.setModel(model);
+//                m.setColor(color);
                 m.setBrand(brand);
                 //通过名称生成助记码
                 m.setMnemonic(PinYinUtil.getFirstLettersLo(name));
@@ -726,7 +781,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                         throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_WEIGHT_NOT_DECIMAL_CODE,
                                 String.format(ExceptionConstants.MATERIAL_WEIGHT_NOT_DECIMAL_MSG, i+1));
                     }
-                    m.setWeight(new BigDecimal(weight));
+                    //m.setWeight(new BigDecimal(weight));
                 }
                 if(StringUtil.isNotEmpty(expiryNum)) {
                     //校验保质期是否是正整数
@@ -852,7 +907,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 //判断该商品是否存在,如果不存在就新增,如果存在就更新
                 String basicBarCode = getBasicBarCode(m);
                 //根据条件返回产品列表
-                List<Material> materials = getMaterialListByParam(m.getName(),m.getStandard(),m.getModel(),m.getColor(),m.getUnit(),m.getUnitId(), basicBarCode);
+                List<Material> materials = getMaterialListByParam(m.getName(),null,null,null,m.getUnit(),m.getUnitId(), basicBarCode);
                 if(materials.size() == 0) { //产品列表为0,新增商品
                     materialMapperEx.insertSelectiveEx(m);
                     mId = m.getId();
@@ -1067,9 +1122,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 }
             }
             if(name.equals(material.getName()) &&
-                    standard.equals(material.getStandard()) &&
-                    model.equals(material.getModel()) &&
-                    color.equals(material.getColor()) &&
+
                     unit.equals(material.getUnit()) &&
                     sku.equals(materialSku)) {
                 String info = name + "-" + standard + "-" + model + "-" + color + "-" + unit + "-" + sku;
@@ -1481,6 +1534,20 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         return list;
     }
 
+    /**
+     * 根据sku查询商品信息
+     * @param sku 商品sku
+     */
+    @Override
+    public List<MaterialVo4Unit> getMaterialBySku(String sku) {
+        String [] skuArray = sku.split(",");
+        List<MaterialVo4Unit> list = materialMapperEx.getMaterialBySku(skuArray);
+        list.forEach(v -> {
+            v.setUnitList(v.getUnitId() == null ? null : unitService.getUnitListByID(v.getUnitId()));
+        });
+        return list;
+    }
+
     @Override
     public List<MaterialVo4Unit> getMaterialByBarCode(List<String> barCodeList) {
         // 将 List<String> 转换为 String[]
@@ -1891,9 +1958,9 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 MaterialWithInitStock m = new MaterialWithInitStock();
                 //设置商品名字、规格、型号、颜色、品牌、类型id
                 m.setName(name);
-                m.setStandard(standard);
-                m.setModel(model);
-                m.setColor(color);
+//                m.setStandard(standard);
+//                m.setModel(model);
+//                m.setColor(color);
                 m.setBrand(brand);
                 m.setCategoryId(categoryId);
                 //通过名称生成助记码
@@ -1901,7 +1968,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 //设置单位、备注、基础重量
                 m.setUnit(unit);
                 m.setRemark(remark);
-                m.setWeight(weight.isEmpty()  ? null : new BigDecimal(weight));
+                //m.setWeight(weight.isEmpty()  ? null : new BigDecimal(weight));
                 //设置商品是否启用
                 m.setEnabled("1".equals(enabled));
                 //设置商品是否开启序列号
@@ -2116,10 +2183,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
             }
             //名称,型号,品牌,规格,颜色,单位一样视为同一商品
             String str = m.getName()
-                    +"-" + m.getModel()
-                    + "-" + m.getStandard()
+//                    +"-" + m.getModel()
+//                    + "-" + m.getStandard()
                     + "-" + m.getBrand()
-                    + "-" + m.getColor()
+//                    + "-" + m.getColor()
                     + "-" + m.getUnit();
             if (materialMap.get(str) == null) {
                 //商品主表不存在,创建商品主表

+ 20 - 0
src/main/java/com/jsh/erp/service/impl/MaterialUnitServiceImpl.java

@@ -33,6 +33,26 @@ public class MaterialUnitServiceImpl extends ServiceImpl<MaterialUnitMapper,Mate
         return saveOrUpdateBatch(units);
     }
 
+    /**
+     * 获取商品包装规格
+     * @param meId
+     */
+    @Override
+    public String getStandardByMeId(Long meId) {
+        List<MaterialUnit> unitList = materialUnitMapper.selectList(new LambdaQueryWrapperX<MaterialUnit>()
+                .eq(MaterialUnit::getMaterialExtendId,meId).eq(MaterialUnit::getDeleteFlag,false));
+        String unitName = unitList == null ? "" : unitList.get(0).getName();
+        if (unitList.size() > 1){
+            MaterialUnit unit = unitList.get(1);
+            unitName += "/(" + unit.getName() + "=" + unit.getRatio() + unitList.get(0).getName() + ")";
+//            for (int i = 1; i < unitList.size(); i++) {
+//                MaterialUnit unit = unitList.get(i);
+//                unitName += "/(" + unit.getName() + "=" + unit.getRatio() + unitList.get(0).getName() + ")";
+//            }
+        }
+        return unitName;
+    }
+
     @Override
     public int batchDeleteMaterialUnitByMIds() {
         return 0;

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

@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jsh.erp.datasource.mappers.AuditNodeConfigMapper">
+
+    <select id="listByProcessId" parameterType="java.lang.Long" resultType="com.jsh.erp.datasource.vo.AuditNodeConfigVo">
+        SELECT anc.id,anc.process_id,anc.node_order,anc.auditor_type,anc.auditor,
+        u.username AS 'auditorName'
+        FROM audit_node_config anc
+        LEFT JOIN jsh_user u ON anc.auditor = u.id
+        <where>
+            anc.delete_flag = 0 AND anc.process_id = #{processId}
+        </where>
+        ORDER BY node_order ASC
+    </select>
+
+    <update id="updateBatchById" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" separator=";">
+            UPDATE audit_node_config
+            SET auditor_type = #{item.auditorType}, auditor = #{item.auditor}
+            WHERE id = #{item.id}
+        </foreach>
+    </update>
+
+</mapper>

+ 16 - 0
src/main/resources/mapper_xml/AuditProcessMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.jsh.erp.datasource.mappers.AuditProcessMapper">
+
+    <select id="listBy" parameterType="com.jsh.erp.datasource.dto.AuditProcessQueryDTO" resultType="com.jsh.erp.datasource.vo.AuditProcessVo">
+        SELECT id,`name`,type,description
+        FROM audit_process
+        <where>
+            delete_flag = 0
+            <if test="type != null and type != ''">
+                AND type LIKE CONCAT('%',#{type},'%')
+            </if>
+        </where>
+    </select>
+
+</mapper>

+ 10 - 5
src/main/resources/mapper_xml/DepotItemMapperEx.xml

@@ -318,11 +318,16 @@
     </select>
 
     <select id="getDetailList" parameterType="com.jsh.erp.datasource.entities.DepotItemExample" resultType="com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx">
-        select di.*,m.name MName,m.model MModel,m.color MColor,m.unit_id,m.standard MStandard,m.weight, m.img_name,
-        m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number, m.enable_batch_number,
-        m.brand, dp1.name DepotName,dp2.name AnotherDepotName, me.purchase_decimal,
-        me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,s.supplier supplierName,u.name unit_name,me.inventory,
-        us.username warehousingUserName,m.default_purchase_decimal,m.default_wholesale_decimal
+        select
+        di.*,
+        m.name,m.unit_id,m.weight, m.img_name,
+        m.other_field1 MOtherField1,m.other_field2 MOtherField2,m.other_field3 MOtherField3,m.enable_serial_number,
+        m.enable_batch_number, m.brand, dp1.name DepotName,dp2.name AnotherDepotName, m.default_purchase_decimal,m.default_wholesale_decimal,
+        me.purchase_decimal,me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.position,
+        me.model, me.color, me.standard, me.commodity_unit unit,
+        s.supplier supplierName,
+        u.name unit_name,me.inventory,
+        us.username warehousingUserName
         from jsh_depot_item di
         left join jsh_material m on di.material_id=m.id  and ifnull(m.delete_flag,'0') !='1'
         left join jsh_material_extend me on me.id=di.material_extend_id  and ifnull(me.delete_Flag,'0') !='1'

+ 27 - 24
src/main/resources/mapper_xml/MaterialMapper.xml

@@ -303,21 +303,21 @@
       <if test="record.name != null">
         name = #{record.name,jdbcType=VARCHAR},
       </if>
-      <if test="record.model != null">
-        model = #{record.model,jdbcType=VARCHAR},
-      </if>
-      <if test="record.standard != null">
-        standard = #{record.standard,jdbcType=VARCHAR},
-      </if>
+      <!--<if test="record.model != null">-->
+        <!--model = #{record.model,jdbcType=VARCHAR},-->
+      <!--</if>-->
+      <!--<if test="record.standard != null">-->
+        <!--standard = #{record.standard,jdbcType=VARCHAR},-->
+      <!--</if>-->
       <if test="record.brand != null">
         brand = #{record.brand,jdbcType=VARCHAR},
       </if>
       <if test="record.mnemonic != null">
         mnemonic = #{record.mnemonic,jdbcType=VARCHAR},
       </if>
-      <if test="record.color != null">
-        color = #{record.color,jdbcType=VARCHAR},
-      </if>
+      <!--<if test="record.color != null">-->
+        <!--color = #{record.color,jdbcType=VARCHAR},-->
+      <!--</if>-->
       <if test="record.unit != null">
         unit = #{record.unit,jdbcType=VARCHAR},
       </if>
@@ -330,9 +330,9 @@
       <if test="record.unitId != null">
         unit_id = #{record.unitId,jdbcType=BIGINT},
       </if>
-      <if test="record.weight != null">
-        weight = #{record.weight,jdbcType=DECIMAL},
-      </if>
+      <!--<if test="record.weight != null">-->
+        <!--weight = #{record.weight,jdbcType=DECIMAL},-->
+      <!--</if>-->
       <if test="record.enabled != null">
         enabled = #{record.enabled,jdbcType=BIT},
       </if>
@@ -357,6 +357,9 @@
       <if test="record.deleteFlag != null">
         delete_flag = #{record.deleteFlag,jdbcType=VARCHAR},
       </if>
+      <if test="record.expiryNum != null">
+        expiry_num = #{record.expiryNum},
+      </if>
     </set>
     <if test="_parameter != null">
       <include refid="Update_By_Example_Where_Clause" />
@@ -400,21 +403,21 @@
       <if test="name != null">
         name = #{name,jdbcType=VARCHAR},
       </if>
-      <if test="model != null">
-        model = #{model,jdbcType=VARCHAR},
-      </if>
-      <if test="standard != null">
-        standard = #{standard,jdbcType=VARCHAR},
-      </if>
+      <!--<if test="model != null">-->
+        <!--model = #{model,jdbcType=VARCHAR},-->
+      <!--</if>-->
+      <!--<if test="standard != null">-->
+        <!--standard = #{standard,jdbcType=VARCHAR},-->
+      <!--</if>-->
       <if test="brand != null">
         brand = #{brand,jdbcType=VARCHAR},
       </if>
       <if test="mnemonic != null">
         mnemonic = #{mnemonic,jdbcType=VARCHAR},
       </if>
-      <if test="color != null">
-        color = #{color,jdbcType=VARCHAR},
-      </if>
+      <!--<if test="color != null">-->
+        <!--color = #{color,jdbcType=VARCHAR},-->
+      <!--</if>-->
       <if test="unit != null">
         unit = #{unit,jdbcType=VARCHAR},
       </if>
@@ -427,9 +430,9 @@
       <if test="unitId != null">
         unit_id = #{unitId,jdbcType=BIGINT},
       </if>
-      <if test="weight != null">
-        weight = #{weight,jdbcType=DECIMAL},
-      </if>
+      <!--<if test="weight != null">-->
+        <!--weight = #{weight,jdbcType=DECIMAL},-->
+      <!--</if>-->
       <if test="enabled != null">
         enabled = #{enabled,jdbcType=BIT},
       </if>

+ 104 - 8
src/main/resources/mapper_xml/MaterialMapperEx.xml

@@ -49,28 +49,32 @@
     </resultMap>
 
     <select id="selectByConditionMaterial" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
-        select jm.*, u.name unitName, mc.name categoryName, jme.bar_code,
-        jme.purchase_decimal, jme.commodity_decimal, jme.wholesale_decimal, jme.low_decimal, jme.sku
+        select
+        jm.id, jm.category_id, jm.name, jm.brand, jm.mnemonic, jm.remark, jm.img_name, jm.enabled,
+        jm.other_field1, jm.other_field2, jm.other_field3, jm.enable_serial_number, jm.system_spu,
+        jm.moving_pin_reminder_cycle, jm.expiry_num, jm.default_purchase_decimal, jm.default_wholesale_decimal, jm.reminder,
+        mc.name categoryName,
+        jme.sku, jme.model, jme.standard, jme.color, jme.weight
         from (select m.id, min(me.id) meId
         from jsh_material m
         left join jsh_material_extend me on m.id = me.material_id and ifnull(me.delete_Flag,'0') !='1'
         where 1=1
         <if test="materialParam != null and materialParam !=''">
             <bind name="bindKey" value="'%'+materialParam+'%'"/>
-            and (me.bar_code like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey}
+            and (me.sku like #{bindKey} or me.batch_number like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or m.standard like #{bindKey}
             or m.model like #{bindKey} or m.color like #{bindKey} or m.brand like #{bindKey})
         </if>
         <if test="standard != null and standard !=''">
             <bind name="bindStandard" value="'%'+standard+'%'"/>
-            and m.standard like #{bindStandard}
+            and me.standard like #{bindStandard}
         </if>
         <if test="model != null and model !=''">
             <bind name="bindModel" value="'%'+model+'%'"/>
-            and m.model like #{bindModel}
+            and me.model like #{bindModel}
         </if>
         <if test="color != null and color !=''">
             <bind name="bindColor" value="'%'+color+'%'"/>
-            and m.color like #{bindColor}
+            and me.color like #{bindColor}
         </if>
         <if test="brand != null and brand !=''">
             <bind name="bindBrand" value="'%'+brand+'%'"/>
@@ -81,7 +85,7 @@
             and (m.other_field1 like #{bindOther} or m.other_field2 like #{bindOther} or m.other_field3 like #{bindOther})
         </if>
         <if test="weight != null and weight !=''">
-            and m.weight = #{weight}
+            and me.weight = #{weight}
         </if>
         <if test="expiryNum != null and expiryNum !=''">
             and m.expiry_num = #{expiryNum}
@@ -111,7 +115,6 @@
         order by m.id desc) tb
         left join jsh_material jm on tb.id = jm.id and ifnull(jm.delete_Flag,'0') !='1'
         left join jsh_material_extend jme on tb.meId = jme.id and ifnull(jme.delete_Flag,'0') !='1'
-        left join jsh_unit u on jm.unit_id = u.id and ifnull(u.delete_Flag,'0') !='1'
         left join jsh_material_category mc on jm.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
         order by tb.id desc
     </select>
@@ -367,6 +370,49 @@
         </if>
     </select>
 
+    <select id="findBySelectWithSku" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
+        select
+        m.id, m.name, m.brand,
+        mc.name categoryName,
+        me.id meId, me.sku, me.commodity_unit, me.standard, me.color, me.model, me.weight
+        from jsh_material m
+        left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
+        left JOIN jsh_material_category mc on m.category_id = mc.id and ifnull(mc.delete_Flag,'0') !='1'
+        where m.enabled = 1 AND me.id is not null AND me.enabled = 1
+        <if test="q != null and q !=''">
+            <bind name="bindKey" value="'%'+q+'%'"/>
+            and (me.sku like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or me.standard like #{bindKey}
+            or me.model like #{bindKey} or me.color like #{bindKey} or m.brand like #{bindKey} )
+        </if>
+        <if test="standardOrModel != null and standardOrModel !=''">
+            <bind name="bindStandardOrModel" value="'%'+standardOrModel+'%'"/>
+            and (me.standard like #{bindStandardOrModel} or me.model like #{bindStandardOrModel})
+        </if>
+        <if test="color != null and color !=''">
+            <bind name="bindColor" value="'%'+color+'%'"/>
+            and me.color like #{bindColor}
+        </if>
+        <if test="brand != null and brand !=''">
+            <bind name="bindBrand" value="'%'+brand+'%'"/>
+            and m.brand like #{bindBrand}
+        </if>
+        <if test="idList.size()>0">
+            and m.category_id in
+            <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="enableSerialNumber != null and enableSerialNumber !=''">
+            and m.enable_serial_number = #{enableSerialNumber}
+        </if>
+        and ifnull(m.delete_flag,'0') !='1'
+        ORDER BY m.id desc, me.default_flag desc, me.id asc
+        <if test="offset != null and rows != null">
+            limit #{offset},#{rows}
+        </if>
+    </select>
+
+
     <select id="findBySelectWithBarCodeCount" resultType="java.lang.Integer">
         select count(1) from jsh_material m
         left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
@@ -407,6 +453,39 @@
         and ifnull(m.delete_flag,'0') !='1'
     </select>
 
+    <select id="findBySelectWithSkuCount" resultType="java.lang.Integer">
+        select count(1) from jsh_material m
+        left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
+        where m.enabled = 1 AND me.id is not null AND me.enabled = 1
+        <if test="q != null and q !=''">
+            <bind name="bindKey" value="'%'+q+'%'"/>
+            and (me.sku like #{bindKey} or m.name like #{bindKey} or m.mnemonic like #{bindKey} or me.standard like #{bindKey}
+            or me.model like #{bindKey} or me.color like #{bindKey} or m.brand like #{bindKey})
+        </if>
+        <if test="standardOrModel != null and standardOrModel !=''">
+            <bind name="bindStandardOrModel" value="'%'+standardOrModel+'%'"/>
+            and (me.standard like #{bindStandardOrModel} or me.model like #{bindStandardOrModel})
+        </if>
+        <if test="color != null and color !=''">
+            <bind name="bindColor" value="'%'+color+'%'"/>
+            and me.color like #{bindColor}
+        </if>
+        <if test="brand != null and brand !=''">
+            <bind name="bindBrand" value="'%'+brand+'%'"/>
+            and m.brand like #{bindBrand}
+        </if>
+        <if test="idList.size()>0">
+            and m.category_id in
+            <foreach collection="idList" item="item" index="index" separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        <if test="enableSerialNumber != null and enableSerialNumber !=''">
+            and m.enable_serial_number = #{enableSerialNumber}
+        </if>
+        and ifnull(m.delete_flag,'0') !='1'
+    </select>
+
     <select id="exportExcel" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
         select m.*,u.name unitName, u.ratio, mc.name categoryName,me.bar_code,me.commodity_unit,me.purchase_decimal, me.commodity_decimal,
         me.wholesale_decimal, me.low_decimal, me.sku, me.production_date, me.expiry_num, me.supplier_id, me.bar_code, me.batch_number, me.depot_id, me.position
@@ -582,6 +661,23 @@
         order by m.id desc, me.default_flag desc, me.id asc
     </select>
 
+    <select id="getMaterialBySku" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultType="com.jsh.erp.datasource.entities.MaterialVo4Unit">
+        select
+        m.id, m.name, m.expiry_num, m.default_purchase_decimal, m.default_wholesale_decimal,
+        me.id meId, me.sku, me.commodity_unit, me.standard
+        from jsh_material m
+        left join jsh_material_extend me on m.id=me.material_id and ifnull(me.delete_Flag,'0') !='1'
+        left join jsh_unit u on m.unit_id=u.id and ifnull(u.delete_Flag,'0') !='1'
+        where
+        me.sku in (
+        <foreach collection="skuArray" item="sku" separator=",">
+            #{sku}
+        </foreach>
+        )
+        and ifnull(m.delete_flag,'0') !='1'
+        order by m.id desc, me.default_flag desc, me.id asc
+    </select>
+
     <select id="getMaterialByBarCodeAndWithOutMId" parameterType="com.jsh.erp.datasource.entities.MaterialExample" resultMap="ResultAndUnitMap">
         select m.*,u.name unit_name, me.id meId,me.bar_code m_bar_code, me.commodity_unit, me.purchase_decimal, me.commodity_decimal,
         me.wholesale_decimal, me.low_decimal, me.sku