Merge branch 'dev-ty1.2' into test

# Conflicts:
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/BmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/OmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WlhyServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/WmsServiceFeign.java
#	mhd-api/mhd-api-system/src/main/java/com/mhd/system/api/YmsServiceFeign.java
#	mhd-common/mhd-common-core/src/main/java/com/mhd/common/core/feign/ThirdPartyServiceFeign.java
#	mhd_oms/src/main/java/com/mhd/oms/infrastructure/feign/ThirdPartyServiceFeign.java
This commit is contained in:
王奎兴
2026-09-14 14:43:19 +08:00
162 changed files with 4337 additions and 242 deletions
@@ -158,6 +158,14 @@ public class HandoverTaskOrderApplicationService {
return handoverTaskOrderDomainService.getInfo(outTaskOrderId);
}
/**
* 获取交接作业单归档详情(已反审): 反审时交接单已软删, 供【已反审】tab 查看归档详情
*/
public HandoverTaskOrderPO getReverseInfo(Long outTaskOrderId)
{
return handoverTaskOrderDomainService.getReverseInfo(outTaskOrderId);
}
/**
* 按作业单号获取交接作业单详细信息(PDA 端)
* 用于下发任务(taskType=7)中 trackingNumber 对应交接作业单的 taskNumber
@@ -2,9 +2,12 @@ package com.mhd.wms.application.service.inMaterialDetail;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailExportPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.inMaterialDetail.service.InMaterialDetailDomainService;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -39,6 +42,51 @@ public class InMaterialDetailApplicationService {
return inMaterialDetailDomainService.queryList(inMaterialDetailDO);
}
/**
* 入库明细查询(关联入库单,只统计已入库(5)单据)
*/
public List<InMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
queryOrderOverStockDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
}
return inMaterialDetailDomainService.queryInOrderDetailList(queryOrderOverStockDO);
}
/**
* 入库明细导出(专用列集,口径同 queryInOrderDetailList,不分页)
*/
public List<InMaterialDetailExportPO> exportInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
List<InMaterialDetailExportPO> list = inMaterialDetailDomainService.exportInOrderDetailList(setDataPermission(queryOrderOverStockDO));
// 货物种类=挂载分类的父级分类名称:material_classify_name为分类路径(如"食品,饮料"),取倒数第二段;
// 仅一级分类(无父级)时取自身名称
for (InMaterialDetailExportPO po : list) {
String names = po.getMaterialClassifyName();
if (names != null && names.contains(",")) {
String[] parts = names.split(",");
po.setMaterialClassifyName(parts[parts.length - 2].trim());
}
}
return list;
}
/**
* 数据权限:非平台超管(1)按登录人一级组织过滤
*/
private QueryOrderOverStockDO setDataPermission(QueryOrderOverStockDO queryOrderOverStockDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
}
}
return queryOrderOverStockDO;
}
/**
* 新增物料明细
@@ -167,7 +167,11 @@ public class InvestigationManageApplicationService {
}
List<InvestigetionManageDetailPO> detailList = investigationManagePO.getInvestigetionManageDetailList();
// 物料编码相同的明细排在一起展示(稳定排序,同编码内保持原顺序;仅排序不聚合,各条明细独立)
detailList.sort(Comparator.comparing(InvestigetionManageDetailPO::getMaterialCode,
Comparator.nullsLast(Comparator.naturalOrder())));
// 性能优化:批量获取批次属性,避免N+1查询问题
// 1. 收集所有唯一的materialBaseInfoId
Set<Long> materialBaseInfoIdSet = detailList.stream()
@@ -236,8 +240,9 @@ public class InvestigationManageApplicationService {
if (materialBaseInfoId != null && batchDetailMap.containsKey(materialBaseInfoId)) {
List<BatchDetailFeignPO> batchDetailFeignPOList = batchDetailMap.get(materialBaseInfoId);
// 用于跟踪已添加到列表中的batchDetailId
// 用于跟踪已添加到列表中的batchDetailIdbatchDetailId为空的配置行改用标签去重,不再丢弃)
Set<Long> addedBatchDetailIds = new HashSet<>();
Set<String> addedLabelKeys = new HashSet<>();
for (BatchDetailFeignPO batchDetailFeignPO : batchDetailFeignPOList) {
MaterialMoreDetailPO materialMoreDetailPO = new MaterialMoreDetailPO();
@@ -249,40 +254,44 @@ public class InvestigationManageApplicationService {
materialMoreDetailPO.setAttributeOption(batchDetailFeignPO.getAttributeOption());
materialMoreDetailPO.setRemark(batchDetailFeignPO.getRemark());
// 确保添加到列表中(使用batchDetailId来避免重复
// 确保添加到列表中(batchDetailId+标签双重去重,batchDetailId为空的配置行也保留
Long batchDetailId = batchDetailFeignPO.getBatchDetailId();
if (batchDetailId != null && !addedBatchDetailIds.contains(batchDetailId)) {
String labelKey = batchDetailFeignPO.getBatchLabels() == null ? "" : batchDetailFeignPO.getBatchLabels().trim();
boolean duplicated = addedLabelKeys.contains(labelKey)
|| (batchDetailId != null && addedBatchDetailIds.contains(batchDetailId));
if (!duplicated) {
materialMoreDetailList.add(materialMoreDetailPO);
addedBatchDetailIds.add(batchDetailId);
addedLabelKeys.add(labelKey);
if (batchDetailId != null) {
addedBatchDetailIds.add(batchDetailId);
}
}
// 根据fieldName或batchLabels从库存表中获取对应的字段值
if (materialInventoryPO != null) {
String fieldValue = null;
String usedFieldName = null;
// 优先使用fieldName(如果存在)
if (StringUtils.isNotBlank(batchDetailFeignPO.getFieldName())) {
usedFieldName = batchDetailFeignPO.getFieldName();
String usedFieldName = batchDetailFeignPO.getFieldName();
fieldValue = getFieldValueByFieldName(materialInventoryPO, usedFieldName);
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
log.info("批次属性 batchDetailId={}, fieldName={}, 从库存表获取到的值={}",
batchDetailFeignPO.getBatchDetailId(), usedFieldName, fieldValue);
}
// 如果fieldName为空,尝试根据batchLabels映射字段名
else if (StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
}
// fieldName没取到值时,回退按batchLabels映射字段名再取一次(修复fieldName配置失效导致值永远为空)
if (fieldValue == null && StringUtils.isNotBlank(batchDetailFeignPO.getBatchLabels())) {
String fieldNameByLabel = getFieldNameByBatchLabel(batchDetailFeignPO.getBatchLabels());
if (StringUtils.isNotBlank(fieldNameByLabel)) {
usedFieldName = fieldNameByLabel;
fieldValue = getFieldValueByFieldName(materialInventoryPO, usedFieldName);
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
usedFieldName, fieldValue);
fieldValue = getFieldValueByFieldName(materialInventoryPO, fieldNameByLabel);
log.info("批次属性 batchDetailId={}, batchLabels={}, 映射字段名={}, 从库存表获取到的值={}",
batchDetailFeignPO.getBatchDetailId(), batchDetailFeignPO.getBatchLabels(),
fieldNameByLabel, fieldValue);
}
}
// 只有当获取到值时才更新attributeValue
if (fieldValue != null) {
materialMoreDetailPO.setAttributeValue(fieldValue);
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
log.info("设置更多属性:batchDetailId={}, batchLabels={}, attributeValue={}",
materialMoreDetailPO.getBatchDetailId(), materialMoreDetailPO.getBatchLabels(),
materialMoreDetailPO.getAttributeValue());
}
}
@@ -306,22 +315,29 @@ public class InvestigationManageApplicationService {
return null;
}
// 批次标签到字段名的映射关系
Map<String, String> labelToFieldNameMap = new HashMap<>();
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
labelToFieldNameMap.put("Invoice No", "invoiceNo");
labelToFieldNameMap.put("发票号", "invoiceNo");
// 批次标签到字段名的映射关系LinkedHashMap保证匹配优先级稳定;长key放前面,避免短标签模糊匹配被抢先误匹配)
Map<String, String> labelToFieldNameMap = new LinkedHashMap<>();
labelToFieldNameMap.put("Batch Ref NO's", "batchRefNo");
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
labelToFieldNameMap.put("Invoice No.", "invoiceNo");
labelToFieldNameMap.put("发票号", "invoiceNo");
labelToFieldNameMap.put("Batch Ref NO", "batchRefNo");
labelToFieldNameMap.put("批次参考号", "batchRefNo");
labelToFieldNameMap.put("Sheet Ref NO's", "sheetRefNo");
labelToFieldNameMap.put("Sheet Ref NO", "sheetRefNo");
labelToFieldNameMap.put("单据参考号", "sheetRefNo");
labelToFieldNameMap.put("箱号/卡板号", "boxPalletNo");
labelToFieldNameMap.put("箱号", "boxPalletNo");
labelToFieldNameMap.put("卡板号", "boxPalletNo");
labelToFieldNameMap.put("Batch Number", "batchNumber");
labelToFieldNameMap.put("Production Date", "productionDate");
labelToFieldNameMap.put("生产日期", "productionDate");
labelToFieldNameMap.put("Expiry Date", "expiryDate");
labelToFieldNameMap.put("EXP Date", "expiryDate");
labelToFieldNameMap.put("过期日期", "expiryDate");
labelToFieldNameMap.put("Batch No", "batchNumber");
labelToFieldNameMap.put("批次号", "batchNumber");
labelToFieldNameMap.put("入库日期", "createTime");
labelToFieldNameMap.put("入库时间", "createTime");
labelToFieldNameMap.put("存货日期", "inventoryDate");
labelToFieldNameMap.put("扩展字段1", "extAttr1");
labelToFieldNameMap.put("扩展字段2", "extAttr2");
@@ -334,14 +350,16 @@ public class InvestigationManageApplicationService {
return fieldName;
}
// 模糊匹配(包含关系)
// 模糊匹配(包含关系):多个key命中时取最长的key,保证同一标签映射结果稳定
String bestMatchKey = null;
for (Map.Entry<String, String> entry : labelToFieldNameMap.entrySet()) {
if (batchLabel.contains(entry.getKey()) || entry.getKey().contains(batchLabel)) {
return entry.getValue();
if (bestMatchKey == null || entry.getKey().length() > bestMatchKey.length()) {
bestMatchKey = entry.getKey();
}
}
}
return null;
return bestMatchKey != null ? labelToFieldNameMap.get(bestMatchKey) : null;
}
/**
@@ -0,0 +1,54 @@
package com.mhd.wms.application.service.outMaterialDetail;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO;
import com.mhd.wms.domain.outMaterialDetail.service.OutMaterialDetailDomainService;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 出库物料明细ApplicationService
*
* @author rcx
* @date 2026-09-09
*/
@Service
@Slf4j
public class OutMaterialDetailApplicationService {
@Autowired
private OutMaterialDetailDomainService outMaterialDetailDomainService;
/**
* 出库明细查询(关联出库单,只统计已出库(9/12/13)单据)
*/
public List<OutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailDomainService.queryOutOrderDetailList(setDataPermission(queryOrderOverStockDO));
}
/**
* 出库明细导出(专用列集,口径同 queryOutOrderDetailList,不分页)
*/
public List<OutMaterialDetailExportPO> exportOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailDomainService.exportOutOrderDetailList(setDataPermission(queryOrderOverStockDO));
}
/**
* 数据权限:非平台超管(1)按登录人一级组织过滤
*/
private QueryOrderOverStockDO setDataPermission(QueryOrderOverStockDO queryOrderOverStockDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
queryOrderOverStockDO.setTopOrganizationId(topOrganizationId);
}
}
return queryOrderOverStockDO;
}
}
@@ -282,11 +282,18 @@ public class PickingOrderApplicationService {
setMaterialMoreDetailListRecursively(pickingMaterialDetailPOList, batchDetailMap);
pickingOrderPO.setMaterialDetailList(pickingMaterialDetailPOList);
log.info("返回拣货单信息,pickingOrderId={}, materialDetailList大小={}",
pickingOrderPO.getPickingOrderId(),
log.info("返回拣货单信息,pickingOrderId={}, materialDetailList大小={}",
pickingOrderPO.getPickingOrderId(),
pickingMaterialDetailPOList != null ? pickingMaterialDetailPOList.size() : 0);
return pickingOrderPO;
}
/**
* 获取拣货单归档详情(已反审): 反审时拣货单已软删(del_flag=2), 供【已反审】tab 查看归档详情
*/
public PickingOrderPO getReverseInfoByIdAndType(Long pickingOrderId, Integer type) {
return pickingOrderDomainService.getReverseInfoByIdAndType(pickingOrderId, type);
}
/**
* 递归为物料明细设置更多属性
@@ -186,6 +186,27 @@ public class ReviewOrderApplicationService {
header.setMaterialDetailList(details);
return header;
}
/**
* 获取复核单归档详情(已反审): 反审时复核单/明细均已软删(del_flag=2), 供【已反审】tab 查看归档详情
*/
public ReviewOrderPO getReverseDetailByReviewOrderId(Long reviewOrderId) {
if (reviewOrderId == null) {
throw new ServiceException("复核单ID不能为空");
}
ReviewOrderPO header = reviewOrderMapper.selectHeaderByReviewOrderIdReverse(reviewOrderId);
if (header == null) {
throw new ServiceException("复核单不存在");
}
List<ReviewMaterialDetailPO> details = reviewOrderMapper.queryDetailByReviewOrderIdReverse(reviewOrderId);
fillDisplayQtyFields(details);
Map<Long, List<BatchDetailFeignPO>> batchDetailMap = loadDisplayBatchDetailMap(details);
fillDynamicBatchDisplayFields(details, batchDetailMap);
buildReviewMaterialMoreDetailListLikeShelf(details, batchDetailMap);
fillHeaderSummary(header, details);
header.setMaterialDetailList(details);
return header;
}
public ReviewOrderPO getDetailByReviewOrderNumber(String reviewOrderNumber) {
@@ -667,7 +667,16 @@ public class StockInOrderApplicationService {
*/
public StockInOrderPO getInfo(Long inOrderId)
{
StockInOrderPO info = stockInOrderDomainService.getInfo(inOrderId);
return getInfo(inOrderId, false);
}
/**
* 获取入库单详情
* @param archive true-查询【已反审】tab 归档数据(已软删+已反审标记,明细放行软删行)
*/
public StockInOrderPO getInfo(Long inOrderId, boolean archive)
{
StockInOrderPO info = stockInOrderDomainService.getInfo(inOrderId, archive);
String userNcCode = stockOutOrderMapper.getUserNcCode(info.getShipperId());
info.setKhdm(userNcCode);
List<InMaterialDetailPO> materialDetailList = info.getMaterialDetailList();
@@ -762,6 +771,14 @@ public class StockInOrderApplicationService {
return info;
}
/**
* 查询入库单【已反审】tab 归档详情(已软删+已反审标记的数据,含软删明细/收货单/上架单)
*/
public StockInOrderPO getReverseAuditInfo(Long inOrderId)
{
return getInfo(inOrderId, true);
}
/**
@@ -955,6 +972,14 @@ public class StockInOrderApplicationService {
stockInOrderDomainService.cancelExecutionOrder(stockInOrder);
}
/**
* OMS入库业务单反审:WMS侧回退已完成单据(出库拦截 -> 回退库存 ->
* 逻辑删除收货/上架链路 -> 写入库异常【反审记录】),已产生出库则报错拦截
*/
public void omsReverseInOrder(StockInOrder stockInOrder){
stockInOrderDomainService.reverseExecutionOrder(stockInOrder);
}
/**
* @description 取消入库单
* @author ZhouGY
@@ -500,7 +500,15 @@ public class StockOutOrderApplicationService {
return stockOutOrderPO;
}
/**
* 获取出库单归档详情(已反审): 反审时单据已软删, 已反审tab 查看归档详情
*/
public StockOutOrderPO getReverseInfoChildren(Long outOrderId)
{
return stockOutOrderDomainService.getReverseInfoChildren(outOrderId);
}
/**
* 出库交接场景递归过滤 pickingQuantity 0 的明细与交接详情一致
* @param detailList 物料明细树
@@ -1950,6 +1958,13 @@ public class StockOutOrderApplicationService {
stockOutOrderDomainService.cancelExecutionOrder(stockOutOrder);
}
/**
* oms出库执行单反审(已出库单据回退): 还原实物库存并推送OMS清理单据生成反审异常记录
*/
public void reverseExecutionOrder(StockOutOrder stockOutOrder){
stockOutOrderDomainService.reverseExecutionOrder(stockOutOrder);
}
public void omsOrderAddDetail(List<OutMaterialDetail> outMaterialDetails){
stockOutOrderDomainService.omsOrderAddDetail(outMaterialDetails);
}
@@ -201,9 +201,22 @@ public class StockReceiptOrderApplicationService {
*/
public StockReceiptOrderPO getInfo(Long receiptOrderId)
{
StockReceiptOrderPO stockReceiptOrderPO = stockReceiptOrderDomainService.getInfo(receiptOrderId);
return getInfo(receiptOrderId, false);
}
/**
* 获取收货单详情
* @param archive true-查询已反审tab 归档数据已软删+已反审标记明细放行软删行
*/
public StockReceiptOrderPO getInfo(Long receiptOrderId, boolean archive)
{
StockReceiptOrderPO stockReceiptOrderPO = stockReceiptOrderDomainService.getInfo(receiptOrderId, archive);
ReceiptMaterialDetailDO receiptMaterialDetailDO = new ReceiptMaterialDetailDO();
receiptMaterialDetailDO.setReceiptOrderNumber(stockReceiptOrderPO.getReceiptOrderNumber());
if (archive) {
//归档明细已随主单软删放行软删行
receiptMaterialDetailDO.setDelFlag(2);
}
List<ReceiptMaterialDetailPO> receiptMaterialDetailPOList = receiptMaterialDetailDomainService.queryListChildren(receiptMaterialDetailDO);
// 性能优化批量获取批次属性避免N+1查询问题
@@ -306,6 +319,14 @@ public class StockReceiptOrderApplicationService {
totalNetWeight, totalGrossWeight, totalVolume, totalArea);
return stockReceiptOrderPO;
}
/**
* 查询收货单已反审tab 归档详情已软删+已反审标记的数据含软删明细
*/
public StockReceiptOrderPO getReverseAuditInfo(Long receiptOrderId)
{
return getInfo(receiptOrderId, true);
}
/**
* 根据物料基础信息ID获取批次属性更多属性只返回isDisplay=1的属性
@@ -134,12 +134,12 @@ public class StockShelfOrderApplicationService {
private static final String VERIFY = "ESLuxAmB6VXCgbqP1eFzxTPVRagkQ62BUkfhElrgQ6XmE/g2reHVflY/SiCSU7JD";
/** 仅这些仓库的上架单在PC上传页默认填充上架库位按仓库名匹配需放开其他仓库时在此追加
* 生产环境维他奶仓warehouseId=14已对照线上库位树验证库区id=20库位id=33测试环境为 青洲仓warehouseId=13需测试时切换 */
private static final Set<String> DEFAULT_STORAGE_LOCATION_WAREHOUSE_NAMES = new HashSet<>(Collections.singletonList("维他奶"));
/** 默认上架库位指定库区名库位名精确匹配须与基础资料名称完全一致注意含繁体字
* 生产环境維他奶2层冷凍A區 2层冷凍A區A01测试环境为 4楼A区 4A-01-01需测试时切换 */
private static final String DEFAULT_SHELF_STORAGE_NAME = "維他奶2层冷凍A區";
private static final String DEFAULT_SHELF_STORAGE_LOCATION_NAME = "2层冷凍A區A01";
* 测试环境青洲仓warehouseId=13生产环境为 维他奶仓warehouseId=14已对照线上库位树验证库区id=20库位id=33发版前需切换 */
private static final Set<String> DEFAULT_STORAGE_LOCATION_WAREHOUSE_NAMES = new HashSet<>(Collections.singletonList("青洲"));
/** 默认上架库位指定库区名库位名精确匹配须与基础资料名称完全一致
* 测试环境4楼A区 4A-01-01生产环境为 維他奶2层冷凍A區 2层冷凍A區A01含繁体字发版前需切换 */
private static final String DEFAULT_SHELF_STORAGE_NAME = "4楼A区";
private static final String DEFAULT_SHELF_STORAGE_LOCATION_NAME = "4A-01-01";
/** 仅这些组织的上架单在PC上传页默认填充上架库位(按组织id精确匹配;测试与生产均为 谷丰=2842,若不一致需按环境切换) */
private static final Set<Long> DEFAULT_STORAGE_LOCATION_ORGANIZATION_IDS = new HashSet<>(Collections.singletonList(2842L));
@@ -243,6 +243,13 @@ public class StockShelfOrderApplicationService {
return getInfo(shelfOrderId, false);
}
/**
* 查询上架单已反审tab 归档详情已软删+已反审标记的数据含软删明细
*/
public StockShelfOrderPO getReverseAuditInfo(Long shelfOrderId) {
return stockShelfOrderDomainService.getInfo(shelfOrderId, true);
}
/**
* 获取上架单详细信息
*
@@ -144,4 +144,7 @@ public class HandoverTaskOrder extends BaseVOEntity {
private String operatorsName;
@ApiModelProperty("计费信息")
private String billingJson;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -146,4 +146,7 @@ public class HandoverTaskOrderPO extends BaseVOEntity {
private List<TaskHandoverMaterialDetailPO> materialDetailList;
@ApiModelProperty("计费信息")
private String billingJson;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -146,4 +146,7 @@ public class HandoverTaskOrderDO extends BaseVOEntity {
private String pictureApp;
private String billingJson;
}
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -44,6 +44,7 @@ import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryM
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailMapper;
import com.mhd.wms.domain.pickingMaterialDetail.entity.PickingMaterialDetail;
import com.mhd.wms.domain.pickingMaterialDetail.repository.mapper.PickingMaterialDetailMapper;
import com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO;
import com.mhd.wms.domain.shelfMaterialDetail.repository.todo.ShelfMaterialDetailDO;
@@ -242,6 +243,90 @@ public class HandoverTaskOrderDomainService {
return handoverTaskOrderPO;
}
/**
* 获取交接作业单归档详情(已反审): 出库单反审时交接单及关联出库明细均已软删(del_flag=2),
* 本方法镜像 getInfo del_flag=2 查归档数据, 供交接单已反审tab 查看详情
*/
public HandoverTaskOrderPO getReverseInfo(Long outTaskOrderId)
{
HandoverTaskOrderPO handoverTaskOrderPO = handoverTaskOrderService.getInfo(outTaskOrderId);
if (handoverTaskOrderPO == null) {
return null;
}
String orderNumber = handoverTaskOrderPO.getOrderNumber();
if (orderNumber != null && !orderNumber.trim().isEmpty()) {
StockOutOrder stockOutOrder = stockOutOrderMapper.selectOne(new QueryWrapper<StockOutOrder>().lambda()
.eq(StockOutOrder::getOutOrderNumber, orderNumber)
.eq(StockOutOrder::getDelFlag, 2));
Integer review = stockOutOrder != null ? stockOutOrder.getReview() : null;
// 归档明细: 出库明细已随反审软删, del_flag=2
LambdaQueryWrapper<OutMaterialDetail> omdQuery = new QueryWrapper<OutMaterialDetail>().lambda()
.eq(OutMaterialDetail::getOutOrderNumber, orderNumber)
.eq(OutMaterialDetail::getDelFlag, 2);
List<OutMaterialDetail> outMaterialDetailList = outMaterialDetailMapper.selectList(omdQuery);
List<TaskHandoverMaterialDetailPO> materialDetailList = new ArrayList<>();
for (OutMaterialDetail omd : outMaterialDetailList) {
BigDecimal handoverQuantity;
BigDecimal pickQty;
if (Integer.valueOf(1).equals(review)) {
// 需要复核时仅限复核单上的明细picking_material_detail 有拣货的 unique_id
List<PickingMaterialDetail> pmdList = pickingMaterialDetailMapper.selectList(new QueryWrapper<PickingMaterialDetail>().lambda()
.eq(PickingMaterialDetail::getOutUniqueId, omd.getUniqueId())
.eq(PickingMaterialDetail::getDelFlag, 2)
.gt(PickingMaterialDetail::getPickingQuantity, BigDecimal.ZERO));
if (pmdList == null || pmdList.isEmpty()) {
continue;
}
if (omd.getCheckQuantity() == null || omd.getCheckQuantity().compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
PickingMaterialDetailPO pickingSummary = pickingMaterialDetailMapper.queryTotalsByOutNumberAndBaseId(omd.getUniqueId());
pickQty = (pickingSummary != null && pickingSummary.getPickingQuantity() != null) ? pickingSummary.getPickingQuantity() : BigDecimal.ZERO;
if (pickQty.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
handoverQuantity = omd.getCheckQuantity();
} else {
BigDecimal qty = omd.getPickingQuantity() != null ? omd.getPickingQuantity() : omd.getQuantity();
if (qty == null || qty.compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
pickQty = qty;
handoverQuantity = qty;
}
TaskHandoverMaterialDetailPO detail = new TaskHandoverMaterialDetailPO();
detail.setMaterialDetailId(omd.getMaterialDetailId());
detail.setUniqueId(omd.getUniqueId());
detail.setTaskNumber(handoverTaskOrderPO.getTaskNumber());
detail.setOrganizationId(omd.getOrganizationId());
detail.setOrganizationName(omd.getOrganizationName());
detail.setTopOrganizationId(omd.getTopOrganizationId());
detail.setMaterialBaseInfoId(omd.getMaterialBaseInfoId());
detail.setMaterialCode(omd.getMaterialCode() != null ? omd.getMaterialCode() : omd.getMaterialNo());
detail.setMaterialName(omd.getMaterialName() != null ? omd.getMaterialName() : omd.getCommodityName());
detail.setBarCode(omd.getBarCode());
detail.setWeightLimit(omd.getWeightLimit());
detail.setVolumeLimit(omd.getVolumeLimit());
detail.setQuantity(omd.getQuantity());
detail.setPickingQuantity(pickQty);
detail.setCheckQuantity(handoverQuantity);
detail.setPackId(omd.getPackId());
detail.setPackCode(omd.getPackCode());
detail.setPackName(omd.getPackName());
detail.setPackDetailId(omd.getPackDetailId() != null ? String.valueOf(omd.getPackDetailId()) : null);
detail.setUnitCode(omd.getUnitCode());
detail.setUnitName(omd.getUnitName());
detail.setUnitNumber(omd.getUnitNumber());
detail.setMaterialWarehouseControlId(omd.getMaterialWarehouseControlId());
detail.setSerialNumberManage(omd.getSerialNumberManage());
detail.setRemark(omd.getRemark());
materialDetailList.add(detail);
}
handoverTaskOrderPO.setMaterialDetailList(materialDetailList);
}
return handoverTaskOrderPO;
}
/**
* @description 分配月台
@@ -2,7 +2,9 @@ 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.InMaterialDetailExportPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO;
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;
@@ -27,6 +29,16 @@ public interface IInMaterialDetailService extends IService<InMaterialDetail>
public List<InMaterialDetailPO> queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 入库明细查询关联入库单只统计已入库(5)单据
*/
public List<InMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 入库明细导出专用列集口径同 queryInOrderDetailList不分页
*/
public List<InMaterialDetailExportPO> exportInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 分页查询物料明细列表
*/
@@ -2,7 +2,9 @@ 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.InMaterialDetailExportPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO;
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;
@@ -28,6 +30,16 @@ public interface InMaterialDetailMapper extends BaseMapper<InMaterialDetail>
*/
public List<InMaterialDetailPO> queryInOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 入库明细查询关联入库单只统计已入库(5)单据
*/
public List<InMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 入库明细导出专用列集口径同 queryInOrderDetailList不分页
*/
public List<InMaterialDetailExportPO> exportInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 入库列表页按入库单号批量取去重后的 Invoice No level=1
*/
@@ -13,7 +13,9 @@ import com.mhd.system.api.model.LoginUser;
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.InMaterialDetailExportPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO;
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;
@@ -72,6 +74,22 @@ public class InMaterialDetailImpl extends ServiceImpl<InMaterialDetailMapper, In
return inMaterialDetailMapper.queryInOrderList(queryOrderOverStockDO);
}
/**
* 入库明细查询关联入库单只统计已入库(5)单据
*/
@Override
public List<InMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return inMaterialDetailMapper.queryInOrderDetailList(queryOrderOverStockDO);
}
/**
* 入库明细导出专用列集口径同 queryInOrderDetailList不分页
*/
@Override
public List<InMaterialDetailExportPO> exportInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return inMaterialDetailMapper.exportInOrderDetailList(queryOrderOverStockDO);
}
/**
* 查询物料明细列表
*/
@@ -0,0 +1,112 @@
package com.mhd.wms.domain.inMaterialDetail.repository.po;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 入库明细导出专用PO仅含客户要求的导出列列顺序即导出顺序
* 火险保费 WMS 库暂无数据来源先占位导出空列
* 单件净重(KG) 入库明细表无单件净重列先占位导出空列
*
* @author rcx
* @date 2026-09-09
*/
@Data
public class InMaterialDetailExportPO {
@Excel(name = "客户编号", sort = 1)
private String customerCode;
@Excel(name = "客户名称", sort = 2)
private String customerName;
@Excel(name = "入库单号", sort = 3)
private String inOrderNumber;
@Excel(name = "入库日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 4)
private Date warehouseDate;
@Excel(name = "LOT编号", sort = 5)
private String lotNo;
@Excel(name = "客户预约名称", sort = 6)
private String customerOrderNumber;
@Excel(name = "物料名称", sort = 7)
private String materialName;
@Excel(name = "物料编码", sort = 8)
private String materialCode;
@Excel(name = "库存单位", sort = 9)
private String unitName;
@Excel(name = "件数", sort = 10)
private BigDecimal pieceCount;
@Excel(name = "仓库", sort = 11)
private String warehouseName;
@Excel(name = "饮用日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 12)
private Date drinkDate;
@Excel(name = "库位", sort = 13)
private String storageLocationName;
@Excel(name = "单件净重(KG)", sort = 14)
private BigDecimal netWeight;
@Excel(name = "单件体积(CBM)", sort = 15)
private BigDecimal singleVolume;
@Excel(name = "单价", sort = 16)
private BigDecimal unitPrice;
@Excel(name = "总价", sort = 17)
private BigDecimal totalPrice;
@Excel(name = "折扣(%)", sort = 18)
private BigDecimal discountRate;
@Excel(name = "每月仓租", sort = 19)
private BigDecimal monthlyWarehouseFee;
@Excel(name = "半月仓租", sort = 20)
private BigDecimal halfMonthWhFee;
@Excel(name = "合同收费", sort = 21)
private BigDecimal contractFee;
@Excel(name = "火险保费", sort = 22)
private BigDecimal fireInsureFee;
@Excel(name = "备注", sort = 23)
private String remark;
@Excel(name = "货物种类", sort = 24)
private String materialClassifyName;
@Excel(name = "总重量", sort = 25)
private BigDecimal totalGrossWeight;
@Excel(name = "每件保额", sort = 26)
private BigDecimal insureAmount;
@Excel(name = "仓位/库位", sort = 27)
private String storageName;
@Excel(name = "收费标准", sort = 28)
private BigDecimal chargeStandard;
@Excel(name = "有效期", width = 30, dateFormat = "yyyy-MM-dd", sort = 29)
private Date expiryDate;
@Excel(name = "单据状态", sort = 30, readConverterExp = "5=已入库")
private Integer inOrderStatus;
@Excel(name = "业务单据类型", sort = 31)
private String orderTypeName;
}
@@ -0,0 +1,47 @@
package com.mhd.wms.domain.inMaterialDetail.repository.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 入库明细查询结果关联入库单只统计已入库单据
*
* @author rcx
* @date 2026-09-09
*/
@Data
public class InMaterialDetailWithOrderPO extends InMaterialDetailPO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("入库单状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
@Excel(name = "入库单状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭")
private Integer inOrderStatus;
@ApiModelProperty("入库单状态(与inOrderStatus同值,便于前端按status字段名绑定)")
private Integer status;
@ApiModelProperty("入库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@Excel(name = "入库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
private Integer inOrderAuditStatus;
@ApiModelProperty("入仓日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "入仓日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date warehouseDate;
@ApiModelProperty("保额")
@Excel(name = "保额")
private BigDecimal insureAmount;
@ApiModelProperty("货物类型: 0-物料 1-半成品 2-成品")
@Excel(name = "货物类型: 0-物料 1-半成品 2-成品")
private Integer goodsType;
@ApiModelProperty("货物种类(物料分类名称,多个逗号分隔)")
private String materialClassifyName;
}
@@ -1,8 +1,11 @@
package com.mhd.wms.domain.inMaterialDetail.service;
import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailService;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailExportPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -30,6 +33,20 @@ public class InMaterialDetailDomainService {
return materialDetailService.queryList(inMaterialDetailDO);
}
/**
* 入库明细查询关联入库单只统计已入库(5)单据
*/
public List<InMaterialDetailWithOrderPO> queryInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return materialDetailService.queryInOrderDetailList(queryOrderOverStockDO);
}
/**
* 入库明细导出专用列集口径同 queryInOrderDetailList不分页
*/
public List<InMaterialDetailExportPO> exportInOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return materialDetailService.exportInOrderDetailList(queryOrderOverStockDO);
}
/**
* 新增物料明细
@@ -53,8 +53,8 @@ public class InOrderAbnormal extends BaseVOEntity {
@Excel(name = "上架单号")
private String shelfOrderNumber;
@ApiModelProperty("类型:1-收货 2-上架")
@Excel(name = "类型:1-收货 2-上架")
@ApiModelProperty("类型:1-收货 2-上架 3-反审")
@Excel(name = "类型:1-收货 2-上架 3-反审")
private Integer type;
@ApiModelProperty("计划数量")
@@ -73,8 +73,8 @@ public class InOrderAbnormal extends BaseVOEntity {
@Excel(name = "异常数量")
private BigDecimal abnormalActualQuantity;
@ApiModelProperty("异常类型: 1-上架异常 2-收货异常 3-收货异常(允许超收没超出超收比例) 4-收货异常(不允许超收)5-收货异常(允许超收但超出超收比例)")
@Excel(name = "异常类型: 1-上架异常 2-收货异常 3-收货异常", readConverterExp = "允=许超收但不允许超出超收比例")
@ApiModelProperty("异常类型: 1-上架异常 2-收货异常 3-收货异常(允许超收没超出超收比例) 4-收货异常(不允许超收)5-收货异常(允许超收但超出超收比例) 6-反审记录")
@Excel(name = "异常类型: 1-上架异常 2-收货异常 6-反审记录", readConverterExp = "允=许超收但不允许超出超收比例")
private Integer abnormalType;
@ApiModelProperty("异常原因")
@@ -51,4 +51,11 @@ public interface IInOrderAbnormalService extends IService<InOrderAbnormal>
* @return Boolean
*/
Boolean genInOrderAbnormal(InOrderAbnormalBaseDO inOrderAbnormalBaseDO, Integer type);
/**
* 生成入库异常反审记录入库业务单反审时调用用于记录跟踪
* 单号自动生成FSYC 前缀与出库反审记录一致固定 type=3反审abnormalType=6反审记录
* 其余字段inOrderNumber/abnormalReason/quantity/remark/createBy 由调用方填充
*/
Boolean genReverseAuditAbnormal(InOrderAbnormal inOrderAbnormal);
}
@@ -174,6 +174,27 @@ public class InOrderAbnormalImpl extends ServiceImpl<InOrderAbnormalMapper, InOr
return true;
}
/**
* 生成入库异常反审记录入库业务单反审时调用用于记录跟踪
* 与出库反审记录共用 FSYC 单号前缀type=3反审abnormalType=6反审记录
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean genReverseAuditAbnormal(InOrderAbnormal inOrderAbnormal) {
if (inOrderAbnormal == null || !StringUtils.hasText(inOrderAbnormal.getInOrderNumber())) {
throw new ServiceException("生成反审记录失败:入库单号为空");
}
inOrderAbnormal.setAbnormalNumber(OrderSequence.getOrderCode("FSYC"));
inOrderAbnormal.setType(3);
inOrderAbnormal.setAbnormalType(6);
//del_flag 不显式置1时 insert 不含该列列无默认值则落库为NULL会被列表的 del_flag=1 过滤掉导致记录永远不可见
inOrderAbnormal.setDelFlag(1);
if (inOrderAbnormal.getCreateTime() == null) {
inOrderAbnormal.setCreateTime(new Date());
}
return this.save(inOrderAbnormal);
}
/**
* @description 收货数量与计划数量不符完成收货会生成收货异常记录
* @author ZhouGY
@@ -223,6 +244,8 @@ public class InOrderAbnormalImpl extends ServiceImpl<InOrderAbnormalMapper, InOr
inOrderAbnormal.setCreateByName(userRealName);
inOrderAbnormal.setCreateTime(new Date());
inOrderAbnormal.setType(2);
//del_flag 不显式置1时 insert 不含该列列无默认值则落库为NULL会被列表的 del_flag=1 过滤掉导致记录永远不可见
inOrderAbnormal.setDelFlag(1);
inOrderAbnormalList.add(inOrderAbnormal);
}
}
@@ -268,6 +291,8 @@ public class InOrderAbnormalImpl extends ServiceImpl<InOrderAbnormalMapper, InOr
inOrderAbnormal.setCreateByName(userRealName);
inOrderAbnormal.setCreateTime(new Date());
inOrderAbnormal.setType(1);
//del_flag 不显式置1时 insert 不含该列列无默认值则落库为NULL会被列表的 del_flag=1 过滤掉导致记录永远不可见
inOrderAbnormal.setDelFlag(1);
inOrderAbnormalList.add(inOrderAbnormal);
}
}
@@ -541,4 +541,7 @@ public class OutMaterialDetail extends BaseVOEntity {
@ApiModelProperty("出库数量")
@Excel(name = "出库数量")
private BigDecimal outQuantity;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -3,7 +3,9 @@ package com.mhd.wms.domain.outMaterialDetail.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialCheckPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutStockListMaterialAgg;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailBaseDO;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
@@ -32,6 +34,16 @@ public interface IOutMaterialDetailService extends IService<OutMaterialDetail>
*/
public List<OutMaterialDetailPO> queryOutOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 出库明细查询关联出库单只统计已出库(9/12/13)单据
*/
public List<OutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 出库明细导出专用列集口径同 queryOutOrderDetailList不分页
*/
public List<OutMaterialDetailExportPO> exportOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
public List<OutMaterialDetailPO> queryListChildren(OutMaterialDetailDO outMaterialDetailDO);
@@ -2,7 +2,9 @@ package com.mhd.wms.domain.outMaterialDetail.repository.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutStockListMaterialAgg;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
@@ -28,6 +30,16 @@ public interface OutMaterialDetailMapper extends BaseMapper<OutMaterialDetail>
*/
public List<OutMaterialDetailPO> queryOutOrderList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 出库明细查询关联出库单只统计已出库(9/12/13)单据
*/
public List<OutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* 出库明细导出专用列集口径同 queryOutOrderDetailList不分页
*/
public List<OutMaterialDetailExportPO> exportOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO);
/**
* @description 批量修改指定物料明细分配数量
@@ -34,7 +34,9 @@ import com.mhd.wms.domain.outMaterialDetail.entity.OutMaterialDetail;
import com.mhd.wms.domain.outMaterialDetail.repository.facade.IOutMaterialDetailService;
import com.mhd.wms.domain.outMaterialDetail.repository.mapper.OutMaterialDetailMapper;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialCheckPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutStockListMaterialAgg;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailBaseDO;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
@@ -107,6 +109,22 @@ public class OutMaterialDetailImpl extends ServiceImpl<OutMaterialDetailMapper,
return outMaterialDetailMapper.queryOutOrderList(queryOrderOverStockDO);
}
/**
* 出库明细查询关联出库单只统计已出库(9/12/13)单据
*/
@Override
public List<OutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailMapper.queryOutOrderDetailList(queryOrderOverStockDO);
}
/**
* 出库明细导出专用列集口径同 queryOutOrderDetailList不分页
*/
@Override
public List<OutMaterialDetailExportPO> exportOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailMapper.exportOutOrderDetailList(queryOrderOverStockDO);
}
/**
* 查询物料明细列表
*/
@@ -0,0 +1,111 @@
package com.mhd.wms.domain.outMaterialDetail.repository.po;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 出库明细导出专用PO仅含客户要求的导出列列顺序即导出顺序
* 火险保费 WMS 库暂无数据来源先占位导出空列
*
* @author rcx
* @date 2026-09-09
*/
@Data
public class OutMaterialDetailExportPO {
@Excel(name = "出库单号", sort = 1)
private String outOrderNumber;
@Excel(name = "出库日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 2)
private Date outboundDate;
@Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 3)
private Date createTime;
@Excel(name = "客户编号", sort = 4)
private String customerCode;
@Excel(name = "客户名称", sort = 5)
private String customerName;
@Excel(name = "LOT编号", sort = 6)
private String lotNo;
@Excel(name = "客户预约名称", sort = 7)
private String customerOrderNumber;
@Excel(name = "物料名称", sort = 8)
private String materialName;
@Excel(name = "物料编码", sort = 9)
private String materialCode;
@Excel(name = "库存单位", sort = 10)
private String stockUnit;
@Excel(name = "件数", sort = 11)
private BigDecimal pieceCount;
@Excel(name = "仓库", sort = 12)
private String warehouseName;
@Excel(name = "饮用日期", width = 30, dateFormat = "yyyy-MM-dd", sort = 13)
private Date drinkDate;
@Excel(name = "库位", sort = 14)
private String storageLocationName;
@Excel(name = "单件净重(KG)", sort = 15)
private BigDecimal weightLimit;
@Excel(name = "单件体积(CBM)", sort = 16)
private BigDecimal singleVolume;
@Excel(name = "单价", sort = 17)
private BigDecimal unitPrice;
@Excel(name = "总价", sort = 18)
private BigDecimal totalPrice;
@Excel(name = "折扣(%)", sort = 19)
private BigDecimal discountRate;
@Excel(name = "每月仓租", sort = 20)
private BigDecimal monthlyWarehouseFee;
@Excel(name = "半月仓租", sort = 21)
private BigDecimal halfMonthWhFee;
@Excel(name = "合同收费", sort = 22)
private BigDecimal contractFee;
@Excel(name = "火险保费", sort = 23)
private BigDecimal fireInsureFee;
@Excel(name = "备注", sort = 24)
private String remark;
@Excel(name = "总重量(KG)", sort = 25)
private BigDecimal totalGrossWeight;
@Excel(name = "仓位/库位", sort = 26)
private String storageName;
@Excel(name = "入库单号", sort = 27)
private String inOrderNumber;
@Excel(name = "种类", sort = 28)
private String materialClassifyName;
@Excel(name = "总价值", sort = 29)
private BigDecimal totalAmount;
@Excel(name = "单据状态", sort = 30, readConverterExp = "9=已出库,12=已复核,13=已交接")
private Integer outOrderStatus;
@Excel(name = "业务单据类型", sort = 31)
private String orderTypeName;
}
@@ -0,0 +1,66 @@
package com.mhd.wms.domain.outMaterialDetail.repository.po;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
/**
* 出库明细查询结果关联出库单只统计已出库单据
*
* @author rcx
* @date 2026-09-09
*/
@Data
public class OutMaterialDetailWithOrderPO extends OutMaterialDetailPO {
private static final long serialVersionUID = 1L;
@ApiModelProperty("客户id")
@Excel(name = "客户id")
private Long customerId;
@ApiModelProperty("客户编码")
@Excel(name = "客户编码")
private String customerCode;
@ApiModelProperty("客户名称")
@Excel(name = "客户名称")
private String customerName;
@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 outOrderStatus;
@ApiModelProperty("出库单状态(与outOrderStatus同值,便于前端按status字段名绑定)")
private Integer status;
@ApiModelProperty("货物种类(物料分类名称,多个逗号分隔)")
private String materialClassifyName;
@ApiModelProperty("出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
@Excel(name = "出库单审核状态: 1-未审核 2-审核不通过 3-审核通过")
private Integer outOrderAuditStatus;
@ApiModelProperty("出仓日期")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "出仓日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date outboundDate;
@ApiModelProperty("完成时间(出库完成时间,Excel导入/录单时填写)")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date completeTime;
@ApiModelProperty("保额")
@Excel(name = "保额")
private BigDecimal insureAmount;
@ApiModelProperty("货物类型: 0-物料 1-半成品 2-成品")
@Excel(name = "货物类型: 0-物料 1-半成品 2-成品")
private Integer goodsType;
}
@@ -1,8 +1,11 @@
package com.mhd.wms.domain.outMaterialDetail.service;
import com.mhd.wms.domain.outMaterialDetail.repository.facade.IOutMaterialDetailService;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -30,6 +33,20 @@ public class OutMaterialDetailDomainService {
return outMaterialDetailService.queryList(outMaterialDetailDO);
}
/**
* 出库明细查询关联出库单只统计已出库(9/12/13)单据
*/
public List<OutMaterialDetailWithOrderPO> queryOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailService.queryOutOrderDetailList(queryOrderOverStockDO);
}
/**
* 出库明细导出专用列集口径同 queryOutOrderDetailList不分页
*/
public List<OutMaterialDetailExportPO> exportOutOrderDetailList(QueryOrderOverStockDO queryOrderOverStockDO) {
return outMaterialDetailService.exportOutOrderDetailList(queryOrderOverStockDO);
}
/**
* 新增物料明细
@@ -53,8 +53,8 @@ public class OutOrderAbnormal extends BaseVOEntity {
@Excel(name = "拣货作业单号")
private String outTaskOrderNumber;
@ApiModelProperty("类型:1-拣货 2-复核")
@Excel(name = "类型:1-拣货 2-复核")
@ApiModelProperty("类型:1-拣货 2-复核 3-反审记录")
@Excel(name = "类型:1-拣货 2-复核 3-反审记录")
private Integer type;
@ApiModelProperty("计划数量")
@@ -69,8 +69,8 @@ public class OutOrderAbnormal extends BaseVOEntity {
@Excel(name = "异常数量 = 作业数量 - 计划数量")
private BigDecimal abnormalActualQuantity;
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常")
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常 3-反审记录")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常 3-反审记录")
private Integer abnormalType;
@ApiModelProperty("异常原因")
@@ -53,8 +53,8 @@ public class OutOrderAbnormalPO extends BaseVOEntity {
@Excel(name = "拣货作业单号")
private String outTaskOrderNumber;
@ApiModelProperty("类型:1-拣货 2-复核")
@Excel(name = "类型:1-拣货 2-复核")
@ApiModelProperty("类型:1-拣货 2-复核 3-反审记录")
@Excel(name = "类型:1-拣货 2-复核 3-反审记录")
private Integer type;
@ApiModelProperty("计划数量:拣货异常=分配数量;复核异常=拣货数量")
@@ -69,8 +69,8 @@ public class OutOrderAbnormalPO extends BaseVOEntity {
@Excel(name = "异常数量 = 作业数量 - 计划数量")
private BigDecimal abnormalActualQuantity;
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常")
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常 3-反审记录")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常 3-反审记录")
private Integer abnormalType;
@ApiModelProperty("异常原因")
@@ -51,8 +51,8 @@ public class OutOrderAbnormalDO extends BaseVOEntity {
@Excel(name = "拣货作业单号")
private String outTaskOrderNumber;
@ApiModelProperty("类型:1-拣货 2-复核")
@Excel(name = "类型:1-拣货 2-复核")
@ApiModelProperty("类型:1-拣货 2-复核 3-反审记录")
@Excel(name = "类型:1-拣货 2-复核 3-反审记录")
private Integer type;
@ApiModelProperty("计划数量")
@@ -67,8 +67,8 @@ public class OutOrderAbnormalDO extends BaseVOEntity {
@Excel(name = "异常数量 = 作业数量 - 计划数量")
private BigDecimal abnormalActualQuantity;
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常")
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常 3-反审记录")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常 3-反审记录")
private Integer abnormalType;
@ApiModelProperty("异常原因")
@@ -78,6 +78,12 @@ public class QueryOrderOverStockDO extends BaseVOEntity {
@Excel(name = "入库单类型编码")
private String inOrderTypeCode;
@ApiModelProperty("入库单类型编码(与inOrderTypeCode同义)")
private String orderTypeCode;
@ApiModelProperty("入库单类型名称")
private String orderTypeName;
@ApiModelProperty("入库单类型名称")
@Excel(name = "入库单类型名称")
private String inOrderTypeName;
@@ -137,4 +143,16 @@ public class QueryOrderOverStockDO extends BaseVOEntity {
@ApiModelProperty("越库单状态 0:无状态 1:处理中 2:越库完成")
@Excel(name = "越库单状态 0:无状态 1:处理中 2:越库完成")
private Integer overStockStatus;
@ApiModelProperty("实际入仓日期 开始(yyyy-MM-dd,为空按建档时间兜底)")
private String warehouseDateStart;
@ApiModelProperty("实际入仓日期 结束(yyyy-MM-dd,为空按建档时间兜底)")
private String warehouseDateEnd;
@ApiModelProperty("实际出仓日期 开始(yyyy-MM-dd,为空按建档时间兜底)")
private String outboundDateStart;
@ApiModelProperty("实际出仓日期 结束(yyyy-MM-dd,为空按建档时间兜底)")
private String outboundDateEnd;
}
@@ -321,4 +321,7 @@ public class PickingMaterialDetail extends BaseVOEntity {
private String bondInvtNoGw;
private String whNoGw;
private String seatNoGw;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -26,6 +26,12 @@ public interface PickingMaterialDetailMapper extends BaseMapper<PickingMaterialD
public PickingMaterialDetailPO queryTotalsByOutNumberAndBaseId(@Param("outUniqueId") Long outUniqueId);
/**
* 归档汇总(已反审): queryTotalsByOutNumberAndBaseId, 但按 DEL_FLAG=2 统计软删归档的拣货明细,
* 供交接单归档详情 getReverseInfo 使用(反审时拣货明细均已软删, del_flag=1 统计恒为0会丢行)
*/
public PickingMaterialDetailPO queryTotalsByOutNumberAndBaseIdReverse(@Param("outUniqueId") Long outUniqueId);
/**
* 按出库单号汇总拣货完成数量实际下发/拣货完成的数量
*/
@@ -133,4 +133,7 @@ public class PickingOrder extends BaseVOEntity {
private String pushByName;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -58,6 +58,11 @@ public interface IPickingOrderService extends IService<PickingOrder>
*/
public PickingOrderPO getInfoByIdAndType(Long pickingOrderId, Integer type);
/**
* @description 根据id和类型获取指定拣货单信息(归档: 已反审软删 del_flag=2, 已反审tab 详情)
*/
public PickingOrderPO getInfoByIdAndTypeReverse(Long pickingOrderId, Integer type);
/**
* @description 根据单号和类型获取指定拣货单信息
@@ -25,12 +25,22 @@ public interface PickingOrderMapper extends BaseMapper<PickingOrder>
*/
public PickingOrderPO queryOutOrderById(Long pickingOrderId);
/**
* 根据Id关联出库单查询(归档: 已反审软删 del_flag=2, 已反审tab 详情)
*/
public PickingOrderPO queryOutOrderByIdReverse(Long pickingOrderId);
/**
* 根据Id关联波次单查询
*/
public PickingOrderPO queryWaveOrderById(Long pickingOrderId);
/**
* 根据Id关联波次单查询(归档: 已反审软删 del_flag=2)
*/
public PickingOrderPO queryWaveOrderByIdReverse(Long pickingOrderId);
/**
* 根据单号关联出库单查询
*/
@@ -146,6 +146,23 @@ public class PickingOrderImpl extends ServiceImpl<PickingOrderMapper, PickingOrd
return pickingOrderPO;
}
/**
* 归档(已反审): del_flag=2 查软删的拣货单, 已反审tab 详情
*/
@Override
public PickingOrderPO getInfoByIdAndTypeReverse(Long pickingOrderId, Integer type) {
PickingOrderPO pickingOrderPO = null;
if (type == 1){
pickingOrderPO = pickingOrderMapper.queryOutOrderByIdReverse(pickingOrderId);
}else {
pickingOrderPO = pickingOrderMapper.queryWaveOrderByIdReverse(pickingOrderId);
}
if (pickingOrderPO == null){
throw new ServiceException("拣货单不存在");
}
return pickingOrderPO;
}
/**
* @description 根据单号和类型获取指定拣货单信息
* @author ZhouGY
@@ -171,4 +171,7 @@ public class PickingOrderPO extends StockOutOrderBasePO {
private String specificationModel;
@ApiModelProperty("货物类型 0-物料 1-半成品 2-成品")
private Integer goodsType;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -228,4 +228,7 @@ public class PickingOrderDO extends BaseVOEntity {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeTo;
}
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -312,6 +312,34 @@ public class PickingOrderDomainService {
return pickingOrderPO;
}
/**
* 获取拣货单归档详情(已反审): 反审时拣货单/拣货明细均已软删(del_flag=2),
* 主表走 Reverse 查询(del_flag=2), 明细通过 DO.delFlag=2 查归档数据,
* 供拣货单已反审tab 查看详情
*/
public PickingOrderPO getReverseInfoByIdAndType(Long pickingOrderId, Integer type) {
PickingOrderPO pickingOrderPO = pickingOrderService.getInfoByIdAndTypeReverse(pickingOrderId, type);
if (pickingOrderPO == null) {
throw new ServiceException("拣货单不存在");
}
PickingMaterialDetailDO pickingMaterialDetailDO = new PickingMaterialDetailDO();
pickingMaterialDetailDO.setPickingOrderNumber(pickingOrderPO.getPickingOrderNumber());
pickingMaterialDetailDO.setDelFlag(2);
List<PickingMaterialDetailPO> pickingMaterialDetailPOList = pickingMaterialDetailService.queryList(pickingMaterialDetailDO);
for (PickingMaterialDetailPO pickingMaterialDetailPO : pickingMaterialDetailPOList) {
Long materialBaseInfoId = pickingMaterialDetailPO.getMaterialBaseInfoId();
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
if(materialBaseInfo!=null){
pickingMaterialDetailPO.setMaterialCode(materialBaseInfo.getMaterialCode());
pickingMaterialDetailPO.setMaterialName(materialBaseInfo.getMaterialName());
pickingMaterialDetailPO.setCopyCode(materialBaseInfo.getCopyCode());
}
}
copyCodeReferenceDomainService.fillWeightListOnPickingMaterialDetails(pickingMaterialDetailPOList);
pickingOrderPO.setMaterialDetailList(pickingMaterialDetailPOList);
return pickingOrderPO;
}
/**
* @description 整单下发
* @author ZhouGY
@@ -120,4 +120,7 @@ public class ReviewMaterialDetail extends BaseVOEntity {
@ApiModelProperty("包装详情id")
@Excel(name = "包装详情id")
private String packDetailId;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@@ -58,4 +59,7 @@ public class ReviewOrder extends BaseVOEntity {
private Date receiveTime;
private String remark;
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -24,6 +24,16 @@ public interface ReviewOrderMapper extends BaseMapper<ReviewOrder> {
*/
ReviewOrderPO selectHeaderByReviewOrderId(@Param("reviewOrderId") Long reviewOrderId);
/**
* 详情-主表按主键归档: 已反审软删 del_flag=2已反审tab 详情
*/
ReviewOrderPO selectHeaderByReviewOrderIdReverse(@Param("reviewOrderId") Long reviewOrderId);
/**
* 详情-明细行按复核单主键归档: 已反审软删 del_flag=2
*/
List<ReviewMaterialDetailPO> queryDetailByReviewOrderIdReverse(@Param("reviewOrderId") Long reviewOrderId);
/**
* 详情-主表按复核单号
*/
@@ -106,4 +106,7 @@ public class ReviewOrderPO extends BaseVOEntity {
/** 详情与上架单一致:头字段扁平 + 明细列表 */
@ApiModelProperty("复核明细")
private List<ReviewMaterialDetailPO> materialDetailList;
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -86,4 +86,7 @@ public class ReviewOrderDO extends BaseVOEntity {
*/
@ApiModelProperty("仅已接收:1-是(receive_time 非空)")
private Integer onlyReceived;
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -410,4 +410,21 @@ public class StockInOrder extends BaseVOEntity {
@ApiModelProperty("签名备注")
private String signatureRemark;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -477,4 +477,21 @@ public class StockInOrderPO extends BaseVOEntity {
@ApiModelProperty("签名备注")
private String signatureRemark;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -470,6 +470,23 @@ public class StockInOrderDO extends BaseVOEntity {
@ApiModelProperty("签名备注")
private String signatureRemark;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
/**
* PDA入库签名列表专用作业任务人员模糊查询字段 workUserName LIKE 同义
* 单独提供是为了避免和现有 workUserName精确/等值逻辑冲突
@@ -30,10 +30,20 @@ import com.mhd.wms.domain.inMaterialDetail.repository.facade.IInMaterialDetailSe
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailBaseDO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.inOrderAbnormal.entity.InOrderAbnormal;
import com.mhd.wms.domain.inOrderAbnormal.repository.facade.IInOrderAbnormalService;
import com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord;
import com.mhd.wms.domain.inventoryAdjustmentRecord.repository.facade.IInventoryAdjustmentRecordService;
import com.mhd.wms.domain.inventoryStandingDetail.entity.InventoryStandingDetail;
import com.mhd.wms.domain.inventoryStandingDetail.repository.facade.IInventoryStandingDetailService;
import com.mhd.wms.domain.materialBaseInfo.repository.facade.IMaterialBaseInfoService;
import com.mhd.wms.domain.materialBaseInfo.repository.po.MaterialBaseInfoPO;
import com.mhd.wms.domain.materialGoodsRule.repository.facade.IMaterialGoodsRuleService;
import com.mhd.wms.domain.materialGoodsRule.repository.po.MaterialGoodsRulePO;
import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO;
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParentDO;
import com.mhd.wms.domain.materialWarehouseControl.repository.facade.IMaterialWarehouseControlService;
import com.mhd.wms.domain.materialWarehouseControl.repository.po.MaterialWarehouseControlPO;
import com.mhd.wms.domain.qualityInspection.repository.facade.IQualityInspectionService;
@@ -53,6 +63,10 @@ import com.mhd.wms.domain.stockInOrder.repository.po.StockInOrderPO;
import com.mhd.wms.domain.stockInOrder.repository.todo.StockInOrderDO;
import com.mhd.wms.domain.stockInTaskOrder.entity.StockInTaskOrder;
import com.mhd.wms.domain.stockInTaskOrder.repository.facade.IStockInTaskOrderService;
import com.mhd.wms.domain.taskShelfMaterialDetail.entity.TaskShelfMaterialDetail;
import com.mhd.wms.domain.taskShelfMaterialDetail.repository.facade.ITaskShelfMaterialDetailService;
import com.mhd.wms.domain.taskShelfMaterialDetail.entity.TaskShelfMaterialDetail;
import com.mhd.wms.domain.taskShelfMaterialDetail.repository.facade.ITaskShelfMaterialDetailService;
import com.mhd.wms.domain.stockReceiptOrder.entity.StockReceiptOrder;
import com.mhd.wms.domain.stockReceiptOrder.repository.facade.IStockReceiptOrderService;
import com.mhd.wms.domain.stockReceiptOrder.repository.po.StockReceiptOrderPO;
@@ -127,6 +141,16 @@ public class StockInOrderDomainService {
@Autowired
private ITaskReceiptMaterialDetailService taskReceiptMaterialDetailService;
@Autowired
private ITaskShelfMaterialDetailService taskShelfMaterialDetailService;
@Autowired
private IInventoryAdjustmentRecordService inventoryAdjustmentRecordService;
@Autowired
private IInventoryStandingDetailService inventoryStandingDetailService;
@Autowired
private IMaterialInventoryService materialInventoryService;
@Autowired
private IInOrderAbnormalService inOrderAbnormalService;
@Autowired
private IdGenerator idGenerator;
/**
@@ -521,23 +545,46 @@ public class StockInOrderDomainService {
* 获取入库单详细信息
*/
public StockInOrderPO getInfo(Long inOrderId)
{
return getInfo(inOrderId, false);
}
/**
* 获取入库单详情
* @param archive true-查询已反审tab 归档数据主单须为已软删+已反审标记收货/上架单及明细放行软删行
*/
public StockInOrderPO getInfo(Long inOrderId, boolean archive)
{
StockInOrderPO stockInOrderPO = stockInOrderService.getInfo(inOrderId);
if (archive && (stockInOrderPO.getDelFlag() == null || stockInOrderPO.getDelFlag() != 2
|| !Integer.valueOf(1).equals(stockInOrderPO.getReverseAuditStatus()))) {
throw new ServiceException("入库单非已反审归档数据,无法查看归档详情");
}
InMaterialDetailDO inMaterialDetailDO = new InMaterialDetailDO();
inMaterialDetailDO.setInOrderNumber(stockInOrderPO.getInOrderNumber());
inMaterialDetailDO.setLevel(1);
if (archive) {
//归档明细已随主单软删放行软删行
inMaterialDetailDO.setDelFlag(2);
}
List<InMaterialDetailPO> inMaterialDetailPOList = materialDetailService.queryList(inMaterialDetailDO);
// 先通过入库单号查询收货单列表
StockReceiptOrderDO stockReceiptOrderDO = new StockReceiptOrderDO();
stockReceiptOrderDO.setInOrderNumber(stockInOrderPO.getInOrderNumber());
if (archive) {
stockReceiptOrderDO.setDelFlag(2);
}
List<StockReceiptOrderPO> stockReceiptOrderPOList = stockReceiptOrderDomainService.queryList(stockReceiptOrderDO);
// 先通过入库单号查询上架单列表
StockShelfOrderDO stockShelfOrderDO = new StockShelfOrderDO();
stockShelfOrderDO.setInOrderNumber(stockInOrderPO.getInOrderNumber());
if (archive) {
stockShelfOrderDO.setDelFlag(2);
}
List<StockShelfOrderPO> stockShelfOrderPOList = stockShelfOrderDomainService.queryList(stockShelfOrderDO);
// 查询收货单明细用于填充收货数量和更新毛重净重面积体积
List<ReceiptMaterialDetailPO> receiptMaterialDetailPOList = new ArrayList<>();
if (!CollectionUtils.isEmpty(stockReceiptOrderPOList)) {
@@ -548,10 +595,13 @@ public class StockInOrderDomainService {
if (!CollectionUtils.isEmpty(receiptOrderNumberList)) {
ReceiptMaterialDetailDO receiptMaterialDetailDO = new ReceiptMaterialDetailDO();
receiptMaterialDetailDO.setReceiptOrderNumberList(receiptOrderNumberList);
if (archive) {
receiptMaterialDetailDO.setDelFlag(2);
}
receiptMaterialDetailPOList = receiptMaterialDetailService.queryList(receiptMaterialDetailDO);
}
}
// 查询上架单明细用于填充上架数量
List<ShelfMaterialDetailPO> shelfMaterialDetailPOList = new ArrayList<>();
if (!CollectionUtils.isEmpty(stockShelfOrderPOList)) {
@@ -559,6 +609,9 @@ public class StockInOrderDomainService {
if (StringUtils.isNotBlank(stockShelfOrderPO.getShelfOrderNumber())) {
ShelfMaterialDetailDO shelfMaterialDetailDO = new ShelfMaterialDetailDO();
shelfMaterialDetailDO.setShelfOrderNumber(stockShelfOrderPO.getShelfOrderNumber());
if (archive) {
shelfMaterialDetailDO.setDelFlag(2);
}
List<ShelfMaterialDetailPO> shelfDetails = shelfMaterialDetailService.queryList(shelfMaterialDetailDO);
if (!CollectionUtils.isEmpty(shelfDetails)) {
shelfMaterialDetailPOList.addAll(shelfDetails);
@@ -844,6 +897,321 @@ public class StockInOrderDomainService {
.eq(StockInOrder::getDelFlag, 1));
}
/**
* OMS入库业务单反审WMS侧一个事务内把已完成单据回退到最原始状态 Feign /stockInOrderApi/omsReverseInOrder 调用
*
* <p> {@link #cancelExecutionOrder(StockInOrder)}取消下发仅限未开始收货不同本方法处理
* 已开始收货/上架/已入库(status&gt;=3)的单据回退动作与"完成收货/完成上架"链路对称</p>
* <ul>
* <li>出库拦截"入库单号+动作(分配库存/出库)"查库存调整记录&gt;0 即有出库记录另校验库存冻结量
* 入库单有出库就不能反审</li>
* <li>回退库存按本单库存行整行扣回上架时 inventory_quantity allocation_quantity 同量增加
* 重量体积一并累加此处对称扣回复用统一扣减服务 GREATEST(x-n,0) 兜底
* 扣减前校验"库存行合计=已上架完成量"不一致说明发生过库存合并/人工调整拦截人工核实</li>
* <li>W入库单/W收货单/W上架单整链软删(del_flag=2)并打已反审标记(REVERSE_AUDIT_STATUS=1)
* 各页面已反审tab按"已软删+已反审"(del_flag=2 and reverse_audit_status=1)查询归档数据
* 物料明细/作业单/任务/质检单一并软删留痕台账节点物理删除保持与回退后库存一致</li>
* <li>写1条入库异常反审记录(in_order_abnormal type=3/abnormalType=6) 用于记录跟踪</li>
* </ul>
* <p>WMS无该单数据时幂等返回成功OMS未下发单反审仅落1条反审记录留痕不产生其他WMS数据任何校验失败抛错经
* Feign 返回OMS侧整体回滚反审可重试本方法幂等</p>
*/
@Transactional(rollbackFor = Exception.class)
public void reverseExecutionOrder(StockInOrder stockInOrder) {
String inOrderNumber = stockInOrder.getInOrderNumber();
if (StringUtils.isEmpty(inOrderNumber)) {
throw new ServiceException("反审失败:入库单号为空");
}
//反审原因/反审人由OMS经Feign传入不依赖Feign链路的登录上下文
String reverseReason = stockInOrder.getRemark();
String reverseByName = stockInOrder.getUpdateByName();
List<StockInOrder> stockInOrders = stockInOrderService.list(new LambdaQueryWrapper<StockInOrder>()
.eq(StockInOrder::getInOrderNumber, inOrderNumber)
.eq(StockInOrder::getDelFlag, 1));
if (CollectionUtils.isEmpty(stockInOrders)) {
//幂等WMS无该单数据未下发单反审或已反审过/重试直接成功保证OMS反审可重试
//反审记录仍落一条留痕入库异常页面可查同单号已有反审记录时不再重复写重试幂等
saveReverseAuditAbnormalIfAbsent(stockInOrder, BigDecimal.ZERO, "未下发WMS,无WMS链路数据需回退");
return;
}
StockInOrder wmsOrder = stockInOrders.get(0);
// ========== 1. 出库拦截入库单有出库就不能反审 ==========
//"入库单号+动作(分配库存/出库)"查询库存调整记录出库分配/交接出库时都会写入调整记录
//>0 即证明该入库单的库存已发生出库流转取消分配时调整记录随之软删不会误拦
List<InventoryAdjustmentRecord> outboundRecords = inventoryAdjustmentRecordService.list(
new LambdaQueryWrapper<InventoryAdjustmentRecord>()
.eq(InventoryAdjustmentRecord::getInOrderNumber, inOrderNumber)
.in(InventoryAdjustmentRecord::getAdjustAction, "分配库存", "出库")
.eq(InventoryAdjustmentRecord::getDelFlag, 1));
if (!CollectionUtils.isEmpty(outboundRecords)) {
throw new ServiceException("入库单[" + inOrderNumber + "]已产生出库记录,无法反审");
}
//本单库存行反审要扣回的库存
List<MaterialInventory> inventoryRows = materialInventoryService.list(new LambdaQueryWrapper<MaterialInventory>()
.eq(MaterialInventory::getInOrderNumber, inOrderNumber));
for (MaterialInventory row : inventoryRows) {
if (row.getFreezeQuantity() != null && row.getFreezeQuantity().compareTo(BigDecimal.ZERO) > 0) {
throw new ServiceException("入库单[" + inOrderNumber + "]库存已被出库分配,无法反审");
}
}
// ========== 2. 回退库存对称"完成上架"写入 ==========
List<StockShelfOrder> shelfOrders = stockShelfOrderService.list(new LambdaQueryWrapper<StockShelfOrder>()
.eq(StockShelfOrder::getInOrderNumber, inOrderNumber)
.eq(StockShelfOrder::getDelFlag, 1));
List<String> shelfOrderNumbers = shelfOrders.stream()
.map(StockShelfOrder::getShelfOrderNumber)
.filter(StringUtils::isNotEmpty)
.distinct()
.collect(Collectors.toList());
BigDecimal inventoryTotal = inventoryRows.stream()
.map(row -> row.getInventoryQuantity() == null ? BigDecimal.ZERO : row.getInventoryQuantity())
.reduce(BigDecimal.ZERO, BigDecimal::add);
if (inventoryTotal.compareTo(BigDecimal.ZERO) > 0) {
//扣减前校验库存行合计必须等于"已完成上架单"的上架量否则整行扣回会误伤合并进来的其他来源库存
//只统计已完成(status=3)的上架单库存只在完成上架时写入上架中未完成的单不产生库存
BigDecimal shelfDoneTotal = BigDecimal.ZERO;
List<String> doneShelfOrderNumbers = shelfOrders.stream()
.filter(shelfOrder -> shelfOrder.getStatus() != null && shelfOrder.getStatus() == 3)
.map(StockShelfOrder::getShelfOrderNumber)
.filter(StringUtils::isNotEmpty)
.distinct()
.collect(Collectors.toList());
if (!doneShelfOrderNumbers.isEmpty()) {
List<ShelfMaterialDetail> shelfDetails = shelfMaterialDetailService.list(new LambdaQueryWrapper<ShelfMaterialDetail>()
.in(ShelfMaterialDetail::getShelfOrderNumber, doneShelfOrderNumbers)
.eq(ShelfMaterialDetail::getDelFlag, 1));
for (ShelfMaterialDetail shelfDetail : shelfDetails) {
BigDecimal shelved = shelfDetail.getAlreadyShelvesQuantity() != null
? shelfDetail.getAlreadyShelvesQuantity()
: (shelfDetail.getShelvesQuantity() != null ? shelfDetail.getShelvesQuantity() : BigDecimal.ZERO);
shelfDoneTotal = shelfDoneTotal.add(shelved);
}
}
if (shelfDoneTotal.compareTo(BigDecimal.ZERO) <= 0 || inventoryTotal.compareTo(shelfDoneTotal) != 0) {
throw new ServiceException("入库单[" + inOrderNumber + "]库存(" + inventoryTotal.stripTrailingZeros().toPlainString()
+ ")与上架完成量(" + shelfDoneTotal.stripTrailingZeros().toPlainString()
+ ")不一致,可能已发生出库或库存合并,请人工核实后再反审");
}
List<MaterialInventoryDO> subtractList = new ArrayList<>();
for (MaterialInventory row : inventoryRows) {
if (row.getInventoryQuantity() == null || row.getInventoryQuantity().compareTo(BigDecimal.ZERO) <= 0) {
continue;
}
MaterialInventoryDO subtractDO = new MaterialInventoryDO();
subtractDO.setMaterialInventoryId(row.getMaterialInventoryId());
subtractDO.setInventoryQuantity(row.getInventoryQuantity());
//SQL按 GREATEST(x-#{item.n},0) 扣减DM/Oracle下 GREATEST null 返回 null数值字段一律兜底0
subtractDO.setNetWeight(row.getNetWeight() == null ? BigDecimal.ZERO : row.getNetWeight());
subtractDO.setGrossWeight(row.getGrossWeight() == null ? BigDecimal.ZERO : row.getGrossWeight());
subtractDO.setVolume(row.getVolume() == null ? BigDecimal.ZERO : row.getVolume());
subtractDO.setArea(row.getArea() == null ? BigDecimal.ZERO : row.getArea());
subtractList.add(subtractDO);
}
if (!CollectionUtils.isEmpty(subtractList)) {
//直接走统一批量扣减(GREATEST(x-n,0)兜底)并显式传更新人不经 updateMaterialInventoryInfo
//其内部 subtractMaterialInventory SecurityUtils 登录上下文OMS经Feign调用时可能无登录态(会抛异常)
MaterialInventoryParentDO subtractParent = new MaterialInventoryParentDO();
subtractParent.setMaterialInventoryDOList(subtractList);
subtractParent.setUpdateBy(stockInOrder.getUpdateBy() == null ? 0L : stockInOrder.getUpdateBy());
subtractParent.setUpdateByName(StringUtils.isEmpty(reverseByName) ? "system" : reverseByName);
subtractParent.setUpdateTime(new Date());
materialInventoryService.batchSubtractInventoryQuantity(subtractParent);
}
}
// ========== 3. 软删下游全链 + W入库单/W收货单/W上架单打"已反审"标记 ==========
//三单软删(del_flag=2)并打已反审标记(REVERSE_AUDIT_STATUS=1)各页面已反审tab按
//"已软删+已反审"(del_flag=2 and reverse_audit_status=1)查询归档数据
//物料明细/收货上架作业单/任务/质检单/台账一并软删留痕重新下发时生成全新数据
String reverseRemarkForWms = StringUtils.isEmpty(reverseReason) ? "入库单反审" : "入库单反审:" + reverseReason;
Long reverseAuditUserId = stockInOrder.getUpdateBy() == null ? 0L : stockInOrder.getUpdateBy();
String reverseAuditUserName = StringUtils.isEmpty(reverseByName) ? "system" : reverseByName;
Date reverseAuditDate = new Date();
//收货单含历史重复下发产生的多张同号收货单全部查出统一清理避免按单号取一条漏删/报错
List<StockReceiptOrder> receiptOrders = stockReceiptOrderService.list(new LambdaQueryWrapper<StockReceiptOrder>()
.eq(StockReceiptOrder::getInOrderNumber, inOrderNumber)
.eq(StockReceiptOrder::getDelFlag, 1));
List<String> receiptOrderNumbers = receiptOrders.stream()
.map(StockReceiptOrder::getReceiptOrderNumber)
.filter(StringUtils::isNotEmpty)
.distinct()
.collect(Collectors.toList());
//收货/上架作业单type=1收货 type=2上架上架作业单兜底按上架单号再查一道防 in_order_number 为空
//上架单复用第2节已查出的 shelfOrders/shelfOrderNumbers
List<StockInTaskOrder> taskOrders = stockInTaskOrderService.list(new LambdaQueryWrapper<StockInTaskOrder>()
.eq(StockInTaskOrder::getInOrderNumber, inOrderNumber)
.eq(StockInTaskOrder::getDelFlag, 1));
if (!shelfOrderNumbers.isEmpty()) {
Set<String> existTaskNumbers = taskOrders.stream()
.map(StockInTaskOrder::getTaskNumber)
.collect(Collectors.toSet());
List<StockInTaskOrder> shelfTaskOrders = stockInTaskOrderService.list(new LambdaQueryWrapper<StockInTaskOrder>()
.in(StockInTaskOrder::getShelfOrderNumber, shelfOrderNumbers)
.eq(StockInTaskOrder::getDelFlag, 1));
for (StockInTaskOrder shelfTaskOrder : shelfTaskOrders) {
if (shelfTaskOrder.getTaskNumber() != null && !existTaskNumbers.contains(shelfTaskOrder.getTaskNumber())) {
taskOrders.add(shelfTaskOrder);
}
}
}
List<String> taskNumbers = taskOrders.stream()
.map(StockInTaskOrder::getTaskNumber)
.filter(StringUtils::isNotEmpty)
.distinct()
.collect(Collectors.toList());
//1.收货/上架作业单明细
if (!taskNumbers.isEmpty()) {
taskReceiptMaterialDetailService.update(new UpdateWrapper<TaskReceiptMaterialDetail>().lambda()
.set(TaskReceiptMaterialDetail::getDelFlag, 2)
.in(TaskReceiptMaterialDetail::getTaskNumber, taskNumbers)
.eq(TaskReceiptMaterialDetail::getDelFlag, 1));
taskShelfMaterialDetailService.update(new UpdateWrapper<TaskShelfMaterialDetail>().lambda()
.set(TaskShelfMaterialDetail::getDelFlag, 2)
.in(TaskShelfMaterialDetail::getTaskNumber, taskNumbers)
.eq(TaskShelfMaterialDetail::getDelFlag, 1));
}
//2.收货/上架作业单
if (!taskNumbers.isEmpty()) {
stockInTaskOrderService.update(new UpdateWrapper<StockInTaskOrder>().lambda()
.set(StockInTaskOrder::getDelFlag, 2)
.eq(StockInTaskOrder::getInOrderNumber, inOrderNumber)
.eq(StockInTaskOrder::getDelFlag, 1));
if (!shelfOrderNumbers.isEmpty()) {
stockInTaskOrderService.update(new UpdateWrapper<StockInTaskOrder>().lambda()
.set(StockInTaskOrder::getDelFlag, 2)
.in(StockInTaskOrder::getShelfOrderNumber, shelfOrderNumbers)
.eq(StockInTaskOrder::getDelFlag, 1));
}
}
//3.收货/上架任务tracking_number=收货/上架单号"RV-"+入库单号兜底历史同号收货单
if (!receiptOrderNumbers.isEmpty() || !shelfOrderNumbers.isEmpty()) {
Set<String> trackingNumbers = new HashSet<>(receiptOrderNumbers);
trackingNumbers.addAll(shelfOrderNumbers);
trackingNumbers.add("RV-" + inOrderNumber);
deliveTaskService.update(new UpdateWrapper<DeliveTask>().lambda()
.set(DeliveTask::getDelFlag, 2)
.in(DeliveTask::getTrackingNumber, trackingNumbers)
.in(DeliveTask::getTaskType, 1, 2)
.eq(DeliveTask::getDelFlag, 1));
}
//4.质检单
qualityInspectionService.update(new UpdateWrapper<com.mhd.wms.domain.qualityInspection.entity.QualityInspection>().lambda()
.set(com.mhd.wms.domain.qualityInspection.entity.QualityInspection::getDelFlag, 2)
.eq(com.mhd.wms.domain.qualityInspection.entity.QualityInspection::getInOrderNumber, inOrderNumber)
.eq(com.mhd.wms.domain.qualityInspection.entity.QualityInspection::getDelFlag, 1));
//5.收货单明细
if (!receiptOrderNumbers.isEmpty()) {
receiptMaterialDetailService.update(new UpdateWrapper<ReceiptMaterialDetail>().lambda()
.set(ReceiptMaterialDetail::getDelFlag, 2)
.in(ReceiptMaterialDetail::getReceiptOrderNumber, receiptOrderNumbers)
.eq(ReceiptMaterialDetail::getDelFlag, 1));
}
//6.收货单软删+打已反审标记收货单已反审tab 可查归档数据
stockReceiptOrderService.update(new UpdateWrapper<StockReceiptOrder>().lambda()
.set(StockReceiptOrder::getDelFlag, 2)
.set(StockReceiptOrder::getReverseAuditStatus, 1)
.set(StockReceiptOrder::getReverseAuditRemark, reverseRemarkForWms)
.set(StockReceiptOrder::getReverseAuditBy, reverseAuditUserId)
.set(StockReceiptOrder::getReverseAuditByName, reverseAuditUserName)
.set(StockReceiptOrder::getReverseAuditTime, reverseAuditDate)
.set(StockReceiptOrder::getUpdateBy, reverseAuditUserId)
.set(StockReceiptOrder::getUpdateByName, reverseAuditUserName)
.set(StockReceiptOrder::getUpdateTime, reverseAuditDate)
.eq(StockReceiptOrder::getInOrderNumber, inOrderNumber)
.eq(StockReceiptOrder::getDelFlag, 1));
//7.上架单明细
if (!shelfOrderNumbers.isEmpty()) {
shelfMaterialDetailService.update(new UpdateWrapper<ShelfMaterialDetail>().lambda()
.set(ShelfMaterialDetail::getDelFlag, 2)
.in(ShelfMaterialDetail::getShelfOrderNumber, shelfOrderNumbers)
.eq(ShelfMaterialDetail::getDelFlag, 1));
}
//8.上架单软删+打已反审标记上架单已反审tab 可查归档数据
stockShelfOrderService.update(new UpdateWrapper<StockShelfOrder>().lambda()
.set(StockShelfOrder::getDelFlag, 2)
.set(StockShelfOrder::getReverseAuditStatus, 1)
.set(StockShelfOrder::getReverseAuditRemark, reverseRemarkForWms)
.set(StockShelfOrder::getReverseAuditBy, reverseAuditUserId)
.set(StockShelfOrder::getReverseAuditByName, reverseAuditUserName)
.set(StockShelfOrder::getReverseAuditTime, reverseAuditDate)
.set(StockShelfOrder::getUpdateBy, reverseAuditUserId)
.set(StockShelfOrder::getUpdateByName, reverseAuditUserName)
.set(StockShelfOrder::getUpdateTime, reverseAuditDate)
.eq(StockShelfOrder::getInOrderNumber, inOrderNumber)
.eq(StockShelfOrder::getDelFlag, 1));
//9.收货/上架节点库存台账trackingNumber=收货/上架单号台账无逻辑删除标志物理删除保持台账与回退后库存一致
Set<String> standingTrackingNumbers = new HashSet<>(receiptOrderNumbers);
standingTrackingNumbers.addAll(shelfOrderNumbers);
if (!standingTrackingNumbers.isEmpty()) {
inventoryStandingDetailService.remove(new LambdaQueryWrapper<InventoryStandingDetail>()
.in(InventoryStandingDetail::getTrackingNumber, standingTrackingNumbers)
.in(InventoryStandingDetail::getNodeStatus, 1, 2));
}
//10.入库单明细
materialDetailService.update(new UpdateWrapper<InMaterialDetail>().lambda()
.set(InMaterialDetail::getDelFlag, 2)
.eq(InMaterialDetail::getInOrderNumber, inOrderNumber)
.eq(InMaterialDetail::getDelFlag, 1));
//11.入库单软删+打已反审标记入库单已反审tab 可查归档数据
stockInOrderService.update(new UpdateWrapper<StockInOrder>().lambda()
.set(StockInOrder::getDelFlag, 2)
.set(StockInOrder::getReverseAuditStatus, 1)
.set(StockInOrder::getReverseAuditRemark, reverseRemarkForWms)
.set(StockInOrder::getReverseAuditBy, reverseAuditUserId)
.set(StockInOrder::getReverseAuditByName, reverseAuditUserName)
.set(StockInOrder::getReverseAuditTime, reverseAuditDate)
.set(StockInOrder::getUpdateBy, reverseAuditUserId)
.set(StockInOrder::getUpdateByName, reverseAuditUserName)
.set(StockInOrder::getUpdateTime, reverseAuditDate)
.eq(StockInOrder::getInOrderNumber, inOrderNumber)
.eq(StockInOrder::getDelFlag, 1));
// ========== 4. 写1条入库异常反审记录用于记录跟踪组织信息取自W入库单 ==========
StockInOrder abnormalParam = new StockInOrder();
abnormalParam.setInOrderNumber(inOrderNumber);
abnormalParam.setOrganizationId(wmsOrder.getOrganizationId());
abnormalParam.setOrganizationName(wmsOrder.getOrganizationName());
abnormalParam.setTopOrganizationId(wmsOrder.getTopOrganizationId());
abnormalParam.setRemark(reverseReason);
abnormalParam.setUpdateBy(stockInOrder.getUpdateBy());
abnormalParam.setUpdateByName(reverseByName);
saveReverseAuditAbnormalIfAbsent(abnormalParam, inventoryTotal,
"回退库存" + inventoryTotal.stripTrailingZeros().toPlainString() + ",清理收货/上架链路数据");
}
/**
* 写入库异常反审记录type=3/abnormalType=6FSYC单号
* 同单号已存在有效反审记录时跳过保证"OMS重试/重复反审"不产生重复记录幂等
*
* @param stockInOrder 载荷入库单号/反审原因(remark)/操作人(updateBy,updateByName)/组织三字段
* @param quantity 本次反审回退的库存量未下发WMS无库存回退时传0
* @param sceneRemark 场景补充说明拼入记录备注
*/
private void saveReverseAuditAbnormalIfAbsent(StockInOrder stockInOrder, BigDecimal quantity, String sceneRemark) {
long existing = inOrderAbnormalService.count(new LambdaQueryWrapper<InOrderAbnormal>()
.eq(InOrderAbnormal::getInOrderNumber, stockInOrder.getInOrderNumber())
.eq(InOrderAbnormal::getAbnormalType, 6)
.eq(InOrderAbnormal::getDelFlag, 1));
if (existing > 0) {
return;
}
InOrderAbnormal reverseAbnormal = new InOrderAbnormal();
reverseAbnormal.setOrganizationId(stockInOrder.getOrganizationId());
reverseAbnormal.setOrganizationName(stockInOrder.getOrganizationName());
reverseAbnormal.setTopOrganizationId(stockInOrder.getTopOrganizationId());
reverseAbnormal.setInOrderNumber(stockInOrder.getInOrderNumber());
reverseAbnormal.setAbnormalReason(StringUtils.isEmpty(stockInOrder.getRemark())
? "入库业务单反审" : "入库业务单反审:" + stockInOrder.getRemark());
reverseAbnormal.setQuantity(quantity == null ? BigDecimal.ZERO : quantity);
reverseAbnormal.setRemark("入库业务单反审:" + (StringUtils.isEmpty(sceneRemark) ? "" : sceneRemark));
reverseAbnormal.setCreateBy(stockInOrder.getUpdateBy() == null ? 0L : stockInOrder.getUpdateBy());
reverseAbnormal.setCreateByName(StringUtils.isEmpty(stockInOrder.getUpdateByName()) ? "system" : stockInOrder.getUpdateByName());
inOrderAbnormalService.genReverseAuditAbnormal(reverseAbnormal);
}
/**
* OMS下发入库单明细保存后自动审核通过生成收货单并更新审核状态
*/
@@ -461,4 +461,7 @@ public class StockOutOrder extends BaseVOEntity {
@ApiModelProperty("签名备注")
private String signatureRemark;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -497,4 +497,7 @@ public class StockOutOrderPO extends BaseVOEntity {
@ApiModelProperty("签名备注")
private String signatureRemark;
}
@ApiModelProperty("反审标记: 0-无 1-已反审(反审时软删del_flag=2并打标记)")
private Integer reverseFlag;
}
@@ -538,4 +538,7 @@ public class StockOutOrderDO extends BaseVOEntity {
/** PDA出库签名列表专用:作业任务人员模糊查询字段 */
@ApiModelProperty("作业任务人员模糊查询")
private String workUserNameLike;
}
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -48,6 +48,7 @@ import com.mhd.wms.domain.materialInventory.entity.MaterialInventory;
import com.mhd.wms.domain.materialInventory.repository.facade.IMaterialInventoryService;
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
import com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryParamDO;
import com.mhd.wms.domain.materialMoreDetail.repository.po.MaterialMoreDetailPO;
import com.mhd.wms.domain.materialWarehouseControl.repository.facade.IMaterialWarehouseControlService;
import com.mhd.wms.domain.materialWarehouseControl.repository.po.MaterialWarehouseControlPO;
@@ -63,6 +64,7 @@ import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailPO;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailBaseDO;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.domain.outOrderAbnormal.repository.facade.IOutOrderAbnormalService;
import com.mhd.wms.domain.outOrderAbnormal.entity.OutOrderAbnormal;
import com.mhd.wms.domain.outOrderAbnormal.repository.todo.OutOrderAbnormalBaseDO;
import com.mhd.wms.domain.pickingMaterialDetail.entity.PickingMaterialDetail;
import com.mhd.wms.domain.pickingMaterialDetail.repository.facade.IPickingMaterialDetailService;
@@ -888,6 +890,34 @@ public class StockOutOrderDomainService {
return stockOutOrderPO;
}
/**
* 获取出库单归档详情(已反审): 出库单反审时主表/明细均已软删(del_flag=2),
* 主表 getInfo getById 不滤 del_flag, 明细通过 DO.delFlag=2 查归档数据
* (out_material_detail queryList XML 支持 delFlag 参数), 已反审tab 查看详情
*/
public StockOutOrderPO getReverseInfoChildren(Long outOrderId) {
StockOutOrderPO stockOutOrderPO = stockOutOrderService.getInfo(outOrderId);
if (stockOutOrderPO == null || stockOutOrderPO.getOutOrderNumber() == null) {
throw new ServiceException("出库单不存在");
}
OutMaterialDetailDO outMaterialDetailDO = new OutMaterialDetailDO();
outMaterialDetailDO.setOutOrderNumber(stockOutOrderPO.getOutOrderNumber());
outMaterialDetailDO.setDelFlag(2);
List<OutMaterialDetailPO> materialDetailPOList = outMaterialDetailService.queryListChildren(outMaterialDetailDO);
for (OutMaterialDetailPO outMaterialDetailPO : materialDetailPOList) {
String materialNo = outMaterialDetailPO.getMaterialNo();
List<MaterialBaseInfo> materialBaseInfos = materialBaseInfoMapper.selectList(new QueryWrapper<MaterialBaseInfo>().lambda().eq(MaterialBaseInfo::getMaterialCode, materialNo));
if (!CollectionUtils.isEmpty(materialBaseInfos) && materialBaseInfos.size() > 0) {
outMaterialDetailPO.setCommodityName(materialBaseInfos.get(0).getMaterialName());
outMaterialDetailPO.setMaterialCode(materialBaseInfos.get(0).getMaterialCode());
outMaterialDetailPO.setMaterialName(materialBaseInfos.get(0).getMaterialName());
outMaterialDetailPO.setCopyCode(materialBaseInfos.get(0).getCopyCode());
}
}
stockOutOrderPO.setMaterialDetailList(materialDetailPOList);
return stockOutOrderPO;
}
/**
* 获取出库单详细信息PDA复核管理查询详情
* 复核场景下与PC端getCheckInfo保持一致返回拣货下发时的完整数据树形结构拣货汇总批次属性等
@@ -2602,6 +2632,8 @@ public class StockOutOrderDomainService {
.eq(InventoryAdjustmentRecord::getRelateNo, relateNo));
//逻辑删除出库单明细
materialDetail.setDelFlag(2);
// 归档行置空uniqueId: 明细表唯一约束不含del_flag, 保留原值会与重新下发推单时同一uniqueId的新明细撞键
materialDetail.setUniqueId(null);
outMaterialDetailService.updateById(materialDetail);
}
//逻辑删除出库单用按单号查出的DB对象更新OMS补偿清理只传单号传入对象无主键直接updateById不生效
@@ -2625,16 +2657,217 @@ public class StockOutOrderDomainService {
}
}
/**
* @description oms出库执行单反审(业务单反审时逐执行单调用; 业务单侧仅允许"已审核未出库"单据反审):
* 按WMS出库单状态分支还原库存:
* 1.未出库(状态非9, 常规场景): 还原分配占用(可用+冻结-, cancelExecutionOrder 取消分配同口径),
* 不动实物库存不推OMS实物未被扣减, 加回会虚增库存; 软删库存调整记录
* 2.已出库(状态9, 防御分支, 业务单侧已拦截): 镜像交接扣减 doStockOutDeduct(实物/可用加回, 冻结不动),
* 生成库存调整记录出库反审 omsEdit 推送还原OMS预约库存
* 3.逻辑删除出库链路单据(软删+reverseFlag=1, 划归已反审tab): 配送明细/出库明细/出库单/拣货单及明细/复核单及明细/交接作业单
* 4.生成1条出库异常记录反审记录(abnormalType=3), 单号前缀 FSYC, 供记录跟踪
* 反审原因经入参 remark 透传(OMS侧拼接业务单号+反审原因)
* @date 2026/9/8
*/
@Transactional(rollbackFor = Exception.class)
public void reverseExecutionOrder(StockOutOrder stockOutOrder) {
String outOrderNumber = stockOutOrder.getOutOrderNumber();
StockOutOrder stockOutOrderDB = stockOutOrderService.getOne(new LambdaQueryWrapper<StockOutOrder>()
.eq(StockOutOrder::getOutOrderNumber, outOrderNumber)
.eq(StockOutOrder::getDelFlag, 1));
if (stockOutOrderDB == null) {
// 幂等: OMS普通下发生成的执行单不推WMS(执行并下发才推), WMS无此单属正常场景,
// 直接返回成功(无数据可清), 由OMS侧完成OMS侧清理与入库侧反审"WMS无数据时幂等成功"同口径
log.info("出库反审幂等:WMS无活动出库单[{}],无需清理", outOrderNumber);
return;
}
// OMS经Feign调用时可能无登录上下文(SecurityUtils会抛异常), 容错获取, 兜底用出库单创建人
LoginUser loginUser;
try {
loginUser = SecurityUtils.getLoginUser();
} catch (Exception e) {
loginUser = new LoginUser();
loginUser.setUserid(stockOutOrderDB.getCreateBy() != null ? stockOutOrderDB.getCreateBy() : 0L);
loginUser.setUsername(stockOutOrderDB.getCreateByName() != null ? stockOutOrderDB.getCreateByName() : "system");
}
String reverseRemark = stockOutOrder.getRemark();
//逻辑删除配送明细(所有清理路径统一先清, cancelExecutionOrder 一致)
deliveryDetailsLinkService.update(new UpdateWrapper<com.mhd.wms.domain.deliveryDetailsLink.entity.DeliveryDetailsLink>().lambda()
.set(com.mhd.wms.domain.deliveryDetailsLink.entity.DeliveryDetailsLink::getDelFlag, 2)
.eq(com.mhd.wms.domain.deliveryDetailsLink.entity.DeliveryDetailsLink::getOrderNumber, outOrderNumber)
.eq(com.mhd.wms.domain.deliveryDetailsLink.entity.DeliveryDetailsLink::getDelFlag, 1));
List<OutMaterialDetail> materialDetails = outMaterialDetailService.list(new LambdaQueryWrapper<OutMaterialDetail>()
.eq(OutMaterialDetail::getOutOrderNumber, outOrderNumber)
.eq(OutMaterialDetail::getDelFlag, 1));
// 出库/未出库分支: 未出库单据(WMS状态非9)实物库存未被扣减, 只还原分配占用(可用+冻结-),
// 不做实物还原也不推OMS否则会虚增库存; 已出库(9)分支还原实物并推OMS(防御保留, 业务单反审已拦截已出库单)
boolean shipped = stockOutOrderDB.getStatus() != null && stockOutOrderDB.getStatus() == 9;
for (OutMaterialDetail materialDetail : materialDetails) {
MaterialInventory materialInventory = materialInventoryMapper.selectById(materialDetail.getMaterialInventoryId());
if (!shipped) {
// ===== 未出库: 还原分配占用( cancelExecutionOrder 的取消分配同口径) =====
BigDecimal allocationQuantity = materialDetail.getAllocationQuantity();
if (materialInventory != null && allocationQuantity != null && allocationQuantity.compareTo(BigDecimal.ZERO) > 0) {
materialInventory.setAllocationQuantity((materialInventory.getAllocationQuantity() == null ? BigDecimal.ZERO : materialInventory.getAllocationQuantity()).add(allocationQuantity));
materialInventory.setFreezeQuantity((materialInventory.getFreezeQuantity() == null ? BigDecimal.ZERO : materialInventory.getFreezeQuantity()).subtract(allocationQuantity));
materialInventory.setUpdateTime(new Date());
materialInventoryMapper.updateById(materialInventory);
}
//逻辑删除库存调整记录
Long uniqueId = materialDetail.getUniqueId();
String relateNo = outOrderNumber + "#" + uniqueId;
inventoryAdjustmentRecordService.update(new InventoryAdjustmentRecord(), new LambdaUpdateWrapper<InventoryAdjustmentRecord>()
.set(InventoryAdjustmentRecord::getDelFlag, 2)
.eq(InventoryAdjustmentRecord::getRelateNo, relateNo));
} else {
// ===== 已出库: 还原实物库存并推送OMS(防御分支) =====
//还原数量与交接扣减一致: 需复核取复核数量, 否则取拣货数量(为空取计划数量), doStockOutDeduct
BigDecimal effectiveQuantity = Integer.valueOf(1).equals(stockOutOrderDB.getReview())
? materialDetail.getCheckQuantity()
: (materialDetail.getPickingQuantity() != null ? materialDetail.getPickingQuantity() : materialDetail.getQuantity());
Long materialInventoryId = materialDetail.getMaterialInventoryId();
if (materialInventoryId == null || effectiveQuantity == null || effectiveQuantity.compareTo(BigDecimal.ZERO) <= 0) {
//无可还原库存(未交接或漏传), 仍继续清理单据
materialDetail.setDelFlag(2);
materialDetail.setReverseFlag(1);
outMaterialDetailService.updateById(materialDetail);
continue;
}
if (materialInventory != null && !"yang_pin_chu_ku".equals(stockOutOrderDB.getBusinessType())) {
//样品出库交接不扣库存( doStockOutDeduct 一致), 反审同样跳过还原
BigDecimal area = materialDetail.getCheckArea() != null ? materialDetail.getCheckArea() : BigDecimal.ZERO;
BigDecimal volume = materialDetail.getCheckVolume() != null ? materialDetail.getCheckVolume() : BigDecimal.ZERO;
BigDecimal grossWeight = materialDetail.getCheckGrossWeight() != null ? materialDetail.getCheckGrossWeight() : BigDecimal.ZERO;
BigDecimal netWeight = materialDetail.getCheckNetWeight() != null ? materialDetail.getCheckNetWeight() : BigDecimal.ZERO;
MaterialInventoryParamDO restoreParam = new MaterialInventoryParamDO();
restoreParam.setMaterialInventoryId(materialInventoryId);
restoreParam.setMaterialBaseInfoId(materialInventory.getMaterialBaseInfoId());
restoreParam.setOrganizationId(materialInventory.getOrganizationId());
restoreParam.setOrganizationName(materialInventory.getOrganizationName());
restoreParam.setTopOrganizationId(materialInventory.getTopOrganizationId());
restoreParam.setWarehouseId(materialInventory.getWarehouseId());
restoreParam.setWarehouseCode(materialInventory.getWarehouseCode());
restoreParam.setWarehouseName(materialInventory.getWarehouseName());
restoreParam.setQuantity(effectiveQuantity);
restoreParam.setArea(area);
restoreParam.setVolume(volume);
restoreParam.setGrossWeight(grossWeight);
restoreParam.setNetWeight(netWeight);
restoreParam.setLotNumber(materialInventory.getLotNumber());
restoreParam.setBatchNumber(materialInventory.getBatchNumber());
restoreParam.setInOrderNumber(materialInventory.getInOrderNumber());
restoreParam.setProductionDate(materialInventory.getProductionDate());
restoreParam.setExpiryDate(materialInventory.getExpiryDate());
//库存调整记录出库反审(kctzjl 内部取调整前快照, 与交接扣减先记录后改库存的顺序一致)
restoreParam.setRelateNo(outOrderNumber + "#" + materialDetail.getUniqueId());
materialInventoryService.kctzjl(restoreParam, "出库反审", loginUser);
//type=1 上架还原: 实物库存/可用数量加回, 冻结数量不动
restoreParam.setType("1");
materialInventoryService.xgkc(restoreParam);
//推送OMS还原预约库存(type=1: OMS侧实物/可用加回, 与交接 omsEdit 扣减互逆)
MaterialInventoryOmsParamDO omsParam = new MaterialInventoryOmsParamDO();
BeanUtils.copyProperties(restoreParam, omsParam);
omsParam.setKctzType("出库反审");
omsParam.setLoginUser(loginUser);
omsServiceFeign.omsEdit(omsParam);
}
}
//逻辑删除出库单明细
materialDetail.setDelFlag(2);
// 归档行置空uniqueId: 明细表唯一约束不含del_flag, 保留原值会与重新下发推单时同一uniqueId的新明细撞键
materialDetail.setUniqueId(null);
materialDetail.setReverseFlag(1);
outMaterialDetailService.updateById(materialDetail);
}
//逻辑删除出库单(用按单号查出的DB对象更新: 传入对象无主键, 直接updateById不生效, cancelExecutionOrder 一致)
stockOutOrderDB.setDelFlag(2);
stockOutOrderDB.setReverseFlag(1);
stockOutOrderService.updateById(stockOutOrderDB);
//逻辑删除拣货单及拣货明细
PickingOrder pickingOrder = pickingOrderService.getOne(new LambdaQueryWrapper<PickingOrder>()
.eq(PickingOrder::getDelFlag, 1)
.eq(PickingOrder::getOrderNumber, outOrderNumber));
if (pickingOrder != null) {
String pickingOrderNumber = pickingOrder.getPickingOrderNumber();
List<PickingMaterialDetail> pickingDetails = pickingMaterialDetailService.list(new LambdaQueryWrapper<PickingMaterialDetail>()
.eq(PickingMaterialDetail::getPickingOrderNumber, pickingOrderNumber)
.eq(PickingMaterialDetail::getDelFlag, 1));
for (PickingMaterialDetail pickingMaterialDetail : pickingDetails) {
pickingMaterialDetail.setDelFlag(2);
pickingMaterialDetail.setReverseFlag(1);
pickingMaterialDetailService.updateById(pickingMaterialDetail);
}
pickingOrder.setDelFlag(2);
pickingOrder.setReverseFlag(1);
pickingOrderService.updateById(pickingOrder);
}
//逻辑删除复核单及复核明细(已复核单据反审时存在)
List<ReviewOrder> reviewOrders = reviewOrderMapper.selectList(new LambdaQueryWrapper<ReviewOrder>()
.eq(ReviewOrder::getDelFlag, 1)
.eq(ReviewOrder::getOutOrderNumber, outOrderNumber));
for (ReviewOrder reviewOrder : reviewOrders) {
reviewMaterialDetailMapper.update(null, new LambdaUpdateWrapper<ReviewMaterialDetail>()
.set(ReviewMaterialDetail::getDelFlag, 2)
.set(ReviewMaterialDetail::getReverseFlag, 1)
.eq(ReviewMaterialDetail::getReviewOrderId, reviewOrder.getReviewOrderId())
.eq(ReviewMaterialDetail::getDelFlag, 1));
reviewOrder.setDelFlag(2);
reviewOrder.setReverseFlag(1);
reviewOrderMapper.updateById(reviewOrder);
}
//逻辑删除交接作业单(不需复核单据出库完成时生成)
List<HandoverTaskOrder> handoverTaskOrders = handoverTaskOrderService.list(new LambdaQueryWrapper<HandoverTaskOrder>()
.eq(HandoverTaskOrder::getDelFlag, 1)
.eq(HandoverTaskOrder::getOrderNumber, outOrderNumber));
for (HandoverTaskOrder handoverTaskOrder : handoverTaskOrders) {
handoverTaskOrder.setDelFlag(2);
handoverTaskOrder.setReverseFlag(1);
handoverTaskOrderService.updateById(handoverTaskOrder);
}
//生成1条出库异常记录反审记录, 供记录跟踪
OutOrderAbnormal reverseAbnormal = new OutOrderAbnormal();
reverseAbnormal.setOrganizationId(stockOutOrderDB.getOrganizationId());
reverseAbnormal.setOrganizationName(stockOutOrderDB.getOrganizationName());
reverseAbnormal.setTopOrganizationId(stockOutOrderDB.getTopOrganizationId());
reverseAbnormal.setAbnormalNumber(OrderSequence.getOrderCode("FSYC"));
reverseAbnormal.setOutOrderNumber(outOrderNumber);
reverseAbnormal.setType(3);
reverseAbnormal.setAbnormalType(3);
reverseAbnormal.setQuantity(stockOutOrderDB.getQuantity());
reverseAbnormal.setActualQuantity(stockOutOrderDB.getPickingQuantity());
reverseAbnormal.setAbnormalActualQuantity(BigDecimal.ZERO);
reverseAbnormal.setAbnormalReason("出库单反审");
reverseAbnormal.setRemark(reverseRemark);
reverseAbnormal.setCreateBy(loginUser.getUserid());
reverseAbnormal.setCreateByName(loginUser.getUsername());
reverseAbnormal.setCreateTime(new Date());
outOrderAbnormalService.save(reverseAbnormal);
}
@Transactional(rollbackFor = Exception.class)
public void omsOrderAddDetail(List<OutMaterialDetail> outMaterialDetails) {
if (CollectionUtils.isEmpty(outMaterialDetails)) {
return;
}
//幂等保护重复下发时先逻辑删除同单号已存在的活动明细避免重复插入导致分配/拣货数据错乱
//幂等保护重复下发时本单已有活动明细统一软删(12)并置空uniqueId
outMaterialDetailService.update(new UpdateWrapper<OutMaterialDetail>().lambda()
.set(OutMaterialDetail::getDelFlag, 2)
.set(OutMaterialDetail::getUniqueId, null)
.eq(OutMaterialDetail::getOutOrderNumber, outMaterialDetails.get(0).getOutOrderNumber())
.eq(OutMaterialDetail::getDelFlag, 1));
//自愈反审/取消下发的历史归档明细(del_flag=2, 含其他执行单残留)若仍占用本次推送的uniqueId, 置空释放键位
//(表唯一约束不含del_flag; 反审后重新下发会复用同一库存行的uniqueId, 跨执行单也要清, 否则明细插入撞唯一约束)
List<Long> pushedUniqueIds = outMaterialDetails.stream()
.map(OutMaterialDetail::getUniqueId)
.filter(java.util.Objects::nonNull)
.distinct()
.collect(Collectors.toList());
if (!pushedUniqueIds.isEmpty()) {
outMaterialDetailService.update(new UpdateWrapper<OutMaterialDetail>().lambda()
.set(OutMaterialDetail::getUniqueId, null)
.eq(OutMaterialDetail::getDelFlag, 2)
.in(OutMaterialDetail::getUniqueId, pushedUniqueIds));
}
outMaterialDetailService.saveBatch(outMaterialDetails);
autoAuditOmsOutOrder(outMaterialDetails.get(0).getOutOrderNumber());
}
@@ -164,5 +164,22 @@ public class StockReceiptOrder extends BaseVOEntity {
@Excel(name = "业务单号")
private String batchNo;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -194,4 +194,21 @@ public class StockReceiptOrderPO extends StockInOrderBasePO {
@ApiModelProperty("批次号")
@Excel(name = "批次号")
private String batchNo;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -203,4 +203,21 @@ public class StockReceiptOrderDO extends StockInOrderBaseDO {
@ApiModelProperty("是否需要报关")
@Excel(name = "是否需要报关")
private Integer needCustomsDeclaration;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -261,7 +261,26 @@ public class StockReceiptOrderDomainService {
* 获取收货单详细信息
*/
public StockReceiptOrderPO getInfo(Long receiptOrderId) {
return stockReceiptOrderService.getInfo(receiptOrderId);
return getInfo(receiptOrderId, false);
}
/**
* 获取收货单详情
* @param archive true-查询已反审tab 归档数据已软删+已反审标记
*/
public StockReceiptOrderPO getInfo(Long receiptOrderId, boolean archive) {
if (!archive) {
return stockReceiptOrderService.getInfo(receiptOrderId);
}
//归档主单已软删 MP getById不过滤 del_flag并校验已反审标记
StockReceiptOrder order = stockReceiptOrderService.getById(receiptOrderId);
if (order == null || order.getDelFlag() == null || order.getDelFlag() != 2
|| !Integer.valueOf(1).equals(order.getReverseAuditStatus())) {
throw new ServiceException("收货单非已反审归档数据,无法查看归档详情");
}
StockReceiptOrderPO po = new StockReceiptOrderPO();
org.springframework.beans.BeanUtils.copyProperties(order, po);
return po;
}
/**
@@ -118,4 +118,21 @@ public class StockShelfOrder extends BaseVOEntity {
@Excel(name = "批次号")
private String batchNo;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -153,4 +153,21 @@ public class StockShelfOrderPO extends StockInOrderBasePO {
@DateTimeFormat(pattern = "yyyy-MM-dd")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date completionTime;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -173,4 +173,21 @@ public class StockShelfOrderDO extends StockInOrderBaseDO {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeTo;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
@ApiModelProperty("反审原因")
private String reverseAuditRemark;
@ApiModelProperty("反审人id")
private Long reverseAuditBy;
@ApiModelProperty("反审人姓名")
private String reverseAuditByName;
@ApiModelProperty("反审时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reverseAuditTime;
}
@@ -243,9 +243,34 @@ public class StockShelfOrderDomainService {
*/
public StockShelfOrderPO getInfo(Long shelfOrderId)
{
StockShelfOrderPO stockShelfOrderPO = stockShelfOrderService.getInfo(shelfOrderId);
return getInfo(shelfOrderId, false);
}
/**
* 获取上架单详情
* @param archive true-查询已反审tab 归档数据已软删+已反审标记明细放行软删行
*/
public StockShelfOrderPO getInfo(Long shelfOrderId, boolean archive)
{
StockShelfOrderPO stockShelfOrderPO;
if (archive) {
//归档主单已软删 MP getById不过滤 del_flag并校验已反审标记
StockShelfOrder order = stockShelfOrderService.getById(shelfOrderId);
if (order == null || order.getDelFlag() == null || order.getDelFlag() != 2
|| !Integer.valueOf(1).equals(order.getReverseAuditStatus())) {
throw new ServiceException("上架单非已反审归档数据,无法查看归档详情");
}
stockShelfOrderPO = new StockShelfOrderPO();
org.springframework.beans.BeanUtils.copyProperties(order, stockShelfOrderPO);
} else {
stockShelfOrderPO = stockShelfOrderService.getInfo(shelfOrderId);
}
ShelfMaterialDetailDO shelfMaterialDetailDO = new ShelfMaterialDetailDO();
shelfMaterialDetailDO.setShelfOrderNumber(stockShelfOrderPO.getShelfOrderNumber());
if (archive) {
//归档明细已随主单软删放行软删行
shelfMaterialDetailDO.setDelFlag(2);
}
List<ShelfMaterialDetailPO> inMaterialDetailPOList = shelfMaterialDetailService.queryListChildren(shelfMaterialDetailDO);
stockShelfOrderPO.setMaterialDetailList(inMaterialDetailPOList);
return stockShelfOrderPO;
@@ -8,7 +8,9 @@ import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import com.mhd.wms.interfaces.dto.inMaterialDetail.InMaterialDetailDTO;
import com.mhd.wms.interfaces.dto.inMaterialDetail.InMaterialDetailQueryDTO;
import org.springframework.stereotype.Component;
import java.util.Date;
@@ -32,6 +34,16 @@ public class InMaterialDetailAssembler {
return inMaterialDetailDO;
}
/**
* 入库明细查询关联入库单查询参数转换
*/
public QueryOrderOverStockDO toQueryDO(InMaterialDetailQueryDTO queryDTO) {
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
// 拷贝
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
return queryDO;
}
/**
* 转换实体
*/
@@ -0,0 +1,39 @@
package com.mhd.wms.interfaces.assember.outMaterialDetail;
import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import com.mhd.wms.interfaces.dto.outMaterialDetail.OutMaterialDetailDTO;
import com.mhd.wms.interfaces.dto.outMaterialDetail.OutMaterialDetailQueryDTO;
import org.springframework.stereotype.Component;
/**
* 出库物料明细Assembler
*
* @author rcx
* @date 2026-09-09
*/
@Component
public class OutMaterialDetailAssembler {
/**
* 转换实体
*/
public OutMaterialDetailDO toDO(OutMaterialDetailDTO outMaterialDetailDTO) {
OutMaterialDetailDO outMaterialDetailDO = new OutMaterialDetailDO();
// 拷贝
BeanUtils.copyProperties(outMaterialDetailDTO, outMaterialDetailDO, IgnoreNullUtil.getNullPropertyNames(outMaterialDetailDTO));
return outMaterialDetailDO;
}
/**
* 出库明细查询关联出库单查询参数转换
*/
public QueryOrderOverStockDO toQueryDO(OutMaterialDetailQueryDTO queryDTO) {
QueryOrderOverStockDO queryDO = new QueryOrderOverStockDO();
// 拷贝
BeanUtils.copyProperties(queryDTO, queryDO, IgnoreNullUtil.getNullPropertyNames(queryDTO));
return queryDO;
}
}
@@ -174,4 +174,7 @@ public class HandoverTaskOrderDTO extends BaseVOEntity {
private String pictureApp;
private String billingJson;
}
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -0,0 +1,64 @@
package com.mhd.wms.interfaces.dto.inMaterialDetail;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 入库明细查询参数 DTO关联入库单只统计已入库单据
*
* @author rcx
* @date 2026-09-09
*/
@Data
public class InMaterialDetailQueryDTO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("组织表ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("入库单号")
private String inOrderNumber;
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("货主id")
private Long shipperId;
@ApiModelProperty("货主名称")
private String shipperName;
@ApiModelProperty("入库单类型编码(如退货入库 tui_huo_ru_ku")
private String inOrderTypeCode;
@ApiModelProperty("入库单类型编码(与inOrderTypeCode同义)")
private String orderTypeCode;
@ApiModelProperty("入库单类型名称(模糊查询)")
private String orderTypeName;
@ApiModelProperty("物料基础信息id")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
@ApiModelProperty("实际入仓日期 开始(yyyy-MM-dd,为空按建档时间兜底)")
private String warehouseDateStart;
@ApiModelProperty("实际入仓日期 结束(yyyy-MM-dd,为空按建档时间兜底)")
private String warehouseDateEnd;
}
@@ -164,6 +164,9 @@ public class InventoryAdjustmentRecordDTO extends BaseVOEntity {
@ApiModelProperty("关联单号")
private String relateNo;
@ApiModelProperty("入库单号")
private String inOrderNumber;
@ApiModelProperty(name = "组织ID集合")
private List<Long> organizationIdList;
@@ -0,0 +1,64 @@
package com.mhd.wms.interfaces.dto.outMaterialDetail;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 出库明细查询参数 DTO关联出库单只统计已出库单据
*
* @author rcx
* @date 2026-09-09
*/
@Data
public class OutMaterialDetailQueryDTO extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("组织表ID")
private Long organizationId;
@ApiModelProperty("一级组织表ID")
private Long topOrganizationId;
@ApiModelProperty("出库单号")
private String outOrderNumber;
@ApiModelProperty("仓库id")
private Long warehouseId;
@ApiModelProperty("仓库编码")
private String warehouseCode;
@ApiModelProperty("仓库名称")
private String warehouseName;
@ApiModelProperty("货主id")
private Long shipperId;
@ApiModelProperty("货主名称")
private String shipperName;
@ApiModelProperty("出库单类型编码")
private String outOrderTypeCode;
@ApiModelProperty("出库单类型编码(与outOrderTypeCode同义)")
private String orderTypeCode;
@ApiModelProperty("出库单类型名称(模糊查询)")
private String orderTypeName;
@ApiModelProperty("物料基础信息id")
private Long materialBaseInfoId;
@ApiModelProperty("物料编码")
private String materialCode;
@ApiModelProperty("物料名称")
private String materialName;
@ApiModelProperty("实际出仓日期 开始(yyyy-MM-dd,为空按建档时间兜底)")
private String outboundDateStart;
@ApiModelProperty("实际出仓日期 结束(yyyy-MM-dd,为空按建档时间兜底)")
private String outboundDateEnd;
}
@@ -50,8 +50,8 @@ public class OutOrderAbnormalDTO extends BaseVOEntity {
@Excel(name = "拣货作业单号")
private String outTaskOrderNumber;
@ApiModelProperty("类型:1-拣货 2-复核")
@Excel(name = "类型:1-拣货 2-复核")
@ApiModelProperty("类型:1-拣货 2-复核 3-反审记录")
@Excel(name = "类型:1-拣货 2-复核 3-反审记录")
private Integer type;
@ApiModelProperty("计划数量")
@@ -66,8 +66,8 @@ public class OutOrderAbnormalDTO extends BaseVOEntity {
@Excel(name = "异常数量 = 作业数量 - 计划数量")
private BigDecimal abnormalActualQuantity;
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常")
@ApiModelProperty("异常类型: 1-拣货异常 2-复核异常 3-反审记录")
@Excel(name = "异常类型: 1-拣货异常 2-复核异常 3-反审记录")
private Integer abnormalType;
@ApiModelProperty("异常原因")
@@ -196,4 +196,7 @@ public class PickingOrderDTO extends BaseVOEntity {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeTo;
}
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -86,4 +86,7 @@ public class ReviewOrderDTO extends BaseVOEntity {
private Integer tabType;
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -468,4 +468,7 @@ public class StockInOrderDTO extends StockInOrderBaseDTO {
*/
@ApiModelProperty("作业任务人员(模糊查询)")
private String workUserNameLike;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
}
@@ -513,4 +513,7 @@ public class StockOutOrderDTO extends StockOutOrderBaseDTO {
/** PDA出库签名列表专用:作业任务人员模糊查询字段 */
@ApiModelProperty("作业任务人员(模糊查询)")
private String workUserNameLike;
}
@ApiModelProperty("反审标记: 1-已反审(查询【已反审】tab时与delFlag=2一起传入)")
private Integer reverseFlag;
}
@@ -171,4 +171,7 @@ public class StockReceiptOrderDTO extends StockInOrderBaseDTO {
@ApiModelProperty("业务单号")
@Excel(name = "业务单号")
private String batchNo;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
}
@@ -162,4 +162,7 @@ public class StockShelfOrderDTO extends StockInOrderBaseDTO {
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTimeTo;
@ApiModelProperty("反审状态: 0-无 1-已反审(已反审tab过滤)")
private Integer reverseAuditStatus;
}
@@ -92,6 +92,16 @@ public class HandoverTaskOrderApi extends BaseController {
return AjaxResult.success(handoverTaskOrderApplicationService.getInfo(outTaskOrderId));
}
/**
* 获取交接作业单归档详情(已反审): 反审时交接单已软删(del_flag=2), 已反审tab 查看归档详情
*/
@ApiOperation("获取交接作业单归档详情(已反审)")
@GetMapping(value = "/getReverseInfo/{outTaskOrderId}")
public AjaxResult getReverseInfo(@PathVariable("outTaskOrderId") Long outTaskOrderId)
{
return AjaxResult.success(handoverTaskOrderApplicationService.getReverseInfo(outTaskOrderId));
}
@ApiOperation("分配月台")
@PostMapping("/allocationPlatform")
@@ -1,18 +1,25 @@
package com.mhd.wms.interfaces.facadeApi.inMaterialDetail;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.wms.application.service.inMaterialDetail.InMaterialDetailApplicationService;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailExportPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailPO;
import com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO;
import com.mhd.wms.domain.inMaterialDetail.repository.todo.InMaterialDetailDO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import com.mhd.wms.interfaces.assember.inMaterialDetail.InMaterialDetailAssembler;
import com.mhd.wms.interfaces.dto.inMaterialDetail.InMaterialDetailDTO;
import com.mhd.wms.interfaces.dto.inMaterialDetail.InMaterialDetailQueryDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
/**
@@ -43,6 +50,40 @@ public class InMaterialDetailApi extends BaseController {
return getDataTable(list);
}
/**
* 入库明细查询关联入库单只统计已入库(5)单据
* 退货回仓按入库单类型 inOrderTypeCode=退货入库(tui_huo_ru_ku) 过滤
*/
@ApiOperation("入库明细查询(关联入库单)")
@GetMapping("/listWithOrder")
public TableDataInfo listWithOrder(InMaterialDetailQueryDTO queryDTO)
{
//转换实体
QueryOrderOverStockDO queryDO = inMaterialDetailAssembler.toQueryDO(queryDTO);
startPage();
List<InMaterialDetailWithOrderPO> list = inMaterialDetailApplicationService.queryInOrderDetailList(queryDO);
return getDataTable(list);
}
/**
* 导出入库明细查询Excel专用列集全量不分页只统计已入库(5)单据
*/
@ApiOperation("导出入库明细查询Excel")
@GetMapping("/exportWithOrder")
public void exportWithOrder(HttpServletResponse response, InMaterialDetailQueryDTO queryDTO) throws Exception
{
//转换实体不分页导出全量
QueryOrderOverStockDO queryDO = inMaterialDetailAssembler.toQueryDO(queryDTO);
List<InMaterialDetailExportPO> list = inMaterialDetailApplicationService.exportInOrderDetailList(queryDO);
String fileName = URLEncoder.encode("入库明细查询", "UTF-8").replaceAll("\\+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
ExcelUtil<InMaterialDetailExportPO> util = new ExcelUtil<>(InMaterialDetailExportPO.class);
util.exportExcel(response, list, "入库明细查询");
}
/**
* 编辑物料明细
*/
@@ -0,0 +1,69 @@
package com.mhd.wms.interfaces.facadeApi.outMaterialDetail;
import com.mhd.common.core.utils.poi.ExcelUtil;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.page.TableDataInfo;
import com.mhd.wms.application.service.outMaterialDetail.OutMaterialDetailApplicationService;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO;
import com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO;
import com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO;
import com.mhd.wms.interfaces.assember.outMaterialDetail.OutMaterialDetailAssembler;
import com.mhd.wms.interfaces.dto.outMaterialDetail.OutMaterialDetailQueryDTO;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
/**
* 出库物料明细Api
*
* @author rcx
* @date 2026-09-09
*/
@RestController
@RequestMapping("/outMaterialDetailApi")
public class OutMaterialDetailApi extends BaseController {
@Autowired
private OutMaterialDetailApplicationService outMaterialDetailApplicationService;
@Resource
private OutMaterialDetailAssembler outMaterialDetailAssembler;
/**
* 出库明细查询关联出库单只统计已出库(9/12/13)单据
*/
@ApiOperation("出库明细查询(关联出库单)")
@GetMapping("/listWithOrder")
public TableDataInfo listWithOrder(OutMaterialDetailQueryDTO queryDTO)
{
//转换实体
QueryOrderOverStockDO queryDO = outMaterialDetailAssembler.toQueryDO(queryDTO);
startPage();
List<OutMaterialDetailWithOrderPO> list = outMaterialDetailApplicationService.queryOutOrderDetailList(queryDO);
return getDataTable(list);
}
/**
* 导出出库明细查询Excel专用列集全量不分页只统计已出库(9/12/13)单据
*/
@ApiOperation("导出出库明细查询Excel")
@GetMapping("/exportWithOrder")
public void exportWithOrder(HttpServletResponse response, OutMaterialDetailQueryDTO queryDTO) throws Exception
{
//转换实体不分页导出全量
QueryOrderOverStockDO queryDO = outMaterialDetailAssembler.toQueryDO(queryDTO);
List<OutMaterialDetailExportPO> list = outMaterialDetailApplicationService.exportOutOrderDetailList(queryDO);
String fileName = URLEncoder.encode("出库明细查询", "UTF-8").replaceAll("\\+", "%20");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
ExcelUtil<OutMaterialDetailExportPO> util = new ExcelUtil<>(OutMaterialDetailExportPO.class);
util.exportExcel(response, list, "出库明细查询");
}
}
@@ -80,6 +80,15 @@ public class PickingOrderApi extends BaseController {
return AjaxResult.success(pickingOrderApplicationService.getInfoByIdAndType(pickingOrderId, type));
}
/**
* 获取拣货单归档详情(已反审): 反审时拣货单已软删(del_flag=2), 已反审tab 查看归档详情
*/
@ApiOperation("获取拣货单归档详情(已反审)")
@GetMapping(value = "/getReverseInfoByIdAndType/{pickingOrderId}/{type}")
public AjaxResult getReverseInfoByIdAndType(@PathVariable("pickingOrderId") Long pickingOrderId, @PathVariable("type") Integer type) {
return AjaxResult.success(pickingOrderApplicationService.getReverseInfoByIdAndType(pickingOrderId, type));
}
@ApiOperation("整单下发")
@PostMapping("/allDistribution")
@@ -52,6 +52,15 @@ public class ReviewOrderApi extends BaseController {
return AjaxResult.success(reviewOrderApplicationService.getDetailByReviewOrderId(reviewOrderId));
}
/**
* 获取复核单归档详情(已反审): 反审时复核单已软删(del_flag=2), 已反审tab 查看归档详情
*/
@ApiOperation("获取复核单归档详情(已反审)")
@GetMapping(value = "/getReverseInfo/{reviewOrderId}")
public AjaxResult getReverseInfo(@PathVariable("reviewOrderId") Long reviewOrderId) {
return AjaxResult.success(reviewOrderApplicationService.getReverseDetailByReviewOrderId(reviewOrderId));
}
@ApiOperation("根据复核单号获取复核单详情")
@GetMapping(value = "/getInfoReviewOrderNumber")
public AjaxResult getInfoReviewOrderNumber(@RequestParam("reviewOrderNumber") String reviewOrderNumber) {
@@ -147,6 +147,16 @@ public class StockInOrderApi extends BaseController {
return AjaxResult.success(stockInOrderApplicationService.getInfo(inOrderId));
}
/**
* 查询入库单已反审tab 归档详情已软删+已反审标记的数据含软删明细/收货单/上架单
*/
@ApiOperation("查询入库单已反审归档详情")
@GetMapping(value = "/getReverseAuditInfo/{inOrderId}")
public AjaxResult getReverseAuditInfo(@PathVariable("inOrderId") Long inOrderId)
{
return AjaxResult.success(stockInOrderApplicationService.getReverseAuditInfo(inOrderId));
}
/**
* 导入入库单
*/
@@ -329,6 +339,17 @@ public class StockInOrderApi extends BaseController {
return AjaxResult.success();
}
/**
* oms入库业务单反审WMS侧回退已完成单据出库拦截 -> 回退库存 ->
* 逻辑删除收货/上架链路 -> 写入库异常反审记录已产生出库则报错拦截
*/
@ApiOperation("oms入库单反审WMS回退")
@PostMapping(value = "/omsReverseInOrder")
public AjaxResult omsReverseInOrder(@RequestBody StockInOrder stockInOrder) {
stockInOrderApplicationService.omsReverseInOrder(stockInOrder);
return AjaxResult.success();
}
@ApiOperation("查询入库信息(通过入库单号)")
@PostMapping("/queryInStockInfo")
public AjaxResult queryInStockInfo(@RequestBody StockInOrderDTO stockInOrderDTO) {
@@ -200,6 +200,16 @@ public class StockOutOrderApi extends BaseController {
return AjaxResult.success(stockOutOrderApplicationService.getInfoChildren(outOrderId));
}
/**
* 获取出库单归档详情(已反审): 反审时单据已软删(del_flag=2), 常规详情查不到,
* 本接口不滤主表 del_flag 且明细查 del_flag=2 归档数据, 已反审tab 使用
*/
@ApiOperation("获取出库单归档详情(已反审)")
@GetMapping(value = "/getReverseInfo/{outOrderId}")
public AjaxResult getReverseInfo(@PathVariable("outOrderId") Long outOrderId) {
return AjaxResult.success(stockOutOrderApplicationService.getReverseInfoChildren(outOrderId));
}
/**
* 根据出库单号获取出库单详细信息
*/
@@ -511,8 +521,9 @@ public class StockOutOrderApi extends BaseController {
*/
@ApiOperation("oms下发单保存")
@PostMapping(value = "/omsOutOrderAdd")
public void omsOutOrderAdd(@RequestBody StockOutOrder stockOutOrder) {
public AjaxResult omsOutOrderAdd(@RequestBody StockOutOrder stockOutOrder) {
stockOutOrderApplicationService.omsOrderAdd(stockOutOrder);
return AjaxResult.success();
}
/**
@@ -540,8 +551,9 @@ public class StockOutOrderApi extends BaseController {
*/
@ApiOperation("oms下发单明细保存")
@PostMapping(value = "/omsOutOrderAddDetail")
public void omsOutOrderAddDetail(@RequestBody List<OutMaterialDetail> outMaterialDetails) {
public AjaxResult omsOutOrderAddDetail(@RequestBody List<OutMaterialDetail> outMaterialDetails) {
stockOutOrderApplicationService.omsOrderAddDetail(outMaterialDetails);
return AjaxResult.success();
}
/**
@@ -561,13 +573,25 @@ public class StockOutOrderApi extends BaseController {
return AjaxResult.success();
}
/**
* oms出库执行单反审(已出库单据回退): 还原实物库存并推送OMS
* 逻辑删除出库单/明细/拣货/复核/交接/配送链路数据生成出库异常记录反审记录
*/
@ApiOperation("oms出库执行单反审")
@PostMapping(value = "/omsReverseExecutionOrder")
public AjaxResult omsReverseExecutionOrder(@RequestBody StockOutOrder stockOutOrder) {
stockOutOrderApplicationService.reverseExecutionOrder(stockOutOrder);
return AjaxResult.success();
}
/**
* oms下发单配送明细保存
*/
@ApiOperation("oms下发单配送明细保存")
@PostMapping(value = "/omsOutOrderAddDeliveryDetailsLink")
public void omsOutOrderAddDeliveryDetailsLink(@RequestBody List<DeliveryDetailsLink> deliveryDetailLinks) {
public AjaxResult omsOutOrderAddDeliveryDetailsLink(@RequestBody List<DeliveryDetailsLink> deliveryDetailLinks) {
stockOutOrderApplicationService.omsOrderAddDeliveryDetailsLink(deliveryDetailLinks);
return AjaxResult.success();
}
@ApiOperation("出库单提货单打印")
@@ -64,6 +64,16 @@ public class StockReceiptOrderApi extends BaseController {
return AjaxResult.success(stockReceiptOrderApplicationService.getInfo(receiptOrderId));
}
/**
* 查询收货单已反审tab 归档详情已软删+已反审标记的数据含软删明细
*/
@ApiOperation("查询收货单已反审归档详情")
@GetMapping(value = "/getReverseAuditInfo/{receiptOrderId}")
public AjaxResult getReverseAuditInfo(@PathVariable("receiptOrderId") Long receiptOrderId)
{
return AjaxResult.success(stockReceiptOrderApplicationService.getReverseAuditInfo(receiptOrderId));
}
@ApiOperation("分配月台")
@PostMapping("/allocationPlatform")
public AjaxResult allocationPlatform(@RequestBody StockReceiptOrderDTO stockReceiptOrderDTO) {
@@ -64,6 +64,16 @@ public class StockShelfOrderApi extends BaseController {
return AjaxResult.success(stockShelfOrderApplicationService.getInfo(shelfOrderId, false));
}
/**
* 查询上架单已反审tab 归档详情已软删+已反审标记的数据含软删明细
*/
@ApiOperation("查询上架单已反审归档详情")
@GetMapping(value = "/getReverseAuditInfo/{shelfOrderId}")
public AjaxResult getReverseAuditInfo(@PathVariable("shelfOrderId") Long shelfOrderId)
{
return AjaxResult.success(stockShelfOrderApplicationService.getReverseAuditInfo(shelfOrderId));
}
@ApiOperation("任务下发")
@PostMapping("/taskDistribution")
public AjaxResult taskDistribution(@RequestBody StockShelfOrderDTO stockShelfOrderDTO) {
+4 -4
View File
@@ -14,18 +14,18 @@ spring:
nacos:
discovery:
# server-addr: 127.0.0.1:8848
# server-addr: 10.33.0.129:6010
server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号
server-addr: 10.102.192.31:6848
# server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
# server-addr: 10.102.192.105:6848
config:
# server-addr: 127.0.0.1:8848
# server-addr: 10.33.0.129:6010
server-addr: 10.33.0.129:6010
# 线上测试环境配置 容器名+端口号
server-addr: 10.102.192.31:6848
# server-addr: 10.102.192.31:6848
username: nacos
password: manhuoda@2023
#线上正式环境
@@ -373,6 +373,225 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<!-- 出库明细查询结果(关联出库单),在物料明细基础上追加单头通知单号/类型/货主/客户/预计出货时间/出仓日期与货品保额 -->
<resultMap type="com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailWithOrderPO" id="OutMaterialDetailWithOrderResult" extends="MaterialDetailResult">
<result property="noticeNumber" column="notice_number" />
<result property="shipperId" column="shipper_id" />
<result property="shipperCode" column="shipper_code" />
<result property="shipperName" column="shipper_name" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="customerId" column="customer_id" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="expectTime" column="expect_time" />
<result property="supplyChainNumber" column="supply_chain_number" />
<result property="priorityLevelCode" column="priority_level_code" />
<result property="priorityLevelName" column="priority_level_name" />
<result property="directWarehouse" column="direct_warehouse" />
<result property="annexUrl" column="annex_url" />
<result property="outOrderStatus" column="out_order_status" />
<result property="status" column="status" />
<result property="outOrderAuditStatus" column="out_order_audit_status"/>
<result property="outboundDate" column="outbound_date" />
<result property="completeTime" column="complete_time" />
<result property="insureAmount" column="insure_amount" />
<result property="goodsType" column="goods_type" />
<result property="materialClassifyName" column="material_classify_name" />
</resultMap>
<!--
出库明细查询(关联出库单):
口径:仅已出库及后续完成状态(b.status in (9,12,13):已出库/已复核/已交接,与出库排名统计同口径);
仅取 level=1 主行防父子行重复计数;
实际出仓日期筛选 b.outbound_date
注意:达梦数据库分页包裹查询不允许重复列名,单头列需与明细表 a 列名错开
b.out_order_number、b.warehouse_*、b.quantity 等与明细同名的列不重复查,明细行自带)
-->
<select id="queryOutOrderDetailList" parameterType="com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO" resultMap="OutMaterialDetailWithOrderResult">
select
<include refid="selectMaterialDetailPo"/>
, b.notice_number
, b.shipper_id, b.shipper_code, b.shipper_name
, b.order_type_code, b.order_type_name
, b.customer_id, b.customer_code, b.customer_name
, b.expect_time
, b.supply_chain_number
, b.priority_level_code, b.priority_level_name
, b.direct_warehouse
, b.annex_url
, b.status as out_order_status
, b.status as status
, b.audit_status as out_order_audit_status
, b.outbound_date
, b.complete_time
, c.insure_amount, c.goods_type, c.material_classify_name
from out_material_detail a
join stock_out_order b on a.out_order_number = b.out_order_number
left join material_base_info c on a.material_base_info_id = c.material_base_info_id
<where>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="outOrderNumber != null and outOrderNumber != ''">
and b.out_order_number like concat('%', #{outOrderNumber}, '%')
</if>
<if test="warehouseId != null ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and b.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and b.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="outOrderTypeCode != null and outOrderTypeCode != ''">
and b.order_type_code = #{outOrderTypeCode}
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and b.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and b.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
<!-- 出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接,只统计已出库(9/12/13)的明细 -->
and b.status in (9, 12, 13)
<!-- 实际出仓日期区间,用于统计当天出库(严格按出仓日期outbound_date过滤) -->
<if test="outboundDateStart != null and outboundDateStart != ''">
and date_format(b.outbound_date, '%Y-%m-%d') &gt;= #{outboundDateStart}
</if>
<if test="outboundDateEnd != null and outboundDateEnd != ''">
and date_format(b.outbound_date, '%Y-%m-%d') &lt;= #{outboundDateEnd}
</if>
and a.level = 1
and a.del_flag = 1
and b.del_flag = 1
</where>
order by a.create_time desc
</select>
<!--
出库明细导出(专用列集,列别名对应 OutMaterialDetailExportPO 属性):
客户编号/名称取出库单自身字段,客户预约名称取通知单 notice_order 的客户订单号(经 b.notice_number 关联);
饮用日期出库明细无此列,按入库单号+物料标量子查询回查入库明细的饮用日期(MAX 防多行);
火险保费 WMS 库暂无数据来源,导出空列(CAST(NULL)占位);
过滤口径与 queryOutOrderDetailList 完全一致(仅已出库(9/12/13)、level=1、实际出仓日期区间)
-->
<select id="exportOutOrderDetailList" parameterType="com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO" resultType="com.mhd.wms.domain.outMaterialDetail.repository.po.OutMaterialDetailExportPO">
select
a.out_order_number as outOrderNumber,
b.outbound_date as outboundDate,
a.create_time as createTime,
b.customer_code as customerCode,
b.customer_name as customerName,
a.lot_no as lotNo,
n.customer_order_number as customerOrderNumber,
a.material_name as materialName,
a.material_code as materialCode,
a.stock_unit as stockUnit,
a.PIECE_COUNT as pieceCount,
a.warehouse_name as warehouseName,
(select MAX(i.DRINK_DATE) from in_material_detail i
where i.in_order_number = a.in_order_number
and i.material_base_info_id = a.material_base_info_id
and i.del_flag = 1) as drinkDate,
a.storage_location_name as storageLocationName,
a.weight_limit as weightLimit,
a.single_volume as singleVolume,
a.unit_price as unitPrice,
a.TOTAL_AMOUNT as totalPrice,
a.discount_rate as discountRate,
a.monthly_warehouse_fee as monthlyWarehouseFee,
a.half_month_wh_fee as halfMonthWhFee,
a.contract_fee as contractFee,
CAST(NULL AS DECIMAL) as fireInsureFee,
a.remark as remark,
a.TOTAL_GROSS_WEIGHT as totalGrossWeight,
a.storage_name as storageName,
a.in_order_number as inOrderNumber,
c.material_classify_name as materialClassifyName,
CAST(NULL AS DECIMAL) as totalAmount,
b.status as outOrderStatus,
b.order_type_name as orderTypeName
from out_material_detail a
join stock_out_order b on a.out_order_number = b.out_order_number
left join material_base_info c on a.material_base_info_id = c.material_base_info_id
left join notice_order n on b.notice_number = n.notice_number and n.del_flag = 1
<where>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="outOrderNumber != null and outOrderNumber != ''">
and b.out_order_number like concat('%', #{outOrderNumber}, '%')
</if>
<if test="warehouseId != null ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and b.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and b.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="outOrderTypeCode != null and outOrderTypeCode != ''">
and b.order_type_code = #{outOrderTypeCode}
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and b.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and b.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
and b.status in (9, 12, 13)
<if test="outboundDateStart != null and outboundDateStart != ''">
and date_format(b.outbound_date, '%Y-%m-%d') &gt;= #{outboundDateStart}
</if>
<if test="outboundDateEnd != null and outboundDateEnd != ''">
and date_format(b.outbound_date, '%Y-%m-%d') &lt;= #{outboundDateEnd}
</if>
and a.level = 1
and a.del_flag = 1
and b.del_flag = 1
</where>
order by a.create_time desc
</select>
<update id="batchAddAllocationQuantityByIds" parameterType="com.mhd.wms.domain.outMaterialDetail.repository.todo.OutMaterialDetailDO">
UPDATE out_material_detail
<set>
@@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="reverseFlag" column="reverse_flag" />
<result property="pictureApp" column="picture_app" />
<result property="billingJson" column="billing_json" />
</resultMap>
@@ -49,7 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.platform_code, a.platform_name, a.platform_use_time_id, a.platform_use_start_time, a.platform_use_end_time, a.platform_use_status,
a.order_type_code, a.order_type_name, a.expect_time, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id,
a.shipper_name, a.order_number, a.picking_order_number, a.remark, a.task_distribution, a.task_distribution_time, a.create_time, a.create_by, a.create_by_name, a.update_time,
a.update_by, a.update_by_name, a.del_flag, a.picture_app,a.billing_json
a.update_by, a.update_by_name, a.del_flag, a.reverse_flag, a.picture_app,a.billing_json
</sql>
<sql id="selectHandoverTaskOrderPo1">
@@ -138,6 +139,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
<!-- 反审标记查询: 【已反审】tab 前端传 delFlag=2 + reverseFlag=1 -->
<if test="reverseFlag != null"> and a.reverse_flag = #{reverseFlag} </if>
</sql>
<select id="queryList" parameterType="com.mhd.wms.domain.handoverTaskOrder.repository.todo.HandoverTaskOrderDO" resultMap="HandoverTaskOrderResult">
@@ -357,6 +357,220 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
</select>
<!-- 入库明细查询结果(关联入库单),在物料明细基础上追加单头通知单号/类型/货主/供应商/预计到货时间/入仓日期与货品保额 -->
<resultMap type="com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailWithOrderPO" id="InMaterialDetailWithOrderResult" extends="MaterialDetailResult">
<result property="noticeNumber" column="notice_number" />
<result property="shipperId" column="shipper_id" />
<result property="shipperCode" column="shipper_code" />
<result property="shipperName" column="shipper_name" />
<result property="orderTypeCode" column="order_type_code" />
<result property="orderTypeName" column="order_type_name" />
<result property="supplierId" column="supplier_id" />
<result property="supplierCode" column="supplier_code" />
<result property="supplierName" column="supplier_name" />
<result property="expectTime" column="expect_time" />
<result property="supplyChainNumber" column="supply_chain_number" />
<result property="priorityLevelCode" column="priority_level_code" />
<result property="priorityLevelName" column="priority_level_name" />
<result property="directWarehouse" column="direct_warehouse" />
<result property="annexUrl" column="annex_url" />
<result property="inOrderStatus" column="in_order_status" />
<result property="status" column="status" />
<result property="inOrderAuditStatus" column="in_order_audit_status" />
<result property="warehouseDate" column="warehouse_date" />
<result property="insureAmount" column="insure_amount" />
<result property="goodsType" column="goods_type" />
<result property="materialClassifyName" column="material_classify_name" />
</resultMap>
<!--
入库明细查询(关联入库单):
口径:仅已入库状态(b.status = 5)单据;仅取 level=1 主行防父子行重复计数;
实际入仓日期筛选 IFNULL(b.warehouse_date, b.create_time)(与入库排名统计同口径);
退货回仓按入库单类型过滤(inOrderTypeCode,退货入库 tui_huo_ru_ku);
注意:达梦数据库分页包裹查询不允许重复列名,单头列需与明细表 a 列名错开
b.warehouse_*、b.quantity 等与明细同名的列不重复查,明细行自带)
-->
<select id="queryInOrderDetailList" parameterType="com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO" resultMap="InMaterialDetailWithOrderResult">
select
<include refid="selectMaterialDetailPo"/>
, b.notice_number
, b.shipper_id, b.shipper_code, b.shipper_name
, b.order_type_code, b.order_type_name
, b.supplier_id, b.supplier_code, b.supplier_name
, b.expect_time
, b.supply_chain_number
, b.priority_level_code, b.priority_level_name
, b.direct_warehouse
, b.annex_url
, b.status as in_order_status
, b.status as status
, b.audit_status as in_order_audit_status
, b.warehouse_date
, c.insure_amount, c.goods_type
, c.material_classify_name
from in_material_detail a
join stock_in_order b on a.in_order_number = b.in_order_number
left join material_base_info c on a.material_base_info_id = c.material_base_info_id
<where>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="inOrderNumber != null and inOrderNumber != ''">
and b.in_order_number like concat('%', #{inOrderNumber}, '%')
</if>
<if test="warehouseId != null ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and b.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and b.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="inOrderTypeCode != null and inOrderTypeCode != ''">
and b.order_type_code = #{inOrderTypeCode}
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and b.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and b.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
<!-- 入库状态: 1-已创建 2-已审核 3-收货中 4-上架中 5-已入库 6-已取消 7-已关闭,只统计已入库(5)的明细 -->
and b.status = 5
<!-- 实际入仓日期区间(为空的历史单按建档时间兜底),用于统计当天入库 -->
<if test="warehouseDateStart != null and warehouseDateStart != ''">
and date_format(IFNULL(b.warehouse_date, b.create_time), '%Y-%m-%d') &gt;= #{warehouseDateStart}
</if>
<if test="warehouseDateEnd != null and warehouseDateEnd != ''">
and date_format(IFNULL(b.warehouse_date, b.create_time), '%Y-%m-%d') &lt;= #{warehouseDateEnd}
</if>
and a.level = 1
and a.del_flag = 1
and b.del_flag = 1
</where>
order by a.create_time desc
</select>
<!--
入库明细导出(专用列集,列别名对应 InMaterialDetailExportPO 属性):
客户编号/名称/客户预约名称取自通知单 notice_order(入库单表无客户字段,经 b.notice_number 关联);
火险保费/单件净重 WMS 库暂无数据来源,导出空列(CAST(NULL)占位);
过滤口径与 queryInOrderDetailList 完全一致(仅已入库(5)、level=1、实际入仓日期区间)
-->
<select id="exportInOrderDetailList" parameterType="com.mhd.wms.domain.overStock.repository.todo.QueryOrderOverStockDO" resultType="com.mhd.wms.domain.inMaterialDetail.repository.po.InMaterialDetailExportPO">
select
b.shipper_code as customerCode,
b.shipper_name as customerName,
a.in_order_number as inOrderNumber,
b.warehouse_date as warehouseDate,
a.lot_no as lotNo,
n.customer_order_number as customerOrderNumber,
a.material_name as materialName,
a.material_code as materialCode,
a.unit_name as unitName,
a.PIECE_COUNT as pieceCount,
a.warehouse_name as warehouseName,
a.DRINK_DATE as drinkDate,
a.storage_location_name as storageLocationName,
CAST(NULL AS DECIMAL) as netWeight,
a.single_volume as singleVolume,
a.unit_price as unitPrice,
a.TOTAL_PRICE as totalPrice,
a.discount_rate as discountRate,
a.monthly_warehouse_fee as monthlyWarehouseFee,
a.half_month_wh_fee as halfMonthWhFee,
a.contract_fee as contractFee,
CAST(NULL AS DECIMAL) as fireInsureFee,
a.remark as remark,
c.material_classify_name as materialClassifyName,
a.TOTAL_GROSS_WEIGHT as totalGrossWeight,
c.insure_amount as insureAmount,
a.storage_name as storageName,
c.charge_standard as chargeStandard,
a.EXPIRY_DATE as expiryDate,
b.status as inOrderStatus,
b.order_type_name as orderTypeName
from in_material_detail a
join stock_in_order b on a.in_order_number = b.in_order_number
left join material_base_info c on a.material_base_info_id = c.material_base_info_id
left join notice_order n on b.notice_number = n.notice_number and n.del_flag = 1
<where>
<if test="organizationId != null ">
and a.organization_id = #{organizationId}
</if>
<if test="topOrganizationId != null ">
and a.top_organization_id = #{topOrganizationId}
</if>
<if test="materialBaseInfoId != null ">
and a.material_base_info_id = #{materialBaseInfoId}
</if>
<if test="materialCode != null and materialCode != ''">
and a.material_code = #{materialCode}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
<if test="inOrderNumber != null and inOrderNumber != ''">
and b.in_order_number like concat('%', #{inOrderNumber}, '%')
</if>
<if test="warehouseId != null ">
and b.warehouse_id = #{warehouseId}
</if>
<if test="warehouseCode != null and warehouseCode != ''">
and b.warehouse_code = #{warehouseCode}
</if>
<if test="warehouseName != null and warehouseName != ''">
and b.warehouse_name like concat('%', #{warehouseName}, '%')
</if>
<if test="shipperId != null ">
and b.shipper_id = #{shipperId}
</if>
<if test="shipperName != null and shipperName != ''">
and b.shipper_name like concat('%', #{shipperName}, '%')
</if>
<if test="inOrderTypeCode != null and inOrderTypeCode != ''">
and b.order_type_code = #{inOrderTypeCode}
</if>
<if test="orderTypeCode != null and orderTypeCode != ''">
and b.order_type_code = #{orderTypeCode}
</if>
<if test="orderTypeName != null and orderTypeName != ''">
and b.order_type_name like concat('%', #{orderTypeName}, '%')
</if>
and b.status = 5
<if test="warehouseDateStart != null and warehouseDateStart != ''">
and date_format(IFNULL(b.warehouse_date, b.create_time), '%Y-%m-%d') &gt;= #{warehouseDateStart}
</if>
<if test="warehouseDateEnd != null and warehouseDateEnd != ''">
and date_format(IFNULL(b.warehouse_date, b.create_time), '%Y-%m-%d') &lt;= #{warehouseDateEnd}
</if>
and a.level = 1
and a.del_flag = 1
and b.del_flag = 1
</where>
order by a.create_time desc
</select>
<!-- 入库列表页:按入库单号批量取去重后的 Invoice No -->
<select id="selectDistinctInvoiceNoForStockInList" resultType="com.mhd.wms.domain.inMaterialDetail.repository.po.InStockListMaterialAgg">
SELECT DISTINCT
@@ -91,7 +91,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectInOrderAbnormalPo"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPo"/>
from in_order_abnormal a
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number and a.DEL_FLAG = 1 and b.DEL_FLAG = 1
<!-- 反审记录(a.TYPE=3)关联的W入库单已被反审软删(del_flag=2),仍按 b.DEL_FLAG=1 关联会匹配不上:
LEFT JOIN 下 b 全为 NULL,仓库/货主等基于 b 的过滤条件(warehouseId等)随之恒为 false,反审记录列表恒为空;
故按 a.TYPE 切换关联状态:type=3 关联已软删的入库单,其余(收货/上架异常)关联正常入库单。
b.IN_ORDER_ID 取同状态最新一张:历史重复下发会产生同号多张入库单,不限定会JOIN出重复行 -->
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number
and a.DEL_FLAG = 1
and b.DEL_FLAG = (case when a.TYPE = 3 then 2 else 1 end)
and b.IN_ORDER_ID = (select max(c.IN_ORDER_ID) from stock_in_order c
where c.IN_ORDER_NUMBER = a.in_order_number
and c.DEL_FLAG = (case when a.TYPE = 3 then 2 else 1 end))
<where>
<include refid="selectInOrderAbnormalPo1"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPoWhere"/>
@@ -111,6 +111,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="relateNo != null and relateNo != ''">
and a.relate_no = #{relateNo}
</if>
<if test="inOrderNumber != null and inOrderNumber != ''">
and b.in_order_number = #{inOrderNumber}
</if>
<if test="materialName != null and materialName != ''">
and a.material_name like concat('%', #{materialName}, '%')
</if>
@@ -101,10 +101,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderTypeCode != null and orderTypeCode != ''">
and b.order_type_code = #{orderTypeCode}
</if>
<choose>
<when test="delFlag != null"> and b.del_flag = #{delFlag} </when>
<otherwise> and b.del_flag = 1 </otherwise>
</choose>
<!-- 不默认过滤 b.del_flag: 反审后出库单已软删(del_flag=2), 默认 b.del_flag=1 会让反审生成的异常记录在列表中消失;
仅当前端显式传 delFlag 时才过滤 -->
<if test="delFlag != null"> and b.del_flag = #{delFlag} </if>
</sql>
<select id="queryList" parameterType="com.mhd.wms.domain.outOrderAbnormal.repository.todo.OutOrderAbnormalDO" resultMap="OutOrderAbnormalResult">
@@ -112,7 +111,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectOutOrderAbnormalPo11"/>
<include refid="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper.joinStockOutOrderPoYc"/>
from out_order_abnormal a
left join stock_out_order b on a.out_order_number = b.out_order_number and b.del_flag = 1
<!-- 不按 b.del_flag 限定: 出库单号唯一, 关联活动单或反审归档单均按单号取数, 保证反审异常记录能带出出库单信息 -->
left join stock_out_order b on a.out_order_number = b.out_order_number
<where>
<include refid="selectOutOrderAbnormalPo1"/>
<include refid="joinStockOutOrderPoWhere"/>
@@ -248,6 +248,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND b.DEL_FLAG = 1
</select>
<!-- 归档汇总(已反审): 反审时拣货明细已软删(del_flag=2), 按 del_flag=1 统计恒为0会丢行, 供交接单归档详情使用 -->
<select id="queryTotalsByOutNumberAndBaseIdReverse" resultType="com.mhd.wms.domain.pickingMaterialDetail.repository.po.PickingMaterialDetailPO">
SELECT
COALESCE(SUM(b.PICKING_QUANTITY), 0) AS picking_quantity,
COALESCE(SUM(b.TOTAL_AREA), 0) AS total_area,
COALESCE(SUM(b.TOTAL_VOLUME), 0) AS total_volume,
COALESCE(SUM(b.TOTAL_NET_WEIGHT), 0) AS total_net_weight,
COALESCE(SUM(b.TOTAL_GROSS_WEIGHT), 0) AS total_gross_weight
FROM
PICKING_MATERIAL_DETAIL b
WHERE
b.OUT_UNIQUE_ID = #{outUniqueId}
AND b.DEL_FLAG = 2
</select>
<select id="sumPickingQuantityByOutOrderNumber" resultType="java.math.BigDecimal">
SELECT COALESCE(SUM(pmd.PICKING_QUANTITY), 0)
FROM picking_material_detail pmd
@@ -26,6 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="reverseFlag" column="reverse_flag" />
<result property="outOrderNumber" column="out_order_number" />
<result property="businessOrderNo" column="business_order_no" />
<result property="orderTypeCode" column="order_type_code" />
@@ -45,13 +46,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<sql id="selectPickingOrderPo">
a.picking_order_id, a.organization_id, a.organization_name, a.top_organization_id, a.order_number, a.picking_order_number,
a.status, a.type, a.warehouse_id, a.warehouse_code, a.warehouse_name, a.shipper_id, a.shipper_name, a.quantity, a.weight_limit, a.volume_limit, a.material_quantity,
IFNULL((SELECT SUM(b.picking_quantity) FROM picking_material_detail b WHERE b.picking_order_number = a.picking_order_number AND b.del_flag = 1), 0) AS picking_quantity,
<!-- 拣货数量/货物类型按行自身生命周期聚合(del_flag=a.del_flag): 活动行统计活动明细, 已反审归档行(del_flag=2)统计归档明细;
固定 del_flag=1 会导致【已反审】tab 及归档详情(queryOutOrderByIdReverse 复用本片段)拣货数量恒为0 -->
IFNULL((SELECT SUM(b.picking_quantity) FROM picking_material_detail b WHERE b.picking_order_number = a.picking_order_number AND b.del_flag = a.del_flag), 0) AS picking_quantity,
a.picking_material_quantity, a.abnormal, a.task_distribution, a.remark, a.create_time, a.create_by, a.create_by_name, a.update_time,b.out_order_id,
a.update_by, a.update_by_name, a.del_flag,a.out_order_number, a.business_order_no, a.order_type_code, a.order_type_name, a.priority_level_code, a.priority_level_name
a.update_by, a.update_by_name, a.del_flag, a.reverse_flag, a.out_order_number, a.business_order_no, a.order_type_code, a.order_type_name, a.priority_level_code, a.priority_level_name
,a.push_status,a.push_time,a.push_by,a.push_by_name,
(SELECT m.goods_type FROM PICKING_MATERIAL_DETAIL d
JOIN material_base_info m ON d.material_base_info_id = m.material_base_info_id
WHERE d.PICKING_ORDER_NUMBER = a.PICKING_ORDER_NUMBER and d.del_flag = 1
WHERE d.PICKING_ORDER_NUMBER = a.PICKING_ORDER_NUMBER and d.del_flag = a.del_flag
LIMIT 1) AS goods_type
</sql>
@@ -120,6 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
<!-- 反审标记查询: 【已反审】tab 前端传 delFlag=2 + reverseFlag=1 -->
<if test="reverseFlag != null"> and a.reverse_flag = #{reverseFlag} </if>
<if test="needDeclareFlag != null and needDeclareFlag != ''">
and b.need_declare_flag = #{needDeclareFlag}
</if>
@@ -170,6 +175,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE a.picking_order_id = #{pickingOrderId}
</select>
<!-- 归档详情(已反审): 反审时拣货单/出库单均已软删, 按 del_flag=2 查归档数据 -->
<select id="queryOutOrderByIdReverse" parameterType="java.lang.Long" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
select
<include refid="selectPickingOrderPo"/>
<include refid="com.mhd.wms.domain.stockOutOrder.repository.mapper.StockOutOrderMapper.joinStockOutOrderPo"/>
from picking_order a
left join stock_out_order b on a.order_number = b.out_order_number and b.del_flag = 2 and a.del_flag = 2
WHERE a.picking_order_id = #{pickingOrderId}
</select>
<select id="queryWaveOrderByIdReverse" parameterType="java.lang.Long" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
select
<include refid="selectPickingOrderPo"/>
<include refid="com.mhd.wms.domain.waveOrder.repository.mapper.WaveOrderMapper.joinWaveOrderPo"/>
from picking_order a
left join wave_order b on a.order_number = b.wave_order_number and a.del_flag = 2
WHERE a.picking_order_id = #{pickingOrderId}
</select>
<select id="queryOutOrderByOrderNumber" parameterType="java.lang.String" resultType="com.mhd.wms.domain.pickingOrder.repository.po.PickingOrderPO">
select
<include refid="selectPickingOrderPo"/>
@@ -32,6 +32,7 @@
<result property="updateByName" column="update_by_name"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="reverseFlag" column="reverse_flag"/>
<result property="materialKindCount" column="material_kind_count"/>
<result property="totalPlanQty" column="total_plan_qty"/>
<result property="totalReviewedQty" column="total_reviewed_qty"/>
@@ -81,6 +82,7 @@
<result property="updateByName" column="update_by_name"/>
<result property="updateTime" column="update_time"/>
<result property="delFlag" column="del_flag"/>
<result property="reverseFlag" column="reverse_flag"/>
</resultMap>
<sql id="reviewOrderSelectColumns">
@@ -111,7 +113,7 @@
a.update_by,
a.update_by_name,
a.update_time,
a.del_flag
a.del_flag, a.reverse_flag
</sql>
<sql id="reviewOrderWhere">
@@ -180,6 +182,10 @@
and a.del_flag = 1
</otherwise>
</choose>
<!-- 反审标记查询: 【已反审】tab 前端传 delFlag=2 + reverseFlag=1 -->
<if test="reverseFlag != null">
and a.reverse_flag = #{reverseFlag}
</if>
</sql>
<!-- 复核单列表查询(头表 + 明细聚合:种类数、计划总量、已复核总量) -->
@@ -198,7 +204,8 @@
sum(ifnull(d.material_plan_qty, ifnull(d.pending_review_qty, 0) + ifnull(d.reviewed_qty, 0))) as total_plan_qty,
sum(ifnull(d.reviewed_qty, 0)) as total_reviewed_qty
from review_material_detail d
where d.del_flag = 1
<!-- 不滤 del_flag: 复核明细仅随整单反审统一软删(全库唯一软删路径), 不滤才能让【已反审】tab 行汇总到归档明细;
活动单明细恒为 del_flag=1, 汇总口径不变 -->
group by d.review_order_id
) agg on a.review_order_id = agg.review_order_id
<where>
@@ -216,6 +223,15 @@
and a.del_flag = 1
</select>
<!-- 详情:主表 by id(归档: 已反审软删 del_flag=2,供【已反审】tab 详情) -->
<select id="selectHeaderByReviewOrderIdReverse" resultMap="ReviewOrderResult">
select
<include refid="reviewOrderSelectColumns"/>
from review_order a
where a.review_order_id = #{reviewOrderId}
and a.del_flag = 2
</select>
<!-- 详情:主表 by 复核单号 -->
<select id="selectHeaderByReviewOrderNumber" resultMap="ReviewOrderResult">
select
@@ -282,6 +298,16 @@
order by d.review_material_detail_id asc
</select>
<!-- 详情:明细 by 复核单主键(归档: 已反审软删 del_flag=2 -->
<select id="queryDetailByReviewOrderIdReverse" resultMap="ReviewMaterialDetailResult">
select
<include refid="reviewMaterialDetailColumns"/>
from review_material_detail d
where d.review_order_id = #{reviewOrderId}
and d.del_flag = 2
order by d.review_material_detail_id asc
</select>
<!-- 详情:明细 by 复核单号 -->
<select id="queryDetailByReviewOrderNumber" resultMap="ReviewMaterialDetailResult">
select
@@ -110,6 +110,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="signaturePic" column="SIGNATURE_PIC" />
<result property="evidencePics" column="EVIDENCE_PICS" />
<result property="signatureRemark" column="SIGNATURE_REMARK" />
<result property="reverseAuditStatus" column="REVERSE_AUDIT_STATUS" />
<result property="reverseAuditRemark" column="REVERSE_AUDIT_REMARK" />
<result property="reverseAuditBy" column="REVERSE_AUDIT_BY" />
<result property="reverseAuditByName" column="REVERSE_AUDIT_BY_NAME" />
<result property="reverseAuditTime" column="REVERSE_AUDIT_TIME" />
</resultMap>
<sql id="selectStockInOrderPo">
@@ -144,7 +149,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.CUSTOMS_BROKER_INFO, a.DELIVERY_ADDRESS, a.ENTRY_EXIT_CUSTOMS, a.ORIGIN_DESTINATION_COUNTRY, a.CARRIER, a.CONTAINER_NO,
a.TRANSPORT_METHOD, a.SUPERVISION_METHOD, a.CUSTOMS_INSPECTION, a.NEED_CUSTOMS_DECLARATION, a.NEED_TRANSPORT,
a.WAREHOUSE_DATE, a.COMPLETION_TIME, a.ORDER_DATE,a.stock_in_order,a.business_order_no,a.WORK_USER_ID,a.WORK_TASK_RECEIVE_STATUS,a.TASK_ISSUE_USER_ID,a.WORK_USER_NAME,
a.SIGNATURE_STATUS, a.SIGNATURE_TIME, a.SIGNATURE_PIC, a.EVIDENCE_PICS, a.SIGNATURE_REMARK
a.SIGNATURE_STATUS, a.SIGNATURE_TIME, a.SIGNATURE_PIC, a.EVIDENCE_PICS, a.SIGNATURE_REMARK,
a.REVERSE_AUDIT_STATUS, a.REVERSE_AUDIT_REMARK, a.REVERSE_AUDIT_BY, a.REVERSE_AUDIT_BY_NAME, a.REVERSE_AUDIT_TIME
</sql>
<sql id="joinStockInOrderPo">
@@ -483,9 +489,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
)
</if>
<!-- 反审状态过滤:入库单【已反审】tab 传 reverseAuditStatus=1,查询已软删且打反审标记的归档数据 -->
<if test="reverseAuditStatus != null">
and a.REVERSE_AUDIT_STATUS = #{reverseAuditStatus}
</if>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
<when test="reverseAuditStatus != null">
and a.del_flag = 2
</when>
<otherwise>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</otherwise>
</choose>
</sql>
@@ -59,6 +59,7 @@
<result property="updateBy" column="update_by"/>
<result property="updateByName" column="update_by_name"/>
<result property="delFlag" column="del_flag"/>
<result property="reverseFlag" column="reverse_flag"/>
<result property="overStockId" column="over_stock_id"/>
<result property="overStockStatus" column="over_stock_status"/>
<result property="overStockType" column="over_stock_type"/>
@@ -127,7 +128,7 @@
a.cancel_time, a.close_order, a.close_remark, a.close_by, a.close_by_name, a.close_time, a.check_status,
a.check_task_distribution, a.check_task_distribution_time, a.check_operators_by, a.check_operators_name, a.mobilize_code,
a.remark, a.create_time, a.create_by, a.create_by_name,a.train_no,a.PUSH_TIME,a.PUSH_BY,a.PUSH_BY_NAME,a.PUSH_STATUS,
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,a."TO",
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.reverse_flag, a.over_stock_id, a.over_stock_status, a.over_stock_type,a."TO",
a.CONTACT_PERSON,a.VEHICLE_MODEL_PLATE,a.ENTRUST_NO,a.TEL,a.DRIVER_SIGN,a.FAX,a.DECLARE_CUSTOMS,a.MANUFACTURER,
a.CUSTOMS_DECLARER_INFO,a.DELIVERY_ADDR,a.ENTRY_EXIT_CUSTOMS,a.DEPARTURE_ARRIVAL_COUNTRY,a.CARRIER,a.CONTAINER_NO,a.CONTAINER_NO_NAME,a.OUTBOUND_DATE,
a.COMPLETE_TIME,a.ORDER_DATE,a.TRANSPORT_MODE_CODE,a.TRANSPORT_MODE_NAME,a.SUPERVISION_MODE_CODE,a.SUPERVISION_MODE_NAME,
@@ -384,6 +385,8 @@
<when test="delFlag != null">and a.del_flag = #{delFlag}</when>
<otherwise>and a.del_flag = 1</otherwise>
</choose>
<!-- 反审标记查询: 【已反审】tab 前端传 delFlag=2 + reverseFlag=1 -->
<if test="reverseFlag != null">and a.reverse_flag = #{reverseFlag}</if>
</sql>
<select id="queryList" parameterType="com.mhd.wms.domain.stockOutOrder.repository.todo.StockOutOrderDO"
@@ -45,6 +45,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="billingJson" column="billing_json" />
<result property="businessOrderNo" column="business_order_no" />
<result property="batchNo" column="batch_no" />
<result property="reverseAuditStatus" column="REVERSE_AUDIT_STATUS" />
<result property="reverseAuditRemark" column="REVERSE_AUDIT_REMARK" />
<result property="reverseAuditBy" column="REVERSE_AUDIT_BY" />
<result property="reverseAuditByName" column="REVERSE_AUDIT_BY_NAME" />
<result property="reverseAuditTime" column="REVERSE_AUDIT_TIME" />
</resultMap>
@@ -54,7 +59,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.status, a.platform_id, a.platform_code, a.platform_name, a.platform_use_time_id, a.platform_use_start_time, a.platform_use_end_time,
a.platform_use_status, a.quantity, a.receipt_quantity, a.receipt_material_quantity, a.material_quantity, a.abnormal, a.task_distribution, a.task_distribution_time,
a.operators_by, a.operators_name, a.remark, a.create_time, a.create_by, a.create_by_name,
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.billing_json,a.business_order_no,a.batch_no
a.update_time, a.update_by, a.update_by_name, a.del_flag, a.billing_json,a.business_order_no,a.batch_no,
a.REVERSE_AUDIT_STATUS, a.REVERSE_AUDIT_REMARK, a.REVERSE_AUDIT_BY, a.REVERSE_AUDIT_BY_NAME, a.REVERSE_AUDIT_TIME
</sql>
<sql id="selectStockReceiptOrderPo1">
@@ -140,9 +146,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createTimeEnd != null and createTimeEnd != ''">
and date_format(a.create_time,'%Y-%m-%d') &lt;= #{createTimeEnd}
</if>
<!-- 反审状态过滤:收货单【已反审】tab 传 reverseAuditStatus=1,查询已软删且打反审标记的归档数据 -->
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
<when test="reverseAuditStatus != null">
and a.REVERSE_AUDIT_STATUS = #{reverseAuditStatus}
and a.del_flag = 2
</when>
<otherwise>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</otherwise>
</choose>
</sql>
@@ -152,7 +167,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectStockReceiptOrderPo"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPo"/>
from stock_receipt_order a
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number and a.DEL_FLAG = 1 and b.DEL_FLAG = 1
<!-- 已反审tab查归档数据: a/b 均已软删(del_flag=2), 仍按 del_flag=1 关联会导致 b 全为 NULL,
基于 b 的过滤条件(仓库/货主等)随之失效为 false, 列表恒为空; 故按是否查反审归档切换关联条件 -->
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number
<choose>
<when test="reverseAuditStatus != null">
and a.DEL_FLAG = 2 and b.DEL_FLAG = 2
<!-- 历史重复下发会产生同号多张入库单,限定只关联同状态最新一张,防止列表出现重复行 -->
and b.IN_ORDER_ID = (select max(c.IN_ORDER_ID) from stock_in_order c
where c.IN_ORDER_NUMBER = a.in_order_number and c.DEL_FLAG = 2)
</when>
<otherwise>
and a.DEL_FLAG = 1 and b.DEL_FLAG = 1
and b.IN_ORDER_ID = (select max(c.IN_ORDER_ID) from stock_in_order c
where c.IN_ORDER_NUMBER = a.in_order_number and c.DEL_FLAG = 1)
</otherwise>
</choose>
<where>
<include refid="selectStockReceiptOrderPo1"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPoWhere"/>
@@ -31,6 +31,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="pushBy" column="push_by" />
<result property="pushByName" column="push_by_name" />
<result property="goodsType" column="goods_type" />
<result property="reverseAuditStatus" column="REVERSE_AUDIT_STATUS" />
<result property="reverseAuditRemark" column="REVERSE_AUDIT_REMARK" />
<result property="reverseAuditBy" column="REVERSE_AUDIT_BY" />
<result property="reverseAuditByName" column="REVERSE_AUDIT_BY_NAME" />
<result property="reverseAuditTime" column="REVERSE_AUDIT_TIME" />
</resultMap>
@@ -40,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.shelves_material_quantity, a.abnormal,a.task_distribution, a.task_distribution_time, a.operators_by, a.remark, a.create_time, a.create_by,
a.create_by_name, a.update_time, a.update_by, a.update_by_name, a.del_flag
,a.push_status,a.push_time,a.push_by,a.push_by_name,
a.REVERSE_AUDIT_STATUS, a.REVERSE_AUDIT_REMARK, a.REVERSE_AUDIT_BY, a.REVERSE_AUDIT_BY_NAME, a.REVERSE_AUDIT_TIME,
(SELECT m.goods_type FROM shelf_material_detail d
JOIN material_base_info m ON d.material_base_info_id = m.material_base_info_id
WHERE d.shelf_order_number = a.shelf_order_number AND d.level = 1
@@ -125,9 +131,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="pushStatus != null">
and a.PUSH_STATUS = #{pushStatus}
</if>
<!-- 反审状态过滤:上架单【已反审】tab 传 reverseAuditStatus=1,查询已软删且打反审标记的归档数据 -->
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
<when test="reverseAuditStatus != null">
and a.REVERSE_AUDIT_STATUS = #{reverseAuditStatus}
and a.del_flag = 2
</when>
<otherwise>
<choose>
<when test="delFlag != null"> and a.del_flag = #{delFlag} </when>
<otherwise> and a.del_flag = 1 </otherwise>
</choose>
</otherwise>
</choose>
</sql>
@@ -143,7 +158,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectStockShelfOrderPo"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPo"/>
from stock_shelf_order a
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number and a.DEL_FLAG = 1 and b.DEL_FLAG = 1
<!-- 已反审tab查归档数据: a/b 均已软删(del_flag=2), 仍按 del_flag=1 关联会导致 b 全为 NULL,
基于 b 的过滤条件(仓库/货主等)随之失效为 false, 列表恒为空; 故按是否查反审归档切换关联条件 -->
LEFT JOIN stock_in_order b ON a.in_order_number = b.in_order_number
<choose>
<when test="reverseAuditStatus != null">
and a.DEL_FLAG = 2 and b.DEL_FLAG = 2
<!-- 历史重复下发会产生同号多张入库单,限定只关联同状态最新一张,防止列表出现重复行 -->
and b.IN_ORDER_ID = (select max(c.IN_ORDER_ID) from stock_in_order c
where c.IN_ORDER_NUMBER = a.in_order_number and c.DEL_FLAG = 2)
</when>
<otherwise>
and a.DEL_FLAG = 1 and b.DEL_FLAG = 1
and b.IN_ORDER_ID = (select max(c.IN_ORDER_ID) from stock_in_order c
where c.IN_ORDER_NUMBER = a.in_order_number and c.DEL_FLAG = 1)
</otherwise>
</choose>
<where>
<include refid="selectStockShelfOrderPo1"/>
<include refid="com.mhd.wms.domain.stockInOrder.repository.mapper.StockInOrderMapper.joinStockInOrderPoWhere"/>