返回值加上code
创建多步骤的currTask只上报一次apms创建生产单 多步骤任务全部删除后自动删除autoTask 数据采集bug修改
This commit is contained in:
parent
722ecf61c0
commit
936dc5b71a
@ -100,6 +100,19 @@ public abstract class BaseSupport {
|
||||
protected <T> R<T> successful(String msg, T 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>
|
||||
|
@ -99,5 +99,8 @@ public class R<T> implements Serializable {
|
||||
public static <T> R<T> ok(String msg, T 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -139,6 +139,10 @@ public class CurrTaskController extends BaseController {
|
||||
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
|
||||
public R<String> createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
|
||||
List<TaskCreateParam> detParams = autoCurrTaskParam.getTaskCreateParamList();
|
||||
Boolean apmsCreateProcessSheet=false;
|
||||
String sheetNo=null;
|
||||
int i=1;
|
||||
R<ApmsCreateProcessSheetVo> processSheet=null;
|
||||
//自动任务循环添加多条currTask
|
||||
AutoExeTask autoExeTask=new AutoExeTask();
|
||||
for (TaskCreateParam param:detParams
|
||||
@ -168,27 +172,30 @@ public class CurrTaskController extends BaseController {
|
||||
{
|
||||
return failed("创建失败,APMS中验证炉号" + kilnCode + "失败!");
|
||||
}
|
||||
if (i==1){
|
||||
//通知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());
|
||||
//fixme 暂时没有正式user,使用测试账户
|
||||
apmsCreateSheet.setStartUser("QJJP03");
|
||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||
param.getDetParams().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(kilnCode);
|
||||
apmsCreateSheet.setItems(createItems);
|
||||
processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||
apmsCreateProcessSheet=processSheet.getData().getSuccess();
|
||||
sheetNo=processSheet.getData().getSheetNo();
|
||||
}
|
||||
|
||||
//通知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());
|
||||
//fixme 暂时没有正式user,使用测试账户
|
||||
apmsCreateSheet.setStartUser("QJJP03");
|
||||
ArrayList<CreateItem> createItems = new ArrayList<>();
|
||||
param.getDetParams().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(kilnCode);
|
||||
apmsCreateSheet.setItems(createItems);
|
||||
R<ApmsCreateProcessSheetVo> processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
|
||||
|
||||
if (processSheet.getData().getSuccess())
|
||||
if (apmsCreateProcessSheet)
|
||||
{
|
||||
//apms创建成功后写入数据库
|
||||
R<IdVo> mainTask = currTaskService.createProcessTask(param);
|
||||
@ -227,7 +234,6 @@ public class CurrTaskController extends BaseController {
|
||||
setUpdateCommonField(autoExeTask);
|
||||
autoExeTaskServiceBiz.updateById(autoExeTask);
|
||||
}
|
||||
String sheetNo = processSheet.getData().getSheetNo();
|
||||
//将返回的生产单号写入到主任务中。
|
||||
CurrTask currTaskById = currTaskService.getCurrTaskById(mainTask.getData().getId());
|
||||
currTaskById.setSheetNo(sheetNo);
|
||||
@ -240,6 +246,7 @@ public class CurrTaskController extends BaseController {
|
||||
{
|
||||
return failed("创建失败,APMS报错:" + processSheet.getData().getMsg());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -158,8 +158,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
|
||||
R<ApmsEndProcessVo> apmsStartProcessR = apmsControl.deleteBySheetNo(sheetNo);
|
||||
if (apmsStartProcessR.getData().getSuccess())
|
||||
{
|
||||
currTaskServiceBiz.removeById(byId.getId());
|
||||
currTaskDetService.deleteByCurrTaskId(byId.getId());
|
||||
Long currTaskId = 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生产单删除成功。");
|
||||
}
|
||||
else
|
||||
|
@ -103,7 +103,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
return failed(1, "操作失败,接收到重复订单信息:" + apmsPostOrderParam.getOrderNo());
|
||||
}
|
||||
orderInfoService.save(orderInfo);
|
||||
return successful("Wms接收Apms订单成功。", "");
|
||||
return successful(0,"Wms接收Apms订单成功。", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -266,7 +266,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
byId.setUpdateTime(LocalDateTime.now());
|
||||
byId.setOrderVoid(0);
|
||||
orderInfoService.updateById(byId);
|
||||
return successful("操作成功,订单状态置为作废。", "");
|
||||
return successful(0,"操作成功,订单状态置为作废。", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -311,7 +311,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
one.setMetallography(apmsCompleteOrder.getMetallographic());
|
||||
apmsCheckResultServiceBiz.save(one);
|
||||
//订单不应该在该地方完成,额外提供一个完成接口供人工完成,不通知apms
|
||||
return successful("操作成功,接收检验结果完成。", "");
|
||||
return successful(0,"操作成功,接收检验结果完成。", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -320,7 +320,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
|
||||
one1.setMetallography(apmsCompleteOrder.getMetallographic());
|
||||
one1.setUpdateTime(LocalDateTime.now());
|
||||
apmsCheckResultServiceBiz.updateById(one1);
|
||||
return successful("操作成功,更新检验结果完成。", "");
|
||||
return successful(0,"操作成功,更新检验结果完成。", "");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -436,7 +436,7 @@ public class AsynRunTaskService extends BaseService {
|
||||
//更新小车状态
|
||||
vehicle.setStatus(0);
|
||||
vehicleInfoServiceBiz.updateById(vehicle);
|
||||
// TODO: 2022/7/6 上报apms加工完成
|
||||
// TODO: 2022/7/6 上报apms加工完成.每次进炉加工完成后就上报apms完成处理生产单,等所有加工步骤都完成后上报apms完成生产单。
|
||||
logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"开始上报apm完成处理生产单!");
|
||||
ApmsEndProcess apmsEndProcess=new ApmsEndProcess();
|
||||
apmsEndProcess.setEndTime(LocalDateTime.now().toString());
|
||||
|
@ -148,15 +148,15 @@ public class ScheduledTask extends BaseService {
|
||||
//剩余时间
|
||||
Integer remainingTime=0;
|
||||
if (kilnInfo.getType()!=4){
|
||||
remainingTime = Integer.parseInt(readPlc(nameSpace, "ProgramTimeRemain").toString());
|
||||
remainingTime = readPlc(nameSpace, "ProgramTimeRemain").intValue();
|
||||
}
|
||||
if(kilnInfo.getType()==1||kilnInfo.getType()==3){
|
||||
//运行时间
|
||||
Integer runTime = Integer.parseInt(readPlc(nameSpace, "ProgramRunTime").toString());
|
||||
Integer runTime = readPlc(nameSpace, "ProgramRunTime").intValue();
|
||||
setupTime=runTime+remainingTime;
|
||||
}
|
||||
if (kilnInfo.getType()==2){
|
||||
setupTime=Integer.parseInt(readPlc(nameSpace, "SetTime").toString());
|
||||
setupTime=readPlc(nameSpace, "SetTime").intValue();
|
||||
}
|
||||
nowCurrTask.setSetupTime(setupTime);
|
||||
nowCurrTask.setRemainingTime(remainingTime);
|
||||
|
Loading…
Reference in New Issue
Block a user