opt: 料桶组盘新增绑定仓位

This commit is contained in:
2025-11-18 14:33:21 +08:00
parent 3f41a5d166
commit d3382c4a16
7 changed files with 51 additions and 25 deletions

View File

@@ -127,5 +127,5 @@ public interface IStructattrService extends IService<Structattr> {
* @param vehicleCode 仓位编码
* @return Structattr
*/
Structattr getByVehicleCode(String vehicleCode);
Structattr getByVehicleCode(String vehicleCode, boolean flag);
}

View File

@@ -4,11 +4,15 @@
<select id="getCanUseEmptyVehicle"
resultType="org.nl.wms.basedata_manage.service.dao.MdPbStoragevehicleinfo">
SELECT
v.*
FROM
`md_pb_storagevehicleinfo` v
WHERE v.storagevehicle_type = '10' AND v.is_used = '1' AND v.is_delete = '0'
AND 0 = (SELECT COUNT(*) FROM md_pb_groupplate g WHERE g.storagevehicle_code = v.storagevehicle_code AND g.`status` <![CDATA[ <> ]]> '03')
SELECT v.*
FROM `md_pb_storagevehicleinfo` v
WHERE v.storagevehicle_type = '10'
AND v.is_used = '1'
AND v.is_delete = '0'
AND 0 = (SELECT COUNT(*)
FROM md_pb_groupplate g
WHERE g.storagevehicle_code = v.storagevehicle_code AND g.`status` <![CDATA[ <> ]]> '03')
AND 0 = (SELECT COUNT(*) FROM st_ivt_structattr s WHERE s.storagevehicle_code = v.storagevehicle_code)
AND 0 = (SELECT COUNT(*) FROM sch_base_point pp WHERE pp.vehicle_code = v.storagevehicle_code)
</select>
</mapper>

View File

@@ -463,12 +463,12 @@ public class StructattrServiceImpl extends ServiceImpl<StructattrMapper, Structa
}
@Override
public Structattr getByVehicleCode(String vehicleCode) {
public Structattr getByVehicleCode(String vehicleCode, boolean flag) {
Structattr one = this.getOne(
new QueryWrapper<Structattr>().lambda()
.eq(Structattr::getStoragevehicle_code, vehicleCode)
);
if (ObjectUtil.isEmpty(one)) {
if (ObjectUtil.isEmpty(one) && flag) {
throw new BadRequestException("此载具不在仓位上【" + vehicleCode + "");
}
return one;

View File

@@ -182,7 +182,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
.eq(SchBaseTask::getExt_task_code, dto.getTask_code()));
if (CollectionUtils.isNotEmpty(taskList)) {
throw new BadRequestException("task_code" + dto.getTask_code() + "已存在,请勿重复提交!");
throw new BadRequestException("MES提供的任务号" + dto.getTask_code() + "已存在,请勿重复提交!");
}
//根据料桶号去载具表匹配料桶类型
@@ -304,21 +304,6 @@ public class MesToWmsServiceImpl implements MesToWmsService {
return MesResponse.requestOk();
} else if ("2".equals(dto.getTask_type())) {
if (StringUtils.isBlank(outPoint.getVehicle_code())) {
throw new BadRequestException("设备【" + pointCode + "】不存在料桶,请核对!");
}
//下空桶上满料 4个点 需要拆成2个任务组装成一组
log.info("下空桶上满料叫料,请求参数:【{}】", JSONObject.toJSONString(dto));
//点位作业位生产完后,满料状态->空料状态
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
.set(SchBasePoint::getPoint_status, "2")
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, DateUtil.now())
.eq(SchBasePoint::getPoint_code, outPoint.getPoint_code()));
SchBasePoint queryPoint = new SchBasePoint();
queryPoint.setPoint_type("2");
queryPoint.setParent_point_code(outPoint.getPoint_code());
@@ -346,6 +331,21 @@ public class MesToWmsServiceImpl implements MesToWmsService {
throw new BadRequestException("该点位存在正在执行的任务,请核对!");
}
if (StringUtils.isBlank(outPoint.getVehicle_code())) {
throw new BadRequestException("设备【" + pointCode + "】不存在料桶,请核对!");
}
//下空桶上满料 4个点 需要拆成2个任务组装成一组
log.info("下空桶上满料叫料,请求参数:【{}】", JSONObject.toJSONString(dto));
//点位作业位生产完后,满料状态->空料状态
pointService.update(new LambdaUpdateWrapper<SchBasePoint>()
.set(SchBasePoint::getPoint_status, "2")
.set(SchBasePoint::getUpdate_id, SecurityUtils.getCurrentUserId())
.set(SchBasePoint::getUpdate_name, SecurityUtils.getCurrentNickName())
.set(SchBasePoint::getUpdate_time, DateUtil.now())
.eq(SchBasePoint::getPoint_code, outPoint.getPoint_code()));
MdMeMaterialbase materialbase = materialbaseService.getByCode(groupPlate.getMaterial_code(), false);
if (ObjectUtil.isEmpty(materialbase)) {
throw new BadRequestException("物料【" + groupPlate.getMaterial_code() + "】不存在!");

View File

@@ -121,4 +121,9 @@ public class PdaJBController {
public ResponseEntity<Object> vehicleList(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaJBService.vehicleList(whereJson), HttpStatus.OK);
}
@PostMapping("/groupAndBind")
@SaIgnore
public ResponseEntity<Object> groupAndBind(@RequestBody JSONObject whereJson) {
return new ResponseEntity<>(pdaJBService.groupAndBind(whereJson), HttpStatus.OK);
}
}

View File

@@ -64,4 +64,6 @@ public interface PdaJBService {
PdaResponse suppList(JSONObject param);
PdaResponse vehicleList(JSONObject param);
PdaResponse groupAndBind(JSONObject param);
}

View File

@@ -443,6 +443,13 @@ public class PdaJBServiceImpl implements PdaJBService {
if (ObjectUtil.isEmpty(structattr)) {
throw new BadRequestException("仓位:" + pointCode + " 不存在!");
}
Structattr byVehicleCode = iStructattrService.getByVehicleCode(vehicleCode, false);
if (ObjectUtil.isNotEmpty(byVehicleCode)) {
throw new BadRequestException(pointCode.equals(byVehicleCode.getStruct_code())
? "该料桶已经绑定!" : "该料桶已经绑定在" + byVehicleCode.getStruct_code());
}
// 获取组盘信息
GroupPlate groupPlate = groupplateService.getOne(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, vehicleCode)
@@ -828,6 +835,14 @@ public class PdaJBServiceImpl implements PdaJBService {
return PdaResponse.requestParamOk(selectList);
}
@Override
public PdaResponse groupAndBind(JSONObject param) {
// vehicle_code、material_id、pcsn、supp_code、supp_name、single_weight、point_code
combination(param);
confirmSet(param);
return PdaResponse.requestOk("操作成功!");
}
private Map<String, Object> buildTaskData(String pointCode, String workorderId, String invId) {
Map<String, Object> jsonMst = new HashMap<>();
// ru库点