4 次代码提交 50eca03c0d ... 3c8cae6327

作者 SHA1 备注 提交日期
  huang 3c8cae6327 订单保存并审核添加生成批次信息,修改商品信息导入条码判断问题,盘点是否存在差异条件查询不生效问题 3 周之前
  13660505945 296744993f Merge remote-tracking branch 'origin/dev_huangjunjie' 3 周之前
  13660505945 2d340838c8 Merge remote-tracking branch 'origin/dev_ml_423' 3 周之前
  13660505945 0846e8e16d Merge remote-tracking branch 'origin/dev_huangjunjie' 3 周之前

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

+ 15 - 35
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
      */
@@ -1058,8 +1058,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 +1746,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 +1808,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 +1852,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,19 +1865,12 @@ 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));
                 mList.add(m);
             }

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