|
|
|
@ -646,7 +646,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_999");// 这是数据源的key
|
|
|
|
|
|
|
|
|
|
BaseEquipmentDto edto = new BaseEquipmentDto();
|
|
|
|
|
edto.setEquipmentTypeCode("equTypeCxj");
|
|
|
|
|
edto.setEquipmentTypeCode("equ_type_cxj");
|
|
|
|
|
List<BaseEquipmentDto> cxjList = mesMapper.getAllEquipments(edto);
|
|
|
|
|
ExecutorService executorService = new ThreadPoolExecutor(
|
|
|
|
|
cxjList.size(),
|
|
|
|
@ -655,7 +655,7 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
|
new LinkedBlockingQueue<Runnable>());
|
|
|
|
|
try {
|
|
|
|
|
cxjList.forEach(cxj -> {
|
|
|
|
|
if(cxj.getEquipmentCode().equals("C4")){
|
|
|
|
|
if(cxj.getEquipmentCode().equals("C5")){
|
|
|
|
|
Runnable run = () -> changeTransferResultFunc(cxj);
|
|
|
|
|
executorService.execute(run);
|
|
|
|
|
}
|
|
|
|
@ -675,18 +675,43 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
|
*/
|
|
|
|
|
private R changeTransferResultFunc(BaseEquipmentDto cxj){
|
|
|
|
|
logger.info("++++++++++++" + cxj.getEquipmentCode() + "++++班次交接最后一车数据修正++++++++++");
|
|
|
|
|
DynamicDataSourceContextHolder.push("ds_999");// 这是数据源的key
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); // 定义日期格式
|
|
|
|
|
LocalDate today = LocalDate.now();
|
|
|
|
|
String ymdT0 = today.format(formatter); // 格式化今天的日期
|
|
|
|
|
LocalDate qianDay = today.minusDays(2);
|
|
|
|
|
String qianDayStr = qianDay.format(formatter); // 格式化前天的日期
|
|
|
|
|
LocalDate yesterday = today.minusDays(1);
|
|
|
|
|
String ymd = yesterday.format(formatter); // 格式化昨天的日期
|
|
|
|
|
cxj.setYmd("'"+ymdT0+"','"+ymd+"'");
|
|
|
|
|
List<MesShift> changeInfos = mesMapper.getChangeInfos(cxj);
|
|
|
|
|
String yesterdayStr = yesterday.format(formatter); // 格式化昨天的日期
|
|
|
|
|
|
|
|
|
|
List<MesShift> changeInfos = new ArrayList<>();
|
|
|
|
|
//昨天的白班开始
|
|
|
|
|
cxj.setYmd(qianDayStr);
|
|
|
|
|
cxj.setShiftId("2");
|
|
|
|
|
MesShift changeInfo0 = mesMapper.getChangeInfos(cxj);
|
|
|
|
|
changeInfo0.setShiftId(5);//昨天的白班
|
|
|
|
|
changeInfos.add(changeInfo0);
|
|
|
|
|
//昨天的白班结束 昨天的夜班开始
|
|
|
|
|
cxj.setYmd(yesterdayStr);
|
|
|
|
|
cxj.setShiftId("5");
|
|
|
|
|
MesShift changeInfo1 = mesMapper.getChangeInfos(cxj);
|
|
|
|
|
changeInfo1.setShiftId(2);//昨天的夜班
|
|
|
|
|
changeInfos.add(changeInfo1);
|
|
|
|
|
//昨天的白班结束 昨天的夜班开始
|
|
|
|
|
cxj.setYmd(yesterdayStr);
|
|
|
|
|
cxj.setShiftId("2");
|
|
|
|
|
MesShift changeInfo2 = mesMapper.getChangeInfos(cxj);
|
|
|
|
|
changeInfos.add(changeInfo2);
|
|
|
|
|
|
|
|
|
|
if(CollectionUtils.isEmpty(changeInfos)){
|
|
|
|
|
logger.info("++++++++++++班次交接最后一车数据修正:无数据++++++++++"+JSONObject.toJSONString(cxj));
|
|
|
|
|
return R.fail("班次交接最后一车数据修正:无数据");
|
|
|
|
|
}
|
|
|
|
|
List<MesStationArrive> todoList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if(changeInfos.size()<3){
|
|
|
|
|
logger.info("++++++++++++班次交接最后一车数据修正:修正点缺失(必须三个点)++++++++++");
|
|
|
|
|
return R.fail("班次交接最后一车数据修正:无数据");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int m=0;m<changeInfos.size()-1;m++){
|
|
|
|
|
Date startTime = changeInfos.get(m).getStartTime();
|
|
|
|
|
Date endTime = changeInfos.get(m+1).getStartTime();
|
|
|
|
@ -698,17 +723,12 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
|
qo.setStationNo(cxj.getEquipmentCode());//成型机编码
|
|
|
|
|
logger.info("++++++++++++班次交接最后一车数据修正:开始修正++++++++++"+JSONObject.toJSONString(qo));
|
|
|
|
|
List<MesStationArrive> todos1 = mesMapper.getUnChangeList(qo);//需要调整的数据
|
|
|
|
|
todoList.addAll(todos1);
|
|
|
|
|
|
|
|
|
|
if(!CollectionUtils.isEmpty(todoList)){
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qo.setReqCode(ymd);//工单日期
|
|
|
|
|
qo.setReqCode(yesterdayStr);//工单日期
|
|
|
|
|
ProOrderWorkorderDTO actOrderWork = mesMapper.getActOrderWork(qo);
|
|
|
|
|
if(actOrderWork != null){//给需要调整的数据,重新赋值新的班次,工单Id
|
|
|
|
|
Date nowDate = DateUtils.getNowDate();
|
|
|
|
|
for(MesStationArrive newtodo:todoList){
|
|
|
|
|
for(MesStationArrive newtodo:todos1){
|
|
|
|
|
newtodo.setChangeOrderWorkId(actOrderWork.getWorkorderId());
|
|
|
|
|
newtodo.setShiftId(Integer.parseInt(actOrderWork.getShiftId()));
|
|
|
|
|
newtodo.setChangeWorkDate(actOrderWork.getProductDate());
|
|
|
|
@ -716,10 +736,10 @@ public class IWCInterfaceServiceImpl implements IWCSInterfaceService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/**mes_material_transfer_result**/
|
|
|
|
|
int n = mesMapper.updateTransferResult(todoList);
|
|
|
|
|
logger.info("++++++++++++班次交接最后一车数据修正:修正成功"+n+"++++++++++"+JSONObject.toJSONString(todoList));
|
|
|
|
|
int n = mesMapper.updateTransferResult(todos1);
|
|
|
|
|
logger.info("++++++++++++班次交接最后一车数据修正:班次"+changeInfos.get(m).getShiftId()+"修正成功"
|
|
|
|
|
+n+"++++++++++"+JSONObject.toJSONString(todos1));
|
|
|
|
|
}
|
|
|
|
|
logger.info("++++++++++++班次交接最后一车数据修正:数据条数++++++++++"+todoList.size());
|
|
|
|
|
return R.fail("班次交接最后一车数据修正:完成");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|