预验收入库,第三方仓库信息修改

master
anthonyywj2 3 years ago
parent 6968e7cea9
commit a5ba3eb62c

@ -4,4 +4,10 @@ public class Constant {
public static String SYSTEM_CUSTOMER_ID = "110";
public static String MUTI = "MUTI";
public static final String SERIAL_CACHE_PREFIX = "serial_";
public static final String SERIAL_CACHE_PREFIX_ST = "serialst_";
public static final String SCAN_ORDER = "MS";
public static final String BUS_ORDER = "MY";
}

@ -1,5 +1,6 @@
package com.glxp.api.admin.controller.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
@ -21,6 +22,7 @@ import com.glxp.api.admin.entity.inout.ErpOrderEntity;
import com.glxp.api.admin.entity.inout.OrderEntity;
import com.glxp.api.admin.entity.inout.WarehouseEntity;
import com.glxp.api.admin.entity.inout.WarehouseUserEntity;
import com.glxp.api.admin.entity.inventory.InvProductDetailEntity;
import com.glxp.api.admin.exception.JsonException;
import com.glxp.api.admin.req.basic.CompanyProductRelevanceRequest;
import com.glxp.api.admin.req.inout.*;
@ -39,6 +41,7 @@ import com.glxp.api.admin.service.info.CompanyProductRelevanceService;
import com.glxp.api.admin.service.info.CompanyService;
import com.glxp.api.admin.service.info.SystemParamConfigService;
import com.glxp.api.admin.service.inout.*;
import com.glxp.api.admin.service.inventory.InvPreInProductDetailService;
import com.glxp.api.admin.thread.IoTransInoutService;
import com.glxp.api.admin.util.*;
import com.glxp.api.common.enums.ResultEnum;
@ -95,11 +98,15 @@ public class WareHouseController {
CompanyProductRelevanceService companyProductRelevanceService;
@Resource
SystemParamConfigService systemParamConfigService;
Logger logger = LoggerFactory.getLogger(StockOrderController.class);
@Resource
StockOrderService stockOrderService;
@Resource
GennerOrderUtils gennerOrderUtils;
@Resource
InvPreInProductDetailService invPreInProductDetailService;
@AuthRuleAnnotation("")
@GetMapping("admin/warehouse/inout/list")
public BaseResponse list(WarehouseQueryRequest warehouseQueryRequest) {
@ -266,6 +273,7 @@ public class WareHouseController {
orderEntity1.setFromCorpId(addOrderRequest.getFromCorpId());
orderEntity1.setLocStorageCode(addOrderRequest.getLocStorageCode());
orderEntity1.setOutChangeEnable(addOrderRequest.isOutChangeEnable());
orderEntity1.setPreCheck(addOrderRequest.isPreCheck());
orderEntity1.setUpdateTime(new Date());
orderService.updateOrder(orderEntity1);
WarehouseEntity warehouseEntity = new WarehouseEntity();
@ -332,6 +340,7 @@ public class WareHouseController {
}
//网页端数据上传调用接口
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/addOrderWeb")
@ -348,15 +357,15 @@ public class WareHouseController {
if (udiEntity == null)
return ResultVOUtils.error(500, "无效条码!");
if(StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length()>20){
if (StrUtil.isNotEmpty(udiEntity.getSerialNo()) && udiEntity.getSerialNo().length() > 20) {
return ResultVOUtils.error(500, "无效条码!序列号超出最大范围");
}
if(StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length()>20){
if (StrUtil.isNotEmpty(udiEntity.getBatchNo()) && udiEntity.getBatchNo().length() > 20) {
return ResultVOUtils.error(500, "无效条码!批次号超出最大范围");
}
//批次号校验
if (StrUtil.isEmpty(udiEntity.getSerialNo()) && StrUtil.isEmpty(udiEntity.getBatchNo())) {
return ResultVOUtils.error(500, "批次号不能为空!");
@ -390,13 +399,35 @@ public class WareHouseController {
return ResultVOUtils.error(505, "当前产品临近过期,距过期还剩" + time + "天,是否确定继续添加?");
}
}
}
}
String orderId = addOrderRequest.getOrderId();
//预验收校验
if (addOrderRequest.isPreCheck()) {
InvProductDetailEntity invProductDetailEntity = invPreInProductDetailService.statInvPreInDetail(code);
if (invProductDetailEntity == null) {
return ResultVOUtils.error(500, "预验收库存未存在此产品!");
} else {
if (StrUtil.isNotEmpty(orderId)) {//非首次添加
if (StrUtil.isEmpty(udiEntity.getSerialNo())) {//该单据已有该产品
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderId);
warehouseQueryRequest.setCode(code);
List<WarehouseEntity> warehouseEntitys = codesTempService.findByOrderIdAndCode(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntitys)) {
WarehouseEntity warehouseEntity = warehouseEntitys.get(0);
if (invProductDetailEntity.getCount() < (warehouseEntity.getCount() + 1)) {
return ResultVOUtils.error(500, "超出预验收库存数量");
}
}
}
}
}
}
String orderId = addOrderRequest.getOrderId();
if (addOrderRequest.getFromCorpId() == null) {
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByName(addOrderRequest.getFromCorp());
if (basicUnitMaintainEntity == null && bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT && bussinessTypeEntity.isGenUnit()) {
@ -414,11 +445,10 @@ public class WareHouseController {
//先生成扫码单据
OrderEntity orderEntity = orderService.findById(orderId);
if (StringUtils.isBlank(orderId) || orderEntity == null) {
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean("MS" + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + MyStrUtil.trim(bussinessTypeEntity.getPrefix()), "yyyyMMdd"));
orderId = orderNo;
}
WarehouseQueryRequest warehouseQueryRequest = new WarehouseQueryRequest();
warehouseQueryRequest.setOrderId(orderId);
warehouseQueryRequest.setCode(code);
@ -498,6 +528,7 @@ public class WareHouseController {
orderSaveRequest.setLocStorageCode(addOrderRequest.getLocStorageCode());
orderSaveRequest.setFromCorpId(addOrderRequest.getFromCorpId());
orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp());
orderSaveRequest.setPreCheck(addOrderRequest.isPreCheck());
orderSaveRequest.setFromType(ConstantStatus.FROM_WEBNEW);
orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderSaveRequest.setExportStatus(ConstantStatus.ORDER_EXPORT_UN);
@ -672,6 +703,7 @@ public class WareHouseController {
}
@AuthRuleAnnotation("")
@PostMapping("/admin/warehouse/inout/save")
public BaseResponse save(@RequestBody @Valid WarehouseSaveRequest warehouseSaveRequest,

@ -37,7 +37,6 @@ import java.util.List;
@RestController
public class InvPreInProductsController {
@Resource
InvPreInProductService invProductService;
@Resource
@ -85,7 +84,16 @@ public class InvPreInProductsController {
if (CollUtil.isNotEmpty(invProductResponses)) {
return ResultVOUtils.success(invProductResponses);
}
return ResultVOUtils.error(501, "未入库");
return ResultVOUtils.error(501, "该产品未预验收入库");
}
@AuthRuleAnnotation("")
@GetMapping("spms/prein/inv/products/getDetaiByCode")
public BaseResponse getDetaiByCode(FilterInvProductDetailRequest filterInvProductDetailRequest) {
InvProductDetailEntity invProductDetailEntity = invProductDetailService.statInvPreInDetail(filterInvProductDetailRequest.getCode());
if (invProductDetailEntity != null)
return ResultVOUtils.success(invProductDetailEntity);
return ResultVOUtils.error(501, "该产品未预验收入库");
}

@ -48,4 +48,7 @@ public class OrderEntity {
private String originUllageSupNo;
private Date updateTime;
private boolean preCheck;
}

@ -20,4 +20,5 @@ public class AddOrderRequest {
private boolean outChangeEnable;
private boolean ignoreExpire;
private boolean ignoreRecentExpire;
private boolean preCheck;
}

@ -27,4 +27,7 @@ public interface InvPreInProductDetailService {
List<String> findAllCode(FilterInvProductDetailRequest filterInvProductDetailRequest);
InvProductDetailEntity statInvPreInDetail(String code);
}

@ -1,6 +1,7 @@
package com.glxp.api.admin.service.inventory.impl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.admin.constant.ConstantType;
import com.glxp.api.admin.dao.inventory.InvPreInProductDetailDao;
import com.glxp.api.admin.entity.inventory.InvProductDetailEntity;
import com.glxp.api.admin.req.inventory.FilterInvProductDetailRequest;
@ -10,7 +11,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class InvPreInProductDetailServiceImpl implements InvPreInProductDetailService {
@ -78,4 +81,34 @@ public class InvPreInProductDetailServiceImpl implements InvPreInProductDetailSe
public List<String> findAllCode(FilterInvProductDetailRequest filterInvProductDetailRequest) {
return invPreInProductDetailDao.findAllCode(filterInvProductDetailRequest);
}
@Override
public InvProductDetailEntity statInvPreInDetail(String code) {
FilterInvProductDetailRequest filterInvProductDetailRequest = new FilterInvProductDetailRequest();
filterInvProductDetailRequest.setOriginCode(code);
List<InvProductDetailEntity> datas = invPreInProductDetailDao.filterInvProductDetail(filterInvProductDetailRequest);
Map<String, InvProductDetailEntity> invProductDetailEntityMap = new HashMap<>();
for (InvProductDetailEntity invProductDetailEntity : datas) {
InvProductDetailEntity temp = invProductDetailEntityMap.get(invProductDetailEntity.getCode());
if (temp == null) {
invProductDetailEntityMap.put(invProductDetailEntity.getOriginCode(), invProductDetailEntity);
} else {
int count1 = 0;
int count2 = 0;
if (temp.getMainAction().equals(ConstantType.TYPE_PUT)) {
count1 = temp.getCount();
} else {
count1 = 0 - temp.getCount();
}
if (invProductDetailEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
count2 = invProductDetailEntity.getCount();
} else {
count2 = 0 - invProductDetailEntity.getCount();
}
temp.setCount(count1 + count2);
}
}
return invProductDetailEntityMap.get(code);
}
}

@ -21,10 +21,7 @@ import com.glxp.api.admin.entity.inout.ErpOrderEntity;
import com.glxp.api.admin.entity.inout.OrderEntity;
import com.glxp.api.admin.entity.inout.WarehouseEntity;
import com.glxp.api.admin.entity.inventory.InvWarehouseEntity;
import com.glxp.api.admin.entity.thrsys.ThrCorpEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderDetailEntity;
import com.glxp.api.admin.entity.thrsys.ThrOrderEntity;
import com.glxp.api.admin.entity.thrsys.ThrProductsEntity;
import com.glxp.api.admin.entity.thrsys.*;
import com.glxp.api.admin.req.basic.BasicExportStatusRequest;
import com.glxp.api.admin.res.basic.*;
import com.glxp.api.admin.res.inventory.InvWarehouseExportResponse;
@ -32,6 +29,8 @@ import com.glxp.api.admin.service.basic.UdiInfoImportDetailService;
import com.glxp.api.admin.service.info.CompanyProductRelevanceService;
import com.glxp.api.admin.service.inout.OrderService;
import com.glxp.api.admin.service.inventory.InvWarehouseService;
import com.glxp.api.admin.service.thrsys.ThrInvProductsService;
import com.glxp.api.admin.service.thrsys.ThrInvWarehouseService;
import com.glxp.api.admin.util.CustomUtil;
import com.glxp.api.admin.util.FileUtils;
import com.glxp.api.admin.util.RedisUtil;
@ -69,6 +68,9 @@ public class DlBasicService {
HeartService heartService;
@Resource
RedisUtil redisUtil;
@Resource
ThrInvWarehouseService thrInvWarehouseService;
private static final Logger logger = LoggerFactory.getLogger(DlBasicService.class);
//------------------------------------------------------------
@ -208,6 +210,14 @@ public class DlBasicService {
} catch (Exception e) {
}
}
if (CollUtil.isNotEmpty(syncDataResponse.getThrInvWarehouseEntities())) {
for (ThrInvWarehouseEntity invWarehouseEntity : syncDataResponse.getThrInvWarehouseEntities()) {
invWarehouseEntity.setUpdateTime(null);
}
thrInvWarehouseService.insertInvWarehouses(syncDataResponse.getThrInvWarehouseEntities());
}
spGetHttp.postBasicStatus(basicExportStatusEntity.getId());
batchSession.close();
}

@ -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

@ -154,7 +154,7 @@ public class IoTransInoutService {
orderSaveRequest.setLocStorageCode(warehouseEntity.getLocStorageCode());
orderSaveRequest.setMainAction(warehouseEntity.getMainAction());
orderSaveRequest.setReceiveStatus(0);
orderSaveRequest.setCreateUser(postOrderRequest.getUserId());
orderSaveRequest.setCreateUser(postOrderRequest.getUserId());
orderSaveRequest.setFromCorp(warehouseEntity.getFromCorp());
if (postOrder.getErpOrders() != null && postOrder.getErpOrders().size() > 0)
orderSaveRequest.setFromType(ConstantStatus.FROM_PDAED);

@ -161,7 +161,7 @@
and locStorageCode = #{locStorageCode}
</if>
<if test="unionUser != '' and unionUser!=null">
and (createUser =#{unionUser} or reviewUser =#{unionUser})
and ((createUser =#{unionUser} or reviewUser =#{unionUser}) or (reviewUser is null and createUser is null) )
</if>
<if test="createUser!=null">
and createUser = #{createUser}

@ -48,7 +48,7 @@
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo)
outChangeEnable, originUllageSupNo,preCheck)
values (#{id},
#{action},
#{corpOrderId},
@ -67,7 +67,7 @@
#{erpFk},
#{stockCheckFk},
#{supId}, #{exportFilePath}, #{locStorageCode}, #{supplementNo}
, #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo})
, #{ullageSupNo}, #{createUser}, #{reviewUser}, #{outChangeEnable}, #{originUllageSupNo},#{preCheck})
</insert>
<insert id="importOrder" keyProperty="id" parameterType="com.glxp.api.admin.entity.inout.OrderEntity">
@ -76,7 +76,7 @@
fromCorp, status, remark, exportStatus, fromType, contrastStatus, signStatus,
receiveStatus, erpFk, stockCheckFk, supId,
exportFilePath, locStorageCode, supplementNo, ullageSupNo, createUser, reviewUser,
outChangeEnable, originUllageSupNo)
outChangeEnable, originUllageSupNo,preCheck)
values (
#{id},
#{action},
@ -103,7 +103,7 @@
#{createUser},
#{reviewUser},
#{outChangeEnable},
#{originUllageSupNo}
#{originUllageSupNo},#{preCheck}
)
</insert>
@ -139,6 +139,7 @@
<if test="updateTime != null">updateTime=#{updateTime},</if>
<if test="outChangeEnable != null">outChangeEnable=#{outChangeEnable},</if>
<if test="originUllageSupNo != null">originUllageSupNo=#{originUllageSupNo},</if>
<if test="preCheck != null">preCheck=#{preCheck},</if>
</trim>
WHERE id = #{id}
@ -150,16 +151,18 @@
</foreach>
</select>
<delete id="deleteByOrderId" parameterType="Map">
<delete id="deleteById" parameterType="Map">
DELETE
FROM io_order
WHERE id = #{orderId}
WHERE id = #{id}
</delete>
<delete id="deleteById" parameterType="Map">
<delete id="deleteByOrderId" parameterType="Map">
DELETE
FROM io_order
WHERE id = #{id}
WHERE id = #{orderId}
</delete>
<insert id="updateUnit" keyProperty="id" parameterType="com.glxp.api.admin.entity.inout.OrderEntity">
@ -255,7 +258,7 @@
and reviewUser =#{reviewUser}
</if>
<if test="unionUser != '' and unionUser!=null">
and (createUser =#{unionUser} or reviewUser =#{unionUser})
and ((createUser =#{unionUser} or reviewUser =#{unionUser}) or (reviewUser is null and createUser is null) )
</if>
<if test="ullageSupNo != '' and ullageSupNo!=null">
and ullageSupNo =#{ullageSupNo}
@ -270,7 +273,6 @@
group by io_order.id
ORDER BY actDate DESC
</select>
<select id="filterList" parameterType="com.glxp.api.admin.req.inout.OrderFilterRequest"
@ -343,6 +345,7 @@
ORDER BY actDate DESC
</select>
<select id="filterNoSort" parameterType="com.glxp.api.admin.req.inout.OrderFilterRequest"
resultType="com.glxp.api.admin.entity.inout.OrderEntity">
SELECT io_order.* FROM io_order
@ -407,7 +410,6 @@
</select>
<select id="filterListByUser" parameterType="com.glxp.api.admin.req.inout.OrderFilterRequest"
resultType="com.glxp.api.admin.entity.inout.OrderEntity">
SELECT io_order.* FROM io_order
@ -503,6 +505,9 @@
</where>
limit 1
</select>
<select id="filterListByCode" parameterType="java.util.List"
resultType="com.glxp.api.admin.entity.inout.OrderEntity">
SELECT * FROM io_order WHERE id IN

@ -74,16 +74,20 @@
resultType="com.glxp.api.admin.entity.inventory.InvProductEntity">
SELECT *
FROM inv_prein_product
<where>
relIdFk = #{relIdFk}
and invStorageCode = #{invStorageCode}
<if test="supId != '' and supId != null">
AND supId = #{supId}
</if>
<if test="supId == null">
AND supId is NULL
</if>
<if test="batchNo != '' and batchNo != null">
AND batchNo = #{batchNo}
</if>
<if test="invStorageCode != '' and invStorageCode != null">
AND invStorageCode = #{invStorageCode}
</if>
<if test="invWarehouseCode != '' and invWarehouseCode != null">
AND invWarehouseCode = #{invWarehouseCode}
</if>

@ -92,6 +92,9 @@
<if test="supId == null">
AND supId is NULL
</if>
<if test="batchNo != '' and batchNo != null">
AND batchNo = #{batchNo}
</if>
<if test="invWarehouseCode != '' and invWarehouseCode != null">
AND invWarehouseCode = #{invWarehouseCode}
</if>

@ -80,6 +80,9 @@
<if test="supId == null">
AND supId is NULL
</if>
<if test="batchNo != '' and batchNo != null">
AND batchNo = #{batchNo}
</if>
<if test="invWarehouseCode != '' and invWarehouseCode != null">
AND invWarehouseCode = #{invWarehouseCode}
</if>

Loading…
Cancel
Save