Browse Source

修改作废

ouyj 3 months ago
parent
commit
d2ce5ac5bd

+ 12 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtRepairOrderServiceImpl.java

@@ -418,8 +418,20 @@ public class GxtRepairOrderServiceImpl implements IGxtRepairOrderService
     @Transactional
     public int invalidateGxtRepairOrder(GxtRepairOrder gxtRepairOrder)
     {
+        GxtRepairOrderPerson repairOrderPerson = new GxtRepairOrderPerson();
+        repairOrderPerson.setOrderId(gxtRepairOrder.getId());
+        List<GxtRepairOrderPerson> repairOrderPersonList = gxtRepairOrderPersonMapper.selectGxtRepairOrderPersonList(repairOrderPerson);
+
+        // 检查列表中是否有任何GxtRepairOrderPerson的selfScore或者score有数据
+        for (GxtRepairOrderPerson person : repairOrderPersonList) {
+            if (person.getSelfScore() != null || person.getScore() != null) {
+                throw new ServiceException("工单中存在工分数据,无法进行作废操作");
+            }
+        }
+
         String nickName = SecurityUtils.getLoginUser().getUser().getNickName();
         GxtRepairOrder oldOrder = gxtRepairOrderMapper.selectGxtRepairOrderById(gxtRepairOrder.getId());
+
         gxtRepairOrder.setWorkOrderStatus("invalid");
         gxtRepairOrder.setUpdateBy(SecurityUtils.getUsername());
         gxtRepairOrder.setUpdateTime(DateUtils.getNowDate());

+ 12 - 0
ygtx-gxt/src/main/java/com/ygtx/gxt/service/impl/GxtWorkOrderServiceImpl.java

@@ -2183,12 +2183,24 @@ public class GxtWorkOrderServiceImpl implements IGxtWorkOrderService
     public int invalidateGxtWorkOrder(GxtWorkOrder gxtWorkOrder)
     {
         Long id = gxtWorkOrder.getId();
+
         GxtWorkOrder order = gxtWorkOrderMapper.selectGxtWorkOrderById(id);
         if (order == null)
         {
             throw new ServiceException("工单不存在");
         }
 
+        GxtWorkOrderPerson  workOrderPerson= new GxtWorkOrderPerson();
+        workOrderPerson.setOrderId(id);
+        List<GxtWorkOrderPerson> orderPersonList = gxtWorkOrderPersonMapper.selectGxtWorkOrderPersonList(workOrderPerson);
+
+        // 检查列表中是否有任何GxtWorkOrderPerson的selfScore或者score有数据
+        for (GxtWorkOrderPerson person : orderPersonList) {
+            if (person.getSelfScore() != null || person.getScore() != null) {
+                throw new ServiceException("工单中存在工分数据,无法进行作废操作");
+            }
+        }
+
         String oldStatus = order.getWorkOrderStatus();
 
         // 更新工单信息

+ 2 - 1
ygtx-ui/src/views/gxt/gxtOrder/index.vue

@@ -2816,7 +2816,8 @@ function submitInvalidate() {
         invalidateDialogVisible.value = false
         getList()
       }).catch(error => {
-        proxy.$modal.msgError("作废失败:" + (error?.response?.data?.msg || "未知错误"))
+        //proxy.$modal.msgError("作废失败:" + (error?.response?.data?.msg || "未知错误"))
+        console.log("操作失败: " + error.message);
       })
     }
   })

+ 2 - 1
ygtx-ui/src/views/gxt/repairOrder/index.vue

@@ -3934,7 +3934,8 @@ async function submitInvalidate() {
       resetTimeOutOrder();
       getList();
     } catch (error) {
-      proxy.$modal.msgError("操作失败: " + error.message);
+      //proxy.$modal.msgError("操作失败: " + error.message);
+      console.log("操作失败: " + error.message);
     }
   });
 }