Merge branch 'refs/heads/dev-ty1.2' into dev
# 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 # mhd_oms/src/main/resources/bootstrap.yml
This commit is contained in:
@@ -34,26 +34,4 @@ spring:
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
# XXL-JOB 配置
|
||||
#xxl:
|
||||
# job:
|
||||
# # 调度中心地址(填你部署的地址)
|
||||
# admin:
|
||||
# addresses: http://192.168.1.6:8020/xxl-job-admin
|
||||
# # 执行器配置
|
||||
# executor:
|
||||
# # 执行器名称(自定义,后面调度中心要用到)
|
||||
# appname: wms-service-executor
|
||||
# # 执行器注册地址,默认0表示自动获取
|
||||
# address:
|
||||
# # 执行器IP,默认空自动获取
|
||||
# ip:
|
||||
# # 执行器端口号(每个微服务不能重复,建议9997/9998/9999)
|
||||
# port: 9997
|
||||
# # 执行器日志存放路径
|
||||
# logpath: /data/applogs/xxl-job/jobhandler
|
||||
# # 日志保留天数
|
||||
# logretentiondays: 30
|
||||
# # 调度中心通讯令牌(默认空,安全可设置)
|
||||
# accessToken: default_token
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
@@ -0,0 +1,104 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mhd.wms.domain.inboundRank.repository.mapper.InboundRankMapper">
|
||||
|
||||
<!--
|
||||
入库排名统计公共查询条件
|
||||
数据源:入库明细 in_material_detail(a,仅 level=1 主行防重复) join 入仓单 stock_in_order(b)
|
||||
left join 货品档案 material_base_info(c,取保额作投保总额)
|
||||
口径:b.status = 5已入库(排除已取消(6)/已关闭(7)及未完成单据);
|
||||
日期筛选按入仓单入仓日期 b.warehouse_date(与列表"入仓日期"列同源,为空的历史单按建档时间兜底);
|
||||
一行 = 某仓单(b.in_order_number)内某货品(a.material_code)的合计,按件数(实际上架量 SUM(a.SHELVES_QUANTITY))降序排名
|
||||
-->
|
||||
<sql id="inboundRankConditions">
|
||||
a.del_flag = 1
|
||||
and a.level = 1
|
||||
and b.status = 5
|
||||
<if test="topOrganizationId != null">
|
||||
and b.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="warehouseId != null">
|
||||
and b.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and b.warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
<if test="inOrderNumber != null and inOrderNumber != ''">
|
||||
and b.in_order_number like concat('%', #{inOrderNumber}, '%')
|
||||
</if>
|
||||
<if test="shipperCode != null and shipperCode != ''">
|
||||
and b.shipper_code like concat('%', #{shipperCode}, '%')
|
||||
</if>
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and b.shipper_name like concat('%', #{shipperName}, '%')
|
||||
</if>
|
||||
<if test="materialCode != null and materialCode != ''">
|
||||
and a.material_code like concat('%', #{materialCode}, '%')
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and a.material_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
<if test="warehouseDateStart != null and warehouseDateStart != ''">
|
||||
and date_format(IFNULL(b.warehouse_date, b.create_time),'%Y-%m-%d') >= #{warehouseDateStart}
|
||||
</if>
|
||||
<if test="warehouseDateEnd != null and warehouseDateEnd != ''">
|
||||
and date_format(IFNULL(b.warehouse_date, b.create_time),'%Y-%m-%d') <= #{warehouseDateEnd}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="inboundRankFrom">
|
||||
from in_material_detail a
|
||||
join stock_in_order b on a.in_order_number = b.in_order_number and b.del_flag = 1
|
||||
left join material_base_info c on a.material_base_info_id = c.material_base_info_id
|
||||
</sql>
|
||||
|
||||
<!-- 商品入库排名列表(仓单+货品汇总,按件数=实际上架量降序) -->
|
||||
<select id="queryMaterialRankList" parameterType="com.mhd.wms.domain.inboundRank.repository.todo.InboundRankDO"
|
||||
resultType="com.mhd.wms.domain.inboundRank.repository.po.InboundMaterialRankPO">
|
||||
select
|
||||
IFNULL(MAX(b.warehouse_date), MAX(b.create_time)) AS warehouseDate,
|
||||
b.in_order_number AS inOrderNumber,
|
||||
MAX(b.shipper_code) AS shipperCode,
|
||||
MAX(b.shipper_name) AS shipperName,
|
||||
a.material_code AS materialCode,
|
||||
MAX(a.material_name) AS materialName,
|
||||
MAX(a.SPECIFICATION_MODEL) AS specificationModel,
|
||||
MAX(a.unit_name) AS unitName,
|
||||
IFNULL(SUM(a.SHELVES_QUANTITY), 0) AS pieceCount,
|
||||
ROUND(IFNULL(SUM(a.TOTAL_GROSS_WEIGHT), 0) / 1000, 3) AS grossWeightTon,
|
||||
MAX(IFNULL(c.insure_amount, 0)) AS insureAmount,
|
||||
IFNULL(SUM(a.TOTAL_VOLUME), 0) AS totalVolume
|
||||
<include refid="inboundRankFrom"/>
|
||||
<where>
|
||||
<include refid="inboundRankConditions"/>
|
||||
</where>
|
||||
GROUP BY b.in_order_number, a.material_code
|
||||
order by pieceCount desc, warehouseDate desc, inOrderNumber desc
|
||||
</select>
|
||||
|
||||
<!-- 商品入库排名合计(当前筛选条件全量;外层对分组结果再汇总,保证投保总额合计=各行列值之和) -->
|
||||
<select id="queryMaterialRankTotal" parameterType="com.mhd.wms.domain.inboundRank.repository.todo.InboundRankDO"
|
||||
resultType="com.mhd.wms.domain.inboundRank.repository.po.InboundRankTotalPO">
|
||||
select
|
||||
IFNULL(SUM(t.pieceCount), 0) AS totalPieceCount,
|
||||
ROUND(IFNULL(SUM(t.grossWeightKG), 0) / 1000, 3) AS totalGrossWeightTon,
|
||||
IFNULL(SUM(t.insureAmount), 0) AS totalInsureAmount,
|
||||
IFNULL(SUM(t.totalVolume), 0) AS totalVolume,
|
||||
COUNT(DISTINCT t.inOrderNumber) AS totalOrderCount
|
||||
from (
|
||||
select
|
||||
b.in_order_number AS inOrderNumber,
|
||||
IFNULL(SUM(a.SHELVES_QUANTITY), 0) AS pieceCount,
|
||||
IFNULL(SUM(a.TOTAL_GROSS_WEIGHT), 0) AS grossWeightKG,
|
||||
MAX(IFNULL(c.insure_amount, 0)) AS insureAmount,
|
||||
IFNULL(SUM(a.TOTAL_VOLUME), 0) AS totalVolume
|
||||
<include refid="inboundRankFrom"/>
|
||||
<where>
|
||||
<include refid="inboundRankConditions"/>
|
||||
</where>
|
||||
GROUP BY b.in_order_number, a.material_code
|
||||
) t
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -56,6 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="expiryDate" column="expiry_date" />
|
||||
<result property="inventoryDate" column="inventory_date" />
|
||||
<result property="purchaseDate" column="purchase_date" />
|
||||
<result property="batchRefNo" column="batch_ref_no" />
|
||||
<result property="sheetRefNo" column="sheet_ref_no" />
|
||||
<result property="boxPalletNo" column="box_pallet_no" />
|
||||
@@ -65,6 +66,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="inOrderNumber" column="in_order_number" />
|
||||
<result property="lotNumber" column="lot_number" />
|
||||
<result property="specificationModel" column="specification_model" />
|
||||
<result property="materialClassifyCode" column="material_classify_code"
|
||||
typeHandler="com.mhd.common.core.handler.ListTypeHandler" />
|
||||
<result property="materialClassifyName" column="material_classify_name"
|
||||
typeHandler="com.mhd.common.core.handler.ListTypeHandler" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -84,7 +89,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
IFNULL (sum(a.GROSS_WEIGHT), 0) GROSS_WEIGHT,
|
||||
IFNULL (sum(a.VOLUME), 0) VOLUME,
|
||||
a.ext_attr_1, a.ext_attr_2, a.ext_attr_3, a.ext_attr_4,
|
||||
a.production_date, a.expiry_date, a.inventory_date,
|
||||
a.production_date, a.expiry_date, a.inventory_date, a.purchase_date,
|
||||
a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name,
|
||||
a.bar_code as inv_bar_code,
|
||||
a.in_order_number,a.lot_number,
|
||||
@@ -108,7 +113,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
IFNULL (sum(a.GROSS_WEIGHT), 0) GROSS_WEIGHT,
|
||||
IFNULL (sum(a.VOLUME), 0) VOLUME,
|
||||
a.ext_attr_1, a.ext_attr_2, a.ext_attr_3, a.ext_attr_4,
|
||||
a.production_date, a.expiry_date, a.inventory_date,
|
||||
a.production_date, a.expiry_date, a.inventory_date, a.purchase_date,
|
||||
a.BATCH_REF_NO, a.SHEET_REF_NO, a.BOX_PALLET_NO,nvl(a.unit_name,b.unit_name) as unit_name,
|
||||
a.bar_code as inv_bar_code,
|
||||
a.in_order_number,a.lot_number,
|
||||
@@ -263,6 +268,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="expiryDateEnd != null and expiryDateEnd != ''">
|
||||
and a.expiry_date <![CDATA[ < ]]> DATEADD(DAY, 1, #{expiryDateEnd})
|
||||
</if>
|
||||
<if test="purchaseDateStr != null and purchaseDateStr != ''">
|
||||
AND TO_CHAR(a.purchase_date, 'yyyy-MM-dd') = #{purchaseDateStr}
|
||||
</if>
|
||||
<if test="purchaseDateStart != null and purchaseDateStart != ''">
|
||||
and a.purchase_date >= #{purchaseDateStart}
|
||||
</if>
|
||||
<if test="purchaseDateEnd != null and purchaseDateEnd != ''">
|
||||
and a.purchase_date <![CDATA[ < ]]> DATEADD(DAY, 1, #{purchaseDateEnd})
|
||||
</if>
|
||||
<if test="createTimeStart != null and createTimeStart != ''">
|
||||
and date_format(a.create_time,'%Y-%m-%d') >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != ''">
|
||||
and date_format(a.create_time,'%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 与 selectMaterialInventoryPo1 相同条件,表别名为 mi(用于 queryListByWl 最新明细子查询) -->
|
||||
@@ -383,6 +403,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!-- 导出融合排序(isExport=true):保留"到期日优先"第一优先级(到期日倒序、空值最后),
|
||||
融合新增"同到期日内按物料编码升序",再保留 0库存靠后、更新时间倒序 兜底,
|
||||
末位以 MAX(物料库存ID) 保证分页序稳定;不传 isExport 各语句保持原有排序 -->
|
||||
<sql id="exportOrderByMaterialCode">
|
||||
order by CASE WHEN MAX(a.expiry_date) IS NULL THEN 1 ELSE 0 END ASC, MAX(a.expiry_date) DESC,
|
||||
MAX(b.material_code) ASC,
|
||||
CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END ASC,
|
||||
MAX(a.update_time) DESC,
|
||||
MAX(a.material_inventory_id) DESC
|
||||
</sql>
|
||||
|
||||
<select id="queryList" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
select
|
||||
<include refid="selectMaterialInventoryPo"/>
|
||||
@@ -393,7 +424,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
</where>
|
||||
group by a.MATERIAL_INVENTORY_ID order by sort_order, a.update_time desc
|
||||
group by a.MATERIAL_INVENTORY_ID
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> order by sort_order, a.update_time desc </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 库存数量合计:与 queryList 相同筛选条件,对全部命中明细行 SUM(库存数量);
|
||||
不受 queryRule 分组展示影响(各分组行之和即全部明细之和) -->
|
||||
<select id="sumInventoryQuantity" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO"
|
||||
resultType="java.math.BigDecimal">
|
||||
select IFNULL(SUM(a.inventory_quantity), 0)
|
||||
from material_inventory a
|
||||
left join material_base_info b on a.material_base_info_id = b.material_base_info_id
|
||||
<where>
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- ============ 出库单明细可分配库存(库存分配弹窗专用) ============
|
||||
@@ -463,7 +513,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
</where>
|
||||
GROUP BY a.SHIPPER_ID,a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by sort_order, a.update_time desc
|
||||
GROUP BY a.SHIPPER_ID,a.MATERIAL_BASE_INFO_ID,a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> order by sort_order, a.update_time desc </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="queryListByKw" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
@@ -476,7 +532,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
</where>
|
||||
GROUP BY a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID order by sort_order, a.update_time desc
|
||||
GROUP BY a.WAREHOUSE_ID,a.STORAGE_SECTION_ID,a.STORAGE_LOCATION_ID
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> order by sort_order, a.update_time desc </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="queryListByWl" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
@@ -509,7 +571,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
GROUP BY a.MATERIAL_BASE_INFO_ID, a.WAREHOUSE_ID,
|
||||
loc.warehouse_id, loc.warehouse_code, loc.warehouse_name,
|
||||
loc.storage_section_id, loc.storage_code, loc.storage_name,
|
||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by sort_order, a.update_time desc
|
||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> order by sort_order, a.update_time desc </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- 按物料+过期日期汇总:相同物料+相同过期日期合并,不同过期日期分开 -->
|
||||
@@ -532,13 +600,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
IFNULL(SUM(a.VOLUME), 0) AS VOLUME,
|
||||
MAX(a.unit) AS unit,
|
||||
MAX(a.unit_name) AS unit_name,
|
||||
MAX(a.create_time) AS create_time,
|
||||
MAX(a.update_time) AS update_time,
|
||||
MAX(a.production_date) AS production_date,
|
||||
MAX(a.inventory_date) AS inventory_date,
|
||||
MAX(a.purchase_date) AS purchase_date,
|
||||
MAX(a.batch_ref_no) AS batch_ref_no, MAX(a.sheet_ref_no) AS sheet_ref_no, MAX(a.box_pallet_no) AS box_pallet_no,
|
||||
MAX(a.bar_code) AS inv_bar_code,
|
||||
MAX(a.in_order_number) AS in_order_number, MAX(a.lot_number) AS lot_number,
|
||||
MAX(b.specification_model) AS specification_model,
|
||||
MAX(b.material_code) AS material_code, MAX(b.material_name) AS material_name,
|
||||
MAX(b.material_classify_code) AS material_classify_code,
|
||||
MAX(b.material_classify_name) AS material_classify_name,
|
||||
CASE WHEN IFNULL(SUM(a.inventory_quantity), 0) = 0 THEN 1 ELSE 0 END AS sort_order
|
||||
from material_inventory a
|
||||
left join material_base_info b on a.material_base_info_id = b.material_base_info_id
|
||||
@@ -548,16 +621,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</where>
|
||||
GROUP BY a.MATERIAL_BASE_INFO_ID, a.EXPIRY_DATE, a.shipper_id,
|
||||
a.organization_id, a.top_organization_id
|
||||
<!-- 导出(queryRule=wlExpiry + orderByExpiryDate=true)按到期日分组归类:到期日倒序(日期近的在前)、
|
||||
空值放最后、0库存靠后、同到期日按更新时间倒序;相同物料+相同到期日合并为一行,数量类字段SUM汇总。
|
||||
不传 orderByExpiryDate 保持原有排序 -->
|
||||
<!-- 导出排序两级开关:isExport=true 用融合排序(到期日优先→同到期日按物料编码升序,与 orderByExpiryDate 融合不取代);
|
||||
否则保持原有 orderByExpiryDate 分支排序 -->
|
||||
<choose>
|
||||
<when test="orderByExpiryDate != null and orderByExpiryDate == true">
|
||||
order by CASE WHEN a.expiry_date IS NULL THEN 1 ELSE 0 END ASC, a.expiry_date DESC,
|
||||
sort_order, MAX(a.update_time) DESC
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
order by sort_order, MAX(a.update_time) desc
|
||||
<!-- 导出(queryRule=wlExpiry + orderByExpiryDate=true)按到期日分组归类:到期日倒序(日期近的在前)、
|
||||
空值放最后、0库存靠后、同到期日按更新时间倒序;相同物料+相同到期日合并为一行,数量类字段SUM汇总。
|
||||
不传 orderByExpiryDate 保持原有排序 -->
|
||||
<choose>
|
||||
<when test="orderByExpiryDate != null and orderByExpiryDate == true">
|
||||
order by CASE WHEN a.expiry_date IS NULL THEN 1 ELSE 0 END ASC, a.expiry_date DESC,
|
||||
sort_order, MAX(a.update_time) DESC
|
||||
</when>
|
||||
<otherwise>
|
||||
order by sort_order, MAX(a.update_time) desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
@@ -593,7 +675,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
GROUP BY a.SHIPPER_ID, a.MATERIAL_BASE_INFO_ID,
|
||||
loc.warehouse_id, loc.warehouse_code, loc.warehouse_name,
|
||||
loc.storage_section_id, loc.storage_code, loc.storage_name,
|
||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name order by sort_order, a.update_time desc
|
||||
loc.storage_location_id, loc.storage_location_code, loc.storage_location_name
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> order by sort_order, a.update_time desc </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<!-- ============ 按货主+物料+仓库+单位 汇总(库存查询第三个页签) ============ -->
|
||||
@@ -614,6 +702,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.top_organization_id,
|
||||
MAX(b.material_type) AS material_type,
|
||||
MAX(b.material_type_name) AS material_type_name,
|
||||
MAX(b.material_classify_code) AS material_classify_code,
|
||||
MAX(b.material_classify_name) AS material_classify_name,
|
||||
MAX(b.bar_code) AS bar_code,
|
||||
MAX(nvl(a.unit_name, b.unit_name)) AS unit_name,
|
||||
MAX(b.pack_id) AS pack_id,
|
||||
@@ -651,7 +741,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
b.material_code,
|
||||
a.warehouse_id,
|
||||
a.organization_id, a.top_organization_id
|
||||
ORDER BY sort_order, MAX(a.update_time) DESC
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> ORDER BY sort_order, MAX(a.update_time) DESC </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<select id="queryListByHz" parameterType="com.mhd.wms.domain.materialInventory.repository.todo.MaterialInventoryDO" resultMap="MaterialInventoryResult">
|
||||
@@ -664,7 +759,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectMaterialInventoryPo1"/>
|
||||
<include refid="com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper.JoinMaterialBaseInfoPoWhere"/>
|
||||
</where>
|
||||
GROUP BY a.SHIPPER_ID, a.WAREHOUSE_ID order by sort_order, a.update_time desc
|
||||
GROUP BY a.SHIPPER_ID, a.WAREHOUSE_ID
|
||||
<choose>
|
||||
<when test="isExport != null and isExport == true">
|
||||
<include refid="exportOrderByMaterialCode"/>
|
||||
</when>
|
||||
<otherwise> order by sort_order, a.update_time desc </otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
<resultMap type="com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO" id="MaterialQueryListResult">
|
||||
@@ -728,6 +829,10 @@ 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="materialClassifyCode" column="material_classify_code"
|
||||
typeHandler="com.mhd.common.core.handler.ListTypeHandler" />
|
||||
<result property="materialClassifyName" column="material_classify_name"
|
||||
typeHandler="com.mhd.common.core.handler.ListTypeHandler" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 1-按货主 2-按物料 3-按批次 4-按库位 5-按物料/库位 6-按容器 0-全部 -->
|
||||
@@ -1195,6 +1300,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="productionDate" column="production_date" />
|
||||
<result property="expiryDate" column="expiry_date" />
|
||||
<result property="inventoryDate" column="inventory_date" />
|
||||
<result property="purchaseDate" column="purchase_date" />
|
||||
<result property="batchRefNo" column="batch_ref_no" />
|
||||
<result property="sheetRefNo" column="sheet_ref_no" />
|
||||
<result property="boxPalletNo" column="box_pallet_no" />
|
||||
@@ -1513,6 +1619,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productionDate != null">
|
||||
AND TRUNC(a.PRODUCTION_DATE) = TRUNC(#{productionDate})
|
||||
</if>
|
||||
<if test="purchaseDate != null">
|
||||
AND TRUNC(a.purchase_date) = TRUNC(#{purchaseDate})
|
||||
</if>
|
||||
<if test="extAttr2 != null and extAttr2 != ''">
|
||||
AND a.EXT_ATTR_2 = #{extAttr2}
|
||||
</if>
|
||||
@@ -1544,6 +1653,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="productionDate == null">
|
||||
AND a.PRODUCTION_DATE is null
|
||||
</if>
|
||||
<if test="purchaseDate == null">
|
||||
AND a.purchase_date is null
|
||||
</if>
|
||||
<if test="extAttr2 == ''">
|
||||
AND a.EXT_ATTR_2 = #{extAttr2}
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mhd.wms.domain.outboundRank.repository.mapper.OutboundRankMapper">
|
||||
|
||||
<!--
|
||||
出库排名统计公共查询条件
|
||||
数据源:出库明细 out_material_detail(a,仅 level=1 主行防重复) join 出库单 stock_out_order(b)
|
||||
口径:b.status in (9已出库,12已复核,13已交接),排除已取消(10)/已关闭(11);
|
||||
日期按出库单创建时间 b.create_time(与出库单列表日期筛选一致)
|
||||
-->
|
||||
<sql id="outboundRankConditions">
|
||||
a.del_flag = 1
|
||||
and a.level = 1
|
||||
and b.status in (9, 12, 13)
|
||||
<if test="topOrganizationId != null">
|
||||
and b.top_organization_id = #{topOrganizationId}
|
||||
</if>
|
||||
<if test="warehouseId != null">
|
||||
and b.warehouse_id = #{warehouseId}
|
||||
</if>
|
||||
<if test="warehouseName != null and warehouseName != ''">
|
||||
and b.warehouse_name like concat('%', #{warehouseName}, '%')
|
||||
</if>
|
||||
<if test="customerName != null and customerName != ''">
|
||||
and b.customer_name like concat('%', #{customerName}, '%')
|
||||
</if>
|
||||
<if test="shipperName != null and shipperName != ''">
|
||||
and b.shipper_name like concat('%', #{shipperName}, '%')
|
||||
</if>
|
||||
<if test="lineCode != null and lineCode != ''">
|
||||
and b.line_code like concat('%', #{lineCode}, '%')
|
||||
</if>
|
||||
<if test="lineName != null and lineName != ''">
|
||||
and b.line_name like concat('%', #{lineName}, '%')
|
||||
</if>
|
||||
<if test="createTimeStart != null and createTimeStart != ''">
|
||||
and date_format(b.create_time,'%Y-%m-%d') >= #{createTimeStart}
|
||||
</if>
|
||||
<if test="createTimeEnd != null and createTimeEnd != ''">
|
||||
and date_format(b.create_time,'%Y-%m-%d') <= #{createTimeEnd}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<sql id="outboundRankFrom">
|
||||
from out_material_detail a
|
||||
join stock_out_order b on a.out_order_number = b.out_order_number and b.del_flag = 1
|
||||
</sql>
|
||||
|
||||
<!-- 商品出库排名列表 -->
|
||||
<select id="queryMaterialRankList" parameterType="com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO"
|
||||
resultType="com.mhd.wms.domain.outboundRank.repository.po.OutboundMaterialRankPO">
|
||||
select
|
||||
a.material_code AS materialCode,
|
||||
MAX(a.material_name) AS materialName,
|
||||
MAX(a.SPECIFICATION_MODEL) AS specificationModel,
|
||||
MAX(a.unit_name) AS unitName,
|
||||
IFNULL(SUM(a.outbound_quantity), 0) AS salesQuantity,
|
||||
COUNT(DISTINCT a.out_order_number) AS tradeCount,
|
||||
IFNULL(SUM(IFNULL(a.TOTAL_AMOUNT, 0)), 0) AS amount
|
||||
<include refid="outboundRankFrom"/>
|
||||
<where>
|
||||
<include refid="outboundRankConditions"/>
|
||||
<if test="materialCode != null and materialCode != ''">
|
||||
and a.material_code like concat('%', #{materialCode}, '%')
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and a.material_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY a.material_code
|
||||
order by salesQuantity desc
|
||||
</select>
|
||||
|
||||
<!-- 线路出库排名列表(线路为空的历史单不参与线路排名) -->
|
||||
<select id="queryLineRankList" parameterType="com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO"
|
||||
resultType="com.mhd.wms.domain.outboundRank.repository.po.OutboundLineRankPO">
|
||||
select
|
||||
b.line_code AS lineCode,
|
||||
MAX(b.line_name) AS lineName,
|
||||
IFNULL(SUM(a.outbound_quantity), 0) AS salesQuantity,
|
||||
COUNT(DISTINCT b.out_order_number) AS tradeCount,
|
||||
IFNULL(SUM(IFNULL(a.TOTAL_AMOUNT, 0)), 0) AS amount
|
||||
<include refid="outboundRankFrom"/>
|
||||
<where>
|
||||
<include refid="outboundRankConditions"/>
|
||||
and b.line_code is not null and b.line_code != ''
|
||||
</where>
|
||||
GROUP BY b.line_code
|
||||
order by salesQuantity desc
|
||||
</select>
|
||||
|
||||
<!-- 商品出库排名合计(当前筛选条件全量) -->
|
||||
<select id="queryMaterialRankTotal" parameterType="com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO"
|
||||
resultType="com.mhd.wms.domain.outboundRank.repository.po.OutboundRankTotalPO">
|
||||
select
|
||||
IFNULL(SUM(a.outbound_quantity), 0) AS totalSalesQuantity,
|
||||
COUNT(DISTINCT a.out_order_number) AS totalTradeCount,
|
||||
IFNULL(SUM(IFNULL(a.TOTAL_AMOUNT, 0)), 0) AS totalAmount
|
||||
<include refid="outboundRankFrom"/>
|
||||
<where>
|
||||
<include refid="outboundRankConditions"/>
|
||||
<if test="materialCode != null and materialCode != ''">
|
||||
and a.material_code like concat('%', #{materialCode}, '%')
|
||||
</if>
|
||||
<if test="materialName != null and materialName != ''">
|
||||
and a.material_name like concat('%', #{materialName}, '%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 线路出库排名合计(当前筛选条件全量) -->
|
||||
<select id="queryLineRankTotal" parameterType="com.mhd.wms.domain.outboundRank.repository.todo.OutboundRankDO"
|
||||
resultType="com.mhd.wms.domain.outboundRank.repository.po.OutboundRankTotalPO">
|
||||
select
|
||||
IFNULL(SUM(a.outbound_quantity), 0) AS totalSalesQuantity,
|
||||
COUNT(DISTINCT b.out_order_number) AS totalTradeCount,
|
||||
IFNULL(SUM(IFNULL(a.TOTAL_AMOUNT, 0)), 0) AS totalAmount
|
||||
<include refid="outboundRankFrom"/>
|
||||
<where>
|
||||
<include refid="outboundRankConditions"/>
|
||||
and b.line_code is not null and b.line_code != ''
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user