feat(oms/wms): 出入库明细查询-已入库/已出库状态过滤、WMS新增出入库明细查询页面及专用导出
一、OMS 入库/出库明细查询(修复+导出) - 出库明细SQL状态过滤由=9改为in(9,12,13):已出库/已复核/已交接均算已出库,与出库排名统计口径一致 - 入库明细SQL固定只统计已入库(status=5)单据 - 入/出库明细SQL新增实际入仓/出仓日期区间过滤(IFNULL(实际日期,建档时间)兜底),支持统计当天 - 新增Excel导出接口 /executionInMaterialDetailApi/exportWithOrder、/executionOutMaterialDetailApi/exportWithOrder(全量不分页) - 退货回仓统计:通过入库单类型 inOrderTypeCode=tui_huo_ru_ku(退货入库)过滤 二、WMS 新增入库/出库明细查询页面 - 入库明细查询:GET /materialDetailApi/listWithOrder(明细关联入库单,固定已入库(5),level=1防父子行重复计数) - 出库明细查询:GET /outMaterialDetailApi/listWithOrder(新建OutMaterialDetailApi,关联出库单,固定in(9,12,13)) - 返回单头字段:单据状态/审核状态/货主/供应商/客户/单据类型/实际入仓出仓日期/保额/货物类型等 - 入库客户编号/名称/客户预约名称经通知单号关联notice_order取得(入库单表无客户字段) 三、WMS 明细导出专用列集 - 出库导出/exportWithOrder:按客户要求30列导出,含出库单号/出库日期/客户信息/LOT号/费用组(单价、总价、折扣、仓租、合同收费)等 - 入库导出/exportWithOrder:按客户要求30列导出,含客户信息/入库日期/每件保额/收费标准/有效期等 - 单据状态、货物种类导出时自动转文字;导出列顺序与客户清单一致 - 火险保费、入库单件净重(KG)暂无数据来源,导出空列占位,待确认数据来源后补充 四、其他 - 查询条件不传日期时默认查全部日期,统计当天由前端传当天日期区间实现 - 数据权限:非平台超管按登录人一级组织过滤
This commit is contained in:
@@ -373,6 +373,207 @@ 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="outOrderAuditStatus" column="out_order_audit_status"/>
|
||||
<result property="outboundDate" column="outbound_date" />
|
||||
<result property="insureAmount" column="insure_amount" />
|
||||
<result property="goodsType" column="goods_type" />
|
||||
</resultMap>
|
||||
|
||||
<!--
|
||||
出库明细查询(关联出库单):
|
||||
口径:仅已出库及后续完成状态(b.status in (9,12,13):已出库/已复核/已交接,与出库排名统计同口径);
|
||||
仅取 level=1 主行防父子行重复计数;
|
||||
实际出仓日期筛选 IFNULL(b.outbound_date, b.create_time);
|
||||
注意:达梦数据库分页包裹查询不允许重复列名,单头列需与明细表 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.audit_status as out_order_audit_status
|
||||
, b.outbound_date
|
||||
, c.insure_amount, c.goods_type
|
||||
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>
|
||||
<!-- 出库状态: 1-已创建 2-已审核 3-部分分配 4-已分配 5-波次中 6-拣货中 7-拣货完成 8-复核中 9-已出库 10-已取消 11-已关闭 12-已复核 13-已交接,只统计已出库(9/12/13)的明细 -->
|
||||
and b.status in (9, 12, 13)
|
||||
<!-- 实际出仓日期区间(为空的历史单按建档时间兜底),用于统计当天出库 -->
|
||||
<if test="outboundDateStart != null and outboundDateStart != ''">
|
||||
and date_format(IFNULL(b.outbound_date, b.create_time), '%Y-%m-%d') >= #{outboundDateStart}
|
||||
</if>
|
||||
<if test="outboundDateEnd != null and outboundDateEnd != ''">
|
||||
and date_format(IFNULL(b.outbound_date, b.create_time), '%Y-%m-%d') <= #{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_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,
|
||||
a.TOTAL_GROSS_WEIGHT as totalGrossWeight,
|
||||
a.storage_name as storageName,
|
||||
a.in_order_number as inOrderNumber,
|
||||
c.goods_type as goodsType,
|
||||
a.TOTAL_AMOUNT as totalAmount,
|
||||
b.status as outOrderStatus
|
||||
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>
|
||||
and b.status in (9, 12, 13)
|
||||
<if test="outboundDateStart != null and outboundDateStart != ''">
|
||||
and date_format(IFNULL(b.outbound_date, b.create_time), '%Y-%m-%d') >= #{outboundDateStart}
|
||||
</if>
|
||||
<if test="outboundDateEnd != null and outboundDateEnd != ''">
|
||||
and date_format(IFNULL(b.outbound_date, b.create_time), '%Y-%m-%d') <= #{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>
|
||||
|
||||
Reference in New Issue
Block a user