opt:优化收货组盘、组盘入库逻辑,修改收货组盘处理批次号默认值为1

This commit is contained in:
zhaoyf
2026-06-26 10:44:43 +08:00
parent cce732bc09
commit c9217acfa4

View File

@@ -14,19 +14,19 @@ import org.nl.common.utils.MapOf;
import org.nl.common.utils.SecurityUtils;
import org.nl.wms.basedata_manage.service.*;
import org.nl.wms.basedata_manage.service.dao.*;
import org.nl.wms.pda_manage.ios_manage.purchase.service.InboundPdaService;
import org.nl.wms.pda_manage.ios_manage.purchase.service.dto.GroupPlateInboundDto;
import org.nl.wms.pda_manage.ios_manage.purchase.service.dto.ManualInboundDto;
import org.nl.wms.pda_manage.ios_manage.purchase.service.dto.PdaGroupPlateDto;
import org.nl.wms.pda_manage.ios_manage.purchase.service.dto.UsualInboundDto;
import org.nl.wms.pda_manage.ios_manage.purchase.service.vo.PurchaseMatInfoVo;
import org.nl.wms.pm_manage.SourceBillTypeEnum;
import org.nl.wms.pm_manage.listener.PmManageEvent;
import org.nl.wms.pm_manage.purchase.ListenerHandler.PurchaseListenerParams;
import org.nl.wms.pm_manage.purchase.service.PurchaseService;
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
import org.nl.wms.pda_manage.ios_manage.purchase.service.InboundPdaService;
import org.nl.wms.pda_manage.ios_manage.purchase.service.vo.PurchaseMatInfoVo;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
import org.nl.wms.pda_manage.ios_manage.purchase.service.dto.PdaGroupPlateDto;
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
import org.nl.wms.warehouse_manage.enums.IOSEnum;
import org.nl.wms.warehouse_manage.inAndOut.service.IInBillService;
import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDis;
@@ -145,19 +145,6 @@ public class InboundPdaServiceImpl implements InboundPdaService {
public JSONObject submitGroupPlate(PdaGroupPlateDto dto) {
log.info("PDA提交组盘, vehicleCode: {}", dto.getVehicle_code());
List<PdaGroupPlateDto.GroupPlateDtlDto> detailList = dto.getDetailList();
detailList.forEach((item)->{
List<PurchaseMatInfoVo> purchaseMatInfoVos = purchaseService.selectPdaInMat(MapOf.of("orderNo", item.getOrder_no(),
"itemNo", item.getItem_no()));
if (purchaseMatInfoVos.isEmpty()){
throw new BadRequestException("组盘失败:单据:"+item.getOrder_no()+"物料:"+item.getSku_code()+"不存在");
}
PurchaseMatInfoVo purchaseMatInfoVo = purchaseMatInfoVos.get(0);
if (item.getQty().add(purchaseMatInfoVo.getInstock_qty()).compareTo(purchaseMatInfoVo.getQty()) > 0){
throw new BadRequestException("组盘失败:"+item.getSku_code() + "组盘数量超过单据数量");
}
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(item.getSku_code());
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getQty_unit_id());
//判断该载具是否存在组盘信息
long statusCount = iMdPbGroupplateService.count(
new LambdaQueryWrapper<GroupPlate>()
@@ -175,11 +162,26 @@ public class InboundPdaServiceImpl implements InboundPdaService {
if (count > 0) {
throw new BadRequestException("组盘失败:载具编码:" + dto.getVehicle_code() + "已存在库内,请对数据进行核实!");
}
List<PdaGroupPlateDto.GroupPlateDtlDto> detailList = dto.getDetailList();
detailList.forEach((item)->{
List<PurchaseMatInfoVo> purchaseMatInfoVos = purchaseService.selectPdaInMat(MapOf.of("orderNo", item.getOrder_no(),
"itemNo", item.getItem_no()));
if (purchaseMatInfoVos.isEmpty()){
throw new BadRequestException("组盘失败:单据:"+item.getOrder_no()+"物料:"+item.getSku_code()+"不存在");
}
PurchaseMatInfoVo purchaseMatInfoVo = purchaseMatInfoVos.get(0);
if (item.getQty().add(purchaseMatInfoVo.getInstock_qty()).compareTo(purchaseMatInfoVo.getQty()) > 0){
throw new BadRequestException("组盘失败:"+item.getSku_code() + "组盘数量超过单据数量");
}
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(item.getSku_code());
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getQty_unit_id());
GroupPlate groupDao = GroupPlate.builder()
.group_id(IdUtil.getStringId())
.material_code(item.getSku_code())
.storagevehicle_code(dto.getVehicle_code())
.pcsn(item.getBatch_no())
.pcsn(Optional.ofNullable(item.getBatch_no()).filter(s -> !s.isEmpty()).orElse("1"))
.qty_unit_id(unitDao.getMeasure_unit_id())
.qty_unit_name(unitDao.getUnit_name())
.qty(item.getQty())
@@ -327,7 +329,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
jsonMst.put("biz_date", DateUtil.now());
// 组织明细数据
ArrayList<HashMap> tableData = new ArrayList<>();
HashMap<String, String> dtl = new HashMap<>();
HashMap<String, Object> dtl = new HashMap<>();
// GroupPlate plateDao = plateDaoList.get(0);
for (GroupPlate plateDao : plateDaoList) {
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(plateDao.getMaterial_code());
@@ -338,8 +340,8 @@ public class InboundPdaServiceImpl implements InboundPdaService {
dtl.put("pcsn", plateDao.getPcsn());
dtl.put("qty_unit_id", plateDao.getQty_unit_id());
dtl.put("qty_unit_name", plateDao.getQty_unit_name());
dtl.put("qty", String.valueOf(total_qty));
dtl.put("plan_qty", String.valueOf(total_qty));
dtl.put("qty", plateDao.getQty());
dtl.put("plan_qty", plateDao.getQty());
dtl.put("ext_code", plateDao.getExt_code());
dtl.put("ext_type", plateDao.getExt_type());
dtl.put("callback_strategy", "dealPurchaseRecBillCallback");
@@ -431,7 +433,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
jsonMst.put("biz_date", DateUtil.now());
// 组织明细数据
ArrayList<HashMap> tableData = new ArrayList<>();
HashMap<String, String> dtl = new HashMap<>();
HashMap<String, Object> dtl = new HashMap<>();
// GroupPlate plateDao = plateDaoList.get(0);
for (GroupPlate plateDao : plateDaoList) {
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(plateDao.getMaterial_code());
@@ -442,8 +444,8 @@ public class InboundPdaServiceImpl implements InboundPdaService {
dtl.put("pcsn", plateDao.getPcsn());
dtl.put("qty_unit_id", plateDao.getQty_unit_id());
dtl.put("qty_unit_name", plateDao.getQty_unit_name());
dtl.put("qty", String.valueOf(total_qty));
dtl.put("plan_qty", String.valueOf(total_qty));
dtl.put("qty", plateDao.getQty());
dtl.put("plan_qty", plateDao.getQty());
dtl.put("ext_code", plateDao.getExt_code());
dtl.put("ext_type", plateDao.getExt_type());
dtl.put("callback_strategy", "dealPurchaseRecBillCallback");