|
|
|
@ -10,6 +10,7 @@ import com.glxp.api.admin.entity.info.SystemParamConfigEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inout.*;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.InvProductDetailEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.InvProductEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.InvSubWarehouseEntity;
|
|
|
|
|
import com.glxp.api.admin.entity.inventory.InvWarehouseEntity;
|
|
|
|
|
import com.glxp.api.admin.req.basic.FilterUdiInfoRequest;
|
|
|
|
|
import com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest;
|
|
|
|
@ -21,6 +22,7 @@ import com.glxp.api.admin.service.info.SystemParamConfigService;
|
|
|
|
|
import com.glxp.api.admin.service.inout.*;
|
|
|
|
|
import com.glxp.api.admin.service.inventory.*;
|
|
|
|
|
import com.glxp.api.admin.util.*;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -28,6 +30,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
public class InvProductsTrService {
|
|
|
|
|
|
|
|
|
@ -72,9 +75,17 @@ public class InvProductsTrService {
|
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
@Resource
|
|
|
|
|
GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
@Resource
|
|
|
|
|
InvSubWarehouseService invSubWarehouseService;
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
|
public void genInvProducts(String orderId) {
|
|
|
|
|
//导入订单状态
|
|
|
|
|
IOOrderStatusEntity ioOrderStatusEntity = new IOOrderStatusEntity();
|
|
|
|
|
ioOrderStatusEntity.setStatus(1);
|
|
|
|
|
ioOrderStatusEntity.setUpdateTime(new Date());
|
|
|
|
|
ioOrderStatusEntity.setOrderId(orderId);
|
|
|
|
|
ioOrderStatusService.insertOrderStatus(ioOrderStatusEntity);
|
|
|
|
|
|
|
|
|
|
OrderEntity orderEntity = orderService.findById(orderId);
|
|
|
|
|
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_SUCCESS &&
|
|
|
|
@ -95,31 +106,11 @@ public class InvProductsTrService {
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.isPreIn()) {
|
|
|
|
|
InvProductEntity invPreProductEntity = null;
|
|
|
|
|
// invPreInProductService.selectByUuid(erpOrderEntity.getGoodsid(), erpOrderEntity.getBatchNo(), warehouseEntity.getSupId()
|
|
|
|
|
// , warehouseEntity.getLocStorageCode(), warehouseEntity.getInvWarehouseCode());
|
|
|
|
|
if (invPreProductEntity == null) {
|
|
|
|
|
invPreProductEntity = buildInvPreInProduct(orderEntity, erpOrderEntity, warehouseEntity);
|
|
|
|
|
invPreProductEntity.setUpdateTime(new Date());
|
|
|
|
|
invPreInProductService.insertInvProduct(invPreProductEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* else {
|
|
|
|
|
* int actCount = getActCount(warehouseEntity);
|
|
|
|
|
* int count = actCount * warehouseEntity.getCount();
|
|
|
|
|
* if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
* invPreProductEntity.setOutCount(invPreProductEntity.getOutCount() + count);
|
|
|
|
|
* } else if (orderEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
|
* invPreProductEntity.setInCount(invPreProductEntity.getInCount() + count);
|
|
|
|
|
* }
|
|
|
|
|
* if (erpOrderEntity.getPrice() != null) {
|
|
|
|
|
* invPreProductEntity.setPrice(erpOrderEntity.getPrice() + "");
|
|
|
|
|
* }
|
|
|
|
|
* invPreProductEntity.setUpdateTime(new Date());
|
|
|
|
|
* invPreInProductService.updateInvProduct(invPreProductEntity);
|
|
|
|
|
* }
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
} else if (bussinessTypeEntity.isAdvanceType()) {//预入库,则转存预入库
|
|
|
|
|
InvProductEntity invPreProductEntity =
|
|
|
|
|
invPreProductService.selectByUuid(erpOrderEntity.getGoodsid(), erpOrderEntity.getBatchNo(), warehouseEntity.getSupId()
|
|
|
|
@ -166,10 +157,13 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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 (preInvEntity != null) {
|
|
|
|
|
// if (orderEntity.getMainAction().equals(ConstantType.TYPE_OUT)) {
|
|
|
|
|
// preInvEntity.setOutCount(preInvEntity.getOutCount() + count);
|
|
|
|
@ -177,9 +171,10 @@ public class InvProductsTrService {
|
|
|
|
|
// if (erpOrderEntity.getPrice() != null) {
|
|
|
|
|
// preInvEntity.setPrice(erpOrderEntity.getPrice() + "");
|
|
|
|
|
// }
|
|
|
|
|
// preInvEntity.setUpdateTime(new Date());
|
|
|
|
|
// invPreInProductService.updateInvProduct(preInvEntity);
|
|
|
|
|
// }
|
|
|
|
|
// preInvEntity.setUpdateTime(new Date());
|
|
|
|
|
// invPreInProductService.updateInvProduct(preInvEntity);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -205,12 +200,6 @@ public class InvProductsTrService {
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 3);
|
|
|
|
|
} else {
|
|
|
|
|
invProductDetailEntities = buildInvProductDetail(orderId, erpOrderEntity, orderEntity, 2);
|
|
|
|
|
|
|
|
|
|
// if (orderEntity.isPreCheck()) {
|
|
|
|
|
//// insetInv(bussinessTypeEntity, invProductDetailEntities);//2.插入当前库存
|
|
|
|
|
//
|
|
|
|
|
// invPreInProductDetailService.insertInvProducts(invProductDetailEntities);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
if (invProductDetailEntities != null && invProductDetailEntities.size() > 0) {
|
|
|
|
|
mInvProductDetailEntities.addAll(invProductDetailEntities);
|
|
|
|
@ -220,32 +209,35 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//单据流转
|
|
|
|
|
List<BussinessChangeTypeEntity> bussinessChangeTypeEntitys = bussinessChangeTypeService.findByAction(bussinessLocalTypeEntity.getLocalAction());
|
|
|
|
|
if ((bussinessChangeTypeEntitys != null && bussinessChangeTypeEntitys.size() > 0) && bussinessLocalTypeEntity.isChangeEnable()) {
|
|
|
|
|
|
|
|
|
|
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())
|
|
|
|
|
//普通入库补单
|
|
|
|
|
{
|
|
|
|
|
BussinessChangeTypeEntity bussinessChangeTypeEntity = bussinessChangeTypeEntitys.get(0);
|
|
|
|
|
List<WarehouseEntity> datas = addPutOrder(orderEntity, mInvProductDetailEntities);
|
|
|
|
|
List<WarehouseEntity> temps = filterMapCodes(datas);
|
|
|
|
|
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);
|
|
|
|
|
buildPreInOrder(bussinessChangeTypeEntity, temps, orderEntity); //3.生成流转单据
|
|
|
|
|
} else {
|
|
|
|
|
insetInv(bussinessTypeEntity, mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
insetInv(bussinessTypeEntity, mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
|
}
|
|
|
|
|
BussinessChangeTypeEntity bussinessChangeTypeEntity = bussinessChangeTypeService.findOriginAction(bussinessLocalTypeEntity.getLocalAction());
|
|
|
|
|
if (bussinessChangeTypeEntity != null && bussinessLocalTypeEntity.isChangeEnable()) {
|
|
|
|
|
|
|
|
|
|
addUseOutOrder(orderEntity, mInvProductDetailEntities, bussinessChangeTypeEntity);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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())
|
|
|
|
|
// //普通入库补单
|
|
|
|
|
// {
|
|
|
|
|
// BussinessChangeTypeEntity bussinessChangeTypeEntity = bussinessChangeTypeEntitys.get(0);
|
|
|
|
|
// List<WarehouseEntity> datas = addPutOrder(orderEntity, mInvProductDetailEntities);
|
|
|
|
|
// List<WarehouseEntity> temps = filterMapCodes(datas);
|
|
|
|
|
// 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);
|
|
|
|
|
// buildPreInOrder(bussinessChangeTypeEntity, temps, orderEntity); //3.生成流转单据
|
|
|
|
|
// } else {
|
|
|
|
|
// insetInv(bussinessTypeEntity, mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// insetInv(bussinessTypeEntity, mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
insetInv(bussinessTypeEntity, mInvProductDetailEntities);//2.插入当前库存
|
|
|
|
@ -255,28 +247,13 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//普通出库补单-- //补采购入库,调拨入库,寄售转入
|
|
|
|
|
public void addUseOutOrder(OrderEntity orderEntity, List<InvProductDetailEntity> invProductDetailEntities, List<BussinessChangeTypeEntity> bussinessChangeTypeEntities) {
|
|
|
|
|
|
|
|
|
|
BussinessChangeTypeEntity advChangeTypeEntity = null;
|
|
|
|
|
BussinessChangeTypeEntity norChangeTypeEntity = null;
|
|
|
|
|
BussinessChangeTypeEntity outChangeTypeEntity = null;
|
|
|
|
|
BussinessChangeTypeEntity innorChangeTypeEntity = null;
|
|
|
|
|
for (BussinessChangeTypeEntity bussinessChangeTypeEntity : bussinessChangeTypeEntities) {
|
|
|
|
|
if (bussinessChangeTypeEntity.getChangeType() == ConstantStatus.ORDER_CHANGE_NORMAL_ADV_IN) {
|
|
|
|
|
advChangeTypeEntity = bussinessChangeTypeEntity;
|
|
|
|
|
} else if (bussinessChangeTypeEntity.getChangeType() == ConstantStatus.ORDER_CHANGE_NORMAL_IN) {
|
|
|
|
|
outChangeTypeEntity = bussinessChangeTypeEntity;
|
|
|
|
|
} else if (bussinessChangeTypeEntity.getChangeType() == ConstantStatus.ORDER_CHANGE_INNOR_NORMAL_IN) {
|
|
|
|
|
innorChangeTypeEntity = bussinessChangeTypeEntity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public void addUseOutOrder(OrderEntity orderEntity, List<InvProductDetailEntity> invProductDetailEntities, BussinessChangeTypeEntity bussinessChangeTypeEntity) {
|
|
|
|
|
List<WarehouseEntity> warehouseEntities = codesService.findByReceiptId(orderEntity.getId());
|
|
|
|
|
List<WarehouseEntity> inList = new ArrayList<>();
|
|
|
|
|
List<WarehouseEntity> preiInList = new ArrayList<>();
|
|
|
|
|
//缺量补单时是否全量补单
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity1 = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
|
// SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("ullage_supplement_all");
|
|
|
|
|
if (bussinessTypeEntity1.isSupplementAll()) {
|
|
|
|
|
if (bussinessChangeTypeEntity.isSupplementAll()) {
|
|
|
|
|
insetInv(bussinessTypeEntity1, invProductDetailEntities);//2.插入当前库存
|
|
|
|
|
WarehouseEntity warehouseEntity = warehouseEntities.get(0);
|
|
|
|
|
InvWarehouseEntity locWarehouseEntity = invWarehouseService.selectByCode(warehouseEntity.getLocStorageCode());
|
|
|
|
@ -286,15 +263,12 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (locWarehouseEntity.getLevel() > 1) {
|
|
|
|
|
norChangeTypeEntity = innorChangeTypeEntity;
|
|
|
|
|
InvWarehouseEntity pInWarehouseEntity = invWarehouseService.selectByCode(locWarehouseEntity.getPcode());
|
|
|
|
|
for (WarehouseEntity tempEntity : warehouseEntities) {
|
|
|
|
|
tempEntity.setFromCorp(pInWarehouseEntity.getName());
|
|
|
|
|
tempEntity.setFromCorpId(pInWarehouseEntity.getCode());
|
|
|
|
|
tempEntity.setFromCorp(bussinessChangeTypeEntity.getDefaultInv());
|
|
|
|
|
tempEntity.setFromCorpId(bussinessChangeTypeEntity.getDefaultSubInv());
|
|
|
|
|
inList.add(tempEntity);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
norChangeTypeEntity = outChangeTypeEntity;
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(warehouseEntity.getSupId());
|
|
|
|
|
for (WarehouseEntity tempEntity : warehouseEntities) {
|
|
|
|
|
tempEntity.setFromCorpId(warehouseEntity.getSupId());
|
|
|
|
@ -314,7 +288,7 @@ public class InvProductsTrService {
|
|
|
|
|
* else(仓库等级>1)
|
|
|
|
|
* {可能需要补录的入库单据有一种:《调拨入库》}
|
|
|
|
|
*/
|
|
|
|
|
InvWarehouseEntity locWarehouseEntity = invWarehouseService.selectByCode(warehouseEntity.getLocStorageCode());
|
|
|
|
|
InvWarehouseEntity locWarehouseEntity = invWarehouseService.selectByCode(bussinessChangeTypeEntity.getLocInv());
|
|
|
|
|
if (locWarehouseEntity.getLevel() == 1 && isAdavnce(warehouseEntity)) {//补寄售转入
|
|
|
|
|
//获取当前条码实际数量
|
|
|
|
|
int actCount = getActCount(warehouseEntity);
|
|
|
|
@ -325,7 +299,7 @@ public class InvProductsTrService {
|
|
|
|
|
* 《寄售转入库》往来单位:
|
|
|
|
|
* 单据类型的当前仓库(如果当前仓库有设置,则判断该当前仓库是否为1级库并且仓库类型=寄售,如果没设置,那么往来单位自动为默认寄售仓库),当前仓库:出库单据的当前仓库
|
|
|
|
|
*/
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(advChangeTypeEntity.getScAction());
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity;
|
|
|
|
|
if (!StrUtil.isEmpty(bussinessTypeEntity.getStorageCode())) {
|
|
|
|
|
invWarehouseEntity = invWarehouseService.selectByCode(bussinessTypeEntity.getStorageCode());
|
|
|
|
@ -337,13 +311,11 @@ public class InvProductsTrService {
|
|
|
|
|
} else
|
|
|
|
|
invWarehouseEntity = invWarehouseService.findDefault(true, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int invCount = getCountByOrder(null, warehouseEntity);
|
|
|
|
|
warehouseEntity.setFromCorpId(invWarehouseEntity.getCode());
|
|
|
|
|
warehouseEntity.setFromCorp(invWarehouseEntity.getName());
|
|
|
|
|
if (invCount > 0) {//仓库已存在该产品
|
|
|
|
|
if (count > invCount) { //当前数量>结余数量,说明该产品是无序列号或者是多级包装
|
|
|
|
|
// UdiEntity udiEntity = FilterUdiUtils.getUdi(warehouseEntity.getCode());
|
|
|
|
|
if (actCount > invCount) { //该产品实际数量大于结余数量,说明是多级包装,直接补
|
|
|
|
|
preiInList.add(warehouseEntity);
|
|
|
|
|
} else if (warehouseEntity.getSerialNo() == null) { //无序列号(多级包装无序列号的已在上一步被排除),补齐数量
|
|
|
|
@ -364,26 +336,27 @@ public class InvProductsTrService {
|
|
|
|
|
String code = warehouseEntity.getCode();
|
|
|
|
|
int count = actCount * warehouseEntity.getCount();
|
|
|
|
|
int invCount = 0;
|
|
|
|
|
if (locWarehouseEntity.getLevel() > 1) {//补调拨入库
|
|
|
|
|
/**
|
|
|
|
|
* 调拨入库》往来单位:出库单据的当前仓库的父级仓库,当前仓库:出库单据的当前仓库;
|
|
|
|
|
*/
|
|
|
|
|
InvWarehouseEntity pInWarehouseEntity = invWarehouseService.selectByCode(locWarehouseEntity.getPcode());
|
|
|
|
|
warehouseEntity.setFromCorp(pInWarehouseEntity.getName());
|
|
|
|
|
warehouseEntity.setFromCorpId(pInWarehouseEntity.getCode());
|
|
|
|
|
|
|
|
|
|
invCount = getCountByOrder(null, warehouseEntity);
|
|
|
|
|
norChangeTypeEntity = innorChangeTypeEntity;
|
|
|
|
|
} else { //补供应商入库
|
|
|
|
|
if (locWarehouseEntity.getLevel() == 1 && StrUtil.isEmpty(bussinessChangeTypeEntity.getDefaultSubInv())) {
|
|
|
|
|
/**
|
|
|
|
|
* 供应商入库》往来单位:根据产品指定的供应商,当前仓库:出库单据的当前仓库;
|
|
|
|
|
*/
|
|
|
|
|
//供应商
|
|
|
|
|
warehouseEntity.setFromCorpId(warehouseEntity.getSupId());
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByErpId(warehouseEntity.getSupId());
|
|
|
|
|
warehouseEntity.setFromCorp(basicUnitMaintainEntity.getName());
|
|
|
|
|
invCount = getCountByOrder(null, warehouseEntity);
|
|
|
|
|
norChangeTypeEntity = outChangeTypeEntity;
|
|
|
|
|
} else if (StrUtil.isNotEmpty(bussinessChangeTypeEntity.getDefaultSubInv())) {
|
|
|
|
|
/**
|
|
|
|
|
* 调拨入库》往来单位:出库单据的当前仓库的父级仓库,当前仓库:出库单据的当前仓库;
|
|
|
|
|
*/
|
|
|
|
|
InvSubWarehouseEntity subWarehouseEntity = invSubWarehouseService.findByInvSubByCode(bussinessChangeTypeEntity.getDefaultSubInv());
|
|
|
|
|
warehouseEntity.setFromCorp(subWarehouseEntity.getName());
|
|
|
|
|
warehouseEntity.setFromCorpId(subWarehouseEntity.getParentId());
|
|
|
|
|
warehouseEntity.setFromSubInvCode(subWarehouseEntity.getCode());
|
|
|
|
|
invCount = getCountByOrder(null, warehouseEntity);
|
|
|
|
|
} else {
|
|
|
|
|
//无法补单,补单失败!
|
|
|
|
|
log.error("无法补单,补单失败!,单据流转设置未设置补单往来信息(" + orderEntity.getId() + ")");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (invCount > 0) {//仓库已存在该产品
|
|
|
|
@ -411,12 +384,12 @@ public class InvProductsTrService {
|
|
|
|
|
|
|
|
|
|
if (inList.size() > 0) {
|
|
|
|
|
List<WarehouseEntity> temps = filterMapCodes(inList);
|
|
|
|
|
buildInOrder(norChangeTypeEntity, temps, orderEntity); //3.生成采购入库流转单据
|
|
|
|
|
buildInOrder(bussinessChangeTypeEntity, temps, orderEntity); //3.生成采购入库流转单据
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (preiInList.size() > 0) {
|
|
|
|
|
List<WarehouseEntity> temps1 = filterMapCodes(preiInList);
|
|
|
|
|
buildNorPreInOrder(advChangeTypeEntity, temps1, orderEntity); //3.补寄售转入
|
|
|
|
|
buildNorPreInOrder(bussinessChangeTypeEntity, temps1, orderEntity); //3.补寄售转入
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -646,7 +619,6 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setFromCorpId(null);
|
|
|
|
|
outOrder.setLocStorageCode(orderEntity.getLocStorageCode());
|
|
|
|
|
outOrder.setInvStorageCode(orderEntity.getInvStorageCode());
|
|
|
|
|
|
|
|
|
|
//互填单号
|
|
|
|
|
orderEntity.setUllageSupNo(outOrder.getId());
|
|
|
|
|
orderEntity.setUpdateTime(new Date());
|
|
|
|
@ -692,7 +664,9 @@ public class InvProductsTrService {
|
|
|
|
|
} else
|
|
|
|
|
unkonwCorpList.add(warehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
|
|
|
|
|
BussinessLocalTypeEntity bussinessLocalTypeEntity = bussinessLocalTypeService.findBTByAction(bussinessChangeTypeEntity.getAction());
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(bussinessLocalTypeEntity.getAction());
|
|
|
|
|
//根据往来单位生成入库单
|
|
|
|
|
for (String corpName : filterSupMaps.keySet()) {
|
|
|
|
|
List<WarehouseEntity> temps;
|
|
|
|
@ -702,8 +676,8 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setSupplementNo(null);//补单需置空
|
|
|
|
|
outOrder.setActDate(DateUtil.getBeforeDay(outOrder.getActDate(), bussinessChangeTypeEntity.getBeforeTime()));
|
|
|
|
|
outOrder.setCreateTime(outOrder.getActDate());
|
|
|
|
|
outOrder.setAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
outOrder.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
outOrder.setAction(bussinessTypeEntity.getAction());
|
|
|
|
|
outOrder.setMainAction(bussinessTypeEntity.getMainAction());
|
|
|
|
|
outOrder.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
outOrder.setCustomerId(Constant.SYSTEM_CUSTOMER_ID);
|
|
|
|
|
outOrder.setErpFk(null);
|
|
|
|
@ -712,16 +686,13 @@ public class InvProductsTrService {
|
|
|
|
|
outOrder.setId(orderNo);
|
|
|
|
|
outOrder.setFromCorpId(corpName);
|
|
|
|
|
outOrder.setFromCorp(temps.get(0).getFromCorp());
|
|
|
|
|
|
|
|
|
|
// BussinessTypeEntity originBT = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
|
if (StrUtil.isNotEmpty(bussinessChangeTypeEntity.getDefaultSubInv())) {
|
|
|
|
|
outOrder.setFromSubInvCode(bussinessChangeTypeEntity.getDefaultSubInv());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
outOrder.setCorpOrderId(CustomUtil.getId() + "x");
|
|
|
|
|
outOrder.setLocStorageCode(orderEntity.getLocStorageCode());
|
|
|
|
|
outOrder.setInvStorageCode(orderEntity.getInvStorageCode());
|
|
|
|
|
|
|
|
|
|
outOrder.setLocStorageCode(bussinessChangeTypeEntity.getLocInv());
|
|
|
|
|
outOrder.setInvStorageCode(bussinessChangeTypeEntity.getLocInv());
|
|
|
|
|
outOrder.setInvWarehouseCode(bussinessChangeTypeEntity.getLocSubInv());
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey("additional_auto_submit");
|
|
|
|
|
if ("1".equals(systemParamConfigEntity.getParamValue())) {
|
|
|
|
|
outOrder.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
|
|
|
@ -746,8 +717,8 @@ public class InvProductsTrService {
|
|
|
|
|
warehouseEntity.setFromCorpId(outOrder.getFromCorpId());
|
|
|
|
|
warehouseEntity.setLocStorageCode(outOrder.getLocStorageCode());
|
|
|
|
|
warehouseEntity.setInvWarehouseCode(outOrder.getInvWarehouseCode());
|
|
|
|
|
warehouseEntity.setAction(bussinessChangeTypeEntity.getScAction());
|
|
|
|
|
warehouseEntity.setMainAction(ConstantType.TYPE_PUT);
|
|
|
|
|
warehouseEntity.setAction(outOrder.getAction());
|
|
|
|
|
warehouseEntity.setMainAction(outOrder.getMainAction());
|
|
|
|
|
}
|
|
|
|
|
codesTempService.insertCodesTemp(temps);
|
|
|
|
|
}
|
|
|
|
@ -963,6 +934,7 @@ public class InvProductsTrService {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void insetInvSingle(boolean isPre, InvProductDetailEntity invProductDetailEntity) {
|
|
|
|
|
List<InvProductDetailEntity> invProductDetailEntities = new ArrayList<>();
|
|
|
|
|
invProductDetailEntities.add(invProductDetailEntity);
|
|
|
|
|