集成oms服务模块

This commit is contained in:
hjx
2026-01-19 15:20:20 +08:00
parent 1837337488
commit 56356839bf
163 changed files with 16893 additions and 0 deletions
@@ -0,0 +1,123 @@
<?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.oms.domain.scmOrder.repository.mapper.ScmOrderMapper">
<resultMap type="com.mhd.oms.domain.scmOrder.repository.po.ScmOrderPO" id="ScmOrderResult">
<result property="id" column="id" />
<result property="createBy" column="create_by" />
<result property="createByName" column="create_by_name" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
<result property="topOrganizationId" column="top_organization_id" />
<result property="organizationId" column="organization_id" />
<result property="organizationName" column="organization_name" />
<result property="scmSource" column="scm_source" />
<result property="orderId" column="order_id" />
<result property="scmNo" column="scm_no" />
<result property="orderState" column="order_state" />
<result property="taskNum" column="task_num" />
<result property="activeTaskNum" column="active_task_num" />
<result property="finishTaskNum" column="finish_task_num" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectScmOrderPo">
select id, create_by, create_by_name, create_time, update_by, update_by_name, update_time, del_flag, top_organization_id, organization_id, organization_name, scm_source, order_id, scm_no, order_state, task_num, active_task_num, finish_task_num, remark from oms_scm_order
where del_flag = 1
</sql>
<sql id="selectScmOrderPo1">
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="scmSource != null ">
and scm_source = #{scmSource}
</if>
<if test="orderId != null ">
and order_id = #{orderId}
</if>
<if test="scmNo != null and scmNo != ''">
and scm_no = #{scmNo}
</if>
<if test="orderState != null ">
and order_state = #{orderState}
</if>
<if test="taskNum != null ">
and task_num = #{taskNum}
</if>
<if test="activeTaskNum != null ">
and active_task_num = #{activeTaskNum}
</if>
<if test="finishTaskNum != null ">
and finish_task_num = #{finishTaskNum}
</if>
<if test="idList != null">
and id in
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</sql>
<select id="queryList" parameterType="com.mhd.oms.domain.scmOrder.repository.todo.ScmOrderDO" resultMap="ScmOrderResult">
<include refid="selectScmOrderPo"/>
<include refid="selectScmOrderPo1"/>
</select>
<update id="batchUpdateOrderState">
UPDATE oms_scm_order
set
order_state = #{orderState},
update_by = #{userPo.userId},
update_by_name = #{userPo.userName},
update_time = now()
WHERE
del_flag = 1
and id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="getGoodsAndTaskInfoList" resultType="com.mhd.oms.domain.scmOrder.repository.po.ScmOrderPO">
select
a.id,
a.scm_no,
a.order_id,
a.order_state,
a.scm_source,
goods.id goodsId,
goods.goods_name,
ifnull(goods.material_unit_ea_quantity, 0) totalGoodsNum, -- 总物料数量
ifnull(sum(task.plan_num), 0) existedGoodsNum, -- 已生成物料数量
case a.scm_source when 1 then pur.receiving_warehouse_id when 2 then sales.delivery_warehouse_id else '异常订单来源' end warehouseId,
case a.scm_source when 1 then pur.receiving_warehouse when 2 then sales.delivery_warehouse else '异常订单来源' end warehouseName,
case a.scm_source when 1 then pur.job_task_type_id when 2 then sales.job_task_type_id else '异常订单来源' end jobTaskTypeId,
case a.scm_source when 1 then pur.job_task_type when 2 then sales.job_task_type else '异常订单来源' end jobTaskType
FROM
oms_scm_order a
left join oms_purchase_order pur on a.order_id = pur.id and pur.del_flag = 1
left join oms_sales_order sales on a.order_id = sales.id and sales.del_flag = 1
left join oms_goods goods on a.order_id = goods.order_id and goods.del_flag = 1
left join oms_task_order task on goods.order_id = task.order_id and goods.id = task.goods_id and task.del_flag = 1 and task.task_status in (0,1,2)
where
a.del_flag = 1
and a.id IN
<foreach collection="idList" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group by goods.id
</select>
</mapper>