Compare commits

...

9 Commits

3 changed files with 323 additions and 247 deletions

View File

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

View File

@ -104,7 +104,7 @@ public class RunTaskUtils {
.eq(PlcNameSpace.EQ_TYPE, 0)
.eq(PlcNameSpace.EQ_ID, kilnInfo.getId())).getName();
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) {
return R.failed("目标窑炉不可用!");