yzc 1 год назад
Родитель
Сommit
a9441b6dff

+ 2 - 1
hx-mes/src/main/resources/mapper/report/ReportLossesDetailsMapper.xml

@@ -14,7 +14,8 @@
                rld.update_user,
                rld.update_time,
                po.`code`                  AS prodOrderCode,
-               GROUP_CONCAT(su.nick_name) AS respUserName
+               GROUP_CONCAT(su.nick_name) AS respUserName,
+               rld.repo_time
         FROM report_losses_details rld
                  LEFT JOIN production_order po ON rld.prod_order_id = po.id
                  LEFT JOIN sys_user su ON FIND_IN_SET(su.user_id, rld.resp_user_set)

+ 0 - 398
hx-sale/src/main/java/com/fjhx/sale/a-json/DeptPerfApi.json

@@ -1,398 +0,0 @@
-{
-  "openapi": "3.0.1",
-  "tags": [
-    {
-      "name": "部门绩效"
-    }
-  ],
-  "paths": {
-    "/deptPerf/list": {
-      "post": {
-        "summary": "列表",
-        "tags": [
-          "部门绩效"
-        ],
-        "requestBody": {
-          "content": {
-            "application/json": {
-              "schema": {
-                "type": null,
-                "required": null,
-                "title": null,
-                "properties": null,
-                "items": null
-              }
-            }
-          }
-        },
-        "responses": {
-          "200": {
-            "description": "成功",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "type": "object",
-                  "required": [
-                    "code",
-                    "success",
-                    "msg",
-                    "data"
-                  ],
-                  "title": null,
-                  "properties": {
-                    "code": {
-                      "type": "Integer",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    },
-                    "success": {
-                      "type": "boolean",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    },
-                    "msg": {
-                      "type": "string",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    },
-                    "data": {
-                      "type": "array",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": {
-                        "type": "object",
-                        "required": null,
-                        "title": null,
-                        "properties": {
-                          "id": {
-                            "type": "integer",
-                            "required": null,
-                            "title": "部门绩效",
-                            "properties": null,
-                            "items": null
-                          },
-                          "deptId": {
-                            "type": "integer",
-                            "required": null,
-                            "title": "部门id",
-                            "properties": null,
-                            "items": null
-                          },
-                          "groupId": {
-                            "type": "integer",
-                            "required": null,
-                            "title": "组id",
-                            "properties": null,
-                            "items": null
-                          },
-                          "year": {
-                            "type": "integer",
-                            "required": null,
-                            "title": "年份",
-                            "properties": null,
-                            "items": null
-                          },
-                          "january": {
-                            "type": "number",
-                            "required": null,
-                            "title": "一月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "february": {
-                            "type": "number",
-                            "required": null,
-                            "title": "二月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "march": {
-                            "type": "number",
-                            "required": null,
-                            "title": "三月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "april": {
-                            "type": "number",
-                            "required": null,
-                            "title": "四月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "may": {
-                            "type": "number",
-                            "required": null,
-                            "title": "五月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "june": {
-                            "type": "number",
-                            "required": null,
-                            "title": "六月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "july": {
-                            "type": "number",
-                            "required": null,
-                            "title": "七月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "august": {
-                            "type": "number",
-                            "required": null,
-                            "title": "八月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "september": {
-                            "type": "number",
-                            "required": null,
-                            "title": "九月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "october": {
-                            "type": "number",
-                            "required": null,
-                            "title": "十月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "november": {
-                            "type": "number",
-                            "required": null,
-                            "title": "十一月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "december": {
-                            "type": "number",
-                            "required": null,
-                            "title": "十二月",
-                            "properties": null,
-                            "items": null
-                          },
-                          "createTime": {
-                            "type": "string",
-                            "required": null,
-                            "title": "创建时间",
-                            "properties": null,
-                            "items": null
-                          },
-                          "updateTime": {
-                            "type": "string",
-                            "required": null,
-                            "title": "修改时间",
-                            "properties": null,
-                            "items": null
-                          }
-                        },
-                        "items": null
-                      }
-                    }
-                  },
-                  "items": null
-                }
-              }
-            }
-          }
-        }
-      }
-    },
-    "/deptPerf/edit": {
-      "post": {
-        "summary": "编辑",
-        "tags": [
-          "部门绩效"
-        ],
-        "requestBody": {
-          "content": {
-            "application/json": {
-              "schema": {
-                "type": "object",
-                "required": null,
-                "title": null,
-                "properties": {
-                  "id": {
-                    "type": "integer",
-                    "required": null,
-                    "title": "部门绩效",
-                    "properties": null,
-                    "items": null
-                  },
-                  "deptId": {
-                    "type": "integer",
-                    "required": null,
-                    "title": "部门id",
-                    "properties": null,
-                    "items": null
-                  },
-                  "groupId": {
-                    "type": "integer",
-                    "required": null,
-                    "title": "组id",
-                    "properties": null,
-                    "items": null
-                  },
-                  "year": {
-                    "type": "integer",
-                    "required": null,
-                    "title": "年份",
-                    "properties": null,
-                    "items": null
-                  },
-                  "january": {
-                    "type": "number",
-                    "required": null,
-                    "title": "一月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "february": {
-                    "type": "number",
-                    "required": null,
-                    "title": "二月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "march": {
-                    "type": "number",
-                    "required": null,
-                    "title": "三月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "april": {
-                    "type": "number",
-                    "required": null,
-                    "title": "四月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "may": {
-                    "type": "number",
-                    "required": null,
-                    "title": "五月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "june": {
-                    "type": "number",
-                    "required": null,
-                    "title": "六月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "july": {
-                    "type": "number",
-                    "required": null,
-                    "title": "七月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "august": {
-                    "type": "number",
-                    "required": null,
-                    "title": "八月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "september": {
-                    "type": "number",
-                    "required": null,
-                    "title": "九月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "october": {
-                    "type": "number",
-                    "required": null,
-                    "title": "十月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "november": {
-                    "type": "number",
-                    "required": null,
-                    "title": "十一月",
-                    "properties": null,
-                    "items": null
-                  },
-                  "december": {
-                    "type": "number",
-                    "required": null,
-                    "title": "十二月",
-                    "properties": null,
-                    "items": null
-                  }
-                },
-                "items": null
-              }
-            }
-          }
-        },
-        "responses": {
-          "200": {
-            "description": "成功",
-            "content": {
-              "application/json": {
-                "schema": {
-                  "type": "object",
-                  "required": [
-                    "code",
-                    "success",
-                    "msg",
-                    "data"
-                  ],
-                  "title": null,
-                  "properties": {
-                    "code": {
-                      "type": "Integer",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    },
-                    "success": {
-                      "type": "boolean",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    },
-                    "msg": {
-                      "type": "string",
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    },
-                    "data": {
-                      "type": null,
-                      "required": null,
-                      "title": null,
-                      "properties": null,
-                      "items": null
-                    }
-                  },
-                  "items": null
-                }
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}

+ 19 - 0
hx-sale/src/main/java/com/fjhx/sale/mapper/contract/ContractMapper.java

@@ -143,4 +143,23 @@ public interface ContractMapper extends BaseMapper<Contract> {
 
     List<ContractProductVo> getProductPriceInfo(@Param("ew") IWrapper<Object> wrapper);
 
+    /**
+     * 获取合同生产订单数
+     */
+    long getProductionOrderCount(@Param("ew") IWrapper<Object> wrapper);
+
+    /**
+     * 删除合同相关的生产订单
+     */
+    void removeProductionOrderByContractId(Long contractId);
+
+    /**
+     * 删除合同相关的生产任务
+     */
+    void removeProductionOrderDetailByContractId(Long contractId);
+
+    /**
+     * 删除合同相关的生产备料
+     */
+    void removeMaterialPreparationoByContractId(Long contractId);
 }

+ 13 - 1
hx-sale/src/main/java/com/fjhx/sale/service/contract/impl/ContractServiceImpl.java

@@ -213,6 +213,9 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
     private SubscribeDetailMapper subscribeDetailMapper;
     @Autowired
     private ContractProductBomMapper contractProductBomMapper;
+//
+//    @Autowired
+//    private ProduceOrderService produceOrderService;
 
     /**
      * 合同和样品单 下拉分页
@@ -1379,7 +1382,16 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract>
         );
 
         //作废生产相关数据 订单、排除、任务、备料
-
+        long count = baseMapper.getProductionOrderCount(IWrapper.getWrapper()
+                .in("po.produce_status", 1, 2)
+                .eq("po.contract_id", contract.getId())
+        );
+        if (count > 0) {
+            throw new ServiceException("该销售订单存在,生产中或生产完成的生产订单信息,禁止作废!");
+        }
+        baseMapper.removeProductionOrderByContractId(contract.getId());
+        baseMapper.removeProductionOrderDetailByContractId(contract.getId());
+        baseMapper.removeMaterialPreparationoByContractId(contract.getId());
     }
 
     @Override

+ 24 - 0
hx-sale/src/main/resources/mapper/contract/ContractMapper.xml

@@ -537,4 +537,28 @@
                  LEFT JOIN contract c ON cp.contract_id = c.id
             ${ew.customSqlSegment}
     </select>
+    <select id="getProductionOrderCount" resultType="java.lang.Long">
+        SELECT COUNT(1)
+        FROM production_order po
+            ${ew.customSqlSegment}
+    </select>
+
+    <delete id="removeProductionOrderByContractId">
+        --生产订单
+        DELETE
+        FROM production_order
+        WHERE contract_id = #{contractId};
+    </delete>
+    <delete id="removeProductionOrderDetailByContractId">
+        --生产任务
+        DELETE
+        FROM production_order_detail
+        WHERE contract_id = #{contractId};
+    </delete>
+    <delete id="removeMaterialPreparationoByContractId">
+        --备料
+        DELETE
+        FROM material_preparation
+        WHERE contract_id = #{contractId};
+    </delete>
 </mapper>