rev: 半条任务与全任务、mes对接的部分日志记录
This commit is contained in:
@@ -57,7 +57,6 @@ public class SysCodeRuleServiceImpl extends ServiceImpl<SysCodeRuleMapper, SysCo
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(propagation= Propagation.REQUIRES_NEW)
|
||||
public String codeDemo(Map form) {
|
||||
String code = (String) form.get("code");
|
||||
String id = codeRuleMapper.selectOne(new LambdaQueryWrapper<SysCodeRule>().eq(SysCodeRule::getCode, code)).getId();
|
||||
|
||||
@@ -546,6 +546,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
throw new BadRequestException("载具编码为"+baseRequest.getVehicle_code()+"组盘不存在!");
|
||||
}
|
||||
String yjDeviceCode = basePoint.getParent_point_code(); // 压机设备编码
|
||||
SchBasePoint devicePoint = pointService.getById(yjDeviceCode);
|
||||
// 获取当前工单
|
||||
PdmBdWorkorder productionTask = workorderService.getDeviceProductionTask(yjDeviceCode);
|
||||
// 校验物料是否正确
|
||||
@@ -573,15 +574,16 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
vehiclematerialgroupService.updateById(one);
|
||||
// 记录泥料
|
||||
MesMudConsumptionDto mesMudConsumptionDto = new MesMudConsumptionDto();
|
||||
mesMudConsumptionDto.setMSGID(IdUtil.simpleUUID());
|
||||
mesMudConsumptionDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
mesMudConsumptionDto.setPWORKSCHE_ID(productionTask.getWorkorder_code());
|
||||
mesMudConsumptionDto.setOUT_FINNUM(String.valueOf(one.getMaterial_weight()));
|
||||
mesMudConsumptionDto.setPRESSUNIT(basePoint.getExt_point_code());
|
||||
mesMudConsumptionDto.setOUT_FINNUM(one.getMaterial_weight());
|
||||
mesMudConsumptionDto.setPRESSUNIT(devicePoint.getExt_point_code());
|
||||
mesMudConsumptionDto.setFBAGCODE("吨袋号未设置");
|
||||
mesMudConsumptionDto.setLOGT("仓库未知");
|
||||
mesMudConsumptionDto.setSENDTIM(DateUtil.now());
|
||||
mesMudConsumptionDto.setCREATE_TM(DateUtil.now());
|
||||
mesMudConsumptionDto.setOP_FLAG(GeneralDefinition.NO);
|
||||
log.info("泥料消耗上报参数:{}", mesMudConsumptionDto);
|
||||
// 不在维护lms数据表
|
||||
// PdmBdMudConsumption mudConsumption = new PdmBdMudConsumption();
|
||||
// mudConsumption.setDevice_code(productionTask.getPoint_code());
|
||||
@@ -602,7 +604,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
return taskResponse;
|
||||
} else {
|
||||
taskResponse.setIs_standing_finish(GeneralDefinition.NO);
|
||||
taskResponse.setMessage("静置未完成");
|
||||
// taskResponse.setMessage("静置未完成,预计静置完成时间:");
|
||||
taskResponse.setMessage(CommonUtils.remainStandingFinishTime(one.getInstorage_time(),
|
||||
one.getStanding_time()));
|
||||
return taskResponse;
|
||||
}
|
||||
}
|
||||
@@ -673,9 +677,9 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
if (ObjectUtil.isEmpty(deviceProductionTask)) {
|
||||
throw new BadRequestException("压机" + deviceCode + "暂无生产的工单");
|
||||
}
|
||||
// 2、通知混碾机生产泥料 - 直接存入混碾系统的数据库中
|
||||
// todo: 2、通知混碾机生产泥料 - 直接存入混碾系统的数据库中
|
||||
try {
|
||||
wmsToMmsService.addRequestMaterial(deviceProductionTask);
|
||||
// wmsToMmsService.addRequestMaterial(deviceProductionTask);
|
||||
} catch (Exception e) {
|
||||
log.error("发送混碾失败");
|
||||
throw new BadRequestException("发送混碾失败");
|
||||
@@ -799,6 +803,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
*/
|
||||
@Override
|
||||
public BaseResponse realTimeSetPoint(JSONObject param) {
|
||||
log.info("ACS修改点位状态:{}", param);
|
||||
ApplySignalStatusRequest actionRequest = param.toJavaObject(ApplySignalStatusRequest.class);
|
||||
String deviceCode = actionRequest.getDevice_code();
|
||||
String move = null;
|
||||
@@ -834,6 +839,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
schBasePoint.setPoint_status(move == null ? PointStatusEnum.EMPTY_POINT.getCode() : move);
|
||||
PointUtils.setUpdateByAcs(schBasePoint);
|
||||
pointService.updateById(schBasePoint);
|
||||
log.info("点位" + schBasePoint.getPoint_code() + "更新之后:{}", schBasePoint);
|
||||
return BaseResponse.responseOk(actionRequest.getRequestNo());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.ext.mes.service.dto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -21,9 +22,12 @@ public class MesMudConsumptionDto implements Serializable {
|
||||
private String FBAGCODE;
|
||||
/** 泥料仓库编号 */
|
||||
private String LOGT;
|
||||
private String OUT_NUMBER;
|
||||
private String OUT_FINNUM;
|
||||
private String OUT_THEONUM;
|
||||
/** 出库数量 */
|
||||
private BigDecimal OUT_NUMBER;
|
||||
/** 出库重量 */
|
||||
private BigDecimal OUT_FINNUM;
|
||||
/** 出库理论重量 */
|
||||
private BigDecimal OUT_THEONUM;
|
||||
private String PRESSUNIT;
|
||||
private String SENDTIM;
|
||||
private String SENDER;
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.wms.ext.mes.service.dto;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
@@ -23,15 +24,18 @@ public class MesProductDataDto implements Serializable {
|
||||
private String PRESSUNIT;
|
||||
private String FTEAM;
|
||||
private String TRAY_NO;
|
||||
private String PRO_NUM;
|
||||
/** 重量 */
|
||||
private BigDecimal PRO_NUM;
|
||||
/** 重量单位 */
|
||||
private String PRO_UNIT;
|
||||
private String PRO_SUBNUM;
|
||||
/** 数量 */
|
||||
private BigDecimal PRO_SUBNUM;
|
||||
private String PRO_SUBUNIT;
|
||||
private String FP_SUBUNIT;
|
||||
private BigDecimal FP_SUBUNIT;
|
||||
private String FP_REASON;
|
||||
private String FP_JJFLAG;
|
||||
private String FP_JJMATERIAL_ID;
|
||||
private String LDLNUM;
|
||||
private BigDecimal LDLNUM;
|
||||
private String CHECKERIN;
|
||||
private String CHECKERIN_TIM;
|
||||
private String PRODATE;
|
||||
|
||||
@@ -2,9 +2,11 @@ package org.nl.wms.ext.mes.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: PMS接收半成品入库信息
|
||||
* @Description: PMS接收半成品入库信息 - 入滚筒线
|
||||
* @Date: 2023/9/13
|
||||
*/
|
||||
@Data
|
||||
@@ -21,9 +23,9 @@ public class MesSemiProductionInfoInDto {
|
||||
private String PRESSUNIT;
|
||||
private String FTEAM;
|
||||
private String TRAY_NO;
|
||||
private String PRO_NUM;
|
||||
private BigDecimal PRO_NUM;
|
||||
private String PRO_UNIT;
|
||||
private String PRO_SUBNUM;
|
||||
private BigDecimal PRO_SUBNUM;
|
||||
private String PRO_SUBUNIT;
|
||||
private String STOCK;
|
||||
private String STOCK_NAME;
|
||||
|
||||
@@ -2,6 +2,8 @@ package org.nl.wms.ext.mes.service.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: lyd
|
||||
* @Description: PMS接收半成品出库信息
|
||||
@@ -16,9 +18,9 @@ public class MesSemiProductionInfoOutDto {
|
||||
private String FPRODUCT_MATERIAL_NAME;
|
||||
private String FMATSPEC;
|
||||
private String FMATMODEL;
|
||||
private String PRO_NUM;
|
||||
private BigDecimal PRO_NUM;
|
||||
private String PRO_UNIT;
|
||||
private String PRO_SUBNUM;
|
||||
private BigDecimal PRO_SUBNUM;
|
||||
private String PRO_SUBUNIT;
|
||||
private String STOCK;
|
||||
private String STOCK_NAME;
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.wms.sch.task_manage.enums.WorkOrderStatusEnum;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -111,32 +112,32 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode);
|
||||
String extData = workorder.getExt_data();
|
||||
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class);
|
||||
log.info("获取mes给的工单数据:{}", mesWorkOrderDto);
|
||||
log.info("获取MES给的工单数据:{}", mesWorkOrderDto);
|
||||
SchBasePoint basePoint = pointService.getById(workorder.getPoint_code());
|
||||
MesProductDataDto mesProductDataDto = new MesProductDataDto();
|
||||
mesProductDataDto.setMSGID(IdUtil.simpleUUID());
|
||||
mesProductDataDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
mesProductDataDto.setFORDER_NO(mesWorkOrderDto.getFORDER_NO());
|
||||
mesProductDataDto.setPWORKSCHE_ID(mesWorkOrderDto.getPWORKSCHE_ID());
|
||||
mesProductDataDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID());
|
||||
mesProductDataDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME());
|
||||
mesProductDataDto.setFMATSPEC(mesProductDataDto.getFMATSPEC());
|
||||
mesProductDataDto.setFMATMODEL(mesProductDataDto.getFMATMODEL());
|
||||
mesProductDataDto.setFMATSPEC(mesWorkOrderDto.getFMATSPEC());
|
||||
mesProductDataDto.setFMATMODEL(mesWorkOrderDto.getFMATMODEL());
|
||||
mesProductDataDto.setBATCHNO(workorder.getBatch_no());
|
||||
mesProductDataDto.setPRESSUNIT(basePoint.getExt_point_code());
|
||||
mesProductDataDto.setFTEAM(workorder.getTeam());
|
||||
mesProductDataDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code());
|
||||
mesProductDataDto.setPRO_SUBNUM(String.valueOf(vehiclematerialgroup.getMaterial_qty()));// 数量
|
||||
mesProductDataDto.setPRO_SUBNUM(BigDecimal.valueOf(vehiclematerialgroup.getMaterial_qty()));// 数量
|
||||
mesProductDataDto.setPRO_SUBUNIT("块");
|
||||
mesProductDataDto.setCHECKERIN_TIM(DateUtil.now());
|
||||
mesProductDataDto.setPRODATE(workorder.getProduce_date());
|
||||
mesProductDataDto.setCREATE_TM(DateUtil.now());
|
||||
mesProductDataDto.setOP_FLAG(GeneralDefinition.NO);
|
||||
log.info("返给MES的数据:{}", mesProductDataDto);
|
||||
log.info("压机产出返给MES的数据:{}", mesProductDataDto);
|
||||
// 插入mes数据库
|
||||
try {
|
||||
mesRequestMapper.insertProductData(mesProductDataDto);
|
||||
} catch (Exception e) {
|
||||
log.error("反馈压机产出插入mes数据库失败:{}", workorder);
|
||||
log.error("反馈压机产出插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("反馈压机产出插入mes数据库失败", "压机产出"+mesProductDataDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
@@ -153,9 +154,9 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode);
|
||||
String extData = workorder.getExt_data();
|
||||
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class);
|
||||
log.info("获取mes给的工单数据:{}", mesWorkOrderDto);
|
||||
log.info("获取MES给的工单数据:{}", mesWorkOrderDto);
|
||||
MesSemiProductionInfoInDto semiProductionInfoInDto = new MesSemiProductionInfoInDto();
|
||||
semiProductionInfoInDto.setMSGID(IdUtil.simpleUUID());
|
||||
semiProductionInfoInDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
semiProductionInfoInDto.setFORDER_NO(mesWorkOrderDto.getFORDER_NO());
|
||||
semiProductionInfoInDto.setPRESSUNIT(mesWorkOrderDto.getPRESSUNIT());
|
||||
semiProductionInfoInDto.setFSCHEDULE_ID(mesWorkOrderDto.getFSCHEDULE_ID());
|
||||
@@ -167,7 +168,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
semiProductionInfoInDto.setPRESSUNIT(mesWorkOrderDto.getPRESSUNIT());
|
||||
semiProductionInfoInDto.setFTEAM(workorder.getTeam());
|
||||
semiProductionInfoInDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code());
|
||||
semiProductionInfoInDto.setPRO_SUBNUM(String.valueOf(vehiclematerialgroup.getMaterial_qty()));// 数量
|
||||
semiProductionInfoInDto.setPRO_SUBNUM(BigDecimal.valueOf(vehiclematerialgroup.getMaterial_qty()));// 数量
|
||||
semiProductionInfoInDto.setPRO_SUBUNIT("块");
|
||||
semiProductionInfoInDto.setCHECKERIN_TIM(DateUtil.now());
|
||||
semiProductionInfoInDto.setPRODATE(workorder.getProduce_date());
|
||||
@@ -178,7 +179,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
try {
|
||||
mesRequestMapper.insertSemiProductInfo(semiProductionInfoInDto);
|
||||
} catch (Exception e) {
|
||||
log.error("入滚筒线插入mes数据库失败:{}", workorder);
|
||||
log.error("入滚筒线插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("入滚筒线插入mes数据库失败", "入滚筒线" + semiProductionInfoInDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
@@ -195,16 +196,16 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode);
|
||||
String extData = workorder.getExt_data();
|
||||
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class);
|
||||
log.info("获取mes给的工单数据:{}", mesWorkOrderDto);
|
||||
log.info("获取MES给的工单数据:{}", mesWorkOrderDto);
|
||||
MesSemiProductionInfoOutDto semiProductionInfoOutDto = new MesSemiProductionInfoOutDto();
|
||||
semiProductionInfoOutDto.setMSGID(IdUtil.simpleUUID());
|
||||
semiProductionInfoOutDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
semiProductionInfoOutDto.setSEMIPRODUCT_BATCHNO(workorder.getBatch_no());
|
||||
semiProductionInfoOutDto.setPRODUCT_BATCHNO(workorder.getBatch_no());
|
||||
semiProductionInfoOutDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID());
|
||||
semiProductionInfoOutDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME());
|
||||
semiProductionInfoOutDto.setFMATSPEC(mesWorkOrderDto.getFMATSPEC());
|
||||
semiProductionInfoOutDto.setFMATMODEL(mesWorkOrderDto.getFMATMODEL());
|
||||
semiProductionInfoOutDto.setPRO_NUM(String.valueOf(vehiclematerialgroup.getMaterial_qty()));
|
||||
semiProductionInfoOutDto.setPRO_NUM(BigDecimal.valueOf(vehiclematerialgroup.getMaterial_qty()));
|
||||
semiProductionInfoOutDto.setPRO_UNIT("块");
|
||||
semiProductionInfoOutDto.setSTOCK("未知");
|
||||
semiProductionInfoOutDto.setSTOCK_NAME("未知");
|
||||
@@ -217,7 +218,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
try {
|
||||
mesRequestMapper.insertSemiProductOutInfo(semiProductionInfoOutDto);
|
||||
} catch (Exception e) {
|
||||
log.error("出滚筒线插入mes数据库失败:{}", workorder);
|
||||
log.error("出滚筒线插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("入滚筒线插入mes数据库失败", "入滚筒线" + semiProductionInfoOutDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
@@ -234,9 +235,9 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode);
|
||||
String extData = workorder.getExt_data();
|
||||
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class);
|
||||
log.info("获取mes给的工单数据:{}", mesWorkOrderDto);
|
||||
log.info("获取MES给的工单数据:{}", mesWorkOrderDto);
|
||||
MesGdyMaterialInDto gdyMaterialInDto = new MesGdyMaterialInDto();
|
||||
gdyMaterialInDto.setMSGID(IdUtil.simpleUUID());
|
||||
gdyMaterialInDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
gdyMaterialInDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code());
|
||||
gdyMaterialInDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID());
|
||||
gdyMaterialInDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME());
|
||||
@@ -257,7 +258,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
try {
|
||||
mesRequestMapper.insertGdyMaterialIn(gdyMaterialInDto);
|
||||
} catch (Exception e) {
|
||||
log.error("入窑插入mes数据库失败:{}", workorder);
|
||||
log.error("入窑插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("入窑插入mes数据库失败", "入窑" + gdyMaterialInDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
@@ -274,9 +275,9 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
PdmBdWorkorder workorder = pdmBdWorkorderService.getByCode(workorderCode);
|
||||
String extData = workorder.getExt_data();
|
||||
MesWorkOrderDto mesWorkOrderDto = JSON.parseObject(extData, MesWorkOrderDto.class);
|
||||
log.info("获取mes给的工单数据:{}", mesWorkOrderDto);
|
||||
log.info("获取MES给的工单数据:{}", mesWorkOrderDto);
|
||||
MesGdyMaterialOutDto gdyMaterialOutDto = new MesGdyMaterialOutDto();
|
||||
gdyMaterialOutDto.setMSGID(IdUtil.simpleUUID());
|
||||
gdyMaterialOutDto.setMSGID(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
gdyMaterialOutDto.setTRAY_NO(vehiclematerialgroup.getVehicle_code());
|
||||
gdyMaterialOutDto.setFPRODUCT_MATERIAL_ID(mesWorkOrderDto.getFPRODUCT_MATERIAL_ID());
|
||||
gdyMaterialOutDto.setFPRODUCT_MATERIAL_NAME(mesWorkOrderDto.getFPRODUCT_MATERIAL_NAME());
|
||||
@@ -297,7 +298,7 @@ public class WmsToMesServiceImpl implements WmsToMesService {
|
||||
try {
|
||||
mesRequestMapper.insertGdyMaterialOut(gdyMaterialOutDto);
|
||||
} catch (Exception e) {
|
||||
log.error("出窑插入mes数据库失败:{}", workorder);
|
||||
log.error("出窑插入mes数据库失败:{}", e.getMessage());
|
||||
// todo:发送通知
|
||||
noticeService.createNotice("出窑插入mes数据库失败", "出窑" + gdyMaterialOutDto.getMSGID(),
|
||||
NoticeTypeEnum.EXCEPTION.getCode());
|
||||
|
||||
@@ -68,6 +68,8 @@ public abstract class AbstractTask {
|
||||
*/
|
||||
protected abstract void create() throws BadRequestException;
|
||||
|
||||
protected void createCompletion(SchBaseTask task){}
|
||||
|
||||
|
||||
/**
|
||||
* @return WCS的任务集合
|
||||
@@ -301,9 +303,11 @@ public abstract class AbstractTask {
|
||||
task.setGroup_id(this.setGroupPlate(param));
|
||||
task.setRequest_param(JSONObject.toJSONString(param));
|
||||
TaskUtils.setCreateByAcs(task); // 设置创建人信息
|
||||
taskService.save(task); // 创建一条单点任务。
|
||||
// 3、判断是否直接找点下发
|
||||
if (taskConfig.getIs_immediate_create()) {
|
||||
this.createCompletion(task);
|
||||
} else {
|
||||
taskService.save(task); // 创建一条单点任务。
|
||||
this.create();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -84,6 +85,35 @@ public class CTQKTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(",")).collect(Collectors.toList());
|
||||
// 找起点
|
||||
SchBasePoint point = findStartPoint(startRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("拆盘机暂无托盘!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("拆盘机暂无托盘!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
task.setRemark("");
|
||||
task.setVehicle_qty(point.getVehicle_qty());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
pointService.update(point);
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从区域中获取一推钢托盘
|
||||
* @param startRegionStr
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -85,6 +86,36 @@ public class DTSKTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
SchBasePoint point = findNextPoint(nextRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("货架暂无货位存放空托盘!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("货架暂无货位存放空托盘!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
|
||||
}
|
||||
|
||||
private SchBasePoint findNextPoint(List<String> nextRegionStr) {
|
||||
List<SchBasePoint> points = dtkMapper.findPointForDTSK(nextRegionStr);
|
||||
return ObjectUtil.isNotEmpty(points) ? points.get(0) : null;
|
||||
|
||||
@@ -156,6 +156,87 @@ public class FJMKTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
String requestParam = task.getRequest_param();// 任务的其他数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
String startPoint = task.getPoint_code1();
|
||||
// 获取起点 回写载具编码
|
||||
SchBasePoint startPointObj = pointService.getById(startPoint);
|
||||
task.setVehicle_code(startPointObj.getVehicle_code()); // 起点的木托盘编码
|
||||
// 找终点
|
||||
/** 包装位 */
|
||||
SchBasePoint packagePoint = findNextPoint(nextRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(packagePoint)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("包装线不可用!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("包装线不可用!");
|
||||
}
|
||||
task.setPoint_code2(packagePoint.getPoint_code()); // 包装线
|
||||
// todo: 校验是否够码满一托
|
||||
List<ApplyDeviceDto> list = JSONArray.parseArray(jsonObject.getString("list"), ApplyDeviceDto.class);
|
||||
// 1 获取点位相应数量
|
||||
int sum = 0;
|
||||
for (ApplyDeviceDto applyDeviceDto : list) {
|
||||
sum += Integer.parseInt(applyDeviceDto.getQty());
|
||||
}
|
||||
// 2.1 获取库存剩余数量 + 2.2 获取在搬运任务 - 组盘绑定状态是带绑定状态、任务类型是创建完成、下发、执行中
|
||||
int surplusNumber = fjMapper.getInventoryQuantity();
|
||||
int total = sum + surplusNumber; // 现有总数
|
||||
// 3 获取木托盘需要多少块
|
||||
int needFullNumber = 255; // todo: 具体未知如何获取
|
||||
JSONObject response = new JSONObject();
|
||||
String responseParam = task.getResponse_param();
|
||||
if (ObjectUtil.isNotEmpty(responseParam)) {
|
||||
response = JSON.parseObject(responseParam);
|
||||
}
|
||||
// 大于两托正常,大于1托给个1,小于1托给2
|
||||
// 4 校验是否够码满一托/两托
|
||||
if ((total % needFullNumber) == 0) {
|
||||
// 不可以叫空木托盘
|
||||
// response.put("")
|
||||
} else if ((total % needFullNumber) < 2) {
|
||||
// 不可以叫空木托盘
|
||||
}
|
||||
// 大于2就可以码
|
||||
/** 覆膜机木托盘位 */
|
||||
SchBasePoint LaminatePoint = findStartPoint(startRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(LaminatePoint)) {
|
||||
noticeService.createNotice("覆膜区不可用!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
// 消息通知
|
||||
throw new BadRequestException("覆膜区不可用!");
|
||||
}
|
||||
// 把这个设备位放到任务中
|
||||
response.put("fmj_device", LaminatePoint.getPoint_code());
|
||||
// 生产木托盘编码
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code3(LaminatePoint.getParent_point_code());
|
||||
task.setPoint_code4(startPoint);
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
taskService.save(task);
|
||||
|
||||
packagePoint.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(packagePoint);
|
||||
pointService.updateById(packagePoint);
|
||||
// 覆膜机对接位
|
||||
SchBasePoint basePoint = pointService.getById(LaminatePoint.getParent_point_code());
|
||||
basePoint.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(basePoint);
|
||||
pointService.updateById(basePoint);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String setGroupPlate(JSONObject param) {
|
||||
// 载具编码从点位中获取
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -64,6 +65,7 @@ public class FJQKTask extends AbstractTask {
|
||||
@Autowired
|
||||
private FJMapper fjMapper;
|
||||
@Override
|
||||
@Transactional
|
||||
protected void create() throws BadRequestException {
|
||||
// 获取任务
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY);
|
||||
@@ -113,6 +115,48 @@ public class FJQKTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找起点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject extGroupData = JSONObject.parseObject(requestParam);
|
||||
SchBasePoint point = findStartPoint(startRegionStr, extGroupData);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("覆膜机不可用!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("覆膜机不可用!");
|
||||
}
|
||||
// 将覆膜机设备放到任务中
|
||||
String responseParam = task.getResponse_param();
|
||||
JSONObject param = new JSONObject();
|
||||
if (ObjectUtil.isNotEmpty(responseParam)) {
|
||||
param = JSON.parseObject(responseParam);
|
||||
}
|
||||
// 把这个设备位放到任务中
|
||||
param.put("fmj_device", point.getPoint_code());
|
||||
// 设置起点并修改创建成功状态
|
||||
task.setPoint_code1(point.getParent_point_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
// todo: 未确认是否放在1还是2,目前规定四点任务空盘的载具编码是2
|
||||
task.setRemark("");
|
||||
task.setGroup_id(point.getGroup_id());
|
||||
taskService.save(task);
|
||||
|
||||
// 父点位锁住
|
||||
SchBasePoint basePoint = pointService.getById(point.getParent_point_code());
|
||||
basePoint.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(basePoint);
|
||||
pointService.updateById(basePoint);
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到的是覆膜机设备位置,父位才是对接位
|
||||
* @param startRegionStr
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -105,6 +106,41 @@ public class FJQLTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
// 钢托盘
|
||||
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找起点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject extGroupData = JSONObject.parseObject(requestParam);
|
||||
extGroupData.put("vehicle_type", task.getVehicle_type());
|
||||
SchBasePoint point = findStartPoint(startRegionStr, extGroupData);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("钢托盘缓存货架没有所需物料!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("钢托盘缓存货架没有所需物料!");
|
||||
}
|
||||
// 设置起点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setVehicle_code(point.getVehicle_code());
|
||||
task.setGroup_id(point.getGroup_id());
|
||||
task.setRemark("");
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 找起点:到钢托盘缓存找一个物料与分拣工单的物料相同的物料
|
||||
* 还需要判断是否烧制,选择已经烧制的物料
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -89,6 +90,33 @@ public class FJRKTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList());
|
||||
// 找终点
|
||||
SchBasePoint point = findNextPoint(nextRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("找不到可用的包装位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("找不到可用的包装位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 到对应的区域中获取放置点
|
||||
* @param nextRegionStr
|
||||
|
||||
@@ -26,6 +26,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -90,6 +91,34 @@ public class FJSKTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList());
|
||||
// 找终点
|
||||
SchBasePoint point = findNextPoint(nextRegionStr);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("叠盘架位置不可用!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("叠盘架位置不可用!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 找叠托位,无锁的位置即可
|
||||
* @param nextRegionStr
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -93,6 +94,37 @@ public class FJSLTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("分拣机械手[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("分拣机械手[" + task.getPoint_code1() + "]未找到所需点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
private SchBasePoint findNextPoint(List<String> nextRegionStr, JSONObject jsonObject) {
|
||||
LambdaQueryWrapper<SchBasePoint> lam = new QueryWrapper<SchBasePoint>().lambda();
|
||||
lam.in(SchBasePoint::getRegion_code, nextRegionStr)
|
||||
|
||||
@@ -139,6 +139,42 @@ public class HNMLTask extends AbstractTask {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
String requestParam = task.getRequest_param();// 任务的其他数据
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
// 找终点
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice(task.getRemark(), TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("未存在生产该料的压机!");
|
||||
}
|
||||
// 叫料完成
|
||||
// requestMaterialRecordService.callMaterialFinish(point.getRecord_id());
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
task.setVehicle_type(GeneralDefinition.MATERIAL_CUP);
|
||||
// 告知acs去左边右边
|
||||
int number = getNumber(point);
|
||||
task.setResponse_param(new JSONObject().fluentPut("direction", number).toJSONString());
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
private static int getNumber(SchBasePoint point) {
|
||||
String deviceCode = point.getDevice_code(); // 获取设备编码
|
||||
int number = Integer.parseInt(deviceCode.replaceAll("[^0-9]", ""));
|
||||
|
||||
@@ -102,6 +102,36 @@ public class CYZCTask extends AbstractTask {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(",")).collect(Collectors.toList());
|
||||
// 找终点
|
||||
String extGroupData = task.getExt_group_data();
|
||||
JSONObject jsonObject = JSONObject.parseObject(extGroupData);
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到钢托盘缓存区域空位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("未找到钢托盘缓存区域空位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setVehicle_type(GeneralDefinition.STEEL_TRAY);
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String setGroupPlate(JSONObject param) {
|
||||
// 查找组盘表信息,不做修改
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.nl.wms.util.PointUtils;
|
||||
import org.nl.wms.util.TaskUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -91,6 +92,38 @@ public class GZYQLTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找起点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
SchBasePoint point = findStartPoint(startRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("入窑口[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("入窑口[" + task.getPoint_code1() + "]未找到所需点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 找到有货最多的那层搬运到入窑口
|
||||
* @param startRegionStr
|
||||
|
||||
@@ -48,6 +48,36 @@ public class YZQKTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> startRegionStr = Arrays.stream(taskConfig.getStart_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找起点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
SchBasePoint point = findStartPoint(startRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("未找到所需点位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code1(point.getPoint_code());
|
||||
task.setRemark("");
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
protected void create() {
|
||||
|
||||
@@ -49,6 +49,38 @@ public class YZSKTask extends AbstractTask {
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
String vehicleType = jsonObject.getString("vehicle_type");
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("送空盅任务未找到混料机空位!", TASK_CONFIG_CODE + task.getPoint_code1(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("送空盅任务未找到混料机空位!");
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
if (task.getVehicle_type() == null) {
|
||||
task.setVehicle_type(vehicleType != null ? vehicleType : GeneralDefinition.MATERIAL_CUP);
|
||||
}
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
|
||||
@@ -128,6 +128,50 @@ public class YZSLTask extends AbstractTask {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
protected void createCompletion(SchBaseTask task) {
|
||||
// 配置信息
|
||||
SchBaseTaskconfig taskConfig = taskConfigService.getOne(new LambdaQueryWrapper<SchBaseTaskconfig>()
|
||||
.eq(SchBaseTaskconfig::getConfig_code, TASK_CONFIG_CODE));
|
||||
TaskUtils.setUpdateByAcs(task); // 修改修改者
|
||||
List<String> nextRegionStr = Arrays.stream(taskConfig.getNext_region_str().split(","))
|
||||
.collect(Collectors.toList());
|
||||
// 找终点
|
||||
String requestParam = task.getRequest_param();
|
||||
JSONObject jsonObject = JSONObject.parseObject(requestParam);
|
||||
SchBasePoint point = findNextPoint(nextRegionStr, jsonObject);
|
||||
if (ObjectUtil.isEmpty(point)) {
|
||||
// 消息通知
|
||||
noticeService.createNotice("压机[" + task.getPoint_code1() + "]未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(),
|
||||
NoticeTypeEnum.WARN.getCode());
|
||||
throw new BadRequestException("压机[" + task.getPoint_code1() + "]未找到所需点位!");
|
||||
}
|
||||
int up = countUp.get();
|
||||
int lower = countLower.get();
|
||||
if (lower == 0 || lower != 5) {
|
||||
countLower.incrementAndGet();
|
||||
} else {
|
||||
countUp.incrementAndGet();
|
||||
}
|
||||
if (up == 4) {
|
||||
countLower = new AtomicInteger(0);
|
||||
}
|
||||
if (lower == 4 && up == 4) {
|
||||
countUp = new AtomicInteger(0);
|
||||
}
|
||||
// 设置终点并修改创建成功状态
|
||||
task.setPoint_code2(point.getPoint_code());
|
||||
task.setTask_status(TaskStatus.CREATED.getCode());
|
||||
task.setRemark("");
|
||||
TaskUtils.setUpdateByAcs(task);
|
||||
taskService.save(task);
|
||||
|
||||
point.setIng_task_code(task.getTask_code());
|
||||
PointUtils.setUpdateByAcs(point);
|
||||
pointService.updateById(point);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否加急:是->入窑口,否->双层缓存线
|
||||
*
|
||||
@@ -163,7 +207,7 @@ public class YZSLTask extends AbstractTask {
|
||||
regionCode = nextRegionStr.get(0);
|
||||
}
|
||||
}
|
||||
// 双层缓存货架的一上一下的区分 -> todo: 上五下五区分
|
||||
// 双层缓存货架的一上一下的区分 -> 上五下五区分
|
||||
// 计算缓存上和缓存下的空位数量决定是使用desc还是asc
|
||||
int up = countUp.get();
|
||||
int lower = countLower.get();
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package org.nl.wms.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.wms.ext.acs.service.dto.PalletizeDto;
|
||||
import org.nl.wms.ext.acs.service.dto.SignalData;
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseRequest;
|
||||
import org.nl.wms.ext.acs.service.dto.to.acs.PutActionRequest;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -36,6 +36,36 @@ public class CommonUtils {
|
||||
return currentTime.isAfter(expiryTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 还有几分钟静置完成
|
||||
* @param inputDateString
|
||||
* @param staticDurationMinutes
|
||||
* @return
|
||||
*/
|
||||
public static String remainStandingFinishTime(String inputDateString, Integer staticDurationMinutes) {
|
||||
// 创建SimpleDateFormat以解析日期时间字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
// 将输入日期时间字符串解析为Date对象
|
||||
Date inputDate = dateFormat.parse(inputDateString);
|
||||
// 获取当前时间
|
||||
Date currentDate = new Date();
|
||||
// 计算距离静置完成还有多少毫秒
|
||||
long timeDifferenceMillis = inputDate.getTime() + (staticDurationMinutes * 60 * 1000) - currentDate.getTime();
|
||||
// 将毫秒转换为分钟
|
||||
long timeDifferenceMinutes = timeDifferenceMillis / (60 * 1000);
|
||||
// System.out.println("距离静置完成还有 " + timeDifferenceMinutes + " 分钟");
|
||||
// 计算预计完成时间
|
||||
Date estimatedCompletionTime = new Date(currentDate.getTime() + timeDifferenceMillis);
|
||||
// 格式化预计完成时间为字符串
|
||||
String estimatedCompletionTimeString = dateFormat.format(estimatedCompletionTime);
|
||||
return "距离静置完成还有 " + timeDifferenceMinutes + " 分钟" + ", 预计完成时间为:" + estimatedCompletionTimeString;
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static <T> T toJavaObject(String objectString, Class<T> clazz) {
|
||||
JSONObject jsonObject = JSONObject.parseObject(objectString);
|
||||
return jsonObject.toJavaObject(clazz);
|
||||
|
||||
@@ -107,7 +107,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--生产环境:打印控制台和输出到文件-->
|
||||
<springProfile name="prod">
|
||||
<root level="ERROR">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
<appender-ref ref="asyncLuceneAppender"/>
|
||||
</root>
|
||||
@@ -152,7 +152,7 @@ https://juejin.cn/post/6844903775631572999
|
||||
|
||||
<!--测试环境:打印控制台-->
|
||||
<springProfile name="test">
|
||||
<root level="info">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="asyncFileAppender"/>
|
||||
</root>
|
||||
<logger name="jdbc.audit" level="ERROR" additivity="false">
|
||||
|
||||
@@ -1238,4 +1238,5 @@ $
|
||||
沙沙
|
||||
上
|
||||
上来
|
||||
上去
|
||||
上去
|
||||
获取MES给的工单数据
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package org.nl.ext;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.nl.common.utils.CodeUtil;
|
||||
import org.nl.wms.ext.mes.service.WmsToMesService;
|
||||
import org.nl.wms.ext.mes.service.dao.mapper.MesRequestMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
@@ -56,4 +60,55 @@ public class TestDemo {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void test2() {
|
||||
wmsToMesService.reportProductData("1700746947708719104");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 静置时长(分钟)
|
||||
int staticDurationMinutes = 60;
|
||||
// 入库时间
|
||||
String inputDateString = "2023-09-15 11:55:01";
|
||||
|
||||
// 创建SimpleDateFormat以解析日期时间字符串
|
||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
try {
|
||||
// 将输入日期时间字符串解析为Date对象
|
||||
Date inputDate = dateFormat.parse(inputDateString);
|
||||
|
||||
// 获取当前时间
|
||||
Date currentDate = new Date();
|
||||
|
||||
// 计算距离静置完成还有多少毫秒
|
||||
long timeDifferenceMillis = inputDate.getTime() + (staticDurationMinutes * 60 * 1000) - currentDate.getTime();
|
||||
|
||||
// 将毫秒转换为分钟
|
||||
long timeDifferenceMinutes = timeDifferenceMillis / (60 * 1000);
|
||||
// 计算预计完成时间
|
||||
Date estimatedCompletionTime = new Date(currentDate.getTime() + timeDifferenceMillis);
|
||||
|
||||
// 格式化预计完成时间为字符串
|
||||
String estimatedCompletionTimeString = dateFormat.format(estimatedCompletionTime);
|
||||
|
||||
|
||||
System.out.println("距离静置完成还有 " + timeDifferenceMinutes + " 分钟");
|
||||
System.out.println("预计完成时间为:" + estimatedCompletionTimeString);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
void test03() throws InterruptedException {
|
||||
// for (int i = 0; i < 50; i++) {
|
||||
// System.out.println("生成标识code: " + CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
// Thread.sleep(1000);
|
||||
// }
|
||||
// for (int i = 0; i < 5; i++) {
|
||||
// new Thread(() -> System.out.println("生成标识code: " + CodeUtil.getNewCode("PDM_SHIFTORDER"))).start();
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user