瀏覽代碼

生产工单bug

24282 1 年之前
父節點
當前提交
397416b3f5
共有 1 個文件被更改,包括 11 次插入1 次删除
  1. 11 1
      sd-wln/src/main/java/com/sd/wln/service/impl/WlnStatementOfAccountImpl.java

+ 11 - 1
sd-wln/src/main/java/com/sd/wln/service/impl/WlnStatementOfAccountImpl.java

@@ -136,6 +136,16 @@ public class WlnStatementOfAccountImpl implements WlnStatementOfAccount {
         orderService.updateBatchById(editOrderList);
 
         Date date = new Date();
+
+        Long userId;
+        try {
+            userId = SecurityUtils.getUserId();
+        } catch (Exception e) {
+            userId = -1L;
+        }
+
+        final Long finalUserId = userId;
+
         // 订单生产完成时,一键完成生产任务
         productionWorkOrderService.update(q -> q
                 .in(ProductionWorkOrder::getOrderId, orderIdList)
@@ -143,7 +153,7 @@ public class WlnStatementOfAccountImpl implements WlnStatementOfAccount {
                 .set(ProductionWorkOrder::getStatus, WorkOrderStatusEnum.PRODUCTION_COMPLETION.getKey())
                 .set(ProductionWorkOrder::getCompleteTime, date)
                 .set(BasePo::getUpdateTime, date)
-                .set(BasePo::getUpdateUser, SecurityUtils.getUserId()));
+                .set(BasePo::getUpdateUser, finalUserId));
 
         // 保存对账单
         if (!saveStatementOfAccountList.isEmpty()) {