返回值加上code

创建多步骤的currTask只上报一次apms创建生产单
多步骤任务全部删除后自动删除autoTask
数据采集bug修改
This commit is contained in:
lgh 2022-07-08 18:23:44 +08:00
parent 722ecf61c0
commit 936dc5b71a
7 changed files with 61 additions and 31 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;
} }

View File

@ -158,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

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
@ -266,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
@ -311,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
{ {
@ -320,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

@ -436,7 +436,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加工完成.每次进炉加工完成后就上报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().toString());

View File

@ -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(readPlc(nameSpace, "ProgramTimeRemain").toString()); remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue();
} }
if(kilnInfo.getType()==1||kilnInfo.getType()==3){ if(kilnInfo.getType()==1||kilnInfo.getType()==3){
//运行时间 //运行时间
Integer runTime = Integer.parseInt(readPlc(nameSpace, "ProgramRunTime").toString()); Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue();
setupTime=runTime+remainingTime; setupTime=runTime+remainingTime;
} }
if (kilnInfo.getType()==2){ if (kilnInfo.getType()==2){
setupTime=Integer.parseInt(readPlc(nameSpace, "SetTime").toString()); setupTime=readPlc(nameSpace, "SetTime").intValue();
} }
nowCurrTask.setSetupTime(setupTime); nowCurrTask.setSetupTime(setupTime);
nowCurrTask.setRemainingTime(remainingTime); nowCurrTask.setRemainingTime(remainingTime);