Merge remote-tracking branch 'origin/master'

This commit is contained in:
2025-08-18 10:41:40 +08:00
7 changed files with 70 additions and 14 deletions

View File

@@ -72,4 +72,6 @@ public class StrategyStructParam {
* 占位状态
*/
private Integer occupancy_state;
private Boolean is_empty_vehicle;
}

View File

@@ -3,6 +3,7 @@ package org.nl.wms.decision_manage.service.strategyConfig.decisioner.impl.diy;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.nl.wms.basedata_manage.service.IStructattrService;
import org.nl.wms.basedata_manage.service.dao.Structattr;
import org.nl.wms.decision_manage.service.strategyConfig.decisioner.Decisioner;
@@ -30,15 +31,28 @@ public class RawInRuleHandle extends Decisioner<Structattr, JSONObject> {
@Override
public List<Structattr> handler(List<Structattr> list, JSONObject param) {
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>()
.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getString("sect_code"))
.isNull("storagevehicle_code")
.isNull("Task_code")
.eq("occupancy_state",1)
.orderByAsc("update_time");
List<Structattr> querylList = iStructattrService.list(query);
return querylList;
//为空,则为普通入库,需要一个空托盘位置,适用于普通入库
if (!param.containsKey("is_empty_vehicle")) {
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>()
.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getString("sect_code"))
.isNotNull("storagevehicle_code")
.isNull("Task_code")
.eq("occupancy_state", 2)
.orderByAsc("update_time");
return iStructattrService.list(query);
} else {
//空位,适用于空托盘入库
QueryWrapper<Structattr> query = new QueryWrapper<Structattr>()
.eq("is_used", true)
.eq("lock_type", IOSEnum.LOCK_TYPE.code("未锁定"))
.eq("sect_code", param.getString("sect_code"))
.isNull("storagevehicle_code")
.isNull("Task_code")
.eq("occupancy_state", 1)
.orderByAsc("update_time");
return iStructattrService.list(query);
}
}
}

View File

@@ -180,6 +180,26 @@ public class MesToWmsServiceImpl implements MesToWmsService {
throw new BadRequestException("task_code" + dto.getTask_code() + "已存在,请勿重复提交!");
}
//根据料桶号去载具表匹配料桶类型
MdPbStoragevehicleinfo mdPbStoragevehicleinfo = iMdPbStoragevehicleinfoService.getByCode(outStructAttr.getStoragevehicle_code());
if(mdPbStoragevehicleinfo == null){
throw new BadRequestException("未找到" + outStructAttr.getStruct_code() + "点位上的的载具!");
}
//通过料桶号的料桶类型,匹配确认入库库区
Dict dict= dictService.getDictByCodeAndValue("storagevehicle_type",mdPbStoragevehicleinfo.getStoragevehicle_type());
if(dict==null){
throw new BadRequestException("未找到载具编码为" + outStructAttr.getStoragevehicle_code() + "的载具库区,请检查字典中是否维护!只允许料桶叫料!");
}
//查询库区
Sectattr sectattr = sectattrService.findByCode(dict.getPara1());
if (sectattr == null) {
throw new BadRequestException("未找到载具编码为" + outStructAttr.getStoragevehicle_code() + "的载具库区,请检查字典中是否维护!只允许料桶叫料!");
}
//1、单独上料2、下空桶上满料
if("1".equals(dto.getTask_type())){
log.info("单独上料叫料,请求参数:【{}】", JSONObject.toJSONString(dto));
@@ -467,6 +487,10 @@ public class MesToWmsServiceImpl implements MesToWmsService {
//查询库区
Sectattr sectattr = sectattrService.findByCode(dict.getPara1());
if(sectattr==null){
throw new BadRequestException("未找到载具编码为" + dto.getVehicle_code() + "的载具入库库区,请检查字典中是否维护!");
}
JSONObject param = new JSONObject();
if(dto.getIsManual() != null && dto.getIsManual()){
param.put("create_mode", "手动" );
@@ -504,6 +528,7 @@ public class MesToWmsServiceImpl implements MesToWmsService {
param.put("site_code",dto.getDevice_code());
param.put("sect_id",sectattr.getSect_id());
param.put("sect_code",sectattr.getSect_code());
param.put("back_material_flag",true);
pdaIosInService.vehicleInConfirm(param);
} else{
throw new BadRequestException("任务类型有误请传入1或2");

View File

@@ -566,8 +566,11 @@ public class PdaIosInServiceImpl implements PdaIosInService {
public PdaResponse vehicleInConfirm(JSONObject whereJson) {
//空载具入库
Sectattr sectattr = sectattrService.findById(whereJson.getString("sect_code"));
if(sectattr == null){
throw new BadRequestException("库区" + whereJson.getString("sect_code") +"不存在");
if (sectattr == null) {
sectattr = sectattrService.findByCode(whereJson.getString("sect_code"));
if (sectattr == null) {
throw new BadRequestException("库区" + whereJson.getString("sect_code") + "不存在");
}
}
whereJson.put("sect_code", sectattr.getSect_code());
@@ -588,7 +591,8 @@ public class PdaIosInServiceImpl implements PdaIosInService {
if(schBasePointList.size()>1){
throw new BadRequestException("存在重复点位,请确认");
}
if(!"2".equals(schBasePointList.get(0).getPoint_status())){
if(!"2".equals(schBasePointList.get(0).getPoint_status())
&& !whereJson.containsKey("back_material_flag")){
throw new BadRequestException("点位状态不为空载具,请核对!");
}
@@ -663,6 +667,7 @@ public class PdaIosInServiceImpl implements PdaIosInService {
params.put("qty", whereJson.getString("qty"));
params.put("pcsn", whereJson.getString("pcsn"));
params.put("stragegy_type", whereJson.getString("stragegy_type"));
params.put("is_empty_vehicle", true);
Structattr attrDao = iRawAssistIStorService.getStructattr(params);
//确定起点
SchBasePoint schBasePoint = iSchBasePointService.getOne(new LambdaQueryWrapper<SchBasePoint>().eq(SchBasePoint::getPoint_code, whereJson.getString("site_code")));

View File

@@ -158,4 +158,13 @@ public class OutBillController {
dto.setIsManual(true);
return new ResponseEntity<>(mesToWmsService.callMaterial(dto), HttpStatus.OK);
}
@PostMapping("/BackMaterial")
@Log("人工退料")
public ResponseEntity<Object> backMaterial(@RequestBody @Validated MesManualBackMaterialRequestDto manualDto) {
MesBackMaterialRequestDto dto = new MesBackMaterialRequestDto();
BeanUtils.copyProperties(manualDto, dto);
dto.setIsManual(true);
return new ResponseEntity<>(mesToWmsService.backMaterial(dto), HttpStatus.OK);
}
}

View File

@@ -589,6 +589,7 @@ public class InBillServiceImpl extends ServiceImpl<IOStorInvMapper, IOStorInv> i
.qty(new BigDecimal(param.getString("qty")))
.pcsn(param.getString("pcsn"))
.stragegyType(param.getString("stragegy_type"))
.is_empty_vehicle(param.getBoolean("is_empty_vehicle"))
.build());
if (CollectionUtils.isEmpty(structattrs)) {
throw new BadRequestException("无可用货位");

View File

@@ -177,7 +177,7 @@ public class UpdateIvtUtils {
.eq(GroupPlate::getPcsn, where.getString("pcsn"))
);
if (ObjectUtil.isEmpty(extDao)) {
throw new BadRequestException("当前载具【" + extDao.getStoragevehicle_code() + "】不存在相关物料批次库存,请检查数据!");
throw new BadRequestException("当前载具【" + where.getString("storagevehicle_code") + "】不存在相关物料批次库存,请检查数据!");
}
// 减可用数
double canuse_qty = NumberUtil.sub(extDao.getQty(), where.getDoubleValue("change_qty")).doubleValue();