opt:中鼎同步
This commit is contained in:
@@ -30,6 +30,7 @@ public class EXTConstant {
|
|||||||
*/
|
*/
|
||||||
public final static String QUERY_INVENTORY_ZD_API = "/app/restful/api/v3/wms/getInventoryList";
|
public final static String QUERY_INVENTORY_ZD_API = "/app/restful/api/v3/wms/getInventoryList";
|
||||||
|
|
||||||
public static final List<String> ZD_STOR_SET = Arrays.asList("6001");
|
public static final String ZD_STOR_SET = "ZD_STOR_SET";
|
||||||
|
// Arrays.asList("6001","6.011");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
|
import org.nl.config.SpringContextHolder;
|
||||||
|
import org.nl.wms.ext_manage.enums.EXTConstant;
|
||||||
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
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.WmsToZDWmdService;
|
||||||
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
|
import org.nl.wms.pm_manage.purchase.service.enums.PurchaseBillStatus;
|
||||||
@@ -13,11 +15,19 @@ import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
|
|||||||
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
|
import org.nl.wms.pm_manage.purchase.service.dao.Purchasemst;
|
||||||
import org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasedtlMapper;
|
import org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasedtlMapper;
|
||||||
import org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasemstMapper;
|
import org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasemstMapper;
|
||||||
|
import org.nl.wms.system_manage.enums.SysParamConstant;
|
||||||
|
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||||
|
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||||
|
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@@ -35,62 +45,64 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private WmsToZDWmdService wmsToZDWmdService;
|
private WmsToZDWmdService wmsToZDWmdService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysParamService iSysParamService;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void syncPurchaseBill(BillChangeDto billChangeDto) {
|
public void syncPurchaseBill(BillChangeDto billChangeDto) {
|
||||||
String billId = billChangeDto.getBillid();
|
String billId = billChangeDto.getBillid();
|
||||||
Integer status = billChangeDto.getStatus();//1:已提交;2:更新;3:删除;
|
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.CREATED.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){
|
switch (status){
|
||||||
case 1:
|
case 1:
|
||||||
|
case 2:
|
||||||
//增加单据
|
//增加单据
|
||||||
Purchasemst easMst = easQueryService.queryMst(billId);
|
Purchasemst easMst = easQueryService.queryMst(billId);
|
||||||
if (easMst == null) {
|
if (easMst == null) {
|
||||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||||
}
|
}
|
||||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
|
||||||
easMst.setModify_date(DateUtil.now());
|
|
||||||
List<Purchasedtl> easDtlList = easQueryService.queryDtlList(billId);
|
|
||||||
for (Purchasedtl dtl : easDtlList) {
|
|
||||||
purchasedtlMapper.insert(dtl);
|
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
|
||||||
//中鼎立库
|
|
||||||
easMst.setForwardZD(1);
|
|
||||||
//TODO 转发中鼎参数待确定
|
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
purchasemstMapper.insert(easMst);
|
|
||||||
|
|
||||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
//更新单据
|
|
||||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||||
.eq(Purchasedtl::getBill_id, billId));
|
.eq(Purchasedtl::getBill_id, billId));
|
||||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||||
.eq(Purchasemst::getBill_id, billId));
|
.eq(Purchasemst::getBill_id, billId));
|
||||||
|
//更新单据
|
||||||
//增加单据
|
List<Purchasedtl> easDtlList = easQueryService.queryDtlList(billId);
|
||||||
Purchasemst easMstUpdate = easQueryService.queryMst(billId);
|
Boolean allZD = true;
|
||||||
if (easMstUpdate == null) {
|
for (Purchasedtl dtl : easDtlList) {
|
||||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
if (ZD_STOR_SET.contains(dtl.getHouse_code())){
|
||||||
}
|
|
||||||
easMstUpdate.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
|
||||||
easMstUpdate.setModify_date(DateUtil.now());
|
|
||||||
List<Purchasedtl> easDtlListUpdate = easQueryService.queryDtlList(billId);
|
|
||||||
for (Purchasedtl dtl : easDtlListUpdate) {
|
|
||||||
purchasedtlMapper.insert(dtl);
|
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
|
||||||
//中鼎立库
|
//中鼎立库
|
||||||
easMstUpdate.setForwardZD(1);
|
dtl.setInstock_qty(dtl.getQty());
|
||||||
//TODO 转发中鼎参数待确定
|
easMst.setForwardZD(1);
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
easMst.setBill_status(PurchaseBillStatus.EXECUTING.getCode());
|
||||||
|
}else {
|
||||||
|
allZD = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
purchasemstMapper.insert(easMstUpdate);
|
if (easMst.getForwardZD()==1){
|
||||||
|
if (allZD){
|
||||||
log.info("EAS采购入库单更新完成, billId: {}", billId);
|
//如果全部都是中鼎的则由中鼎回传EAS
|
||||||
|
easMst.setBill_status(PurchaseBillStatus.COMPLETED.getCode());
|
||||||
|
}
|
||||||
|
//转发中鼎
|
||||||
|
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||||
|
}
|
||||||
|
purchasedtlMapper.batchSave(easDtlList);
|
||||||
|
purchasemstMapper.insert(easMst);
|
||||||
|
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//删除单据
|
//删除单据
|
||||||
@@ -105,56 +117,55 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
|||||||
public void syncTransferBill(BillChangeDto billChangeDto) {
|
public void syncTransferBill(BillChangeDto billChangeDto) {
|
||||||
String billId = billChangeDto.getBillid();
|
String billId = billChangeDto.getBillid();
|
||||||
Integer status = billChangeDto.getStatus();//1:已提交;2:更新;3:删除;
|
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.CREATED.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){
|
switch (status){
|
||||||
case 1:
|
case 1:
|
||||||
|
case 2:
|
||||||
//增加单据
|
//增加单据
|
||||||
Purchasemst easMst = easQueryService.queryMstByTransfer(billId);
|
Purchasemst easMst = easQueryService.queryMstByTransfer(billId);
|
||||||
if (easMst == null) {
|
if (easMst == null) {
|
||||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||||
}
|
}
|
||||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
|
||||||
easMst.setModify_date(DateUtil.now());
|
|
||||||
List<Purchasedtl> easDtlList = easQueryService.queryDtlListByTransfer(billId);
|
|
||||||
for (Purchasedtl dtl : easDtlList) {
|
|
||||||
purchasedtlMapper.insert(dtl);
|
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
|
||||||
//中鼎立库
|
|
||||||
easMst.setForwardZD(1);
|
|
||||||
//TODO 转发中鼎参数待确定
|
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
purchasemstMapper.insert(easMst);
|
|
||||||
|
|
||||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
//更新单据
|
|
||||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||||
.eq(Purchasedtl::getBill_id, billId));
|
.eq(Purchasedtl::getBill_id, billId));
|
||||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||||
.eq(Purchasemst::getBill_id, billId));
|
.eq(Purchasemst::getBill_id, billId));
|
||||||
|
//更新单据
|
||||||
//增加单据
|
List<Purchasedtl> easDtlList = easQueryService.queryDtlListByTransfer(billId);
|
||||||
Purchasemst easMstUpdate = easQueryService.queryMstByTransfer(billId);
|
Boolean allZD = true;
|
||||||
if (easMstUpdate == null) {
|
for (Purchasedtl dtl : easDtlList) {
|
||||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
if (ZD_STOR_SET.contains(dtl.getHouse_code())){
|
||||||
}
|
|
||||||
easMstUpdate.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
|
||||||
easMstUpdate.setModify_date(DateUtil.now());
|
|
||||||
List<Purchasedtl> easDtlListUpdate = easQueryService.queryDtlListByTransfer(billId);
|
|
||||||
for (Purchasedtl dtl : easDtlListUpdate) {
|
|
||||||
purchasedtlMapper.insert(dtl);
|
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
|
||||||
//中鼎立库
|
//中鼎立库
|
||||||
easMstUpdate.setForwardZD(1);
|
dtl.setInstock_qty(dtl.getQty());
|
||||||
//TODO 转发中鼎参数待确定
|
easMst.setForwardZD(1);
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
easMst.setBill_status(PurchaseBillStatus.EXECUTING.getCode());
|
||||||
|
}else {
|
||||||
|
allZD = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
purchasemstMapper.insert(easMstUpdate);
|
if (easMst.getForwardZD()==1){
|
||||||
|
if (allZD){
|
||||||
log.info("EAS采购入库单更新完成, billId: {}", billId);
|
//如果全部都是中鼎的则由中鼎回传EAS
|
||||||
|
easMst.setBill_status(PurchaseBillStatus.COMPLETED.getCode());
|
||||||
|
}
|
||||||
|
//转发中鼎
|
||||||
|
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||||
|
}
|
||||||
|
purchasedtlMapper.batchSave(easDtlList);
|
||||||
|
purchasemstMapper.insert(easMst);
|
||||||
|
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//删除单据
|
//删除单据
|
||||||
@@ -169,56 +180,55 @@ public class InboundEasSyncServiceImpl implements InboundEasSyncService {
|
|||||||
public void syncOtherBill(BillChangeDto billChangeDto) {
|
public void syncOtherBill(BillChangeDto billChangeDto) {
|
||||||
String billId = billChangeDto.getBillid();
|
String billId = billChangeDto.getBillid();
|
||||||
Integer status = billChangeDto.getStatus();//1:已提交;2:更新;3:删除;
|
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.CREATED.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){
|
switch (status){
|
||||||
case 1:
|
case 1:
|
||||||
|
case 2:
|
||||||
//增加单据
|
//增加单据
|
||||||
Purchasemst easMst = easQueryService.queryMstByOther(billId);
|
Purchasemst easMst = easQueryService.queryMstByOther(billId);
|
||||||
if (easMst == null) {
|
if (easMst == null) {
|
||||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
||||||
}
|
}
|
||||||
easMst.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
|
||||||
easMst.setModify_date(DateUtil.now());
|
|
||||||
List<Purchasedtl> easDtlList = easQueryService.queryDtlListByOther(billId);
|
|
||||||
for (Purchasedtl dtl : easDtlList) {
|
|
||||||
purchasedtlMapper.insert(dtl);
|
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
|
||||||
//中鼎立库
|
|
||||||
easMst.setForwardZD(1);
|
|
||||||
//TODO 转发中鼎参数待确定
|
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
purchasemstMapper.insert(easMst);
|
|
||||||
|
|
||||||
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
//更新单据
|
|
||||||
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
purchasedtlMapper.delete(new LambdaQueryWrapper<Purchasedtl>()
|
||||||
.eq(Purchasedtl::getBill_id, billId));
|
.eq(Purchasedtl::getBill_id, billId));
|
||||||
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
purchasemstMapper.delete(new LambdaQueryWrapper<Purchasemst>()
|
||||||
.eq(Purchasemst::getBill_id, billId));
|
.eq(Purchasemst::getBill_id, billId));
|
||||||
|
//更新单据
|
||||||
//增加单据
|
List<Purchasedtl> easDtlList = easQueryService.queryDtlListByOther(billId);
|
||||||
Purchasemst easMstUpdate = easQueryService.queryMstByOther(billId);
|
Boolean allZD = true;
|
||||||
if (easMstUpdate == null) {
|
for (Purchasedtl dtl : easDtlList) {
|
||||||
throw new BadRequestException("EAS采购单同步失败:EAS系统中未找到单据: " + billId);
|
if (ZD_STOR_SET.contains(dtl.getHouse_code())){
|
||||||
}
|
|
||||||
easMstUpdate.setBill_status(PurchaseBillStatus.CREATED.getCode());
|
|
||||||
easMstUpdate.setModify_date(DateUtil.now());
|
|
||||||
List<Purchasedtl> easDtlListUpdate = easQueryService.queryDtlListByOther(billId);
|
|
||||||
for (Purchasedtl dtl : easDtlListUpdate) {
|
|
||||||
purchasedtlMapper.insert(dtl);
|
|
||||||
if (dtl.getHouse_code().contains("ZDLK")){
|
|
||||||
//中鼎立库
|
//中鼎立库
|
||||||
easMstUpdate.setForwardZD(1);
|
dtl.setInstock_qty(dtl.getQty());
|
||||||
//TODO 转发中鼎参数待确定
|
easMst.setForwardZD(1);
|
||||||
wmsToZDWmdService.syncPurchaseReceiving(new JSONObject());
|
easMst.setBill_status(PurchaseBillStatus.EXECUTING.getCode());
|
||||||
|
}else {
|
||||||
|
allZD = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
purchasemstMapper.insert(easMstUpdate);
|
if (easMst.getForwardZD()==1){
|
||||||
|
if (allZD){
|
||||||
log.info("EAS采购入库单更新完成, billId: {}", billId);
|
//如果全部都是中鼎的则由中鼎回传EAS
|
||||||
|
easMst.setBill_status(PurchaseBillStatus.COMPLETED.getCode());
|
||||||
|
}
|
||||||
|
//转发中鼎
|
||||||
|
wmsToZDWmdService.syncPurchaseReceiving(billChangeDto);
|
||||||
|
}
|
||||||
|
purchasedtlMapper.batchSave(easDtlList);
|
||||||
|
purchasemstMapper.insert(easMst);
|
||||||
|
log.info("EAS采购入库单同步完成, billId: {}, 明细数: {}", billId, easDtlList.size());
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//删除单据
|
//删除单据
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
package org.nl.wms.ext_manage.service;
|
package org.nl.wms.ext_manage.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.nl.common.utils.MapOf;
|
||||||
|
import org.nl.wms.ext_manage.purchase.service.dto.BillChangeDto;
|
||||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
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.demand.service.dto.PmDemandDto;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -17,6 +20,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface WmsToZDWmdService {
|
public interface WmsToZDWmdService {
|
||||||
|
|
||||||
|
public static Map<String,String> ZD_LOS_MAPPING = MapOf.of("EP2","6.002");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生产领料需求单下发
|
* 生产领料需求单下发
|
||||||
*
|
*
|
||||||
@@ -28,9 +33,9 @@ public interface WmsToZDWmdService {
|
|||||||
ResponseEntity syncDemandOrder(List<PmDemandDto> demands);
|
ResponseEntity syncDemandOrder(List<PmDemandDto> demands);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购入库单下发
|
* EAS入库单下发
|
||||||
*/
|
*/
|
||||||
ResponseEntity syncPurchaseReceiving(JSONObject whereJson);
|
ResponseEntity syncPurchaseReceiving(BillChangeDto billChangeDto);
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import com.alibaba.fastjson.JSON;
|
|||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.common.annotation.Mock;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.config.SpringContextHolder;
|
import org.nl.config.SpringContextHolder;
|
||||||
import org.nl.wms.ext_manage.enums.EXTConstant;
|
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.WmsToZDWmdService;
|
||||||
import org.nl.wms.ext_manage.service.dto.ZDInventory;
|
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.demand.service.dto.PmDemandDto;
|
||||||
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -27,13 +29,41 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
|||||||
@Override
|
@Override
|
||||||
public ResponseEntity syncDemandOrder(List<PmDemandDto> demands) {
|
public ResponseEntity syncDemandOrder(List<PmDemandDto> demands) {
|
||||||
log.info("syncDemandOrder生产领料需求单下发输入参数:-------------------" + demands.size());
|
log.info("syncDemandOrder生产领料需求单下发输入参数:-------------------" + demands.size());
|
||||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL).getValue();
|
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_REQUISITION).getValue();
|
||||||
try {
|
try {
|
||||||
|
//数据转换
|
||||||
|
List<Map<String, Object>> targetList = new ArrayList<>();
|
||||||
|
for (PmDemandDto demand : demands) {
|
||||||
|
java.util.Map<String, Object> map = new java.util.HashMap<>();
|
||||||
|
map.put("Id", demand.getId());
|
||||||
|
map.put("Creator", demand.getCreator());
|
||||||
|
map.put("CreateTime", demand.getCreateTime());
|
||||||
|
map.put("Priority", demand.getPriority());
|
||||||
|
map.put("Status", 0);
|
||||||
|
map.put("WorkOrder", demand.getWorkOrder());
|
||||||
|
map.put("SkuCode", demand.getSkuCode());
|
||||||
|
map.put("SkuName", demand.getSkuName());
|
||||||
|
map.put("Qty", demand.getQty().intValue());
|
||||||
|
map.put("Unit", demand.getUnit());
|
||||||
|
map.put("TargetArea", demand.getTargetArea());
|
||||||
|
map.put("ProductionLine", demand.getProductionLine());
|
||||||
|
map.put("Source", demand.getProductionLine());
|
||||||
|
map.put("CarrierType", demand.getCarrierType());
|
||||||
|
map.put("TargetHouseCode", demand.getTargetHouseCode());
|
||||||
|
map.put("SN", demand.getSn());
|
||||||
|
targetList.add(map);
|
||||||
|
}
|
||||||
|
final String param = JSON.toJSONString(targetList);
|
||||||
|
log.info("syncDemandOrder需求单请求参数:-------------------" + param);
|
||||||
String resultMsg = HttpRequest.post(url)
|
String resultMsg = HttpRequest.post(url)
|
||||||
.body(JSONArray.parseArray(JSON.toJSONString(demands)).toJSONString())
|
.body(JSONArray.parseArray(param).toJSONString())
|
||||||
.execute().body();
|
.execute().body();
|
||||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||||
log.info("syncDemandOrder需求单下发输出参数:-------------------" + result.toString());
|
log.info("syncDemandOrder需求单下发输出参数:-------------------" + result.toString());
|
||||||
|
Integer respCode = result.getInteger("respCode");
|
||||||
|
if (respCode == null || respCode != 0) {
|
||||||
|
throw new BadRequestException("中鼎库存查询失败:" + result.getString("respMsg"));
|
||||||
|
}
|
||||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
throw new BadRequestException("中鼎需求单下发失败:" + e.getMessage());
|
||||||
@@ -41,38 +71,42 @@ public class WmsToZDWmdServiceImpl implements WmsToZDWmdService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResponseEntity syncPurchaseReceiving(JSONObject whereJson) {
|
public ResponseEntity syncPurchaseReceiving(BillChangeDto billChangeDto) {
|
||||||
log.info("syncPurchaseReceiving采购入库单下发输入参数:-------------------" + whereJson.toString());
|
final String param = JSON.toJSONString(billChangeDto);
|
||||||
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL).getValue();
|
log.info("syncPurchaseReceiving采购入库单下发输入参数:-------------------" + param);
|
||||||
|
String url = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_REQUISITION).getValue();
|
||||||
try {
|
try {
|
||||||
String resultMsg = HttpRequest.post(url)
|
String resultMsg = HttpRequest.post(url)
|
||||||
.body(whereJson.toString())
|
.body(param)
|
||||||
.execute().body();
|
.execute().body();
|
||||||
JSONObject result = JSONObject.parseObject(resultMsg);
|
JSONObject result = JSONObject.parseObject(resultMsg);
|
||||||
|
Integer respCode = result.getInteger("respCode");
|
||||||
|
if (respCode == null || respCode != 0) {
|
||||||
|
throw new BadRequestException("中鼎单据下推失败:" + result.getString("respMsg"));
|
||||||
|
}
|
||||||
log.info("syncPurchaseReceiving采购入库单下发输出参数:-------------------" + result.toString());
|
log.info("syncPurchaseReceiving采购入库单下发输出参数:-------------------" + result.toString());
|
||||||
return new ResponseEntity<>(result, HttpStatus.OK);
|
return new ResponseEntity<>(result, HttpStatus.OK);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BadRequestException("中鼎采购入库单下发失败:" + e.getMessage());
|
throw new BadRequestException("中鼎单据下推失败:" + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Mock(desc = "库存查询mock",enable = true)
|
||||||
public ResponseEntity<List<ZDInventory>> queryInventory(String skuCode) {
|
public ResponseEntity<List<ZDInventory>> queryInventory(String skuCode) {
|
||||||
List<ZDInventory> inventorys = new ArrayList<>();
|
List<ZDInventory> inventorys = new ArrayList<>();
|
||||||
log.info("queryInventory查询SKU库存输入参数:skuCode={}", skuCode);
|
log.info("queryInventory查询SKU库存输入参数:skuCode={}", skuCode);
|
||||||
Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL);
|
Param param = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode(SysParamConstant.ZD_URL_LOC);
|
||||||
if (param==null){
|
if (param==null){
|
||||||
return new ResponseEntity<>(inventorys, HttpStatus.OK);
|
return new ResponseEntity<>(inventorys, HttpStatus.OK);
|
||||||
// throw new BadRequestException("查询中鼎库存失败,接口地址未配置");
|
// throw new BadRequestException("查询中鼎库存失败,接口地址未配置");
|
||||||
}
|
}
|
||||||
String baseUrl = param.getValue();
|
String url = param.getValue();
|
||||||
String url = baseUrl + EXTConstant.QUERY_INVENTORY_ZD_API;
|
|
||||||
|
|
||||||
JSONObject requestBody = new JSONObject();
|
JSONObject requestBody = new JSONObject();
|
||||||
|
requestBody.put("SkuCode", "");
|
||||||
requestBody.put("SkuCode", skuCode);
|
requestBody.put("SkuCode", skuCode);
|
||||||
requestBody.put("HouseCode", "");
|
requestBody.put("HouseCode", "6.002");
|
||||||
requestBody.put("HouseCodeLis", new JSONArray());
|
requestBody.put("HouseCodeLis", new JSONArray());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String resultMsg = HttpRequest.post(url)
|
String resultMsg = HttpRequest.post(url)
|
||||||
.contentType("application/json")
|
.contentType("application/json")
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ public class PmDemand extends Model<PmDemand> {
|
|||||||
@TableField("target_area")
|
@TableField("target_area")
|
||||||
private String target_area;
|
private String target_area;
|
||||||
|
|
||||||
|
@TableField("target_house_code")
|
||||||
|
private String target_house_code;
|
||||||
|
|
||||||
|
@TableField("carrier_type")
|
||||||
|
private String carrier_type;
|
||||||
|
|
||||||
@TableField("production_line")
|
@TableField("production_line")
|
||||||
private String production_line;
|
private String production_line;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
<result property="assignQty" column="assign_qty"/>
|
<result property="assignQty" column="assign_qty"/>
|
||||||
<result property="unit" column="unit"/>
|
<result property="unit" column="unit"/>
|
||||||
<result property="targetArea" column="target_area"/>
|
<result property="targetArea" column="target_area"/>
|
||||||
|
<result property="targetHouseCode" column="target_house_code"/>
|
||||||
|
<result property="carrierType" column="carrier_type"/>
|
||||||
<result property="productionLine" column="production_line"/>
|
<result property="productionLine" column="production_line"/>
|
||||||
<result property="sn" column="sn"/>
|
<result property="sn" column="sn"/>
|
||||||
<result property="createAt" column="create_at"/>
|
<result property="createAt" column="create_at"/>
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ public class PmDemandDto implements Serializable {
|
|||||||
private BigDecimal assignQty;
|
private BigDecimal assignQty;
|
||||||
private String unit;
|
private String unit;
|
||||||
private String targetArea;
|
private String targetArea;
|
||||||
|
private String targetHouseCode;
|
||||||
|
private String carrierType;
|
||||||
private String productionLine;
|
private String productionLine;
|
||||||
private String sn;
|
private String sn;
|
||||||
private String createAt;
|
private String createAt;
|
||||||
|
|||||||
@@ -19,58 +19,65 @@ import java.math.BigDecimal;
|
|||||||
public class PmDemandParam {
|
public class PmDemandParam {
|
||||||
|
|
||||||
@NotBlank(message = "单据唯一ID不能为空")
|
@NotBlank(message = "单据唯一ID不能为空")
|
||||||
@JsonProperty(value = "Id")
|
@JsonProperty(value = "id")
|
||||||
private String Id;
|
private String id;
|
||||||
|
|
||||||
@NotBlank(message = "操作人不能为空")
|
@NotBlank(message = "操作人不能为空")
|
||||||
@JsonProperty(value = "Creator")
|
@JsonProperty(value = "creator")
|
||||||
private String Creator;
|
private String creator;
|
||||||
|
|
||||||
@NotBlank(message = "需求日期不能为空")
|
@NotBlank(message = "需求日期不能为空")
|
||||||
@JsonProperty(value = "CreateTime")
|
@JsonProperty(value = "createTime")
|
||||||
private String CreateTime;
|
private String createTime;
|
||||||
|
|
||||||
@NotNull(message = "优先级不能为空")
|
@NotNull(message = "优先级不能为空")
|
||||||
@JsonProperty(value = "Priority")
|
@JsonProperty(value = "priority")
|
||||||
private Integer Priority;
|
private Integer priority;
|
||||||
|
|
||||||
@JsonProperty(value = "Status")
|
@JsonProperty(value = "status")
|
||||||
private String Status;
|
private String status;
|
||||||
|
|
||||||
@NotBlank(message = "工单编号不能为空")
|
@NotBlank(message = "工单编号不能为空")
|
||||||
@JsonProperty(value = "WorkOrder")
|
@JsonProperty(value = "workOrder")
|
||||||
private String WorkOrder;
|
private String workOrder;
|
||||||
|
|
||||||
@NotBlank(message = "物料编码不能为空")
|
@NotBlank(message = "物料编码不能为空")
|
||||||
@JsonProperty(value = "SkuCode")
|
@JsonProperty(value = "skuCode")
|
||||||
private String SkuCode;
|
private String skuCode;
|
||||||
|
|
||||||
@NotBlank(message = "物料名称不能为空")
|
@NotBlank(message = "物料名称不能为空")
|
||||||
@JsonProperty(value = "SkuName")
|
@JsonProperty(value = "skuName")
|
||||||
private String SkuName;
|
private String skuName;
|
||||||
|
|
||||||
@NotNull(message = "数量不能为空")
|
@NotNull(message = "数量不能为空")
|
||||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||||
@JsonProperty(value = "Qty")
|
@JsonProperty(value = "qty")
|
||||||
private BigDecimal Qty;
|
private BigDecimal qty;
|
||||||
|
|
||||||
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
@DecimalMin(value = "0", inclusive = false, message = "数量必须大于0")
|
||||||
@JsonProperty(value = "QssignQty")
|
@JsonProperty(value = "qssignQty")
|
||||||
private BigDecimal QssignQty;
|
private BigDecimal qssignQty;
|
||||||
|
|
||||||
@NotBlank(message = "单位不能为空")
|
@NotBlank(message = "单位不能为空")
|
||||||
@JsonProperty(value = "Unit")
|
@JsonProperty(value = "unit")
|
||||||
private String Unit;
|
private String unit;
|
||||||
|
|
||||||
@NotBlank(message = "目标库存地点不能为空")
|
@NotBlank(message = "目标库存地点不能为空")
|
||||||
@JsonProperty(value = "TargetArea")
|
@JsonProperty(value = "targetArea")
|
||||||
private String TargetArea;
|
private String targetArea;
|
||||||
|
|
||||||
@NotBlank(message = "产线不能为空")
|
@NotBlank(message = "产线不能为空")
|
||||||
@JsonProperty(value = "ProductionLine")
|
@JsonProperty(value = "productionLine")
|
||||||
private String ProductionLine;
|
private String productionLine;
|
||||||
|
@NotBlank(message = "目标库存地点不能为空")
|
||||||
|
@JsonProperty(value = "targetHouseCode")
|
||||||
|
private String targetHouseCode;
|
||||||
|
|
||||||
@JsonProperty(value = "SN")
|
@NotBlank(message = "产线不能为空")
|
||||||
private String SN;
|
@JsonProperty(value = "carrierType")
|
||||||
|
private String carrierType;
|
||||||
|
|
||||||
|
@JsonProperty(value = "sn")
|
||||||
|
private String sn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ public class PmDemandQuery extends BaseQuery<PmDemand> {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
private String workOrder;
|
private String workOrder;
|
||||||
private String skuCode;
|
private String skuCode;
|
||||||
|
private String targetHouseCode;
|
||||||
|
private String carrierType;
|
||||||
private String productionLine;
|
private String productionLine;
|
||||||
private String targetArea;
|
private String targetArea;
|
||||||
private String startTime;
|
private String startTime;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.nl.common.domain.query.PageQuery;
|
import org.nl.common.domain.query.PageQuery;
|
||||||
import org.nl.common.exception.BadRequestException;
|
import org.nl.common.exception.BadRequestException;
|
||||||
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
import org.nl.wms.basedata_manage.service.IMdMeMaterialbaseService;
|
||||||
@@ -26,6 +27,9 @@ import org.nl.wms.pm_manage.demand.service.dto.PmDemandParam;
|
|||||||
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
|
import org.nl.wms.pm_manage.demand.service.dto.PmDemandQuery;
|
||||||
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
|
import org.nl.wms.pm_manage.demand.service.enums.DemandStatus;
|
||||||
import org.nl.wms.sch_manage.enums.StatusEnum;
|
import org.nl.wms.sch_manage.enums.StatusEnum;
|
||||||
|
import org.nl.wms.system_manage.service.param.ISysParamService;
|
||||||
|
import org.nl.wms.system_manage.service.param.dao.Param;
|
||||||
|
import org.nl.wms.system_manage.service.param.impl.SysParamServiceImpl;
|
||||||
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
import org.nl.wms.warehouse_manage.enums.IOSEnum;
|
||||||
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
import org.nl.wms.warehouse_manage.inAndOut.service.IOutBillService;
|
||||||
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
import org.nl.wms.warehouse_manage.inventory.IStInventoryService;
|
||||||
@@ -57,7 +61,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
private IMdMeMaterialbaseService iMdMeMaterialbaseService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdPbMeasureunitService iMdPbMeasureunitService;
|
private ISysParamService iSysParamService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PmDemandDto> queryPage(PmDemandQuery query, PageQuery pageQuery) {
|
public Page<PmDemandDto> queryPage(PmDemandQuery query, PageQuery pageQuery) {
|
||||||
@@ -84,8 +88,10 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
demand.setQty(param.getQty());
|
demand.setQty(param.getQty());
|
||||||
demand.setUnit(param.getUnit());
|
demand.setUnit(param.getUnit());
|
||||||
demand.setTarget_area(param.getTargetArea());
|
demand.setTarget_area(param.getTargetArea());
|
||||||
|
demand.setTarget_house_code(param.getTargetHouseCode());
|
||||||
|
demand.setCarrier_type(param.getCarrierType());
|
||||||
demand.setProduction_line(param.getProductionLine());
|
demand.setProduction_line(param.getProductionLine());
|
||||||
demand.setSn(param.getSN());
|
demand.setSn(param.getSn());
|
||||||
demand.setCreate_at(DateUtil.now());
|
demand.setCreate_at(DateUtil.now());
|
||||||
this.save(demand);
|
this.save(demand);
|
||||||
}
|
}
|
||||||
@@ -171,7 +177,12 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
demandDto.setSkuCode(item.getSkuCode());
|
demandDto.setSkuCode(item.getSkuCode());
|
||||||
demandDto.setSkuName(null);
|
demandDto.setSkuName(null);
|
||||||
demandDto.setQty(item.getQty());
|
demandDto.setQty(item.getQty());
|
||||||
demandDto.setHouseCode(item.getHouseCode());
|
//中鼎库存有映射
|
||||||
|
String houseMapping = WmsToZDWmdService.ZD_LOS_MAPPING.get(item.getHouseCode());
|
||||||
|
if (StringUtils.isEmpty(houseMapping)){
|
||||||
|
throw new BadRequestException("分配失败,当前中鼎仓库编码未配置映射");
|
||||||
|
}
|
||||||
|
demandDto.setHouseCode(houseMapping);
|
||||||
demandDto.setHouseName(null);
|
demandDto.setHouseName(null);
|
||||||
resultList.add(demandDto);
|
resultList.add(demandDto);
|
||||||
}
|
}
|
||||||
@@ -190,8 +201,15 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
throw new BadRequestException("下推失败,单据状态不为已分配不能下推");
|
throw new BadRequestException("下推失败,单据状态不为已分配不能下推");
|
||||||
}
|
}
|
||||||
// 一次性分成两组
|
// 一次性分成两组
|
||||||
|
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<>();
|
||||||
|
}
|
||||||
Map<Boolean, List<PmDemandDto>> partitioned = pmDemandDtos.stream()
|
Map<Boolean, List<PmDemandDto>> partitioned = pmDemandDtos.stream()
|
||||||
.collect(Collectors.partitioningBy(a -> EXTConstant.ZD_STOR_SET
|
.collect(Collectors.partitioningBy(a -> ZD_STOR_SET
|
||||||
.contains(JSONObject.parseObject(a.getInventoryDis()).getString("horseCode"))));
|
.contains(JSONObject.parseObject(a.getInventoryDis()).getString("horseCode"))));
|
||||||
List<PmDemandDto> zdDemands = partitioned.get(true);
|
List<PmDemandDto> zdDemands = partitioned.get(true);
|
||||||
List<PmDemandDto> otherDemands = partitioned.get(false);
|
List<PmDemandDto> otherDemands = partitioned.get(false);
|
||||||
@@ -235,7 +253,11 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
|
|||||||
for (PmDemandDto demand : demands) {
|
for (PmDemandDto demand : demands) {
|
||||||
JSONObject detailRow = new JSONObject();
|
JSONObject detailRow = new JSONObject();
|
||||||
detailRow.put("material_code", demand.getSkuCode());
|
detailRow.put("material_code", demand.getSkuCode());
|
||||||
detailRow.put("material_id", codeToIdMap.get(demand.getSkuCode()).getMaterial_id());
|
MdMeMaterialbase materialbase = codeToIdMap.get(demand.getSkuCode());
|
||||||
|
if (materialbase == null){
|
||||||
|
throw new BadRequestException("下推失败,"+demand.getSkuCode()+"在WMS中不存在");
|
||||||
|
}
|
||||||
|
detailRow.put("material_id", materialbase.getMaterial_id());
|
||||||
detailRow.put("qty_unit_name", demand.getUnit());
|
detailRow.put("qty_unit_name", demand.getUnit());
|
||||||
detailRow.put("qty_unit_id", codeToIdMap.get(demand.getSkuCode()).getQty_unit_id());
|
detailRow.put("qty_unit_id", codeToIdMap.get(demand.getSkuCode()).getQty_unit_id());
|
||||||
detailRow.put("qty", demand.getQty());
|
detailRow.put("qty", demand.getQty());
|
||||||
|
|||||||
@@ -8,6 +8,9 @@ import lombok.EqualsAndHashCode;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购入库单分录信息表实体类
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@TableName("st_ivt_purchasedtl")
|
@TableName("st_ivt_purchasedtl")
|
||||||
@@ -15,36 +18,84 @@ public class Purchasedtl implements Serializable {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自增主键ID
|
||||||
|
*/
|
||||||
@TableId("id")
|
@TableId("id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分录id
|
||||||
|
*/
|
||||||
private String entry_id;
|
private String entry_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单据主表关联id
|
||||||
|
*/
|
||||||
private String bill_id;
|
private String bill_id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 行号
|
||||||
|
*/
|
||||||
private String item_no;
|
private String item_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类编码
|
||||||
|
*/
|
||||||
private String category_code;
|
private String category_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类名称
|
||||||
|
*/
|
||||||
private String category_name;
|
private String category_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料编码
|
||||||
|
*/
|
||||||
private String sku_code;
|
private String sku_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料名称
|
||||||
|
*/
|
||||||
private String sku_name;
|
private String sku_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 物料规格
|
||||||
|
*/
|
||||||
private String model;
|
private String model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仓库号
|
||||||
|
*/
|
||||||
private String house_code;
|
private String house_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批次号
|
||||||
|
*/
|
||||||
private String batch_no;
|
private String batch_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数量
|
||||||
|
*/
|
||||||
private BigDecimal qty;
|
private BigDecimal qty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位编码
|
||||||
|
*/
|
||||||
private String unit_code;
|
private String unit_code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单位
|
||||||
|
*/
|
||||||
private String unit;
|
private String unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跟踪号
|
||||||
|
*/
|
||||||
private String track_no;
|
private String track_no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已入库数量
|
||||||
|
*/
|
||||||
private BigDecimal instock_qty;
|
private BigDecimal instock_qty;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
|
import org.nl.wms.pm_manage.purchase.service.dao.Purchasedtl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface PurchasedtlMapper extends BaseMapper<Purchasedtl> {
|
public interface PurchasedtlMapper extends BaseMapper<Purchasedtl> {
|
||||||
|
|
||||||
|
void batchSave(List<Purchasedtl> entitys);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,44 @@
|
|||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasedtlMapper">
|
<mapper namespace="org.nl.wms.pm_manage.purchase.service.dao.mapper.PurchasedtlMapper">
|
||||||
|
|
||||||
|
<insert id="batchSave" parameterType="java.util.List">
|
||||||
|
INSERT INTO st_ivt_purchasedtl (
|
||||||
|
id,
|
||||||
|
entry_id,
|
||||||
|
bill_id,
|
||||||
|
item_no,
|
||||||
|
category_code,
|
||||||
|
category_name,
|
||||||
|
sku_code,
|
||||||
|
sku_name,
|
||||||
|
model,
|
||||||
|
house_code,
|
||||||
|
batch_no,
|
||||||
|
qty,
|
||||||
|
unit_code,
|
||||||
|
unit,
|
||||||
|
track_no,
|
||||||
|
instock_qty
|
||||||
|
) VALUES
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(
|
||||||
|
#{item.id},
|
||||||
|
#{item.entryId},
|
||||||
|
#{item.billId},
|
||||||
|
#{item.itemNo},
|
||||||
|
#{item.categoryCode},
|
||||||
|
#{item.categoryName},
|
||||||
|
#{item.skuCode},
|
||||||
|
#{item.skuName},
|
||||||
|
#{item.model},
|
||||||
|
#{item.houseCode},
|
||||||
|
#{item.batchNo},
|
||||||
|
#{item.qty},
|
||||||
|
#{item.unitCode},
|
||||||
|
#{item.unit},
|
||||||
|
#{item.trackNo},
|
||||||
|
#{item.instockQty}
|
||||||
|
)
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ public class SysParamConstant {
|
|||||||
/**
|
/**
|
||||||
* 中鼎系统URL
|
* 中鼎系统URL
|
||||||
*/
|
*/
|
||||||
public final static String ZD_URL = "zd_url";
|
public final static String ZD_URL_REQUISITION = "ZD_URL_REQUISITION";
|
||||||
|
public final static String ZD_URL_LOC = "ZD_URL_LOC";
|
||||||
|
public final static String ZD_URL_IOORDER = "ZD_URL_IOORDER";
|
||||||
/**
|
/**
|
||||||
* MES URL
|
* MES URL
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
|||||||
param.setUpdate_id(currentUserId);
|
param.setUpdate_id(currentUserId);
|
||||||
param.setUpdate_name(nickName);
|
param.setUpdate_name(nickName);
|
||||||
param.setUpdate_time(now);
|
param.setUpdate_time(now);
|
||||||
|
param.setZh_name(param.getName());
|
||||||
|
param.setEn_name(param.getName());
|
||||||
|
param.setIn_name(param.getName());
|
||||||
paramMapper.insert(param);
|
paramMapper.insert(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -284,6 +284,9 @@ public class OutBillServiceImpl extends ServiceImpl<IOStorInvMapper,IOStorInv> i
|
|||||||
}
|
}
|
||||||
bsrealStorattr = iBsrealStorattrService.findByCode(storCode);
|
bsrealStorattr = iBsrealStorattrService.findByCode(storCode);
|
||||||
}
|
}
|
||||||
|
if (bsrealStorattr == null){
|
||||||
|
throw new BadRequestException("生成出库单失败,仓库编码不存在");
|
||||||
|
}
|
||||||
map.put("iostorinv_id", iostorinv_id);
|
map.put("iostorinv_id", iostorinv_id);
|
||||||
map.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
map.put("bill_code", CodeUtil.getNewCode("OUT_STORE_CODE"));
|
||||||
map.put("biz_date", map.getString("biz_date").substring(0, 10));
|
map.put("biz_date", map.getString("biz_date").substring(0, 10));
|
||||||
|
|||||||
@@ -52,17 +52,17 @@
|
|||||||
物料:<strong>{{ currentDemand.skuCode }} {{ currentDemand.skuName }}</strong> |
|
物料:<strong>{{ currentDemand.skuCode }} {{ currentDemand.skuName }}</strong> |
|
||||||
需求数量:<strong style="color:#E6A23C;">{{ currentDemand.qty }} {{ currentDemand.unit }}</strong>
|
需求数量:<strong style="color:#E6A23C;">{{ currentDemand.qty }} {{ currentDemand.unit }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<el-table ref="allocateTable" :data="inventoryList" size="small" border v-loading="inventoryLoading" @selection-change="handleInventorySelection">
|
<el-table ref="allocateTable" v-loading="inventoryLoading" :data="inventoryList" size="small" border @selection-change="handleInventorySelection">
|
||||||
<el-table-column type="selection" width="45" />
|
<el-table-column type="selection" width="45" />
|
||||||
<el-table-column prop="houseCode" label="仓库编号" min-width="130" show-overflow-tooltip />
|
<el-table-column prop="houseCode" label="仓库编号" min-width="130" show-overflow-tooltip />
|
||||||
<el-table-column prop="houseName" label="仓库名称" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="houseName" label="仓库名称" min-width="140" show-overflow-tooltip />
|
||||||
<el-table-column prop="skuCode" label="物料编码" min-width="130" show-overflow-tooltip />
|
<el-table-column prop="skuCode" label="物料编码" min-width="130" show-overflow-tooltip />
|
||||||
<el-table-column prop="qty" label="库存数量" width="110" />
|
<el-table-column prop="qty" label="库存数量" width="110" />
|
||||||
<el-table-column label="分配数量" width="160">
|
<!-- <el-table-column label="分配数量" width="160">-->
|
||||||
<template slot-scope="scope">
|
<!-- <template slot-scope="scope">-->
|
||||||
<el-input-number v-model="scope.row.allocQty" :min="0" :max="scope.row.qty" :precision="4" size="mini" style="width:130px;" :disabled="!scope.row._selected" />
|
<!-- <el-input-number v-model="scope.row.allocQty" :min="0" :max="scope.row.qty" :precision="4" size="mini" style="width:130px;" :disabled="!scope.row._selected" />-->
|
||||||
</template>
|
<!-- </template>-->
|
||||||
</el-table-column>
|
<!-- </el-table-column>-->
|
||||||
</el-table>
|
</el-table>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button size="mini" @click="closeAllocateDialog">取消</el-button>
|
<el-button size="mini" @click="closeAllocateDialog">取消</el-button>
|
||||||
@@ -88,6 +88,8 @@
|
|||||||
<el-table-column prop="assignQty" label="已分配数量" width="100" />
|
<el-table-column prop="assignQty" label="已分配数量" width="100" />
|
||||||
<el-table-column prop="unit" label="单位" width="80" />
|
<el-table-column prop="unit" label="单位" width="80" />
|
||||||
<el-table-column prop="targetArea" label="目标库存地点" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="targetArea" label="目标库存地点" min-width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="targetHouseCode" label="目标库" min-width="140" show-overflow-tooltip />
|
||||||
|
<el-table-column prop="carrierType" label="托盘类型" min-width="140" show-overflow-tooltip />
|
||||||
<el-table-column prop="productionLine" label="产线" min-width="100" show-overflow-tooltip />
|
<el-table-column prop="productionLine" label="产线" min-width="100" show-overflow-tooltip />
|
||||||
<el-table-column prop="sn" label="车辆序列号" min-width="140" show-overflow-tooltip />
|
<el-table-column prop="sn" label="车辆序列号" min-width="140" show-overflow-tooltip />
|
||||||
<el-table-column prop="createAt" label="创建时间" min-width="160" show-overflow-tooltip />
|
<el-table-column prop="createAt" label="创建时间" min-width="160" show-overflow-tooltip />
|
||||||
@@ -182,11 +184,12 @@ export default {
|
|||||||
this.allocateVisible = true
|
this.allocateVisible = true
|
||||||
this.inventoryLoading = true
|
this.inventoryLoading = true
|
||||||
queryInventory(row.skuCode).then(res => {
|
queryInventory(row.skuCode).then(res => {
|
||||||
const demandQty = Number(row.qty) || 0
|
// const demandQty = Number(row.qty) || 0
|
||||||
this.inventoryList = (res || []).map(item => ({
|
this.inventoryList = (res || []).map(item => ({
|
||||||
...item,
|
...item,
|
||||||
_selected: false,
|
_selected: false,
|
||||||
allocQty: Math.min(Number(item.qty) || 0, demandQty)
|
allocQty: row.qty
|
||||||
|
// Math.min(Number(item.qty) || 0, demandQty)
|
||||||
}))
|
}))
|
||||||
if (row.inventoryDis) {
|
if (row.inventoryDis) {
|
||||||
try {
|
try {
|
||||||
@@ -215,9 +218,32 @@ export default {
|
|||||||
this.selectedInventory = []
|
this.selectedInventory = []
|
||||||
},
|
},
|
||||||
handleInventorySelection(selection) {
|
handleInventorySelection(selection) {
|
||||||
|
// 如果选中了多个,只保留最后一个
|
||||||
|
if (selection.length > 1) {
|
||||||
|
const lastSelected = selection[selection.length - 1]
|
||||||
|
this.$refs.allocateTable.clearSelection()
|
||||||
|
this.$refs.allocateTable.toggleRowSelection(lastSelected, true)
|
||||||
|
// 更新选中的数据
|
||||||
|
this.selectedInventory = [lastSelected]
|
||||||
|
this.updateSelectedStatus(lastSelected)
|
||||||
|
} else if (selection.length === 1) {
|
||||||
|
// 单选
|
||||||
this.selectedInventory = selection
|
this.selectedInventory = selection
|
||||||
|
this.updateSelectedStatus(selection[0])
|
||||||
|
} else {
|
||||||
|
// 取消选中
|
||||||
|
this.selectedInventory = []
|
||||||
this.inventoryList.forEach(item => {
|
this.inventoryList.forEach(item => {
|
||||||
item._selected = selection.some(s => s.houseCode === item.houseCode)
|
item._selected = false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
updateSelectedStatus(selectedRow) {
|
||||||
|
this.inventoryList.forEach(item => {
|
||||||
|
// 根据唯一标识判断是否选中(使用 houseCode + skuCode 或其他唯一组合)
|
||||||
|
item._selected = selectedRow &&
|
||||||
|
item.houseCode === selectedRow.houseCode &&
|
||||||
|
item.skuCode === selectedRow.skuCode
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
saveAllocate() {
|
saveAllocate() {
|
||||||
|
|||||||
Reference in New Issue
Block a user