叫料优化

This commit is contained in:
2025-10-30 10:49:08 +08:00
parent c8a25ac6a9
commit a0eafa689e
3 changed files with 103 additions and 120 deletions

View File

@@ -205,12 +205,17 @@
INNER JOIN st_ivt_structattr attr ON ext.storagevehicle_code = attr.storagevehicle_code
INNER JOIN md_me_materialbase mater ON mater.material_id = ext.material_id
<where>
1 = 1 and ext.`status`='01'
1 = 1 and ext.`status`='02'
<if test="param.stor_id != null and param.stor_id != ''">
AND
attr.stor_id = #{param.stor_id}
</if>
<if test="param.storagevehicleext_id != null and param.storagevehicleext_id != ''">
AND
ext.group_id = #{param.storagevehicleext_id}
</if>
<if test="param.stor_code != null and param.stor_code != ''">
AND
attr.stor_code = #{param.stor_code}

View File

@@ -7,26 +7,10 @@ public class MesCallMaterialRequestDto {
@NotBlank(message = "设备号不可为空")
private String device_code;
@NotBlank(message = "货位号不可为空")
private String struct_code;
@NotBlank(message = "物料编码不可为空")
private String material_code;
@NotBlank(message = "料桶号不可为空")
private String vehicle_code;
@NotBlank(message = "组盘标识不可为空")
private String storagevehicleext_id;
@NotBlank(message = "物料编码不可为空")
private String pcsn;
private String qty_unit_name;
private String qty;
private String remark;
@NotBlank(message = "任务号不可为空")
private String task_code;
@@ -34,12 +18,6 @@ public class MesCallMaterialRequestDto {
@NotBlank(message = "任务类型不可为空")
private String task_type;
@NotBlank(message = "供应商编码不可为空")
private String supp_code;
@NotBlank(message = "供应商名称不可为空")
private String supp_name;
/**
* 是否是人工发起如果是则不需要反馈给MES
*

View File

@@ -27,6 +27,7 @@ import org.nl.wms.ext_manage.dto.mes.MesBackMaterialRequestDto;
import org.nl.wms.ext_manage.dto.mes.MesCallMaterialRequestDto;
import org.nl.wms.ext_manage.dto.mes.MesResponse;
import org.nl.wms.ext_manage.service.MesToWmsService;
import org.nl.wms.ext_manage.service.util.AcsResponse;
import org.nl.wms.pda_manage.ios_manage.service.PdaIosInService;
import org.nl.wms.sch_manage.enums.StatusEnum;
import org.nl.wms.sch_manage.enums.TaskStatus;
@@ -140,6 +141,15 @@ public class MesToWmsServiceImpl implements MesToWmsService {
dto.setTask_code(CodeUtil.getNewCode("TASK_CODE"));
}
JSONObject whereJson = new JSONObject();
whereJson.put("storagevehicleext_id", dto.getStoragevehicleext_id());
List<JSONObject> jsonObjectList = mdPbStoragevehicleextMapper.queryAllIn(whereJson);
if (CollectionUtils.isEmpty(jsonObjectList)) {
throw new BadRequestException("组盘ID有误!");
}
GroupPlate groupPlate = JSONObject.toJavaObject(jsonObjectList.get(0), GroupPlate.class);
RLock lock = redissonClient.getLock(dto.getTask_code());
boolean tryLock = lock.tryLock(1, TimeUnit.SECONDS);
try {
@@ -152,17 +162,17 @@ public class MesToWmsServiceImpl implements MesToWmsService {
}
if (!"1".equals(outPoint.getPoint_type())) {
throw new BadRequestException("设备【" + dto.getStruct_code() + "】有误,请传入作业区设备!");
throw new BadRequestException("设备【" + groupPlate.getStruct_code() + "】有误,请传入作业区设备!");
}
// 出库的仓位
Structattr outStructAttr = structattrService.getByCode(dto.getStruct_code());
Structattr outStructAttr = structattrService.getByCode(groupPlate.getStruct_code());
if (ObjectUtil.isEmpty(outStructAttr)) {
throw new BadRequestException("仓位【" + dto.getStruct_code() + "】不存在!");
throw new BadRequestException("仓位【" + groupPlate.getStruct_code() + "】不存在!");
}
if (3 != outStructAttr.getOccupancy_state() || StringUtils.isBlank(outStructAttr.getStoragevehicle_code())) {
throw new BadRequestException("仓位【" + dto.getStruct_code() + "】上没有料,无法叫料!");
throw new BadRequestException("仓位【" + groupPlate.getStruct_code() + "】上没有料,无法叫料!");
}
//只有料桶缓存库区的料才能被叫料
@@ -206,22 +216,16 @@ public class MesToWmsServiceImpl implements MesToWmsService {
.and(wp -> wp
.eq(SchBaseTask::getPoint_code2, pointCode)
.or()
.eq(SchBaseTask::getPoint_code1, dto.getStruct_code())
.eq(SchBaseTask::getPoint_code1, groupPlate.getStruct_code())
)
.le(SchBaseTask::getTask_status, TaskStatus.EXECUTING.getCode()));
if (CollectionUtils.isNotEmpty(schBaseTaskList)) {
throw new BadRequestException("存在正在执行的点位,请核对!");
}
MdMeMaterialbase materialbase = materialbaseService.getByCode(dto.getMaterial_code(),false);
MdMeMaterialbase materialbase = materialbaseService.getByCode(groupPlate.getMaterial_code(), false);
if (ObjectUtil.isEmpty(materialbase)) {
throw new BadRequestException("物料【" + dto.getMaterial_code() + "】不存在!");
}
GroupPlate groupPlate = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, outStructAttr.getStoragevehicle_code())
.eq(GroupPlate::getStatus, "02"));
if (ObjectUtil.isEmpty(groupPlate)) {
throw new BadRequestException("托盘[" + outStructAttr.getStoragevehicle_code() + "]组盘信息不存在!");
throw new BadRequestException("物料【" + groupPlate.getMaterial_code() + "】不存在!");
}
if (!"1".equals(outPoint.getPoint_status())) {
@@ -288,7 +292,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
// 创建任务
JSONObject taskParam = new JSONObject();
taskParam.put("iostorinv_id", invId);
taskParam.put("point_code", dto.getStruct_code());
taskParam.put("point_code", groupPlate.getStruct_code());
taskParam.put("point_code2", pointCode);
taskParam.put("group_id", groupPlate.getGroup_id());
taskParam.put("task_code", dto.getTask_code());
@@ -330,7 +334,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
List<SchBaseTask> schBaseTaskList = iSchBaseTaskService.list(new LambdaQueryWrapper<SchBaseTask>()
.eq(SchBaseTask::getIs_delete, IOSConstant.IS_DELETE_NO)
.and(wp -> wp
.eq(SchBaseTask::getPoint_code1, dto.getStruct_code())
.eq(SchBaseTask::getPoint_code1, groupPlate.getStruct_code())
.or()
.eq(SchBaseTask::getPoint_code2, dto.getDevice_code())
.or()
@@ -343,19 +347,14 @@ public class MesToWmsServiceImpl implements MesToWmsService {
throw new BadRequestException("存在正在执行的点位,请核对!");
}
MdMeMaterialbase materialbase = materialbaseService.getByCode(dto.getMaterial_code(),false);
MdMeMaterialbase materialbase = materialbaseService.getByCode(groupPlate.getMaterial_code(), false);
if (ObjectUtil.isEmpty(materialbase)) {
throw new BadRequestException("物料【" + dto.getMaterial_code() + "】不存在!");
throw new BadRequestException("物料【" + groupPlate.getMaterial_code() + "】不存在!");
}
if ("1".equals(outPoint.getPoint_status())) {
throw new BadRequestException("设备【" + dto.getStruct_code() + "】是空位,请执行单独上料!");
}
GroupPlate groupPlate = iMdPbGroupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, outStructAttr.getStoragevehicle_code())
.eq(GroupPlate::getStatus, "02"));
if (ObjectUtil.isEmpty(groupPlate)) {
throw new BadRequestException("托盘[" + outStructAttr.getStoragevehicle_code() + "]组盘信息不存在!");
throw new BadRequestException("设备【" + groupPlate.getStruct_code() + "】是空位,请执行单独上料!");
}
// 1、创建出库单、明细、分配明细
JSONObject insertInvObj = new JSONObject();
JSONArray tableData = new JSONArray();
@@ -416,7 +415,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
// 创建任务
JSONObject taskParam = new JSONObject();
taskParam.put("iostorinv_id", invId);
taskParam.put("point_code", dto.getStruct_code());
taskParam.put("point_code", groupPlate.getStruct_code());
taskParam.put("point_code2", sonSchBasePointList.get(0).getPoint_code());
taskParam.put("point_code3", dto.getDevice_code());
taskParam.put("point_code4", sonSchBasePointList.get(1).getPoint_code());
@@ -554,6 +553,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
/**
* 组织入库插入数据
*
* @param whereJson {
* storagevehicle_code载具编码
* point_code点位编码