5 Commits 54bf2df97d ... df07e58cdf

Auteur SHA1 Message Date
  yz df07e58cdf Merge remote-tracking branch 'origin/dev_ml_423' il y a 3 semaines
  maliang 03ecf033a5 fix:bug il y a 3 semaines
  huang 7435670004 Merge branch 'master' of http://121.40.253.172:3000/pengyue/jsh_erp into dev_huangjunjie il y a 3 semaines
  huang 6dd256174b 商品信息导入表格新增库位信息 il y a 3 semaines
  huang 3c8cae6327 订单保存并审核添加生成批次信息,修改商品信息导入条码判断问题,盘点是否存在差异条件查询不生效问题 il y a 3 semaines

BIN
jshERP-web/public/doc/goods_template.xls


+ 1 - 1
jshERP-web/src/views/bill/modules/OtherInModal.vue

@@ -344,7 +344,7 @@ export default {
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, statistics: true },
           // {
           //   title: '实际入库数量',

+ 1 - 1
jshERP-web/src/views/bill/modules/OtherOutModal.vue

@@ -333,7 +333,7 @@ export default {
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, statistics: true },
           {
             title: '实际出库数量',

+ 1 - 1
jshERP-web/src/views/bill/modules/PurchaseInModal.vue

@@ -524,7 +524,7 @@ export default {
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, statistics: true },
           { title: '税率', key: 'taxRate', width: '120px', type: FormTypes.inputNumber, placeholder: '%' },
           {

+ 1 - 1
jshERP-web/src/views/bill/modules/PurchaseOrderModal.vue

@@ -479,7 +479,7 @@ export default {
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, statistics: true },
 
           // {

+ 1 - 1
jshERP-web/src/views/bill/modules/SaleOrderModal.vue

@@ -435,7 +435,7 @@ export default {
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, statistics: true },
           { title: '税率', key: 'taxRate', width: '120px', type: FormTypes.inputNumber, placeholder: '%' },
           {

+ 1 - 1
jshERP-web/src/views/bill/modules/SaleOutModal.vue

@@ -536,7 +536,7 @@ export default {
             statistics: true,
             validateRules: [{ required: true, message: '${title}不能为空' }],
           },
-          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber },
+          { title: '单价', key: 'unitPrice', width: '120px', type: FormTypes.inputNumber,validateRules: [{ required: true, message: '${title}不能为空' }], },
           { title: '金额', key: 'allPrice', width: '120px', type: FormTypes.inputNumber, statistics: true },
           { title: '税率', key: 'taxRate', width: '120px', type: FormTypes.inputNumber, placeholder: '%' },
           {

+ 1 - 1
jshERP-web/src/views/stock/components/stockModal.vue

@@ -178,7 +178,7 @@ export default {
       })
     },
     onChangeGoods() {
-      this.$refs.selectModal.queryParam.depotId = this.form.depotId
+      // this.$refs.selectModal.queryParam.depotId = this.form.depotId
       this.$refs.selectModal.showModal()
     },
     getList(id) {

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

@@ -8,6 +8,7 @@ import lombok.experimental.Accessors;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 产品表实体类(商品信息)
@@ -89,6 +90,9 @@ public class Material {
     @TableField(exist = false)
     private List<MaterialExtend> list;
 
+    @TableField(exist = false)
+    private Map<Long,String> depotMap;
+
 
     public void setName(String name) {
         this.name = name == null ? null : name.trim();

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

@@ -822,6 +822,17 @@ public class DepotItemServiceImpl extends ServiceImpl<DepotItemMapper, DepotItem
                     }
                 }
                 this.insertDepotItemWithObj(depotItem);
+                if ("1".equals(depotHead.getStatus())){
+                    //单据审核,处理批次商品信息
+                    if(BusinessConstants.DEPOTHEAD_TYPE_IN.equals(depotHead.getType())){
+                        //表单入库,新增批次商品信息
+                        materialBatchService.generateMaterialBatchByDepotItemId(depotItem,depotHead.getOrganId());
+                    }else if(BusinessConstants.DEPOTHEAD_TYPE_OUT.equals(depotHead.getType())){
+                        //表单出库,修改商品库存
+                        //materialExtend.setInventory(materialExtend.getInventory().subtract(depotItem.getBasicNumber()));
+                        materialBatchService.handleMaterialBatchByDepotItemId(depotItem.getId());
+                    }
+                }
                 //更新当前库存
                 updateCurrentStock(depotItem);
                 //更新当前成本价

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

@@ -121,8 +121,6 @@ public class MaterialBatchServiceImpl extends ServiceImpl<MaterialBatchMapper,Ma
                 log.setType(type);
                 inventoryLogService.save(log);
                 update(new UpdateWrapper<MaterialBatch>().set("inventory",materialBatch.getInventory()).eq("id",materialBatch.getId()));
-                //更新当前库存
-                depotItemService.updateCurrentStockFun(materialBatch.getMaterialId(),materialBatch.getDepotId());
         }
     }
 

+ 61 - 36
src/main/java/com/jsh/erp/service/impl/MaterialServiceImpl.java

@@ -981,10 +981,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
 
     /**
      * 缓存各个仓库的库存信息
-     * @param src
+     * @param src 行数据
      * @param depotCount
      * @param depotMap
-     * @param i
+     * @param i 行数
      * @return
      * @throws Exception
      */
@@ -1009,6 +1009,35 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
     }
 
     /**
+     * 获取excel仓库库位信息
+     * @param src 行数据
+     * @param depotCount 仓库数量
+     * @param depotMap 仓库集合
+     * @param i
+     * @return
+     * @throws Exception
+     */
+    private Map<Long, String> getExcelDepot(Sheet src, int depotCount, Map<String, Long> depotMap, int i) throws Exception {
+        Map<Long, String> stockMap = new HashMap<>();
+        for(int j = 1; j<= depotCount; j++) {
+            int col = 16 + j;
+            if(col < src.getColumns()){
+                String depotName = ExcelUtils.getContent(src, 1, col); //获取仓库名称
+                if(StringUtil.isNotEmpty(depotName)) {
+                    Long depotId = depotMap.get(depotName);
+                    if(depotId!=null && depotId!=0L){
+                        String stockStr = ExcelUtils.getContent(src, i, col);
+                        if(StringUtil.isNotEmpty(stockStr)) {
+                            stockMap.put(depotId, stockStr);
+                        }
+                    }
+                }
+            }
+        }
+        return stockMap;
+    }
+
+    /**
      * 批量校验excel中有无重复商品,是指名称、规格、型号、颜色、单位
      * @param mList
      */
@@ -1058,8 +1087,8 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
             }
         }
         //EXCEL中有条码在系统中已存在
-        int count = materialExtendService.getCountByManyBarCodeWithoutUs(barCode, barCode);
-        if (count>0) {
+        MaterialExtend materialExtend = materialExtendService.getInfoByBarCode(barCode);
+        if (materialExtend != null && !materialExtend.getBarCode().isEmpty()) {
             throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_CODE,
                     String.format(ExceptionConstants.MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG, barCode));
         }
@@ -1746,8 +1775,6 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 String otherField2 = ExcelUtils.getContent(src, i, 14); //自定义2
                 String otherField3 = ExcelUtils.getContent(src, i, 15); //自定义3
                 String remark = ExcelUtils.getContent(src, i, 16); //备注
-                String depotName = ExcelUtils.getContent(src, i, 17); //仓库名称
-                String position = ExcelUtils.getContent(src, i, 18); //仓位货架
                 //校验字段
                 //名称为空
                 if(StringUtil.isEmpty(name)) {
@@ -1810,16 +1837,16 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 }
                 //批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
                 batchCheckExistBarCodeByParam(mList, barCode, null);
-                Long depotId = null;
-                if(StringUtil.isNotEmpty(depotName)) {
-                    //根据仓库名查询仓库id
-                    depotId = depotMapperEx.selectByConditionDepot(depotName,null,null).get(0).getId();
-                    if (depotId == null){
-                        //仓库不存在
-                        throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_CODE,
-                                String.format(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_MSG, i+1));
-                    }
-                }
+//                Long depotId = null;
+//                if(StringUtil.isNotEmpty(depotName)) {
+//                    //根据仓库名查询仓库id
+//                    depotId = depotMapperEx.selectByConditionDepot(depotName,null,null).get(0).getId();
+//                    if (depotId == null){
+//                        //仓库不存在
+//                        throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_CODE,
+//                                String.format(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_MSG, i+1));
+//                    }
+//                }
                 MaterialWithInitStock m = new MaterialWithInitStock();
                 //设置商品名字、规格、型号、颜色、品牌、类型id
                 m.setName(name);
@@ -1854,18 +1881,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 JSONObject materialExObj = new JSONObject();
                 JSONObject basicObj = new JSONObject();
                 basicObj.put("commodityUnit", manyUnit.isEmpty() ? unit : manyUnit);    //商品单位
-                //basicObj.put("sku", sku);   //商品属性
-//                basicObj.put("purchaseDecimal", purchaseDecimal);   //采购价格
-//                basicObj.put("commodityDecimal", commodityDecimal); //零售价格
-//                basicObj.put("wholesaleDecimal", wholesaleDecimal); //销售价格
-//                basicObj.put("lowDecimal", lowDecimal); //最低售价
-//                basicObj.put("productionDate",productionDate); //生产日期
-//                basicObj.put("expiryNum",expiryNum);    //保质期天数
-//                basicObj.put("supplierId",supplierId); //供应商id
                 basicObj.put("barCode", barCode); //商品条码
-//                basicObj.put("inventory",inventory); //库存
-                basicObj.put("depotId",depotId);    //仓库id
-                basicObj.put("position",position);  //仓位货架
                 materialExObj.put("basic", basicObj);
                 if(StringUtil.isNotEmpty(manyUnit) && StringUtil.isNotEmpty(ratio)){ //多单位
                     //校验比例是否是数字(含小数)
@@ -1878,20 +1894,13 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                         m.setUnitId(unitId);
                         m.setUnit("");
                     }
-//                    JSONObject otherObj = new JSONObject();
-//                    otherObj.put("commodityUnit", manyUnit);
-//                    otherObj.put("purchaseDecimal", parsePrice(purchaseDecimal,ratio));
-//                    otherObj.put("commodityDecimal", parsePrice(commodityDecimal,ratio));
-//                    otherObj.put("wholesaleDecimal", parsePrice(wholesaleDecimal,ratio));
-//                    otherObj.put("lowDecimal", parsePrice(lowDecimal,ratio));
-//                    materialExObj.put("other", otherObj);
                 } else {
                     m.setUnit(unit);
                     m.setUnitId(null);
                 }
                 m.setMaterialExObj(materialExObj);
-                //设置库存
-                m.setStockMap(getStockMapCache(src, depotCount, depotMap, i));
+                //设置仓库库位
+                m.setDepotMap(getExcelDepot(src, depotCount, depotMap, i));
                 mList.add(m);
             }
             //处理表单信息,转为对象集合
@@ -1899,6 +1908,21 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
             for (Material material : materialList) {
                 //添加商品信息
                 materialMapperEx.insertSelectiveEx(material);
+                //获取excel商品添加库存
+                Map<Long, String> stockMap = material.getDepotMap();
+                for(Depot depot: depotList){
+                    Long depotId = depot.getId();
+                    //excel里面的当前库位
+                    String position = stockMap.get(depot.getId());
+                    //新增或更新初始库存
+                    if(StringUtil.isNotEmpty(position)) {
+                        MaterialInitialStock materialInitialStock = new MaterialInitialStock();
+                        materialInitialStock.setDepotId(depotId);
+                        materialInitialStock.setMaterialId(material.getId());
+                        materialInitialStock.setPosition(position);
+                        materialInitialStockMapper.insertSelective(materialInitialStock);
+                    }
+                }
                 //添加商品子信息
                 for (MaterialExtend materialExtend : material.getList()) {
                     //设置商品id
@@ -2053,6 +2077,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
                 material.setSystemSku(m.getSystemSku());
                 List<MaterialExtend> list = new ArrayList<>();
                 material.setList(list);
+                material.setDepotMap(m.getDepotMap());
                 materialMap.put(str,material);
             }
             //添加子表信息

+ 2 - 2
src/main/resources/mapper_xml/TaskStocktakingItemMapper.xml

@@ -112,10 +112,10 @@
             <if test="position != null and position != ''">
                 AND me.position LIKE  CONCAT('%',#{position},'%')
             </if>
-            <if test="isDifference != null and isDifference == '1'">
+            <if test="isDifference != null and isDifference == '1'.toString()">
                 AND tsi.new_inventory = me.inventory
             </if>
-            <if test="isDifference != null and isDifference == '2'">
+            <if test="isDifference != null and isDifference == '2'.toString()">
                 AND tsi.new_inventory != 0
                 AND tsi.new_inventory != me.inventory
             </if>