|
|
|
@ -22,7 +22,6 @@ import com.glxp.api.admin.service.inout.*;
|
|
|
|
|
import com.glxp.api.admin.service.inventory.*;
|
|
|
|
|
import com.glxp.api.admin.util.*;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
@ -66,16 +65,9 @@ public class InvProductsTrService {
|
|
|
|
|
@Resource
|
|
|
|
|
private BasicUnitMaintainService basicUnitMaintainService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
@Lazy
|
|
|
|
|
private IoTransInoutService ioTransInoutService;
|
|
|
|
|
@Resource
|
|
|
|
|
CompanyService companyService;
|
|
|
|
|
@Resource
|
|
|
|
|
SystemParamConfigService systemParamConfigService;
|
|
|
|
|
@Resource
|
|
|
|
|
IOOrderStatusService ioOrderStatusService;
|
|
|
|
|
@Resource
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
@ -103,7 +95,7 @@ public class InvProductsTrService {
|
|
|
|
|
if (bussinessTypeEntity.isPreIn()) {
|
|
|
|
|
InvProductEntity invPreProductEntity =
|
|
|
|
|
invPreInProductService.selectByUuid(erpOrderEntity.getGoodsid(), erpOrderEntity.getBatchNo(), warehouseEntity.getSupId()
|
|
|
|
|
, warehouseEntity.getInvStorageCode(), warehouseEntity.getInvWarehouseCode());
|
|
|
|
|
, null, null);
|
|
|
|
|
if (invPreProductEntity == null) {
|
|
|
|
|
invPreProductEntity = buildInvProduct(erpOrderEntity.getGoodsid(), erpOrderEntity, orderEntity, warehouseEntity);
|
|
|
|
|
invPreInProductService.insertInvProduct(invPreProductEntity);
|
|
|
|
@ -152,6 +144,17 @@ public class InvProductsTrService {
|
|
|
|
|
invProductService.updateInvProduct(invProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (orderEntity.isPreCheck()) {
|
|
|
|
|
int actCount = getActCount(warehouseEntity);
|
|
|
|
|
int count = actCount * warehouseEntity.getCount();
|
|
|
|
|
InvProductEntity preInvEntity = invPreInProductService.selectByUuid(erpOrderEntity.getGoodsid(), erpOrderEntity.getBatchNo(),
|
|
|
|
|
warehouseEntity.getSupId(), null, null);
|
|
|
|
|
if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
preInvEntity.setOutCount(preInvEntity.getOutCount() + count);
|
|
|
|
|
}
|
|
|
|
|
invPreInProductService.updateInvProduct(preInvEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -170,10 +173,15 @@ public class InvProductsTrService {
|
|
|
|
|
if (relId != null) {
|
|
|
|
|
List<InvProductDetailEntity> invProductDetailEntities;
|
|
|
|
|
if (bussinessTypeEntity.isAdvanceType()) {//预入库,则转存预入库
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 1, true);
|
|
|
|
|
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 1);
|
|
|
|
|
} else if (bussinessTypeEntity.isPreIn()) {
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 3);
|
|
|
|
|
} else {
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 2, false);
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 2);
|
|
|
|
|
|
|
|
|
|
if (orderEntity.isPreCheck()) {
|
|
|
|
|
insetInv(bussinessTypeEntity, invProductDetailEntities);//2.插入当前库存
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) {
|
|
|
|
|
mInvProductDetailEntities.addAll(invProductDetailEntities);
|
|
|
|
@ -189,7 +197,6 @@ public class InvProductsTrService {
|
|
|
|
|
if (orderEntity.isOutChangeEnable()) {//是否缺量补单
|
|
|
|
|
//普通出库
|
|
|
|
|
if (ConstantType.TYPE_OUT.equals(bussinessTypeEntity.getMainAction()) && !bussinessTypeEntity.isAdvanceType()) {
|
|
|
|
|
//补采购入库或寄售转入单
|
|
|
|
|
addUseOutOrder(orderEntity, mInvProductDetailEntities, bussinessChangeTypeEntitys);
|
|
|
|
|
} else if (ConstantType.TYPE_PUT.equals(bussinessTypeEntity.getMainAction()) && !bussinessTypeEntity.isAdvanceType())
|
|
|
|
|
//普通入库补单
|
|
|
|
@ -197,14 +204,12 @@ public class InvProductsTrService {
|
|
|
|
|
BussinessChangeTypeEntity bussinessChangeTypeEntity = bussinessChangeTypeEntitys.get(0);
|
|
|
|
|
List<WarehouseEntity> datas = addPutOrder(orderEntity, mInvProductDetailEntities);
|
|
|
|
|
List<WarehouseEntity> temps = filterMapCodes(datas);
|
|
|
|
|
// insetInv(bussinessTypeEntity.isAdvanceType(), mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
|
buildPreOutOrder(bussinessChangeTypeEntity, temps, orderEntity); //3.生成流转单据
|
|
|
|
|
} else if (ConstantType.TYPE_OUT.equals(bussinessTypeEntity.getMainAction()) && bussinessTypeEntity.isAdvanceType()) {
|
|
|
|
|
//寄售出库补单
|
|
|
|
|
BussinessChangeTypeEntity bussinessChangeTypeEntity = bussinessChangeTypeEntitys.get(0);
|
|
|
|
|
List<WarehouseEntity> datas = addPreOutOrder(orderEntity, mInvProductDetailEntities);
|
|
|
|
|
List<WarehouseEntity> temps = filterMapCodes(datas);
|
|
|
|
|
// insetInv(bussinessTypeEntity.isAdvanceType(), mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
|
buildPreInOrder(bussinessChangeTypeEntity, temps, orderEntity); //3.生成流转单据
|
|
|
|
|
} else {
|
|
|
|
|
insetInv(bussinessTypeEntity, mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
@ -220,7 +225,7 @@ public class InvProductsTrService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//普通出库补单-- //补采购入库或寄售转入单
|
|
|
|
|
//普通出库补单-- //补采购入库,调拨入库,寄售转入
|
|
|
|
|
public void addUseOutOrder(OrderEntity orderEntity, List<InvProductDetailEntity> invProductDetailEntities, List<BussinessChangeTypeEntity> bussinessChangeTypeEntities) {
|
|
|
|
|
|
|
|
|
|
BussinessChangeTypeEntity advChangeTypeEntity = null;
|
|
|
|
@ -268,6 +273,7 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
for (WarehouseEntity warehouseEntity : warehouseEntities) {
|
|
|
|
|
/**
|
|
|
|
@ -278,13 +284,10 @@ public class InvProductsTrService {
|
|
|
|
|
* {可能需要补录的入库单据有一种:《调拨入库》}
|
|
|
|
|
*/
|
|
|
|
|
InvWarehouseEntity locWarehouseEntity = invWarehouseService.selectByCode(warehouseEntity.getLocStorageCode());
|
|
|
|
|
|
|
|
|
|
if (locWarehouseEntity.getLevel() == 1 && isAdavnce(warehouseEntity)) {//补寄售转入
|
|
|
|
|
|
|
|
|
|
//获取当前条码实际数量
|
|
|
|
|
int actCount = getActCount(warehouseEntity);
|
|
|
|
|
int count = 0;
|
|
|
|
|
UdiInfoEntity udiInfoEntity = getMinDi(warehouseEntity);
|
|
|
|
|
String code = warehouseEntity.getCode();
|
|
|
|
|
count = actCount * warehouseEntity.getCount();
|
|
|
|
|
/**
|
|
|
|
@ -319,7 +322,6 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else { //结余数量《=0直接补
|
|
|
|
|
// warehouseEntity.setCount(count);
|
|
|
|
|
preiInList.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = filterInvByCode(invProductDetailEntities, warehouseEntity.getCode());
|
|
|
|
@ -328,18 +330,8 @@ public class InvProductsTrService {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
int actCount = getActCount(warehouseEntity);
|
|
|
|
|
UdiInfoEntity udiInfoEntity = getMinDi(warehouseEntity);
|
|
|
|
|
String code = warehouseEntity.getCode();
|
|
|
|
|
int count = actCount * warehouseEntity.getCount();
|
|
|
|
|
// if (udiInfoEntity.getDiType() == ConstantStatus.DITYPE_PACK || udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY
|
|
|
|
|
// || (udiInfoEntity.getSjcpbm() != null && !"".equals(udiInfoEntity.getSjcpbm()))) {
|
|
|
|
|
// warehouseEntity.setNameCode(udiInfoEntity.getNameCode());
|
|
|
|
|
// code = FilterUdiUtils.transGlxpNoSerStr(warehouseEntity);
|
|
|
|
|
// count = actCount * warehouseEntity.getCount();
|
|
|
|
|
// } else {
|
|
|
|
|
// count = warehouseEntity.getCount();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
int invCount = 0;
|
|
|
|
|
if (locWarehouseEntity.getLevel() > 1) {//补调拨入库
|
|
|
|
|
/**
|
|
|
|
@ -350,10 +342,6 @@ public class InvProductsTrService {
|
|
|
|
|
warehouseEntity.setFromCorpId(pInWarehouseEntity.getCode());
|
|
|
|
|
|
|
|
|
|
invCount = getCountByOrder(null, warehouseEntity);
|
|
|
|
|
// invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId(), locWarehouseEntity.getPcode());
|
|
|
|
|
// if (invCount <= 0) {
|
|
|
|
|
// invCount = getCountByOrder(null, code, warehouseEntity.getSupId(), locWarehouseEntity.getPcode());
|
|
|
|
|
// }
|
|
|
|
|
norChangeTypeEntity = innorChangeTypeEntity;
|
|
|
|
|
} else { //补供应商入库
|
|
|
|
|
/**
|
|
|
|
@ -364,11 +352,6 @@ public class InvProductsTrService {
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(warehouseEntity.getSupId());
|
|
|
|
|
warehouseEntity.setFromCorp(basicUnitMaintainEntity.getName());
|
|
|
|
|
invCount = getCountByOrder(null, warehouseEntity);
|
|
|
|
|
|
|
|
|
|
// invCount = getCountByOrder(null, warehouseEntity.getCode(), warehouseEntity.getSupId(), null);
|
|
|
|
|
// if (invCount <= 0) {
|
|
|
|
|
// invCount = getCountByOrder(null, code, warehouseEntity.getSupId(), null);
|
|
|
|
|
// }
|
|
|
|
|
norChangeTypeEntity = outChangeTypeEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -384,19 +367,8 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else { //结余数量《=0直接补
|
|
|
|
|
// warehouseEntity.setCount(count);
|
|
|
|
|
inList.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
// if (invCount > 0) {
|
|
|
|
|
// if (count > invCount) {
|
|
|
|
|
// int lea = count - invCount;
|
|
|
|
|
// warehouseEntity.setCount(lea / getActCount(warehouseEntity));
|
|
|
|
|
// inList.add(warehouseEntity);
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// warehouseEntity.setCount(count);
|
|
|
|
|
// inList.add(warehouseEntity);
|
|
|
|
|
// }
|
|
|
|
|
InvProductDetailEntity invProductDetailEntity = filterInvByCode(invProductDetailEntities, warehouseEntity.getCode());
|
|
|
|
|
insetInvSingle(false, invProductDetailEntity);
|
|
|
|
|
warehouseEntity.setCode(code);
|
|
|
|
@ -512,14 +484,12 @@ public class InvProductsTrService {
|
|
|
|
|
} else {
|
|
|
|
|
outOrder.setStatus(ConstantStatus.ORDER_STATUS_ADDITIONAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outOrder.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
outOrder.setErpFk(null);
|
|
|
|
|
outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID);
|
|
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getAction());
|
|
|
|
|
String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean("MS" + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderId);
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderNo);
|
|
|
|
|
outOrder.setCorpOrderId(CustomUtil.getId() + "x");
|
|
|
|
|
outOrder.setFromCorp(invWarehouseEntity.getName());
|
|
|
|
|
outOrder.setFromCorpId(invWarehouseEntity.getCode());
|
|
|
|
@ -537,7 +507,6 @@ public class InvProductsTrService {
|
|
|
|
|
warehouseEntity.setMainAction(ConstantType.TYPE_OUT);
|
|
|
|
|
}
|
|
|
|
|
codesTempService.insertCodesTemp(preOutList);
|
|
|
|
|
// ioTransInoutService.transInout(outOrder.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//生成寄售入库单据
|
|
|
|
@ -565,6 +534,9 @@ public class InvProductsTrService {
|
|
|
|
|
unkonwCorpList.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
|
|
|
|
|
//有供应商生成采购入库单据
|
|
|
|
|
for (String corpName : filterSupMaps.keySet()) {
|
|
|
|
|
List<WarehouseEntity> temps;
|
|
|
|
@ -585,9 +557,8 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
outOrder.setErpFk(null);
|
|
|
|
|
outOrder.setFromType(ConstantStatus.FROM_CHANGE);
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(outOrder.getAction());
|
|
|
|
|
String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean("MS" + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderId);
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderNo);
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(corpName);
|
|
|
|
|
outOrder.setFromCorp(basicUnitMaintainEntity.getName());
|
|
|
|
|
outOrder.setFromCorpId(corpName);
|
|
|
|
@ -611,10 +582,7 @@ public class InvProductsTrService {
|
|
|
|
|
warehouseEntity.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
}
|
|
|
|
|
codesTempService.insertCodesTemp(temps);
|
|
|
|
|
// ioTransInoutService.transInout(outOrder.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//无供应商,一个条码生成一个错误单据,到时候利用单据合并生成同一个单据
|
|
|
|
|
for (WarehouseEntity warehouseEntity : unkonwCorpList) {
|
|
|
|
|
OrderEntity outOrder = new OrderEntity();
|
|
|
|
@ -632,10 +600,8 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
outOrder.setRemark("未选择供应商");
|
|
|
|
|
outOrder.setErpFk(null);
|
|
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(outOrder.getAction());
|
|
|
|
|
String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean("MS" + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderId);
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderNo);
|
|
|
|
|
outOrder.setFromCorp(null);
|
|
|
|
|
outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID);
|
|
|
|
|
outOrder.setFromCorpId(null);
|
|
|
|
@ -684,7 +650,7 @@ public class InvProductsTrService {
|
|
|
|
|
} else
|
|
|
|
|
unkonwCorpList.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
//根据往来单位生成入库单
|
|
|
|
|
for (String corpName : filterSupMaps.keySet()) {
|
|
|
|
|
List<WarehouseEntity> temps;
|
|
|
|
@ -699,11 +665,8 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID);
|
|
|
|
|
outOrder.setErpFk(null);
|
|
|
|
|
outOrder.setFromType(ConstantStatus.FROM_CHANGE);
|
|
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(outOrder.getAction());
|
|
|
|
|
String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean("MS" + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderId);
|
|
|
|
|
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderNo);
|
|
|
|
|
outOrder.setFromCorpId(corpName);
|
|
|
|
|
outOrder.setFromCorp(temps.get(0).getFromCorp());
|
|
|
|
|
outOrder.setCorpOrderId(CustomUtil.getId() + "x");
|
|
|
|
@ -761,7 +724,7 @@ public class InvProductsTrService {
|
|
|
|
|
} else
|
|
|
|
|
unkonwCorpList.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
//有供应商生成采购入库单据
|
|
|
|
|
for (String corpName : filterSupMaps.keySet()) {
|
|
|
|
|
List<WarehouseEntity> temps;
|
|
|
|
@ -784,12 +747,8 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setLocStorageCode(orderEntity.getLocStorageCode());
|
|
|
|
|
outOrder.setErpFk(null);
|
|
|
|
|
outOrder.setFromType(ConstantStatus.FROM_CHANGE);
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(outOrder.getAction());
|
|
|
|
|
String orderId = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean("MS" + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderId);
|
|
|
|
|
// BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(corpName);
|
|
|
|
|
// outOrder.setFromCorp(basicUnitMaintainEntity.getName());
|
|
|
|
|
// outOrder.setFromCorpId(corpName);
|
|
|
|
|
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
|
|
|
|
|
outOrder.setId(orderNo);
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("additional_auto_submit");
|
|
|
|
|
if ("1".equals(systemParamConfigEntity.getParamValue())) {
|
|
|
|
|
outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
|
|
|
@ -815,7 +774,6 @@ public class InvProductsTrService {
|
|
|
|
|
warehouseEntity.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
}
|
|
|
|
|
codesTempService.insertCodesTemp(temps);
|
|
|
|
|
// ioTransInoutService.transInout(outOrder.getId());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -851,7 +809,7 @@ public class InvProductsTrService {
|
|
|
|
|
|
|
|
|
|
//生成库存条码
|
|
|
|
|
private List<InvProductDetailEntity> buildInvProductDetail(String orderId, ErpOrderEntity erpOrderEntity,
|
|
|
|
|
OrderEntity orderEntity, Integer purchaseType, boolean isPre) {
|
|
|
|
|
OrderEntity orderEntity, Integer purchaseType) {
|
|
|
|
|
|
|
|
|
|
List<InvProductDetailEntity> mInvProductDetailEntities = new ArrayList<>();
|
|
|
|
|
List<WarehouseEntity> warehouseEntities = codesService.findByReceiptId(orderId);
|
|
|
|
@ -864,7 +822,6 @@ public class InvProductsTrService {
|
|
|
|
|
invProductDetailEntity.setOriginCode(warehouseEntity.getCode());
|
|
|
|
|
invProductDetailEntity.setProductIdFk(erpOrderEntity.getGoodsid() + "");
|
|
|
|
|
int actCount = getActCount(warehouseEntity);
|
|
|
|
|
|
|
|
|
|
String code = warehouseEntity.getCode();
|
|
|
|
|
UdiInfoEntity udiInfoEntity = getMinDi(warehouseEntity);
|
|
|
|
|
if (udiInfoEntity.getDiType() == ConstantStatus.DITYPE_PACK || udiInfoEntity.getDiType() == ConstantStatus.DITYPE_SYDY
|
|
|
|
@ -1029,6 +986,30 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据条码获取预入库结余数量
|
|
|
|
|
public int getPreCountByOrder(String mainAction, String code, String supId) {
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setCode(code);
|
|
|
|
|
filterInvProductDetailRequest.setSupId(supId);
|
|
|
|
|
if (mainAction != null)
|
|
|
|
|
filterInvProductDetailRequest.setMainAction(mainAction);
|
|
|
|
|
List<InvProductDetailJoinResponse> detailJoinResponseList
|
|
|
|
|
= invPreProductDetailService.filterJoinInvProduct(filterInvProductDetailRequest);
|
|
|
|
|
int invCount = 0;
|
|
|
|
|
if (detailJoinResponseList != null && detailJoinResponseList.size() > 0) {
|
|
|
|
|
for (InvProductDetailJoinResponse invProductDetailJoinResponse : detailJoinResponseList) {
|
|
|
|
|
if (invProductDetailJoinResponse.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invCount = invCount - invProductDetailJoinResponse.getCount();
|
|
|
|
|
} else {
|
|
|
|
|
invCount = invCount + invProductDetailJoinResponse.getCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return invCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int getPreCountByOrder(String mainAction, String relId, String batchNo, String supId, String invWarehouseCode) {
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setSupId(supId);
|
|
|
|
@ -1053,6 +1034,53 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//根据条码获取库存结余数量
|
|
|
|
|
public int getCountByProduct(String mainAction, String productId, String batchNo, String supId) {
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setProductIdFk(productId);
|
|
|
|
|
filterInvProductDetailRequest.setBatchNo(batchNo);
|
|
|
|
|
filterInvProductDetailRequest.setSupId(supId);
|
|
|
|
|
if (mainAction != null)
|
|
|
|
|
filterInvProductDetailRequest.setMainAction(mainAction);
|
|
|
|
|
List<InvProductDetailJoinResponse> detailJoinResponseList
|
|
|
|
|
= invProductDetailService.filterJoinInvProduct(filterInvProductDetailRequest);
|
|
|
|
|
int invCount = 0;
|
|
|
|
|
if (detailJoinResponseList != null && detailJoinResponseList.size() > 0) {
|
|
|
|
|
for (InvProductDetailJoinResponse invProductDetailJoinResponse : detailJoinResponseList) {
|
|
|
|
|
if (invProductDetailJoinResponse.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invCount = invCount - invProductDetailJoinResponse.getCount();
|
|
|
|
|
} else {
|
|
|
|
|
invCount = invCount + invProductDetailJoinResponse.getCount();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return invCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//根据条码获取预入库结余数量
|
|
|
|
|
public int getPreCountByProduct(String mainAction, String productId, String batchNo, String supId) {
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
filterInvProductDetailRequest.setProductIdFk(productId);
|
|
|
|
|
filterInvProductDetailRequest.setBatchNo(batchNo);
|
|
|
|
|
filterInvProductDetailRequest.setSupId(supId);
|
|
|
|
|
if (mainAction != null)
|
|
|
|
|
filterInvProductDetailRequest.setMainAction(mainAction);
|
|
|
|
|
List<InvProductDetailJoinResponse> detailJoinResponseList
|
|
|
|
|
= invPreProductDetailService.filterJoinInvProduct(filterInvProductDetailRequest);
|
|
|
|
|
int invCount = 0;
|
|
|
|
|
if (detailJoinResponseList != null && detailJoinResponseList.size() > 0) {
|
|
|
|
|
for (InvProductDetailJoinResponse invProductDetailJoinResponse : detailJoinResponseList) {
|
|
|
|
|
if (invProductDetailJoinResponse.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
invCount = invCount - invProductDetailJoinResponse.getCount();
|
|
|
|
|
} else {
|
|
|
|
|
invCount = invCount + invProductDetailJoinResponse.getCount();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return invCount;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//合并条码
|
|
|
|
|
public List<WarehouseEntity> filterMapCodes(List<WarehouseEntity> warehouseEntityList) {
|
|
|
|
|
Map<String, WarehouseEntity> filterMap = new HashMap<>();
|
|
|
|
@ -1077,6 +1105,7 @@ public class InvProductsTrService {
|
|
|
|
|
public boolean isAdavnce(WarehouseEntity warehouseEntity) {
|
|
|
|
|
//获取普通出入库结余数量
|
|
|
|
|
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
|
|
|
|
|
// filterInvProductDetailRequest.setCode(warehouseEntity.getCode());
|
|
|
|
|
filterInvProductDetailRequest.setProductIdFk(warehouseEntity.getRelId());
|
|
|
|
|
filterInvProductDetailRequest.setSupId(warehouseEntity.getSupId());
|
|
|
|
|
List<InvProductDetailJoinResponse> detailJoinResponseList
|
|
|
|
|