2 Commit-ok 3d1b8c3921 ... 3286e9aa56

Szerző SHA1 Üzenet Dátum
  wanghongzhi 3286e9aa56 Merge branch 'master' of http://git.qdeasydo.com/wanghongzhi/easydo-mes-server 1 hónapja
  wanghongzhi e9a963ace5 init 1 hónapja
20 módosított fájl, 1169 hozzáadás és 44 törlés
  1. 0 1
      easydo-core/src/main/java/easydo/technology/model/CommonModel.java
  2. 124 0
      easydo-mes/src/main/java/easydo/technology/controller/CustomerController.java
  3. 28 9
      easydo-mes/src/main/java/easydo/technology/controller/ProcessRouteController.java
  4. 23 5
      easydo-mes/src/main/java/easydo/technology/controller/ProcessStageController.java
  5. 205 0
      easydo-mes/src/main/java/easydo/technology/controller/ProductBomController.java
  6. 141 0
      easydo-mes/src/main/java/easydo/technology/controller/ProductMaterialController.java
  7. 117 0
      easydo-mes/src/main/java/easydo/technology/controller/QualityInspectProgramController.java
  8. 175 0
      easydo-mes/src/main/java/easydo/technology/controller/SaleOrderController.java
  9. 126 0
      easydo-mes/src/main/java/easydo/technology/controller/SalePlanController.java
  10. 37 5
      easydo-mes/src/main/java/easydo/technology/enums/MESEnum.java
  11. 23 0
      easydo-mes/src/main/java/easydo/technology/model/Customer.java
  12. 1 0
      easydo-mes/src/main/java/easydo/technology/model/ProcessRoute.java
  13. 20 9
      easydo-mes/src/main/java/easydo/technology/model/ProductBom.java
  14. 0 12
      easydo-mes/src/main/java/easydo/technology/model/ProductBomDetail.java
  15. 25 0
      easydo-mes/src/main/java/easydo/technology/model/ProductMaterial.java
  16. 30 0
      easydo-mes/src/main/java/easydo/technology/model/QualityInspectProgram.java
  17. 39 0
      easydo-mes/src/main/java/easydo/technology/model/SaleOrder.java
  18. 19 0
      easydo-mes/src/main/java/easydo/technology/model/SaleOrderDetail.java
  19. 21 0
      easydo-mes/src/main/java/easydo/technology/model/SalePlan.java
  20. 15 3
      easydo-mes/src/main/java/easydo/technology/service/FlowNoService.java

+ 0 - 1
easydo-core/src/main/java/easydo/technology/model/CommonModel.java

@@ -1,6 +1,5 @@
 package easydo.technology.model;
 
-import easydo.technology.annotation.NotTableField;
 import lombok.Data;
 
 import java.util.ArrayList;

+ 124 - 0
easydo-mes/src/main/java/easydo/technology/controller/CustomerController.java

@@ -0,0 +1,124 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.Customer;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/customer")
+public class CustomerController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<Customer> list = jdbcClient.getJdbcList(map, Customer.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, Customer.class, connection);
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/save")
+    public Object save(@RequestBody Customer model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            model.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
+            generateCode(model, connection);
+            jdbcClient.jdbcInsert(model, connection);
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody Customer model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody Customer model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            jdbcClient.jdbcRemoveById(model, connection);
+
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    private synchronized void generateCode(Customer model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_CUSTOMER.getValue(), connection);
+                Customer param = new Customer();
+                param.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(param, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            Customer param = new Customer();
+            param.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(param, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+
+}

+ 28 - 9
easydo-mes/src/main/java/easydo/technology/controller/ProcessRouteController.java

@@ -81,11 +81,9 @@ public class ProcessRouteController {
         try {
             connection.setAutoCommit(false);
             model.setCreateId(SecurityUtils.getCurrentUserId());
-            if (StringUtil.isEmpty(model.getCode())) {
-                model.setCode(flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_ROUTE.getValue(), connection));
-            }
+            generateCode(model, connection);
             model.setParentId("0");
-            model.setStatus(MESEnum.PROCESS_ROUTE_OF_STATUS_ENABLE.getValue());
+            model.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
             jdbcClient.jdbcInsert(model, connection);
 
             List<ProcessRouteDetail> detailList = model.getDetailList();
@@ -173,7 +171,7 @@ public class ProcessRouteController {
             ProcessRoute existRoute = new ProcessRoute();
             existRoute.setId(model.getId());
             existRoute.setParentId(newId);
-            existRoute.setStatus(MESEnum.PROCESS_ROUTE_OF_STATUS_DISABLE.getValue());
+            existRoute.setStatus(MESEnum.PROCESS_OF_STATUS_DISABLE.getValue());
             jdbcClient.jdbcUpdateById(existRoute, connection);
 
             ProcessRoute childrenRoute = new ProcessRoute();
@@ -183,12 +181,10 @@ public class ProcessRouteController {
             jdbcClient.jdbcUpdate(childrenRoute, paramMap, connection);
 
             model.setCreateId(SecurityUtils.getCurrentUserId());
-            if (StringUtil.isEmpty(model.getCode())) {
-                model.setCode(flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_ROUTE.getValue(), connection));
-            }
+            generateCode(model,connection);
             model.setParentId("0");
             model.setId(newId);
-            model.setStatus(MESEnum.PROCESS_ROUTE_OF_STATUS_ENABLE.getValue());
+            model.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
             jdbcClient.jdbcInsert(model, connection);
 
             List<ProcessRouteDetail> detailList = model.getDetailList();
@@ -218,6 +214,7 @@ public class ProcessRouteController {
                 childrenList = childrenList.stream().sorted(Comparator.comparing(ProcessRoute::getCreateTime).reversed()).collect(Collectors.toList());
                 ProcessRoute child = childrenList.get(0);
                 child.setParentId("0");
+                child.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
                 jdbcClient.jdbcUpdateById(child, connection);
 
                 ProcessRoute childrenRoute = new ProcessRoute();
@@ -242,4 +239,26 @@ public class ProcessRouteController {
         }
     }
 
+    private synchronized void generateCode(ProcessRoute model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_ROUTE.getValue(), connection);
+                ProcessRoute processRouteParam = new ProcessRoute();
+                processRouteParam.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(processRouteParam, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            ProcessRoute processRouteParam = new ProcessRoute();
+            processRouteParam.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(processRouteParam, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+
 }

+ 23 - 5
easydo-mes/src/main/java/easydo/technology/controller/ProcessStageController.java

@@ -58,11 +58,9 @@ public class ProcessStageController {
         Connection connection = dataSource.getConnection();
         try {
             connection.setAutoCommit(false);
-            model.setStatus(MESEnum.PROCESS_STAGE_OF_STATUS_ENABLE.getValue());
+            model.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
             model.setCreateId(SecurityUtils.getCurrentUserId());
-            if (StringUtil.isEmpty(model.getCode())) {
-                model.setCode(flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_MANAGE.getValue(), connection));
-            }
+            generateCode(model, connection);
             jdbcClient.jdbcInsert(model, connection);
             connection.commit();
             return new ResponseEntity<>(model, HttpStatus.OK);
@@ -87,5 +85,25 @@ public class ProcessStageController {
         return new ResponseEntity<>(HttpStatus.OK);
     }
 
-
+    private synchronized void generateCode(ProcessStage model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PROCESS_STAGE.getValue(), connection);
+                ProcessStage processStageParam = new ProcessStage();
+                processStageParam.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(processStageParam, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            ProcessStage processStageParam = new ProcessStage();
+            processStageParam.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(processStageParam, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
 }

+ 205 - 0
easydo-mes/src/main/java/easydo/technology/controller/ProductBomController.java

@@ -0,0 +1,205 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.ProductBom;
+import easydo.technology.model.ProductMaterial;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/processBom")
+public class ProductBomController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, ProductBom.class, connection);
+            List<ProductBom> records = (List<ProductBom>) recordsPage.get("records");
+            for (ProductBom model : records) {
+                ProductMaterial material = new ProductMaterial();
+                material.setCode(model.getMaterialCode());
+                material = jdbcClient.getJdbcModel(material, connection);
+                model.setMaterial(material);
+
+                ProductBom param = new ProductBom();
+                param.setParentId(model.getId());
+                int count = jdbcClient.getJdbcCount(param, connection);
+                if (count > 0) {
+                    model.setIsHaveChildren(true);
+                }
+            }
+
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/getChildrenList")
+    public Object getChildrenList(@RequestBody ProductBom model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            ProductBom detail = new ProductBom();
+            detail.setParentId(model.getId());
+            List<ProductBom> detailList = jdbcClient.getJdbcList(detail, connection);
+            model.setChildrenList(detailList);
+
+            for (ProductBom bomDetail : detailList) {
+                ProductMaterial material = new ProductMaterial();
+                material.setCode(bomDetail.getMaterialCode());
+                material = jdbcClient.getJdbcModel(material, connection);
+                bomDetail.setMaterial(material);
+
+                ProductBom param = new ProductBom();
+                param.setParentId(bomDetail.getId());
+                int count = jdbcClient.getJdbcCount(param, connection);
+                if (count > 0) {
+                    bomDetail.setIsHaveChildren(true);
+                }
+            }
+            return new ResponseEntity<>(detailList, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object save(@RequestBody ProductBom model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            List<ProductBom> bomList = model.getChildrenList();
+            if (bomList.isEmpty()) {
+                return new ResponseEntity<>(model, HttpStatus.OK);
+            }
+            model.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
+            if (StringUtil.isEmpty(model.getId())) {
+                generateCode(model, connection);
+                jdbcClient.jdbcInsert(model, connection);
+            }
+
+            for (ProductBom bom : bomList) {
+                bom.setParentId(model.getId());
+                jdbcClient.jdbcInsert(bom, connection);
+            }
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody ProductBom model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            List<ProductBom> bomList = model.getChildrenList();
+            if (bomList.isEmpty()) {
+                connection.commit();
+                return new ResponseEntity<>(model, HttpStatus.OK);
+            }
+            ProductBom param = new ProductBom();
+            param.setParentId(model.getId());
+            List<ProductBom> existList = jdbcClient.getJdbcList(param, connection);
+            List<String> removeIdList = existList.stream().map(ProductBom::getId).collect(Collectors.toList());
+
+            List<ProductBom> insertList = bomList.stream().filter(item -> StringUtil.isEmpty(item.getId())).collect(Collectors.toList());
+            List<ProductBom> updateList = bomList.stream().filter(item -> StringUtil.isNotEmpty(item.getId())).collect(Collectors.toList());
+            List<String> updateIdList = updateList.stream().map(ProductBom::getId).collect(Collectors.toList());
+            removeIdList.removeAll(updateIdList);
+
+            for (ProductBom bom : insertList) {
+                bom.setParentId(model.getId());
+                jdbcClient.jdbcInsert(bom, connection);
+            }
+            for (ProductBom bom : updateList) {
+                jdbcClient.jdbcUpdateById(bom, connection);
+            }
+            for (String id : removeIdList) {
+                ProductBom bom = new ProductBom();
+                bom.setId(id);
+                jdbcClient.jdbcRemoveById(bom, connection);
+            }
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object remove(@RequestBody ProductBom model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            jdbcClient.jdbcRemoveById(model, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    private synchronized void generateCode(ProductBom model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getBomCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PRODUCT_BOM.getValue(), connection);
+                ProductBom processBomParam = new ProductBom();
+                processBomParam.setBomCode(flowNo);
+                int count = jdbcClient.getJdbcCount(processBomParam, connection);
+                if (count == 0) {
+                    model.setBomCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            ProductBom processBomParam = new ProductBom();
+            processBomParam.setBomCode(model.getBomCode());
+            int count = jdbcClient.getJdbcCount(processBomParam, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+}

+ 141 - 0
easydo-mes/src/main/java/easydo/technology/controller/ProductMaterialController.java

@@ -0,0 +1,141 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.ProductBom;
+import easydo.technology.model.ProductMaterial;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.utils.SecurityUtils;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/processMaterial")
+public class ProductMaterialController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<ProductMaterial> list = jdbcClient.getJdbcList(map, ProductMaterial.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, ProductMaterial.class, connection);
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/save")
+    public Object save(@RequestBody ProductMaterial model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            model.setStatus(MESEnum.PROCESS_OF_STATUS_ENABLE.getValue());
+            model.setCreateId(SecurityUtils.getCurrentUserId());
+            generateCode(model, connection);
+            jdbcClient.jdbcInsert(model, connection);
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody ProductMaterial model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            Map<String, Object> paramMap = new HashMap<>();
+            paramMap.put("materialCode", model.getCode());
+            ProductBom bom = new ProductBom();
+            bom.setMaterialName(model.getName());
+            jdbcClient.jdbcUpdate(bom, paramMap, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody ProductMaterial model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+
+            model = jdbcClient.getJdbcModelById(model, connection);
+            ProductBom bom = new ProductBom();
+            bom.setMaterialCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(bom, connection);
+            if (count > 0) {
+                throw new BizException("该物料在bom管理中存在,无法删除");
+            }
+
+            jdbcClient.jdbcRemoveById(model, connection);
+
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    private synchronized void generateCode(ProductMaterial model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_PRODUCT_MATERIAL.getValue(), connection);
+                ProductMaterial productMaterialParam = new ProductMaterial();
+                productMaterialParam.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(productMaterialParam, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            ProductMaterial productMaterialParam = new ProductMaterial();
+            productMaterialParam.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(productMaterialParam, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+}

+ 117 - 0
easydo-mes/src/main/java/easydo/technology/controller/QualityInspectProgramController.java

@@ -0,0 +1,117 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.QualityInspectProgram;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.system.model.SysUser;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/qualityInspectProgram")
+public class QualityInspectProgramController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<QualityInspectProgram> list = jdbcClient.getJdbcList(map, QualityInspectProgram.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, QualityInspectProgram.class, connection);
+            List<QualityInspectProgram> records = (List<QualityInspectProgram>) recordsPage.get("records");
+            for (QualityInspectProgram model : records) {
+                jdbcClient.getMinioFile(model, connection);
+
+                SysUser inspectUser = new SysUser();
+                inspectUser.setId(model.getInspectUserId());
+                inspectUser = jdbcClient.getJdbcModelById(inspectUser,connection);
+                model.setInspectUserName(inspectUser.getNickName());
+
+                SysUser reviewUser = new SysUser();
+                reviewUser.setId(model.getReviewUserId());
+                reviewUser = jdbcClient.getJdbcModelById(reviewUser, connection);
+                model.setReviewUserName(reviewUser.getNickName());
+            }
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/save")
+    public Object add(@RequestBody QualityInspectProgram model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            generateCode(model, connection);
+            jdbcClient.jdbcInsert(model, connection);
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody QualityInspectProgram model) throws Exception {
+        jdbcClient.jdbcUpdateById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object remove(@RequestBody QualityInspectProgram model) throws Exception {
+        jdbcClient.jdbcRemoveById(model);
+        return new ResponseEntity<>(HttpStatus.OK);
+    }
+
+    private synchronized void generateCode(QualityInspectProgram model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_QUALITY_INSPECT_PROGRAM.getValue(), connection);
+                QualityInspectProgram param = new QualityInspectProgram();
+                param.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(param, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            QualityInspectProgram param = new QualityInspectProgram();
+            param.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(param, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+}

+ 175 - 0
easydo-mes/src/main/java/easydo/technology/controller/SaleOrderController.java

@@ -0,0 +1,175 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.Customer;
+import easydo.technology.model.ProductMaterial;
+import easydo.technology.model.SaleOrder;
+import easydo.technology.model.SaleOrderDetail;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.system.model.SysUser;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/saleOrder")
+public class SaleOrderController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, SaleOrder.class, connection);
+            List<SaleOrder> records = (List<SaleOrder>) recordsPage.get("records");
+            for (SaleOrder model : records) {
+                SaleOrderDetail detailParam = new SaleOrderDetail();
+                detailParam.setOrderId(model.getId());
+                List<SaleOrderDetail> childrenList = jdbcClient.getJdbcList(detailParam, connection);
+
+                for (SaleOrderDetail detail : childrenList) {
+                    ProductMaterial material = new ProductMaterial();
+                    material.setCode(detail.getMaterialCode());
+                    material = jdbcClient.getJdbcModel(material, connection);
+                    detail.setMaterial(material);
+                }
+                model.setChildrenList(childrenList);
+
+                if (StringUtil.isNotEmpty(model.getManagerId())) {
+                    SysUser user = new SysUser();
+                    user.setId(model.getManagerId());
+                    user = jdbcClient.getJdbcModelById(user, connection);
+                    model.setManagerName(user.getNickName());
+                }
+
+                Customer customer = new Customer();
+                customer.setId(model.getCustomerId());
+                customer = jdbcClient.getJdbcModelById(customer, connection);
+                model.setCustomerName(customer.getName());
+
+                jdbcClient.getMinioFile(model, connection);
+
+            }
+
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/save")
+    public Object save(@RequestBody SaleOrder model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            generateCode(model, connection);
+            model.setStatus(MESEnum.SALE_ORDER_OF_STATUS_PENDING.getValue());
+            jdbcClient.jdbcInsert(model, connection);
+
+            List<SaleOrderDetail> childrenList = model.getChildrenList();
+            for (SaleOrderDetail detail : childrenList) {
+                detail.setOrderId(model.getId());
+                jdbcClient.jdbcInsert(detail, connection);
+            }
+
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SaleOrder model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            List<SaleOrderDetail> childrenList = model.getChildrenList();
+            if (null != childrenList && !childrenList.isEmpty()) {
+                SaleOrderDetail detailParam = new SaleOrderDetail();
+                detailParam.setOrderId(model.getId());
+                jdbcClient.jdbcRemove(detailParam, connection);
+
+                for (SaleOrderDetail detail : childrenList) {
+                    detail.setOrderId(model.getId());
+                    jdbcClient.jdbcInsert(detail, connection);
+                }
+            }
+
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SaleOrder model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            jdbcClient.jdbcRemoveById(model, connection);
+
+            SaleOrderDetail detailParam = new SaleOrderDetail();
+            detailParam.setOrderId(model.getId());
+            jdbcClient.jdbcRemove(detailParam, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    private synchronized void generateCode(SaleOrder model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_SALE_ORDER.getValue(), connection);
+                SaleOrder param = new SaleOrder();
+                param.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(param, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            SaleOrder param = new SaleOrder();
+            param.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(param, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+}

+ 126 - 0
easydo-mes/src/main/java/easydo/technology/controller/SalePlanController.java

@@ -0,0 +1,126 @@
+package easydo.technology.controller;
+
+import easydo.technology.components.JdbcClient;
+import easydo.technology.enums.MESEnum;
+import easydo.technology.exception.BizException;
+import easydo.technology.model.SalePlan;
+import easydo.technology.service.FlowNoService;
+import easydo.technology.utils.StringUtil;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import javax.sql.DataSource;
+import java.sql.Connection;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@RequestMapping("/salePlan")
+public class SalePlanController {
+    @Resource
+    JdbcClient jdbcClient;
+    @Resource
+    DataSource dataSource;
+    @Resource
+    FlowNoService flowNoService;
+
+
+    @RequestMapping(value = "/getList")
+    public Object getList(@RequestBody Map<String, Object> map) throws Exception {
+        List<SalePlan> list = jdbcClient.getJdbcList(map, SalePlan.class);
+        return new ResponseEntity<>(list, HttpStatus.OK);
+    }
+
+    @RequestMapping(value = "/getPage")
+    public Object getPage(@RequestBody Map<String, Object> map) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            Map<String, Object> recordsPage = jdbcClient.getJdbcPage(map, SalePlan.class, connection);
+            List<SalePlan> records = (List<SalePlan>) recordsPage.get("records");
+
+            return new ResponseEntity<>(recordsPage, HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/save")
+    public Object save(@RequestBody SalePlan model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+            generateCode(model, connection);
+            jdbcClient.jdbcInsert(model, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(model, HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/update")
+    public Object update(@RequestBody SalePlan model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+            connection.setAutoCommit(false);
+
+            jdbcClient.jdbcUpdateById(model, connection);
+
+            connection.commit();
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            connection.rollback();
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+    @RequestMapping(value = "/remove")
+    public Object deleteProgram(@RequestBody SalePlan model) throws Exception {
+        Connection connection = dataSource.getConnection();
+        try {
+
+            jdbcClient.jdbcRemoveById(model, connection);
+
+            return new ResponseEntity<>(HttpStatus.OK);
+        } catch (Exception e) {
+            throw new BizException(e.getMessage());
+        } finally {
+            connection.close();
+        }
+    }
+
+
+    private synchronized void generateCode(SalePlan model, Connection connection) throws Exception {
+        if (StringUtil.isEmpty(model.getCode())) {
+            while (true) {
+                String flowNo = flowNoService.getFlowNo(MESEnum.FLOW_NO_TYPE_SALE_PLAN.getValue(), connection);
+                SalePlan param = new SalePlan();
+                param.setCode(flowNo);
+                int count = jdbcClient.getJdbcCount(param, connection);
+                if (count == 0) {
+                    model.setCode(flowNo);
+                    break;
+                }
+            }
+        } else {
+            SalePlan param = new SalePlan();
+            param.setCode(model.getCode());
+            int count = jdbcClient.getJdbcCount(param, connection);
+            if (count > 0) {
+                throw new BizException("编号已存在,请重新填写");
+            }
+        }
+    }
+}

+ 37 - 5
easydo-mes/src/main/java/easydo/technology/enums/MESEnum.java

@@ -5,8 +5,16 @@ import java.util.Map;
 
 public enum MESEnum {
 
-    FLOW_NO_TYPE_PROCESS_MANAGE("process_manage", "工序管理"),
+    FLOW_NO_TYPE_PROCESS_STAGE("process_stage", "工序管理"),
     FLOW_NO_TYPE_PROCESS_ROUTE("process_route", "工艺路线"),
+    FLOW_NO_TYPE_PRODUCT_MATERIAL("product_material", "物料管理"),
+    FLOW_NO_TYPE_PRODUCT_BOM("product_bom", "bom清单"),
+    FLOW_NO_TYPE_QUALITY_INSPECT_TOOL("quality_inspect_tool", "质检工具"),
+    FLOW_NO_TYPE_QUALITY_INSPECT_FUNCTION("quality_inspect_function", "质检方法"),
+    FLOW_NO_TYPE_QUALITY_INSPECT_PROGRAM("quality_inspect_program", "质检方案"),
+    FLOW_NO_TYPE_CUSTOMER("customer", "供应商/客户"),
+    FLOW_NO_TYPE_SALE_PLAN("sale_plan", "销售计划"),
+    FLOW_NO_TYPE_SALE_ORDER("sale_order", "销售订单"),
 
     PROCESS_STAGE_OF_CATEGORY_PREPARATION("preparation","准备工序"),
     PROCESS_STAGE_OF_CATEGORY_PROCESSING("processing","加工工序"),
@@ -21,11 +29,35 @@ public enum MESEnum {
     PROCESS_STAGE_OF_CALCULATE_METHOD_TIME_RATE("time_rate","计时"),
     PROCESS_STAGE_OF_CALCULATE_METHOD_NON_PROD_PAY("non_prod_pay","不计生产工资"),
 
-    PROCESS_STAGE_OF_STATUS_ENABLE("enable","启用"),
-    PROCESS_STAGE_OF_STATUS_DISABLE("disable","停用"),
+    PROCESS_OF_STATUS_ENABLE("enable","启用"),
+    PROCESS_OF_STATUS_DISABLE("disable","停用"),
 
-    PROCESS_ROUTE_OF_STATUS_ENABLE("enable", "启用"),
-    PROCESS_ROUTE_OF_STATUS_DISABLE("disable", "停用"),
+    PRODUCT_MATERIAL_OF_NEED_TYPE_SELF_MADE("self_made", "自制"),
+    PRODUCT_MATERIAL_OF_NEED_TYPE_OUT_PURCHASE("out_purchase", "外采"),
+    PRODUCT_MATERIAL_OF_NEED_TYPE_OUTSOURCING("outsourcing", "委外"),
+
+    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_RAW_MATERIAL("raw_material", "原材料"),
+    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_SEMI_FINISHED("semi_finished", "半成品"),
+    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_FINISHED_PRODUCT("finished_product", "半成品"),
+    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_PACKAGING_MATERIAL("packaging_material", "包装材料"),
+    PRODUCT_MATERIAL_OF_MATERIAL_TYPE_TRADE_GOODS("trade_goods", "贸易品"),
+
+    QUALITY_INSPECT_PROGRAM_OF_STATUS_PENDING("pending", "待审批"),
+    QUALITY_INSPECT_PROGRAM_OF_STATUS_APPROVED("approved", "同意"),
+    QUALITY_INSPECT_PROGRAM_OF_STATUS_REJECTED("rejected", "拒绝"),
+
+    QUALITY_INSPECT_PROGRAM_OF_TYPE_FULL("full", "全检"),
+    QUALITY_INSPECT_PROGRAM_OF_TYPE_SAMPLING("sampling", "抽检"),
+
+    SALE_PLAN_OF_STATUS_INACTIVE("inactive","待进行"),
+    SALE_PLAN_OF_STATUS_ACTIVE("active","进行中"),
+    SALE_PLAN_OF_STATUS_DONE("done","已完成"),
+
+    SALE_ORDER_OF_STATUS_PENDING("pending", "待处理"),
+    SALE_ORDER_OF_STATUS_PROCESSING("processing", "备货中"),
+    SALE_ORDER_OF_STATUS_PARTIALLY("partially", "部分发货"),
+    SALE_ORDER_OF_STATUS_SHIPPED("shipped", "已发货"),
+    SALE_ORDER_OF_STATUS_COMPLETE("complete", "已完成"),
     ;
 
     MESEnum(String value, String comment) {

+ 23 - 0
easydo-mes/src/main/java/easydo/technology/model/Customer.java

@@ -0,0 +1,23 @@
+package easydo.technology.model;
+
+import lombok.Data;
+
+@Data
+public class Customer {
+    private String id;
+    private String name;
+    private String code;
+    private String creditNo;
+    private String address;
+    private String type;
+    private String customerType;
+    private String phone;
+    private String createTime;
+    private String managerName;
+    private String managerPhone;
+    private String status;
+    private String email;
+    private String creditLevel;
+    private String valueLevel;
+
+}

+ 1 - 0
easydo-mes/src/main/java/easydo/technology/model/ProcessRoute.java

@@ -21,6 +21,7 @@ public class ProcessRoute extends CommonModel {
     private String status;
     private String remark;
     private String version;
+    private String inspectProgramId;
 
     @NotTableField
     private List<ProcessRouteDetail> detailList;

+ 20 - 9
easydo-mes/src/main/java/easydo/technology/model/ProductBom.java

@@ -1,20 +1,31 @@
 package easydo.technology.model;
 
+import easydo.technology.annotation.NotTableField;
 import lombok.Data;
+import lombok.EqualsAndHashCode;
 
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
 @Data
-public class ProductBom {
+public class ProductBom extends CommonModel{
     private String id;
-    private String name;
-    private String code;
-    private String specification;
-    private String category;
-    private String unit;
+    private String materialCode;
+    private String materialName;
     private String createTime;
     private Long createId;
     private String status;
-    private String version;
-    private String productType;
-
+    private String remark;
+    private String bomCode;
+    private String parentId;
+    private BigDecimal quantity;
 
+    @NotTableField
+    private ProductMaterial material;
+    @NotTableField
+    private List<ProductBom> childrenList = new ArrayList<>();
+    @NotTableField
+    private Boolean isHaveChildren = false;
 }

+ 0 - 12
easydo-mes/src/main/java/easydo/technology/model/ProductBomDetail.java

@@ -1,12 +0,0 @@
-package easydo.technology.model;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-@Data
-public class ProductBomDetail {
-    private String id;
-    private String bomId;
-    private BigDecimal number;
-}

+ 25 - 0
easydo-mes/src/main/java/easydo/technology/model/ProductMaterial.java

@@ -0,0 +1,25 @@
+package easydo.technology.model;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class ProductMaterial extends CommonModel {
+    private String id;
+    private String name;
+    private String code;
+    private String unit;
+    private String specification;
+    private String needType;
+    private String materialType;
+    private String status;
+    private String remark;
+    private String warehouseId;
+    private String createTime;
+    private Long createId;
+    private BigDecimal price;
+
+}

+ 30 - 0
easydo-mes/src/main/java/easydo/technology/model/QualityInspectProgram.java

@@ -0,0 +1,30 @@
+package easydo.technology.model;
+
+import easydo.technology.annotation.Minio;
+import easydo.technology.annotation.NotTableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Minio
+public class QualityInspectProgram extends CommonModel{
+    private String id;
+    private String name;
+    private String code;
+    private Long inspectUserId;
+    private String type;
+    private Long reviewUserId;
+    private String reviewStatus;
+    private String reviewTime;
+    private String reviewReason;
+    private String remark;
+    private String createTime;
+    private Integer sampleRate;
+    private Integer passedRate;
+
+    @NotTableField
+    private String inspectUserName;
+    @NotTableField
+    private String reviewUserName;
+}

+ 39 - 0
easydo-mes/src/main/java/easydo/technology/model/SaleOrder.java

@@ -0,0 +1,39 @@
+package easydo.technology.model;
+
+import easydo.technology.annotation.Minio;
+import easydo.technology.annotation.NotTableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.List;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+@Minio
+public class SaleOrder extends CommonModel{
+    private String id;
+    private String code;
+    private String customerId;
+    private Long managerId;
+    private BigDecimal incomePrice;
+    private BigDecimal freePrice;
+    private BigDecimal actualPrice;
+    private String createTime;
+    private String status;
+    private String planReceiveDate;
+    private String actualReceiveDate;
+    private String deliveryDate;
+    private String deliveryAddress;
+    private String contractNo;
+    private String orderDate;
+    private String remark;
+
+    @NotTableField
+    private List<SaleOrderDetail> childrenList = new ArrayList<>();
+    @NotTableField
+    private String managerName;
+    @NotTableField
+    private String customerName;
+}

+ 19 - 0
easydo-mes/src/main/java/easydo/technology/model/SaleOrderDetail.java

@@ -0,0 +1,19 @@
+package easydo.technology.model;
+
+import easydo.technology.annotation.NotTableField;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class SaleOrderDetail {
+    private String id;
+    private String materialCode;
+    private Integer materialQuantity;
+    private String orderId;
+    private String createTime;
+    private BigDecimal materialPrice;
+
+    @NotTableField
+    private ProductMaterial material;
+}

+ 21 - 0
easydo-mes/src/main/java/easydo/technology/model/SalePlan.java

@@ -0,0 +1,21 @@
+package easydo.technology.model;
+
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.math.BigDecimal;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class SalePlan extends CommonModel{
+    private String id;
+    private String type;
+    private String code;
+    private String name;
+    private String parentId;
+    private String beginDate;
+    private String endDate;
+    private BigDecimal saleAmount;
+    private String createTime;
+    private String remark;
+}

+ 15 - 3
easydo-mes/src/main/java/easydo/technology/service/FlowNoService.java

@@ -3,6 +3,7 @@ package easydo.technology.service;
 import easydo.technology.components.JdbcClient;
 import easydo.technology.exception.BizException;
 import easydo.technology.model.FlowNo;
+import easydo.technology.utils.StringUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -34,17 +35,28 @@ public class FlowNoService {
             flowNo.setType(type);
             flowNo = jdbcClient.getJdbcModel(flowNo, connection);
 
+            DateTimeFormatter DFY_MD = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            DateTimeFormatter DFY_MD_2 = DateTimeFormatter.ofPattern("yyyyMMdd");
             String currDate = DFY_MD.format(LocalDateTime.now());
             String currDate2 = DFY_MD_2.format(LocalDateTime.now());
 
-            if (flowNo.getCurrDate() == null || !flowNo.getCurrDate().equals(currDate)) {
+            String no;
+            if (StringUtil.isNotEmpty(flowNo.getCurrDate()) && !flowNo.getCurrDate().equals(currDate)) {
                 flowNo.setCurrDate(currDate);
                 flowNo.setCurrSeq(1);
             } else {
                 flowNo.setCurrSeq(flowNo.getCurrSeq() + 1);
             }
-            String currSeq = String.format("%05d", flowNo.getCurrSeq());
-            String no = flowNo.getPrefix() + currDate2 + currSeq;
+
+
+            if (StringUtil.isEmpty(flowNo.getCurrDate())) {
+                String currSeq = String.format("%06d", flowNo.getCurrSeq());
+                no = flowNo.getPrefix() + currSeq;
+            } else {
+                String currSeq = String.format("%05d", flowNo.getCurrSeq());
+                no = flowNo.getPrefix() + currDate2 + currSeq;
+            }
+
             flowNo.setCurrNo(no);
 
             Map<String, Object> paramMap = new HashMap<>();