This commit is contained in:
李广豪 2022-07-10 22:48:44 +08:00
commit a440684232
5 changed files with 53 additions and 5 deletions

View File

@ -36,6 +36,20 @@ public class CodeGeneratorHelper {
* 自动任务编码
*/
public static final String AUTO_TASK_CODE = "AUTO_TASK_CODE";
/**
* 炉号编码
*/
public static final String STOVE_CODE = "STOVE_CODE";
/**
* 生成自炉号编码
*
* @return 订单编号
*/
public static String getStoveCode(String kilnNameAndCraft) {
return IDGenerator.gen(kilnNameAndCraft, "yyMMdd", 2, STOVE_CODE);
}
/**
* 生成自动任务编码
*

View File

@ -81,4 +81,11 @@ public class OrderParamForApms extends BaseParam {
@ApiModelProperty(value = "单位")
private String unit;
/**
* 技术要求 APMS系统获取
*/
@ApiModelProperty(value = "技术要求")
private String techRequest;
}

View File

@ -95,6 +95,8 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
setCommon(orderInfo);
//设定来源信息为apms
orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue());
//apms传来的技术要求字段使用工艺要求字段不关注工艺要求字段
orderInfo.setCraftIll(apmsPostOrderParam.getTechRequest());
orderInfo.setInterCode(IDGenerator.gen("DD", IDGenerator.PATTERN_YYYYMMDDHHMM, 2, "ORDER_CODE"));
//检查是否为重复的单号
OrderInfo one = orderInfoService.getOne(new QueryWrapper<OrderInfo>().eq(OrderInfo.ORDER_NO, apmsPostOrderParam.getOrderNo()).eq(OrderInfo.IDEN_CARD_NUM, apmsPostOrderParam.getIdenCardNum()));

View File

@ -6,14 +6,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.*;
import com.mt.wms.core.dal.service.*;
import com.mt.wms.core.utils.CodeGeneratorHelper;
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.params.*;
import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo;
import com.mt.wms.empty.vo.ApmsEndProcessVo;
import com.mt.wms.empty.vo.ApmsFinishProcessSheetVo;
import com.mt.wms.empty.websocket.WebSocketServer;
@ -32,6 +31,7 @@ import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -86,6 +86,7 @@ public class AsynRunTaskService extends BaseService {
public void asynRunTask(Long currTaskId,Long vehicleId) throws IOException {
CurrTask currTask = currTaskServiceBiz.getById(currTaskId);
VehicleInfo vehicle = vehicleInfoServiceBiz.getById(vehicleId);
List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask));
//检查车辆是否冲突冲突则避让
rgvStatus(vehicleId,currTask);
//新建一条执行任务的关系表存放任务执行信息
@ -97,6 +98,28 @@ public class AsynRunTaskService extends BaseService {
runTask.setEndPosition(currTask.getTargetPosition());
runTask.setBeginTime(LocalDateTime.now());
runTaskServiceBiz.save(runTask);
//通知apms创建一个生产单
ApmsCreateProcessSheet apmsCreateSheet = new ApmsCreateProcessSheet();
apmsCreateSheet.setWorkShopCode("BM");
apmsCreateSheet.setStartTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
apmsCreateSheet.setTechCode(currTask.getCraftCodeId().toString());
//fixme 暂时没有正式user使用测试账户
apmsCreateSheet.setStartUser("QJJP03");
ArrayList<CreateItem> createItems = new ArrayList<>();
currTaskDetList.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(CodeGeneratorHelper.getStoveCode(currTask.getKilnName()+String.format("%02d",currTask.getCraftCodeId())));
apmsCreateSheet.setItems(createItems);
R<ApmsCreateProcessSheetVo> processSheet = apmsController.createProcessSheet(apmsCreateSheet);
if (!processSheet.getData().getSuccess()){
logger.info(currTaskId+"创建失败APMS报错" + processSheet.getData().getMsg());
webSocketServer.sendtoUser("创建失败APMS报错" + processSheet.getData().getMsg(),"1");
}
//调用车辆填入起终点,得到车辆执行结果
Long startPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getStartPosition())).getCode();
Long endPoint = pointInfoServiceBiz.getOne(new QueryWrapper<PointInfo>().eq(PointInfo.NOTE, runTask.getEndPosition())).getCode();

View File

@ -75,9 +75,11 @@ public class ScheduledTask extends BaseService {
private OrderInfoServiceBiz orderInfoServiceBiz;
@Test
//@Scheduled(fixedDelay = 1000*20)
public void test() throws IOException {
System.out.println(CodeGeneratorHelper.getStoveCode("MBA102"));
}
//@Scheduled(fixedDelay = 1000*60)
@Scheduled(fixedDelay = 1000*60)
public void testWebsocket() throws IOException {
//查询出正在进炉加工的curr_task,查询对应炉号是否Working,查询计划时间剩余时间查询标识卡详情
List<CurrTask> currTaskList = currTaskServiceBiz.list(new QueryWrapper<CurrTask>().eq(CurrTask.IS_IN, 1));