上报apms生产单进度

This commit is contained in:
李广豪 2022-07-06 18:35:14 +08:00
parent 14b05bae7e
commit b107cd2446
5 changed files with 152 additions and 13 deletions

View File

@ -0,0 +1,37 @@
package com.mt.wms.empty.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.core.dal.entity.ApmsCheckResult;
import com.mt.wms.core.dal.service.ApmsCheckResultServiceBiz;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.ApmsCheckRusultQueryParam;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* @Author: LGH
* @Date: 2022/7/6
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "checkResult")
@Slf4j
@Api(value = "检验结果相关接口", tags = "检验结果相关接口", hidden = false)
public class CheckResultController extends BaseController {
@Resource
private ApmsCheckResultServiceBiz apmsCheckResultServiceBiz;
public R<ApmsCheckResult> checkResult(ApmsCheckRusultQueryParam apmsCheckRusultQueryParam){
ApmsCheckResult apmsCheckResult = apmsCheckResultServiceBiz.getOne(new QueryWrapper<ApmsCheckResult>()
.eq(ApmsCheckResult.SHEET_NO, apmsCheckRusultQueryParam.getSheetNo())
.eq(ApmsCheckResult.IDEN_CARD_NUM, apmsCheckRusultQueryParam.getIdenCardNum()));
return successful(apmsCheckResult);
}
}

View File

@ -0,0 +1,24 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.params.BasePageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @Author: LGH
* @Date: 2022/7/6
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "检验结果查询参数", description = "检验结果查询参数")
public class ApmsCheckRusultQueryParam extends BasePageParam {
@ApiModelProperty(value = "生产单号", required = true)
private String sheetNo;
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
}

View File

@ -181,16 +181,16 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
orderInfo.setKilnId(currTask.getKilnId());
orderInfo.setStartPosition(currTask.getStartPosition());
orderInfo.setTargetPosition(currTask.getTargetPosition());
orderInfo.setVehicleId(currTask.getVehicleId());
//orderInfo.setVehicleId(currTask.getVehicleId());
//获取窑炉和车辆的名称信息
if (orderInfo.getKilnId() != null)
{
orderInfo.setKilnName(collect2.get(orderInfo.getKilnId()).get(0).getKilnName());
}
if (orderInfo.getVehicleId() != null)
/* if (orderInfo.getVehicleId() != null)
{
orderInfo.setVehicleName(collect.get(orderInfo.getVehicleId()).get(0).getVehicleName());
}
}*/
}
);
return successful(currOrderCurrTask);

View File

@ -8,6 +8,14 @@ import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.utils.HttpClient;
import com.mt.wms.core.utils.IDGenerator;
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.params.ApmsFinishProcessSheet;
import com.mt.wms.empty.params.ApmsStartProcess;
import com.mt.wms.empty.params.FinishItem;
import com.mt.wms.empty.vo.ApmsEndProcessVo;
import com.mt.wms.empty.vo.ApmsFinishProcessSheetVo;
import com.mt.wms.empty.websocket.WebSocketServer;
import io.swagger.models.auth.In;
import org.junit.jupiter.api.Test;
@ -21,11 +29,10 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
import java.util.concurrent.TimeUnit;
/**
@ -68,6 +75,12 @@ public class AsynRunTaskService extends BaseService {
private ParGasValueServiceBiz parGasValueServiceBiz;
@Resource
private WebSocketServer webSocketServer;
@Resource
private ApmsController apmsController;
@Resource
private AutoExeTaskServiceBiz autoExeTaskServiceBiz;
@Resource
private CurrTaskDetServiceBiz currTaskDetServiceBiz;
//窑炉可用未满的情况下调用车辆起点为提升台终点为窑炉
@Async("asyncServiceExecutor")
public void asynRunTask(Long currTaskId,Long vehicleId) throws IOException {
@ -133,6 +146,9 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工单开始
//apmsStartProcess(currTask);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
@ -225,6 +241,8 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms生产单开始加工
//apmsStartProcess(currTask);
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
@ -415,6 +433,48 @@ public class AsynRunTaskService extends BaseService {
//更新小车状态
vehicle.setStatus(0);
vehicleInfoServiceBiz.updateById(vehicle);
// TODO: 2022/7/6 上报apms加工完成
/* ApmsEndProcess apmsEndProcess=new ApmsEndProcess();
apmsEndProcess.setEndTime(LocalDateTime.now().toString());
apmsEndProcess.setEndUser("QJJP03");
apmsEndProcess.setSheetNo(currTask.getSheetNo());
R<ApmsEndProcessVo> apmsEndProcessVoR = apmsController.endProcess(apmsEndProcess);
if (apmsEndProcessVoR.getCode()!=0){
logger.info("任务:"+currTaskId+" 生产单号:"+currTask.getSheetNo()+"上报apm完成处理生产单失败");
}
if (currTask.getIsAuto()==1){
//两步且是第二步
List<AutoExeTask> twoSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 1)
.eq(AutoExeTask.T_TASK_ID, currTaskId));
//三步且是第三步
List<AutoExeTask> threeSpet = autoExeTaskServiceBiz.list(new QueryWrapper<AutoExeTask>()
.eq(AutoExeTask.PROCESS_FLOW_TYPE, 2)
.eq(AutoExeTask.TH_TASK_ID, currTaskId));
if (!(threeSpet.size()!=0||twoSpet.size()!=0)){
return;
}
}
ApmsFinishProcessSheet apmsFinishProcessSheet=new ApmsFinishProcessSheet();
apmsFinishProcessSheet.setSheetNo(currTask.getSheetNo());
apmsFinishProcessSheet.setEndTime(LocalDateTime.now().toString());
apmsFinishProcessSheet.setEndUser("QJJP03");
List<FinishItem> finishItems=new ArrayList<>();
List<CurrTaskDet> currTaskDets = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTaskId));
for (CurrTaskDet currTaskDet:currTaskDets
) {
FinishItem finishItem=new FinishItem();
BigDecimal bigDecimal = new BigDecimal(currTaskDet.getWeight());
finishItem.setFinishWeight(bigDecimal.doubleValue());
finishItem.setFinishQuantity(Math.round(currTaskDet.getQuantity()));
finishItem.setItemCode(currTaskDet.getIdenCardNum());
finishItems.add(finishItem);
}
apmsFinishProcessSheet.setItems(finishItems);
R<ApmsFinishProcessSheetVo> apmsFinishProcessSheetVoR = apmsController.finishProcessSheet(apmsFinishProcessSheet);
if (apmsFinishProcessSheetVoR.getCode()!=0){
logger.info("任务:"+currTask.getTaskCode()+"完成后上报apms完成生产单失败");
}*/
}else {
runTask.setStatus(3);
runTask.setUpdateTime(LocalDateTime.now());
@ -1019,4 +1079,16 @@ public class AsynRunTaskService extends BaseService {
return Integer.parseInt(String.valueOf(jsonObject.get("msg")));
}
private void apmsStartProcess(CurrTask currTask) {
ApmsStartProcess apmsStartProcess = new ApmsStartProcess();
apmsStartProcess.setStartTime(LocalDateTime.now().toString());
apmsStartProcess.setStartUser("QJJP03");
apmsStartProcess.setSheetNo(currTask.getSheetNo());
apmsStartProcess.setTechName(currTask.getCraftCodeId().toString());
apmsStartProcess.setStoveCode(kilnInfoServiceBiz.getById(currTask.getKilnId()).getCode());
R<ApmsStartProcess> apmsStartProcessR = apmsController.startProcess(apmsStartProcess);
if (apmsStartProcessR.getCode() != 0) {
logger.info("任务号" + currTask.getTaskCode() + "生产单号:" + currTask.getSheetNo() + "生产单开始生产上报apms失败");
}
}
}

View File

@ -81,6 +81,9 @@ public class ScheduledTask extends BaseService {
public void testWebsocket() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
if (currTaskList.size()==0){
return;
}
List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
) {
@ -119,10 +122,13 @@ public class ScheduledTask extends BaseService {
/**
* 正在加工的加工任务详情
*/
//@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000*60)
public void screen() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));
if (currTaskList.size()==0){
return;
}
List<NowCurrTaskDetVo> nowCurrTaskDetVoList = BeanUtils.copyList(currTaskList, NowCurrTaskDetVo.class);
for (NowCurrTaskDetVo nowCurrTask:nowCurrTaskDetVoList
) {
@ -166,12 +172,12 @@ public class ScheduledTask extends BaseService {
nowCurrTask.setCurrTaskDetVoList(currTaskDetVoList);
}
}
webSocketServer.sendtoAll(JSONObject.toJSONString(nowCurrTaskDetVoList));
webSocketServer.sendtoUser(JSON.toJSONString(nowCurrTaskDetVoList),"2");
}
/**
* 查询加工完成的窑炉
*/
//@Scheduled(fixedDelay = 1000*60*3)
@Scheduled(fixedDelay = 1000*60*3)
public void taskForStockToKiln() throws IOException {
//两辆车是否都空闲只有两辆车都空闲才被允许做任务
List<VehicleInfo> vehicleInfoList = vehicleInfoServiceBiz.list(new QueryWrapper<VehicleInfo>().eq(VehicleInfo.STATUS, 0));
@ -204,7 +210,7 @@ public class ScheduledTask extends BaseService {
}
//查询出正在加工的窑炉遍历根据采集频率的不同采集高频数据能源消耗暂定30秒
//@Scheduled(fixedDelay = 1000*30)
@Scheduled(fixedDelay = 1000*30)
public void getFastValue(){
//加工炉列表
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>().in(KilnInfo.TYPE,1,3));
@ -292,7 +298,7 @@ public class ScheduledTask extends BaseService {
}
//查询出正在加工的窑炉遍历根据采集频率的不同采集低频数据能源消耗暂定3分钟一次
//@Scheduled(fixedDelay = 1000*60*3)
@Scheduled(fixedDelay = 1000*60*3)
public void getSlowValue(){
System.out.println("开始采集数据");
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
@ -436,7 +442,7 @@ public class ScheduledTask extends BaseService {
//遍历窑炉空窑炉查询缓存区是否有等待加工的任务
//待加工任务存在且没有状态为正在进炉的情况下按照先进先出的规则选择待加工任务呼叫车辆进炉
//@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000*60)
public void runTaskForEmptyKiln() throws IOException {
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list(new QueryWrapper<KilnInfo>()
.eq(KilnInfo.VALID, 1).eq(KilnInfo.STATUS, 0));
@ -483,7 +489,7 @@ public class ScheduledTask extends BaseService {
}
//遍历正在工作炉子的报警变量记录报警
//@Scheduled(fixedDelay = 1000*30)
@Scheduled(fixedDelay = 1000*30)
public void listenKilnAlarm(){
List<KilnInfo> kilnInfoList = kilnInfoServiceBiz.list();
for (KilnInfo kilnInfo:kilnInfoList