Compare commits

...

3 Commits

Author SHA1 Message Date
lgh
936dc5b71a 返回值加上code
创建多步骤的currTask只上报一次apms创建生产单
多步骤任务全部删除后自动删除autoTask
数据采集bug修改
2022-07-08 18:23:44 +08:00
lgh
722ecf61c0 Merge branch 'master' of http://git.picaiba.com/mt-ck/mt-qj-wms-hd 2022-07-08 15:58:33 +08:00
lgh
b12bd2294f 细节修改 2022-07-08 15:58:24 +08:00
8 changed files with 110 additions and 67 deletions

View File

@ -100,6 +100,19 @@ public abstract class BaseSupport {
protected <T> R<T> successful(String msg, T data) { protected <T> R<T> successful(String msg, T data) {
return R.ok(msg, data); return R.ok(msg, data);
} }
/**
* <p>
* 请求成功
* </p>
* @param code 正确码
* @param msg 提示内容
* @param data 数据内容
* @param <T> 对象泛型
* @return
*/
protected <T> R<T> successful(int code,String msg, T data) {
return R.ok(code,msg, data);
}
/** /**
* <p> * <p>

View File

@ -99,5 +99,8 @@ public class R<T> implements Serializable {
public static <T> R<T> ok(String msg, T data) { public static <T> R<T> ok(String msg, T data) {
return new R<T>().msg(msg).data(data); return new R<T>().msg(msg).data(data);
} }
public static <T> R<T> ok(int code,String msg, T data) {
return new R<T>().code(code).msg(msg).data(data);
}
} }

View File

@ -139,6 +139,10 @@ public class CurrTaskController extends BaseController {
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列") @ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){ public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList(); List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
Boolean apmsCreateProcessSheet=false;
String sheetNo=null;
int i=1;
R<ApmsCreateProcessSheetVo> processSheet=null;
//自动任务循环添加多条currTask //自动任务循环添加多条currTask
AutoExeTask autoExeTask=new AutoExeTask(); AutoExeTask autoExeTask=new AutoExeTask();
for (TaskCreateParam param:detParams for (TaskCreateParam param:detParams
@ -168,7 +172,7 @@ public class CurrTaskController extends BaseController {
{ {
return failed("创建失败APMS中验证炉号" + kilnCode + "失败!"); return failed("创建失败APMS中验证炉号" + kilnCode + "失败!");
} }
if (i==1){
//通知apms创建一个生产单 //通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet(); ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM"); apmsCreateSheet.setWorkShopCode("BM");
@ -186,9 +190,12 @@ public class CurrTaskController extends BaseController {
}); });
apmsCreateSheet.setStoveCode(kilnCode); apmsCreateSheet.setStoveCode(kilnCode);
apmsCreateSheet.setItems(createItems); apmsCreateSheet.setItems(createItems);
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet); processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
apmsCreateProcessSheet=processSheet.getData().getSuccess();
sheetNo=processSheet.getData().getSheetNo();
}
if (processSheet.getData().getSuccess()) if (apmsCreateProcessSheet)
{ {
//apms创建成功后写入数据库 //apms创建成功后写入数据库
R<IdVo> mainTask = currTaskService.createProcessTask(param); R<IdVo> mainTask = currTaskService.createProcessTask(param);
@ -227,7 +234,6 @@ public class CurrTaskController extends BaseController {
setUpdateCommonField(autoExeTask); setUpdateCommonField(autoExeTask);
autoExeTaskServiceBiz.updateById(autoExeTask); autoExeTaskServiceBiz.updateById(autoExeTask);
} }
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);
@ -240,6 +246,7 @@ public class CurrTaskController extends BaseController {
{ {
return failed("创建失败APMS报错" + processSheet.getData().getMsg()); return failed("创建失败APMS报错" + processSheet.getData().getMsg());
} }
i++;
} }
return null; return null;
} }
@ -264,8 +271,8 @@ public class CurrTaskController extends BaseController {
@PostMapping(value = "deleteBySheetNo") @PostMapping(value = "deleteBySheetNo")
@ApiOperation(value = "人工通过生产单编号删除未正式开始的生产单(通知APMS)") @ApiOperation(value = "人工通过生产单编号删除未正式开始的生产单(通知APMS)")
public R<String> deleteBySheetNo(@Validated @RequestBody String sheetNo) { public R<String> deleteBySheetNo(@Validated @RequestBody CurrTaskQueryParam param) {
return currTaskService.deleteBySheetNo(sheetNo); return currTaskService.deleteBySheetNo(param.getSheetNo());
} }
@PostMapping(value = "runTask") @PostMapping(value = "runTask")
@ApiOperation(value = "执行任务") @ApiOperation(value = "执行任务")

View File

@ -23,4 +23,7 @@ public class CurrTaskQueryParam extends BasePageParam {
@ApiModelProperty(value = "车辆id") @ApiModelProperty(value = "车辆id")
private String vehicleId; private String vehicleId;
private String sheetNo;
} }

View File

@ -76,6 +76,8 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
RunTaskUtils runTaskUtils; RunTaskUtils runTaskUtils;
@Autowired @Autowired
AutoExeTaskServiceBiz autoExeTaskServiceBiz; AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Autowired
KilnInfoServiceBiz kilnInfoServiceBiz;
@Override @Override
public CurrTaskVo getCurrTask(IdParam idParam) { public CurrTaskVo getCurrTask(IdParam idParam) {
@ -101,9 +103,11 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
CurrTask currTask = new CurrTask(); CurrTask currTask = new CurrTask();
BeanUtils.copyProperties(param, currTask); BeanUtils.copyProperties(param, currTask);
currTask.setTaskType(TaskTypeEnum.WTK.getValue()); currTask.setTaskType(TaskTypeEnum.WTK.getValue());
KilnInfo kilnInfo = kilnInfoServiceBiz.getById(currTask.getKilnId());
//根据工艺号查询工艺id以及工艺plc值 //根据工艺号查询工艺id以及工艺plc值
// TODO: 2022/7/7 工艺号临时 CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, param.getCraftCode()));
CraftInfo one = craftInfoServiceBiz.getOne(new QueryWrapper<CraftInfo>().eq(CraftInfo.CRAFT_CODE, 1)); currTask.setTargetPosition(kilnInfo.getCode());
currTask.setCraftCodeId(one.getId()); currTask.setCraftCodeId(one.getId());
currTask.setPlcValue(one.getPlcValue()); currTask.setPlcValue(one.getPlcValue());
currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE")); currTask.setInterCode(IDGenerator.gen("RW", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "TASK_CODE"));
@ -154,8 +158,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo); R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
if (apmsStartProcessR.getData().getSuccess()) if (apmsStartProcessR.getData().getSuccess())
{ {
currTaskServiceBiz.removeById(byId.getId()); Long currTaskId = byId.getId();
currTaskDetService.deleteByCurrTaskId(byId.getId()); currTaskServiceBiz.removeById(currTaskId);
currTaskDetService.deleteByCurrTaskId(currTaskId);
if (byId.getIsAuto()==1){
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.AUTO_EXE_TASK_ID, byId.getAutoExeTaskId()));
if (currTaskList.size()==0){
autoExeTaskServiceBiz.removeById(byId.getAutoExeTaskId());
}
}
return successful("APMS生产单删除成功。"); return successful("APMS生产单删除成功。");
} }
else else
@ -163,6 +174,9 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
return failed(apmsStartProcessR.getData().getMsg()); return failed(apmsStartProcessR.getData().getMsg());
} }
} }
if (byId.getStatus()==2){
return failed("无法删除,任务已加工完成。");
}
return failed("无法删除,任务正在执行中。"); return failed("无法删除,任务正在执行中。");
} }

View File

@ -103,7 +103,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo()); return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo());
} }
orderInfoService.save(orderInfo); orderInfoService.save(orderInfo);
return successful("Wms接收Apms订单成功。", ""); return successful(0,"Wms接收Apms订单成功。", "");
} }
@Override @Override
@ -165,8 +165,8 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param); PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param);
Assert.notNull("该订单暂无详细任务记录。", currOrderCurrTask.getRecords()); Assert.notNull("该订单暂无详细任务记录。", currOrderCurrTask.getRecords());
//获取车辆信息 //获取车辆信息
R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam()); //R<List<VehicleVo>> vehicle = vehicleService.list(new VehicleQueryParam());
Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId)); //Map<Long, List<VehicleVo>> collect = vehicle.getData().stream().collect(Collectors.groupingBy(VehicleVo::getId));
//获取窑炉信息 //获取窑炉信息
R<List<KilnInfoVo>> kiln = kilnInfoService.list(new KilnInfoQueryParam()); R<List<KilnInfoVo>> kiln = kilnInfoService.list(new KilnInfoQueryParam());
Map<Long, List<KilnInfoVo>> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId)); Map<Long, List<KilnInfoVo>> collect2 = kiln.getData().stream().collect(Collectors.groupingBy(KilnInfoVo::getId));
@ -181,6 +181,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
orderInfo.setKilnId(currTask.getKilnId()); orderInfo.setKilnId(currTask.getKilnId());
orderInfo.setStartPosition(currTask.getStartPosition()); orderInfo.setStartPosition(currTask.getStartPosition());
orderInfo.setTargetPosition(currTask.getTargetPosition()); orderInfo.setTargetPosition(currTask.getTargetPosition());
orderInfo.setTaskCode(currTask.getTaskCode());
//orderInfo.setVehicleId(currTask.getVehicleId()); //orderInfo.setVehicleId(currTask.getVehicleId());
//获取窑炉和车辆的名称信息 //获取窑炉和车辆的名称信息
if (orderInfo.getKilnId() != null) if (orderInfo.getKilnId() != null)
@ -265,7 +266,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
byId.setUpdateTime(LocalDateTime.now()); byId.setUpdateTime(LocalDateTime.now());
byId.setOrderVoid(0); byId.setOrderVoid(0);
orderInfoService.updateById(byId); orderInfoService.updateById(byId);
return successful("操作成功,订单状态置为作废。", ""); return successful(0,"操作成功,订单状态置为作废。", "");
} }
@Override @Override
@ -310,7 +311,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
one.setMetallography(apmsCompleteOrder.getMetallographic()); one.setMetallography(apmsCompleteOrder.getMetallographic());
apmsCheckResultServiceBiz.save(one); apmsCheckResultServiceBiz.save(one);
//订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms //订单不应该在该地方完成额外提供一个完成接口供人工完成不通知apms
return successful("操作成功,接收检验结果完成。", ""); return successful(0,"操作成功,接收检验结果完成。", "");
} }
else else
{ {
@ -319,7 +320,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
one1.setMetallography(apmsCompleteOrder.getMetallographic()); one1.setMetallography(apmsCompleteOrder.getMetallographic());
one1.setUpdateTime(LocalDateTime.now()); one1.setUpdateTime(LocalDateTime.now());
apmsCheckResultServiceBiz.updateById(one1); apmsCheckResultServiceBiz.updateById(one1);
return successful("操作成功,更新检验结果完成。", ""); return successful(0,"操作成功,更新检验结果完成。", "");
} }
} }

View File

@ -148,7 +148,7 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工单开始 // TODO: 2022/7/6 上报apms加工单开始
//apmsStartProcess(currTask); apmsStartProcess(currTask);
}else { }else {
runTask.setStatus(3); runTask.setStatus(3);
@ -217,7 +217,7 @@ public class AsynRunTaskService extends BaseService {
//执行成功,托盘进炉 //执行成功,托盘进炉
if (status==1){ if (status==1){
// TODO: 2022/7/7 // TODO: 2022/7/7
//asynStartRecordConsume(currTaskId,currTask.getKilnId()); asynStartRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新调度表状态为完成 //更新调度表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -244,7 +244,7 @@ public class AsynRunTaskService extends BaseService {
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms生产单开始加工 // TODO: 2022/7/6 上报apms生产单开始加工
//apmsStartProcess(currTask); apmsStartProcess(currTask);
}else { }else {
runTask.setStatus(3); runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -417,7 +417,7 @@ public class AsynRunTaskService extends BaseService {
if (status==1){ if (status==1){
// TODO: 2022/7/7 加工完成记录结束时能源消耗 // TODO: 2022/7/7 加工完成记录结束时能源消耗
//asynEndRecordConsume(currTaskId,currTask.getKilnId()); asynEndRecordConsume(currTaskId,currTask.getKilnId());
logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功==="); logger.info("===执行任务:"+currTaskId+" ,车辆搬运任务,车辆:"+vehicleId+" ,起点:"+startPoint+" ,终点:"+endPoint+"任务执行成功===");
//更新关系表状态为完成 //更新关系表状态为完成
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -436,8 +436,9 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态 //更新小车状态
vehicle.setStatus(0); vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle); vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工完成 // TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单等所有加工步骤都完成后上报apms完成生产单
/* ApmsEndProcess apmsEndProcess=new ApmsEndProcess(); logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"开始上报apm完成处理生产单");
ApmsEndProcess apmsEndProcess=new ApmsEndProcess();
apmsEndProcess.setEndTime(LocalDateTime.now().toString()); apmsEndProcess.setEndTime(LocalDateTime.now().toString());
apmsEndProcess.setEndUser("QJJP03"); apmsEndProcess.setEndUser("QJJP03");
apmsEndProcess.setSheetNo(currTask.getSheetNo()); apmsEndProcess.setSheetNo(currTask.getSheetNo());
@ -458,6 +459,7 @@ public class AsynRunTaskService extends BaseService {
return; return;
} }
} }
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().toString());
@ -477,7 +479,7 @@ public class AsynRunTaskService extends BaseService {
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet); R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
if (apmsFinishProcessSheetVoR.getCode()!=0){ if (apmsFinishProcessSheetVoR.getCode()!=0){
logger.info("任务:"+currTask.getTaskCode()+"完成后上报apms完成生产单失败"); logger.info("任务:"+currTask.getTaskCode()+"完成后上报apms完成生产单失败");
}*/ }
}else { }else {
runTask.setStatus(3); runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now()); runTask.setUpdateTime(LocalDateTime.now());
@ -581,7 +583,7 @@ public class AsynRunTaskService extends BaseService {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>() PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_ID, kilnId) .eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.EQ_TYPE, 0)); .eq(PlcNameSpace.EQ_TYPE, 0));
String nameSpaceNote = nameSpace.getNote(); String nameSpaceNote = nameSpace.getName();
switch (kilnInfo.getType()){ switch (kilnInfo.getType()){
//加工炉 //加工炉
case 1: case 1:
@ -600,7 +602,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue()); parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId); parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId); parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue); parTemValue.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue); parTemValueServiceBiz.save(parTemValue);
//电度值 //电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -615,7 +617,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue.setTotalBat(electricalValue.floatValue()); parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId); parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId); parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue); parEleValue.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue); parEleValueServiceBiz.save(parEleValue);
//一号油搅拌转速 //一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1"); Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
@ -626,7 +628,7 @@ public class AsynRunTaskService extends BaseService {
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue()); parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId); parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId); parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue); parRotSpeedValue.setCreateTime(LocalDateTime.now());
parRotSpeedValueServiceBiz.save(parRotSpeedValue); parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气 //氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow"); Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
@ -649,7 +651,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue.setSetNitPotValue(setupCarbon.floatValue()); parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId); parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId); parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue); parGasValue.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue); parGasValueServiceBiz.save(parGasValue);
break; break;
//回火炉 //回火炉
@ -663,7 +665,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue2.setActTemValue(actualTemp.floatValue()); parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId); parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId); parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2); parTemValue2.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue2); parTemValueServiceBiz.save(parTemValue2);
//电度值 //电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity"); electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
@ -678,7 +680,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue2.setTotalBat(electricalValue.floatValue()); parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId); parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId); parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2); parEleValue2.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue2); parEleValueServiceBiz.save(parEleValue2);
break; break;
//氮化炉 //氮化炉
@ -701,7 +703,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue3.setFurnacePressure(furnacePressure.floatValue()); parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId); parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId); parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3); parTemValue3.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue3); parTemValueServiceBiz.save(parTemValue3);
//电度值 //电度值
electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -716,7 +718,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue3.setTotalBat(electricalValue.floatValue()); parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId); parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId); parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3); parEleValue3.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue3); parEleValueServiceBiz.save(parEleValue3);
//实际氮势 //实际氮势
actualCarbon = readPlc(nameSpaceNote, "ActualCarbon"); actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
@ -741,7 +743,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue3.setDecompositionRate(decompositionRate.floatValue()); parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId); parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId); parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3); parGasValue3.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue3); parGasValueServiceBiz.save(parGasValue3);
break; break;
//清洗炉 //清洗炉
@ -759,7 +761,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue4.setTotalBat(electricalValue.floatValue()); parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId); parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId); parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4); parEleValue4.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue4); parEleValueServiceBiz.save(parEleValue4);
break; break;
default: default:
@ -773,7 +775,7 @@ public class AsynRunTaskService extends BaseService {
PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>() PlcNameSpace nameSpace = plcNameSpaceServiceBiz.getOne(new QueryWrapper<PlcNameSpace>()
.eq(PlcNameSpace.EQ_ID, kilnId) .eq(PlcNameSpace.EQ_ID, kilnId)
.eq(PlcNameSpace.EQ_TYPE, 0)); .eq(PlcNameSpace.EQ_TYPE, 0));
String nameSpaceNote = nameSpace.getNote(); String nameSpaceNote = nameSpace.getName();
switch (kilnInfo.getType()){ switch (kilnInfo.getType()){
//加工炉 //加工炉
case 1: case 1:
@ -792,7 +794,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue.setOilTankActTemValue(actualOilTemp.floatValue()); parTemValue.setOilTankActTemValue(actualOilTemp.floatValue());
parTemValue.setKilnId(kilnId); parTemValue.setKilnId(kilnId);
parTemValue.setTaskId(currTaskId); parTemValue.setTaskId(currTaskId);
setCommonField(parTemValue); parTemValue.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue); parTemValueServiceBiz.save(parTemValue);
//电度值 //电度值
Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); Double electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -807,7 +809,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue.setTotalBat(electricalValue.floatValue()); parEleValue.setTotalBat(electricalValue.floatValue());
parEleValue.setKilnId(kilnId); parEleValue.setKilnId(kilnId);
parEleValue.setTaskId(currTaskId); parEleValue.setTaskId(currTaskId);
setCommonField(parEleValue); parEleValue.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue); parEleValueServiceBiz.save(parEleValue);
//一号油搅拌转速 //一号油搅拌转速
Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1"); Double oilStirringSpeed1 = readPlc(nameSpaceNote, "OilStirringSpeed1");
@ -818,7 +820,7 @@ public class AsynRunTaskService extends BaseService {
parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue()); parRotSpeedValue.setOilStiSpeedAValue(oilStirringSpeed2.floatValue());
parRotSpeedValue.setKilnId(kilnId); parRotSpeedValue.setKilnId(kilnId);
parRotSpeedValue.setTaskId(currTaskId); parRotSpeedValue.setTaskId(currTaskId);
setCommonField(parRotSpeedValue); parRotSpeedValue.setCreateTime(LocalDateTime.now());
parRotSpeedValueServiceBiz.save(parRotSpeedValue); parRotSpeedValueServiceBiz.save(parRotSpeedValue);
//氮气 //氮气
Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow"); Double nitrogenFlow = readPlc(nameSpaceNote, "NitrogenFlow");
@ -841,7 +843,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue.setSetNitPotValue(setupCarbon.floatValue()); parGasValue.setSetNitPotValue(setupCarbon.floatValue());
parGasValue.setKilnId(kilnId); parGasValue.setKilnId(kilnId);
parGasValue.setTaskId(currTaskId); parGasValue.setTaskId(currTaskId);
setCommonField(parGasValue); parGasValue.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue); parGasValueServiceBiz.save(parGasValue);
break; break;
//回火炉 //回火炉
@ -855,7 +857,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue2.setActTemValue(actualTemp.floatValue()); parTemValue2.setActTemValue(actualTemp.floatValue());
parTemValue2.setKilnId(kilnId); parTemValue2.setKilnId(kilnId);
parTemValue2.setTaskId(currTaskId); parTemValue2.setTaskId(currTaskId);
setCommonField(parTemValue2); parTemValue2.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue2); parTemValueServiceBiz.save(parTemValue2);
//电度值 //电度值
electricalValue = readPlc(nameSpaceNote,"TotalElectricity"); electricalValue = readPlc(nameSpaceNote,"TotalElectricity");
@ -870,7 +872,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue2.setTotalBat(electricalValue.floatValue()); parEleValue2.setTotalBat(electricalValue.floatValue());
parEleValue2.setKilnId(kilnId); parEleValue2.setKilnId(kilnId);
parEleValue2.setTaskId(currTaskId); parEleValue2.setTaskId(currTaskId);
setCommonField(parEleValue2); parEleValue2.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue2); parEleValueServiceBiz.save(parEleValue2);
break; break;
//氮化炉 //氮化炉
@ -893,7 +895,7 @@ public class AsynRunTaskService extends BaseService {
parTemValue3.setFurnacePressure(furnacePressure.floatValue()); parTemValue3.setFurnacePressure(furnacePressure.floatValue());
parTemValue3.setKilnId(kilnId); parTemValue3.setKilnId(kilnId);
parTemValue3.setTaskId(currTaskId); parTemValue3.setTaskId(currTaskId);
setCommonField(parTemValue3); parTemValue3.setCreateTime(LocalDateTime.now());
parTemValueServiceBiz.save(parTemValue3); parTemValueServiceBiz.save(parTemValue3);
//电度值 //电度值
electricalValue = readPlc(nameSpaceNote,"ElectricalValue"); electricalValue = readPlc(nameSpaceNote,"ElectricalValue");
@ -908,7 +910,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue3.setTotalBat(electricalValue.floatValue()); parEleValue3.setTotalBat(electricalValue.floatValue());
parEleValue3.setKilnId(kilnId); parEleValue3.setKilnId(kilnId);
parEleValue3.setTaskId(currTaskId); parEleValue3.setTaskId(currTaskId);
setCommonField(parEleValue3); parEleValue3.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue3); parEleValueServiceBiz.save(parEleValue3);
//实际氮势 //实际氮势
actualCarbon = readPlc(nameSpaceNote, "ActualCarbon"); actualCarbon = readPlc(nameSpaceNote, "ActualCarbon");
@ -933,7 +935,7 @@ public class AsynRunTaskService extends BaseService {
parGasValue3.setDecompositionRate(decompositionRate.floatValue()); parGasValue3.setDecompositionRate(decompositionRate.floatValue());
parGasValue3.setKilnId(kilnId); parGasValue3.setKilnId(kilnId);
parGasValue3.setTaskId(currTaskId); parGasValue3.setTaskId(currTaskId);
setCommonField(parGasValue3); parGasValue3.setCreateTime(LocalDateTime.now());
parGasValueServiceBiz.save(parGasValue3); parGasValueServiceBiz.save(parGasValue3);
break; break;
//清洗炉 //清洗炉
@ -951,7 +953,7 @@ public class AsynRunTaskService extends BaseService {
parEleValue4.setTotalBat(electricalValue.floatValue()); parEleValue4.setTotalBat(electricalValue.floatValue());
parEleValue4.setKilnId(kilnId); parEleValue4.setKilnId(kilnId);
parEleValue4.setTaskId(currTaskId); parEleValue4.setTaskId(currTaskId);
setCommonField(parEleValue4); parEleValue4.setCreateTime(LocalDateTime.now());
parEleValueServiceBiz.save(parEleValue4); parEleValueServiceBiz.save(parEleValue4);
break; break;
default: default:

View File

@ -123,7 +123,7 @@ public class ScheduledTask extends BaseService {
/** /**
* 正在加工的加工任务详情 * 正在加工的加工任务详情
*/ */
//@Scheduled(fixedDelay = 1000*60) @Scheduled(fixedDelay = 1000*60)
public void screen() throws IOException { public void screen() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情 //查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1)); List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
@ -148,15 +148,15 @@ public class ScheduledTask extends BaseService {
//剩余时间 //剩余时间
Integer remainingTime=0; Integer remainingTime=0;
if (kilnInfo.getType()!=4){ if (kilnInfo.getType()!=4){
remainingTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramTimeRemain")); remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue();
} }
if(kilnInfo.getType()==1||kilnInfo.getType()==3){ if(kilnInfo.getType()==1||kilnInfo.getType()==3){
//运行时间 //运行时间
Integer runTime = Integer.parseInt(readPlcToString(nameSpace, "ProgramRunTime")); Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue();
setupTime=runTime+remainingTime; setupTime=runTime+remainingTime;
} }
if (kilnInfo.getType()==2){ if (kilnInfo.getType()==2){
setupTime=Integer.parseInt(readPlcToString(nameSpace, "SetTime")); setupTime=readPlc(nameSpace, "SetTime").intValue();
} }
nowCurrTask.setSetupTime(setupTime); nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime); nowCurrTask.setRemainingTime(remainingTime);
@ -179,7 +179,7 @@ public class ScheduledTask extends BaseService {
/** /**
* 查询加工完成的窑炉 * 查询加工完成的窑炉
*/ */
//@Scheduled(fixedDelay = 1000*60*2) @Scheduled(fixedDelay = 1000*60*2)
public void taskForStockToKiln() throws IOException { public void taskForStockToKiln() throws IOException {
//两辆车是否都空闲只有两辆车都空闲才被允许做任务 //两辆车是否都空闲只有两辆车都空闲才被允许做任务
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0)); List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));