|
|
|
@ -117,30 +117,22 @@ public class MesPackageRoundnessService implements IRoundnessStrategy {
|
|
|
|
|
//2.排序信息中的零件合计数量
|
|
|
|
|
double qty = sortInfoList.stream().map(MesCustSortInfo::getQty).reduce(Double::sum).get();
|
|
|
|
|
MesCustSortInfo sortInfo;
|
|
|
|
|
/**
|
|
|
|
|
* 2024/10/24 by Castle需要根据custOrderNo升序设置productSeq
|
|
|
|
|
*/
|
|
|
|
|
log.info("castle-execute-before查询出的sortInfo数据:{}", sortInfoList);
|
|
|
|
|
sortInfoList = sortInfoList.stream().sorted((sortInfo1, sortInfo2) -> {
|
|
|
|
|
if (Long.parseLong(sortInfo1.getCustOrderCode().substring(3)) > Long.parseLong(sortInfo2.getCustOrderCode().substring(3))) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
log.info("castle-execute-after查询出的sortInfo数据:{}", sortInfoList);
|
|
|
|
|
|
|
|
|
|
//3.当数量未达到圆整包装数时
|
|
|
|
|
if (qty < roundQty) {
|
|
|
|
|
//4.查看客户排序信息钟的最早的一条过点时间 + 生产组最晚生成时间是否已到达当前时间
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
// sortInfoList = sortInfoList.stream().sorted((sortInfo1, sortInfo2) -> {
|
|
|
|
|
// try {
|
|
|
|
|
// if (sdf.parse(sortInfo1.getMatchTime()).after(sdf.parse(sortInfo2.getMatchTime()))) {
|
|
|
|
|
// return 1;
|
|
|
|
|
// }
|
|
|
|
|
// } catch (ParseException e) {
|
|
|
|
|
// log.error("解析匹配时间报错:{}", e.getMessage());
|
|
|
|
|
// }
|
|
|
|
|
// return -1;
|
|
|
|
|
// }).collect(Collectors.toList());
|
|
|
|
|
/**
|
|
|
|
|
* 2024/10/24 by Castle需要根据custOrderNo升序设置productSeq
|
|
|
|
|
*/
|
|
|
|
|
sortInfoList = sortInfoList.stream().sorted((sortInfo1, sortInfo2) -> {
|
|
|
|
|
if (Long.parseLong(sortInfo1.getCustOrderCode().substring(3)) > Long.parseLong(sortInfo2.getCustOrderCode().substring(3))) {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
return -1;
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
sortInfo = sortInfoList.get(0);
|
|
|
|
|
//最晚延迟的时间
|
|
|
|
|
int latestCreationTime = Integer.parseInt(partProdGroup.getLatestCreationTime());
|
|
|
|
@ -158,11 +150,23 @@ public class MesPackageRoundnessService implements IRoundnessStrategy {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//批量获取生生产序号
|
|
|
|
|
/**
|
|
|
|
|
* 生产序号
|
|
|
|
|
* 工厂-产线-9位流水号,跳号10
|
|
|
|
|
*/
|
|
|
|
|
GenSerialNoModel prodSeqSerialNoModel = new GenSerialNoModel("MES_WORK_ORDER_SEQ_WU_HAN");
|
|
|
|
|
prodSeqSerialNoModel.setProdLocation(partProdGroup.getWorkCenterCode());
|
|
|
|
|
List<String> proSeqResultList = syncFuncService.syncSerialNo(prodSeqSerialNoModel.organizeCode(partProdGroup.getOrganizeCode()), "edi", partProdGroup.getOrganizeCode(), sortInfoList.size()).getResultList();
|
|
|
|
|
|
|
|
|
|
log.info("castle-execute-顺序号:{}", proSeqResultList);
|
|
|
|
|
//扣减qty 生成工单
|
|
|
|
|
while (qty > 0) {
|
|
|
|
|
//临时客户排序信息中的数量计数器
|
|
|
|
|
sortInfo = sortInfoList.get(0);
|
|
|
|
|
String seq = proSeqResultList.get(0);
|
|
|
|
|
long productSeq = Long.parseLong(seq.replace("MES_WORK_ORDER_SEQ_WU_HAN", "").replace(partProdGroup.getWorkCenterCode(), ""));
|
|
|
|
|
|
|
|
|
|
double custQty = sortInfo.getQty();
|
|
|
|
|
//当客户排序信息中的数量大于剩余圆整数量要Break
|
|
|
|
|
if (custQty > roundQty) {
|
|
|
|
@ -187,10 +191,11 @@ public class MesPackageRoundnessService implements IRoundnessStrategy {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mesCreateWorkOrder.createWorkOrder(partProdGroup, mesPartProdGroupDetail, mesPart, sortInfo);
|
|
|
|
|
mesCreateWorkOrder.createWorkOrder(partProdGroup, mesPartProdGroupDetail, mesPart, sortInfo,productSeq);
|
|
|
|
|
// doCreateWorkOrder(partProdGroup, mesPartProdGroupDetail, mesPart, sortInfo);
|
|
|
|
|
qty -= custQty;
|
|
|
|
|
sortInfoList.remove(sortInfo);
|
|
|
|
|
proSeqResultList.remove(seq);
|
|
|
|
|
// 更新排序信息 已完成
|
|
|
|
|
custSoftInfoService.updateCustSortInfo(sortInfo);
|
|
|
|
|
}
|
|
|
|
|