完成排产(测试过了)
This commit is contained in:
197
klp-da/src/main/resources/mapper/da/aps/ApsPlanMapper.xml
Normal file
197
klp-da/src/main/resources/mapper/da/aps/ApsPlanMapper.xml
Normal file
@@ -0,0 +1,197 @@
|
||||
<?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.klp.aps.mapper.ApsPlanMapper">
|
||||
|
||||
<select id="selectOrderDetailsByOrderId"
|
||||
parameterType="long"
|
||||
resultType="com.klp.aps.domain.row.ApsOrderDetailRow">
|
||||
SELECT
|
||||
detail_id AS detailId,
|
||||
product_id AS productId,
|
||||
quantity AS quantity
|
||||
FROM wms_order_detail
|
||||
WHERE order_id = #{orderId}
|
||||
AND (del_flag = 0 OR del_flag IS NULL)
|
||||
ORDER BY detail_id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectCrmOrderById" resultType="com.klp.aps.domain.row.ApsCrmOrderRow">
|
||||
SELECT
|
||||
order_id AS orderId,
|
||||
order_code AS orderCode,
|
||||
customer_id AS customerId,
|
||||
salesman AS salesman,
|
||||
order_amount AS orderAmount,
|
||||
remark AS remark
|
||||
FROM crm_order
|
||||
WHERE order_id = #{crmOrderId}
|
||||
AND del_flag = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectCrmOrderItemsByOrderId" resultType="com.klp.aps.domain.row.ApsCrmOrderItemRow">
|
||||
SELECT
|
||||
item_id AS itemId,
|
||||
order_id AS orderId,
|
||||
product_type AS productType,
|
||||
product_num AS productNum,
|
||||
contract_price AS contractPrice,
|
||||
remark AS remark
|
||||
FROM crm_order_item
|
||||
WHERE order_id = #{crmOrderId}
|
||||
AND del_flag = 0
|
||||
ORDER BY item_id ASC
|
||||
</select>
|
||||
|
||||
<select id="selectWmsOrderByCode" resultType="com.klp.aps.domain.row.ApsWmsOrderRow">
|
||||
SELECT order_id AS orderId, order_code AS orderCode
|
||||
FROM wms_order
|
||||
WHERE order_code = #{orderCode}
|
||||
AND del_flag = 0
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertWmsOrder" parameterType="com.klp.aps.domain.dto.ApsWmsOrderCreateReq">
|
||||
INSERT INTO wms_order
|
||||
(
|
||||
order_code,
|
||||
customer_id,
|
||||
customer_name,
|
||||
sales_manager,
|
||||
order_status,
|
||||
remark,
|
||||
tax_amount,
|
||||
no_tax_amount,
|
||||
del_flag,
|
||||
create_by,
|
||||
update_by
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{orderCode},
|
||||
#{customerId},
|
||||
#{customerName},
|
||||
#{salesManager},
|
||||
#{orderStatus},
|
||||
#{remark},
|
||||
#{taxAmount},
|
||||
#{noTaxAmount},
|
||||
0,
|
||||
#{createBy},
|
||||
#{updateBy}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertWmsOrderDetail" parameterType="com.klp.aps.domain.dto.ApsWmsOrderDetailCreateReq">
|
||||
INSERT INTO wms_order_detail
|
||||
(
|
||||
order_id,
|
||||
product_id,
|
||||
quantity,
|
||||
unit,
|
||||
remark,
|
||||
tax_price,
|
||||
no_tax_price,
|
||||
group_id,
|
||||
del_flag,
|
||||
create_by,
|
||||
update_by
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{orderId},
|
||||
#{productId},
|
||||
#{quantity},
|
||||
#{unit},
|
||||
#{remark},
|
||||
#{taxPrice},
|
||||
#{noTaxPrice},
|
||||
#{groupId},
|
||||
IFNULL(#{delFlag}, 0),
|
||||
#{createBy},
|
||||
#{updateBy}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<select id="selectAnyProductionLineId" resultType="long">
|
||||
SELECT line_id
|
||||
FROM wms_production_line
|
||||
WHERE del_flag = 0
|
||||
ORDER BY line_id ASC
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSchedulePlan"
|
||||
parameterType="com.klp.aps.domain.entity.ApsSchedulePlanEntity"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="planId"
|
||||
keyColumn="plan_id">
|
||||
INSERT INTO wms_schedule_plan
|
||||
(
|
||||
plan_code,
|
||||
version,
|
||||
order_id,
|
||||
status,
|
||||
remark,
|
||||
del_flag,
|
||||
create_by,
|
||||
update_by,
|
||||
priority,
|
||||
start_date,
|
||||
end_date
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{planCode},
|
||||
#{version},
|
||||
#{orderId},
|
||||
#{status},
|
||||
#{remark},
|
||||
#{delFlag},
|
||||
#{createBy},
|
||||
#{updateBy},
|
||||
#{priority},
|
||||
#{startDate},
|
||||
#{endDate}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertSchedulePlanDetail"
|
||||
parameterType="com.klp.aps.domain.entity.ApsSchedulePlanDetailEntity"
|
||||
useGeneratedKeys="true"
|
||||
keyProperty="detailId"
|
||||
keyColumn="detail_id">
|
||||
INSERT INTO wms_schedule_plan_detail
|
||||
(
|
||||
plan_id,
|
||||
line_id,
|
||||
task_id,
|
||||
product_id,
|
||||
quantity,
|
||||
start_date,
|
||||
end_date,
|
||||
remark,
|
||||
del_flag,
|
||||
create_by,
|
||||
update_by
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{planId},
|
||||
#{lineId},
|
||||
#{taskId},
|
||||
#{productId},
|
||||
#{quantity},
|
||||
#{startDate},
|
||||
#{endDate},
|
||||
#{remark},
|
||||
#{delFlag},
|
||||
#{createBy},
|
||||
#{updateBy}
|
||||
)
|
||||
</insert>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user