fix: 完善日计划持久层状态约束
This commit is contained in:
@@ -67,7 +67,7 @@ public interface DailyPlanMapper extends BaseMapperX<DailyPlanDO> {
|
|||||||
List<DailyPlanDO> selectSleevingCandidates();
|
List<DailyPlanDO> selectSleevingCandidates();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增日计划。
|
* 新增初始状态的日计划,数量、状态和版本由 SQL 固定为零。
|
||||||
*/
|
*/
|
||||||
int insertDailyPlan(@Param("plan") DailyPlanDO plan);
|
int insertDailyPlan(@Param("plan") DailyPlanDO plan);
|
||||||
|
|
||||||
@@ -83,6 +83,27 @@ public interface DailyPlanMapper extends BaseMapperX<DailyPlanDO> {
|
|||||||
*/
|
*/
|
||||||
int updateStateWithVersion(@Param("plan") DailyPlanDO plan);
|
int updateStateWithVersion(@Param("plan") DailyPlanDO plan);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁恢复已取消的订单状态,并清空前一订单状态。
|
||||||
|
*/
|
||||||
|
int restoreOrderWithVersion(@Param("dailyPlanId") Long dailyPlanId,
|
||||||
|
@Param("version") Integer version,
|
||||||
|
@Param("updater") String updater);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁恢复已取消的备货状态,并清空前一备货状态。
|
||||||
|
*/
|
||||||
|
int restoreStockingWithVersion(@Param("dailyPlanId") Long dailyPlanId,
|
||||||
|
@Param("version") Integer version,
|
||||||
|
@Param("updater") String updater);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乐观锁恢复已取消的套管状态,并清空前一套管状态。
|
||||||
|
*/
|
||||||
|
int restoreSleevingWithVersion(@Param("dailyPlanId") Long dailyPlanId,
|
||||||
|
@Param("version") Integer version,
|
||||||
|
@Param("updater") String updater);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 乐观锁更新排序序号。
|
* 乐观锁更新排序序号。
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import java.util.List;
|
|||||||
public interface DailyPlanOperationLogMapper extends BaseMapperX<DailyPlanOperationLogDO> {
|
public interface DailyPlanOperationLogMapper extends BaseMapperX<DailyPlanOperationLogDO> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增操作日志;自定义新增不会生成主键,调用方必须预先设置 operationLogId。
|
* 新增操作日志;自定义新增不会生成主键,调用方必须预先设置 operationLogId,操作时间使用数据库当前时间。
|
||||||
*/
|
*/
|
||||||
int insertOperationLog(@Param("operationLog") DailyPlanOperationLogDO operationLog);
|
int insertOperationLog(@Param("operationLog") DailyPlanOperationLogDO operationLog);
|
||||||
|
|
||||||
|
|||||||
@@ -107,19 +107,12 @@
|
|||||||
plan_date, material_id, material_code, material_name, material_spec,
|
plan_date, material_id, material_code, material_name, material_spec,
|
||||||
plan_qty, append_qty, stocked_qty, sleeved_qty, packing_info, sort_seq, weight,
|
plan_qty, append_qty, stocked_qty, sleeved_qty, packing_info, sort_seq, weight,
|
||||||
order_status, stocking_status, sleeving_status,
|
order_status, stocking_status, sleeving_status,
|
||||||
previous_order_status, previous_stocking_status, previous_sleeving_status,
|
version, creator, updater)
|
||||||
order_start_time, order_end_time, stocking_start_time, stocking_complete_time,
|
|
||||||
sleeving_start_time, sleeving_complete_time, version,
|
|
||||||
creator, updater)
|
|
||||||
VALUES
|
VALUES
|
||||||
(#{plan.dailyPlanId}, #{plan.planCode}, #{plan.sourceType}, #{plan.erpOrderCode}, #{plan.manualOrderCode},
|
(#{plan.dailyPlanId}, #{plan.planCode}, #{plan.sourceType}, #{plan.erpOrderCode}, #{plan.manualOrderCode},
|
||||||
#{plan.planDate}, #{plan.materialId}, #{plan.materialCode}, #{plan.materialName}, #{plan.materialSpec},
|
#{plan.planDate}, #{plan.materialId}, #{plan.materialCode}, #{plan.materialName}, #{plan.materialSpec},
|
||||||
#{plan.planQty}, #{plan.appendQty}, #{plan.stockedQty}, #{plan.sleevedQty}, #{plan.packingInfo},
|
#{plan.planQty}, 0, 0, 0, #{plan.packingInfo}, #{plan.sortSeq}, #{plan.weight},
|
||||||
#{plan.sortSeq}, #{plan.weight}, #{plan.orderStatus}, #{plan.stockingStatus}, #{plan.sleevingStatus},
|
0, 0, 0, 0, #{plan.creator}, #{plan.updater})
|
||||||
#{plan.previousOrderStatus}, #{plan.previousStockingStatus}, #{plan.previousSleevingStatus},
|
|
||||||
#{plan.orderStartTime}, #{plan.orderEndTime}, #{plan.stockingStartTime}, #{plan.stockingCompleteTime},
|
|
||||||
#{plan.sleevingStartTime}, #{plan.sleevingCompleteTime}, #{plan.version},
|
|
||||||
#{plan.creator}, #{plan.updater})
|
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<update id="updateNotStartedPlan">
|
<update id="updateNotStartedPlan">
|
||||||
@@ -143,6 +136,47 @@
|
|||||||
AND order_status = 0
|
AND order_status = 0
|
||||||
</update>
|
</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 id="updateStateWithVersion">
|
||||||
UPDATE lms_daily_plan
|
UPDATE lms_daily_plan
|
||||||
<set>
|
<set>
|
||||||
@@ -195,6 +229,7 @@
|
|||||||
AND deleted = b'0'
|
AND deleted = b'0'
|
||||||
AND order_status = 1
|
AND order_status = 1
|
||||||
AND stocking_status = 1
|
AND stocking_status = 1
|
||||||
|
AND #{incrementQty} > 0
|
||||||
AND stocked_qty + #{incrementQty} <= plan_qty + append_qty
|
AND stocked_qty + #{incrementQty} <= plan_qty + append_qty
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
@@ -214,6 +249,7 @@
|
|||||||
AND deleted = b'0'
|
AND deleted = b'0'
|
||||||
AND order_status = 1
|
AND order_status = 1
|
||||||
AND sleeving_status = 1
|
AND sleeving_status = 1
|
||||||
|
AND #{incrementQty} > 0
|
||||||
AND sleeved_qty + #{incrementQty} <= plan_qty + append_qty
|
AND sleeved_qty + #{incrementQty} <= plan_qty + append_qty
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
INSERT INTO lms_daily_plan_operation_log
|
INSERT INTO lms_daily_plan_operation_log
|
||||||
(operation_log_id, daily_plan_id, operation_target, operation_type,
|
(operation_log_id, daily_plan_id, operation_target, operation_type,
|
||||||
before_value, after_value, change_qty, operation_reason,
|
before_value, after_value, change_qty, operation_reason,
|
||||||
operator, operation_time)
|
operator)
|
||||||
VALUES
|
VALUES
|
||||||
(#{operationLog.operationLogId}, #{operationLog.dailyPlanId},
|
(#{operationLog.operationLogId}, #{operationLog.dailyPlanId},
|
||||||
#{operationLog.operationTarget}, #{operationLog.operationType},
|
#{operationLog.operationTarget}, #{operationLog.operationType},
|
||||||
#{operationLog.beforeValue}, #{operationLog.afterValue},
|
#{operationLog.beforeValue}, #{operationLog.afterValue},
|
||||||
#{operationLog.changeQty}, #{operationLog.operationReason},
|
#{operationLog.changeQty}, #{operationLog.operationReason},
|
||||||
#{operationLog.operator}, #{operationLog.operationTime})
|
#{operationLog.operator})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<select id="selectListByDailyPlanId"
|
<select id="selectListByDailyPlanId"
|
||||||
|
|||||||
Reference in New Issue
Block a user