优化
This commit is contained in:
@@ -211,6 +211,31 @@ public class SmartLoadingService {
|
||||
return view(repository.plan(planId), requireBooking(plan.getContainerBookingId()));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@BusinessAudit(event = "SMART_LOADING_WAREHOUSE_REMARK", resourceType = "LOADING_PLAN",
|
||||
resourceId = "#planId", description = "修改装柜仓库备注")
|
||||
public Plan updateWarehouseRemark(long planId, long itemId, WarehouseRemarkRequest request,
|
||||
long operatorId, String operatorName) {
|
||||
String operation = operation(request.operationId());
|
||||
String remark = trim(request.warehouseRemark());
|
||||
String requestHash = sha256("WAREHOUSE_REMARK|" + planId + '|' + itemId + '|'
|
||||
+ Objects.toString(remark, "") + '|' + request.expectedPlanVersion() + '|'
|
||||
+ request.expectedItemVersion());
|
||||
Plan replay = replay(operation, planId, "WAREHOUSE_REMARK", itemId, requestHash);
|
||||
if (replay != null) return replay;
|
||||
LoadingPlanEntity plan = editing(planId, request.expectedPlanVersion(), operatorId, operatorName);
|
||||
LoadingPlanItemEntity item = repository.item(planId, itemId);
|
||||
if (item == null) throw new BizException(ResultCode.NOT_FOUND, "装柜明细不存在");
|
||||
String before = json(values("warehouseRemark", item.getWarehouseRemark(), "version", item.getVersion()));
|
||||
if (repository.updateWarehouseRemark(planId, itemId, request.expectedPlanVersion(),
|
||||
request.expectedItemVersion(), remark, operatorId, operatorName) != 1) {
|
||||
throw conflict("装柜计划或明细已被其他人修改,请刷新后重试");
|
||||
}
|
||||
history(planId, itemId, "WAREHOUSE_REMARK", plan.getPlanStatus(), plan.getPlanStatus(), operation,
|
||||
before, json(values("warehouseRemark", remark, "requestHash", requestHash)), operatorId, operatorName);
|
||||
return view(repository.plan(planId), requireBooking(plan.getContainerBookingId()));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@BusinessAudit(event = "SMART_LOADING_ITEM_DELETE", resourceType = "LOADING_PLAN_ITEM",
|
||||
resourceId = "#itemId", description = "删除智能装柜明细")
|
||||
|
||||
Reference in New Issue
Block a user