Merge branch 'refs/heads/dev' into dev_820

This commit is contained in:
王奎兴
2026-08-18 16:36:28 +08:00
73 changed files with 1628 additions and 349 deletions
@@ -8,6 +8,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableRyFeignClients
@@ -15,6 +16,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@MapperScan("com.mhd.wms.domain.**.mapper")
@EnableMethodCache(basePackages = "com.mhd.platform.domain.**.cache")
@EnableAsync
//@EnableScheduling
@ComponentScan(basePackages = {
"com.mhd.wms",
"com.mhd.system.api.factory"
@@ -270,10 +270,17 @@ public class HandoverTaskOrderApplicationService {
.eq(HandoverTaskOrder::getOrderNumber, orderNumber)
.set(HandoverTaskOrder::getBillingJson, handoverTaskOrderDO.getBillingJson())
.set(HandoverTaskOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
// 2. PDA上传图片插入出库管理,状态改为已出库
// // 2. 状态按是否报关:仅通宇(2830)+需报关→已交接(13),否则→已出库(9)
// StockOutOrder soo = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
// .eq(StockOutOrder::getOutOrderNumber, orderNumber));
// boolean needCustoms = soo != null
// && Long.valueOf(2830L).equals(soo.getOrganizationId())
// && "1".equals(soo.getNeedDeclareFlag());
// int targetStatus = needCustoms ? 13 : 9;
stockOutOrderService.update(new LambdaUpdateWrapper<StockOutOrder>()
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
.set(StockOutOrder::getStatus, "9")
// .set(StockOutOrder::getStatus, targetStatus)
.set(StockOutOrder::getStatus, 9) // 不注释之后需要删除
.set(StockOutOrder::getBillingJson, handoverTaskOrderDO.getBillingJson())
.set(StockOutOrder::getPictureApp, handoverTaskOrderDO.getPictureApp()));
// 3. 参考PC端完成交接:根据orderNumber查询交接单ID,执行库存扣减+交接状态更新
@@ -36,6 +36,7 @@ import com.mhd.wms.domain.handoverTaskOrder.repository.facade.IHandoverTaskOrder
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
@@ -242,7 +243,40 @@ public class StockInOrderApplicationService {
}
}
List<StockInOrderPO> stockInOrderPOS = stockInOrderDomainService.queryList(stockInOrderDO);
if (CollectionUtils.isEmpty(stockInOrderPOS)) {
return stockInOrderPOS;
}
List<String> inOrderNumbers = stockInOrderPOS.stream()
.map(StockInOrderPO::getInOrderNumber)
.filter(Objects::nonNull)
.collect(Collectors.toList());
// 列表页展示:按入库单号批量取去重后的 Invoice No
Map<String, String> invoiceNoByNum = new HashMap<>();
inMaterialDetailService.selectDistinctInvoiceNoForStockInList(inOrderNumbers)
.stream()
.filter(a -> StringUtils.isNotBlank(a.getInvoiceNo()))
.forEach(a -> invoiceNoByNum.merge(a.getInOrderNumber(), a.getInvoiceNo().trim(), (o, n) -> o + "," + n));
// 导出场景(needDetail=true):批量取出完整明细树(level=1 父行 + children),按入库单号分组挂到列表
// 注释掉 needDetail 判断:列表/导出统一返回明细
Map<String, List<InMaterialDetailPO>> detailByNum = Collections.emptyMap();
// if (Boolean.TRUE.equals(stockInOrderDO.getNeedDetail()) && !CollectionUtils.isEmpty(inOrderNumbers)) {
if (!CollectionUtils.isEmpty(inOrderNumbers)) {
InMaterialDetailDO detailQuery = new InMaterialDetailDO();
detailQuery.setInOrderNumberList(inOrderNumbers);
List<InMaterialDetailPO> detailTreeList = inMaterialDetailService.queryListChildren(detailQuery);
detailByNum = detailTreeList.stream()
.collect(Collectors.groupingBy(InMaterialDetailPO::getInOrderNumber));
}
for (StockInOrderPO stockInOrderPO : stockInOrderPOS) {
if (invoiceNoByNum.containsKey(stockInOrderPO.getInOrderNumber())) {
stockInOrderPO.setInvoiceNo(invoiceNoByNum.get(stockInOrderPO.getInOrderNumber()));
}
// if (Boolean.TRUE.equals(stockInOrderDO.getNeedDetail())) {
stockInOrderPO.setMaterialDetailList(detailByNum.getOrDefault(stockInOrderPO.getInOrderNumber(), Collections.emptyList()));
// }
Long inOrderId = stockInOrderPO.getInOrderId();
List<ReceiptOrderAccount> list = receiptOrderAccountService.list(new LambdaQueryWrapper<ReceiptOrderAccount>().eq(ReceiptOrderAccount::getOrderId, inOrderId).eq(ReceiptOrderAccount::getInOrOut, "in"));
stockInOrderPO.setReceiptOrderAccountList(list);
@@ -253,9 +253,35 @@ public class StockOutOrderApplicationService {
accountByOrderId = accounts.stream().collect(Collectors.groupingBy(ReceiptOrderAccount::getOrderId));
}
// 列表页展示:按出库单号批量取去重后的 Invoice No
Map<String, String> invoiceNoByNum = new HashMap<>();
outMaterialDetailService.selectDistinctInvoiceNoForStockOutList(outOrderNumbers)
.stream()
.filter(a -> StringUtils.isNotBlank(a.getInvoiceNo()))
.forEach(a -> invoiceNoByNum.merge(a.getOutOrderNumber(), a.getInvoiceNo().trim(), (o, n) -> o + "," + n));
// 导出场景(needDetail=true):批量取出完整明细树(level=1 父行 + children),按出库单号分组挂到列表
// 注释掉 needDetail 判断:列表/导出统一返回明细
Map<String, List<OutMaterialDetailPO>> detailByNum = Collections.emptyMap();
// if (Boolean.TRUE.equals(stockOutOrderDO.getNeedDetail()) && !CollectionUtils.isEmpty(outOrderNumbers)) {
if (!CollectionUtils.isEmpty(outOrderNumbers)) {
OutMaterialDetailDO detailQuery = new OutMaterialDetailDO();
detailQuery.setOutOrderNumberList(outOrderNumbers);
List<OutMaterialDetailPO> detailTreeList = outMaterialDetailService.queryListChildren(detailQuery);
detailByNum = detailTreeList.stream()
.collect(Collectors.groupingBy(OutMaterialDetailPO::getOutOrderNumber));
}
for (StockOutOrderPO stockOutOrderPO : stockOutOrderPOS) {
String outOrderNumber = stockOutOrderPO.getOutOrderNumber();
if (invoiceNoByNum.containsKey(outOrderNumber)) {
stockOutOrderPO.setInvoiceNo(invoiceNoByNum.get(outOrderNumber));
}
// if (Boolean.TRUE.equals(stockOutOrderDO.getNeedDetail())) {
stockOutOrderPO.setMaterialDetailList(detailByNum.getOrDefault(outOrderNumber, Collections.emptyList()));
// }
List<DeliveryDetailsLink> list = deliveryDetailsLinkService.list(new LambdaQueryWrapper<DeliveryDetailsLink>().eq(DeliveryDetailsLink::getOrderNumber, outOrderNumber));
stockOutOrderPO.setDeliveryDetailsLinkList(list);
@@ -2915,6 +2915,7 @@ public class StockReceiptOrderApplicationService {
returnReceiptMaterialDetailDO.setTotalGrossWeight(receiptMaterialDetailDO.getTotalGrossWeight());
returnReceiptMaterialDetailDO.setTotalVolume(receiptMaterialDetailDO.getTotalVolume());
returnReceiptMaterialDetailDO.setTotalArea(receiptMaterialDetailDO.getTotalArea());
returnReceiptMaterialDetailDO.setDimensions(receiptMaterialDetailDO.getDimensions());
BigDecimal parentRetAlreadyQty = receiptMaterialDetailDO.getAlreadyReceiptQuantity() != null
? receiptMaterialDetailDO.getAlreadyReceiptQuantity() : BigDecimal.ZERO;
returnReceiptMaterialDetailDO.setAlreadyReceiptQuantity(parentRetAlreadyQty);
@@ -1,5 +1,18 @@
package com.mhd.wms.domain.handoverTaskOrder.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.wms.domain.customsDeclarationDetail.repository.todo.CustomsDeclarationDetailDO;
import com.mhd.wms.domain.customsDeclarationDetail.repository.facade.ICustomsDeclarationDetailService;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.util.EntityUtils;
import org.springframework.scheduling.annotation.Scheduled;
import java.text.SimpleDateFormat;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -86,6 +99,29 @@ public class HandoverTaskOrderDomainService {
private CopyCodeReferenceDomainService copyCodeReferenceDomainService;
@Autowired
private OmsServiceFeign omsServiceFeign;
// @Autowired
// private ICustomsDeclarationDetailService customsDeclarationDetailService;
// // 报关回写相关常量
// private static final String CUSTOMS_PUSH_API_URL = "http://10.102.192.15/nagu-erp-api/transfer/pushData";
// private static final String CUSTOMS_VERIFY = "ESLuxAmB6VXCgbqP1eFzxTPVRagkQ62BUkfhElrgQ6XmE/g2reHVflY/SiCSU7JD";
// // 通宇组织ID只有通宇才启用报关出库流程
// private static final Long TONGYU_ORGANIZATION_ID = 2830L;
// // 视为海关已放行/结关的状态码建议做成 @Value("${gw.customs.pass-status:P,I,R,F,K,B}")
// // 视为海关已放行的状态码ERP 确认只有 P=海关已放行 才表示货物可出库
// private static final String[] CUSTOMS_PASS_STATUS = {"P"};
// // 退单/失败状态码记告警用
// private static final String[] CUSTOMS_FAIL_STATUS = {"E", "A", "D", "Z", "c", "H"};
//
// /**
// * 判断是否需要走报关出库流程仅通宇 + needDeclareFlag=1
// * 其它组织一律走老流程交接直接出库
// */
// private boolean isCustomsDeclareOrder(StockOutOrder stockOutOrder) {
// return stockOutOrder != null
// && TONGYU_ORGANIZATION_ID.equals(stockOutOrder.getOrganizationId())
// && "1".equals(stockOutOrder.getNeedDeclareFlag());
// }
/**
@@ -293,16 +329,22 @@ public class HandoverTaskOrderDomainService {
LoginUser loginUser = SecurityUtils.getLoginUser();
//修改库存
xgkc(handoverTaskOrderIds,loginUser);
//推送oms
//推送oms需报关的单子等海关确认放行后再推
for (Long handoverTaskOrderId : handoverTaskOrderIds) {
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderId);
String orderNumber = handoverTaskOrder.getOrderNumber();
StockOutOrder stockOutOrder = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
.eq(StockOutOrder::getDelFlag, 1), false);
if (stockOutOrder != null && !"yang_pin_chu_ku".equals(stockOutOrder.getBusinessType())) {
pushOms(handoverTaskOrderId);
}
// HandoverTaskOrder hto = handoverTaskOrderService.getById(handoverTaskOrderId);
// if (hto == null) {
// continue;
// }
// StockOutOrder soo = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda()
// .eq(StockOutOrder::getOutOrderNumber, hto.getOrderNumber()));
// if (isCustomsDeclareOrder(soo)) {
// continue; // 需报关仅通宇跳过
// }
// if (soo != null && !"yang_pin_chu_ku".equals(soo.getBusinessType())) {
// pushOms(handoverTaskOrderId);
// }
// 推送 oms 当上面不注释时需要将这个删除
pushOms(handoverTaskOrderId);
}
HandoverTaskOrder handoverTaskOrder = handoverTaskOrderService.getById(handoverTaskOrderIds.get(0));
stockOutOrderService.update(null,new UpdateWrapper<StockOutOrder>().lambda().set(StockOutOrder::getBillingJson,handoverTaskOrderDO.getBillingJson()).eq(StockOutOrder::getOutOrderNumber,handoverTaskOrder.getOrderNumber()));
@@ -346,191 +388,271 @@ public class HandoverTaskOrderDomainService {
if (stockOutOrder == null) {
continue;
}
// // 需要报关仅通宇+needDeclareFlag=1交接时只改状态为已交接(13)不扣库存/不推OMS等海关确认放行后再处理
// if (isCustomsDeclareOrder(stockOutOrder)) {
// stockOutOrder.setStatus(13);
// stockOutOrderMapper.updateById(stockOutOrder);
// continue; // 跳过下方扣库存逻辑B/C/D/E 全部延后到海关确认
// }
// // 不需要报关维持原逻辑状态改已出库(9)+ 扣库存
//完成交接状态改为已出库
stockOutOrder.setStatus(9);
stockOutOrderMapper.updateById(stockOutOrder);
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper<OutMaterialDetail>().lambda()
.eq(OutMaterialDetail::getOutOrderNumber, orderNumber)
.eq(OutMaterialDetail::getDelFlag, 1));
Integer review = stockOutOrder != null ? stockOutOrder.getReview() : null;
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
//oms详情同步
OMSWarehouseEntryDetails(outMaterialDetail);
if (outMaterialDetail.getCopyCodeReferenceIds() != null){
List<Integer> copyCodeReferenceIds = Arrays.stream(outMaterialDetail.getCopyCodeReferenceIds().split(","))
.map(Integer::parseInt).collect(Collectors.toList());
copyCodeReferenceService.lambdaUpdate()
.set(CopyCodeReference::getMaterialStatusCode, 3)
.set(CopyCodeReference::getMaterialStatusName, "已出库")
.in(CopyCodeReference::getId, copyCodeReferenceIds);
}
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
// 复核什么扣减什么需要复核用check_quantity不需要复核用picking_quantity
BigDecimal effectiveQuantity = Integer.valueOf(1).equals(review)
? outMaterialDetail.getCheckQuantity()
: (outMaterialDetail.getPickingQuantity() != null ? outMaterialDetail.getPickingQuantity() : outMaterialDetail.getQuantity());
if (materialInventoryId == null || effectiveQuantity == null || effectiveQuantity.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
BigDecimal checkQuantity = effectiveQuantity;
BigDecimal checkArea = outMaterialDetail.getCheckArea();
BigDecimal checkVolume = outMaterialDetail.getCheckVolume();
BigDecimal checkGrossWeight = outMaterialDetail.getCheckGrossWeight();
BigDecimal checkNetWeight = outMaterialDetail.getCheckNetWeight();
doStockOutDeduct(orderNumber, stockOutOrder, loginUser);
}
}
// 初始化检查数据避免空指针
checkQuantity = checkQuantity != null ? checkQuantity : BigDecimal.ZERO;
checkArea = checkArea != null ? checkArea : BigDecimal.ZERO;
checkVolume = checkVolume != null ? checkVolume : BigDecimal.ZERO;
checkGrossWeight = checkGrossWeight != null ? checkGrossWeight : BigDecimal.ZERO;
checkNetWeight = checkNetWeight != null ? checkNetWeight : BigDecimal.ZERO;
/**
* 出库扣减同步OMS明细 + 联单状态 + 扣实物库存 + 推OMS库存
* xgkc 抽取不需报关交接海关确认两处复用
*/
private void doStockOutDeduct(String orderNumber, StockOutOrder stockOutOrder, LoginUser loginUser) {
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(new QueryWrapper<OutMaterialDetail>().lambda()
.eq(OutMaterialDetail::getOutOrderNumber, orderNumber)
.eq(OutMaterialDetail::getDelFlag, 1));
Integer review = stockOutOrder.getReview();
for (OutMaterialDetail outMaterialDetail : outMaterialDetailList) {
// === 以下把原 L349-513 的循环体原样搬进来一行不改 ===
// oms详情同步
OMSWarehouseEntryDetails(outMaterialDetail);
if (outMaterialDetail.getCopyCodeReferenceIds() != null) {
List<Integer> copyCodeReferenceIds = Arrays.stream(outMaterialDetail.getCopyCodeReferenceIds().split(","))
.map(Integer::parseInt).collect(Collectors.toList());
copyCodeReferenceService.lambdaUpdate()
.set(CopyCodeReference::getMaterialStatusCode, 3)
.set(CopyCodeReference::getMaterialStatusName, "已出库")
.in(CopyCodeReference::getId, copyCodeReferenceIds);
}
Long materialInventoryId = outMaterialDetail.getMaterialInventoryId();
BigDecimal effectiveQuantity = Integer.valueOf(1).equals(review)
? outMaterialDetail.getCheckQuantity()
: (outMaterialDetail.getPickingQuantity() != null ? outMaterialDetail.getPickingQuantity() : outMaterialDetail.getQuantity());
if (materialInventoryId == null || effectiveQuantity == null || effectiveQuantity.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
BigDecimal checkQuantity = effectiveQuantity;
BigDecimal checkArea = outMaterialDetail.getCheckArea();
BigDecimal checkVolume = outMaterialDetail.getCheckVolume();
BigDecimal checkGrossWeight = outMaterialDetail.getCheckGrossWeight();
BigDecimal checkNetWeight = outMaterialDetail.getCheckNetWeight();
checkQuantity = checkQuantity != null ? checkQuantity : BigDecimal.ZERO;
checkArea = checkArea != null ? checkArea : BigDecimal.ZERO;
checkVolume = checkVolume != null ? checkVolume : BigDecimal.ZERO;
checkGrossWeight = checkGrossWeight != null ? checkGrossWeight : BigDecimal.ZERO;
checkNetWeight = checkNetWeight != null ? checkNetWeight : BigDecimal.ZERO;
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
MaterialInventory materialInventoryPO = materialInventoryMapper.selectById(materialInventoryId);
if (materialInventoryPO != null) {
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
materialInventoryParamDO.setArea(checkArea);
materialInventoryParamDO.setVolume(checkVolume);
materialInventoryParamDO.setGrossWeight(checkGrossWeight);
materialInventoryParamDO.setNetWeight(checkNetWeight);
materialInventoryParamDO.setQuantity(checkQuantity);
materialInventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
materialInventoryParamDO.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
materialInventoryParamDO.setLotNumber(outMaterialDetail.getLotNo());
materialInventoryParamDO.setBatchNumber(outMaterialDetail.getBatchNumber());
materialInventoryParamDO.setInOrderNumber(materialInventoryPO.getInOrderNumber());
materialInventoryParamDO.setProductionDate(materialInventoryPO.getProductionDate());
materialInventoryParamDO.setExpiryDate(materialInventoryPO.getExpiryDate());
materialInventoryParamDO.setType("4");
materialInventoryParamDO.setWarehouseId(materialInventoryPO.getWarehouseId());
//oms库存同步
//OMSInventorySynchronization(outMaterialDetail,checkQuantity);
if (materialInventoryPO != null) {
MaterialInventoryParamDO materialInventoryParamDO = new MaterialInventoryParamDO();
//更新库存数量
// //库存数量
// BigDecimal oldInventoryQuantity = materialInventoryPO.getInventoryQuantity();
// oldInventoryQuantity = oldInventoryQuantity != null ? oldInventoryQuantity : BigDecimal.ZERO;
// //可用数量
// BigDecimal oldAllocationQuantity = materialInventoryPO.getAllocationQuantity();
// oldAllocationQuantity = oldAllocationQuantity != null ? oldAllocationQuantity : BigDecimal.ZERO;
// //冻结数量出库交接不变动冻结数量
// BigDecimal oldFreezeQuantity = materialInventoryPO.getFreezeQuantity();
// oldFreezeQuantity = oldFreezeQuantity != null ? oldFreezeQuantity : BigDecimal.ZERO;
// //扣减后库存数量
// BigDecimal newInventoryQuantity = oldInventoryQuantity.subtract(checkQuantity);
// //扣减后可用数量
// BigDecimal newAllocationQuantity = oldAllocationQuantity.subtract(checkQuantity);
// BigDecimal newFreezeQuantity = oldFreezeQuantity;
//
//
//
// BigDecimal oldArea = materialInventoryPO.getArea();
// BigDecimal oldVolume = materialInventoryPO.getVolume();
// BigDecimal oldGrossWeight = materialInventoryPO.getGrossWeight();
// BigDecimal oldNetWeight = materialInventoryPO.getNetWeight();
//
// // 初始化旧数据避免空指针
// oldArea = oldArea != null ? oldArea : BigDecimal.ZERO;
// oldVolume = oldVolume != null ? oldVolume : BigDecimal.ZERO;
// oldGrossWeight = oldGrossWeight != null ? oldGrossWeight : BigDecimal.ZERO;
// oldNetWeight = oldNetWeight != null ? oldNetWeight : BigDecimal.ZERO;
//
// BigDecimal newArea = oldArea.subtract(checkArea);
// BigDecimal newVolume = oldVolume.subtract(checkVolume);
// BigDecimal newGrossWeight = oldGrossWeight.subtract(checkGrossWeight);
// BigDecimal newNetWeight = oldNetWeight.subtract(checkNetWeight);
//
// materialInventoryPO.setInventoryQuantity(newInventoryQuantity);
// materialInventoryPO.setAllocationQuantity(materialInventoryPO.getAllocationQuantity());
// materialInventoryPO.setFreezeQuantity(materialInventoryPO.getFreezeQuantity().subtract(outMaterialDetail.getCheckQuantity()) );
// materialInventoryPO.setArea(newArea);
// materialInventoryPO.setVolume(newVolume);
// materialInventoryPO.setGrossWeight(newGrossWeight);
// materialInventoryPO.setNetWeight(newNetWeight);
// MaterialInventory materialInventory = new MaterialInventory();
// BeanUtils.copyProperties(materialInventoryPO, materialInventory);
//materialInventoryMapper.updateById(materialInventory);
materialInventoryParamDO.setArea(checkArea);
materialInventoryParamDO.setVolume(checkVolume);
materialInventoryParamDO.setGrossWeight(checkGrossWeight);
materialInventoryParamDO.setNetWeight(checkNetWeight);
materialInventoryParamDO.setQuantity(checkQuantity);
materialInventoryParamDO.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
materialInventoryParamDO.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
materialInventoryParamDO.setLotNumber(outMaterialDetail.getLotNo());
materialInventoryParamDO.setBatchNumber(outMaterialDetail.getBatchNumber());
materialInventoryParamDO.setInOrderNumber(materialInventoryPO.getInOrderNumber());
materialInventoryParamDO.setProductionDate(materialInventoryPO.getProductionDate());
materialInventoryParamDO.setExpiryDate(materialInventoryPO.getExpiryDate());
materialInventoryParamDO.setType("4");
materialInventoryParamDO.setWarehouseId(materialInventoryPO.getWarehouseId());
//样品出库不修改库存
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("出库");
materialInventoryOmsParamDO.setLoginUser(loginUser);
HandoverTaskOrder h = handoverTaskOrderService.getById(handoverTaskOrderId);
String number = h.getOrderNumber();
StockOutOrder out = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
.eq(StockOutOrder::getOutOrderNumber, number)
.eq(StockOutOrder::getDelFlag, 1), false);
if (out != null && !"yang_pin_chu_ku".equals(out.getBusinessType())) {
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO);
//库存推送oms
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
}
//库存调整记录
// InventoryAdjustmentRecord inventoryAdjustmentRecord = new InventoryAdjustmentRecord();
// inventoryAdjustmentRecord.setAdjustAction("出库");
// inventoryAdjustmentRecord.setRelateNo(orderNumber);
// inventoryAdjustmentRecord.setAdjustAfterStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
// inventoryAdjustmentRecord.setAdjustBeforeStatusCode(materialInventory.getMaterialStatusCode() == null ? "" : materialInventory.getMaterialStatusCode());
// inventoryAdjustmentRecord.setAdjustAfterStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
// inventoryAdjustmentRecord.setAdjustBeforeStatusName(materialInventory.getMaterialStatusName() == null ? "" : materialInventory.getMaterialStatusName());
//// inventoryAdjustmentRecord.setAdjustBeforeStatusCode("he_ge");
//// inventoryAdjustmentRecord.setAdjustBeforeStatusName("合格");
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
// inventoryAdjustmentRecord.setMaterialCode(outMaterialDetail.getMaterialNo());
// inventoryAdjustmentRecord.setMaterialName(outMaterialDetail.getCommodityName());
// inventoryAdjustmentRecord.setBarCode(outMaterialDetail.getBarCode());
// if (inventoryAdjustmentRecord.getBarCode() == null || inventoryAdjustmentRecord.getBarCode().isEmpty()){
// getBarCode(materialInventoryPO, inventoryAdjustmentRecord);
// }
// inventoryAdjustmentRecord.setMaterialBaseInfoId(outMaterialDetail.getMaterialBaseInfoId());
// inventoryAdjustmentRecord.setAdjustType(1L);
// inventoryAdjustmentRecord.setOrganizationId(stockOutOrder.getOrganizationId());
// inventoryAdjustmentRecord.setOrganizationName(stockOutOrder.getOrganizationName());
// inventoryAdjustmentRecord.setTopOrganizationId(stockOutOrder.getTopOrganizationId());
// inventoryAdjustmentRecord.setWarehouseCode(stockOutOrder.getWarehouseCode());
// inventoryAdjustmentRecord.setWarehouseName(stockOutOrder.getWarehouseName());
// inventoryAdjustmentRecord.setWarehouseId(stockOutOrder.getWarehouseId());
// inventoryAdjustmentRecord.setStorageCode(materialInventoryPO.getStorageCode());
// inventoryAdjustmentRecord.setStorageName(materialInventoryPO.getStorageName());
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
// inventoryAdjustmentRecord.setStorageLocationCode(materialInventoryPO.getStorageLocationCode());
// inventoryAdjustmentRecord.setStorageLocationName(materialInventoryPO.getStorageLocationName());
// inventoryAdjustmentRecord.setMaterialInventoryId(materialInventoryPO.getMaterialInventoryId());
// inventoryAdjustmentRecord.setMaterialBaseInfoId(materialInventoryPO.getMaterialBaseInfoId());
// inventoryAdjustmentRecord.setShipperId(stockOutOrder.getShipperId());
// inventoryAdjustmentRecord.setShipperName(stockOutOrder.getShipperName());
// inventoryAdjustmentRecord.setStorageSectionId(materialInventoryPO.getStorageSectionId());
// inventoryAdjustmentRecord.setStorageLocationId(materialInventoryPO.getStorageLocationId());
// inventoryAdjustmentRecord.setCreateBy(loginUser.getUserid());
// UserPo userPo = loginUser.getUserPo();
// if (userPo != null) inventoryAdjustmentRecord.setCreateByName(userPo.getUserName());
// inventoryAdjustmentRecord.setCreateTime(new Date());
// inventoryAdjustmentRecord.setAllocationBeforeQuantity(oldAllocationQuantity);
// inventoryAdjustmentRecord.setAllocationAfterQuantity(oldAllocationQuantity);
// inventoryAdjustmentRecord.setFreezeBeforeQuantity(oldFreezeQuantity);
// inventoryAdjustmentRecord.setFreezeAfterQuantity(newFreezeQuantity.subtract(outMaterialDetail.getCheckQuantity()));//调整后 冻结-出库
// inventoryAdjustmentRecord.setInventoryBeforeQuantity(oldInventoryQuantity);
// inventoryAdjustmentRecord.setInventoryAfterQuantity(newInventoryQuantity);
// // 调整前库存数量净重毛重体积面积
// inventoryAdjustmentRecord.setNetWeight(oldNetWeight);
// inventoryAdjustmentRecord.setGrossWeight(oldGrossWeight);
// inventoryAdjustmentRecord.setVolume(oldVolume);
// inventoryAdjustmentRecord.setArea(oldArea);
// // 调整后库存数量 - 复核时填写的数量
// inventoryAdjustmentRecord.setAdjustedNetWeight(newNetWeight);
// inventoryAdjustmentRecord.setAdjustedGrossWeight(newGrossWeight);
// inventoryAdjustmentRecord.setAdjustedVolume(newVolume);
// inventoryAdjustmentRecord.setAdjustedArea(newArea);
//
// inventoryAdjustmentRecordMapper.insert(inventoryAdjustmentRecord);
MaterialInventoryOmsParamDO materialInventoryOmsParamDO = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(materialInventoryParamDO, materialInventoryOmsParamDO);
materialInventoryOmsParamDO.setKctzType("出库");
materialInventoryOmsParamDO.setLoginUser(loginUser);
if (stockOutOrder != null && !"yang_pin_chu_ku".equals(stockOutOrder.getBusinessType())) {
materialInventoryService.kctzjl(materialInventoryParamDO,"出库",loginUser);
materialInventoryService.xgkc(materialInventoryParamDO);
//库存推送oms
omsServiceFeign.omsEdit(materialInventoryOmsParamDO);
}
}
}
}
// /**
// * 定时任务入口每小时整点扫描已交接(13)状态的需报关出库单 sendDec 查报关结果
// * 放行/结关的 状态 139 + 扣库存 + 推OMS未放行 跳过下次再查
// * @Scheduled 触发无需在 sys_job 表配置
// */
// @Scheduled(cron = "0 0 * * * ?")
// public void scheduledCustomsConfirm() {
// log.info("【报关确认出库】定时任务开始执行");
// try {
// AjaxResult result = customsConfirmOut(null);
// log.info("【报关确认出库】定时任务执行完成 result={}", result);
// } catch (Exception e) {
// log.error("【报关确认出库】定时任务执行异常", e);
// }
// }
// /**
// * 海关确认出库轮询/手动入口
// * status=13已交接的需报关出库单 sendDec 查报关状态
// * 放行/结关 状态 139 + 扣库存 + 推OMS
// * 退单 保持13记告警
// * 进行中 跳过下次再查
// * @param outOrderNumbers 传空则扫全部 status=13传值则按指定单号处理
// */
// @Transactional(rollbackFor = Exception.class)
// public AjaxResult customsConfirmOut(List<String> outOrderNumbers) {
// // 1. 确定处理范围只处理通宇status=13 且需要报关的出库单
// LambdaQueryWrapper<StockOutOrder> qw = new LambdaQueryWrapper<StockOutOrder>()
// .eq(StockOutOrder::getOrganizationId, TONGYU_ORGANIZATION_ID)
// .eq(StockOutOrder::getStatus, 13)
// .eq(StockOutOrder::getNeedDeclareFlag, "1");
// if (outOrderNumbers != null && !outOrderNumbers.isEmpty()) {
// qw.in(StockOutOrder::getOutOrderNumber, outOrderNumbers);
// }
// List<StockOutOrder> list = stockOutOrderService.list(qw);
//
// int pass = 0, pending = 0, fail = 0;
// LoginUser loginUser = SecurityUtils.getLoginUser();
//
// for (StockOutOrder soo : list) {
// try {
// // 2. sendDec 查报关状态
// JSONArray decData = queryCustomsDeclaration(
// soo.getOutOrderNumber(),
// soo.getOrganizationId(),
// soo.getOrganizationName());
// if (decData == null || decData.isEmpty()) {
// pending++; // ERP 里还没报关单下次再查
// continue;
// }
//
// // 3. 判断状态遍历全部明细任一命中放行即整单放行
// String decStatus = null;
// boolean passed = false, failed = false;
// for (int i = 0; i < decData.size(); i++) {
// JSONObject item = decData.getJSONObject(i);
// decStatus = item.getString("dec_status");
// if (isInList(decStatus, CUSTOMS_PASS_STATUS)) {
// passed = true;
// // 报关单号写入 customs_declaration_detail补全出库单关联
// saveCustomsDetail(soo, item);
// break;
// }
// if (isInList(decStatus, CUSTOMS_FAIL_STATUS)) {
// failed = true;
// }
// }
//
// if (passed) {
// // 放行状态 139 + 扣库存 + OMS
// soo.setStatus(9);
// stockOutOrderMapper.updateById(soo);
// doStockOutDeduct(soo.getOutOrderNumber(), soo, loginUser);
// pushOmsByOrderNumber(soo.getOutOrderNumber());
// pass++;
// } else if (failed) {
// // 退单保持13记告警日志暂留人工处理
// log.warn("报关退单,请人工处理 outOrderNumber={} decStatus={}",
// soo.getOutOrderNumber(), decStatus);
// fail++;
// } else {
// pending++; // 进行中
// }
// } catch (Exception e) {
// log.error("海关确认出库异常 outOrderNumber={}", soo.getOutOrderNumber(), e);
// fail++;
// }
// }
// Map<String, Object> r = new HashMap<>();
// r.put("pass", pass);
// r.put("pending", pending);
// r.put("fail", fail);
// return AjaxResult.success(r);
// }
// /**
// * sendDec 查询报关回写参考 PickingOrderApplicationService.java:771-818 模板
// * 关键改造 erpBillNo 传出库单号 返回整个 data 数组不只第0条 不在这里处理 dec_status
// */
// private JSONArray queryCustomsDeclaration(String erpBillNo, Long organizationId, String organizationName) throws Exception {
// Map<String, Object> param = new HashMap<>();
// param.put("beginDate", "2020-01-01");
// param.put("endDate", new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
// param.put("erpBillNo", erpBillNo);
// param.put("pageIndex", 1);
// param.put("pageSize", 100);
// List<Map<String, Object>> body = new ArrayList<>();
// body.add(param);
//
// // 多租户 URL保证查的地址和推 save_order_e 的地址一致
// String ncUrl = pickingMaterialDetailMapper.getNcUrl("gw", organizationName, organizationId);
// String url = (ncUrl != null) ? ncUrl : CUSTOMS_PUSH_API_URL;
//
// HttpPost post = new HttpPost(url);
// post.setEntity(new StringEntity(JSONObject.toJSONString(body), "UTF-8"));
// post.setHeader("Content-type", "application/json");
// post.setHeader("apiName", "sendDec");
// post.setHeader("verify", CUSTOMS_VERIFY);
// log.info("sendDec 请求 erpBillNo={} url={} body={}", erpBillNo, url,body);
//
// try (CloseableHttpClient client = HttpClients.createDefault();
// CloseableHttpResponse resp = client.execute(post)) {
// String respStr = EntityUtils.toString(resp.getEntity());
// log.info("sendDec 响应 erpBillNo={} resp={}", erpBillNo, respStr);
// if (resp.getStatusLine().getStatusCode() == 200) {
// JSONObject json = JSONObject.parseObject(respStr);
// Integer code = json.getInteger("code");
// if (code != null && code == 200) {
// return json.getJSONArray("data");
// }
// }
// return null;
// }
// }
// private boolean isInList(String v, String[] arr) {
// if (v == null) return false;
// for (String s : arr) {
// if (s.equalsIgnoreCase(v)) return true;
// }
// return false;
// }
// /**
// * 报关明细写入 customs_declaration_detail
// * set outOrderNumber/outOrderId PickingOrder 代码这两字段漏 set
// */
// private void saveCustomsDetail(StockOutOrder soo, JSONObject item) {
// try {
// CustomsDeclarationDetailDO d = new CustomsDeclarationDetailDO();
// d.setDocumentNumber(soo.getOutOrderNumber());
// d.setBondInvtNo(item.getString("entry_id"));
// Object erpGNo = item.get("erp_g_no");
// if (erpGNo != null) {
// d.setInvtRow(erpGNo instanceof Number
// ? ((Number) erpGNo).intValue()
// : Integer.parseInt(erpGNo.toString()));
// }
// d.setOutOrderNumber(soo.getOutOrderNumber());
// d.setOutOrderId(soo.getOutOrderId());
// d.setOrganizationId(soo.getOrganizationId());
// d.setOrganizationName(soo.getOrganizationName());
// d.setTopOrganizationId(soo.getTopOrganizationId());
// customsDeclarationDetailService.insert(d);
// } catch (Exception e) {
// log.error("写报关明细失败 outOrderNumber={}", soo.getOutOrderNumber(), e);
// }
// }
// /** 按 orderNumber 推 OMSpushOms 入参是 handoverTaskOrderId,这里包一层) */
// private void pushOmsByOrderNumber(String orderNumber) {
// List<HandoverTaskOrder> htoList = handoverTaskOrderService.list(
// new LambdaQueryWrapper<HandoverTaskOrder>()
// .eq(HandoverTaskOrder::getOrderNumber, orderNumber));
// for (HandoverTaskOrder hto : htoList) {
// pushOms(hto.getHandoverTaskOrderId());
// }
// }
private void OMSInventorySynchronization(OutMaterialDetail outMaterialDetail,BigDecimal checkQuantity) {
outMaterialDetail.getLotNo();
outMaterialDetail.getInOrderNumber();
@@ -3,6 +3,7 @@ package com.mhd.wms.domain.inMaterialDetail.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
@@ -31,6 +32,11 @@ public interface IInMaterialDetailService extends IService<InMaterialDetail>
*/
public List<InMaterialDetailPO> queryListChildren(InMaterialDetailDO inMaterialDetailDO);
/**
* 入库列表页按入库单号批量取去重后的 Invoice No level=1
*/
List<InStockListMaterialAgg> selectDistinctInvoiceNoForStockInList(List<String> inOrderNumbers);
/**
* 新增物料明细
*/
@@ -3,8 +3,10 @@ package com.mhd.wms.domain.inMaterialDetail.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -26,4 +28,9 @@ public interface InMaterialDetailMapper extends BaseMapper<InMaterialDetail>
*/
public List<InMaterialDetailPO> queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 入库列表页按入库单号批量取去重后的 Invoice No level=1
*/
List<InStockListMaterialAgg> selectDistinctInvoiceNoForStockInList(@Param("inOrderNumbers") List<String> inOrderNumbers);
}
@@ -14,6 +14,7 @@ import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
import com.mhd.wms.domain.inMaterialDetail.repository.mapper.InMaterialDetailMapper;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
@@ -26,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -86,6 +88,14 @@ public class InMaterialDetailImpl extends ServiceImpl<InMaterialDetailMapper, In
return inMaterialDetailPOParentList;
}
@Override
public List<InStockListMaterialAgg> selectDistinctInvoiceNoForStockInList(List<String> inOrderNumbers) {
if (CollectionUtils.isEmpty(inOrderNumbers)) {
return Collections.emptyList();
}
return inMaterialDetailMapper.selectDistinctInvoiceNoForStockInList(inOrderNumbers);
}
private List<InMaterialDetailPO> getChildren(Long parentUniqueId, List<InMaterialDetailPO> inMaterialDetailPOList, Integer maxLevel){
List<InMaterialDetailPO> childrenCityList = inMaterialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(childrenCityList)){
@@ -0,0 +1,12 @@
package com.mhd.wms.domain.inMaterialDetail.repository.po;
import lombok.Data;
/**
* 入库列表页批量取去重后的 Invoice No
*/
@Data
public class InStockListMaterialAgg {
private String inOrderNumber;
private String invoiceNo;
}
@@ -41,6 +41,11 @@ public interface IOutMaterialDetailService extends IService<OutMaterialDetail>
*/
List<OutStockListMaterialAgg> selectAggregatesForStockOutList(List<String> outOrderNumbers);
/**
* 出库列表页按出库单号批量取去重后的 Invoice No level=1
*/
List<OutStockListMaterialAgg> selectDistinctInvoiceNoForStockOutList(List<String> outOrderNumbers);
/**
* 新增物料明细
*/
@@ -60,4 +60,9 @@ public interface OutMaterialDetailMapper extends BaseMapper<OutMaterialDetail>
* 出库列表页按出库单号批量聚合 level=1
*/
List<OutStockListMaterialAgg> selectAggregatesForStockOutList(@Param("outOrderNumbers") List<String> outOrderNumbers);
/**
* 出库列表页按出库单号批量取去重后的 Invoice No level=1
*/
List<OutStockListMaterialAgg> selectDistinctInvoiceNoForStockOutList(@Param("outOrderNumbers") List<String> outOrderNumbers);
}
@@ -130,6 +130,14 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
return outMaterialDetailMapper.selectAggregatesForStockOutList(outOrderNumbers);
}
@Override
public List<OutStockListMaterialAgg> selectDistinctInvoiceNoForStockOutList(List<String> outOrderNumbers) {
if (CollectionUtils.isEmpty(outOrderNumbers)) {
return Collections.emptyList();
}
return outMaterialDetailMapper.selectDistinctInvoiceNoForStockOutList(outOrderNumbers);
}
private List<OutMaterialDetailPO> getChildren(Long parentUniqueId, List<OutMaterialDetailPO> materialDetailPOList, Integer maxLevel){
List<OutMaterialDetailPO> childrenCityList = materialDetailPOList.stream().filter(materialDetailPO -> parentUniqueId.equals(materialDetailPO.getParentUniqueId())).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(childrenCityList)){
@@ -400,7 +408,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
.eq(StockOutOrder::getDelFlag, 1));
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
xgkc(outMaterialDetailList,outOrderNumber,loginUser);
}
//保存物料明细信息
@@ -535,7 +543,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
.eq(StockOutOrder::getDelFlag, 1));
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
qxfp(outMaterialDetailDOList,outOrderNumber,loginUser);
}
@@ -979,7 +987,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
.eq(StockOutOrder::getDelFlag, 1));
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
qxfp(outMaterialDetailDOList,outOrderNumber,loginUser);
}
@@ -1088,7 +1096,7 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
List<StockOutOrder> stockOutOrderList = stockOutOrderMapper.selectList(new QueryWrapper<StockOutOrder>().lambda()
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
.eq(StockOutOrder::getDelFlag, 1));
if (!CollectionUtils.isEmpty(stockOutOrderList) && "yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
if (!CollectionUtils.isEmpty(stockOutOrderList) && !"yang_pin_chu_ku".equals(stockOutOrderList.get(0).getBusinessType())) {
childrenqxfp(children,outOrderNumber,loginUser);
}
}
@@ -13,4 +13,6 @@ public class OutStockListMaterialAgg {
private BigDecimal totalOutboundQuantity;
private BigDecimal checkQuantitySum;
private Integer materialKindCountDistinct;
/** 列表页展示用:该出库单的 Invoice No */
private String invoiceNo;
}
@@ -492,6 +492,8 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
}
//保存物料明细信息
saveOrUpdateBatch(receiptMaterialDetailList);
// total_volume/total_area 为空时强制落库 NULL绕开 MyBatis-Plus NOT_NULL 更新策略
applyForcedNullTotalMetrics(receiptMaterialDetailList);
//批量新增/更新物料更多属性保留已有值仅更新有值的属性不再先删后插
mergeMaterialMoreDetail(materialMoreDetailList, stockReceiptOrderDO, receiptMaterialDetailDOList);
//批量新增/更新物料更多属性先删除该收货单下所有明细的旧批次属性再插入新值避免重复插入导致更新失效
@@ -657,6 +659,55 @@ public class ReceiptMaterialDetailImpl extends ServiceImpl<ReceiptMaterialDetail
return val != null && val.compareTo(BigDecimal.ZERO) == 0;
}
/**
* total_volume / total_area / dimensions 为空时强制 UPDATE NULL
* 仅对已存在明细material_detail_id 非空生效新插入行由实体空值自然得到 null
*/
private void applyForcedNullTotalMetrics(List<ReceiptMaterialDetail> receiptMaterialDetailList) {
if (CollectionUtils.isEmpty(receiptMaterialDetailList)) {
return;
}
// 列名组合 -> materialDetailId 列表total_volume / total_area / dimensions / 任意组合
Map<String, List<Long>> columnsToIds = new HashMap<>();
for (ReceiptMaterialDetail detail : receiptMaterialDetailList) {
if (detail == null || detail.getMaterialDetailId() == null) {
continue;
}
StringBuilder columns = new StringBuilder();
if (detail.getTotalVolume() == null) {
columns.append("total_volume");
}
if (detail.getTotalArea() == null) {
if (columns.length() > 0) {
columns.append(",");
}
columns.append("total_area");
}
if (detail.getDimensions() == null) {
if (columns.length() > 0) {
columns.append(",");
}
columns.append("dimensions");
}
if (columns.length() == 0) {
continue;
}
columnsToIds.computeIfAbsent(columns.toString(), k -> new ArrayList<>())
.add(detail.getMaterialDetailId());
}
if (columnsToIds.isEmpty()) {
return;
}
for (Map.Entry<String, List<Long>> entry : columnsToIds.entrySet()) {
UpdateWrapper<ReceiptMaterialDetail> wrapper = new UpdateWrapper<>();
for (String column : entry.getKey().split(",")) {
wrapper.set(column, null);
}
wrapper.in("material_detail_id", entry.getValue());
receiptMaterialDetailMapper.update(null, wrapper);
}
}
private void setMore(ReceiptMaterialDetailDO receiptMaterialDetailDO) {
List<MaterialMoreDetailDO> materialMoreDetailList = receiptMaterialDetailDO.getMaterialMoreDetailList();
if (!CollectionUtils.isEmpty(materialMoreDetailList)) {
@@ -235,6 +235,9 @@ public class StockInOrderPO extends BaseVOEntity {
@Excel(name = "备注")
private String remark;
@ApiModelProperty("Invoice No(多个用逗号隔开)")
private String invoiceNo;
@ApiModelProperty("物料明细")
private List<InMaterialDetailPO> materialDetailList;
@@ -476,4 +476,7 @@ public class StockInOrderDO extends BaseVOEntity {
*/
@ApiModelProperty("作业任务人员模糊查询")
private String workUserNameLike;
@ApiModelProperty("是否返回物料明细(导出时传 true")
private Boolean needDetail;
}
@@ -178,6 +178,171 @@ public class StockInOrderDomainService {
return maxSeq;
}
/**
* 新增入库单含复制新建时重置单据生命周期状态
*
* <p>前端复制入库单是取原单详情getInfo后按新单提交/edit 不带 inOrderId
* 若原单已审核审核状态等字段会被原样带入新单导致新单状态是已创建但审核时提示已审核等问题
* 此处统一重置保证新单从初始态开始</p>
*/
private void resetNewOrderState(StockInOrderDO stockInOrderDO) {
//单据状态回到已创建
stockInOrderDO.setStatus(1);
//审核状态回到未审核清空审核信息
stockInOrderDO.setAuditStatus(1);
stockInOrderDO.setAuditRemark(null);
stockInOrderDO.setAuditBy(null);
stockInOrderDO.setAuditByName(null);
stockInOrderDO.setAuditTime(null);
//取消/关闭复位
stockInOrderDO.setCancelOrder(2);
stockInOrderDO.setCancelRemark(null);
stockInOrderDO.setCancelBy(null);
stockInOrderDO.setCancelByName(null);
stockInOrderDO.setCancelTime(null);
stockInOrderDO.setCloseOrder(2);
stockInOrderDO.setCloseRemark(null);
stockInOrderDO.setCloseBy(null);
stockInOrderDO.setCloseByName(null);
stockInOrderDO.setCloseTime(null);
//推送状态复位
stockInOrderDO.setPushStatus(1);
stockInOrderDO.setPushTime(null);
stockInOrderDO.setPushBy(null);
stockInOrderDO.setPushByName(null);
//作业任务复位
stockInOrderDO.setWorkUserId(null);
stockInOrderDO.setWorkUserName(null);
stockInOrderDO.setWorkTaskReceiveStatus(null);
stockInOrderDO.setTaskIssueUserId(null);
//签名状态复位
stockInOrderDO.setSignatureStatus(null);
stockInOrderDO.setSignatureTime(null);
stockInOrderDO.setSignaturePic(null);
stockInOrderDO.setEvidencePics(null);
stockInOrderDO.setSignatureRemark(null);
//复制新增时原单的衍生业务/流程字段不能带入新单新增时前端不传保持初始值
//注意组织/创建人/货主/供应商/仓库等由 Assembler App 层重新赋值或单号生成依赖不在本处清理
stockInOrderDO.setInOrderId(null);
stockInOrderDO.setNoticeNumber(null);
stockInOrderDO.setExpectTime(null);
stockInOrderDO.setSupplyChainNumber(null);
stockInOrderDO.setPriorityLevelCode(null);
stockInOrderDO.setPriorityLevelName(null);
stockInOrderDO.setDirectWarehouse(null);
stockInOrderDO.setAnnexUrl(null);
stockInOrderDO.setWeightLimit(null);
stockInOrderDO.setVolumeLimit(null);
stockInOrderDO.setQuantity(null);
stockInOrderDO.setMobilizeCode(null);
stockInOrderDO.setBusinessOrderNo(null);
stockInOrderDO.setDocumentCreator(null);
stockInOrderDO.setDocumentCreatorName(null);
stockInOrderDO.setDocumentDate(null);
stockInOrderDO.setBillingJson(null);
stockInOrderDO.setReceiptOrderAccountList(null);
}
/**
* 新增入库单含复制新建时重置明细的执行态字段
*
* <p>前端复制入库单是把原单详情getInfo整体提交到新增接口明细会带出原单的
* 主键收货/上架状态已分配库区库位/容器验收/质检结果费用等执行数据
* 规则只清空复制时额外多传的字段新增时前端不传的让新单与直接新增行为一致
* 新增时前端会传的业务属性料号名称规格申报要素报关字段备注入库数量等保留不清理
* 明细的组织/创建人/唯一键等由 batchInsert 按当前登录人重新赋值清理后即恢复初始态</p>
*/
private void resetNewOrderDetailState(List<InMaterialDetailDO> detailList) {
if (CollectionUtils.isEmpty(detailList)) {
return;
}
detailList.forEach(detail -> {
if (detail == null) {
return;
}
//唯一键单号组织审计字段 batchInsert 重新生成/赋值
detail.setUniqueId(null);
detail.setInOrderNumber(null);
detail.setOrganizationId(null);
detail.setOrganizationName(null);
detail.setTopOrganizationId(null);
detail.setCreateBy(null);
detail.setCreateByName(null);
detail.setCreateTime(null);
detail.setUpdateBy(null);
detail.setUpdateByName(null);
detail.setUpdateTime(null);
detail.setDelFlag(null);
//计划数量 batchInsert 按入库数量补齐
detail.setQuantity(null);
//重量/体积限制
detail.setWeightLimit(null);
detail.setVolumeLimit(null);
//收货/上架执行数据
detail.setReceiptQuantity(null);
detail.setShelvesQuantity(null);
detail.setActualQuantity(null);
detail.setReceiptStatus(null);
detail.setShelvesStatus(null);
//包装/单位
detail.setPackId(null);
detail.setPackCode(null);
detail.setPackName(null);
detail.setPackDetailId(null);
detail.setUnitCode(null);
detail.setUnitName(null);
detail.setUnitNumber(null);
detail.setMaterialWarehouseControlId(null);
detail.setSerialNumberManage(null);
detail.setBarCode(null);
//批次仓库/库区/库位容器
detail.setBatchNumber(null);
detail.setMaterialStatusCode(null);
detail.setMaterialStatusName(null);
detail.setWarehouseId(null);
detail.setWarehouseCode(null);
detail.setWarehouseName(null);
detail.setStorageSectionId(null);
detail.setStorageCode(null);
detail.setStorageName(null);
detail.setStorageLocationId(null);
detail.setStorageLocationCode(null);
detail.setStorageLocationName(null);
detail.setContainerId(null);
detail.setContainerCode(null);
detail.setContainerType(null);
detail.setContainerTypeName(null);
//层级结构新单均为一级父行level batchInsert 强制为 1
detail.setParentUniqueId(null);
detail.setChildren(null);
//验收/质检结果
detail.setArrivalAcceptQualified(null);
detail.setPackageDamaged(null);
detail.setIsThawWaterstain(null);
detail.setNotifyCustomerAbnormal(null);
detail.setQualityInspectionResults(null);
//费用/展示
detail.setContractFee(null);
detail.setMonthlyWarehouseFee(null);
detail.setHalfMonthWhFee(null);
detail.setDiscountRate(null);
detail.setSingleVolume(null);
detail.setSingleGrossWeight(null);
detail.setLotNo(null);
//执行数据
detail.setCollectQuantity(null);
detail.setShelfJson(null);
//报关推送映射字段
detail.setLineNumGw(null);
detail.setSpecGw(null);
detail.setUnitGw(null);
detail.setQtyGw(null);
detail.setErpCurrGw(null);
detail.setErpPriceGw(null);
detail.setAmountGw(null);
});
}
/**
* 新增入库单
@@ -186,6 +351,9 @@ public class StockInOrderDomainService {
public Boolean insert(StockInOrderDO stockInOrderDO) {
// stockInOrderDO.setInOrderNumber(OrderSequence.getOrderCode("RK"));
//新增单必须从已创建/未审核初始态开始复制新建时原单状态不能带入新单
resetNewOrderState(stockInOrderDO);
//设置入库单号
Long warehouseId = stockInOrderDO.getWarehouseId();
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
@@ -232,6 +400,8 @@ public class StockInOrderDomainService {
// //统计总体积
// BigDecimal volumeLimit = stockInOrderDO.getMaterialDetailList().stream().map(InMaterialDetailDO::getVolumeLimit).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
// stockInOrderDO.setVolumeLimit(volumeLimit);
//复制新建时原单明细的收货数量上架数量作业数量等执行数据不能带入新单统一清空
resetNewOrderDetailState(stockInOrderDO.getMaterialDetailList());
stockInOrderService.insert(stockInOrderDO);
return materialDetailService.batchInsert(stockInOrderDO.getInOrderNumber(), stockInOrderDO.getMaterialDetailList());
}
@@ -53,8 +53,8 @@ public class StockOutOrderPO extends BaseVOEntity {
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
private Integer status;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@@ -256,6 +256,9 @@ public class StockOutOrderPO extends BaseVOEntity {
@Excel(name = "备注")
private String remark;
@ApiModelProperty("Invoice No(多个用逗号隔开)")
private String invoiceNo;
@ApiModelProperty("物料明细")
private List<OutMaterialDetailPO> materialDetailList;
@@ -49,8 +49,8 @@ public class StockOutOrderDO extends BaseVOEntity {
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
private Integer status;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@@ -514,6 +514,9 @@ public class StockOutOrderDO extends BaseVOEntity {
@ApiModelProperty("任务移除用户ID")
private String removeUserId;
@ApiModelProperty("是否返回物料明细(导出时传 true")
private Boolean needDetail;
// ========== PDA出库签名字段 ==========
@ApiModelProperty("签名状态:1-待签名 2-已签名")
private Integer signatureStatus;
@@ -231,6 +231,215 @@ public class StockOutOrderDomainService {
return maxSeq;
}
/**
* 新增出库单含复制新建时重置单据生命周期状态
*
* <p>前端复制出库单是取原单详情getInfo后按新单提交/edit 不带 outOrderId
* 若原单已审核/已分配/已出库审核状态分配数量复核/推送/作业任务等字段会被原样带入新单
* 导致新单状态是已创建但审核时提示已审核等问题此处统一重置保证新单从初始态开始</p>
*/
private void resetNewOrderState(StockOutOrderDO stockOutOrderDO) {
//单据状态回到已创建
stockOutOrderDO.setStatus(1);
//审核状态回到未审核清空审核信息
stockOutOrderDO.setAuditStatus(1);
stockOutOrderDO.setAuditRemark(null);
stockOutOrderDO.setAuditBy(null);
stockOutOrderDO.setAuditByName(null);
stockOutOrderDO.setAuditTime(null);
//清空分配/拣货/复核数量等待重新分配产生
stockOutOrderDO.setAllocationQuantity(BigDecimal.ZERO);
stockOutOrderDO.setAlreadyAllocationQuantity(BigDecimal.ZERO);
stockOutOrderDO.setPickingQuantity(BigDecimal.ZERO);
stockOutOrderDO.setCheckQuantity(BigDecimal.ZERO);
//复核状态复位
stockOutOrderDO.setCheckStatus(1);
stockOutOrderDO.setCheckTaskDistribution(2);
stockOutOrderDO.setCheckTaskDistributionTime(null);
stockOutOrderDO.setCheckOperatorsBy(null);
stockOutOrderDO.setCheckOperatorsName(null);
//推送状态复位
stockOutOrderDO.setPushStatus(1);
stockOutOrderDO.setPushTime(null);
stockOutOrderDO.setPushBy(null);
stockOutOrderDO.setPushByName(null);
//取消/关闭复位
stockOutOrderDO.setCancelOrder(2);
stockOutOrderDO.setCancelRemark(null);
stockOutOrderDO.setCancelBy(null);
stockOutOrderDO.setCancelByName(null);
stockOutOrderDO.setCancelTime(null);
stockOutOrderDO.setCloseOrder(2);
stockOutOrderDO.setCloseRemark(null);
stockOutOrderDO.setCloseBy(null);
stockOutOrderDO.setCloseByName(null);
stockOutOrderDO.setCloseTime(null);
//作业任务复位
stockOutOrderDO.setWorkUserId(null);
stockOutOrderDO.setWorkUserName(null);
stockOutOrderDO.setWorkTaskReceiveStatus(null);
stockOutOrderDO.setTaskIssueUserId(null);
//签名状态复位
stockOutOrderDO.setSignatureStatus(null);
stockOutOrderDO.setSignatureTime(null);
stockOutOrderDO.setSignaturePic(null);
stockOutOrderDO.setEvidencePics(null);
stockOutOrderDO.setSignatureRemark(null);
//复制新增时原单的衍生业务/流程字段不能带入新单新增时前端不传保持初始值
//注意组织/创建人/货主/客户等由 Assembler App 层重新赋值不在本处清理
stockOutOrderDO.setOutOrderId(null);
stockOutOrderDO.setNoticeNumber(null);
stockOutOrderDO.setExpectTime(null);
stockOutOrderDO.setSupplyChainNumber(null);
stockOutOrderDO.setPriorityLevelCode(null);
stockOutOrderDO.setPriorityLevelName(null);
stockOutOrderDO.setDirectWarehouse(null);
stockOutOrderDO.setReview(null);
stockOutOrderDO.setAnnexUrl(null);
stockOutOrderDO.setWeightLimit(null);
stockOutOrderDO.setVolumeLimit(null);
stockOutOrderDO.setMobilizeCode(null);
stockOutOrderDO.setTransportModeCode(null);
stockOutOrderDO.setSupervisionModeCode(null);
stockOutOrderDO.setContainerNoName(null);
stockOutOrderDO.setDocumentCreator(null);
stockOutOrderDO.setDocumentCreatorName(null);
stockOutOrderDO.setDocumentDate(null);
stockOutOrderDO.setCarrierName(null);
stockOutOrderDO.setBillingJson(null);
stockOutOrderDO.setReceiptOrderAccountList(null);
stockOutOrderDO.setReturnQuantity(null);
stockOutOrderDO.setTrainNo(null);
}
/**
* 新增出库单含复制新建时重置明细的执行态字段
*
* <p>前端复制出库单是把原单详情getInfo整体提交到新增接口明细会带出原单的
* 主键已分配库存/批次/库区库位/容器拣货复核数量抄码重量收费等执行数据
* 规则只清空复制时额外多传的字段新增时前端不传的让新单与直接新增行为一致
* 新增时前端会传的业务属性料号规格申报要素报关字段备注出库数量等保留不清理
* 明细的组织/创建人/计划数量等由 batchInsert 按当前登录人重新赋值清理后即恢复初始态</p>
*/
private void resetNewOrderDetailState(List<OutMaterialDetailDO> detailList) {
if (CollectionUtils.isEmpty(detailList)) {
return;
}
detailList.forEach(detail -> {
if (detail == null) {
return;
}
//主键与唯一键重新生成避免与原单重复/冲突
detail.setMaterialDetailId(null);
detail.setUniqueId(null);
detail.setOutOrderNumber(null);
//单据组织审计字段 batchInsert 按当前登录人重新赋值
detail.setOrganizationId(null);
detail.setOrganizationName(null);
detail.setTopOrganizationId(null);
detail.setCreateBy(null);
detail.setCreateByName(null);
detail.setCreateTime(null);
detail.setUpdateBy(null);
detail.setUpdateByName(null);
detail.setUpdateTime(null);
detail.setDelFlag(null);
//计划数量 batchInsert 按出库数量重新计算
detail.setQuantity(null);
//执行数量
detail.setInventoryQuantity(null);
detail.setAllocationQuantity(null);
detail.setAlreadyAllocationQuantity(null);
detail.setNowAllocationQuantity(null);
detail.setPickingQuantity(null);
detail.setCheckQuantity(null);
detail.setActualQuantity(null);
//重量/体积限制
detail.setWeightLimit(null);
detail.setVolumeLimit(null);
//物料基础信息batchInsert 会按主数据重填条码/商品名称等
detail.setMaterialCode(null);
detail.setMaterialName(null);
detail.setBarCode(null);
detail.setCommodityName(null);
detail.setCommodityNo(null);
//包装/单位
detail.setPackId(null);
detail.setPackCode(null);
detail.setPackName(null);
detail.setPackDetailId(null);
detail.setUnitCode(null);
detail.setUnitName(null);
detail.setUnitNumber(null);
detail.setMaterialWarehouseControlId(null);
detail.setSerialNumberManage(null);
//已分配库存批次库区/库位容器
detail.setWarehouseId(null);
detail.setWarehouseCode(null);
detail.setWarehouseName(null);
detail.setMaterialInventoryId(null);
detail.setBatchNumber(null);
detail.setMaterialStatusCode(null);
detail.setMaterialStatusName(null);
detail.setStorageSectionId(null);
detail.setStorageCode(null);
detail.setStorageName(null);
detail.setStorageLocationId(null);
detail.setStorageLocationCode(null);
detail.setStorageLocationName(null);
detail.setContainerId(null);
detail.setContainerCode(null);
detail.setContainerType(null);
detail.setContainerTypeName(null);
//层级结构新单均为一级父行子行由 batchInsert 忽略不落库
detail.setLevel(null);
detail.setParentUniqueId(null);
detail.setAllowModify(null);
detail.setGenPickingOrder(null);
detail.setChildren(null);
//复核重量状态标识
detail.setCheckNetWeight(null);
detail.setCheckGrossWeight(null);
detail.setCheckVolume(null);
detail.setCheckArea(null);
detail.setIsAllocated(null);
//抄码数据
detail.setCopyCodeReferenceIds(null);
detail.setCopyTotalWeight(null);
detail.setOutWeight(null);
detail.setOutVolume(null);
detail.setOutQuantity(null);
//库存展示/费用/批次信息
detail.setStockQuantity(null);
detail.setStockUnit(null);
detail.setLotNo(null);
detail.setContractFee(null);
detail.setMonthlyWarehouseFee(null);
detail.setHalfMonthWhFee(null);
detail.setDiscountRate(null);
detail.setSingleVolume(null);
detail.setSingleGrossWeight(null);
detail.setInOrderNumber(null);
detail.setProductionDate(null);
//报关推送映射字段
detail.setLineNumGw(null);
detail.setSpecGw(null);
detail.setUnitGw(null);
detail.setQtyGw(null);
detail.setErpCurrGw(null);
detail.setErpPriceGw(null);
detail.setAmountGw(null);
detail.setInOrderNumberGw(null);
detail.setInLineNumGw(null);
detail.setOpWhLocGw(null);
detail.setWarehouseGw(null);
detail.setInvtRowGw(null);
detail.setBondInvtNoGw(null);
detail.setWhNoGw(null);
detail.setSeatNoGw(null);
});
}
/**
* 新增出库单
@@ -239,6 +448,9 @@ public class StockOutOrderDomainService {
public Boolean insert(StockOutOrderDO stockOutOrderDO) {
// stockOutOrderDO.setOutOrderNumber(OrderSequence.getOrderCode("CK"));
//新增单必须从已创建/未审核初始态开始复制新建时原单状态不能带入新单
resetNewOrderState(stockOutOrderDO);
//设置单号
Long warehouseId = stockOutOrderDO.getWarehouseId();
AjaxResult ajaxResult = systemServiceFeign.getWarehouseInfoByWarehouseId(warehouseId);
@@ -290,6 +502,8 @@ public class StockOutOrderDomainService {
if (stockOutOrderDO.getCheckTaskDistribution() == null) {
stockOutOrderDO.setCheckTaskDistribution(2);
}
//复制新建时原单明细的库存数量分配数量拣货/复核数量等执行数据不能带入新单统一清空
resetNewOrderDetailState(stockOutOrderDO.getMaterialDetailList());
stockOutOrderService.insert(stockOutOrderDO);
return outMaterialDetailService.batchInsert(stockOutOrderDO.getOutOrderNumber(), stockOutOrderDO.getMaterialDetailList());
}
@@ -446,6 +446,9 @@ public class StockInOrderDTO extends StockInOrderBaseDTO {
@ApiModelProperty("任务移除用户ID")
private String removeUserId;
@ApiModelProperty("是否返回物料明细(导出时传 true")
private Boolean needDetail;
// ========== PDA入库签名字段 ==========
@ApiModelProperty("签名状态:1-待签名 2-已签名")
private Integer signatureStatus;
@@ -47,8 +47,8 @@ public class StockOutOrderDTO extends StockOutOrderBaseDTO {
@Excel(name = "出库单号")
private String outOrderNumber;
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭")
@ApiModelProperty("出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
@Excel(name = "出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接")
private Integer status;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@@ -503,6 +503,9 @@ public class StockOutOrderDTO extends StockOutOrderBaseDTO {
@ApiModelProperty("任务移除用户ID")
private String removeUserId;
@ApiModelProperty("是否返回物料明细(导出时传 true")
private Boolean needDetail;
// ========== PDA出库签名字段 ==========
@ApiModelProperty("签名状态:1-待签名 2-已签名")
private Integer signatureStatus;
@@ -12,6 +12,7 @@ import com.mhd.wms.domain.copyCodeReference.entity.CopyCodeReference;
import com.mhd.wms.domain.copyCodeReference.repository.po.CopyCodeReferencePO;
import com.mhd.wms.domain.handoverTaskOrder.entity.HandoverTaskOrder;
import com.mhd.wms.domain.handoverTaskOrder.repository.facade.IHandoverTaskOrderService;
import com.mhd.wms.domain.handoverTaskOrder.service.HandoverTaskOrderDomainService;
import com.mhd.wms.domain.inMaterialDetail.entity.InMaterialDetail;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
@@ -68,6 +69,8 @@ public class StockOutOrderApi extends BaseController {
private IStockOutOrderService stockOutOrderService;
@Autowired
private ExcelParseService excelParseService;
// @Autowired
// private HandoverTaskOrderDomainService handoverTaskOrderDomainService;
/**
* 提货单大标题未选时为提货单可传副标题如谷丰--营销部或与弹窗一致传整段提货单--谷丰--营销部后者原样作标题并将 -- 规范为
@@ -106,6 +109,12 @@ public class StockOutOrderApi extends BaseController {
List<StockOutOrderPO> list = stockOutOrderApplicationService.queryList(stockOutOrderDO);
return getDataTable(list);
}
//
// @ApiOperation("海关确认出库(人工批量触发,参数为空则扫全部已交接状态)")
// @PostMapping("/customsConfirmOut")
// public AjaxResult customsConfirmOut(@RequestBody(required = false) List<String> outOrderNumbers) {
// return handoverTaskOrderDomainService.customsConfirmOut(outOrderNumbers);
// }
/**
* PDA出库签名列表查询
@@ -451,4 +451,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
GROUP BY a.out_order_number
</select>
<!-- 出库列表页:按出库单号批量取去重后的 Invoice No -->
<select id="selectDistinctInvoiceNoForStockOutList" resultType="com.mhd.wms.domain.outMaterialDetail.repository.po.OutStockListMaterialAgg">
SELECT DISTINCT
a.out_order_number AS outOrderNumber,
a.INVOICE_NO AS invoiceNo
FROM out_material_detail a
WHERE a.del_flag = 1
AND a.level = 1
AND a.INVOICE_NO IS NOT NULL
AND a.INVOICE_NO != ''
AND a.out_order_number IN
<foreach collection="outOrderNumbers" item="num" open="(" separator="," close=")">
#{num}
</foreach>
</select>
</mapper>
@@ -356,4 +356,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="joinStockInOrderPoWhere"/>
</where>
</select>
<!-- 入库列表页:按入库单号批量取去重后的 Invoice No -->
<select id="selectDistinctInvoiceNoForStockInList" resultType="com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg">
SELECT DISTINCT
a.in_order_number AS inOrderNumber,
a.INVOICE_NO AS invoiceNo
FROM in_material_detail a
WHERE a.del_flag = 1
AND a.level = 1
AND a.INVOICE_NO IS NOT NULL
AND a.INVOICE_NO != ''
AND a.in_order_number IN
<foreach collection="inOrderNumbers" item="num" open="(" separator="," close=")">
#{num}
</foreach>
</select>
</mapper>