diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java index 5dcf5942..5a27c7ba 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java @@ -944,14 +944,14 @@ public class DepositoryRecordController { simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut()); // 获取申请的物料信息 - Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid()); + Inventory inventoryById = materialService.findInventoryById(applicationOutMinById.getMid()); if ("-1".equals(applicationOutMinById.getUnit())) { - simpleApplicationOutMinRecordP.setShowQuantity(materialById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); + simpleApplicationOutMinRecordP.setShowQuantity(inventoryById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); } else { simpleApplicationOutMinRecordP.setShowQuantity(applicationOutMinById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); } // 获取当前物料所存在的库位 - List placeByMidAndDid = placeService.findPlaceByMidAndDid(materialById.getId(), applicationOutMinById.getDepositoryId()); + List placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryById.getId(), applicationOutMinById.getDepositoryId()); // 获取库位编码 StringBuilder sb = new StringBuilder(); for (PlaceP placeP : placeByMidAndDid) { @@ -974,7 +974,7 @@ public class DepositoryRecordController { // 当已经完成出库时设置数量为出库数 simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity()); } - List materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId()); + List materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(inventoryById.getId()); if (materialAndProducedDateByMid.size() > 0) { // 获取距今生产日期远的(即生产日期最早的) for (MaterialAndProducedDate materialAndProducedDate : @@ -991,14 +991,14 @@ public class DepositoryRecordController { simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark()); simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId()); simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname()); - simpleApplicationOutMinRecordP.setMname(materialById.getMname()); - simpleApplicationOutMinRecordP.setMcode(materialById.getCode()); + simpleApplicationOutMinRecordP.setMname(inventoryById.getMname()); + simpleApplicationOutMinRecordP.setMcode(inventoryById.getCode()); simpleApplicationOutMinRecordP.setApplicantName(userByPort.getName()); simpleApplicationOutMinRecordP.setCode(applicationOutRecordPById.getCode()); simpleApplicationOutMinRecordP.setPcode(sb.toString()); simpleApplicationOutMinRecordP.setPid(placeByDid.getId()); simpleApplicationOutMinRecordP.setState(state); - simpleApplicationOutMinRecordP.setVersion(materialById.getVersion()); + simpleApplicationOutMinRecordP.setVersion(inventoryById.getVersion()); applicationOutRecordMinList.add(simpleApplicationOutMinRecordP); } diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index c6152eb7..a8f1eaed 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -766,8 +766,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { flagForApproval = isApprovalPass; } map.put("flagForApproval", flagForApproval); - } - else { + } else { // 设置审批权限 map.put("inType", "mt"); // 获取当前类别物料是否需要审批 @@ -1059,7 +1058,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 如果是按基础单位出库 - if (istransfer == 1) {// 如果是库存转移 + if (istransfer == 1) { + // 如果是库存转移 + // 获取库存转移订单 TransferRecord transferRecordById = transferRecordMapper.findTransferRecordById(applicationOutMinById.getTransferId()); placeId = transferRecordById.getFromPlaceId();// 获取转出库位 @@ -1091,7 +1092,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params); if (placeAndMaterialByMidAndPid != null) { // 如果当前库位存在该物料 - if (placeAndMaterialByMidAndPid.getQuantity() < trueOut) { + if (placeAndMaterialByMidAndPid.getQuantity() < trueOut * 100) { // 如果当前库位数量不足 flag = false; } @@ -1103,7 +1104,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } } // 如果物料数量可以出库并且库位数量充足 - if (inventory.getQuantity() >= trueOut && flag) { + if (inventory.getQuantity() >= trueOut * 100 && flag) { // 当前出库数量 double quantity = trueOut * 100; inventory.setQuantity(inventory.getQuantity() - (int) quantity); @@ -2076,6 +2077,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { */ @Transactional(rollbackFor = Exception.class) void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent, String userKey, String token) { + log.info("要出库的子订单数据id:" + id + ",出库数量:" + trueOut + "出库人:" + userByPort.getName() + ":" + userByPort.getNumber()); String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值 // 修改当前已经出库的数量 applicationOutMinById.setTrueOut((int) ((trueOut * 100) + applicationOutMinById.getTrueOut())); @@ -2112,6 +2114,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } else { redisPool.getRedisTemplateByDb(15).opsForHash().put(otherManager, "minRecord", minRecord); } + log.info("用户Id为:" + item + "的用户,剩余的出库任务为:" + minRecord); } // 删除已完成的订单 redisPool.getRedisTemplateByDb(15).delete(redisMinRecordKey); @@ -2411,12 +2414,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); - Map stringObjectMap = PublicConfig.returnMapString(jsonObject); + Map stringObjectMap = PublicConfig.returnMapString(jsonObject); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); }); - } - else { + } else { // 如果是通过仓库 @@ -2492,7 +2494,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); - Map stringObjectMap = PublicConfig.returnMapString(jsonObject); + Map stringObjectMap = PublicConfig.returnMapString(jsonObject); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); }); @@ -2534,8 +2536,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 将当前redis中存储的spno删除 redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); } - } - else { + } else { // 如果是前两个审批节点 //定义处理时间 @@ -3226,8 +3227,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { s = "PangFuZhen,"; qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token); }); - } - else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) { + } else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) { // 如果是平衡岗人员审批且进入该流程 String result = ""; @@ -3333,8 +3333,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { s = "PangFuZhen,"; qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token); }); - } - else { + } else { String result = ""; // 开启线程更改其他用户卡片模板样式 String simpleTime = DateUtil.getSimpleTime(new Date()); @@ -3473,7 +3472,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); - Map stringObjectMap = PublicConfig.returnMapString(jsonObject); + Map stringObjectMap = PublicConfig.returnMapString(jsonObject); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); }); @@ -3552,7 +3551,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); - Map stringObjectMap = PublicConfig.returnMapString(jsonObject); + Map stringObjectMap = PublicConfig.returnMapString(jsonObject); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); }); @@ -3951,7 +3950,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); - Map stringObjectMap = PublicConfig.returnMapString(jsonObject); + Map stringObjectMap = PublicConfig.returnMapString(jsonObject); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); }); @@ -4029,7 +4028,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { SendQyWxMessageThreadPool.execute(() -> { JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); - Map stringObjectMap = PublicConfig.returnMapString(jsonObject); + Map stringObjectMap = PublicConfig.returnMapString(jsonObject); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); });