successful(int code,String msg, T data) {
+ return R.ok(code,msg, data);
+ }
/**
*
diff --git a/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java b/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java
index 24279b0..2177e33 100644
--- a/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java
+++ b/6.program/wms-core/src/main/java/com/mt/wms/core/vo/R.java
@@ -99,5 +99,8 @@ public class R implements Serializable {
public static R ok(String msg, T data) {
return new R().msg(msg).data(data);
}
+ public static R ok(int code,String msg, T data) {
+ return new R().code(code).msg(msg).data(data);
+ }
}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java
index 130a458..9908e72 100644
--- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java
@@ -139,6 +139,10 @@ public class CurrTaskController extends BaseController {
@ApiOperation(value = "订单加工-创建多个个分步骤加工任务至任务队列")
public R createAutoTask(@Validated @RequestBody AutoCurrTaskParam autoCurrTaskParam){
List detParams = autoCurrTaskParam.getTaskCreateParamList();
+ Boolean apmsCreateProcessSheet=false;
+ String sheetNo=null;
+ int i=1;
+ R 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 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 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 processSheet = apmsControl.createProcessSheet(apmsCreateSheet);
-
- if (processSheet.getData().getSuccess())
+ if (apmsCreateProcessSheet)
{
//apms创建成功后写入数据库
R 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;
}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java
index 325b04d..947c93e 100644
--- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java
@@ -158,8 +158,15 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
R 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 currTaskList = currTaskServiceBiz.list(new QueryWrapper().eq(CurrTask.AUTO_EXE_TASK_ID, byId.getAutoExeTaskId()));
+ if (currTaskList.size()==0){
+ autoExeTaskServiceBiz.removeById(byId.getAutoExeTaskId());
+ }
+ }
return successful("APMS生产单删除成功。");
}
else
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java
index 950fdf7..b0a12f0 100644
--- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/OrderInfoServiceImpl.java
@@ -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,"操作成功,更新检验结果完成。", "");
}
}
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
index 70f107d..5f5ec85 100644
--- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/AsynRunTaskService.java
@@ -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());
diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java
index 689c841..18acbb5 100644
--- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java
+++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/ScheduledTask.java
@@ -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);