|
|
|
@ -406,52 +406,6 @@ public class WorkOrderRunServiceImpl extends BaseServiceImpl<WorkOrderRunMapper, |
|
|
|
//更新车间订单主责任单位
|
|
|
|
//更新车间订单主责任单位
|
|
|
|
workOrderService.updateHostWorkUnit(wo); |
|
|
|
workOrderService.updateHostWorkUnit(wo); |
|
|
|
workPlanMapper.updateById(wpList); |
|
|
|
workPlanMapper.updateById(wpList); |
|
|
|
|
|
|
|
|
|
|
|
// 调用外协接收
|
|
|
|
|
|
|
|
String wxWoCode = null; |
|
|
|
|
|
|
|
Oem oem = oemMapper.selectById(workOrderRun.getInCustomer()); |
|
|
|
|
|
|
|
User planner = UserCache.getUser(wo.getPlanner()); |
|
|
|
|
|
|
|
if (workOrderRun.getCollaborate() != null && workOrderRun.getCollaborate().equalsIgnoreCase("1")) { |
|
|
|
|
|
|
|
List<BsProcessSetEntity> processSets = processSetMapper.selectByIds(wpList.stream().filter(workPlan -> oem.getId().equals(workPlan.getOcId())).map(WorkPlan::getPpsId).collect(Collectors.toList())); |
|
|
|
|
|
|
|
String ppsName = processSets.stream().map(BsProcessSetEntity::getName).collect(Collectors.joining(",")); |
|
|
|
|
|
|
|
// 获取wpList最大的计划结束时间
|
|
|
|
|
|
|
|
LocalDateTime maxPlanEndTime = wpList.stream().map(WorkPlan::getPlanEndTime).max(LocalDateTime::compareTo).orElse(null); |
|
|
|
|
|
|
|
if (maxPlanEndTime == null) { |
|
|
|
|
|
|
|
maxPlanEndTime = LocalDateTime.now(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
wxWoCode = erpDataOemClient.fullOrderOutsourcing(yo.getPartCode(), yo.getProductIdent(), wo.getBatchNo(), oem != null ? oem.getCode() : "", ppsName, yo.getYoCode(), |
|
|
|
|
|
|
|
planner != null ? planner.getName() : "", maxPlanEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")), wo.getMakeQty(), "").getData(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
User user = UserCache.getUser(workOrderRun.getCreateUser()); |
|
|
|
|
|
|
|
User dispatcher = UserCache.getUser(wo.getDispatcher()); |
|
|
|
|
|
|
|
String roamNo = null; |
|
|
|
|
|
|
|
String craftNo = null; |
|
|
|
|
|
|
|
Long craftId = yo.getCraftId(); |
|
|
|
|
|
|
|
// 返工单号
|
|
|
|
|
|
|
|
if (craftId != null && wo.getReworkCode() == null) { |
|
|
|
|
|
|
|
Map<String, String> craftInfo = baseMapper.selectRoamAndCraftNoByCraftId(craftId); |
|
|
|
|
|
|
|
roamNo = craftInfo.get("ROAMNO"); |
|
|
|
|
|
|
|
craftNo = craftInfo.get("CRAFTNO"); |
|
|
|
|
|
|
|
if (roamNo == null) { |
|
|
|
|
|
|
|
craftInfo = baseMapper.selectRoamAndCraftNoByPartCode(yo.getPartCode()); |
|
|
|
|
|
|
|
roamNo = craftInfo.get("ROAMNO"); |
|
|
|
|
|
|
|
craftNo = craftInfo.get("CRAFTNO"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (StringUtils.isNotBlank(wo.getReworkCode())) { |
|
|
|
|
|
|
|
roamNo = wo.getReworkCode(); |
|
|
|
|
|
|
|
craftNo = "返修"; |
|
|
|
|
|
|
|
craftId = Long.valueOf(wo.getReworkNo()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
String format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(yo.getDemandDate().toInstant()); |
|
|
|
|
|
|
|
wxWoCode = erpDataOemClient.collaborativeOutsourcing(yo.getPartCode(), yo.getProductIdent(), format, wo.getMakeQty(), yo.getUseDeptCode(), yo.getUseDept(), |
|
|
|
|
|
|
|
wo.getBatchNo(), oem != null ? oem.getCode() : "", yo.getPlate(), yo.getYpCode(), yo.getYoCode(), user != null ? user.getName() : "", |
|
|
|
|
|
|
|
planner != null ? planner.getName() : "", dispatcher != null ? dispatcher.getName() : "", roamNo, craftNo, craftId).getData(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 赋值wx号,erp返回
|
|
|
|
|
|
|
|
workOrderRun.setWoCode(wxWoCode); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(wxWoCode)) { |
|
|
|
|
|
|
|
updateWorkPlanAndOrderStatus(wo, wxWoCode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
//转厂内业务
|
|
|
|
//转厂内业务
|
|
|
|
WorkPlan nextWorkPlan; |
|
|
|
WorkPlan nextWorkPlan; |
|
|
|
|