fix: 完善日计划持久层状态约束
This commit is contained in:
@@ -107,19 +107,12 @@
|
||||
plan_date, material_id, material_code, material_name, material_spec,
|
||||
plan_qty, append_qty, stocked_qty, sleeved_qty, packing_info, sort_seq, weight,
|
||||
order_status, stocking_status, sleeving_status,
|
||||
previous_order_status, previous_stocking_status, previous_sleeving_status,
|
||||
order_start_time, order_end_time, stocking_start_time, stocking_complete_time,
|
||||
sleeving_start_time, sleeving_complete_time, version,
|
||||
creator, updater)
|
||||
version, creator, updater)
|
||||
VALUES
|
||||
(#{plan.dailyPlanId}, #{plan.planCode}, #{plan.sourceType}, #{plan.erpOrderCode}, #{plan.manualOrderCode},
|
||||
#{plan.planDate}, #{plan.materialId}, #{plan.materialCode}, #{plan.materialName}, #{plan.materialSpec},
|
||||
#{plan.planQty}, #{plan.appendQty}, #{plan.stockedQty}, #{plan.sleevedQty}, #{plan.packingInfo},
|
||||
#{plan.sortSeq}, #{plan.weight}, #{plan.orderStatus}, #{plan.stockingStatus}, #{plan.sleevingStatus},
|
||||
#{plan.previousOrderStatus}, #{plan.previousStockingStatus}, #{plan.previousSleevingStatus},
|
||||
#{plan.orderStartTime}, #{plan.orderEndTime}, #{plan.stockingStartTime}, #{plan.stockingCompleteTime},
|
||||
#{plan.sleevingStartTime}, #{plan.sleevingCompleteTime}, #{plan.version},
|
||||
#{plan.creator}, #{plan.updater})
|
||||
#{plan.planQty}, 0, 0, 0, #{plan.packingInfo}, #{plan.sortSeq}, #{plan.weight},
|
||||
0, 0, 0, 0, #{plan.creator}, #{plan.updater})
|
||||
</insert>
|
||||
|
||||
<update id="updateNotStartedPlan">
|
||||
@@ -143,6 +136,47 @@
|
||||
AND order_status = 0
|
||||
</update>
|
||||
|
||||
<update id="restoreOrderWithVersion">
|
||||
UPDATE lms_daily_plan
|
||||
SET order_status = previous_order_status,
|
||||
previous_order_status = NULL,
|
||||
updater = #{updater},
|
||||
version = version + 1
|
||||
WHERE daily_plan_id = #{dailyPlanId}
|
||||
AND version = #{version}
|
||||
AND deleted = b'0'
|
||||
AND order_status = 3
|
||||
AND previous_order_status IS NOT NULL
|
||||
</update>
|
||||
|
||||
<update id="restoreStockingWithVersion">
|
||||
UPDATE lms_daily_plan
|
||||
SET stocking_status = previous_stocking_status,
|
||||
previous_stocking_status = NULL,
|
||||
updater = #{updater},
|
||||
version = version + 1
|
||||
WHERE daily_plan_id = #{dailyPlanId}
|
||||
AND version = #{version}
|
||||
AND deleted = b'0'
|
||||
AND order_status = 1
|
||||
AND stocking_status = 3
|
||||
AND previous_stocking_status IS NOT NULL
|
||||
</update>
|
||||
|
||||
<update id="restoreSleevingWithVersion">
|
||||
UPDATE lms_daily_plan
|
||||
SET sleeving_status = previous_sleeving_status,
|
||||
previous_sleeving_status = NULL,
|
||||
updater = #{updater},
|
||||
version = version + 1
|
||||
WHERE daily_plan_id = #{dailyPlanId}
|
||||
AND version = #{version}
|
||||
AND deleted = b'0'
|
||||
AND order_status = 1
|
||||
AND sleeving_status = 3
|
||||
AND previous_sleeving_status IS NOT NULL
|
||||
</update>
|
||||
|
||||
<update id="updateStateWithVersion">
|
||||
UPDATE lms_daily_plan
|
||||
<set>
|
||||
@@ -195,6 +229,7 @@
|
||||
AND deleted = b'0'
|
||||
AND order_status = 1
|
||||
AND stocking_status = 1
|
||||
AND #{incrementQty} > 0
|
||||
AND stocked_qty + #{incrementQty} <= plan_qty + append_qty
|
||||
</update>
|
||||
|
||||
@@ -214,6 +249,7 @@
|
||||
AND deleted = b'0'
|
||||
AND order_status = 1
|
||||
AND sleeving_status = 1
|
||||
AND #{incrementQty} > 0
|
||||
AND sleeved_qty + #{incrementQty} <= plan_qty + append_qty
|
||||
</update>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user