Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -15,4 +15,6 @@ public interface InboundEasSyncService {
|
||||
void syncOtherOutBill(BillChangeDto billChangeDto);
|
||||
|
||||
void syncSaleOutBill(BillChangeDto billChangeDto);
|
||||
|
||||
void syncReturnInBill(BillChangeDto billChangeDto);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,16 @@ package org.nl.wms.ext_manage.purchase.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.purchase.service.EasToWmsService;
|
||||
import org.nl.wms.ext_manage.purchase.service.InboundEasSyncService;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.pm_manage.purchase.service.PurchaseService;
|
||||
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
|
||||
import org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasemstMapper;
|
||||
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -16,39 +21,36 @@ public class EasToWmsServiceImpl implements EasToWmsService {
|
||||
|
||||
@Autowired
|
||||
private InboundEasSyncService inboundEasSyncService;
|
||||
@Autowired
|
||||
private PurchaseService purchaseService;
|
||||
@Autowired
|
||||
private PurchasemstMapper purchasemstMapper;
|
||||
|
||||
@Override
|
||||
public JSONObject billChangeHandler(BillChangeDto billChangeDto) {
|
||||
if (StrUtil.isEmptyIfStr(billChangeDto.getBillid())){
|
||||
throw new BadRequestException("EAS同步失败:billid为空");
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
switch (billChangeDto.getOrderType()){
|
||||
case "103":
|
||||
//采购入库单
|
||||
inboundEasSyncService.syncPurchaseBill(billChangeDto);
|
||||
break;
|
||||
case "107":
|
||||
//调拨入库单
|
||||
inboundEasSyncService.syncTransferBill(billChangeDto);
|
||||
break;
|
||||
case "109":
|
||||
//其他入库单
|
||||
inboundEasSyncService.syncOtherBill(billChangeDto);
|
||||
break;
|
||||
case "106":
|
||||
//调拨出库单
|
||||
inboundEasSyncService.syncTransferOutBill(billChangeDto);
|
||||
break;
|
||||
case "108":
|
||||
//其他出库单
|
||||
inboundEasSyncService.syncOtherOutBill(billChangeDto);
|
||||
break;
|
||||
case "102":
|
||||
//销售出库单
|
||||
inboundEasSyncService.syncSaleOutBill(billChangeDto);
|
||||
break;
|
||||
String billId = billChangeDto.getBillid();
|
||||
//更新单据
|
||||
final Purchasemst one = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (one!=null && one.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
Purchasemst purchasemst = new Purchasemst();
|
||||
purchasemst.setBill_id(billChangeDto.getBillid());
|
||||
purchasemst.setStatus(billChangeDto.getStatus());
|
||||
purchasemst.setOrder_no(billChangeDto.getOrderNo());
|
||||
purchasemst.setOrder_type(billChangeDto.getOrderType());
|
||||
purchasemst.setRed(billChangeDto.getRed());
|
||||
purchasemst.setCreate_time(billChangeDto.getNoticeTime());
|
||||
purchasemst.setBill_status(PurchaseBillStatus.W_SYNC.getCode());
|
||||
purchaseService.save(purchasemst);
|
||||
JSONObject result = new JSONObject();
|
||||
|
||||
result.put("respCode", 0);
|
||||
result.put("respMsg", "单据变更通知成功");
|
||||
return result;
|
||||
|
||||
@@ -89,4 +89,13 @@ public class InboundEasQueryService {
|
||||
public List<Purchasedtl> queryDtlListBySaleOut(String billId) {
|
||||
return easPurchasedtlMapper.selectSaleOutByBillId(billId);
|
||||
}
|
||||
|
||||
public Purchasemst queryMstByReturnIn(String billId) {
|
||||
List<Purchasemst> list = easPurchasemstMapper.selectReturnInByBillId(billId);
|
||||
return list != null && !list.isEmpty() ? list.get(0) : null;
|
||||
}
|
||||
|
||||
public List<Purchasedtl> queryDtlListByReturnIn(String billId) {
|
||||
return easPurchasedtlMapper.selectReturnInByBillId(billId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && !purchasemst.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -67,8 +67,9 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMst(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
@@ -113,7 +114,7 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
purchasedtlMapper.batchSave(easDtlList);
|
||||
purchasemstMapper.insert(easMst);
|
||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
log.info("EAS单据同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
break;
|
||||
case 3:
|
||||
//删除单据
|
||||
@@ -136,8 +137,8 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && !purchasemst.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -152,8 +153,9 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMstByTransfer(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
@@ -198,7 +200,7 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
purchasedtlMapper.batchSave(easDtlList);
|
||||
purchasemstMapper.insert(easMst);
|
||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
log.info("EAS单据同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
break;
|
||||
case 3:
|
||||
//删除单据
|
||||
@@ -221,8 +223,8 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && !purchasemst.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -237,8 +239,9 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMstByOther(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
@@ -283,7 +286,7 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
purchasedtlMapper.batchSave(easDtlList);
|
||||
purchasemstMapper.insert(easMst);
|
||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
log.info("EAS单据同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
break;
|
||||
case 3:
|
||||
//删除单据
|
||||
@@ -306,8 +309,8 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && !purchasemst.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -322,8 +325,9 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMstByTransferOut(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
@@ -368,7 +372,7 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
purchasedtlMapper.batchSave(easDtlList);
|
||||
purchasemstMapper.insert(easMst);
|
||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
log.info("EAS单据同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
break;
|
||||
case 3:
|
||||
//删除单据
|
||||
@@ -391,8 +395,8 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && !purchasemst.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -407,8 +411,9 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMstByOtherOut(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
@@ -453,7 +458,7 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
purchasedtlMapper.batchSave(easDtlList);
|
||||
purchasemstMapper.insert(easMst);
|
||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
log.info("EAS单据同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
break;
|
||||
case 3:
|
||||
//删除单据
|
||||
@@ -476,8 +481,8 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && !purchasemst.getBill_status().equals(PurchaseBillStatus.CREATED.getCode())){
|
||||
throw new BadRequestException("EAS采购单同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
@@ -492,8 +497,9 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMstBySaleOut(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
@@ -507,6 +513,92 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
||||
}
|
||||
}
|
||||
|
||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
//更新单据
|
||||
Boolean allZD = true;
|
||||
for (Purchasedtl dtl : easDtlList) {
|
||||
if (ZD_STOR_SET.contains(dtl.getHouse_code())){
|
||||
//中鼎立库
|
||||
dtl.setInstock_qty(dtl.getQty());
|
||||
easMst.setForwardZD(1);
|
||||
easMst.setBill_status(PurchaseBillStatus.EXECUTING.getCode());
|
||||
}else {
|
||||
allZD = false;
|
||||
}
|
||||
}
|
||||
if (Objects.equals(1, easMst.getForwardZD())){
|
||||
if (allZD){
|
||||
//如果全部都是中鼎的则由中鼎回传EAS
|
||||
easMst.setBill_status(PurchaseBillStatus.COMPLETED.getCode());
|
||||
}
|
||||
//转发中鼎
|
||||
try {
|
||||
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||
easMst.setForwardZD(2);
|
||||
} catch (Exception e) {
|
||||
easMst.setForwardZD(1);
|
||||
}
|
||||
}
|
||||
purchasedtlMapper.batchSave(easDtlList);
|
||||
purchasemstMapper.insert(easMst);
|
||||
log.info("EAS单据同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||
break;
|
||||
case 3:
|
||||
//删除单据
|
||||
LambdaQueryWrapper<Purchasemst> eq = new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId);
|
||||
Purchasemst mst = purchasemstMapper.selectOne(eq);
|
||||
if (mst.getForwardZD() == 2){
|
||||
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||
}
|
||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
purchasemstMapper.deleteById(mst.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void syncReturnInBill(BillChangeDto billChangeDto) {
|
||||
String billId = billChangeDto.getBillid();
|
||||
Integer status = billChangeDto.getStatus();//1:已提交;2:更新;3:删除;
|
||||
//更新单据
|
||||
final Purchasemst purchasemst = purchasemstMapper.selectOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, billId));
|
||||
if (purchasemst!=null && purchasemst.getBill_status().equals(PurchaseBillStatus.EXECUTING.getCode())){
|
||||
throw new BadRequestException("EAS单据同步失败:当前单据在WMS系统中已经执行 " + billId);
|
||||
}
|
||||
Param zdStorParam = iSysParamService.findByCode(EXTConstant.ZD_STOR_SET);
|
||||
List ZD_STOR_SET;
|
||||
if (zdStorParam!=null){
|
||||
ZD_STOR_SET = JSONObject.parseObject(zdStorParam.getValue(), List.class);
|
||||
} else {
|
||||
ZD_STOR_SET = new ArrayList<>();
|
||||
}
|
||||
switch (status){
|
||||
case 1:
|
||||
case 2:
|
||||
//增加单据
|
||||
Purchasemst easMst = easQueryService.queryMstByReturnIn(billId);
|
||||
if (easMst == null) {
|
||||
throw new BadRequestException("EAS单据同步失败:EAS系统中未找到单据: " + billId);
|
||||
}
|
||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
||||
//判断是否因为填错仓库号保证中鼎一致
|
||||
List<Purchasedtl> purchasedtlList = purchasedtlMapper.selectList(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
List<Purchasedtl> easDtlList = easQueryService.queryDtlListByReturnIn(billId);
|
||||
boolean hasZDEas = easDtlList.stream().anyMatch((item) -> ZD_STOR_SET.contains(item.getHouse_code()));
|
||||
if (!purchasedtlList.isEmpty() &&!hasZDEas){ //不包含立库则判断是否是填错仓库单据
|
||||
boolean hasZD = purchasedtlList.stream().anyMatch((item) -> ZD_STOR_SET.contains(item.getHouse_code()));
|
||||
if (hasZD){//原来单据包含中鼎立库
|
||||
billChangeDto.setStatus(3);//删除中鼎异常单据
|
||||
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||
}
|
||||
}
|
||||
|
||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, billId));
|
||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||
|
||||
@@ -21,4 +21,6 @@ public interface EasPurchasedtlMapper extends BaseMapper<Purchasedtl> {
|
||||
List<Purchasedtl> selectTransferOutByBillId(String billId);
|
||||
|
||||
List<Purchasedtl> selectSaleOutByBillId(String billId);
|
||||
|
||||
List<Purchasedtl> selectReturnInByBillId(String billId);
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
FROM EAS_NOBLE.V_UC_DBCK01
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
<select id="selectSaleOutByBillId" resultType="org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl">
|
||||
<select id="selectSaleOutByBillId" resultType="org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
entryid,
|
||||
billid,
|
||||
@@ -134,5 +134,24 @@
|
||||
FROM EAS_NOBLE.V_UC_XSCK05
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
|
||||
<select id="selectReturnInByBillId" resultType="org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
entryid,
|
||||
billid,
|
||||
itemNo,
|
||||
categoryCode,
|
||||
categoryName,
|
||||
skuCode,
|
||||
skuName,
|
||||
model,
|
||||
batchNo,
|
||||
houseCode,
|
||||
qty,
|
||||
unitCode,
|
||||
unit,
|
||||
trackNo
|
||||
FROM EAS_NOBLE.V_UC_SCLL07
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
<!-- 记得添加映射-->
|
||||
</mapper>
|
||||
|
||||
@@ -23,4 +23,6 @@ public interface EasPurchasemstMapper extends BaseMapper<Purchasemst> {
|
||||
List<Purchasemst> selectTransferOutByBillId(String billId);
|
||||
|
||||
List<Purchasemst> selectSaleOutByBillId(String billId);
|
||||
|
||||
List<Purchasemst> selectReturnInByBillId(String billId);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
FROM EAS_NOBLE.V_UC_DBCK01
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
<select id="selectSaleOutByBillId" resultType="org.nl.wms.pm_manage.purchase.service.dao.Purchasemst">
|
||||
<select id="selectSaleOutByBillId" resultType="org.nl.wms.pm_manage.purchase.service.dao.Purchasemst" resultMap="BaseResultMap">
|
||||
SELECT DISTINCT
|
||||
orderNo,
|
||||
orderType,
|
||||
@@ -108,5 +108,18 @@
|
||||
FROM EAS_NOBLE.V_UC_XSCK05
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
|
||||
<select id="selectReturnInByBillId" resultType="org.nl.wms.pm_manage.purchase.service.dao.Purchasemst" resultMap="BaseResultMap">
|
||||
SELECT DISTINCT
|
||||
orderNo,
|
||||
orderType,
|
||||
creator,
|
||||
createTime,
|
||||
modifyDate,
|
||||
status,
|
||||
billid,
|
||||
red
|
||||
FROM EAS_NOBLE.V_UC_SCLL07
|
||||
WHERE billid = #{bill_id}
|
||||
</select>
|
||||
<!-- 记得添加映射-->
|
||||
</mapper>
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandDto;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dao.PmReturn;
|
||||
import org.nl.wms.pm_manage.pmreturn.service.dto.PmReturnDto;
|
||||
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||
@@ -103,7 +102,7 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
||||
public ResponseEntity syncPurchaseReceiving(BillChangeDto billChangeDto) {
|
||||
final String param = JSON.toJSONString(billChangeDto);
|
||||
log.info("syncPurchaseReceiving采购入库单下发输入参数:-------------------" + param);
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_REQUISITION).getValue();
|
||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_IOORDER).getValue();
|
||||
try {
|
||||
String resultMsg = HttpRequest.post(url)
|
||||
.body(param)
|
||||
|
||||
@@ -247,12 +247,15 @@ public class InboundPdaServiceImpl implements InboundPdaService {
|
||||
List<AddInvParam> addInvParams = new ArrayList<>();
|
||||
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);
|
||||
// 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"));
|
||||
List<StructattrVechielDto> structattrVechielDtos = iStructattrService.collectVechicle(
|
||||
MapOf.of("sect_code", usualInboundDto.getSect_code(), "material_code", item.getSku_code()));
|
||||
|
||||
if (!structattrVechielDtos.isEmpty()){
|
||||
StructattrVechielDto groupPlate = structattrVechielDtos.get(0);
|
||||
Structattr structattr = iStructattrService.getOne(new LambdaQueryWrapper<Structattr>()
|
||||
.eq(Structattr::getStoragevehicle_code, groupPlate.getStoragevehicle_code())
|
||||
.eq(Structattr::getSect_code, usualInboundDto.getSect_code())
|
||||
|
||||
@@ -7,10 +7,12 @@ import org.nl.common.logging.annotation.Log;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.ext_manage.service.WmsToZDWmdService;
|
||||
import org.nl.wms.pm_manage.purchase.service.PurchaseService;
|
||||
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
|
||||
import org.nl.wms.pm_manage.purchase.service.dto.PurchaseDto;
|
||||
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;import org.nl.common.base.ResponseData;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -79,7 +81,11 @@ public class PurchaseController {
|
||||
@PostMapping("/pushZD")
|
||||
@Log("出入库单推中鼎")
|
||||
public ResponseEntity pushZD(@RequestBody BillChangeDto billChangeDto){
|
||||
return wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||
purchaseService.lambdaUpdate()
|
||||
.set(Purchasemst::getBill_status, PurchaseBillStatus.COMPLETED.getCode())
|
||||
.eq(Purchasemst::getBill_id, billChangeDto.getBillid());
|
||||
return ResponseData.build();
|
||||
}
|
||||
@PostMapping("/outPush")
|
||||
@Log("下推出库单")
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
AND m.create_time >= #{params.createTime[0]}
|
||||
AND m.create_time <= #{params.createTime[1]}
|
||||
</if>
|
||||
AND m.bill_status != '10'
|
||||
</where>
|
||||
GROUP BY
|
||||
m.id,
|
||||
@@ -92,7 +93,6 @@
|
||||
WHERE 1=1
|
||||
AND m.order_no = #{param.orderNo}
|
||||
AND d.item_no = #{param.itemNo}
|
||||
AND m.status = 0
|
||||
ORDER BY m.create_time DESC, d.item_no ASC
|
||||
</select>
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ public enum PurchaseBillStatus {
|
||||
EXECUTING("1", "执行中"),
|
||||
COMPLETED("2", "已完成"),
|
||||
AUDIT_SUCCESS("3", "审核成功"),
|
||||
W_SYNC("10", "待同步"),
|
||||
AUDIT_FAIL("4", "审核失败");
|
||||
|
||||
private final String code;
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.nl.wms.sch_manage.service.core;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext_manage.purchase.service.InboundEasSyncService;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||
import org.nl.wms.pm_manage.purchase.service.PurchaseService;
|
||||
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
|
||||
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 倒冲领料定时回传,每次回传五条
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class SyncBillAutoTask {
|
||||
|
||||
@Autowired
|
||||
private InboundEasSyncService inboundEasSyncService;
|
||||
@Autowired
|
||||
private PurchaseService purchaseService;
|
||||
|
||||
@SneakyThrows
|
||||
public void run() {
|
||||
log.info("========>同步EAS单据任务");
|
||||
List<Purchasemst> list = purchaseService.list(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_status, PurchaseBillStatus.W_SYNC.getCode()));
|
||||
for (Purchasemst purchasemst : list) {
|
||||
try {
|
||||
BillChangeDto billChangeDto = new BillChangeDto();
|
||||
billChangeDto.setStatus(purchasemst.getStatus());
|
||||
billChangeDto.setRed(purchasemst.getRed());
|
||||
billChangeDto.setOrderNo(purchasemst.getOrder_no());
|
||||
billChangeDto.setOrderType(purchasemst.getOrder_type());
|
||||
billChangeDto.setNoticeTime(purchasemst.getCreate_time());
|
||||
billChangeDto.setBillid(purchasemst.getBill_id());
|
||||
switch (billChangeDto.getOrderType()){
|
||||
case "103":
|
||||
//采购入库单
|
||||
inboundEasSyncService.syncPurchaseBill(billChangeDto);
|
||||
break;
|
||||
case "107":
|
||||
//调拨入库单
|
||||
inboundEasSyncService.syncTransferBill(billChangeDto);
|
||||
break;
|
||||
case "109":
|
||||
//其他入库单
|
||||
inboundEasSyncService.syncOtherBill(billChangeDto);
|
||||
break;
|
||||
case "106":
|
||||
//调拨出库单
|
||||
inboundEasSyncService.syncTransferOutBill(billChangeDto);
|
||||
break;
|
||||
case "108":
|
||||
//其他出库单
|
||||
inboundEasSyncService.syncOtherOutBill(billChangeDto);
|
||||
break;
|
||||
case "102":
|
||||
//销售出库单
|
||||
inboundEasSyncService.syncSaleOutBill(billChangeDto);
|
||||
break;
|
||||
case "104":
|
||||
//退料入库单
|
||||
inboundEasSyncService.syncReturnInBill(billChangeDto);
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("同步EAS单据定时任务错误{}",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
log.info("========>同步EAS单据任务结束:{}", JSON.toJSONString(list));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.commons.lang.time.DateFormatUtils;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.wms.ext_manage.purchase.service.dto.EasAuditRequestDto;
|
||||
import org.nl.wms.ext_manage.util.ErpUtil;
|
||||
import org.nl.wms.pm_manage.purchase.service.PurchaseService;
|
||||
@@ -46,11 +47,17 @@ public class DealPurchaseRecBillCallback implements CallbackStrategy {
|
||||
final String orderCode = param.getSource_bill_code();
|
||||
Purchasemst purchasemst = purchaseService.getOne(new LambdaQueryWrapper<Purchasemst>()
|
||||
.eq(Purchasemst::getBill_id, orderCode));
|
||||
if (PurchaseBillStatus.COMPLETED.getCode().equals(purchasemst.getBill_status())){
|
||||
throw new BadRequestException("重复入库!");
|
||||
}
|
||||
List<EasAuditRequestDto.EasAuditEntryDto> entryList = new ArrayList<>();
|
||||
Purchasedtl purchasedtl = purchasedtlService.getOne(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, orderCode)
|
||||
.eq(Purchasedtl::getItem_no, param.getSource_billdtl_id()));
|
||||
purchasedtl.setInstock_qty(param.getPlan_qty().add(purchasedtl.getInstock_qty()));
|
||||
if (purchasedtl.getInstock_qty().compareTo(purchasedtl.getQty())>0){//超过单据数量
|
||||
throw new BadRequestException("入库数量超出单据数量,物料:" + purchasedtl.getSku_code());
|
||||
}
|
||||
purchasedtlService.updateById(purchasedtl);
|
||||
List<Purchasedtl> list = purchasedtlService.list(new LambdaQueryWrapper<Purchasedtl>()
|
||||
.eq(Purchasedtl::getBill_id, orderCode));
|
||||
|
||||
Reference in New Issue
Block a user