add:平库入库库存合并
This commit is contained in:
@@ -39,6 +39,9 @@ import org.nl.wms.warehouse_manage.inAndOut.service.dao.IOStorInvDtl;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDisMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dao.mapper.IOStorInvDtlMapper;
|
||||
import org.nl.wms.warehouse_manage.inAndOut.service.dto.IOStorInvDisDto;
|
||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.enums.InventoryChangeType;
|
||||
import org.nl.wms.warehouse_manage.inventory.core.param.impl.AddInvParam;
|
||||
import org.nl.wms.warehouse_manage.service.IMdPbGroupplateService;
|
||||
import org.nl.wms.warehouse_manage.service.dao.GroupPlate;
|
||||
import org.nl.wms.warehouse_manage.stockReturn.service.IPmStockReturnService;
|
||||
@@ -65,7 +68,11 @@ public class InboundPdaServiceImpl implements InboundPdaService {
|
||||
private ApplicationEventPublisher eventPublisher;
|
||||
@Autowired
|
||||
private PurchaseService purchaseService;
|
||||
|
||||
/**
|
||||
* 库存变更服务
|
||||
*/
|
||||
@Autowired
|
||||
private IStInventoryService iStInventoryService;
|
||||
/**
|
||||
* 组盘记录服务
|
||||
*/
|
||||
@@ -243,7 +250,35 @@ public class InboundPdaServiceImpl implements InboundPdaService {
|
||||
log.info("平库入库:找到虚拟库位{}",JSON.toJSONString(struct));
|
||||
String storagevehicleCode = struct.getStoragevehicle_code();//载具编码
|
||||
List<PurchaseListenerParams.DetailItem> items = new ArrayList<>();
|
||||
boolean flag = false;
|
||||
for (UsualInboundDto.UsualInboundDtlDto item : usualInboundDto.getDetailList()) {
|
||||
//判断当前物料是否在库内
|
||||
List<GroupPlate> inStockGps = iMdPbGroupplateService.list(new LambdaQueryWrapper<GroupPlate>()
|
||||
.eq(GroupPlate::getMaterial_code, item.getSku_code())
|
||||
.eq(GroupPlate::getStatus, GROUP_PLATE_STATUS.code("入库"))
|
||||
.likeRight(GroupPlate::getStoragevehicle_code, "VTP"));
|
||||
if (!inStockGps.isEmpty()){
|
||||
GroupPlate groupPlate = inStockGps.get(0);
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStoragevehicle_code, groupPlate.getStoragevehicle_code())
|
||||
.eq(Structattr::getSect_code, usualInboundDto.getSect_code())
|
||||
.last("limit 1"));
|
||||
if (Objects.equals(structattr.getSect_code(), usualInboundDto.getSect_code())){
|
||||
//已在库,增加库存
|
||||
flag = true;
|
||||
List<AddInvParam> addInvParams = new ArrayList<>();
|
||||
AddInvParam addParam = new AddInvParam();
|
||||
addParam.setPcsn(groupPlate.getPcsn());
|
||||
addParam.setMaterialCode(groupPlate.getMaterial_code());
|
||||
addParam.setStoragevehicleCode(groupPlate.getStoragevehicle_code());
|
||||
addParam.setUnitName(groupPlate.getQty_unit_name());
|
||||
addParam.setUnitId(groupPlate.getQty_unit_id());
|
||||
addParam.setQty(item.getQty());
|
||||
addInvParams.add(addParam);
|
||||
iStInventoryService.changeInventory(InventoryChangeType.ADD_INV, addInvParams);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
MdMeMaterialbase materDao = iMdMeMaterialbaseService.getByCode(item.getSku_code());
|
||||
MdPbMeasureunit unitDao = iMdPbMeasureunitService.getById(materDao.getQty_unit_id());
|
||||
//组盘
|
||||
@@ -268,6 +303,7 @@ public class InboundPdaServiceImpl implements InboundPdaService {
|
||||
detailItem.setQty(item.getQty());
|
||||
items.add(detailItem);
|
||||
}
|
||||
if (flag) return;//已存在库存则不用走组盘入库
|
||||
GroupPlateInboundDto groupPlateInboundDto = new GroupPlateInboundDto();
|
||||
groupPlateInboundDto.setSect_code(sectDao.getSect_code());
|
||||
groupPlateInboundDto.setVehicle_code(storagevehicleCode);
|
||||
|
||||
@@ -61,6 +61,9 @@ public class StInventoryServiceImpl implements IStInventoryService {
|
||||
if (!StringUtils.isEmpty(invParam.getPcsn())){
|
||||
query.eq(GroupPlate::getPcsn,invParam.getPcsn());
|
||||
}
|
||||
if (invParam.getStoragevehicleCode().startsWith("VTP")){
|
||||
query.last("limit 1");
|
||||
}
|
||||
GroupPlate groupPlate = iMdPbGroupplateService.getOne(query);
|
||||
if (groupPlate == null){
|
||||
GroupPlate groupDao = GroupPlate.builder()
|
||||
|
||||
Reference in New Issue
Block a user