|
|
@ -392,7 +392,6 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
if(!purchaseshortageDetailDOList.isEmpty()) { |
|
|
|
purchaseshortageDetailMapper.insertBatch(purchaseshortageDetailDOList); |
|
|
|
} |
|
|
|
|
|
|
|
//先判断每个物品是否免检
|
|
|
|
List<String> dedpulicationItem = new ArrayList<>(itemCodeSet); |
|
|
|
//是否是免检物品Map
|
|
|
@ -409,7 +408,6 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//增加库存事务
|
|
|
|
transactionService.createTransaction(transactionCreateReqVOList); |
|
|
|
List<String> typeList = new ArrayList<>(); |
|
|
@ -427,8 +425,31 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
} |
|
|
|
//移除预计入
|
|
|
|
expectinService.deleteExpectinByJobNumber(purchasereceiptJobMainDO.getNumber()); |
|
|
|
//变更记录
|
|
|
|
trendsApi.createTrends(purchasereceiptJobMainDO.getId(), "purchasereceiptJob", "执行了采购收货任务", TrendsTypeEnum.UPDATE); |
|
|
|
//消息通知
|
|
|
|
NotifySendSingleToRoleReqDTO notifySendSingleToRoleReqDTO = new NotifySendSingleToRoleReqDTO(); |
|
|
|
notifySendSingleToRoleReqDTO.setRoleId(1L); |
|
|
|
notifySendSingleToRoleReqDTO.setTemplateCode("createJob"); |
|
|
|
Map<String, Object> templateParams = new HashMap<>(); |
|
|
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String dateTime = LocalDateTime.now().format(fmt); |
|
|
|
templateParams.put("name","采购收货任务"); |
|
|
|
templateParams.put("dateTime", dateTime); |
|
|
|
templateParams.put("number", purchasereceiptJobMainDO.getNumber()); |
|
|
|
notifySendSingleToRoleReqDTO.setTemplateParams(templateParams); |
|
|
|
notifyMessageSendApi.sendMessageToRole(notifySendSingleToRoleReqDTO); |
|
|
|
// 创建检验申请
|
|
|
|
this.createInspectRequest(purchasereceiptRecordMainDO, purchasereceiptRecordDetailDOList); |
|
|
|
// 创建上架申请
|
|
|
|
this.createPutawayRequest(purchasereceiptRecordMainDO, purchasereceiptRecordDetailDOList, exemptSet); |
|
|
|
|
|
|
|
return number; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//全检,抽检,挑选---检验申请 // 采购收货记录 生成后 创建 到货检验申请
|
|
|
|
public String createInspectRequest(PurchasereceiptRecordMainDO purchasereceiptRecordMainDO, List<PurchasereceiptRecordDetailDO> purchasereceiptRecordDetailDOList) { |
|
|
|
//全检,抽检,挑选---检验申请 // 采购收货记录 生成后 创建 到货检验申请
|
|
|
|
SwitchDO switchDO1 = switchService.selectSwitchExist("CreateInspectRequestAfterPurchaseReceiptRecordCreated"); |
|
|
|
//采购收货记录 生成后 创建 到货检验申请
|
|
|
|
// 配置是否是TRUE
|
|
|
@ -436,17 +457,19 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
//按物料号和批次分组
|
|
|
|
Map<String, List<PurchasereceiptRecordDetailDO>> listMap = new HashMap<>(); |
|
|
|
for(PurchasereceiptRecordDetailDO purchasereceiptRecordDetailDO : purchasereceiptRecordDetailDOList) { |
|
|
|
// 不是免检的物品
|
|
|
|
if(!exemptSet.contains(purchasereceiptRecordDetailDO.getItemCode())) { |
|
|
|
//采购收货记录 生成后免检物料 创建 上架申请
|
|
|
|
String key = purchasereceiptRecordDetailDO.getItemCode() + "_" + purchasereceiptRecordDetailDO.getFromBatch(); |
|
|
|
List<PurchasereceiptRecordDetailDO> list = listMap.get(key); |
|
|
|
if(list == null) { |
|
|
|
list = new ArrayList<>(); |
|
|
|
} |
|
|
|
list.add(purchasereceiptRecordDetailDO); |
|
|
|
listMap.put(key, list); |
|
|
|
RuleRespVO ruleRespVO = ruleService.inspect(purchasereceiptRecordMainDO.getSupplierCode(), purchasereceiptRecordDetailDO.getItemCode()); |
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration()); |
|
|
|
if("EXEMPT".equals(jsonObject.getStr("InspectType"))) { |
|
|
|
//如果是免检
|
|
|
|
continue; |
|
|
|
} |
|
|
|
String key = purchasereceiptRecordDetailDO.getItemCode() + "_" + purchasereceiptRecordDetailDO.getFromBatch(); |
|
|
|
List<PurchasereceiptRecordDetailDO> list = listMap.get(key); |
|
|
|
if(list == null) { |
|
|
|
list = new ArrayList<>(); |
|
|
|
} |
|
|
|
list.add(purchasereceiptRecordDetailDO); |
|
|
|
listMap.put(key, list); |
|
|
|
} |
|
|
|
//组装到货检验数据
|
|
|
|
for(String mapKey : listMap.keySet()) { |
|
|
@ -457,7 +480,7 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
InspectRequestMainCreateReqVO inspectRequestMainCreateReqVO = new InspectRequestMainCreateReqVO(); |
|
|
|
String inspectRecordNumber = serialNumberApi.generateCode(RuleCodeEnum.INSPECT_RECORD.getCode()); |
|
|
|
inspectRequestMainCreateReqVO.setNumber(inspectRecordNumber); |
|
|
|
inspectRequestMainCreateReqVO.setPurchaseReceiptRecordNumber(number); |
|
|
|
inspectRequestMainCreateReqVO.setPurchaseReceiptRecordNumber(purchasereceiptRecordMainDO.getNumber()); |
|
|
|
inspectRequestMainCreateReqVO.setSupplierCode(purchasereceiptRecordMainDO.getSupplierCode()); |
|
|
|
inspectRequestMainCreateReqVO.setItemCode(recordDetailDO.getItemCode()); |
|
|
|
inspectRequestMainCreateReqVO.setBatch(recordDetailDO.getToBatch()); |
|
|
@ -488,10 +511,14 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
} |
|
|
|
inspectRequestMainCreateReqVO.setSubList(inspectRequestDetailCreateReqVOList); |
|
|
|
//创建检验申请
|
|
|
|
inspectRequestMainService.createInspectRequestMain(inspectRequestMainCreateReqVO); |
|
|
|
String inspectNumber = inspectRequestMainService.createInspectRequestMain(inspectRequestMainCreateReqVO); |
|
|
|
return inspectNumber; |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public String createPutawayRequest(PurchasereceiptRecordMainDO purchasereceiptRecordMainDO, List<PurchasereceiptRecordDetailDO> purchasereceiptRecordDetailDOList, Set<String> exemptSet) { |
|
|
|
//免检--上架申请 (采购收货记录 生成后免检物品 创建 上架申请)
|
|
|
|
SwitchDO switchDO2 = switchService.selectSwitchExist("ExemptItemCreatePutawayRequestAfterPurchaseReceiptRecordCreated"); |
|
|
|
//采购收货记录 生成后免检物料 创建 上架申请
|
|
|
@ -503,7 +530,10 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
putawayRequestMainCreateReqVO.setToWarehouseCode(null); |
|
|
|
List<PutawayRequestDetailCreateReqVO> putawayRequestDetailCreateReqVOList = new ArrayList<>(); |
|
|
|
for(PurchasereceiptRecordDetailDO purchasereceiptRecordDetailDO : purchasereceiptRecordDetailDOList) { |
|
|
|
if(exemptSet.contains(purchasereceiptRecordDetailDO.getItemCode())){ |
|
|
|
RuleRespVO ruleRespVO = ruleService.inspect(purchasereceiptRecordMainDO.getSupplierCode(), purchasereceiptRecordDetailDO.getItemCode()); |
|
|
|
JSONObject jsonObject = JSONUtil.parseObj(ruleRespVO.getConfiguration()); |
|
|
|
if("EXEMPT".equals(jsonObject.getStr("InspectType"))) { |
|
|
|
//如果是免检
|
|
|
|
PutawayRequestDetailCreateReqVO putawayRequestDetailCreateReqVO = new PutawayRequestDetailCreateReqVO(); |
|
|
|
BeanUtils.copyProperties(purchasereceiptRecordDetailDO, putawayRequestDetailCreateReqVO); |
|
|
|
putawayRequestDetailCreateReqVO.setFromOwnerCode(purchasereceiptRecordDetailDO.getToOwnerCode()); |
|
|
@ -522,26 +552,14 @@ public class PurchasereceiptJobMainServiceImpl implements PurchasereceiptJobMain |
|
|
|
putawayRequestMainCreateReqVO.setId(null).setCreator(null).setCreateTime(null).setUpdater(null).setUpdateTime(null); |
|
|
|
putawayRequestMainCreateReqVO.setConcurrencyStamp(1); |
|
|
|
putawayRequestMainCreateReqVO.setSubList(putawayRequestDetailCreateReqVOList); |
|
|
|
putawayRequestMainService.createPutawayRequestMain(putawayRequestMainCreateReqVO); |
|
|
|
String putawayNumber = putawayRequestMainService.createPutawayRequestMain(putawayRequestMainCreateReqVO); |
|
|
|
return putawayNumber; |
|
|
|
} |
|
|
|
} |
|
|
|
//变更记录
|
|
|
|
trendsApi.createTrends(purchasereceiptJobMainDO.getId(), "purchasereceiptJob", "执行了采购收货任务", TrendsTypeEnum.UPDATE); |
|
|
|
//消息通知
|
|
|
|
NotifySendSingleToRoleReqDTO notifySendSingleToRoleReqDTO = new NotifySendSingleToRoleReqDTO(); |
|
|
|
notifySendSingleToRoleReqDTO.setRoleId(1L); |
|
|
|
notifySendSingleToRoleReqDTO.setTemplateCode("createJob"); |
|
|
|
Map<String, Object> templateParams = new HashMap<>(); |
|
|
|
DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
|
String dateTime = LocalDateTime.now().format(fmt); |
|
|
|
templateParams.put("name","采购收货任务"); |
|
|
|
templateParams.put("dateTime", dateTime); |
|
|
|
templateParams.put("number", purchasereceiptJobMainDO.getNumber()); |
|
|
|
notifySendSingleToRoleReqDTO.setTemplateParams(templateParams); |
|
|
|
notifyMessageSendApi.sendMessageToRole(notifySendSingleToRoleReqDTO); |
|
|
|
return number; |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Long getPurchasereceiptJobCount() { |
|
|
|
QueryWrapper<PurchasereceiptJobMainDO> queryWrapper = new QueryWrapper<>(); |
|
|
|