上报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

@ -81,6 +81,7 @@ public class AsynRunTaskService extends BaseService {
private AutoExeTaskServiceBiz autoExeTaskServiceBiz; private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Resource @Resource
private CurrTaskDetServiceBiz currTaskDetServiceBiz; private CurrTaskDetServiceBiz currTaskDetServiceBiz;
//窑炉可用未满的情况下调用车辆起点为提升台终点为窑炉 //窑炉可用未满的情况下调用车辆起点为提升台终点为窑炉
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunTask(Long currTaskId, Long vehicleId) throws IOException { public void asynRunTask(Long currTaskId, Long vehicleId) throws IOException {
@ -98,27 +99,19 @@ public class AsynRunTaskService extends BaseService {
runTask.setEndPosition(currTask.getTargetPosition()); runTask.setEndPosition(currTask.getTargetPosition());
runTask.setBeginTime(LocalDateTime.now()); runTask.setBeginTime(LocalDateTime.now());
runTaskServiceBiz.save(runTask); runTaskServiceBiz.save(runTask);
//任务为自动任务第一步或任务为非自动任务时创建生产单其他情况下开始生产单
if (isFirstTask(currTask)) {
//通知apms创建一个生产单 //通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); Boolean createProcess = apmsCreateProcess(currTask);
apmsCreateSheet.setWorkShopCode("BM"); if (!createProcess) {
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); return;
apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString()); }
//fixme 暂时没有正式user使用测试账户 } else {
apmsCreateSheet.setStartUser("QJJP03"); //通知apms开始生产单
ArrayList<CreateItem> createItems = new ArrayList<>(); Boolean startProcess = apmsStartProcess(currTask);
currTaskDetList.forEach(e -> { if (!startProcess) {
CreateItem createItem = new CreateItem(); return;
createItem.setItemCode(e.getIdenCardNum()); }
createItem.setQuantity(e.getQuantity().intValue());
createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem);
});
apmsCreateSheet.setStoveCode(CodeGeneratorHelper.getStoveCode(currTask.getKilnName()+String.format("%02d",currTask.getCraftCodeId())));
apmsCreateSheet.setItems(createItems);
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
if (!processSheet.getData().getSuccess()){
logger.info(currTaskId+"创建失败APMS报错" + processSheet.getData().getMsg());
webSocketServer.sendtoUser("创建失败APMS报错" + processSheet.getData().getMsg(),"1");
} }
//调用车辆填入起终点,得到车辆执行结果 //调用车辆填入起终点,得到车辆执行结果
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode(); Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
@ -143,9 +136,6 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态 //更新小车状态
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工单开始
apmsStartProcess(currTask);
} else { } else {
runTask.setStatus(3); runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -163,7 +153,7 @@ public class AsynRunTaskService extends BaseService {
Location location = locationServiceBiz.getById(inStockInfo.getLocationId()); Location location = locationServiceBiz.getById(inStockInfo.getLocationId());
Long currTaskId = inStockInfo.getTaskId(); Long currTaskId = inStockInfo.getTaskId();
CurrTask currTask = currTaskServiceBiz.getById(currTaskId); CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId); VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突冲突则避让 //检查车辆是否冲突冲突则避让
rgvStatus(vehicleId, currTask); rgvStatus(vehicleId, currTask);
//新建一条执行任务的关系表存放任务执行信息 //新建一条执行任务的关系表存放任务执行信息
@ -179,6 +169,20 @@ public class AsynRunTaskService extends BaseService {
//修改缓存区存储情况表状态 //修改缓存区存储情况表状态
inStockInfo.setStatus(1); inStockInfo.setStatus(1);
inStockInfoServiceBiz.updateById(inStockInfo); inStockInfoServiceBiz.updateById(inStockInfo);
//任务为自动任务第一步或任务为非自动任务时创建生产单其他情况下开始生产单
if (isFirstTask(currTask)) {
//通知apms创建一个生产单
Boolean createProcess = apmsCreateProcess(currTask);
if (!createProcess) {
return;
}
} else {
//通知apms开始生产单
Boolean startProcess = apmsStartProcess(currTask);
if (!startProcess) {
return;
}
}
// 调用车辆填入起终点,得到车辆执行结果 // 调用车辆填入起终点,得到车辆执行结果
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode(); Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode(); Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();
@ -212,8 +216,6 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态 //更新小车状态
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms生产单开始加工
apmsStartProcess(currTask);
} else { } else {
runTask.setStatus(3); runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -225,6 +227,7 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从缓存区到加工炉过程中失败。"); webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从缓存区到加工炉过程中失败。");
} }
} }
//窑炉已满调用车辆起点为提升台终点为缓存区 //窑炉已满调用车辆起点为提升台终点为缓存区
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId) throws IOException { public void asynRunTaskToWarehouse(Long currTaskId, Long vehicleId) throws IOException {
@ -287,6 +290,7 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从液压台到缓存区过程中失败。"); webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从液压台到缓存区过程中失败。");
} }
} }
//窑炉加工完成调用车辆入库到缓存区 //窑炉加工完成调用车辆入库到缓存区
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunTaskForKilnToWarehouse(Long currTaskId, Long vehicleId) throws IOException { public void asynRunTaskForKilnToWarehouse(Long currTaskId, Long vehicleId) throws IOException {
@ -351,7 +355,7 @@ public class AsynRunTaskService extends BaseService {
// TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单等所有加工步骤都完成后上报apms完成生产单 // TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单等所有加工步骤都完成后上报apms完成生产单
logger.info("任务:" + currTaskId + " 生产单号:" + currTask.getSheetNo() + "开始上报apm完成处理生产单"); logger.info("任务:" + currTaskId + " 生产单号:" + currTask.getSheetNo() + "开始上报apm完成处理生产单");
ApmsEndProcess apmsEndProcess = new ApmsEndProcess(); ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
apmsEndProcess.setEndTime(LocalDateTime.now().toString()); apmsEndProcess.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setEndUser("QJJP03");
apmsEndProcess.setSheetNo(currTask.getSheetNo()); apmsEndProcess.setSheetNo(currTask.getSheetNo());
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess); R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
@ -374,7 +378,7 @@ public class AsynRunTaskService extends BaseService {
logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单"); logger.info("任务:" + currTask.getTaskCode() + "开始上报apms完成生产单");
ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet(); ApmsFinishProcessSheet apmsFinishProcessSheet = new ApmsFinishProcessSheet();
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo()); apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().toString()); apmsFinishProcessSheet.setEndTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsFinishProcessSheet.setEndUser("QJJP03"); apmsFinishProcessSheet.setEndUser("QJJP03");
List<FinishItem> finishItems = new ArrayList<>(); List<FinishItem> finishItems = new ArrayList<>();
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTaskId)); List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTaskId));
@ -402,6 +406,7 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从窑炉到缓存区过程中失败。"); webSocketServer.sendtoAll("任务 " + currTask.getTaskCode() + " 车辆从窑炉到缓存区过程中失败。");
} }
} }
//出库起点为缓存区库位终点为提升台 //出库起点为缓存区库位终点为提升台
@Async("asyncServiceExecutor") @Async("asyncServiceExecutor")
public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException { public void asynRunOutStock(Long locationId, String yeyaTaiCode, Long vehicleId) throws IOException {
@ -500,6 +505,7 @@ public class AsynRunTaskService extends BaseService {
webSocketServer.sendtoAll("出库任务车辆从缓存区到提升平台过程中失败。"); webSocketServer.sendtoAll("出库任务车辆从缓存区到提升平台过程中失败。");
} }
} }
//允许进炉信号为true记录开始加工时的能源消耗数据再写定时任务记录加工过程的消耗数据再写一个异步方法加工任务结束的时候记录一下各项消耗的值 //允许进炉信号为true记录开始加工时的能源消耗数据再写定时任务记录加工过程的消耗数据再写一个异步方法加工任务结束的时候记录一下各项消耗的值
public void asynStartRecordConsume(Long currTaskId, Long kilnId) { public void asynStartRecordConsume(Long currTaskId, Long kilnId) {
// TODO: 2022/2/17 // TODO: 2022/2/17
@ -692,6 +698,7 @@ public class AsynRunTaskService extends BaseService {
logger.info("任务:" + currTaskId + "开始在" + kilnInfo.getKilnName() + "加工,能源消耗开始统计。"); logger.info("任务:" + currTaskId + "开始在" + kilnInfo.getKilnName() + "加工,能源消耗开始统计。");
} }
} }
//允许出炉信号为true记录结束加工时的能源消耗数据 //允许出炉信号为true记录结束加工时的能源消耗数据
public void asynEndRecordConsume(Long currTaskId, Long kilnId) { public void asynEndRecordConsume(Long currTaskId, Long kilnId) {
// TODO: 2022/2/17 // TODO: 2022/2/17
@ -884,8 +891,10 @@ public class AsynRunTaskService extends BaseService {
logger.info("任务:" + currTaskId + "开始在" + kilnInfo.getKilnName() + "加工,能源消耗开始统计。"); logger.info("任务:" + currTaskId + "开始在" + kilnInfo.getKilnName() + "加工,能源消耗开始统计。");
} }
} }
/** /**
* 获取变量值 * 获取变量值
*
* @param nameSpace nameSpace前缀 * @param nameSpace nameSpace前缀
* @param variableName 变量名称 * @param variableName 变量名称
* @return 变量值 * @return 变量值
@ -909,6 +918,7 @@ public class AsynRunTaskService extends BaseService {
/** /**
* RGV1的当前位置 * RGV1的当前位置
* id 小车表示 * id 小车表示
*
* @return 小车位置值距离原点的值 * @return 小车位置值距离原点的值
*/ */
private Double RGVCurrPosition(Integer id) { private Double RGVCurrPosition(Integer id) {
@ -934,6 +944,7 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 移动RGV * 移动RGV
*
* @param vehicleId 车辆id * @param vehicleId 车辆id
* @param currTaskId 任务id * @param currTaskId 任务id
* @param sendRow 终点 * @param sendRow 终点
@ -974,6 +985,7 @@ public class AsynRunTaskService extends BaseService {
/** /**
* 发送搬运任务到RGV * 发送搬运任务到RGV
*
* @param vehicleId RGV * @param vehicleId RGV
* @param currTaskId 任务id * @param currTaskId 任务id
* @param startPoint 起点 * @param startPoint 起点
@ -1008,18 +1020,65 @@ public class AsynRunTaskService extends BaseService {
return Integer.parseInt(String.valueOf(jsonObject.get("msg"))); return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
} }
private void apmsStartProcess(CurrTask currTask) { /**
* 上报apms创建生产单并开始处理
*
* @param currTask 任务
* @return 成功与否
* @throws IOException
*/
private Boolean apmsCreateProcess(CurrTask currTask) throws IOException {
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
//通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM");
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString());
//fixme 暂时没有正式user使用测试账户
apmsCreateSheet.setStartUser("QJJP03");
ArrayList<CreateItem> createItems = new ArrayList<>();
currTaskDetList.forEach(e -> {
CreateItem createItem = new CreateItem();
createItem.setItemCode(e.getIdenCardNum());
createItem.setQuantity(e.getQuantity().intValue());
createItem.setWeight(e.getWeight().doubleValue());
createItems.add(createItem);
});
apmsCreateSheet.setStoveCode(CodeGeneratorHelper.getStoveCode(currTask.getKilnName() + String.format("%02d", currTask.getCraftCodeId())));
apmsCreateSheet.setItems(createItems);
logger.info(currTask.getId() + "开始创建apms生产单号");
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
if (!processSheet.getData().getSuccess()) {
logger.info(currTask.getId() + "创建失败APMS报错" + processSheet.getData().getMsg());
webSocketServer.sendtoUser("创建失败APMS报错" + processSheet.getData().getMsg(), "1");
return false;
} else {
logger.info(currTask.getId() + "创建apms生产单号成功");
currTask.setSheetNo(processSheet.getData().getSheetNo());
currTaskServiceBiz.updateById(currTask);
return true;
}
}
/**
* 上报apms开始加工
* @param currTask
* @return
*/
private Boolean apmsStartProcess(CurrTask currTask) {
ApmsStartProcess apmsStartProcess=new ApmsStartProcess(); ApmsStartProcess apmsStartProcess=new ApmsStartProcess();
apmsStartProcess.setStartTime(LocalDateTime.now().toString());
apmsStartProcess.setStartUser("QJJP03"); apmsStartProcess.setStartUser("QJJP03");
apmsStartProcess.setSheetNo(currTask.getSheetNo()); apmsStartProcess.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString()); apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
apmsStartProcess.setStoveCode(kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode()); apmsStartProcess.setSheetNo(currTask.getSheetNo());
apmsStartProcess.setStoveCode(CodeGeneratorHelper.getStoveCode(currTask.getKilnName()+String.format("%02d",currTask.getCraftCodeId())));
R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess); R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess);
if (apmsStartProcessR.getCode() != 0) { if (apmsStartProcessR.getCode() != 0) {
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败"); logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
return false;
} }
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功"); logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms成功");
return true;
} }
/** /**
* 车辆是否在线 * 车辆是否在线
@ -1103,4 +1162,18 @@ public class AsynRunTaskService extends BaseService {
} }
} }
} }
/**
* 判断任务是否为单步骤任务多步骤任务第一步
* @param currTask 任务
* @return 单步骤任务true多步骤任务第一步true,其他false
*/
public Boolean isFirstTask(CurrTask currTask){
if (currTask.getAutoExeTaskId()==1){
int count = autoExeTaskServiceBiz.count(new QueryWrapper<AutoExeTask>().eq(AutoExeTask.F_TASK_ID, currTask.getId()));
return count>0;
}else {
return true;
}
}
} }

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("目标窑炉不可用!");