上报APMS步骤改为单步骤任务或多步骤任务的第一步进炉加工上报接口为creatProcess,其他步骤进炉加工上报接口为startProcess

This commit is contained in:
李广豪 2022-07-10 23:58:36 +08:00
parent a440684232
commit 10e46121c3
3 changed files with 322 additions and 247 deletions

View File

@ -98,12 +98,12 @@ public class CurrTaskController extends BaseController {
} }
//通知apms创建一个生产单 //通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); //ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM"); //apmsCreateSheet.setWorkShopCode("BM");
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); //apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsCreateSheet.setTechCode(param.getCraftCode()); //apmsCreateSheet.setTechCode(param.getCraftCode());
//fixme 暂时没有正式user使用测试账户 //fixme 暂时没有正式user使用测试账户
apmsCreateSheet.setStartUser("QJJP03"); //apmsCreateSheet.setStartUser("QJJP03");
ArrayList<CreateItem> createItems = new ArrayList<>(); ArrayList<CreateItem> createItems = new ArrayList<>();
param.getDetParams().forEach(e -> { param.getDetParams().forEach(e -> {
CreateItem createItem = new CreateItem(); CreateItem createItem = new CreateItem();
@ -112,28 +112,28 @@ public class CurrTaskController extends BaseController {
createItem.setWeight(e.getWeight().doubleValue()); createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem); createItems.add(createItem);
}); });
apmsCreateSheet.setStoveCode(kilnCode); //apmsCreateSheet.setStoveCode(kilnCode);
apmsCreateSheet.setItems(createItems); //apmsCreateSheet.setItems(createItems);
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet); //R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
if (processSheet.getData().getSuccess()) //if (processSheet.getData().getSuccess())
{ //{
//apms创建成功后写入数据库 //apms创建成功后写入数据库
param.setAutoTaskType(0); param.setAutoTaskType(0);
R<IdVo> mainTask = currTaskService.createProcessTask(param); R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId()); currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
String sheetNo = processSheet.getData().getSheetNo(); //String sheetNo = processSheet.getData().getSheetNo();
//将返回的生产单号写入到主任务中 //将返回的生产单号写入到主任务中
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId()); //CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
currTaskById.setSheetNo(sheetNo); //currTaskById.setSheetNo(sheetNo);
currTaskService.updateCurrTaskById(currTaskById); //currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建 //生成详细任务中的检验结果数据在apms推送生产单结果时创建
return successful(0,"创建成功,任务添加至等待执行队列。",""); return successful(0,"创建成功,任务添加至等待执行队列。","");
} //}
else //else
{ //{
return failed("创建失败APMS报错" + processSheet.getData().getMsg()); // return failed("创建失败APMS报错" + processSheet.getData().getMsg());
} //}
} }
@PostMapping(value = "createAutoTask") @PostMapping(value = "createAutoTask")
@ -173,6 +173,7 @@ public class CurrTaskController extends BaseController {
{ {
return failed("创建失败APMS中验证炉号" + kilnCode + "失败!"); return failed("创建失败APMS中验证炉号" + kilnCode + "失败!");
} }
/*
if (i==1){ if (i==1){
//通知apms创建一个生产单 //通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
@ -195,9 +196,10 @@ public class CurrTaskController extends BaseController {
apmsCreateProcessSheet=processSheet.getData().getSuccess(); apmsCreateProcessSheet=processSheet.getData().getSuccess();
sheetNo=processSheet.getData().getSheetNo(); sheetNo=processSheet.getData().getSheetNo();
} }
*/
if (apmsCreateProcessSheet) //if (apmsCreateProcessSheet)
{ //{
//apms创建成功后写入数据库 //apms创建成功后写入数据库
R<IdVo> mainTask = currTaskService.createProcessTask(param); R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId()); currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
@ -237,18 +239,18 @@ public class CurrTaskController extends BaseController {
} }
//将返回的生产单号写入到主任务中 //将返回的生产单号写入到主任务中
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId()); CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
currTaskById.setSheetNo(sheetNo); //currTaskById.setSheetNo(sheetNo);
currTaskById.setAutoExeTaskId(autoExeTask.getId()); currTaskById.setAutoExeTaskId(autoExeTask.getId());
currTaskService.updateCurrTaskById(currTaskById); currTaskService.updateCurrTaskById(currTaskById);
//生成详细任务中的检验结果数据在apms推送生产单结果时创建 //生成详细任务中的检验结果数据在apms推送生产单结果时创建
//return successful("创建成功,任务添加至等待执行队列。"); //return successful("创建成功,任务添加至等待执行队列。");
} //}
else //else
{ //{
return failed("创建失败APMS报错" + processSheet.getData().getMsg()); // return failed("创建失败APMS报错" + processSheet.getData().getMsg());
} //}
i++; //i++;
} }
return successful(0,"操作成功,任务加入待执行队列",""); return successful(0,"操作成功,任务加入待执行队列","");
} }

View File

@ -104,7 +104,7 @@ public class RunTaskUtils {
.eq(PlcNameSpace.EQ_TYPE, 0) .eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())).getName(); .eq(PlcNameSpace.EQ_ID, kilnInfo.getId())).getName();
String result = readPlcToString(kilnNamePlace, "AllowIn"); String result = readPlcToString(kilnNamePlace, "AllowIn");
Boolean resultBoolean = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString()); boolean resultBoolean = Boolean.parseBoolean(JSONObject.parseObject(result).get("result").toString());
//窑炉状态为不可用 //窑炉状态为不可用
if (kilnInfo.getStatus() == 1) { if (kilnInfo.getStatus() == 1) {
return R.failed("目标窑炉不可用!"); return R.failed("目标窑炉不可用!");