lhm 3 năm trước cách đây
mục cha
commit
9ac8e51a51

+ 24 - 24
kmall-admin/src/main/java/com/kmall/admin/service/impl/haikong/StockChangeRecordServiceImpl.java

@@ -64,16 +64,16 @@ public class StockChangeRecordServiceImpl implements StockChangeRecordService {
         stockChangeRecord.setModifyTime(modifyTime);
         stockChangeRecord.setModifyTime(modifyTime);
         stockChangeRecord.setCreateTime(modifyTime);
         stockChangeRecord.setCreateTime(modifyTime);
 
 
-        List<StockChangeRecordEntity> storageList = Collections.singletonList(stockChangeRecord);
-        if (Constants.StockChangeType.item_0.getType().equals(stockChangeRecord.getType())) {
-            // 出库
-            productStoreRelaService.updateStockNumberByOutbound(storageList);
-            goodsService.updateStockNumberByOutbound(storageList);
-        } else if (Constants.StockChangeType.item_1.getType().equals(stockChangeRecord.getType())) {
-            // 入库
-            productStoreRelaService.updateStockNumberByStorage(storageList);
-            goodsService.updateStockNumberByStorage(storageList);
-        }
+//        List<StockChangeRecordEntity> storageList = Collections.singletonList(stockChangeRecord);
+//        if (Constants.StockChangeType.item_0.getType().equals(stockChangeRecord.getType())) {
+//            // 出库
+//            productStoreRelaService.updateStockNumberByOutbound(storageList);
+//            goodsService.updateStockNumberByOutbound(storageList);
+//        } else if (Constants.StockChangeType.item_1.getType().equals(stockChangeRecord.getType())) {
+//            // 入库
+//            productStoreRelaService.updateStockNumberByStorage(storageList);
+//            goodsService.updateStockNumberByStorage(storageList);
+//        }
 
 
         return stockChangeRecordDao.save(stockChangeRecord);
         return stockChangeRecordDao.save(stockChangeRecord);
     }
     }
@@ -133,20 +133,20 @@ public class StockChangeRecordServiceImpl implements StockChangeRecordService {
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public synchronized void saveBatch(List<StockChangeRecordEntity> stockChangeRecordEntities) {
     public synchronized void saveBatch(List<StockChangeRecordEntity> stockChangeRecordEntities) {
 
 
-        Map<String, List<StockChangeRecordEntity>> stringListHashMap = new HashMap<>();
-
-        stockChangeRecordEntities.forEach(entity -> {
-            String type = entity.getType();
-            if (stringListHashMap.containsKey(type)) {
-                List<StockChangeRecordEntity> entities = stringListHashMap.get(type);
-                entities.add(entity);
-                stringListHashMap.put(type, entities);
-            } else {
-                ArrayList<StockChangeRecordEntity> entities = new ArrayList<>();
-                entities.add(entity);
-                stringListHashMap.put(type, entities);
-            }
-        });
+//        Map<String, List<StockChangeRecordEntity>> stringListHashMap = new HashMap<>();
+//
+//        stockChangeRecordEntities.forEach(entity -> {
+//            String type = entity.getType();
+//            if (stringListHashMap.containsKey(type)) {
+//                List<StockChangeRecordEntity> entities = stringListHashMap.get(type);
+//                entities.add(entity);
+//                stringListHashMap.put(type, entities);
+//            } else {
+//                ArrayList<StockChangeRecordEntity> entities = new ArrayList<>();
+//                entities.add(entity);
+//                stringListHashMap.put(type, entities);
+//            }
+//        });
 
 
 //        // 出库和入库,需要修改库存
 //        // 出库和入库,需要修改库存
 //        // 出库集合,减库存
 //        // 出库集合,减库存

+ 6 - 5
kmall-admin/src/main/java/com/kmall/admin/service/impl/haikong/StockChangeServiceImpl.java

@@ -241,17 +241,18 @@ public class StockChangeServiceImpl implements StockChangeService {
         // 审核成功才需要更新库存
         // 审核成功才需要更新库存
         if (Constants.AuditStatus.AUDIT_SUCCESS.getType().equals(type)) {
         if (Constants.AuditStatus.AUDIT_SUCCESS.getType().equals(type)) {
 
 
-
-            stockChangeEntities.stream().filter(stockChangeEntity -> {
+            stockChangeEntities = stockChangeEntities.stream().filter(stockChangeEntity -> {
                 log.info("工单号为:{}的审核状态为成功",stockChangeEntity.getId());
                 log.info("工单号为:{}的审核状态为成功",stockChangeEntity.getId());
                 return !stockChangeEntity.getAudit().equals(Constants.AuditStatus.AUDIT_SUCCESS.getType());
                 return !stockChangeEntity.getAudit().equals(Constants.AuditStatus.AUDIT_SUCCESS.getType());
-            }).peek(stockChangeEntity -> {
+            }).collect(Collectors.toList());
+
+            stockChangeEntities.forEach(stockChangeEntity -> {
                 String type1 = stockChangeEntity.getType();
                 String type1 = stockChangeEntity.getType();
                 if (Constants.StockChangeType.item_0.getType().equals(type1)
                 if (Constants.StockChangeType.item_0.getType().equals(type1)
-                || Constants.StockChangeType.item_1.getType().equals(type1)) {
+                        || Constants.StockChangeType.item_1.getType().equals(type1)) {
                     inChangeEntities.add(stockChangeEntity);
                     inChangeEntities.add(stockChangeEntity);
                 } else if (Constants.StockChangeType.item_3.getType().equals(type1)
                 } else if (Constants.StockChangeType.item_3.getType().equals(type1)
-                || Constants.StockChangeType.item_4.getType().equals(type1)) {
+                        || Constants.StockChangeType.item_4.getType().equals(type1)) {
                     outChangeEntities.add(stockChangeEntity);
                     outChangeEntities.add(stockChangeEntity);
                 }
                 }
             });
             });

+ 1 - 5
kmall-admin/src/main/resources/mybatis/mapper/haikong/StockChangeDao.xml

@@ -64,12 +64,8 @@
 			c.`modify_by`,
 			c.`modify_by`,
 			c.`modify_time`,
 			c.`modify_time`,
 			c.`audit_by`,
 			c.`audit_by`,
-			c.`audit_time`,
-		    r.product,
-		    r.specification
+			c.`audit_time`
 		from mall_stock_change c
 		from mall_stock_change c
-		left join mall_stock_change_record r
-		on c.id =r.parent_id
 		WHERE 1=1
 		WHERE 1=1
 		<if test="name != null and name.trim() != ''">
 		<if test="name != null and name.trim() != ''">
 			AND c.name LIKE concat('%',#{name},'%')
 			AND c.name LIKE concat('%',#{name},'%')

+ 13 - 5
kmall-admin/src/main/webapp/js/shop/stockchangerecord.js

@@ -4,14 +4,22 @@ $(function () {
         datatype: "json",
         datatype: "json",
         colModel: [
         colModel: [
 			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
 			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+			{label: '单号', name: 'parentId', index: 'parentId', width: 60, align: 'center'},
 			{label: '门店id', name: 'storeId', index: 'store_id', width: 40, align: 'center'},
 			{label: '门店id', name: 'storeId', index: 'store_id', width: 40, align: 'center'},
 			{label: 'sku', name: 'sku', index: 'sku', width: 60, align: 'center'},
 			{label: 'sku', name: 'sku', index: 'sku', width: 60, align: 'center'},
 			{label: '类型', name: 'type', index: 'type', width: 40, align: 'center', formatter:function (value) {
 			{label: '类型', name: 'type', index: 'type', width: 40, align: 'center', formatter:function (value) {
-				if (value === '0') {
-					return '出库';
-				} else {
-					return '入库';
-				}
+					if (value == '0') {
+						return '普通入库';
+					} else if (value == '1') {
+						return '调拨入库';
+					} else if (value == '2') {
+						return '销售出库';
+					} else if (value == '3') {
+						return '普通出库';
+					} else if (value == '4') {
+						return '调拨出库';
+					}
+					return '-';
 			}},
 			}},
 			{label: '数量', name: 'number', index: 'number', width: 30, align: 'center'},
 			{label: '数量', name: 'number', index: 'number', width: 30, align: 'center'},
 			{label: '备注', name: 'remark', index: 'remark', width: 120, align: 'center'},
 			{label: '备注', name: 'remark', index: 'remark', width: 120, align: 'center'},