监听到加工炉完成加工后就结束当前工艺,防止开始新的工艺时上报出错
This commit is contained in:
lgh 2022-12-02 15:42:02 +08:00
parent 63d251325f
commit 21a4cfab23

View File

@ -12,6 +12,9 @@ import com.mt.wms.core.utils.CodeGeneratorHelper;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.utils.StringUtils;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.controller.ApmsController;
import com.mt.wms.empty.params.ApmsEndProcess;
import com.mt.wms.empty.vo.ApmsEndProcessVo;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.NowCurrTaskDetVo;
import com.mt.wms.empty.websocket.WebSocketServer;
@ -25,6 +28,7 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -81,6 +85,8 @@ public class ScheduledTask extends BaseService {
private TaskHisServiceBiz taskHisServiceBiz;
@Resource
private TaskDetHisServiceBiz taskDetHisServiceBiz;
@Resource
private ApmsController apmsController;
//@Scheduled(fixedDelay = 1000*20)
@ -242,6 +248,8 @@ public class ScheduledTask extends BaseService {
taskDetHisServiceBiz.saveBatch(taskDetHisList);
//加工结束而没有立马出炉加工结束记录能源消耗值只记录一次
asynRunTaskService.asynEndRecordConsume(currTask.getId(), kilnId);
apmsEndProcess(currTask);
logger.info(currTask+"上报apms结束当前工艺加工");
logger.info(kilnInfo.getCode() + "炉子中的任务:" + currTask.getId() + "已加工结束,记录加工结束能源消耗值");
}
runTaskUtils.runTaskForOutKiln(kilnId);
@ -882,4 +890,23 @@ public class ScheduledTask extends BaseService {
Boolean free = Boolean.valueOf(JSONObject.parseObject(result).get("result").toString());
return free;
}
/**
* 上报apms-end
*
* @param currTask
* @return
*/
private Boolean apmsEndProcess(CurrTask currTask) {
ApmsEndProcess apmsEndProcess = new ApmsEndProcess();
apmsEndProcess.setEndTime(currTask.getEndTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsEndProcess.setEndUser("QJJP03");
apmsEndProcess.setSheetNo(currTask.getSheetNo());
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
if (apmsEndProcessVoR.getCode() != 0) {
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms失败");
return false;
}
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单完成处理上报apms成功");
return true;
}
}