Browse Source

为出库申请添加日志

lwx_dev
erdanergou 2 years ago
parent
commit
a80bf02023
  1. 14
      src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java
  2. 37
      src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

14
src/main/java/com/dreamchaser/depository_manage/controller/DepositoryRecordController.java

@ -944,14 +944,14 @@ public class DepositoryRecordController {
simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut()); simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut());
// 获取申请的物料信息 // 获取申请的物料信息
Inventory materialById = materialService.findInventoryById(applicationOutMinById.getMid()); Inventory inventoryById = materialService.findInventoryById(applicationOutMinById.getMid());
if ("-1".equals(applicationOutMinById.getUnit())) { if ("-1".equals(applicationOutMinById.getUnit())) {
simpleApplicationOutMinRecordP.setShowQuantity(materialById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); simpleApplicationOutMinRecordP.setShowQuantity(inventoryById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut()));
} else { } else {
simpleApplicationOutMinRecordP.setShowQuantity(applicationOutMinById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut())); simpleApplicationOutMinRecordP.setShowQuantity(applicationOutMinById.getUnit() + ":" + (applicationOutMinById.getQuantity() - applicationOutMinById.getTrueOut()));
} }
// 获取当前物料所存在的库位 // 获取当前物料所存在的库位
List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(materialById.getId(), applicationOutMinById.getDepositoryId()); List<PlaceP> placeByMidAndDid = placeService.findPlaceByMidAndDid(inventoryById.getId(), applicationOutMinById.getDepositoryId());
// 获取库位编码 // 获取库位编码
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
for (PlaceP placeP : placeByMidAndDid) { for (PlaceP placeP : placeByMidAndDid) {
@ -974,7 +974,7 @@ public class DepositoryRecordController {
// 当已经完成出库时设置数量为出库数 // 当已经完成出库时设置数量为出库数
simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity()); simpleApplicationOutMinRecordP.setQuantity(applicationOutMinById.getQuantity());
} }
List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(materialById.getId()); List<MaterialAndProducedDate> materialAndProducedDateByMid = materialService.findMaterialAndProducedDateByMid(inventoryById.getId());
if (materialAndProducedDateByMid.size() > 0) { if (materialAndProducedDateByMid.size() > 0) {
// 获取距今生产日期远的(即生产日期最早的) // 获取距今生产日期远的(即生产日期最早的)
for (MaterialAndProducedDate materialAndProducedDate : for (MaterialAndProducedDate materialAndProducedDate :
@ -991,14 +991,14 @@ public class DepositoryRecordController {
simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark()); simpleApplicationOutMinRecordP.setApplyRemark(applicationOutRecordPById.getApplyRemark());
simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId()); simpleApplicationOutMinRecordP.setDepositoryId(depositoryRecordById.getId());
simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname()); simpleApplicationOutMinRecordP.setDepositoryName(depositoryRecordById.getDname());
simpleApplicationOutMinRecordP.setMname(materialById.getMname()); simpleApplicationOutMinRecordP.setMname(inventoryById.getMname());
simpleApplicationOutMinRecordP.setMcode(materialById.getCode()); simpleApplicationOutMinRecordP.setMcode(inventoryById.getCode());
simpleApplicationOutMinRecordP.setApplicantName(userByPort.getName()); simpleApplicationOutMinRecordP.setApplicantName(userByPort.getName());
simpleApplicationOutMinRecordP.setCode(applicationOutRecordPById.getCode()); simpleApplicationOutMinRecordP.setCode(applicationOutRecordPById.getCode());
simpleApplicationOutMinRecordP.setPcode(sb.toString()); simpleApplicationOutMinRecordP.setPcode(sb.toString());
simpleApplicationOutMinRecordP.setPid(placeByDid.getId()); simpleApplicationOutMinRecordP.setPid(placeByDid.getId());
simpleApplicationOutMinRecordP.setState(state); simpleApplicationOutMinRecordP.setState(state);
simpleApplicationOutMinRecordP.setVersion(materialById.getVersion()); simpleApplicationOutMinRecordP.setVersion(inventoryById.getVersion());
applicationOutRecordMinList.add(simpleApplicationOutMinRecordP); applicationOutRecordMinList.add(simpleApplicationOutMinRecordP);
} }

37
src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java

@ -766,8 +766,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
flagForApproval = isApprovalPass; flagForApproval = isApprovalPass;
} }
map.put("flagForApproval", flagForApproval); map.put("flagForApproval", flagForApproval);
} } else {
else {
// 设置审批权限 // 设置审批权限
map.put("inType", "mt"); 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()); TransferRecord transferRecordById = transferRecordMapper.findTransferRecordById(applicationOutMinById.getTransferId());
placeId = transferRecordById.getFromPlaceId();// 获取转出库位 placeId = transferRecordById.getFromPlaceId();// 获取转出库位
@ -1091,7 +1092,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params); placeAndMaterialByMidAndPid = placeMapper.findPlaceAndMaterialByMidAndPid(params);
if (placeAndMaterialByMidAndPid != null) { if (placeAndMaterialByMidAndPid != null) {
// 如果当前库位存在该物料 // 如果当前库位存在该物料
if (placeAndMaterialByMidAndPid.getQuantity() < trueOut) { if (placeAndMaterialByMidAndPid.getQuantity() < trueOut * 100) {
// 如果当前库位数量不足 // 如果当前库位数量不足
flag = false; 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; double quantity = trueOut * 100;
inventory.setQuantity(inventory.getQuantity() - (int) quantity); inventory.setQuantity(inventory.getQuantity() - (int) quantity);
@ -2076,6 +2077,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
*/ */
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
void updateApplicationMinOutInfo(Integer id, ApplicationOutRecordMin applicationOutMinById, ApplicationOutRecord record, Double trueOut, UserByPort userByPort, Integer placeId, String userAgent, String userKey, String token) { 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中子订单键值 String redisMinRecordKey = "minRecord:" + id; // 设置redis中子订单键值
// 修改当前已经出库的数量 // 修改当前已经出库的数量
applicationOutMinById.setTrueOut((int) ((trueOut * 100) + applicationOutMinById.getTrueOut())); applicationOutMinById.setTrueOut((int) ((trueOut * 100) + applicationOutMinById.getTrueOut()));
@ -2112,6 +2114,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
} else { } else {
redisPool.getRedisTemplateByDb(15).opsForHash().put(otherManager, "minRecord", minRecord); redisPool.getRedisTemplateByDb(15).opsForHash().put(otherManager, "minRecord", minRecord);
} }
log.info("用户Id为:" + item + "的用户,剩余的出库任务为:" + minRecord);
} }
// 删除已完成的订单 // 删除已完成的订单
redisPool.getRedisTemplateByDb(15).delete(redisMinRecordKey); redisPool.getRedisTemplateByDb(15).delete(redisMinRecordKey);
@ -2411,12 +2414,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject); Map<String, String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
} } else {
else {
// 如果是通过仓库 // 如果是通过仓库
@ -2492,7 +2494,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject); Map<String, String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -2534,8 +2536,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
// 将当前redis中存储的spno删除 // 将当前redis中存储的spno删除
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo);
} }
} } else {
else {
// 如果是前两个审批节点 // 如果是前两个审批节点
//定义处理时间 //定义处理时间
@ -3226,8 +3227,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
s = "PangFuZhen,"; s = "PangFuZhen,";
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token); qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token);
}); });
} } else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) {
else if (map.containsKey("balancePosterPass") && !flagForHasOtherDepository) {
// 如果是平衡岗人员审批且进入该流程 // 如果是平衡岗人员审批且进入该流程
String result = ""; String result = "";
@ -3333,8 +3333,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
s = "PangFuZhen,"; s = "PangFuZhen,";
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token); qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1, userKey, token);
}); });
} } else {
else {
String result = ""; String result = "";
// 开启线程更改其他用户卡片模板样式 // 开启线程更改其他用户卡片模板样式
String simpleTime = DateUtil.getSimpleTime(new Date()); String simpleTime = DateUtil.getSimpleTime(new Date());
@ -3473,7 +3472,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject); Map<String, String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -3552,7 +3551,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject); Map<String, String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -3951,7 +3950,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject); Map<String, String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });
@ -4029,7 +4028,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService {
SendQyWxMessageThreadPool.execute(() -> { SendQyWxMessageThreadPool.execute(() -> {
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token);
String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId(); String redisOutKey = "wms_notificationOut_" + applicationOutRecordMin.getId();
Map<String,String> stringObjectMap = PublicConfig.returnMapString(jsonObject); Map<String, String> stringObjectMap = PublicConfig.returnMapString(jsonObject);
redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap); redisPool.getRedisTemplateByDb(14).opsForHash().putAll(redisOutKey, stringObjectMap);
redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS); redisPool.getRedisTemplateByDb(14).expire(redisOutKey, 72, TimeUnit.HOURS);
}); });

Loading…
Cancel
Save