add:拣选出库确认,余料回库

This commit is contained in:
zhaoyf
2026-10-22 19:20:48 +08:00
parent 80b81830ed
commit 9cbacd3e3b
7 changed files with 154 additions and 34 deletions

View File

@@ -11,7 +11,7 @@ import org.nl.wms.basedata_manage.service.dao.MdMeMaterialbase;
import org.nl.wms.pda_manage.ios_manage.service.PdaIosInService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -121,4 +121,10 @@ public class PdaIosInController {
assertNotBlankJson(whereJson, "请求参数不能为空", "sect_code", "group_id", "vehicle_code", "material_code", "qty", "stor_id");
return ResponseData.build(pdaIosInService.confirmReturnMaterial(whereJson),HttpStatus.OK);
}
@PostMapping("/backMaterial")
@Log("余料回库")
public ResponseEntity<Object> backMaterial(@RequestBody JSONObject whereJson) {
assertNotBlankJson(whereJson, "请求参数不能为空", "vehicle_code", "struct_code");
return ResponseData.build(pdaIosInService.backMaterial(whereJson),HttpStatus.OK);
}
}

View File

@@ -126,4 +126,6 @@ public interface PdaIosInService {
* @return PdaResponse
*/
PdaResponse confirmReturnMaterial(JSONObject whereJson);
PdaResponse backMaterial(JSONObject whereJson);
}

View File

@@ -121,4 +121,8 @@ public interface PdaIosOutService {
void changeGroup(ChangeGroupDto changeGroupDto);
List<ContainerItemDto> getContainerItemByCode(String code);
List<OutBoundDis> selectOutDisByChoose(String vehicleCode);
void confirmChoose(List<String> invIds);
}

View File

@@ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
import static org.nl.wms.warehouse_manage.enums.IOSEnum.GROUP_PLATE_STATUS;
@@ -303,6 +304,27 @@ public class PdaIosInServiceImpl implements PdaIosInService {
return PdaResponse.requestOk();
}
@Override
public PdaResponse backMaterial(JSONObject whereJson) {
String structCode = whereJson.getString("struct_code");
String vehicleCode = whereJson.getString("vehicle_code");
List<GroupPlate> groupPlates = mdPbGroupplateMapper.selectList(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, vehicleCode)
.eq(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("出库")));
if (groupPlates.isEmpty()) new BadRequestException("回库物料不存在");
mdPbGroupplateMapper.update(null, new LambdaUpdateWrapper<GroupPlate>()
.set(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库"))
.in(GroupPlate::getGroup_id,groupPlates.stream().map(GroupPlate::getGroup_id).collect(Collectors.toList())));
if (!iStructattrService.update(new LambdaUpdateWrapper<Structattr>()
.set(Structattr::getStoragevehicle_code, vehicleCode)
.eq(Structattr::getStruct_code, structCode)
.and(w -> w.isNull(Structattr::getStoragevehicle_code)
.or().eq(Structattr::getStoragevehicle_code, ""))
)) throw new BadRequestException("库位不存在或被占用");
return PdaResponse.requestOk();
}
/**
* 不含单据入库业务

View File

@@ -804,4 +804,60 @@ public class PdaIosOutServiceImpl implements PdaIosOutService {
}
return dtos;
}
@Override
public List<OutBoundDis> selectOutDisByChoose(String vehicleCode) {
final List<IOStorInvDis> invDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
.eq(IOStorInvDis::getStoragevehicle_code, vehicleCode)
.eq(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("生成"))
.isNotNull(IOStorInvDis::getTask_id)
);
if (invDis.isEmpty()) throw new BadRequestException("未查询到该托盘待拣选确认物料");
final List<OutBoundDis> result = new ArrayList<>();
for (IOStorInvDis source : invDis) {
IOStorInv ioStorInv = ioStorInvMapper.selectById(source.getIostorinv_id());
MdMeMaterialbase materialbase = iMdMeMaterialbaseService.getByCode(source.getMaterial_code());
OutBoundDis target = new OutBoundDis();
// 字段映射(注意下划线命名转驼峰命名)
target.setBillCode(ioStorInv.getBill_code());
target.setInputTime(ioStorInv.getInput_time());
target.setIostorinvdisId(source.getIostorinvdis_id());
target.setSectName(source.getSect_name());
target.setStructCode(source.getStruct_code());
target.setPointCode(source.getPoint_code());
target.setStoragevehicleCode(source.getStoragevehicle_code());
target.setMaterialName(materialbase.getMaterial_name());
target.setMaterialCode(source.getMaterial_code());
target.setUnitName(source.getQty_unit_name());
target.setWorkStatus(source.getWork_status());
target.setPlanQty(source.getPlan_qty());
target.setHandType(source.getHand_type());
result.add(target);
}
//PdaResponse.requestParamOk(result)
return result;
}
@Override
@Transactional
public void confirmChoose(List<String> invIds) {
List<IOStorInvDis> ioStorInvDis = ioStorInvDisMapper.selectList(new LambdaQueryWrapper<IOStorInvDis>()
.in(IOStorInvDis::getIostorinvdis_id, invIds));
if (invIds.size() != ioStorInvDis.size()){
throw new BadRequestException("确认异常,系统缺少出库明细");
}
iOutBillService.disFinish(ioStorInvDis);
iStructattrService.update(new LambdaUpdateWrapper<>(Structattr.class)
.set(Structattr::getInv_id,null)
.set(Structattr::getInv_code,null)
.set(Structattr::getInv_type,null)
.set(Structattr::getStoragevehicle_code,null)
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getStoragevehicle_code, ioStorInvDis.get(0).getStoragevehicle_code()));
iMdPbGroupplateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.set(GroupPlate::getUpdate_time,DateUtil.now())
.eq(GroupPlate::getStoragevehicle_code,ioStorInvDis.get(0).getStoragevehicle_code())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
}
}

View File

@@ -67,6 +67,21 @@ public class PdaIosOutController {
return ResponseData.build(pdaIosOutService.selectSectOutDis(sectCode), HttpStatus.OK);
}
@GetMapping("/getOutBoundDtlByChoose")
@SaIgnore
@Log("获取拣选待确认物料")
public ResponseEntity<Object> getOutBoundDtlByChoose(String vehicleCode) {
return ResponseData.build(pdaIosOutService.selectOutDisByChoose(vehicleCode), HttpStatus.OK);
}
@PostMapping("/confirmChoose")
@SaIgnore
@Log("拣选确认")
public ResponseEntity<Object> confirmChoose(@RequestBody List<String> invIds) {
pdaIosOutService.confirmChoose(invIds);
return ResponseData.build();
}
@PostMapping("/assignOutDis")
@SaIgnore
@Log("平库出库明细确认")

View File

@@ -751,6 +751,18 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
.set(Structattr::getStoragevehicle_code,null)
.set(Structattr::getLock_type,IOSEnum.LOCK_TYPE.code("未锁定"))
.eq(Structattr::getStruct_code,task.getPoint_code1()));
List<GroupPlate> groupPlateList = iMdPbGroupPlateService.list(new LambdaQueryWrapper<GroupPlate>()
.eq(GroupPlate::getStoragevehicle_code, task.getVehicle_code())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
if (groupPlateList.stream().anyMatch(item -> item.getFrozen_qty().compareTo(item.getQty()) != 0)){
iMdPbGroupPlateService.update(new GroupPlate(),new LambdaUpdateWrapper<>(GroupPlate.class)
.set(GroupPlate::getStatus,IOSEnum.GROUP_PLATE_STATUS.code("出库"))
.set(GroupPlate::getUpdate_time,DateUtil.now())
.eq(GroupPlate::getStoragevehicle_code,task.getVehicle_code())
.eq(GroupPlate::getStatus, IOSEnum.GROUP_PLATE_STATUS.code("入库")));
return;
}
disFinish(disList);
}
@Override
@@ -774,41 +786,44 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
}
//库存变动:根据冻结数更新物料库存
iStInventoryService.changeInventory(InventoryChangeType.OUT_FINS, outFinsParams);
IOStorInvDis item = disList.get(0);
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdtl_id,item.getIostorinvdtl_id())
.ne(IOStorInvDis::getWork_status,IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
//如果是调拨出库直接库存变更,如果是AGV的则需要走个入库
// 明细
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(item.getIostorinvdtl_id());
if (ObjectUtil.isEmpty(ioStorInvDtl)){
throw new BadRequestException("未找到明细");
}
final IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDtl.getIostorinv_id());
//非标处理,到线边库的线边库要加库存
// 如果分配明细全部完成则更新明细表状态
if (countDis == 0){
// 更新明细表状态
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
ioStorInvDtlMapper.updateById(ioStorInvDtl);
callbackStrategyPublish.callbackStrategy(ioStorInvDtl.getCallback_strategy(),ioStorInvDtl);
// 查看明细是否全部完成
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
.eq(IOStorInvDtl::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
.ne(IOStorInvDtl::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
// IOStorInvDis item = disList.get(0);
for (IOStorInvDis item : disList) {
// 查询该明细下是否还有未完成的分配明细
int countDis = ioStorInvDisMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDis.class)
.eq(IOStorInvDis::getIostorinvdtl_id, item.getIostorinvdtl_id())
.ne(IOStorInvDis::getWork_status, IOSEnum.INBILL_DIS_STATUS.code("完成"))
);
// 如果明细全部完成则更新主表状态
if (countDtl == 0){
//更新主表状态
ioStorInvMapper.update(new IOStorInv(),new LambdaUpdateWrapper<>(IOStorInv.class)
.set(IOStorInv::getBill_status,IOSEnum.BILL_STATUS.code("完成"))
.set(IOStorInv::getConfirm_optid, SecurityUtils.getCurrentUserId())
.set(IOStorInv::getConfirm_optname, SecurityUtils.getCurrentNickName())
.set(IOStorInv::getConfirm_time, DateUtil.now())
.eq(IOStorInv::getIostorinv_id,ioStorInvDtl.getIostorinv_id())
//如果是调拨出库直接库存变更,如果是AGV的则需要走个入库
// 明细
IOStorInvDtl ioStorInvDtl = ioStorInvDtlMapper.selectById(item.getIostorinvdtl_id());
if (ObjectUtil.isEmpty(ioStorInvDtl)) {
throw new BadRequestException("未找到明细");
}
final IOStorInv ioStorInv = ioStorInvMapper.selectById(ioStorInvDtl.getIostorinv_id());
//非标处理,到线边库的线边库要加库存
// 如果分配明细全部完成则更新明细表状态
if (countDis == 0) {
// 更新明细表状态
ioStorInvDtl.setBill_status(IOSEnum.BILL_STATUS.code("完成"));
ioStorInvDtlMapper.updateById(ioStorInvDtl);
callbackStrategyPublish.callbackStrategy(ioStorInvDtl.getCallback_strategy(), ioStorInvDtl);
// 查看明细是否全部完成
int countDtl = ioStorInvDtlMapper.selectCount(new LambdaQueryWrapper<>(IOStorInvDtl.class)
.eq(IOStorInvDtl::getIostorinv_id, ioStorInvDtl.getIostorinv_id())
.ne(IOStorInvDtl::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
);
// 如果明细全部完成则更新主表状态
if (countDtl == 0) {
//更新主表状态
ioStorInvMapper.update(new IOStorInv(), new LambdaUpdateWrapper<>(IOStorInv.class)
.set(IOStorInv::getBill_status, IOSEnum.BILL_STATUS.code("完成"))
.set(IOStorInv::getConfirm_optid, SecurityUtils.getCurrentUserId())
.set(IOStorInv::getConfirm_optname, SecurityUtils.getCurrentNickName())
.set(IOStorInv::getConfirm_time, DateUtil.now())
.eq(IOStorInv::getIostorinv_id, ioStorInvDtl.getIostorinv_id())
);
}
}
}