Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

晴为镜 2 месяцев назад
Родитель
Сommit
e17aad0615
57 измененных файлов с 4329 добавлено и 938 удалено
  1. 0 24
      zkqy-admin/src/main/java/com/zkqy/web/controller/TetsContro.java
  2. 0 23
      zkqy-admin/src/main/java/com/zkqy/web/controller/Yx.java
  3. 34 0
      zkqy-admin/src/main/java/com/zkqy/web/controller/chemicalFiber/HtmlContentController.java
  4. 0 12
      zkqy-admin/src/main/java/com/zkqy/web/controller/dragForm/DynamicController.java
  5. 8 8
      zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysBpmNodeScriptController.java
  6. 0 73
      zkqy-admin/src/main/java/com/zkqy/web/controller/tool/DynamicBeanRegistrar.java
  7. 0 32
      zkqy-admin/src/main/java/com/zkqy/web/controller/tool/DynamicCompiler.java
  8. 29 0
      zkqy-business/src/main/java/com/zkqy/business/controller/PageParsingController.java
  9. 7 0
      zkqy-business/src/main/java/com/zkqy/business/service/PageParsingHtmlService.java
  10. 53 0
      zkqy-business/src/main/java/com/zkqy/business/service/impl/PageParsingHtmlServiceImpl.java
  11. 8 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInventoryController.java
  12. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/RequisitionOrdersController.java
  13. 1 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleRegistrationCollectionController.java
  14. 8 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInventoryService.java
  15. 107 99
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java
  16. 1 0
      zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml
  17. 0 1
      zkqy-custom-business/src/main/resources/mapper/business/ProductionMapper.xml
  18. 2 2
      zkqy-custom-business/src/main/resources/mapper/business/RequisitionOrdersMapper.xml
  19. 2 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/StationInformationController.java
  20. 24 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/PlanTaskDetails.java
  21. 68 42
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/domain/JdProductionOrder.java
  22. 8 3
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/service/impl/JdProductionOrderServiceImpl.java
  23. 9 3
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/scheduling/ScheduledBean.java
  24. 34 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/RkService.java
  25. 524 323
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/StationInformationServiceImpl.java
  26. 916 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/rkServiceImpl.java
  27. 15 8
      zkqy-fujian-amichi/src/main/resources/mapper/PlanTaskDetailsMapper.xml
  28. 4 1
      zkqy-fujian-amichi/src/main/resources/processReport.json
  29. 4 1
      zkqy-fujian-amichi/src/main/resources/storage.json
  30. 2 2
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/controller/BpmRunController.java
  31. 14 10
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/runbpm/PreExecutionToolClass.java
  32. 90 7
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/runbpm/RunImplementationClass.java
  33. 5 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/DynamicJavaService.java
  34. 1 1
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/CommonServiceImpl.java
  35. 70 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/DynamicJavaServiceImpl.java
  36. 31 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/DefaultPackageClassLoader.java
  37. 19 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/DefaultPackageCompiler.java
  38. 36 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/DynamicJavaService.java
  39. 121 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/PlaceholderReplacer.java
  40. 37 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/SpringBeanRegistrar.java
  41. 86 58
      zkqy-system/src/main/java/com/zkqy/system/domain/SysBpmNodeScript.java
  42. 18 8
      zkqy-system/src/main/java/com/zkqy/system/mapper/SysBpmNodeScriptMapper.java
  43. 15 8
      zkqy-system/src/main/resources/mapper/system/SysBpmNodeScriptMapper.xml
  44. 1 0
      zkqy-ui/package.json
  45. 19 0
      zkqy-ui/src/api/bpmprocess/run/executeProcess.js
  46. 12 0
      zkqy-ui/src/api/tablelist/commonTable.js
  47. 2 4
      zkqy-ui/src/utils/request.js
  48. 832 0
      zkqy-ui/src/views/amichi/dialogCompments/processMange - 副本.vue
  49. 51 51
      zkqy-ui/src/views/amichi/dialogCompments/processMange.vue
  50. 2 2
      zkqy-ui/src/views/amichi/qualityinspectioninformation/bp_leavefactory/QualityStatement.vue
  51. 147 119
      zkqy-ui/src/views/bussiness/processMange.vue
  52. 806 0
      zkqy-ui/src/views/bussiness/processMange2.vue
  53. 41 8
      zkqy-ui/src/views/orderMange/oldOutStock/index.vue
  54. 1 0
      zkqy-ui/src/views/orderMange/planTable/show/fangsi.vue
  55. 1 0
      zkqy-ui/src/views/orderMange/planTable/show/fankuang.vue
  56. 1 0
      zkqy-ui/src/views/orderMange/planTable/show/luotong.vue
  57. 1 0
      zkqy-ui/src/views/orderMange/planTable/show/northWorkshop.vue

+ 0 - 24
zkqy-admin/src/main/java/com/zkqy/web/controller/TetsContro.java

@@ -1,24 +0,0 @@
-package com.zkqy.web.controller;
-
-import com.zkqy.common.annotation.Anonymous;
-import org.springframework.web.bind.annotation.*;
-
-@RestController
-@RequestMapping("/admin")
-public class TetsContro {
-
-    @PostMapping("/test")
-    @Anonymous
-    public String test(@RequestBody Yx yx) {
-        System.out.println(yx);
-        return "hello";
-    }
-
-    @GetMapping("/test2")
-    @Anonymous
-    public String test2(Yx yx) {
-        System.out.println(yx);
-        return "hello";
-    }
-
-}

+ 0 - 23
zkqy-admin/src/main/java/com/zkqy/web/controller/Yx.java

@@ -1,23 +0,0 @@
-package com.zkqy.web.controller;
-
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import lombok.ToString;
-
-import java.util.List;
-
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-@ToString
-public class Yx {
-
-    private String name;
-
-    private  String age;
-
-    private  String desc;
-
-    private List<Yx> rows;
-}

+ 34 - 0
zkqy-admin/src/main/java/com/zkqy/web/controller/chemicalFiber/HtmlContentController.java

@@ -0,0 +1,34 @@
+package com.zkqy.web.controller.chemicalFiber;
+
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+@RestController
+public class HtmlContentController {
+    private final String uploadDir = "path/to/your/upload/directory"; // 替换为你的实际上传目录
+
+    @GetMapping("/api/html/{filename}")
+    public ResponseEntity<String> getHtmlContent(@PathVariable String filename) {
+        try {
+            Path filePath = Paths.get(uploadDir, filename + ".html");
+            if (!Files.exists(filePath)) {
+                return new ResponseEntity<>("File not found", HttpStatus.NOT_FOUND);
+            }
+            String content = new String(Files.readAllBytes(filePath));
+            return ResponseEntity.ok()
+                    .contentType(MediaType.TEXT_HTML)
+                    .body(content);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR);
+        }
+    }
+}

+ 0 - 12
zkqy-admin/src/main/java/com/zkqy/web/controller/dragForm/DynamicController.java

@@ -1,17 +1,5 @@
 package com.zkqy.web.controller.dragForm;
 
-import com.zkqy.common.annotation.Anonymous;
-import com.zkqy.web.controller.tool.DynamicBeanRegistrar;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.DependsOn;
-import org.springframework.context.annotation.Lazy;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
 //@RestController
 public class DynamicController {
 

+ 8 - 8
zkqy-admin/src/main/java/com/zkqy/web/controller/system/SysBpmNodeScriptController.java

@@ -5,14 +5,7 @@ import javax.servlet.http.HttpServletResponse;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
@@ -74,6 +67,13 @@ public class SysBpmNodeScriptController extends BaseController
         return success(sysBpmNodeScriptService.selectSysBpmNodeScriptById(id));
     }
 
+    @GetMapping(value = "/queryCurrentNode")
+    @ApiOperation(value = "获取流程节点脚本详细信息")
+    public AjaxResult queryCurrentNode(@RequestParam("scriptKey") String scriptKey)
+    {
+        return success(sysBpmNodeScriptService.selectSysBpmNodeScriptByScriptKey(scriptKey));
+    }
+
     /**
      * 新增流程节点脚本
      */

+ 0 - 73
zkqy-admin/src/main/java/com/zkqy/web/controller/tool/DynamicBeanRegistrar.java

@@ -1,73 +0,0 @@
-package com.zkqy.web.controller.tool;
-
-import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
-import org.springframework.context.ApplicationContext;
-import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
-
-import java.io.File;
-import java.net.URL;
-import java.net.URLClassLoader;
-
-public class DynamicBeanRegistrar {
-    private final ApplicationContext applicationContext;
-    private final DynamicCompiler dynamicCompiler;
-
-    public DynamicBeanRegistrar(ApplicationContext applicationContext) {
-        this.applicationContext = applicationContext;
-        this.dynamicCompiler = new DynamicCompiler();
-    }
-
-    /**
-     * 动态加载并注册控制器
-     */
-    public void registerController(String sourceFilePath, String beanName) throws Exception {
-        // 1. 动态编译 .java 文件
-        File classDirectory = dynamicCompiler.compileJavaFile("C:\\Users\\86180\\IdeaProjects\\gsxm\\mec-cloud_-intelligent-manufacturing_client\\zkqy-admin\\src\\main\\resources\\abc\\TestController.java");
-
-        // 2. 加载编译后的类
-        Class<?> controllerClass = loadClassFromFile(classDirectory, sourceFilePath);
-
-        // 3. 获取 ConfigurableListableBeanFactory
-        ConfigurableListableBeanFactory beanFactory = ((org.springframework.context.support.AbstractApplicationContext) applicationContext).getBeanFactory();
-
-        // 4. 注册 Bean 到容器
-        beanFactory.registerSingleton(beanName, controllerClass.getDeclaredConstructor().newInstance());
-
-        // 5. 刷新请求映射(确保新控制器生效)
-        refreshRequestMappings();
-    }
-
-    /**
-     * 加载编译后的类文件
-     */
-    private Class<?> loadClassFromFile(File classDirectory, String sourceFilePath) throws Exception {
-        // 获取类名
-        String className = extractClassNameFromSourcePath(sourceFilePath);
-
-        // 创建自定义 ClassLoader 加载类
-        URLClassLoader classLoader = new URLClassLoader(new URL[]{classDirectory.toURI().toURL()}, getClass().getClassLoader());
-        return Class.forName(className, true, classLoader);
-    }
-
-    /**
-     * 提取类名
-     */
-    private String extractClassNameFromSourcePath(String sourceFilePath) {
-        File sourceFile = new File(sourceFilePath);
-        String fileName = sourceFile.getName();
-        String className = fileName.substring(0, fileName.lastIndexOf('.'));
-        return className;
-    }
-
-    /**
-     * 刷新请求映射
-     */
-    private void refreshRequestMappings() {
-        RequestMappingHandlerMapping requestMappingHandlerMapping = applicationContext.getBean(RequestMappingHandlerMapping.class);
-        try {
-            requestMappingHandlerMapping.afterPropertiesSet();
-        } catch (Exception e) {
-            throw new RuntimeException("Failed to refresh request mappings", e);
-        }
-    }
-}

+ 0 - 32
zkqy-admin/src/main/java/com/zkqy/web/controller/tool/DynamicCompiler.java

@@ -1,32 +0,0 @@
-package com.zkqy.web.controller.tool;
-
-import javax.tools.JavaCompiler;
-import javax.tools.ToolProvider;
-import java.io.File;
-
-public class DynamicCompiler {
-    /**
-     * 动态编译 .java 文件
-     */
-    public File compileJavaFile(String sourceFilePath) throws Exception {
-        // 获取 Java 编译器
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-
-        if (compiler == null) {
-            throw new IllegalStateException("Java compiler is not available. Ensure you are running with JDK, not JRE.");
-        }
-
-        // 获取源文件对象
-        File sourceFile = new File(sourceFilePath);
-
-        // 编译源文件
-        int compilationResult = compiler.run(null, null, null, sourceFile.getPath());
-
-        if (compilationResult != 0) {
-            throw new Exception("Compilation failed for file: " + sourceFilePath);
-        }
-
-        // 返回生成的 .class 文件所在目录
-        return sourceFile.getParentFile();
-    }
-}

+ 29 - 0
zkqy-business/src/main/java/com/zkqy/business/controller/PageParsingController.java

@@ -0,0 +1,29 @@
+package com.zkqy.business.controller;
+
+
+import com.zkqy.business.service.PageParsingHtmlService;
+import com.zkqy.common.annotation.Anonymous;
+import com.zkqy.common.core.domain.AjaxResult;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping("/PageParsing")
+public class PageParsingController {
+
+    @Autowired
+    PageParsingHtmlService pageParsingHtmlService;
+
+    @GetMapping("/getVueHtml")
+    @Anonymous
+    public AjaxResult getPageParsingHtml(@RequestParam("pageName") String pageName){
+        //文件解析逻辑
+        AjaxResult pageParsingHtml = pageParsingHtmlService.getPageParsingHtml(pageName);
+        pageParsingHtml.put("fileName",pageName+".vue");
+        //页面路径
+        return  pageParsingHtml;
+    }
+}

+ 7 - 0
zkqy-business/src/main/java/com/zkqy/business/service/PageParsingHtmlService.java

@@ -0,0 +1,7 @@
+package com.zkqy.business.service;
+
+import com.zkqy.common.core.domain.AjaxResult;
+
+public interface PageParsingHtmlService {
+    public AjaxResult getPageParsingHtml(String pageName);
+}

+ 53 - 0
zkqy-business/src/main/java/com/zkqy/business/service/impl/PageParsingHtmlServiceImpl.java

@@ -0,0 +1,53 @@
+package com.zkqy.business.service.impl;
+
+import com.zkqy.business.service.PageParsingHtmlService;
+import com.zkqy.common.core.domain.AjaxResult;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.Resource;
+import org.springframework.core.io.UrlResource;
+import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Service;
+
+import java.io.*;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+@Service
+public class PageParsingHtmlServiceImpl implements PageParsingHtmlService {
+
+    @Value("${template.pageUrl}")
+    public  String  pageUrl;
+
+    @Override
+    public AjaxResult getPageParsingHtml(String pageName) {
+        //1、拼接页面组件路径
+        StringBuffer stringBuffer=new StringBuffer();
+        stringBuffer.append(pageUrl).append(pageName).append(".vue");
+        String filePath = stringBuffer.toString();
+
+        //2、前置校验文件是可读
+        try {
+
+            File resource=new File(filePath);
+            if (!resource.exists() || !resource.canRead()) {//判断文件是否存在+是否可读
+                return AjaxResult.error( "文件不存在或不可读!!!");
+            }
+
+            // 3. 读取文件内容
+            BufferedReader reader = new BufferedReader(new FileReader(resource));
+            StringBuilder contentBuilder = new StringBuilder();
+            String line;
+            while ((line = reader.readLine()) != null) {
+                contentBuilder.append(line).append("\n"); // 按行读取并拼接内容
+            }
+            reader.close();
+
+            // 4. 返回文件内容
+            return AjaxResult.success().put("fileStr", contentBuilder.toString());
+        } catch (MalformedURLException e) {
+            return AjaxResult.error(HttpStatus.BAD_REQUEST.value(), "无效的文件路径:" + e.getMessage());
+        } catch (IOException e) {
+            return AjaxResult.error(HttpStatus.INTERNAL_SERVER_ERROR.value(), "文件读取失败:" + e.getMessage());
+        }
+    }
+}

+ 8 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductInventoryController.java

@@ -255,4 +255,12 @@ public class ProductInventoryController extends BaseController {
         return productInventoryService.oldNoticeOutStorage(productInvoice);
     }
 
+    /**
+     * 通知单出库接口(老库存)
+     */
+    @PostMapping("/checkOldInventory")
+    public AjaxResult checkOldInventory(@RequestBody ProductInvoice productInvoice) {
+        return productInventoryService.checkOldInventory(productInvoice);
+    }
+
 }

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/RequisitionOrdersController.java

@@ -107,7 +107,7 @@ public class RequisitionOrdersController extends BaseController {
             // 实际领料 -》减物料库存
             Map<String, Map<String, Object>> retMap = requisitionOrdersService.reduceMaterialInventory(requisitionOrders);
             if (retMap.keySet().size() != 0) {
-                return AjaxResult.warn("部分物料无法完整领取", retMap);
+                return AjaxResult.warn("物料数量不足,无法领取!!", retMap);
             }
             requisitionOrdersService.updateRequisitionOrders(requisitionOrders);
             return AjaxResult.success("领料成功");

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/SaleRegistrationCollectionController.java

@@ -66,7 +66,7 @@ public class SaleRegistrationCollectionController extends BaseController {
     /**
      * 获取收款登记详细信息
      */
-    @PreAuthorize("@ss.hasPermi('system:SaleRegistrationCollection:query')")
+    @PreAuthorize("@ss.hasPermi('system:SaleRegistrationCollection:edit')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取收款登记详细信息")
     public AjaxResult getInfo(@PathVariable("id") Long id) {

+ 8 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductInventoryService.java

@@ -121,7 +121,7 @@ public interface IProductInventoryService {
     /**
      * 退库
      *
-     * @param productCodeListVO
+     * @param
      * @return
      */
     AjaxResult returnStorage(List<ProductCodeListVO> productCodeListVOList);
@@ -141,4 +141,11 @@ public interface IProductInventoryService {
      * @return
      */
     AjaxResult oldNoticeOutStorage(ProductInvoice productInvoice);
+
+    /**
+     * 检查库存是否足够
+     * @param productInvoice
+     * @return
+     */
+    AjaxResult checkOldInventory(ProductInvoice productInvoice);
 }

+ 107 - 99
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductInventoryServiceImpl.java

@@ -2,6 +2,7 @@ package com.zkqy.business.service.impl;
 
 import java.text.DecimalFormat;
 import java.util.*;
+import java.util.stream.Collectors;
 
 import cn.hutool.core.util.RandomUtil;
 import com.zkqy.business.domain.*;
@@ -32,6 +33,9 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
     @Autowired
     private ProductInventoryMapper productInventoryMapper;
 
+    @Autowired
+    private  ProductionMapper productionMapper;
+
     @Autowired // 码单
     private ProductCodeListMapper productCodeListMapper;
 
@@ -722,18 +726,35 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
     @Override
     public AjaxResult oldNoticeOutStorage(ProductInvoice productInvoice) {
 
-        //修改通知单、发货日期、发货仓库、调拨仓库、发货员、
-        ProductInvoice productInvoice1 = new ProductInvoice();
-        productInvoice1.setId(productInvoice.getId());
-        productInvoice1.setDeliveryDate(productInvoice.getDeliveryDate());
-        productInvoice1.setDeliveryWarehouse(productInvoice.getDeliveryWarehouse());
-        productInvoice1.setTransferWarehouse(productInvoice.getTransferWarehouse());
-        productInvoice1.setDeliveryClerk(productInvoice.getDeliveryClerk());
-        productInvoiceMapper.updateProductInvoice(productInvoice1);
+
         int xs = 0;//箱数用于添加出库记录
         Double zl = 0.0;//重量用于添加出库记录
         // 减去手动输入的老库存,当前订单出库
-        for (ProductInvoiceVO.SaleProductInfo item : productInvoice.getOldProductInvoiceList()) {
+        int totalBoxNum = 0;
+        Double totalSuttle = 0.0;
+        boolean returnState = false;
+        String msg = "";
+
+        if(productInvoice.getOldProductInvoiceList().size()<0){
+            return  AjaxResult.error("未选择待出库的产品");
+        }
+
+        //如果是多个产品(使用Stream API过滤掉name或age为空的对象)
+        List<ProductInvoiceVO.SaleProductInfo> productInvoiceVOList =  productInvoice.getOldProductInvoiceList().stream()
+                .filter(item -> item.getOldActualBoxNum() != null) // 过滤掉name为空(包括null和空字符串)的对象
+                .filter(item -> item.getActualWeight() != null) // 过滤掉age为null的对象
+                .collect(Collectors.toList()); // 将流收集为一个新的列表
+
+        //这个是将要出库的产品循环
+        for (ProductInvoiceVO.SaleProductInfo item : productInvoiceVOList) {
+            // 得到当前出库货品库存(老库存)
+            ProductInventory product = new ProductInventory();
+            product.setLotNum(item.getLotNum());
+            product.setProductId(item.getProductId());
+            product.setProductColour(item.getProductColor());
+            product.setInventoryType("2");
+
+            List<ProductInventory> productInventoryList = productInventoryMapper.oldselectProductInventoryByLotNumAndProductId(product);
 
             // 新增老货品出库记录
             OldProductOutboundRecord oldProductOutboundRecord = new OldProductOutboundRecord();
@@ -748,100 +769,43 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
             oldProductOutboundRecord.setDelFlag("0");
             oldProductOutboundRecordService.insertOldProductOutboundRecord(oldProductOutboundRecord);
 
-
-
-            // 得到当前出库货品库存(老库存)
-            ProductInventory product = new ProductInventory();
-            product.setLotNum(item.getLotNum());
-            product.setProductId(item.getProductId());
-            product.setProductColour(item.getProductColor());
-            product.setInventoryType("2");
-            List<ProductInventory> productInventoryList = productInventoryMapper.oldselectProductInventoryByLotNumAndProductId(product);
-            if (productInventoryList.size() == 0) {
-                return AjaxResult.error("库存不足!");
-            }
-
-            //返回变量
-            String msg = "";
-            boolean returnState = false;
-            int del = 0;
-            // 循环减当前库存
+            int totalBoxNums = item.getOldActualBoxNum();//记录剩余箱数
+            Double totalSuttles = item.getOldActualWeight();//记录剩余重量
+            //循环处理库存
             for (int i = 0; i < productInventoryList.size(); i++) {
                 //当前库存对象
                 ProductInventory productInventory = productInventoryList.get(i);
-                // 更新库存对象
+                // 更新库存对象类
                 ProductInventory editProductInventory = new ProductInventory();
                 editProductInventory.setId(productInventory.getId());
-                if(productInventory.getTotalBoxNum() > xs || item.getOldActualWeight() > zl){
-                    //箱数
-                    if (productInventory.getTotalBoxNum() - 1 < 0) {
-                        // 判断当前循环是否到达最后
-                        if (i == productInventoryList.size() - 1) {
-                            returnState = true;
-                            msg = "当前库存箱数不足";
-                        } else {
-                            del++;
-                        }
-
-                    } else {
-
-                        int totalBoxNum = productInventory.getTotalBoxNum() - item.getOldActualBoxNum();
-                        // 判断当前减去
-                        if (totalBoxNum <= 0) {
-                            Math.abs(totalBoxNum);  // 当前出库还差多少箱数
-                            item.setOldActualBoxNum(Math.abs(totalBoxNum));
-                            editProductInventory.setTotalBoxNum(0);
-                        } else {
-                            editProductInventory.setTotalBoxNum(totalBoxNum);
-                            item.setOldActualBoxNum(0);
-                        }
-                        //获得当前减去的库存箱数
-                        xs = productInventory.getTotalBoxNum() - totalBoxNum;
-                    }
-
-                    //净重
-                    if (productInventory.getTotalSuttle() - item.getOldActualWeight() < 0) {
-                        // 判断当前循环是否到达最后
-                        if (i == productInventoryList.size() - 1) {
-                            returnState = true;
-                            msg = "当前库存重量不足";
-                        } else {
-                            del++;
-                        }
-                    } else {
-                        Double totalSuttle = handlingWeight(productInventory.getTotalSuttle() - item.getOldActualWeight());
-                        if (totalSuttle <= 0.0) {
-//                        Math.abs(totalSuttle);
-                            item.setOldActualWeight(Math.abs(totalSuttle));
-                            editProductInventory.setTotalSuttle(0.0);
-                        } else {
-                            editProductInventory.setTotalSuttle(totalSuttle);
-                            item.setOldActualWeight(0.0);
-                        }
-                        //获得当前减去的库存重量
-                        zl = handlingWeight(productInventory.getTotalSuttle() - totalSuttle);
+                //箱数
+                if(productInventory.getTotalBoxNum() > 0 && item.getOldActualBoxNum() > 0){
+                    if(productInventory.getTotalBoxNum() - item.getOldActualBoxNum() > 0){
+                        editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() - item.getOldActualBoxNum());
+                        xs = item.getOldActualBoxNum();
+                        item.setOldActualBoxNum(0);
+                    }else{
+                        editProductInventory.setTotalBoxNum(0);
+                        xs = item.getOldActualBoxNum() - Math.abs(productInventory.getTotalBoxNum() - item.getOldActualBoxNum());
+                        item.setOldActualBoxNum(Math.abs(productInventory.getTotalBoxNum() - item.getOldActualBoxNum()));
                     }
-
-                    //                //毛重
-                    //                if (productInventory.getTotalGrossWeight() - item.getOldActualWeight() < 0) {
-                    //                    // 判断当前循环是否到达最后
-                    //                    if (i == productInventoryList.size() - 1) {
-                    //                        returnState = true;
-                    //                        msg = "当前库存毛重不足";
-                    //                    }
-                    //                } else {
-                    //                    Double totalGrossWeight = handlingWeight(productInventory.getTotalGrossWeight() - item.getOldActualWeight());
-                    //                    if (totalGrossWeight <= 0.0) {
-                    //                        item.setOldActualWeight(Math.abs(totalGrossWeight));
-                    //                        editProductInventory.setTotalSuttle(0.0);
-                    //                    } else {
-                    //                        editProductInventory.setTotalGrossWeight(totalGrossWeight);
-                    //                    }
-                    //                }
-
-                    if (del == 2) {
+                }
+                //减库存
+                if(productInventory.getTotalSuttle() > 0 && item.getOldActualWeight() > 0){
+                    if(productInventory.getTotalSuttle() - item.getOldActualWeight() > 0){
+                        editProductInventory.setTotalSuttle(productInventory.getTotalSuttle() - item.getOldActualWeight());
+                        zl = item.getOldActualWeight();
+                        item.setOldActualWeight(0.0);
+                    }else{
+                        editProductInventory.setTotalSuttle(0.0);
                         editProductInventory.setDelFlag("2");
+                        zl = item.getOldActualWeight() - Math.abs(productInventory.getTotalSuttle() - item.getOldActualWeight());
+                        item.setOldActualWeight(Math.abs(productInventory.getTotalSuttle() - item.getOldActualWeight()));
                     }
+                }
+                Boolean present = Optional.ofNullable(editProductInventory.getTotalBoxNum()).isPresent();
+                Boolean presentSuttle = Optional.ofNullable(editProductInventory.getTotalSuttle()).isPresent();
+                if(present || presentSuttle){
                     // 成品出库记录
                     ProductOutboundRecord productOutboundRecord = new ProductOutboundRecord();
                     productOutboundRecord.setQrCode("lkc_"+System.currentTimeMillis());//码单号
@@ -875,9 +839,7 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
                     productOutboundRecordMapper.insertProductOutboundRecord(productOutboundRecord);
                     productInventoryMapper.updateProductInventory(editProductInventory);
                 }
-
-                }
-
+            }
             if (returnState) {
                 return AjaxResult.error(msg);
             }
@@ -885,6 +847,14 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
 
         }
 
+        //修改通知单、发货日期、发货仓库、调拨仓库、发货员、
+        ProductInvoice productInvoice1 = new ProductInvoice();
+        productInvoice1.setId(productInvoice.getId());
+        productInvoice1.setDeliveryDate(productInvoice.getDeliveryDate());
+        productInvoice1.setDeliveryWarehouse(productInvoice.getDeliveryWarehouse());
+        productInvoice1.setTransferWarehouse(productInvoice.getTransferWarehouse());
+        productInvoice1.setDeliveryClerk(productInvoice.getDeliveryClerk());
+        productInvoiceMapper.updateProductInvoice(productInvoice1);
         //修改销售单状态为已完成
         //查询通知单详情获取
         ProductInvoice productInvoice2 = productInvoiceMapper.selectProductInvoiceById(productInvoice.getId());
@@ -900,12 +870,50 @@ public class ProductInventoryServiceImpl implements IProductInventoryService {
         return AjaxResult.success();
     }
 
+    @Override
+    public AjaxResult checkOldInventory(ProductInvoice productInvoice) {
+        //不够的库存列表集合贫瘠
+        List<String> notEnoughList=new ArrayList<>();
+
+        //这个是将要出库的产品循环
+        for (ProductInvoiceVO.SaleProductInfo item : productInvoice.getOldProductInvoiceList()) {
+            // 得到当前出库货品库存(老库存)
+            ProductInventory product = new ProductInventory();
+            product.setLotNum(item.getLotNum());
+            product.setProductId(item.getProductId());
+            product.setProductColour(item.getProductColor());
+            product.setInventoryType("2");
+            List<ProductInventory> productInventoryList = productInventoryMapper.oldselectProductInventoryByLotNumAndProductId(product);
+            //判断库存是否空
+            if(productInventoryList.size()<0){
+                StringBuffer stringBuffer=new StringBuffer();
+                stringBuffer.append(item.getProductName()).append("-").append(item.getProductColor()).append(item.getLotNum());
+                notEnoughList.add(stringBuffer.toString());//添加库存不够的记录 ---有多少出多少
+            }else {
+                // 聚合老库存剩余量
+                Double totalOldWeight = productInventoryList.stream()
+                    .filter(e -> e.getTotalSuttle() != 0) // 过滤掉a为0的情况,如果不需要可忽略此行
+                    .mapToDouble(ProductInventory::getTotalSuttle)
+                    .sum();
+                // 库存量-需求数量<0证明库存不够了
+                if(totalOldWeight-item.getOldActualWeight()<0){
+                    StringBuffer stringBuffer=new StringBuffer();
+                    stringBuffer.append(item.getProductName()).append("-").append(item.getProductColor()).append(item.getLotNum());
+                    notEnoughList.add(stringBuffer.toString());//添加库存不够的记录 ---有多少出多少
+                }
+            }
+        }
+        if(notEnoughList.size()>0){
+            return  AjaxResult.success(notEnoughList.stream().collect(Collectors.joining("@"))).put("isG",1);
+        }else{
+            return  AjaxResult.success("库存够").put("isG",0);
+        }
+    }
     //保留两位小数
     public Double handlingWeight(Double weight) {
         DecimalFormat df = new DecimalFormat("0.00");
         return Double.parseDouble(df.format(weight));
     }
 
-    // find
 
 }

+ 1 - 0
zkqy-custom-business/src/main/resources/mapper/business/ProductInventoryMapper.xml

@@ -354,6 +354,7 @@
         </if>
         <if test="productId != null">and pi.product_id = #{productId}</if>
         <if test="levels != null and levels != ''">and pi.levels = #{levels}</if>
+        <if test="productType != null and productType != ''">and p.product_type = #{productType}</if>
         <if test="lotNum != null and lotNum != ''">and pi.lot_num like concat('%', #{lotNum}, '%')</if>
         GROUP BY
         pi.product_id,

+ 0 - 1
zkqy-custom-business/src/main/resources/mapper/business/ProductionMapper.xml

@@ -156,7 +156,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="productDescribe != null  and productDescribe != ''"> and product_describe = #{productDescribe}</if>
         <if test="productUnit != null  and productUnit != ''"> and product_unit = #{productUnit}</if>
         <if test="productTypeNo != null "> and product_type_no = #{productTypeNo}</if>
-        group by product_name
         order by product_name asc
     </select>
 

+ 2 - 2
zkqy-custom-business/src/main/resources/mapper/business/RequisitionOrdersMapper.xml

@@ -376,7 +376,7 @@
           AND sale_craft.del_flag = 0
           AND materiel.del_flag = 0
           AND sale_order.del_flag = 0
-          AND sale_order.status = 3
-          and sale_products.on_board_state != 3 -- 过滤已完成的任务
+          AND sale_order.`status` > 2 AND sale_order.`status` &lt; 7
+          AND sale_products.on_board_state != 12 -- 过滤已完成的任务111111
     </select>
 </mapper>

+ 2 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/StationInformationController.java

@@ -15,6 +15,7 @@ import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
@@ -29,7 +30,7 @@ import java.util.List;
 @Api(value = "/amichi/stationInformation", description = "工位信息-接口")
 public class StationInformationController extends BaseController
 {
-    @Autowired
+    @Resource
     private IStationInformationService stationInformationService;
 
     /**

+ 24 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/PlanTaskDetails.java

@@ -67,10 +67,26 @@ public class PlanTaskDetails extends BaseEntity
     @Excel(name = "单位编号")
     private String funitidfNumber;
 
+    @Excel(name = "基本单位")
+    private String fBaseUnitId;
+
+    @Excel(name = "序列号单位")
+    private String fSNUnitID;
+
+    public String getfSNUnitID() {
+        return fSNUnitID;
+    }
+
+    public void setfSNUnitID(String fSNUnitID) {
+        this.fSNUnitID = fSNUnitID;
+    }
+
     /** 订单号 */
     @Excel(name = "订单号")
     private String fsrcbillno;
 
+
+
     /** 订单号 */
     @Excel(name = "源单分录内码")
     private String ftreeEntityFentryid;
@@ -198,6 +214,13 @@ public class PlanTaskDetails extends BaseEntity
     private String scheduledCompletion;
 
 
+    public String getfBaseUnitId() {
+        return fBaseUnitId;
+    }
+
+    public void setfBaseUnitId(String fBaseUnitId) {
+        this.fBaseUnitId = fBaseUnitId;
+    }
 
     public String getFbomIdFnumber() {
         return fbomIdFnumber;
@@ -603,4 +626,4 @@ public class PlanTaskDetails extends BaseEntity
         this.taskId = taskId;
     }
 
-}
+}

+ 68 - 42
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/domain/JdProductionOrder.java

@@ -12,7 +12,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 金蝶-生产订单信息对象 jd_production_order
- * 
+ *
  * @author ruoyi
  * @date 2024-10-12
  */
@@ -28,6 +28,25 @@ public class JdProductionOrder extends BaseEntity
     @JSONField(name = "FBillNo")
     private String documentNumber;
 
+    //基本单位
+
+
+    public String getfBaseUnitId() {
+        return fBaseUnitId;
+    }
+
+    public void setfBaseUnitId(String fBaseUnitId) {
+        this.fBaseUnitId = fBaseUnitId;
+    }
+
+    public String getfSNUnitID() {
+        return fSNUnitID;
+    }
+
+    public void setfSNUnitID(String fSNUnitID) {
+        this.fSNUnitID = fSNUnitID;
+    }
+
     @JSONField(name = "FWorkShopID.FNumber")
     private String shopCoding;
 
@@ -70,6 +89,13 @@ public class JdProductionOrder extends BaseEntity
     @JSONField(name = "FUnitId.FNumber")
     private String funitidfNumber;
 
+    @JSONField(name = "FBaseUnitId.FNumber")
+    private String fBaseUnitId;
+
+    //序列号单位
+    @JSONField(name = "FSNUnitID.FNumber")
+    private String fSNUnitID;
+
 
 
     @Excel(name = "需求日期")
@@ -394,16 +420,16 @@ public class JdProductionOrder extends BaseEntity
     public void setCompletionTime(String completionTime) {
         this.completionTime = completionTime;
     }
-    public Long getId() 
+    public Long getId()
     {
         return id;
     }
-    public void setDocumentNumber(String documentNumber) 
+    public void setDocumentNumber(String documentNumber)
     {
         this.documentNumber = documentNumber;
     }
 
-    public String getDocumentNumber() 
+    public String getDocumentNumber()
     {
         return documentNumber;
     }
@@ -417,174 +443,174 @@ public class JdProductionOrder extends BaseEntity
     {
         return documentDate;
     }
-    public void setDocumentStatus(String documentStatus) 
+    public void setDocumentStatus(String documentStatus)
     {
         this.documentStatus = documentStatus;
     }
 
-    public String getDocumentStatus() 
+    public String getDocumentStatus()
     {
         return documentStatus;
     }
-    public void setProductType(String productType) 
+    public void setProductType(String productType)
     {
         this.productType = productType;
     }
 
-    public String getProductType() 
+    public String getProductType()
     {
         return productType;
     }
-    public void setMaterialCode(String materialCode) 
+    public void setMaterialCode(String materialCode)
     {
         this.materialCode = materialCode;
     }
 
-    public String getMaterialCode() 
+    public String getMaterialCode()
     {
         return materialCode;
     }
-    public void setMaterialName(String materialName) 
+    public void setMaterialName(String materialName)
     {
         this.materialName = materialName;
     }
 
-    public String getMaterialName() 
+    public String getMaterialName()
     {
         return materialName;
     }
-    public void setModelNumber(String modelNumber) 
+    public void setModelNumber(String modelNumber)
     {
         this.modelNumber = modelNumber;
     }
 
-    public String getModelNumber() 
+    public String getModelNumber()
     {
         return modelNumber;
     }
-    public void setSpecification(String specification) 
+    public void setSpecification(String specification)
     {
         this.specification = specification;
     }
 
-    public String getSpecification() 
+    public String getSpecification()
     {
         return specification;
     }
-    public void setProductionWorkshop(String productionWorkshop) 
+    public void setProductionWorkshop(String productionWorkshop)
     {
         this.productionWorkshop = productionWorkshop;
     }
 
-    public String getProductionWorkshop() 
+    public String getProductionWorkshop()
     {
         return productionWorkshop;
     }
-    public void setUnit(String unit) 
+    public void setUnit(String unit)
     {
         this.unit = unit;
     }
 
-    public String getUnit() 
+    public String getUnit()
     {
         return unit;
     }
-    public void setQuantity(String quantity) 
+    public void setQuantity(String quantity)
     {
         this.quantity = quantity;
     }
 
-    public String getQuantity() 
+    public String getQuantity()
     {
         return quantity;
     }
-    public void setServiceStatus(String serviceStatus) 
+    public void setServiceStatus(String serviceStatus)
     {
         this.serviceStatus = serviceStatus;
     }
 
-    public String getServiceStatus() 
+    public String getServiceStatus()
     {
         return serviceStatus;
     }
-    public void setDemandDocument(String demandDocument) 
+    public void setDemandDocument(String demandDocument)
     {
         this.demandDocument = demandDocument;
     }
 
-    public String getDemandDocument() 
+    public String getDemandDocument()
     {
         return demandDocument;
     }
-    public void setMaterialRequisitionStatus(String materialRequisitionStatus) 
+    public void setMaterialRequisitionStatus(String materialRequisitionStatus)
     {
         this.materialRequisitionStatus = materialRequisitionStatus;
     }
 
-    public String getMaterialRequisitionStatus() 
+    public String getMaterialRequisitionStatus()
     {
         return materialRequisitionStatus;
     }
-    public void setCreateById(Long createById) 
+    public void setCreateById(Long createById)
     {
         this.createById = createById;
     }
 
-    public Long getCreateById() 
+    public Long getCreateById()
     {
         return createById;
     }
-    public void setUpdateById(Long updateById) 
+    public void setUpdateById(Long updateById)
     {
         this.updateById = updateById;
     }
 
-    public Long getUpdateById() 
+    public Long getUpdateById()
     {
         return updateById;
     }
-    public void setDelFlag(String delFlag) 
+    public void setDelFlag(String delFlag)
     {
         this.delFlag = delFlag;
     }
 
-    public String getDelFlag() 
+    public String getDelFlag()
     {
         return delFlag;
     }
-    public void setByOne(String byOne) 
+    public void setByOne(String byOne)
     {
         this.byOne = byOne;
     }
 
-    public String getByOne() 
+    public String getByOne()
     {
         return byOne;
     }
-    public void setByTwo(String byTwo) 
+    public void setByTwo(String byTwo)
     {
         this.byTwo = byTwo;
     }
 
-    public String getByTwo() 
+    public String getByTwo()
     {
         return byTwo;
     }
-    public void setPlanNumber(String planNumber) 
+    public void setPlanNumber(String planNumber)
     {
         this.planNumber = planNumber;
     }
 
-    public String getPlanNumber() 
+    public String getPlanNumber()
     {
         return planNumber;
     }
-    public void setPlanName(String planName) 
+    public void setPlanName(String planName)
     {
         this.planName = planName;
     }
 
-    public String getPlanName() 
+    public String getPlanName()
     {
         return planName;
     }

+ 8 - 3
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/service/impl/JdProductionOrderServiceImpl.java

@@ -155,7 +155,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                 //定义查询条件
                 String query = "{\n" +
                         "    \"FormId\": \"PRD_MO\",\n" +
-                        "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
+                        "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,FSNUnitID.FNumber,FBaseUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
                         "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,FSaleOrderNo,FPickMtrlStatus,FMemoItem,FWorkShopID.FNumber," +
                         "FMaterialId.FNumber,FMaterialName,F_PONP_BaseProperty,FSpecification,FUnitId.FName,F_PONP_yanse,F_PONP_mingpai,F_PONP_hegezheng.FDataValue," +
                         "F_PONP_shuomingshu.FDataValue,F_PONP_KaiGuanXiang,F_PONP_baozhuangxiang,F_PONP_GongLv,FPlanFinishDate,FPlanStartDate,F_PONP_XQRQ,FPlanStartDate,FPlanFinishDate\",\n" +
@@ -315,12 +315,15 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                                 planTaskDetails.setFtreeEntityFentryid(a.getFtreeEntityFentryid());
                                 planTaskDetails.setFbillno(a.getDocumentNumber());//生产订单号
                                 planTaskDetails.setFsrcbillno(a.getDemandDocument());//销售订单号
-                                planTaskDetails.setFunitidfNumber(a.getFunitidfNumber());//单位编号
                                 planTaskDetails.setShopCoding(a.getShopCoding());//车间编码
+                                planTaskDetails.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
+                                planTaskDetails.setFunitidfNumber(a.getFunitidfNumber());//单位编号
+                                planTaskDetails.setfBaseUnitId(a.getfBaseUnitId());//基本单位
+                                planTaskDetails.setfSNUnitID(a.getfSNUnitID());//序列号单位
                                 if (StringUtils.isNotNull(a.getDocumentDate())) {
                                     planTaskDetails.setTimeOfRequest(a.getDocumentDate());
                                 }
-                                planTaskDetails.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
+
                                 int i = planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
                             });
                         }
@@ -396,6 +399,8 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                         planTaskDetailsAdd.setFsrcbillno(a.getDemandDocument());//销售订单号
                         planTaskDetailsAdd.setShopCoding(a.getShopCoding());//车间编码
                         planTaskDetailsAdd.setFunitidfNumber(a.getFunitidfNumber());//单位编号
+                        planTaskDetailsAdd.setfBaseUnitId(a.getfBaseUnitId());//基本单位
+                        planTaskDetailsAdd.setfSNUnitID(a.getfSNUnitID());//序列号单位
                         if (StringUtils.isNotNull(a.getDocumentDate())) {
                             planTaskDetailsAdd.setTimeOfRequest(a.getDocumentDate());
                         }

+ 9 - 3
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/scheduling/ScheduledBean.java

@@ -80,7 +80,7 @@ public class ScheduledBean {
                 //定义查询条件
                 String query = "{\n" +
                         "    \"FormId\": \"PRD_MO\",\n" +
-                        "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
+                        "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,FSNUnitID.FNumber,FBaseUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
                         "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,FSaleOrderNo,FPickMtrlStatus,FMemoItem,FWorkShopID.FNumber," +
                         "FMaterialId.FNumber,FMaterialName,F_PONP_BaseProperty,FSpecification,FUnitId.FName,F_PONP_yanse,F_PONP_mingpai,F_PONP_hegezheng.FDataValue," +
                         "F_PONP_shuomingshu.FDataValue,F_PONP_KaiGuanXiang,F_PONP_baozhuangxiang,F_PONP_GongLv,FPlanFinishDate,FPlanStartDate,F_PONP_XQRQ,FPlanStartDate,FPlanFinishDate\",\n" +
@@ -236,13 +236,15 @@ public class ScheduledBean {
 //                                String formattedDate = formatter1.format(a.getDocumentDate());
                                     planTaskDetails.setTimeOfRequest(a.getDocumentDate());
                                 }
-                                planTaskDetails.setShopCoding(a.getShopCoding());//生产车间
                                 planTaskDetails.setFid(a.getFid());
                                 planTaskDetails.setFtreeEntityFentryid(a.getFtreeEntityFentryid());
                                 planTaskDetails.setFbillno(a.getDocumentNumber());//生产订单号
                                 planTaskDetails.setFsrcbillno(a.getDemandDocument());//销售订单号
-                                planTaskDetails.setFunitidfNumber(a.getFunitidfNumber());//单位
+                                planTaskDetails.setShopCoding(a.getShopCoding());//生产车间
                                 planTaskDetails.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
+                                planTaskDetails.setFunitidfNumber(a.getFunitidfNumber());//单位
+                                planTaskDetails.setfBaseUnitId(a.getfBaseUnitId());//基本单位
+                                planTaskDetails.setfSNUnitID(a.getfSNUnitID());//序列号单位
                                 planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
                             });
                         }
@@ -320,6 +322,10 @@ public class ScheduledBean {
                         }
                         planTaskDetailsAdd.setShopCoding(a.getShopCoding());//生产车间
                         planTaskDetailsAdd.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
+
+                        planTaskDetailsAdd.setFunitidfNumber(a.getFunitidfNumber());//单位
+                        planTaskDetailsAdd.setfBaseUnitId(a.getfBaseUnitId());//基本单位
+                        planTaskDetailsAdd.setfSNUnitID(a.getfSNUnitID());//序列号单位
                         planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetailsAdd);
 
                         //判断那个字段是否为空

+ 34 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/RkService.java

@@ -0,0 +1,34 @@
+package com.zkqy.amichi.service;
+
+import com.zkqy.amichi.domain.PlanTaskDetails;
+import com.zkqy.amichi.domain.RingScanInformation;
+
+import java.util.Map;
+
+public interface RkService {
+
+    public  String   sweepingMaterial(String orderNumber,String productNumber,String gxm,String lxkNumber);
+
+    /**
+     * 汇报逻辑
+     *
+     * @param planTaskDetails1
+     * @param type
+     * @param txfs
+     * @param ringScanInformation
+     * @return
+     */
+    public String erpProcessReport(PlanTaskDetails planTaskDetails1, String type, String txfs, RingScanInformation ringScanInformation);
+
+    /**
+     * 入库逻辑
+     */
+    public Map<String, String> erpWareHouSing(PlanTaskDetails planTaskDetails1, String type, RingScanInformation ringScanInformation, String isDOrQ);
+
+
+    /**
+     * 中间判断逻辑
+     */
+    public  String  generateWarehouseWarrant(String productionOrderNumber,String gxName,String type,RingScanInformation ringScanInformation);
+
+}

Разница между файлами не показана из-за своего большого размера
+ 524 - 323
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/StationInformationServiceImpl.java


+ 916 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/rkServiceImpl.java

@@ -0,0 +1,916 @@
+package com.zkqy.amichi.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.kingdee.bos.webapi.sdk.K3CloudApi;
+import com.zkqy.amichi.domain.*;
+import com.zkqy.amichi.jd.domain.JdProductionOrder;
+import com.zkqy.amichi.jd.domain.MaterialRetentionLogVo;
+import com.zkqy.amichi.mapper.*;
+import com.zkqy.amichi.service.RkService;
+import com.zkqy.amichi.utils.WarehouseEntryNumberGenerator;
+import com.zkqy.common.utils.DateUtils;
+import com.zkqy.execution.produce.dispersed.mapper.BpmExecuteNodeLogMapper;
+import com.zkqy.execution.produce.dispersed.mapper.BpmExecuteProcessMapper;
+import com.zkqy.system.mapper.SysDictDataMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.io.Resource;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class rkServiceImpl implements RkService {
+
+
+    @Autowired
+    private StationInformationMapper stationInformationMapper;
+
+    @Autowired
+    private ReportInformationSheetMapper reportInformationSheetMapper;
+
+    @Autowired
+    private ExceptionReportInformationSheetMapper exceptionReportInformationSheetMapper;
+
+    @Autowired
+    private ProductionPlanningManagementMapper productionPlanningManagementMapper;
+
+    @Autowired
+    private BpmExecuteProcessMapper bpmExecuteProcessMapper;
+
+    @Autowired
+    private BpmExecuteNodeLogMapper bpmExecuteNodeLogMapper;
+
+    @Autowired
+    private  PlanTaskDetailsServiceImpl planTaskDetailsService;
+
+    @Autowired
+    private ProductionCardFlowMapper productionCardFlowMapper;
+
+    @Autowired
+    private RingScanInformationMapper ringScanInformationMapper;
+
+    @Autowired
+    private  TerminalInformationMapper terminalInformationMapper;
+
+    @Autowired
+    private  MaterialRetentionLogMapper materialRetentionLogMapper;
+
+    @Autowired
+    private  RingScanInformationFirstMapper ringScanInformationFirstMapper;
+
+    @Autowired
+    private  RingTerminalMapper ringTerminalMapper;
+
+    @Autowired
+    private  RingScanInformationProdOrderScanningMapper prodOrderScanningMapper;
+
+    @Autowired
+    private  PlanTaskDetailsMapper planTaskDetailsMapper;
+
+    @Autowired
+    ProcedureListErpMapper procedureListErpMapper;
+
+    @Autowired
+    ProcedureListMapper procedureListMapper;
+
+    @Autowired
+    ThreadPoolTaskExecutor threadPoolTaskExecutor;
+
+    @Value("classpath:processReport.json")
+    private Resource processReport;
+
+
+    @Value("classpath:storage.json")
+    private Resource storage;
+
+    @Autowired
+    SysDictDataMapper dictDataMapper;
+
+    @Autowired
+    WarehouseEntryNumberGenerator warehouseEntryNumberGenerator;
+
+
+    @Autowired
+    ProductionReportingRecordMapper productionReportingRecordMapper;
+
+
+    /**
+     * 判断走入库还是走生产汇报的逻辑
+     *   前置一直在更新,包装检验,或者试机的数量,如果满足就创建生产汇报单据
+     *   前置也在更新,可入库的数量,如果满足就下推生产入库单。
+     * @param productionOrderNumber
+     * type 1入成品 type 2 入利库 type 3走工序汇报逻辑,实际我并没有获取这个参数
+     */
+    @Override
+    public  String  generateWarehouseWarrant(String productionOrderNumber,String gxName,String type,RingScanInformation ringScanInformation){
+        if(gxName.equals("入库")){
+            RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
+            newRingScanInformationFirst.setProductionOrderNumber(productionOrderNumber);
+            //查询第一次新增时确定的是试机入库还是包装入库
+            List<RingScanInformationFirst> ringScanInformationFirsts1 = ringScanInformationFirstMapper.selectRingScanInformationFirstList(newRingScanInformationFirst);
+            if(ringScanInformationFirsts1.size()>0) {
+                RingScanInformationFirst ringScanInformationFirst = ringScanInformationFirsts1.get(0);
+                //包装或者检验
+                String packingOrInspection = ringScanInformationFirst.getPackingOrInspection();
+                if(packingOrInspection.equals("1")){//检查包装检验  --够了--下推入库单
+                    PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                    planTaskDetails.setDemandDocument(productionOrderNumber);
+                    //查询即将入库的产品信息
+                    List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+                    if(ringScanInformationFirst.getRks().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                        //加更正生产订单状态
+                        planTaskDetails.setStatus("2");//生产完成
+                        int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                    }
+                    //入库 typ 1 入成品 type 入利库
+                    Map<String,String> ac= erpWareHouSing(planTaskDetails1.get(0), type, ringScanInformation, "单量推送");
+                    if(ac.get("msg").equals("未查询到生产汇报信息")){
+                        return "未查询到生产汇报信息";
+                    }
+                    if(ac.get("msg").equals("入库单创建失败")){
+                        return "入库单创建失败"+ac.get("error");
+                    }
+                    if(ac.get("msg").equals("入库单提交失败")){
+                        return "入库单提交失败";
+                    }
+                    if(ac.get("msg").equals("入库单审核失败")){
+                        return "入库单审核失败";
+                    }
+                    return "入库成功";
+                }else if(packingOrInspection.equals("2")){  //试机数量 --够了--下推入库单
+                    //入库数量等于生产订单总数那么就发起入库申请
+                    if(ringScanInformationFirst.getRks().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                        PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                        planTaskDetails.setDemandDocument(productionOrderNumber);
+                        int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                        //查询即将入库的产品信息
+                        List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+                        //入库 typ 1 入成品 type 入利库
+                        Map<String,String> ac= erpWareHouSing(planTaskDetails1.get(0), type, ringScanInformation, "全量推送");
+                        if(ac.get("msg").equals("未查询到生产汇报信息")){
+                            return "未查询到生产汇报信息";
+                        }
+                        if(ac.get("msg").equals("入库单创建失败")){
+                            return "入库单创建失败"+ac.get("error");
+                        }
+                        if(ac.get("msg").equals("入库单提交失败")){
+                            return "入库单创建失败";
+                        }
+                        if(ac.get("msg").equals("入库单审核失败")){
+                            return "入库单审核失败";
+                        }
+                        //加更正生产订单状态
+                        planTaskDetails.setStatus("2");//生产完成
+                        int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                        return "入库成功";
+                    }
+                }
+            }
+            return "正在入库";
+        }else if(type.equals("3")||type.equals("4")){//等于代表走工序汇报逻辑 1 和 2代表入的什么仓库(1:成品 2:利库)   3和4 代表走工序汇报逻辑(3:成品 4:利库)
+            RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
+            newRingScanInformationFirst.setProductionOrderNumber(productionOrderNumber);
+            //查询第一次新增时确定的是试机入库还是包装入库
+            List<RingScanInformationFirst> ringScanInformationFirsts1 = ringScanInformationFirstMapper.selectRingScanInformationFirstList(newRingScanInformationFirst);
+            if(ringScanInformationFirsts1.size()>0){
+                RingScanInformationFirst ringScanInformationFirst = ringScanInformationFirsts1.get(0);
+                String packingOrInspection = ringScanInformationFirst.getPackingOrInspection();
+                //改当前生产订单的状态
+                PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                planTaskDetails.setDemandDocument(productionOrderNumber);
+                //查询即将入库的产品信息
+                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+                //检查包装或者试机数量
+                if(packingOrInspection.equals("1")){//检查成品检验  --如果够了-下推生产汇报单
+                    //看包装跟当前生产订单总数量是否相等
+                    if(ringScanInformationFirst.getPackingQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                        //加更正生产订单状态
+                        planTaskDetails.setStatus("2");//生产完成
+                        int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                        //扣料操作
+                        String s = this.sweepingMaterial(ringScanInformation.getOrderNumber(), ringScanInformation.getProductionOrderNumber(), //订单号   生产订单号
+                                ringScanInformation.getProcessName(), ringScanInformation.getNativeNumbering());//工序     流转卡信息
+                    }
+                    //工序汇报 0 为单个推送
+                    erpProcessReport(planTaskDetails1.get(0),type,"单量推送",ringScanInformation);
+                    System.out.println("工序汇报单量推送");
+                }else if(packingOrInspection.equals("2")){ //试机数量--下推生产汇报单
+                    //看包装跟当前生产订单总数量是否相等
+                    if(ringScanInformationFirst.getInspectionQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                        //生产汇报 1为批量推送
+                        String aa = erpProcessReport(planTaskDetails1.get(0), type, "全量推送", ringScanInformation);
+                        //扣料操作
+                        String s = this.sweepingMaterial(ringScanInformation.getOrderNumber(), ringScanInformation.getProductionOrderNumber(), //订单号   生产订单号
+                                ringScanInformation.getProcessName(), ringScanInformation.getNativeNumbering());//工序     流转卡信息
+                        //加更正生产订单状态
+                        planTaskDetails.setStatus("2");//生产完成
+                        int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                        System.out.println("工序汇报全量推送");
+                    }
+                }
+            }
+            return "工序汇报成功";
+        }
+        return "有问题请联系管理员";
+    }
+
+    /**
+     * 生产汇报单是否下推提交审核成功
+     * txfs:判断是成品检验还是试机检验
+     * @param planTaskDetails1
+     */
+    @Override
+    public String erpProcessReport(PlanTaskDetails planTaskDetails1,String type,String txfs,RingScanInformation ringScanInformation) {
+        //生产汇报
+        ObjectMapper objectMapper = new ObjectMapper();
+        try {
+            Map<String, Object> jsonData = objectMapper.readValue(processReport.getInputStream(), Map.class);
+            //得到Model
+            String model1 = objectMapper.writeValueAsString(jsonData.get("Model"));
+            Map<String,Object> modelMap = objectMapper.readValue(model1, Map.class);
+            String localDateTimeStr = DateUtils.toLocalDateTimeStr(LocalDateTime.now());
+            modelMap.put("FDate",localDateTimeStr);
+            //得到FEntity
+            String fEntityString = objectMapper.writeValueAsString(modelMap.get("FEntity"));
+            List<Map> list = objectMapper.readValue(fEntityString, List.class);
+            Map map = list.get(0);
+            String fMaterialId = map.get("FMaterialId").toString();
+            map.put("FSrcEntryId",planTaskDetails1.getFtreeEntityFentryid());
+            String fMaterialIdString = objectMapper.writeValueAsString(map.get("FMaterialId"));
+            Map<String,String > map1 = objectMapper.readValue(fMaterialIdString, Map.class);
+            map1.put("FNumber",planTaskDetails1.getMaterialId());
+            map.put("FMaterialId",map1);
+
+            //生产车间信息
+            boolean present = Optional.ofNullable(planTaskDetails1.getShopCoding()).filter(a -> !a.isEmpty()).isPresent();
+            if(present){
+                HashMap<String, String> shopCoding = new HashMap<>();
+                shopCoding.put("FNumber",planTaskDetails1.getShopCoding());
+                map.put("FWorkshipId",shopCoding);
+            }
+
+            map.put("FMoBillNo",planTaskDetails1.getDemandDocument());
+            map.put("FSrcBillNo",planTaskDetails1.getDemandDocument()); //生产订单号
+            map.put("FReqBillNo",ringScanInformation.getOverNumber()); //订单号
+            map.put("FStartTime",localDateTimeStr);
+            map.put("FEndTime",localDateTimeStr);
+            HashMap fbomdIdMap=new HashMap();
+            fbomdIdMap.put("FNumber",planTaskDetails1.getFbomIdFnumber());
+            map.put("FBomId",fbomdIdMap);
+            HashMap FStockId=new HashMap();
+            if(type.equals("3")){
+                FStockId.put("FNumber","CK007"); //成品仓
+            }else if(type.equals("4")) {
+                FStockId.put("FNumber","CK006"); //利库仓
+            }
+
+            map.put("FStockId",FStockId);
+            String FSNUnitIDJson = objectMapper.writeValueAsString( map.get("FSNUnitID"));
+            Map<String,String > FSNUnitIDMap = objectMapper.readValue(FSNUnitIDJson, Map.class);
+            FSNUnitIDMap.put("FNumber",planTaskDetails1.getFunitidfNumber());
+            map.put("FReqBillNo",planTaskDetails1.getFsrcbillno()); //源单编号
+            map.put("FSrcInterId",planTaskDetails1.getFid());
+            map.put("FMoId",planTaskDetails1.getFid());
+            map.put("FMoEntryId",planTaskDetails1.getFtreeEntityFentryid());
+            map.put("FMOMAINENTRYID",planTaskDetails1.getFtreeEntityFentryid());
+
+            if(txfs.equals("全量推送")){
+                //序列号单据体---循环
+                ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                productionCardFlow.setDemandDocumentNumber(planTaskDetails1.getDemandDocument());//流转卡序列号
+                List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+
+                map.put("FSNQty",productionCardFlows.size()); //序列号数量
+                map.put("FFinishQty",planTaskDetails1.getQuantity()); //完成数量
+                map.put("FFinishQty",planTaskDetails1.getQuantity()); //合格数量
+
+                List<Map> list1=new ArrayList<>();
+                //String FSerialSubEntity = map.get("FSerialSubEntity").toString();
+                String FSerialSubEntityJson = objectMapper.writeValueAsString( map.get("FSerialSubEntity"));
+                List<Map> fSerialSubEntitylist = objectMapper.readValue(FSerialSubEntityJson, List.class);
+                productionCardFlows.forEach(item->{
+                    try {
+                        // 将 fSerialSubEntitylist.get(0) 转换为 JSON 字符串,再反序列化为新的 Map
+                        String map2Json = objectMapper.writeValueAsString(fSerialSubEntitylist.get(0));
+                        Map<String, Object> map2 = objectMapper.readValue(map2Json, Map.class);
+
+                        // 修改 map2 中的 FSerialNo
+                        map2.put("FSerialNo", item.getSerialNumber());
+
+                        // 处理 FSerialId
+                        Map<String, String> fSerialIdMap = null;
+                        if (map2.get("FSerialId") != null) {
+                            String fSerialIdJson = objectMapper.writeValueAsString(map2.get("FSerialId"));
+                            fSerialIdMap = objectMapper.readValue(fSerialIdJson, Map.class);
+                        } else {
+                            fSerialIdMap = new HashMap<>();
+                        }
+
+                        // 修改 FSerialId 中的 FNUMBER
+                        fSerialIdMap.put("FNUMBER", item.getSerialNumber());
+                        map2.put("FSerialId", fSerialIdMap);
+
+                        // 将修改后的 map2 添加到 list1
+                        list1.add(map2);
+                    } catch (JsonProcessingException e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    }
+                });
+                map.put("FSerialSubEntity",list1);
+            }else if(txfs.equals("单量推送")) { //==等于0的情况
+                //序列号单据体---循环
+                ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                productionCardFlow.setSerialNumber(ringScanInformation.getNativeNumbering());//流转卡序列号
+                List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+
+                map.put("FSNQty","1"); //序列号数量
+                map.put("FFinishQty","1"); //完成数量
+                map.put("FFinishQty","1"); //合格数量
+
+                List<Map> list1=new ArrayList<>();
+                String FSerialSubEntityJson = objectMapper.writeValueAsString( map.get("FSerialSubEntity"));
+                List<Map> fSerialSubEntitylist = objectMapper.readValue(FSerialSubEntityJson, List.class);
+                productionCardFlows.forEach(item->{
+                    try {
+                        // 将 fSerialSubEntitylist.get(0) 转换为 JSON 字符串,再反序列化为新的 Map
+                        String map2Json = objectMapper.writeValueAsString(fSerialSubEntitylist.get(0));
+                        Map<String, Object> map2 = objectMapper.readValue(map2Json, Map.class);
+
+                        // 修改 map2 中的 FSerialNo
+                        map2.put("FSerialNo", item.getSerialNumber());
+
+                        // 处理 FSerialId
+                        Map<String, String> fSerialIdMap = null;
+                        if (map2.get("FSerialId") != null) {
+                            String fSerialIdJson = objectMapper.writeValueAsString(map2.get("FSerialId"));
+                            fSerialIdMap = objectMapper.readValue(fSerialIdJson, Map.class);
+                        } else {
+                            fSerialIdMap = new HashMap<>();
+                        }
+                        // 修改 FSerialId 中的 FNUMBER
+                        fSerialIdMap.put("FNUMBER", item.getSerialNumber());
+                        map2.put("FSerialId", fSerialIdMap);
+
+                        // 将修改后的 map2 添加到 list1
+                        list1.add(map2);
+                    } catch (JsonProcessingException e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    }
+                });
+                map.put("FSerialSubEntity",list1);
+            }
+            //表连接关系
+            String FEntity_LinkJSON = objectMapper.writeValueAsString(map.get("FEntity_Link"));
+            List<Map> FEntity_LinkJSONList = objectMapper.readValue(FEntity_LinkJSON, List.class);
+            Map map3 = FEntity_LinkJSONList.get(0);
+            map3.put("FEntity_Link_FSBillId",planTaskDetails1.getFid());
+            map3.put("FEntity_Link_FSId",planTaskDetails1.getFtreeEntityFentryid());
+            List<Map> list2=new ArrayList<>();
+            list2.add(map3);
+            map.put("FEntity_Link",list2);
+            List<Map> FEntityList=new ArrayList<>();
+            FEntityList.add(map);
+            modelMap.put("FEntity",FEntityList);
+
+            //转成String 字符
+
+            jsonData.put("Model", modelMap);
+
+            String zxJson = objectMapper.writeValueAsString(jsonData);
+            //生产用料清单结果
+            K3CloudApi api = new K3CloudApi();
+            try {
+                //执行JSO结果
+                String resultJsonJG = api.save("PRD_MORPT", zxJson);
+                //分析结构
+                Map resultString = objectMapper.readValue(resultJsonJG, Map.class);
+
+                String result = objectMapper.writeValueAsString(resultString.get("Result"));
+                Map<String,Object>  resultMap= objectMapper.readValue(result, Map.class);
+                String number = resultMap.get("Number").toString();//编号
+
+                String s4 = documentExecutionJudgment1(objectMapper, resultJsonJG, "工序创建成功", "工序汇报提交失败");
+                if(s4.equals("工序汇报提交失败")){
+                    return resultJsonJG;
+                }
+                //执行提交
+                String tjQuery="{\n" +
+                        "    \"Numbers\": [],\n" +
+                        "    \"Ids\": \"\",\n" +
+                        "    \"SelectedPostId\": 0,\n" +
+                        "    \"NetworkCtrl\": \"\",\n" +
+                        "    \"IgnoreInterationFlag\": \"true\"\n" +
+                        "}";
+                Map map4 = objectMapper.readValue(tjQuery, Map.class);
+
+                List<String> numberjson = new ArrayList<>();
+                numberjson.add(number);
+                map4.put("Numbers",numberjson);
+                String tjExeJSON = objectMapper.writeValueAsString(map4);
+                String s1 = api.submit("PRD_MORPT",tjExeJSON);
+                String s3 = documentExecutionJudgment1(objectMapper, s1, "工序汇提交成功", "工序汇报提交失败");
+                if(s3.equals("工序汇报提交失败")){
+                    return s1;
+                }
+                //执行审核
+                String shQuery="{\n" +
+                        "    \"Numbers\": [],\n" +
+                        "    \"Ids\": \"\",\n" +
+                        "    \"InterationFlags\": \"\",\n" +
+                        "    \"NetworkCtrl\": \"\",\n" +
+                        "    \"IsVerifyProcInst\": \"\",\n" +
+                        "    \"IgnoreInterationFlag\": \"true\",\n" +
+                        "    \"UseBatControlTimes\": \"false\"\n" +
+                        "}";
+
+                Map map5 = objectMapper.readValue(shQuery, Map.class);
+                List<String> number2json = new ArrayList<>();
+                number2json.add(number);
+                map5.put("Numbers",number2json);
+                String shExeJSON = objectMapper.writeValueAsString(map4);
+                String s2 = api.audit("PRD_MORPT",shExeJSON);
+                String s = documentExecutionJudgment1(objectMapper, s2, "工序汇报审核成功", "工序汇报审核失败");
+                if(s.equals("工序汇报审核失败")){
+                    return s2;
+                }
+                if(s.equals("工序汇报审核成功")){
+                    //添加一张审核记录表,单据编号,序列号,数量
+                    ProductionReportingRecord productionReportingRecord=new ProductionReportingRecord();
+                    if(txfs.equals("全量推送")) {
+                        //序列号单据体---循环
+                        ProductionCardFlow productionCardFlow = new ProductionCardFlow();
+                        productionCardFlow.setDemandDocumentNumber(planTaskDetails1.getDemandDocument());//流转卡序列号
+                        List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                        if(productionCardFlows.size()>0){
+                            //单据编号
+                            productionReportingRecord.setNumber(number);
+                            //整体的所有序列号
+                            productionReportingRecord.setXlhArray(productionCardFlows.stream().map(ProductionCardFlow::getSerialNumber).collect(Collectors.joining(",")));
+                            productionReportingRecord.setType("2");//试机检验
+                        }
+                        productionReportingRecordMapper.insertProductionReportingRecord(productionReportingRecord);
+                    }else if(txfs.equals("单量推送")) {
+                        //序列号单据体---循环
+                        ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                        productionCardFlow.setSerialNumber(ringScanInformation.getNativeNumbering());//流转卡序列号
+                        List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                        if (productionCardFlows.size()>0){
+                            //单据编号
+                            productionReportingRecord.setNumber(number);
+                            //只有一个序列号
+                            productionReportingRecord.setXlh(productionCardFlows.get(0).getSerialNumber());
+                            productionReportingRecord.setType("1");//成品检验
+                            productionReportingRecordMapper.insertProductionReportingRecord(productionReportingRecord);
+                            System.out.println("保存工序汇报单据数据成功");
+                        }
+                    }
+                }
+            } catch (Exception e) {
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            }
+        } catch (IOException e) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+        }
+        return "汇报成功";
+    }
+
+
+    /**
+     * 操作ERP生产入库单
+     * @param planTaskDetails1
+     * planTaskDetails1 产品信息
+     * type 入那个库
+     * ringScanInformation 扫描信息
+     */
+    @Override
+    public   Map<String,String> erpWareHouSing(PlanTaskDetails planTaskDetails1,String type,RingScanInformation ringScanInformation,String isDOrQ){
+        //生产汇报
+        ObjectMapper objectMapper = new ObjectMapper();
+        //生产用料清单结果
+        K3CloudApi api = new K3CloudApi();
+        try {
+            String nr="";
+            if(isDOrQ.equals("单量推送")){
+                //当前扫描的序列号信息
+                String nativeNumbering = ringScanInformation.getNativeNumbering();
+                ProductionReportingRecord productionReportingRecord=new ProductionReportingRecord();
+                productionReportingRecord.setXlh(nativeNumbering);
+                List<ProductionReportingRecord> productionReportingRecords = productionReportingRecordMapper.selectProductionReportingRecordList(productionReportingRecord);
+                if(productionReportingRecords.size()>0){
+                    //查询生产汇报工序的基本信息
+                    nr="{\n" +
+                            "    \"FormId\": \"PRD_MORPT\",\n" +
+                            "    \"FieldKeys\": \"fbillno,fid,FSrcBillNo,FEntity_FEntryId,FDate,FUnitID.FNumber\",\n" +
+                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"17\",\"Value\":\""+productionReportingRecords.get(0).getNumber()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                }else{
+                    Map<String,String> abc= new HashMap<>();
+                    abc.put("msg","未查询到生产汇报信息");
+                    return abc;
+                }
+            }else {
+                //查询生产汇报工序的基本信息
+                nr="{\n" +
+                        "    \"FormId\": \"PRD_MORPT\",\n" +
+                        "    \"FieldKeys\": \"fbillno,fid,FSrcBillNo,FEntity_FEntryId,FDate,FUnitID.FNumber\",\n" +
+                        "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FSrcBillNo\",\"Compare\":\"17\",\"Value\":\""+planTaskDetails1.getDemandDocument()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                        "    \"OrderString\": \"\",\n" +
+                        "    \"TopRowCount\": 0,\n" +
+                        "    \"StartRow\": 0,\n" +
+                        "    \"Limit\": 2000,\n" +
+                        "    \"SubSystemId\": \"\"\n" +
+                        "}";
+            }
+
+            //查询结果
+            String nrString = api.billQuery(nr);
+            List<Map> mapList1 = JSONArray.parseArray(nrString, Map.class);
+            Map map2 = mapList1.get(0);
+            String fbillno = map2.get("fbillno").toString();
+            String fid = map2.get("fid").toString();
+            String FEntityFEntryId = map2.get("FEntity.FEntryId").toString();
+            String FDate = map2.get("FDate").toString();
+            String FSrcBillNo = map2.get("FSrcBillNo").toString();
+            String FUnitIDFNumber = map2.get("FUnitID.FNumber").toString();
+            //生成入库单
+            Map<String, Object> jsonData2 = objectMapper.readValue(storage.getInputStream(), LinkedHashMap.class);
+            //得到Model
+            String model2 = objectMapper.writeValueAsString(jsonData2.get("Model"));
+            LinkedHashMap map6 = JSONObject.parseObject(model2, LinkedHashMap.class);
+            map6.put("FDate",DateUtils.toLocalDateTimeStr(LocalDateTime.now()));
+            String fEntity1 = objectMapper.writeValueAsString(map6.get("FEntity"));
+            List<LinkedHashMap> mapList = JSONArray.parseArray(fEntity1, LinkedHashMap.class);
+            LinkedHashMap map7 = mapList.get(0);
+            map7.put("F_PONP_HBRQ",FDate);
+
+            map7.put("FSrcEntryId",FEntityFEntryId);
+            map7.put("FSrcInterId",fid);
+            map7.put("FSrcBillNo",fbillno);
+            map7.put("FMoBillNo",planTaskDetails1.getDemandDocument());
+            map7.put("FMoId",planTaskDetails1.getFid());
+            map7.put("FMoEntryId",planTaskDetails1.getFtreeEntityFentryid());
+            map7.put("FReqBillNo",planTaskDetails1.getFsrcbillno()); //订单号
+            map7.put("FMOMAINENTRYID",planTaskDetails1.getFtreeEntityFentryid());
+            HashMap<String, String> fStockId = new HashMap<>();
+            if(type.equals("1")){
+                fStockId.put("FNumber","CK007"); //成品仓
+            }else {
+                fStockId.put("FNumber","CK006"); //利库仓
+            }
+            map7.put("FStockId",fStockId);
+            HashMap<String, String> fNumber = new HashMap<>();
+            fNumber.put("FNumber",planTaskDetails1.getMaterialId());
+            map7.put("FMaterialId",fNumber);
+
+            //生产车间信息
+            boolean present = Optional.ofNullable(planTaskDetails1.getShopCoding()).filter(a -> !a.isEmpty()).isPresent();
+            if(present){
+                HashMap<String, String> shopCoding = new HashMap<>();
+                shopCoding.put("FNumber",planTaskDetails1.getShopCoding());
+                map7.put("FWorkshipId",shopCoding);
+            }
+
+            HashMap<String, String> fUnitIDfNumber = new HashMap<>();
+            fUnitIDfNumber.put("FNumber",FUnitIDFNumber);
+            map7.put("FUnitID",fUnitIDfNumber);
+
+            HashMap<String, String> fBaseUnitIdFNumber = new HashMap<>();
+            fBaseUnitIdFNumber.put("FNumber",FUnitIDFNumber);
+            map7.put("FBaseUnitId",fBaseUnitIdFNumber);
+
+            if(isDOrQ.equals("全量推送")){
+                //序列号单据体---循环
+                ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                productionCardFlow.setDemandDocumentNumber(planTaskDetails1.getDemandDocument());//流转卡序列号
+                List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                map7.put("FSNQty",productionCardFlows.size()); //序列号数量
+                map7.put("FMustQty",productionCardFlows.size()); //应收实收
+                map7.put("FRealQty",productionCardFlows.size()); //实收
+
+                map7.put("FBaseMustQty",productionCardFlows.size());  //基本单位实收数量
+                map7.put("FBaseRealQty",productionCardFlows.size()); //基本单位库存实收数量
+                List<Map> list1=new ArrayList<>();
+                String FSerialSubEntityJson = objectMapper.writeValueAsString( map7.get("FSerialSubEntity"));
+                List<Map> fSerialSubEntitylist = objectMapper.readValue(FSerialSubEntityJson, List.class);
+                productionCardFlows.forEach(item->{
+                    try {
+                        // 将 fSerialSubEntitylist.get(0) 转换为 JSON 字符串,再反序列化为新的 Map
+                        String map2Json = objectMapper.writeValueAsString(fSerialSubEntitylist.get(0));
+                        Map<String, Object> map2two = objectMapper.readValue(map2Json, Map.class);
+
+                        // 修改 map2 中的 FSerialNo
+                        map2two.put("FSerialNo", item.getSerialNumber());
+
+                        // 处理 FSerialId
+                        Map<String, String> fSerialIdMap = null;
+                        if (map2two.get("FSerialId") != null) {
+                            String fSerialIdJson = objectMapper.writeValueAsString(map2two.get("FSerialId"));
+                            fSerialIdMap = objectMapper.readValue(fSerialIdJson, Map.class);
+                        } else {
+                            fSerialIdMap = new HashMap<>();
+                        }
+
+                        // 修改 FSerialId 中的 FNUMBER
+                        fSerialIdMap.put("FNumber", item.getSerialNumber());
+                        map2two.put("FSerialId", fSerialIdMap);
+
+                        // 将修改后的 map2 添加到 list1
+                        list1.add(map2two);
+                    } catch (JsonProcessingException e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    }
+                });
+            }else if(isDOrQ.equals("单量推送")) {
+                //序列号单据体---循环
+                ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                productionCardFlow.setSerialNumber(ringScanInformation.getNativeNumbering());//流转卡序列号
+                List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                map7.put("FSNQty","1"); //序列号数量
+                map7.put("FMustQty","1"); //应收实收
+                map7.put("FRealQty","1"); //实收
+
+                map7.put("FBaseMustQty","1");  //基本单位实收数量
+                map7.put("FBaseRealQty","1"); //基本单位库存实收数量
+                List<Map> list1=new ArrayList<>();
+                String FSerialSubEntityJson = objectMapper.writeValueAsString( map7.get("FSerialSubEntity"));
+                List<Map> fSerialSubEntitylist = objectMapper.readValue(FSerialSubEntityJson, List.class);
+                productionCardFlows.forEach(item->{
+                    try {
+                        // 将 fSerialSubEntitylist.get(0) 转换为 JSON 字符串,再反序列化为新的 Map
+                        String map2Json = objectMapper.writeValueAsString(fSerialSubEntitylist.get(0));
+                        Map<String, Object> map2two = objectMapper.readValue(map2Json, Map.class);
+
+                        // 修改 map2 中的 FSerialNo
+                        map2two.put("FSerialNo", item.getSerialNumber());
+
+                        // 处理 FSerialId
+                        Map<String, String> fSerialIdMap = null;
+                        if (map2two.get("FSerialId") != null) {
+                            String fSerialIdJson = objectMapper.writeValueAsString(map2two.get("FSerialId"));
+                            fSerialIdMap = objectMapper.readValue(fSerialIdJson, Map.class);
+                        } else {
+                            fSerialIdMap = new HashMap<>();
+                        }
+
+                        // 修改 FSerialId 中的 FNUMBER
+                        fSerialIdMap.put("FNumber", item.getSerialNumber());
+                        map2two.put("FSerialId", fSerialIdMap);
+
+                        // 将修改后的 map2 添加到 list1
+                        list1.add(map2two);
+                    } catch (JsonProcessingException e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    }
+                });
+                map7.put("FSerialSubEntity",list1);
+                System.out.println("入库单量推送流转卡逻辑");
+            }
+            List<Map> fEntityLinkList=new ArrayList<>();
+            String FenJson="{\n" +
+                    "\"FEntity_Link_FRuleId\": \"PRD_MO2INSTOCK\",\n" +
+                    "\"FEntity_Link_FSTableName\": \"T_PRD_MORPTENTRY\",\n" +
+                    "\"FEntity_Link_FSBillId\": \"168691\",\n" +
+                    "\"FEntity_Link_FSId\": \"168691\"\n" +
+                    "}";
+            Map<String,String> map8 = JSONObject.parseObject(FenJson, Map.class);
+            map8.put("FEntity_Link_FSBillId",fid);
+            map8.put("FEntity_Link_FSId",FEntityFEntryId);
+            fEntityLinkList.add(map8);
+            map7.put("FEntity_Link",fEntityLinkList);
+            List<LinkedHashMap> map7List = new ArrayList<>();
+            map7List.add(map7);
+            map6.put("FEntity",map7List);
+
+            jsonData2.put("Model",map6);
+
+            String rkdcrateJosn = api.save("PRD_INSTOCK",JSONObject.toJSONString(jsonData2));
+            Map<String, String> stringStringMap1 = documentExecutionJudgment(objectMapper, rkdcrateJosn, "生成入库单创建", "入库单创建失败");
+            if(stringStringMap1.get("msg").equals("入库单创建失败")){
+                return stringStringMap1;
+            }
+            //解析入库单创建结果
+            Map rkdCrateJsonResultString = objectMapper.readValue(rkdcrateJosn, Map.class);
+            String rkdCrateResultJson = objectMapper.writeValueAsString(rkdCrateJsonResultString.get("Result"));
+            Map<String,String>  rkdResultMap= objectMapper.readValue(rkdCrateResultJson, Map.class);
+            String rkdNumber = rkdResultMap.get("Number");//编号
+
+            //提交
+            String rkdtj="{\n" +
+                    "    \"Numbers\": [],\n" +
+                    "    \"Ids\": \"\",\n" +
+                    "    \"SelectedPostId\": 0,\n" +
+                    "    \"NetworkCtrl\": \"\",\n" +
+                    "    \"IgnoreInterationFlag\": \"\"\n" +
+                    "}";
+            Map<String, Object> jsonData3 = objectMapper.readValue(rkdtj, Map.class);
+            List<String> list5 =new ArrayList<>();
+            list5.add(rkdNumber);
+            jsonData3.put("Numbers",list5);
+            String tkdtjR = api.submit("PRD_INSTOCK",JSONObject.toJSONString(jsonData3));
+            Map<String, String> stringStringMap2 = documentExecutionJudgment(objectMapper, tkdtjR, "入库单提交成功", "入库单提交失败");
+            if(stringStringMap2.get("msg").equals("入库单提交失败")){
+                return stringStringMap2;
+            }
+
+            //审核
+            String rkdsh="{\n" +
+                    "    \"Numbers\": [],\n" +
+                    "    \"Ids\": \"\",\n" +
+                    "    \"InterationFlags\": \"\",\n" +
+                    "    \"NetworkCtrl\": \"\",\n" +
+                    "    \"IsVerifyProcInst\": \"\",\n" +
+                    "    \"IgnoreInterationFlag\": \"\",\n" +
+                    "    \"UseBatControlTimes\": \"false\"\n" +
+                    "}";
+            Map<String, Object> jsonData4 = objectMapper.readValue(rkdsh, Map.class);
+            jsonData4.put("Number",list5);
+
+            String rkdshR = api.audit("PRD_INSTOCK",JSONObject.toJSONString(jsonData3));
+            Map<String, String> stringStringMap = documentExecutionJudgment(objectMapper, rkdshR, "入库单审核成功", "入库单审核失败");
+            if(stringStringMap.get("msg").equals("入库单审核失败")){
+                return stringStringMap;
+            }
+        } catch (Exception e) {
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            Map<String,String>  abc=new HashMap<>();
+            abc.put("msg", "入库单创建失败");
+            abc.put("error","入库单创建失败");
+            return abc;
+        }
+        Map<String,String>  abc=new HashMap<>();
+        abc.put("msg","入库成功");
+        return abc;
+    }
+
+
+    /**
+     * erp创建单据是否成功
+     * @param objectMapper
+     * @param resultJson
+     * @param
+     * @param msg2
+     * @return
+     * @throws JsonProcessingException
+     */
+
+    private Map<String,String>  documentExecutionJudgment(ObjectMapper objectMapper, String resultJson,String msg1,String msg2) throws JsonProcessingException {
+        Map s2Map = objectMapper.readValue(resultJson, Map.class);
+        String result = objectMapper.writeValueAsString(s2Map.get("Result"));
+        System.out.println(result+"执行结果");
+        Map<String,Object>  s2MapResultJsonMap= objectMapper.readValue(result, Map.class);
+        //判断是否成功
+        String responseStatus3 = objectMapper.writeValueAsString(s2MapResultJsonMap.get("ResponseStatus"));
+        Map map11 = objectMapper.readValue(responseStatus3, Map.class);
+        String isSuccess3 = map11.get("IsSuccess").toString();
+        String  isSuccess4= map11.get("Errors").toString();
+        if(isSuccess3.equals("true")){
+            HashMap hashMap=new HashMap();
+            hashMap.put("msg",msg1);
+            return hashMap;
+        }else {
+            System.out.println(isSuccess4);
+            HashMap hashMap=new HashMap();
+            hashMap.put("msg",msg2);
+            hashMap.put("error",isSuccess4);
+            return hashMap;
+        }
+    }
+
+
+    private String  documentExecutionJudgment1(ObjectMapper objectMapper, String resultJson,String msg1,String msg2) throws JsonProcessingException {
+        Map s2Map = objectMapper.readValue(resultJson, Map.class);
+        String result = objectMapper.writeValueAsString(s2Map.get("Result"));
+        System.out.println(result+"执行结果");
+        Map<String,Object>  s2MapResultJsonMap= objectMapper.readValue(result, Map.class);
+        //判断是否成功
+        String responseStatus3 = objectMapper.writeValueAsString(s2MapResultJsonMap.get("ResponseStatus"));
+        Map map11 = objectMapper.readValue(responseStatus3, Map.class);
+        String isSuccess3 = map11.get("IsSuccess").toString();
+        String  isSuccess4= map11.get("Errors").toString();
+        if(isSuccess3.equals("true")){
+//            HashMap hashMap=new HashMap();
+//            hashMap.put("msg",);
+            return msg1;
+        }else {
+            System.out.println(isSuccess4);
+//            HashMap hashMap=new HashMap();
+//            hashMap.put("msg",msg1);
+//            hashMap.put("error",isSuccess4);
+            return msg2;
+        }
+    }
+
+    @Override
+    public  String   sweepingMaterial(String orderNumber,String productNumber,String gxm,String lxkNumber) {
+        //查询条件
+        String queryString = "{\n" +
+                "    \"FormId\": \"PRD_MO\",\n" +
+                "    \"FieldKeys\": \"FBillNo\",\n" +
+                "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FSerialNo\",\"Compare\":\"67\",\"Value\":\"" + lxkNumber + "\",\"Right\":\"\",\"Logic\":0}],\n" +
+                "    \"OrderString\": \"\",\n" +
+                "    \"TopRowCount\": 0,\n" +
+                "    \"StartRow\": 0,\n" +
+                "    \"Limit\": 2000,\n" +
+                "    \"SubSystemId\": \"\"\n" +
+                "}";
+        //查询条件
+        Map<String, Object> map = JSON.parseObject(queryString, Map.class);
+        K3CloudApi api = new K3CloudApi();
+        List<JdProductionOrder> jdProductionOrders;
+        try {
+            String resultJson = api.billQuery(JSON.toJSONString(map));
+            //如果查询的数据为空
+            if (resultJson == "" || resultJson == "[]") {
+                return "不能添加这次扫描记录";
+            } else {
+                //转换实体类对象
+                jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+                //按照流转卡把信息查询出来了
+                if (jdProductionOrders.size() > 0) {
+                    //单据编号
+                    String documentNumber = jdProductionOrders.get(0).getDocumentNumber();
+                    //这个生产订单生产的数量
+                    //String quantity = jdProductionOrders.get(0).getQuantity();
+                    //根据生产订单号查询生产用料清单
+                    String productionMaterialsListQuery = "{\n" +
+                            "    \"FormId\": \"PRD_PPBOM\",\n" +
+                            "    \"FieldKeys\": \"FMaterialID.FNumber,FMaterialName,FMaterialModel,FMaterialModel2,FDescription,FMaterialID2.FNumber,FMaterialName1,FMaterialModel1,FUnitID2.FName,FMustQty,FMEMO1,FNumerator,FMaterialType,FProcessID.FName\",\n" +
+                            "    \"FilterString\": [],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                    //查询生产用料清单
+                    Map<String, Object> map2 = JSON.parseObject(productionMaterialsListQuery, Map.class);
+
+                    String filterString = map2.get("FilterString").toString();
+
+                    List<Map> mapList = JSON.parseArray(filterString, Map.class);
+
+                    //循环条件
+                    String ddh = "{\"Left\":\"\",\"FieldName\":\"FMOBillNO\",\"Compare\":\"67\",\"Value\":\"11\",\"Right\":\"\",\"Logic\":0}";
+                    Map ddhObj = JSONObject.parseObject(ddh, Map.class);
+                    ddhObj.put("Value", productNumber);
+                    mapList.add(ddhObj);
+                    map2.put("FilterString", mapList);//从新绑定条件
+
+
+                    //全部MES工序
+                    List<ProcedureList> procedureLists = procedureListMapper.selectProcedureListMap();
+
+                    Map<String, String> gxMap = procedureLists.stream()
+                            .filter(procedureList ->
+                                    procedureList.getElpname() != null && !procedureList.getElpname().isEmpty()) // 过滤条件
+                            .collect(Collectors.toMap(ProcedureList::getElpname, ProcedureList::getProcedurName));
+
+
+
+                    //生产用料清单结果
+                    String resultJsonJG = api.billQuery(JSON.toJSONString(map2));
+                    //json转Java实体类对象
+                    List<MaterialRetentionLogVo> materialRetentionLogVos = JSON.parseArray(resultJsonJG, MaterialRetentionLogVo.class);
+                    //赋值一些默认值
+                    List<MaterialRetentionLogVo> collect = materialRetentionLogVos.parallelStream().map(item -> {
+                        item.setCkNumber("CK005");
+                        item.setDeliveryWarehouse("车间仓");
+                        item.setFlowSequenceNumber(lxkNumber);//流转序列号
+                        boolean present = Optional.ofNullable(gxMap.get(item.getProcess())).filter(a->!a.isEmpty()).isPresent();
+                        if(present){
+                            item.setMesprocess(gxMap.get(item.getProcess())); //工序
+                        }else {
+                            item.setMesprocess("未知工序");
+                        }
+                        item.setOrderNumber(orderNumber); //订单
+                        item.setProductionOrderNumber(productNumber); //生产订单
+                        item.setCreateTime(new DateTime());//创建时间
+                        return item;
+                    }).collect(Collectors.toList());
+                    //分子数量基本的扣料单位
+                    int i = materialRetentionLogMapper.insertMaterialRetentionLogBatch(collect);
+                }
+            }
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+        return productNumber + gxm + "扣料成功";
+    }
+
+}

+ 15 - 8
zkqy-fujian-amichi/src/main/resources/mapper/PlanTaskDetailsMapper.xml

@@ -43,6 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="funitidfNumber"    column="funitidfNumber"    />
         <result property="fbillno"    column="fbillno"    />
         <result property="fsrcbillno"    column="fsrcbillno"    />
+        <result property="fBaseUnitId"    column="fBaseUnitId"    />
+        <result property="fSNUnitID"    column="fSNUnitID"    />
     </resultMap>
 
     <resultMap type="com.zkqy.amichi.domain.vo.PlanTaskDetailsVo" id="PlanTaskDetailsResultVo">
@@ -77,14 +79,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="ftreeEntityFentryid"    column="ftreeEntity_fentryid"    />
         <result property="funitidfNumber"    column="funitidfNumber"    />
         <result property="fbillno"    column="fbillno"    />
-        <result property="fsrcbillno"    column="fsrcbillno"    />
+
     </resultMap>
 
     <sql id="selectPlanTaskDetailsVo">
         select fid,fbomIdFnumber,ftreeEntity_fentryid,funitidfNumber,fbillno,fsrcbillno,id, quantity,  remark,  document_type,
                create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, data_approval_status, process_key,
                task_process_key, task_node_key, plan_id, material_id, material_name, model_number, specification, material_unit, demand_document,
-               time_of_request, customer_model, power, colour, mingpai, shuomingshu, hegezheng, description, baozhuangxiang,status,shop_coding
+               time_of_request, customer_model, power, colour, mingpai, shuomingshu, hegezheng, description,
+               baozhuangxiang,status,shop_coding,fBaseUnitId,fSNUnitID
         from fjqydb.plan_task_details
     </sql>
 
@@ -117,7 +120,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="status != null  and status != ''"> and status = #{status}</if>
         </where>
     </select>
-    
+
     <select id="selectPlanTaskDetailsById" parameterType="Long" resultMap="PlanTaskDetailsResult">
         <include refid="selectPlanTaskDetailsVo"/>
         where id = #{id}
@@ -168,6 +171,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fsrcbillno != null  and fsrcbillno != ''">fsrcbillno,</if>
             <if test="funitidfNumber != null  and funitidfNumber != ''">funitidfNumber,</if>
             <if test="fbomIdFnumber != null  and fbomIdFnumber != ''">fbomIdFnumber,</if>
+            <if test="fBaseUnitId != null  and fBaseUnitId != ''">fBaseUnitId,</if>
+            <if test="fSNUnitID != null  and fSNUnitID != ''">fSNUnitID,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="quantity != null">#{quantity},</if>
@@ -211,6 +216,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fsrcbillno != null  and fsrcbillno != ''">#{fsrcbillno},</if>
             <if test="funitidfNumber != null  and funitidfNumber != ''">#{funitidfNumber},</if>
             <if test="fbomIdFnumber != null  and fbomIdFnumber != ''">#{fbomIdFnumber},</if>
+            <if test="fBaseUnitId != null  and fBaseUnitId != ''">#{fBaseUnitId},</if>
+            <if test="fSNUnitID != null  and fSNUnitID != ''">#{fSNUnitID},</if>
          </trim>
     </insert>
 
@@ -218,7 +225,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updatePlanTaskDetailsByDemandDocument" parameterType="com.zkqy.amichi.domain.PlanTaskDetails">
         update fjqydb.plan_task_details
         <trim prefix="SET" suffixOverrides=",">
-
             <if test="quantity != null">quantity = #{quantity},</if>
             <if test="documentType != null">document_type = #{documentType},</if>
             <if test="remark != null">remark = #{remark},</if>
@@ -255,9 +261,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </update>
 
     <update id="updatePlanTaskDetails" parameterType="com.zkqy.amichi.domain.PlanTaskDetails">
-        update {DBNAME}.plan_task_details
+        update fjqydb.plan_task_details
         <trim prefix="SET" suffixOverrides=",">
-
             <if test="quantity != null">quantity = #{quantity},</if>
             <if test="documentType != null">document_type = #{documentType},</if>
             <if test="remark != null">remark = #{remark},</if>
@@ -289,6 +294,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">description = #{description},</if>
             <if test="baozhuangxiang != null">baozhuangxiang = #{baozhuangxiang},</if>
             <if test="status != null  and status != ''">status=#{status},</if>
+            <if test="fBaseUnitId != null">fBaseUnitId = #{fBaseUnitId},</if>
+            <if test="fSNUnitID != null  and fSNUnitID != ''">fSNUnitID=#{fSNUnitID},</if>
         </trim>
         where id = #{id}
     </update>
@@ -298,7 +305,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deletePlanTaskDetailsByIds" parameterType="String">
-        delete from {DBNAME}.plan_task_details where id in 
+        delete from {DBNAME}.plan_task_details where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -426,4 +433,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
         order by pcf.serial_number
     </select>
-</mapper>
+</mapper>

+ 4 - 1
zkqy-fujian-amichi/src/main/resources/processReport.json

@@ -63,6 +63,9 @@
         "FBomId": {
           "FNumber": "2010040030037_V1.0"
         },
+        "FBFLowId": {
+          "FID": "f6e6eec3-5267-4f02-8593-b633da508a72"
+        },
         "FOwnerTypeId": "BD_OwnerOrg",
         "FStockInOrgId": {
           "FNumber": "100"
@@ -122,4 +125,4 @@
       }
     ]
   }
-}
+}

+ 4 - 1
zkqy-fujian-amichi/src/main/resources/storage.json

@@ -42,6 +42,9 @@
         "FUnitID": {
           "FNumber": "Pcs"
         },
+        "FBFLowId": {
+          "FID": "f6e6eec3-5267-4f02-8593-b633da508a72"
+        },
         "FMustQty": 1.0,
         "FRealQty": 1.0,
         "FCostRate": 100.0000000000,
@@ -101,4 +104,4 @@
       }
     ]
   }
-}
+}

+ 2 - 2
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/controller/BpmRunController.java

@@ -63,7 +63,7 @@ public class BpmRunController extends BaseController {
                 throw new RuntimeException(e);
             }
         }
-        return AjaxResult.success(ipreExecutionToolClass.executionNode(bpmRunNodeVo));
+        return ipreExecutionToolClass.executionNode(bpmRunNodeVo);
     }
 
     /**
@@ -164,4 +164,4 @@ public class BpmRunController extends BaseController {
         return AjaxResult.success(ipreExecutionToolClass.revokeApplication(bpmRunNodeVo));
     }
 
-}
+}

+ 14 - 10
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/runbpm/PreExecutionToolClass.java

@@ -334,7 +334,8 @@ public class PreExecutionToolClass<R> {
                 IScriptEntity iScriptEntity = new IScriptEntity();
                 iScriptEntity.setImplementationName(scriptAutoList.get(0).getScriptKey());
                 iScriptEntity.setScriptNodeKey(optionalBpmUserScriptVo.get().getNodeKey());
-                if (!iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, intoProduction)) {
+                AjaxResult ajaxResult = iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, intoProduction);
+                if ((boolean)ajaxResult.get("isFlag")) {
                     // 判断脚本执行状态
                     return AjaxResult.error(HttpStatus.SCRIPTEXCEPTION, "脚本执行异常!");
                 }
@@ -356,14 +357,11 @@ public class PreExecutionToolClass<R> {
      */
     @Transactional
     public AjaxResult executionNode(BpmRunNodeVo bpmRunNodeVo) {
-//        Integer a= 10/0;
         String taskProcessKey = bpmRunNodeVo.getTaskProcessKey(); // 任务流程编码
         String taskNodeKey = bpmRunNodeVo.getTaskNodeKey(); // 任务节点编码
         // 得到当前节点的所有信息-》用于执行节点前后绑定的自动运行的脚本
         BpmExecuteNode currentBpmExecuteNode = runBpmExecuteNodeMapper.queryBpmExecuteNodeBytaskNodeKey(taskProcessKey, taskNodeKey);
-        // ⚠️⚠️⚠️ 新增节点执行记录
-        BpmExecuteNodeLog bpmExecuteNodeLog = new BpmExecuteNodeLog(currentBpmExecuteNode);
-        iBpmExecuteNodeLogService.insertBpmExecuteNodeLog(bpmExecuteNodeLog);
+
         // 在执行节时得到除当前节点绑定的正常脚本外,有可能会绑定自动执行的脚本(这些自动执行的脚本参数不能确定,无法传递)
         BpmExecuteNodeMiddle bpmExecuteNodeMiddle = runBpmExecuteNodeMiddleMapper.queryBpmExecuteNodeMiddleByTaskNodeKey(taskProcessKey, taskNodeKey);
         String script[] = bpmExecuteNodeMiddle.getTaskNodeAroundScriptKey().split(",");  // 得到当前节点需要自动执行的脚本
@@ -379,7 +377,8 @@ public class PreExecutionToolClass<R> {
                     iScriptEntity.setScriptNodeKey(taskNodeKey);
                     iScriptEntity.setImplementationName(script[i]);
                     // 调用执行脚本方法
-                    if (!iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, bpmRunNodeVo)) {
+                    AjaxResult ajaxResult1 = iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, bpmRunNodeVo);
+                    if ((Boolean) ajaxResult1.get("isFlag")) {
                         // 判断脚本执行状态
                         return AjaxResult.error(HttpStatus.SCRIPTEXCEPTION, "节点前脚本执行失败!");
                     }
@@ -397,6 +396,10 @@ public class PreExecutionToolClass<R> {
         AjaxResult ajaxResult = iRunImplementationClass.RunBPMImplementationClassLogicCode(iRunBPMEntity);  //  调用节点绑定逻辑代码
         if (!ajaxResult.get("code").toString().equals("200")) {
             return ajaxResult;
+        }else { //只有执行成功的情况下再让他插入日志信息
+            // ⚠️⚠️⚠️ 新增节点执行记录
+            BpmExecuteNodeLog bpmExecuteNodeLog = new BpmExecuteNodeLog(currentBpmExecuteNode);
+            iBpmExecuteNodeLogService.insertBpmExecuteNodeLog(bpmExecuteNodeLog);
         }
         //--- 2️⃣⚡️5️⃣ 当节点执行完成后修改节点的状态
         System.err.println("--- 2️⃣⚡️5️⃣ 当节点执行完成后修改节点的状态");
@@ -418,7 +421,8 @@ public class PreExecutionToolClass<R> {
                     iScriptEntity.setScriptNodeKey(taskNodeKey);
                     iScriptEntity.setImplementationName(script[i]);
                     // 调用执行节点
-                    if (!iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, bpmRunNodeVo)) {
+                    AjaxResult ajaxResult1 = iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, bpmRunNodeVo);
+                    if ((Boolean) ajaxResult1.get("isFlag")) {
                         // 判断脚本执行状态
                         return AjaxResult.error(HttpStatus.SCRIPTEXCEPTION, "节点后执行脚本失败!");
                     }
@@ -440,7 +444,8 @@ public class PreExecutionToolClass<R> {
             iScriptEntity.setScriptNodeKey(taskNodeKey);
             iScriptEntity.setImplementationName("commonEndEvent");  // 直接调用结束节点执行逻辑
             // 调用执行结束节点
-            if (!iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, iScriptEntity)) {
+            AjaxResult ajaxResult1 = iRunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity, bpmRunNodeVo);
+            if ((Boolean) ajaxResult1.get("isFlag")) {
                 // 判断脚本执行状态
                 return AjaxResult.error(HttpStatus.SCRIPTEXCEPTION, "流程结束失败!");
             }
@@ -459,7 +464,6 @@ public class PreExecutionToolClass<R> {
          *  主动调用的执行接口一定是手动触发的节点
          *  当手动触发节点后的下一个节点需要判断节点类型是否是自动执行的节点
          *
-         *
          *  自动执行节点程序自己调用 自动执行节点绑定的脚本。(递归执行)
          *  !!! 调用自动执行的脚本无法传递除特定参数外的其他用户业务表中的参数
          */
@@ -932,4 +936,4 @@ public class PreExecutionToolClass<R> {
     }
 
 
-}
+}

+ 90 - 7
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/runbpm/RunImplementationClass.java

@@ -1,18 +1,24 @@
 package com.zkqy.execution.produce.dispersed.runbpm;
 
 
+import cn.hutool.core.util.ObjectUtil;
 import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
 import com.zkqy.execution.produce.dispersed.entity.runbpm.BpmRunNodeFromVo;
 import com.zkqy.execution.produce.dispersed.entity.runbpm.IRunBPMEntity;
 import com.zkqy.execution.produce.dispersed.entity.runbpm.IScriptEntity;
+import com.zkqy.execution.produce.dispersed.service.DynamicJavaService;
 import com.zkqy.execution.produce.dispersed.service.IRunBPMService;
 import com.zkqy.execution.produce.dispersed.service.IScriptService;
+import com.zkqy.system.domain.SysBpmNodeScript;
+import com.zkqy.system.mapper.SysBpmNodeScriptMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.NoSuchBeanDefinitionException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
 import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -37,12 +43,53 @@ public class RunImplementationClass<J> {
 
     private static final Logger log = LoggerFactory.getLogger(RunImplementationClass.class);
 
+    @Autowired
+    private SysBpmNodeScriptMapper sysBpmNodeScriptMapper;
+
+    @Autowired
+    private DynamicJavaService dynamicJavaService;
+
     /**
      * @param iRunBPMEntity 节点执行参数
      * @return
      */
     @Transactional
     public AjaxResult RunBPMImplementationClassLogicCode(IRunBPMEntity iRunBPMEntity) {
+        //脚本动态加载逻辑(判断当前脚本是否存在于Spring容器当中)---如果不存在就进行编译+注入
+        //查询节点列表
+        SysBpmNodeScript sysBpmNodeScript = sysBpmNodeScriptMapper.
+                selectSysBpmNodeScriptByScriptKey(iRunBPMEntity.getImplementationName());
+        //如果未查询到节点列表
+        if(ObjectUtil.isNull(sysBpmNodeScript)){
+            return AjaxResult.error("未有此脚本信息");
+        }
+        //判断是新节点还是老节点
+        if (sysBpmNodeScript.getIsOld().equals("1")){ //新节点走删除bean,和更新bean的逻辑
+            if(applicationContext.containsBean(iRunBPMEntity.getImplementationName())){
+                //删除容器中
+                    // 获取 DefaultListableBeanFactory
+                ConfigurableApplicationContext configurableContext = (ConfigurableApplicationContext) applicationContext;
+                    // 获取 DefaultListableBeanFactory
+                DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) configurableContext.getBeanFactory();
+                beanFactory.removeBeanDefinition(iRunBPMEntity.getImplementationName());//移除某个Bean
+                //动态编译class文件进Spring 容器
+                String s = dynamicJavaService.loadAndRegisterJavaFile(iRunBPMEntity.getImplementationName());
+                if(s.equals(iRunBPMEntity.getImplementationName()+"未有此class文件")){
+                    return AjaxResult.error("未有此脚本");
+                }
+                if(s.equals(iRunBPMEntity.getImplementationName()+"注册失败")){
+                    return AjaxResult.error("脚本编译失败,请联系管理员");
+                }
+                System.out.println("编译成功");
+            }else { //如果容器中不存在就直接编译
+                //动态编译class文件进Spring 容器
+                String s = dynamicJavaService.loadAndRegisterJavaFile(iRunBPMEntity.getImplementationName());
+                if(s.equals(iRunBPMEntity.getImplementationName()+"注册失败")){
+                    return AjaxResult.error("脚本编译失败");
+                }
+                System.out.println("编译成功");
+            }
+        }
         AjaxResult ajaxResult = new AjaxResult(); // 节点逻辑执行完成返回提示
         if (applicationContext.containsBean(iRunBPMEntity.getImplementationName())) {
             IRunBPMService iRunBPMService = (IRunBPMService) applicationContext.getBean(iRunBPMEntity.getImplementationName(), IRunBPMService.class);
@@ -66,7 +113,7 @@ public class RunImplementationClass<J> {
             return ajaxResult;
         } else {
             log.error("Service not found for name: " + iRunBPMEntity.getImplementationName());
-            return AjaxResult.error("网络出现问题!请联系管理员!!!");
+            return AjaxResult.error("系统中未找到当前脚本信息请联系管理员!!!");
         }
     }
 
@@ -74,11 +121,46 @@ public class RunImplementationClass<J> {
     /**
      * @param iScriptEntity 定位执行脚本所需参数
      * @param parameter     脚本实现逻辑其他参数
+     *                      开始节点,节点前,节点后,结束脚本所用的
      * @return
      */
     @Transactional
-    public boolean RunScriptImplementationClassLogicCode(IScriptEntity iScriptEntity, J parameter) {
+    public AjaxResult RunScriptImplementationClassLogicCode(IScriptEntity iScriptEntity, J parameter) {
+        //脚本动态加载逻辑(判断当前脚本是否存在于Spring容器当中)---如果不存在就进行编译+注入
+        //查询节点列表
+        SysBpmNodeScript sysBpmNodeScript = sysBpmNodeScriptMapper.
+                selectSysBpmNodeScriptByScriptKey(iScriptEntity.getImplementationName());
+        //如果未查询到节点列表
+        if(ObjectUtil.isNull(sysBpmNodeScript)){
+            return AjaxResult.error("未有此脚本信息").put("isFlag",false);
+        }
+        //判断是新节点还是老节点
+        if (sysBpmNodeScript.getIsOld().equals("1")){ //新节点走删除bean,和更新bean的逻辑
+            if(applicationContext.containsBean(iScriptEntity.getImplementationName())){
+                //删除容器中
+                // 获取 DefaultListableBeanFactory
+                ConfigurableApplicationContext configurableContext = (ConfigurableApplicationContext) applicationContext;
+                // 获取 DefaultListableBeanFactory
+                DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) configurableContext.getBeanFactory();
+                beanFactory.removeBeanDefinition(iScriptEntity.getImplementationName());//移除某个Bean
+                //动态编译class文件进Spring 容器
+                String s = dynamicJavaService.loadAndRegisterJavaFile(iScriptEntity.getImplementationName());
+                if(s.equals(iScriptEntity.getImplementationName()+"注册失败")){
+                    return AjaxResult.error("脚本编译失败").put("isFlag",false);
+                }
+                System.out.println("编译成功");
+            }else { //如果容器中不存在就直接编译
+                //动态编译class文件进Spring 容器
+                String s = dynamicJavaService.loadAndRegisterJavaFile(iScriptEntity.getImplementationName());
+                if(s.equals(iScriptEntity.getImplementationName()+"注册失败")){
+                    return AjaxResult.error("脚本编译失败").put("isFlag",false);
+                }
+                System.out.println("编译成功");
+            }
+        }
+        //原本的判断逻辑如果存在就执行当去业务逻辑脚本
         if (applicationContext.containsBean(iScriptEntity.getImplementationName())) {
+            // 找到对应的脚本Bean
             IScriptService iScriptService = (IScriptService) applicationContext.getBean(iScriptEntity.getImplementationName(), IScriptService.class);
             // 校验当前需要执行的脚本是否存在
             if (iScriptService.isVerificationMethod()) {
@@ -88,13 +170,14 @@ public class RunImplementationClass<J> {
                     iScriptService.afterExecutionScript(parameter);
                 }
                 // 执行清理操作
-                return iScriptService.preDestroy();
+                boolean b = iScriptService.preDestroy();
+                return AjaxResult.success().put("isFlag",b);
             }
-            log.info("Service execution successful:" + iScriptEntity.getImplementationName());
-            return true;
+            log.info("业务执行成功:" + iScriptEntity.getImplementationName());
+            return AjaxResult.success().put("isFlag",true);
         } else {
-            log.error("Service not found for name: " + iScriptEntity.getImplementationName());
-            return false;
+            log.error("业务脚本未找到: " + iScriptEntity.getImplementationName());
+            return AjaxResult.success().put("isFlag",false);
         }
     }
 

+ 5 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/DynamicJavaService.java

@@ -0,0 +1,5 @@
+package com.zkqy.execution.produce.dispersed.service;
+
+public interface DynamicJavaService {
+    public String loadAndRegisterJavaFile(String javaScriptKey);
+}

+ 1 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/CommonServiceImpl.java

@@ -676,4 +676,4 @@ network:
   version: 2
   renderer: NetworkManager
 
- */
+ */

+ 70 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/DynamicJavaServiceImpl.java

@@ -0,0 +1,70 @@
+package com.zkqy.execution.produce.dispersed.service.impl;
+
+import com.zkqy.execution.produce.dispersed.service.DynamicJavaService;
+import com.zkqy.execution.produce.utilsPlus.DefaultPackageClassLoader;
+import com.zkqy.execution.produce.utilsPlus.DefaultPackageCompiler;
+import com.zkqy.execution.produce.utilsPlus.SpringBeanRegistrar;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+
+@Service
+@Slf4j
+public class DynamicJavaServiceImpl  implements DynamicJavaService {
+
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    @Value("${template.urluPload}")
+    private  String  javaFilePath;
+
+    /**
+     * 这里到到时候会传递java脚本的Key
+     * @param javaScriptKey
+     * @throws Exception
+     */
+    @Override
+    public String loadAndRegisterJavaFile(String javaScriptKey){
+        try {
+            //根据固定路径+ScriptKey来固定的编译对应Java脚本文件
+            StringBuffer stringBuffer=new StringBuffer();
+            stringBuffer.append(javaFilePath).append(javaScriptKey).append(".java");
+            String newJavaFilePath = stringBuffer.toString();
+            System.out.println(newJavaFilePath+"新路径");
+
+            // 1. 路径替换找到对应的class文件
+            String classFilePath = newJavaFilePath.replace(".java", ".class");
+            // 2.判断有我没有我对应的编译class文件
+            File file=new File(classFilePath);
+
+            if(!file.exists()){
+                return javaScriptKey+"未有此class文件";
+            }
+
+            // 2. 动态加载编译后的类
+            DefaultPackageClassLoader classLoader = new DefaultPackageClassLoader(this.getClass().getClassLoader());
+            Class<?> dynamicClass = classLoader.loadClassFromFile(classFilePath);
+            String beanName="";
+            // 检查类上是否有 @Component 注解
+            if (dynamicClass.isAnnotationPresent(Component.class)) {
+                Component componentAnnotation = dynamicClass.getAnnotation(Component.class);
+                beanName= componentAnnotation.value().isEmpty() ? dynamicClass.getSimpleName() : componentAnnotation.value();
+            }else {
+                // 3. 注册到 Spring 容器
+                beanName = dynamicClass.getSimpleName(); // 默认包中,类名就是简单名称
+            }
+            //注解bean到Spring容器中
+            SpringBeanRegistrar.registerBean(applicationContext, beanName, dynamicClass);
+            log.info("动态的Bean已经被注册了");
+            return javaScriptKey+"注册成功";
+        } catch (Exception e) {
+            return javaScriptKey+"注册失败";
+        }
+    }
+
+}

+ 31 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/DefaultPackageClassLoader.java

@@ -0,0 +1,31 @@
+package com.zkqy.execution.produce.utilsPlus;
+
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class DefaultPackageClassLoader extends ClassLoader{
+
+
+    public DefaultPackageClassLoader(ClassLoader parent) {
+        super(parent);
+    }
+
+    public Class<?> loadClassFromFile(String classFilePath) throws Exception {
+        File file = new File(classFilePath);
+        URL url = file.getParentFile().toURI().toURL();
+        URL[] urls = new URL[]{url};
+        // 使用 URLClassLoader 加载类
+        ClassLoader loader = new URLClassLoader(urls, this);
+        String className = getClassNameFromPath(classFilePath);
+
+        return loader.loadClass(className);
+    }
+
+
+
+    private String getClassNameFromPath(String filePath) {
+        // 默认包中,类名就是文件名去掉 ".class" 后缀
+        return new File(filePath).getName().replace(".class", "");
+    }
+}

+ 19 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/DefaultPackageCompiler.java

@@ -0,0 +1,19 @@
+package com.zkqy.execution.produce.utilsPlus;
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+
+public class DefaultPackageCompiler {
+    public static void compileJavaFile(String javaFilePath) throws Exception {
+        // 获取系统默认的 Java 编译器
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        if (compiler == null) {
+            throw new IllegalStateException("Java 编译器不可用,请确保使用的是 JDK 而非 JRE");
+        }
+        // 编译指定的 .java 文件
+        int result = compiler.run(null, null, null, javaFilePath);
+        if (result != 0) {
+            throw new RuntimeException("编译失败");
+        }
+    }
+}

+ 36 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/DynamicJavaService.java

@@ -0,0 +1,36 @@
+package com.zkqy.execution.produce.utilsPlus;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.ApplicationContext;
+import org.springframework.stereotype.Component;
+import org.springframework.stereotype.Service;
+
+@Service
+public class DynamicJavaService {
+
+    @Autowired
+    private ApplicationContext applicationContext;
+
+    public void loadAndRegisterJavaFile(String javaFilePath) throws Exception {
+        // 1. 动态编译 .java 文件
+        String classFilePath = javaFilePath.replace(".java", ".class");
+        DefaultPackageCompiler.compileJavaFile(javaFilePath);
+
+        // 2. 动态加载编译后的类
+        DefaultPackageClassLoader classLoader = new DefaultPackageClassLoader(this.getClass().getClassLoader());
+//        ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+        Class<?> dynamicClass = classLoader.loadClassFromFile(classFilePath);
+        String beanName="";
+        // 检查类上是否有 @Component 注解
+        if (dynamicClass.isAnnotationPresent(Component.class)) {
+            Component componentAnnotation = dynamicClass.getAnnotation(Component.class);
+            beanName= componentAnnotation.value().isEmpty() ? dynamicClass.getSimpleName() : componentAnnotation.value();
+        }else {
+            // 3. 注册到 Spring 容器
+            beanName = dynamicClass.getSimpleName(); // 默认包中,类名就是简单名称
+        }
+        SpringBeanRegistrar.registerBean(applicationContext, beanName, dynamicClass);
+
+        System.out.println("动态 Bean 已注册: " + beanName);
+    }
+}

+ 121 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/PlaceholderReplacer.java

@@ -0,0 +1,121 @@
+package com.zkqy.execution.produce.utilsPlus;
+
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public class PlaceholderReplacer {
+
+    // 组件id占位符
+    private static final String PLACEHOLDEROne = "${componentId}";
+
+    // 组件ID
+    private static final String COMPONENT_ID = "3c374962955748cab96865977f608af6";
+
+    // 类描述信息占位符
+    private  static  final  String PLACEHOLDERTwo="desc";
+
+    // 类描述信息
+    private  static  final  String PLACEHOLDERDesc="组装节点";
+
+
+
+    public static void main(String[] args) {
+        try {
+            // 文件路径
+            String filePath = "D:\\zkqy\\test\\AddAmmunitionPickingUp.java";
+
+            // 新文件路径(基于组件ID生成)
+            String newFilePath = "D:\\zkqy\\test\\" + COMPONENT_ID + ".java";
+
+            // 第一步:将注解中的内容替换为占位符
+            String filledContent = replaceWithPlaceholder(filePath);
+
+            // 第二步:将填充好的内容写入新文件
+            createNewFile(newFilePath, filledContent);
+
+            System.out.println("操作完成!");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 将注解中的内容替换为占位符
+     *
+     * @param filePath 文件路径
+     * @throws IOException 如果发生 I/O 错误
+     */
+    private static String replaceWithPlaceholder(String filePath) throws IOException {
+        // 读取文件内容
+        StringBuilder contentBuilder = new StringBuilder();
+        try (BufferedReader reader = Files.newBufferedReader(Paths.get(filePath))) {
+            String line;
+            while ((line = reader.readLine()) != null) {
+                if (line.contains("${componentId}")) {
+                    // 替换为占位符
+                    line = line.replace( PLACEHOLDEROne,COMPONENT_ID);
+                }
+                if(line.contains("@{desc}")){  //${desc}
+                    line = line.replace(PLACEHOLDERTwo,PLACEHOLDERDesc ); //${desc}---> 组装节点
+                }
+                contentBuilder.append(line).append(System.lineSeparator());
+            }
+        }
+
+//        // 写回文件
+//        try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(filePath))) {
+//            writer.write(contentBuilder.toString());
+//        }
+        return contentBuilder.toString();
+    }
+
+
+    /**
+     * 重命名文件
+     *
+     * @param originalFilePath 原始文件路径
+     * @param newFileName      新文件名
+     * @throws IOException 如果发生 I/O 错误
+     */
+    private static void renameFile(String originalFilePath, String newFileName) throws IOException {
+        File originalFile = new File(originalFilePath);
+        File newFile = new File(originalFile.getParent(), newFileName);
+
+        // 确保新文件名不冲突
+        if (!newFile.exists()) {
+            boolean success = originalFile.renameTo(newFile);
+            if (!success) {
+                throw new IOException("无法重命名文件");
+            }
+        } else {
+            throw new IOException("目标文件已存在:" + newFile.getAbsolutePath());
+        }
+    }
+
+
+    /**
+     * 创建新文件并将内容写入
+     *
+     * @param newFilePath 新文件路径
+     * @param content     要写入的内容
+     * @throws IOException 如果发生 I/O 错误
+     */
+    private static void createNewFile(String newFilePath, String content) throws IOException {
+        File newFile = new File(newFilePath);
+
+        // 确保父目录存在
+        if (!newFile.getParentFile().exists()) {
+            newFile.getParentFile().mkdirs();
+        }
+
+        // 写入内容到新文件
+        try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(newFilePath))) {
+            writer.write(content);
+        }
+    }
+
+}

+ 37 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utilsPlus/SpringBeanRegistrar.java

@@ -0,0 +1,37 @@
+package com.zkqy.execution.produce.utilsPlus;
+
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.support.DefaultListableBeanFactory;
+import org.springframework.beans.factory.support.RootBeanDefinition;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ConfigurableApplicationContext;
+
+public class SpringBeanRegistrar {
+    public static void registerBean(ApplicationContext context, String beanName, Class<?> clazz) throws Exception {
+        // 确保 ApplicationContext 是 ConfigurableApplicationContext 类型
+        if (!(context instanceof ConfigurableApplicationContext)) {
+            throw new IllegalArgumentException("上下文类型不支持动态注册 Bean");
+        }
+
+        // 获取 BeanFactory
+        ConfigurableListableBeanFactory beanFactory = ((ConfigurableApplicationContext) context).getBeanFactory();
+        // 检查 Bean 是否已存在
+        if (beanFactory.containsSingleton(beanName)) {
+            System.out.println("Bean with name '" + beanName + "' already exists. Skipping registration.");
+            return;
+        }
+        ConfigurableApplicationContext configurableApplicationContext = (ConfigurableApplicationContext) context;
+        DefaultListableBeanFactory beanFactory2 = (DefaultListableBeanFactory) configurableApplicationContext.getBeanFactory();
+        // 注册 BeanDefinition
+        RootBeanDefinition beanDefinition = new RootBeanDefinition(clazz);
+        beanDefinition.setScope("prototype"); // 设置作用域为 prototype
+        beanFactory2.registerBeanDefinition(beanName, beanDefinition);
+
+        // 列出所有 Bean 名称
+        String[] beanNames = context.getBeanDefinitionNames();
+        System.out.println("All Beans in the container:");
+        for (String name : beanNames) {
+            System.out.println(name);
+        }
+    }
+}

+ 86 - 58
zkqy-system/src/main/java/com/zkqy/system/domain/SysBpmNodeScript.java

@@ -6,7 +6,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
  * 流程节点脚本对象 sys_bpm_node_script
- * 
+ *
  * @author ruoyi
  * @date 2023-10-26
  */
@@ -17,9 +17,30 @@ public class SysBpmNodeScript extends BaseEntity
     /** 编号 */
     private Long id;
 
+    private String tenantId;
+
+    private  String isOld;
+
     /** 脚本编码 */
     private String scriptKey;
 
+    private  String  pageUpload;
+
+    public String getPageUpload() {
+        return pageUpload;
+    }
+
+    public void setPageUpload(String pageUpload) {
+        this.pageUpload = pageUpload;
+    }
+
+    /**
+     * 脚本状态
+     */
+    private String scriptState;
+
+
+
     /** 脚本方法名称 */
     private String scriptFunctionName;
 
@@ -32,6 +53,9 @@ public class SysBpmNodeScript extends BaseEntity
     /** 脚本类型 */
     private Long scriptType;
 
+    /** 表名 */
+    private String tableName;
+
     /** 脚本描述 */
     private String scriptDescription;
 
@@ -41,72 +65,92 @@ public class SysBpmNodeScript extends BaseEntity
     /** 删除标志(0:否;1:是) */
     private String delFlag;
 
-    public void setId(Long id) 
-    {
+    public Long getId() {
+        return id;
+    }
+
+    public String getIsOld() {
+        return isOld;
+    }
+
+    public void setIsOld(String isOld) {
+        this.isOld = isOld;
+    }
+
+    public void setId(Long id) {
         this.id = id;
     }
 
-    public Long getId() 
-    {
-        return id;
+    public String getTenantId() {
+        return tenantId;
     }
-    public void setScriptKey(String scriptKey) 
-    {
-        this.scriptKey = scriptKey;
+
+    public void setTenantId(String tenantId) {
+        this.tenantId = tenantId;
     }
 
-    public String getScriptKey() 
-    {
+    public String getScriptKey() {
         return scriptKey;
     }
-    public void setScriptFunctionName(String scriptFunctionName) 
-    {
-        this.scriptFunctionName = scriptFunctionName;
+
+    public void setScriptKey(String scriptKey) {
+        this.scriptKey = scriptKey;
     }
 
-    public String getScriptFunctionName() 
-    {
+    public String getScriptState() {
+        return scriptState;
+    }
+
+    public void setScriptState(String scriptState) {
+        this.scriptState = scriptState;
+    }
+
+    public String getScriptFunctionName() {
         return scriptFunctionName;
     }
-    public void setScriptName(String scriptName) 
-    {
-        this.scriptName = scriptName;
+
+    public void setScriptFunctionName(String scriptFunctionName) {
+        this.scriptFunctionName = scriptFunctionName;
     }
 
-    public String getScriptName() 
-    {
+    public String getScriptName() {
         return scriptName;
     }
-    public void setScriptFunctionCode(String scriptFunctionCode) 
-    {
-        this.scriptFunctionCode = scriptFunctionCode;
+
+    public void setScriptName(String scriptName) {
+        this.scriptName = scriptName;
     }
 
-    public String getScriptFunctionCode() 
-    {
+    public String getScriptFunctionCode() {
         return scriptFunctionCode;
     }
-    public void setScriptType(Long scriptType) 
-    {
-        this.scriptType = scriptType;
+
+    public void setScriptFunctionCode(String scriptFunctionCode) {
+        this.scriptFunctionCode = scriptFunctionCode;
     }
 
-    public Long getScriptType() 
-    {
+    public Long getScriptType() {
         return scriptType;
     }
-    public void setScriptDescription(String scriptDescription) 
-    {
-        this.scriptDescription = scriptDescription;
+
+    public void setScriptType(Long scriptType) {
+        this.scriptType = scriptType;
+    }
+
+    public String getTableName() {
+        return tableName;
     }
 
-    public String getScriptDescription() 
-    {
+    public void setTableName(String tableName) {
+        this.tableName = tableName;
+    }
+
+    public String getScriptDescription() {
         return scriptDescription;
     }
-    public void setDelFlag(String delFlag) 
-    {
-        this.delFlag = delFlag;
+
+    public void setScriptDescription(String scriptDescription) {
+        this.scriptDescription = scriptDescription;
     }
 
     public String getIndustryType() {
@@ -117,27 +161,11 @@ public class SysBpmNodeScript extends BaseEntity
         this.industryType = industryType;
     }
 
-    public String getDelFlag()
-    {
+    public String getDelFlag() {
         return delFlag;
     }
 
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("scriptKey", getScriptKey())
-            .append("scriptFunctionName", getScriptFunctionName())
-            .append("scriptName", getScriptName())
-            .append("scriptFunctionCode", getScriptFunctionCode())
-            .append("scriptType", getScriptType())
-            .append("scriptDescription", getScriptDescription())
-            .append("industryType",getIndustryType())
-            .append("delFlag", getDelFlag())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .toString();
+    public void setDelFlag(String delFlag) {
+        this.delFlag = delFlag;
     }
 }

+ 18 - 8
zkqy-system/src/main/java/com/zkqy/system/mapper/SysBpmNodeScriptMapper.java

@@ -5,15 +5,15 @@ import com.zkqy.system.domain.SysBpmNodeScript;
 
 /**
  * 流程节点脚本Mapper接口
- * 
+ *
  * @author ruoyi
  * @date 2023-10-26
  */
-public interface SysBpmNodeScriptMapper 
+public interface SysBpmNodeScriptMapper
 {
     /**
      * 查询流程节点脚本
-     * 
+     *
      * @param id 流程节点脚本主键
      * @return 流程节点脚本
      */
@@ -21,7 +21,7 @@ public interface SysBpmNodeScriptMapper
 
     /**
      * 查询流程节点脚本列表
-     * 
+     *
      * @param sysBpmNodeScript 流程节点脚本
      * @return 流程节点脚本集合
      */
@@ -29,7 +29,7 @@ public interface SysBpmNodeScriptMapper
 
     /**
      * 新增流程节点脚本
-     * 
+     *
      * @param sysBpmNodeScript 流程节点脚本
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface SysBpmNodeScriptMapper
 
     /**
      * 修改流程节点脚本
-     * 
+     *
      * @param sysBpmNodeScript 流程节点脚本
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface SysBpmNodeScriptMapper
 
     /**
      * 删除流程节点脚本
-     * 
+     *
      * @param id 流程节点脚本主键
      * @return 结果
      */
@@ -53,13 +53,23 @@ public interface SysBpmNodeScriptMapper
 
     /**
      * 批量删除流程节点脚本
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     int deleteSysBpmNodeScriptByIds(Long[] ids);
 
+    /**
+     * 根据脚本key查询脚本信息
+     * @param scriptKey
+     * @return
+     */
     SysBpmNodeScript selectSysBpmNodeScriptByScriptKey(String scriptKey);
 
+    /**
+     * 根据脚本key 查询脚本列表
+     * @param scriptKeys
+     * @return
+     */
     List<SysBpmNodeScript> selectSysBpmNodeScriptByScriptKeys(List<String> scriptKeys);
 }

+ 15 - 8
zkqy-system/src/main/resources/mapper/system/SysBpmNodeScriptMapper.xml

@@ -3,8 +3,8 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.system.mapper.SysBpmNodeScriptMapper">
-    
-    <resultMap type="SysBpmNodeScript" id="SysBpmNodeScriptResult">
+
+    <resultMap type="com.zkqy.system.domain.SysBpmNodeScript" id="SysBpmNodeScriptResult">
         <result property="id"    column="id"    />
         <result property="scriptKey"    column="script_key"    />
         <result property="scriptFunctionName"    column="script_function_name"    />
@@ -18,13 +18,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"    column="create_time"    />
         <result property="updateBy"    column="update_by"    />
         <result property="updateTime"    column="update_time"    />
+        <result property="scriptState"    column="script_state"    />
+        <result property="tenantId"    column="tenant_id"    />
+        <result property="pageUpload"    column="page_upload"    />
+        <result property="isOld" column="is_old"/>
     </resultMap>
 
     <sql id="selectSysBpmNodeScriptVo">
-        select id, script_key, script_function_name, script_name, script_function_code, script_type, script_description, industry_type, del_flag, create_by, create_time, update_by, update_time from sys_bpm_node_script
+        select id, script_key, script_function_name, script_name, script_function_code, script_type,
+               script_description, industry_type, del_flag, create_by, create_time, update_by, update_time,
+               tenant_id,script_state,tenant_id,page_upload,is_old
+        from sys_bpm_node_script
     </sql>
 
-    <select id="selectSysBpmNodeScriptList" parameterType="SysBpmNodeScript" resultMap="SysBpmNodeScriptResult">
+    <select id="selectSysBpmNodeScriptList" parameterType="com.zkqy.system.domain.SysBpmNodeScript" resultMap="SysBpmNodeScriptResult">
         <include refid="selectSysBpmNodeScriptVo"/>
         where del_flag = '0'
             <if test="scriptKey != null  and scriptKey != ''"> and script_key = #{scriptKey}</if>
@@ -36,13 +43,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="industryType != null"> and industry_type = #{industryType}</if>
              order by create_time desc
     </select>
-    
+
     <select id="selectSysBpmNodeScriptById" parameterType="Long" resultMap="SysBpmNodeScriptResult">
         <include refid="selectSysBpmNodeScriptVo"/>
         where id = #{id}
     </select>
 
-    <insert id="insertSysBpmNodeScript" parameterType="SysBpmNodeScript" useGeneratedKeys="true" keyProperty="id">
+    <insert id="insertSysBpmNodeScript" parameterType="com.zkqy.system.domain.SysBpmNodeScript" useGeneratedKeys="true" keyProperty="id">
         insert into sys_bpm_node_script
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="scriptKey != null">script_key,</if>
@@ -70,7 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
     </insert>
 
-    <update id="updateSysBpmNodeScript" parameterType="SysBpmNodeScript">
+    <update id="updateSysBpmNodeScript" parameterType="com.zkqy.system.domain.SysBpmNodeScript">
         update sys_bpm_node_script
         <trim prefix="SET" suffixOverrides=",">
             <if test="scriptKey != null">script_key = #{scriptKey},</if>
@@ -109,4 +116,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{scriptKey}
         </foreach>
     </select>
-</mapper>
+</mapper>

+ 1 - 0
zkqy-ui/package.json

@@ -107,6 +107,7 @@
     "vue-quill-editor": "^3.0.6",
     "vue-router": "3.4.9",
     "vue2-ace-editor": "^0.0.15",
+    "vue3-sfc-loader": "^0.9.5",
     "vuedraggable": "2.24.3",
     "vuex": "3.6.0",
     "vuex-persistedstate": "^4.1.0",

+ 19 - 0
zkqy-ui/src/api/bpmprocess/run/executeProcess.js

@@ -9,6 +9,25 @@ export function listProcess(query) {
   })
 }
 
+// 查询当前节点是新节点还是老节点
+export function queryCurrentNodeType(query) {
+  return request({
+    url: '/system/script/queryCurrentNode',
+    method: 'get',
+    params: query
+  })
+}
+//查询当前节点表单的单文件页面
+// 查询流程执行任务表列表
+export function getVueHtml(query) {
+  return request({
+    url: '/PageParsing/getVueHtml',
+    method: 'get',
+    params: query
+  })
+}
+
+
 // 查询流程执行任务表详细
 export function getProcess(id) {
   return request({

+ 12 - 0
zkqy-ui/src/api/tablelist/commonTable.js

@@ -389,6 +389,18 @@ export function oldNoticeOutStorage(data) {
   })
 }
 
+export function checkOldInventory(data) {
+  return request({
+    url: '/system/ProductInventory/checkOldInventory',
+    method: 'post',
+    data: data,
+    timeout: 1000000000, // 设置超时时间为5秒
+    //baseURL: process.env.VUE_APP_BASE_API1
+  })
+}
+
+
+
 // 订单管理  打印出库单  获取详情接口
 export function outboundOrderInfo(data) {
   return request({

+ 2 - 4
zkqy-ui/src/utils/request.js

@@ -87,9 +87,6 @@ service.interceptors.response.use(res => {
       }).then(() => {
         isRelogin.show = false;
         store.dispatch('LogOut')
-        // .then(() => {
-        //   location.href = '/index';
-        // })
       }).catch(() => {
         isRelogin.show = false;
       });
@@ -101,7 +98,8 @@ service.interceptors.response.use(res => {
       Message({ message: msg, type: 'error' })
       return Promise.reject(new Error(msg))
     } else {
-      return Promise.reject('code:500')
+      Message({ message: msg, type: 'error' })
+      return Promise.reject(new Error(msg))
     }
 
   } else if (code === 601) {

+ 832 - 0
zkqy-ui/src/views/amichi/dialogCompments/processMange - 副本.vue

@@ -0,0 +1,832 @@
+<template>
+  <div class="process-mange-wrap">
+    <!-- <el-card shadow="always" :body-style="{ padding: '20px' }"> -->
+    <el-row>
+      <el-col :xs="24" :md="8" :xl="8" class="col">
+        <div class="statistic-wrap">
+          <div class="discription">
+            <span class="title">已完成</span>
+            <span class="sub-title">已经完成的生产任务数</span>
+          </div>
+          <span class="data">{{ doneNum }}</span>
+        </div>
+      </el-col>
+      <el-col :xs="24" :md="8" :xl="8" class="col">
+        <div class="statistic-wrap">
+          <div class="discription">
+            <span class="title">进行中</span>
+            <span class="sub-title">正在进行的生产任务数</span>
+          </div>
+          <span class="data">{{ doingNum }}</span>
+        </div>
+      </el-col>
+      <!-- <el-col :xs="24" :md="8" :xl="8" class="col">
+        <div class="statistic-wrap">
+          <div class="discription">
+            <span class="title">完成</span>
+            <span class="sub-title">已经完成的管道</span>
+          </div>
+          <span class="data">0</span>
+        </div>
+      </el-col> -->
+    </el-row>
+    <!-- </el-card> -->
+    <div class="main-area">
+      <div class="show-header">
+        <h3 class="header">流程列表</h3>
+        <div class="search-list">
+          <div class="search-tab">
+            <el-radio-group v-model="taskType" v-show="false">
+              <el-radio-button :label="1">我的处理</el-radio-button>
+              <el-radio-button :label="2">其他处理</el-radio-button>
+            </el-radio-group>
+            <el-radio-group
+              class="btn-list-two"
+              v-model="queryParams.taskProcessState"
+              @change="getList"
+            >
+              <el-radio-button label="3">已完成</el-radio-button>
+              <el-radio-button label="0">进行中</el-radio-button>
+              <!-- <el-radio-button label="">所有</el-radio-button> -->
+            </el-radio-group>
+          </div>
+          <div class="search-input">
+            <el-input
+              placeholder="请输入..."
+              v-model="queryString"
+              @keyup.enter.native="getList"
+            >
+              <el-button
+                slot="append"
+                icon="el-icon-search"
+                @click="getList"
+              ></el-button>
+            </el-input>
+          </div>
+        </div>
+      </div>
+      <div class="show-body">
+        <!--    流程任务列表    -->
+        <el-table :data="tableData" v-loading="loading" border stripe>
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column type="index" width="50" align="center" />
+          <el-table-column
+            v-for="col in newColumn"
+            :prop="col.prop"
+            :key="col.prop"
+            :label="col.label"
+            align="center"
+          >
+            <template slot-scope="scope">
+              <span v-if="col.prop == 'benCreateTime'">{{
+                scope.row.benCreateTime.replace("T", " ")
+              }}</span>
+              <span v-else-if="col.prop == 'bepTaskProcessType'">{{
+                getDictLabel(scope.row.bepTaskProcessType, dict.type.bpm_type)
+              }}</span>
+              <span v-else-if="col.prop == 'benTaskNodeState'">{{
+                scope.row.benTaskNodeState == "0" ? "未执行" : "已执行"
+              }}</span>
+              <span v-else-if="col.prop == 'bepTaskProcessState'">{{
+                getDictLabel(
+                  scope.row.bepTaskProcessState,
+                  dict.type.task_process_state
+                )
+              }}</span>
+              <span v-else>{{ scope.row[col.prop] }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" align="center">
+            <template slot-scope="scope">
+              <div class="excute-wrap">
+                <el-button
+                  type="warning"
+                  plain
+                  size="small"
+                  class="mr10 mb5"
+                  v-show="scope.row.bepTaskProcessState == '0'"
+                  @click="opneExecuteNode(scope.row)"
+                >
+                  运行
+                </el-button>
+<!--                <el-dropdown>-->
+<!--                  <el-button type="warning" plain size="small">-->
+<!--                    处理<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+<!--                  </el-button>-->
+<!--                  <el-dropdown-menu slot="dropdown">-->
+<!--                    &lt;!&ndash; <el-dropdown-item>-->
+<!--                      <el-button-->
+<!--                        size="mini"-->
+<!--                        type="text"-->
+<!--                        icon="el-icon-edit"-->
+<!--                        @click="excuteHandler(scope.row)"-->
+<!--                        v-hasPermi="['system:user:edit']"-->
+<!--                      >处理-->
+<!--                      </el-button>-->
+<!--                    </el-dropdown-item> &ndash;&gt;-->
+<!--                    <el-dropdown-item   v-if="scope.row.exceptionScriptList && scope.row.exceptionScriptList.length">-->
+<!--                      <el-dropdown size="mini">-->
+<!--                        <el-button size="mini" type="text" icon="el-icon-d-arrow-right">触发异常</el-button>-->
+<!--                        <el-dropdown-menu slot="dropdown">-->
+<!--                                  <el-dropdown-item-->
+<!--                                    v-for="item in scope.row.exceptionScriptList" :key="item.id">-->
+<!--                                    <el-button @click="exceptionTrigger(scope.row, item)" size="mini" type="text">{{ item.scriptName }}</el-button>-->
+<!--                                  </el-dropdown-item>-->
+<!--                        </el-dropdown-menu>-->
+<!--                      </el-dropdown>-->
+<!--                    </el-dropdown-item>-->
+<!--                  </el-dropdown-menu>-->
+<!--                </el-dropdown>-->
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <!--    分页    -->
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </div>
+
+      <div class="show-window">
+        <!-- 运行节点弹窗 -->
+
+        <el-dialog :title="nodeTitle" :visible.sync="open">
+          <!--  <el-form label-width="100px" :model="commonData">
+            <h1>这里会引入当前节点需要处理的表单</h1>
+          </el-form> -->
+          <!-- <k-form-build
+            v-if="formType == 'dragForm'"
+            class="formBuild"
+            ref="addFromRef"
+            :dynamicData="dynamicData"
+            :defaultValue="defaultValue"
+            :value="jsonData"
+          /> -->
+
+            <component
+              :is="myForm"
+              :formData="formData"
+              :row="row"
+              :timestamp="timestamp"
+              ref="myFormRef"
+              v-if="myForm"
+            ></component>
+
+          <!-- <Sorting ref="myFormRef" :formData="formData" :row="row"></Sorting> -->
+<!--         <NodeInStorage-->
+<!--            :formData="formData"-->
+<!--            :row="row"-->
+<!--          ></NodeInStorage>-->
+
+          <span slot="footer" class="dialog-footer" style="margin-top: 60px">
+            <el-button @click="closeExecuteNode">取消</el-button>
+            <el-button type="primary" @click="executeNode">确认运行</el-button>
+          </span>
+        </el-dialog>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import {
+  processList,
+  runProcessNodeExecution,
+  getProcessNodeFormTemplate,
+  getProcessNodeFormInfoData,
+} from "@/api/bpmprocess/run/executeProcess";
+import { triggerExceptionNode } from "@/api/bpmprocess/process";
+
+import getNodeSequence from "@/utils/bpmn/getNodeSequence";
+import GY02 from "./dialogCompments/GongYi/GY02.vue";
+import ZL01 from "./dialogCompments/ZhiLiang/ZL1.vue";
+import { getForm } from "@/api/dragform/form";
+import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
+
+// 弹窗表单组件
+import GY01 from "./dialogCompments/GongYi/GY01.vue";
+import GY03 from "./dialogCompments/GongYi/GY03.vue";
+import CG1 from "./dialogCompments/test-component/CaiGou/CG1.vue";
+import CG02 from "./dialogCompments/test-component/CaiGou/CG02.vue";
+import KC01 from "./dialogCompments/test-component/KuCun/KC1.vue";
+import KC02 from "./dialogCompments/test-component/KuCun/KC02.vue";
+import GY06 from "./dialogCompments/GongYi/GY06.vue";
+import KB01 from "./dialogCompments/KongBai/KB01.vue"; //空白提示组件
+import SC01 from "./dialogCompments/ShengChan/SC01.vue";
+
+import Loading from "./dialogCompments/Edu/Loading.vue";
+import Processing from "./dialogCompments/Edu/Processing.vue";
+import Assemble from "./dialogCompments/Edu/Assemble.vue";
+import Detection from "./dialogCompments/Edu/Detection.vue";
+import WareHousing from "./dialogCompments/Edu/WareHousing.vue";
+
+//Mec组件
+import AssignEmployees from "./dialogCompments/Mec/AssignEmployees.vue";
+import Notes from "./dialogCompments/Mec/Notes.vue";
+import Print from "./dialogCompments/Mec/Print.vue";
+import NodeShow from "./dialogCompments/Mec/NodeShow.vue";
+import RecordQuality from "./dialogCompments/Mec/RecordQuality.vue";
+import ProductionProcesses from "./dialogCompments/Mec/ProductionProcesses.vue";
+import PersonalDistribution from "./dialogCompments/Mec/PersonalDistribution.vue";
+import RecordSplitData from "./dialogCompments/Mec/RecordSplitData.vue";
+import EditFinishTime from "./dialogCompments/Mec/EditFinishTime.vue";
+import EditQualityCard from "./dialogCompments/Mec/EditQualityCard.vue";
+import FinishTask from "./dialogCompments/Mec/FinishTask.vue";
+import QualityControlCardSubCardProcessing from "./dialogCompments/Mec/QualityControlCardSubCardProcessing.vue";
+import ScrapDisposition from "./dialogCompments/Mec/ScrapDisposition.vue";
+
+import QRCode from "./dialogCompments/Mec/QRCode.vue";
+import Inspect from "./dialogCompments/GongYi/Inspect.vue";
+
+// 物理指标
+import PhysicalInspection from "./dialogCompments/GongYi/PhysicalInspection.vue";
+// 外观指标
+import AppearanceInspection from "./dialogCompments/GongYi/AppearanceInspection.vue";
+//
+import Sorting from "./dialogCompments/GongYi/Sorting.vue";
+import UpSilk from "./dialogCompments/GongYi/UpSilk.vue";
+
+
+
+//节点报工
+import NodeReport from "@/views/amichi/dialogCompments/NodeReport.vue";
+//节点报工
+import NodeInStorage from "@/views/amichi/dialogCompments/NodeInStorage.vue";
+
+export default {
+  name: "processMange",
+  props: [],
+  components: {
+    GY01,
+    DialogTemplate,
+    CG1,
+    CG02,
+    KC01,
+    GY06,
+    GY03,
+    KC02,
+    GY02,
+    KB01,
+    SC01,
+    ZL01,
+    NodeShow,
+    AssignEmployees,
+    Notes,
+    Print,
+    RecordQuality,
+    ProductionProcesses,
+    PersonalDistribution,
+    RecordSplitData,
+    EditFinishTime,
+    EditQualityCard,
+    FinishTask,
+    QualityControlCardSubCardProcessing,
+    ScrapDisposition,
+    QRCode,
+    Inspect,
+    Loading,
+    Processing,
+    Assemble,
+    Detection,
+    WareHousing,
+    PhysicalInspection,
+    AppearanceInspection,
+    Sorting, //分拣
+    UpSilk, //上丝
+    NodeReport,//节点报工
+    NodeInStorage,//节点入库
+  },
+  dicts: ["bpm_type", "task_process_state"],
+  data() {
+    return {
+      timestamp: new Date().getTime(),//时间戳
+      doneNum: 0, //已完成数
+      doingNum: 0, //进行中数
+      row: {}, //当前操作行数据
+      myForm: "", //自定义表单组件名
+      // 节点弹窗title
+      nodeTitle: "节点弹窗",
+      open: false,
+      // 节点弹窗对应的formData
+      commonData: {},
+      taskType: 1,
+      queryString: "",
+      taskStatus: "",
+      tableData: [], //表格数据
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        taskProcessState: "0",
+        taskProcessType: 0,
+      },
+      total: 0,
+      columns: [
+        {
+          prop: "bepTaskKey",
+          label: "任务编号",
+        },
+        {
+          prop: "bepTaskName",
+          label: "任务名称",
+        },
+        // {
+        //   prop: "bepTaskProcessType",
+        //   label: "任务流程类型",
+        // },
+        {
+          prop: "bepTaskProcessState",
+          label: "任务流程状态",
+        },
+        {
+          prop: "benTaskNodeName",
+          label: "节点名称",
+        },
+        {
+          prop: "benTaskNodeType",
+          label: "节点类型",
+        },
+        {
+          prop: "benTaskNodeState",
+          label: "节点状态",
+        },
+        {
+          prop: "benCreateBy",
+          label: "创建人",
+        },
+        {
+          prop: "benCreateTime",
+          label: "创建时间",
+        },
+      ],
+      formType: "", //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单   designForm:定制表单
+      // k-form-build 数据
+      dynamicData: {},
+      tableName: "",
+      defaultValue: {},
+      jsonData: {},
+      // 拖拽数据
+      taskInfo: {},
+      groupKey: "",
+      subCount: {},
+      tableCount: {},
+      subTableName: "",
+
+      // 弹窗表单渲染数据
+      formData: {},
+      backExceptionTaskList: ["GY06"], //特殊回退表单组件列表
+      loading: true,
+    };
+  },
+  computed: {
+    newColumn() {
+      if (this.queryParams.taskProcessState == "3") {
+        return [
+          {
+            prop: "bepTaskKey",
+            label: "任务编号",
+          },
+          {
+            prop: "bepTaskName",
+            label: "任务名称",
+          },
+          // {
+          //   prop: "bepTaskProcessType",
+          //   label: "任务流程类型",
+          // },
+          {
+            prop: "bepTaskProcessState",
+            label: "任务流程状态",
+          },
+          {
+            prop: "benCreateBy",
+            label: "创建人",
+          },
+          {
+            prop: "benCreateTime",
+            label: "创建时间",
+          },
+        ];
+      } else {
+        return this.columns;
+      }
+    },
+  },
+  mounted() {
+    this.getList();
+    this.getDoneNumber();
+    this.getDoingNumber();
+  },
+  methods: {
+    // 获取列表数据
+    getList() {
+      this.loading = true;
+      processList({ ...this.queryParams, taskName: this.queryString })
+        .then((res) => {
+          if (res.code == 200) {
+            this.tableData = res.rows.map((item) => item.resultMap);
+            this.total = res.total;
+            console.log(this.tableData);
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+          this.loading = false;
+        })
+        .finally((e) => {
+          console.log(e);
+          this.loading = false;
+        });
+    },
+    getDoneNumber() {
+      let params = {
+        pageNum: 1,
+        pageSize: 10,
+        taskProcessState: "3",
+        taskProcessType: 0,
+      };
+      processList(params)
+        .then((res) => {
+          if (res.code == 200) {
+            this.doneNum = res.total;
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+        })
+        .finally((e) => {
+          console.log(e);
+          this.loading = false;
+        });
+    },
+    getDoingNumber() {
+      let params = {
+        pageNum: 1,
+        pageSize: 10,
+        taskProcessState: "0",
+        taskProcessType: 0,
+      };
+      processList(params)
+        .then((res) => {
+          if (res.code == 200) {
+            this.doingNum = res.total;
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+        })
+        .finally((e) => {
+          console.log(e);
+          this.loading = false;
+        });
+    },
+    // 获取表单数据
+    async getFormData() {
+      let formData = {};
+      // switch (this.formType) {
+      //   case "dragForm":
+      //     try {
+      //       formData = await this.$refs.addFromRef.getData();
+      //     } catch (error) {
+      //       console.log(error);
+      //       this.$message.error("表单校验异常,请稍后重试");
+      //       return {};
+      //     }
+      //     break;
+      //   case "designForm":
+      //     let temp = await this.$refs.myFormRef.getFormData();
+      //     if (!temp.flag) {
+      //       this.$message.error(temp.msg);
+      //       return {};
+      //     } else {
+      //       formData = temp.data;
+      //     }
+      //     break;
+      //   default:
+      //     break;
+      // }
+      let temp = await this.$refs.myFormRef?.getFormData();
+      console.log("temp", temp);
+      if (!temp?.flag) {
+        if (!temp) {
+          //没有表单
+          // formData.flag = true;
+        } else {
+          //表单数据不合法
+          this.$message.error(temp.msg);
+          return false;
+        }
+      } else {
+        formData = temp.data;
+      }
+      return formData;
+    },
+    // 重置弹窗数据
+    resetDialogForm() {
+      this.formType = ""; //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单   designForm:定制表单
+      // k-form-build 数据
+      this.dynamicData = {};
+      this.defaultValue = {};
+      this.jsonData = {};
+    },
+    // 打开运行节点弹窗
+    async opneExecuteNode(row) {
+      this.timestamp = new Date().getTime();//更新时间戳
+      this.resetDialogForm();
+      console.log(row);
+      this.nodeTitle = row.benTaskNodeName;
+      // let preFix = row.benTaskNodeName.split("-")[0];
+      let preFix = row.benTaskNodeFormKey;
+      let {
+        benTaskNodeFormKey,
+        benTaskNodeFormType,
+        bepTaskPlanKey,
+        bepTaskKey,
+        bepTaskNodeKey,
+        benTaskProcessKey,
+        benmTaskAutomaticScriptTriggerType,
+        bepTaskNodeNextKey,
+      } = row;
+      // 新的运行逻辑
+      let payLoad = {
+        taskNodeKey: bepTaskNodeNextKey,
+        taskProcessKey: benTaskProcessKey,
+        taskAutomaticScriptTriggerType: benmTaskAutomaticScriptTriggerType,
+        taskPlanKey: bepTaskPlanKey,
+      };
+
+      // let formData = await getProcessNodeFormTemplate(payLoad);
+      // console.log(formData);
+      // if (benTaskNodeFormKey) {
+      //   if (benTaskNodeFormType == "dragForm") {
+      //     let templateInfo = formData.data[0]?.template;
+      //     //拖拽表单
+      //     this.formType = "dragForm";
+      //     this.jsonData = JSON.parse(templateInfo.dfVueTemplate);
+      //     this.tableName = templateInfo.dfTableName;
+      //     if (Object.keys(JSON.parse(templateInfo.dfFormSql)).length) {
+      //       this.dynamicData = JSON.parse(templateInfo.dfFormSql);
+      //     }
+      //     // await this.getDragFormInfo(benTaskNodeFormKey);
+      //   } else if (benTaskNodeFormType == "composeForm") {
+      //     //工艺组合表单
+      //     this.formType = "composeForm";
+      //     this.groupKey = benTaskNodeFormKey;
+      //     let queryPayload = {
+      //       row,
+      //       groupKey: benTaskNodeFormKey,
+      //     };
+      //     this.$nextTick(() => {
+      //       this.$refs.dialogRef.getLists(queryPayload);
+      //     });
+      //   }
+      // } else if (preFix) {
+      //   //定制表单
+      //   this.formType = "designForm";
+      //   this.myForm = preFix;
+      // }
+      //定制表单
+      this.formType = "designForm";
+      this.myForm = preFix;
+      let res = await getProcessNodeFormInfoData(payLoad);
+      if (res.code == 200) {
+        this.formData = res.data;
+      } else {
+        this.$message.error("网络异常,请稍后再试");
+      }
+
+      this.row = row; //记录当前行数据
+      // if (!this.formType) return; //没有表单,直接掉运行逻辑
+      this.open = true; // 打开弹窗
+      this.$nextTick(() => {
+        // this.$refs.myFormRef?.resetForm();
+      });
+      // 根据当前节点绑定的表单信息查询对应的表单进行展示
+    },
+    // 运行节点按钮 确认运行回调
+    async executeNode() {
+      let { benTaskNodeKey, bepTaskProcessXmlContent, implementationName } =
+        this.row;
+      let { nodeId, nextNodeId } = this.getNextNodeKey(
+        benTaskNodeKey,
+        bepTaskProcessXmlContent
+      );
+      // 只有完成状态的可以运行
+      if (this.formType == "composeForm") {
+        let res = this.$refs.dialogRef.getComposeFormData();
+        if (!res.isSuccess) {
+          this.$message.warning("非完成状态节点不能运行!");
+          return;
+        }
+      }
+      // return;
+      let formData = await this.getFormData();
+      if (!formData) return;
+      formData.taskPlanKey = this.row.bepTaskPlanKey;
+      let payLoad = {
+        taskProcessKey: this.row.bepTaskKey, //当前任务流程编码
+        taskNodeKey: nodeId, //当前执行节点唯一编码
+        nextNodeKey: nextNodeId, //下一节点编码
+        implementationName: this.row.benmTaskAutomaticScriptTriggerType, //当前节点绑定的脚本名
+        // taskProcessXmlContent: this.row.bepTaskProcessXmlContent, //当前流程xml
+        tableName: this.tableName,
+        formDataMapString: JSON.stringify(formData), //自定义表单组件收集的表单数据
+        taskNodeType: this.backExceptionTaskList.includes(
+          this.row.benTaskNodeFormKey
+        )
+          ? "backExceptionTask"
+          : this.row.benTaskNodeType,
+      };
+      let fileXML = new File(
+        [this.row.bepTaskProcessXmlContent],
+        this.row.bepTaskKey + ".bpmn",
+        {
+          type: "text/bpmn",
+        }
+      );
+      const subformData = new FormData();
+      subformData.append("fileXML", fileXML);
+      for (let key in payLoad) {
+        subformData.append(key, payLoad[key] == null ? "" : payLoad[key]);
+      }
+      runProcessNodeExecution(subformData).then((res) => {
+        if (res.code == 200) {
+          this.$message.success("运行成功!");
+          this.getList();
+          this.getDoneNumber();
+          this.getDoingNumber();
+          this.open = false;
+        }
+      });
+    },
+    // 获取拖拽表单数据
+    async getDragFormInfo(fid) {
+      try {
+        let res = await getForm(fid);
+        console.log(res);
+        if (res.code == 200) {
+          this.jsonData = JSON.parse(res.data.dfVueTemplate);
+          this.tableName = res.data.dfTableName;
+          if (res.data.dfFormSql) {
+            this.dynamicData = JSON.parse(res.data.dfFormSql);
+            console.log(this.dynamicData);
+          }
+        } else {
+          console.log(res);
+          throw new Error(res);
+        }
+      } catch (error) {
+        console.log(error);
+        this.$message.error("网络异常,请稍后再试");
+      }
+    },
+    // 关闭运行节点弹窗
+    closeExecuteNode(row) {
+      this.open = false;
+    },
+    // 获取下一个节点的nodekey
+    getNextNodeKey(nodeKey, xmlStr) {
+      let xmlObj = this.xmlStr2XmlObj(xmlStr);
+      let nodeSequence = getNodeSequence(xmlObj);
+      return nodeSequence.find((item) => item.nodeId == nodeKey) || {};
+    },
+    // xml字符串转xml对象
+    xmlStr2XmlObj(xmlStr) {
+      var xmlObj = {};
+      if (document.all) {
+        var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
+        xmlDom.loadXML(xmlStr);
+        xmlObj = xmlDom;
+      } else {
+        xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml");
+      }
+      return xmlObj;
+    },
+    // 触发异常回调
+    exceptionTrigger(row, scriptData) {
+      // console.log(taskNodeType);
+      let _this = this;
+      this.$modal
+        .confirm("是否确认触发<" + scriptData.scriptName + ">异常?")
+        .then(function (val) {
+          console.log(val);
+          // 发送触发异常节点的请求
+          let payLoad = {
+            taskProcessKey: row.bepTaskKey,
+            taskNodeKey: row.benTaskNodeKey,
+            sysBpmNodeScriptVO: scriptData,
+            taskNodeType: row.benTaskNodeType,
+          };
+          // 异常节点抛异常  需要下一个节点key
+          if (row.benTaskNodeType == "exceptionTask") {
+            let { nodeId, nextNodeId } = _this.getNextNodeKey(
+              row.benTaskNodeKey,
+              row.bepTaskProcessXmlContent
+            );
+
+            payLoad.taskNextNodeKey = nextNodeId;
+          }
+          triggerExceptionNode(payLoad).then((res) => {
+            console.log(res);
+            if (res.code == 200) {
+              _this.$message.success("触发成功");
+              _this.open = false;
+              _this.getList();
+            } else {
+              _this.$message.error("触发失败请稍后再试");
+            }
+          });
+        })
+        .catch((err) => {
+          console.log(err);
+          _this.open = false;
+          _this.$message.info("取消成功");
+        });
+    },
+    // 获取字典对应label
+    getDictLabel(value, dictLsit = []) {
+      return dictLsit.find((item) => {
+        return item.value == value;
+      })?.label;
+    },
+  },
+};
+</script>
+
+<style scoped lang="scss">
+.process-mange-wrap {
+  background-color: #f2f3f8;
+  padding: 20px;
+
+  .col {
+    background-color: #fff;
+    border-right: 1px solid #ebedf2;
+    /* margin-right: 3px; */
+    .statistic-wrap {
+      /* // height: 70px; */
+      box-sizing: border-box;
+      display: flex;
+      align-items: center;
+      padding: 10px 17px;
+      justify-content: space-between;
+
+      .discription {
+        display: flex;
+        flex-direction: column;
+
+        .title {
+          line-height: 20px;
+          font-size: 18px;
+          font-weight: 700;
+          margin-bottom: 5px;
+        }
+
+        .sub-title {
+          font-size: 14px;
+        }
+      }
+
+      .data {
+        font-size: 20px;
+        font-weight: 700;
+      }
+    }
+  }
+
+  .main-area {
+    margin-top: 30px;
+    box-shadow: 0 1px 15px 1px rgb(69 65 78 / 8%);
+    background-color: #fff;
+
+    .show-header {
+      border-bottom: 1px solid #ebedf2;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      padding: 0px 20px 0px 20px;
+      height: 70px;
+
+      /* .header {
+      } */
+
+      .search-list {
+        display: flex;
+
+        .search-tab {
+          margin-right: 20px;
+
+          .btn-list-two {
+            margin-left: 10px;
+          }
+        }
+      }
+    }
+
+    .show-body {
+      padding: 25px;
+    }
+  }
+}
+</style>

+ 51 - 51
zkqy-ui/src/views/amichi/dialogCompments/processMange.vue

@@ -79,20 +79,20 @@
           >
             <template slot-scope="scope">
               <span v-if="col.prop == 'benCreateTime'">{{
-                scope.row.benCreateTime.replace("T", " ")
-              }}</span>
+                  scope.row.benCreateTime.replace("T", " ")
+                }}</span>
               <span v-else-if="col.prop == 'bepTaskProcessType'">{{
-                getDictLabel(scope.row.bepTaskProcessType, dict.type.bpm_type)
-              }}</span>
+                  getDictLabel(scope.row.bepTaskProcessType, dict.type.bpm_type)
+                }}</span>
               <span v-else-if="col.prop == 'benTaskNodeState'">{{
-                scope.row.benTaskNodeState == "0" ? "未执行" : "已执行"
-              }}</span>
+                  scope.row.benTaskNodeState == "0" ? "未执行" : "已执行"
+                }}</span>
               <span v-else-if="col.prop == 'bepTaskProcessState'">{{
-                getDictLabel(
-                  scope.row.bepTaskProcessState,
-                  dict.type.task_process_state
-                )
-              }}</span>
+                  getDictLabel(
+                    scope.row.bepTaskProcessState,
+                    dict.type.task_process_state
+                  )
+                }}</span>
               <span v-else>{{ scope.row[col.prop] }}</span>
             </template>
           </el-table-column>
@@ -109,34 +109,34 @@
                 >
                   运行
                 </el-button>
-<!--                <el-dropdown>-->
-<!--                  <el-button type="warning" plain size="small">-->
-<!--                    处理<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
-<!--                  </el-button>-->
-<!--                  <el-dropdown-menu slot="dropdown">-->
-<!--                    &lt;!&ndash; <el-dropdown-item>-->
-<!--                      <el-button-->
-<!--                        size="mini"-->
-<!--                        type="text"-->
-<!--                        icon="el-icon-edit"-->
-<!--                        @click="excuteHandler(scope.row)"-->
-<!--                        v-hasPermi="['system:user:edit']"-->
-<!--                      >处理-->
-<!--                      </el-button>-->
-<!--                    </el-dropdown-item> &ndash;&gt;-->
-<!--                    <el-dropdown-item   v-if="scope.row.exceptionScriptList && scope.row.exceptionScriptList.length">-->
-<!--                      <el-dropdown size="mini">-->
-<!--                        <el-button size="mini" type="text" icon="el-icon-d-arrow-right">触发异常</el-button>-->
-<!--                        <el-dropdown-menu slot="dropdown">-->
-<!--                                  <el-dropdown-item-->
-<!--                                    v-for="item in scope.row.exceptionScriptList" :key="item.id">-->
-<!--                                    <el-button @click="exceptionTrigger(scope.row, item)" size="mini" type="text">{{ item.scriptName }}</el-button>-->
-<!--                                  </el-dropdown-item>-->
-<!--                        </el-dropdown-menu>-->
-<!--                      </el-dropdown>-->
-<!--                    </el-dropdown-item>-->
-<!--                  </el-dropdown-menu>-->
-<!--                </el-dropdown>-->
+                <!--                <el-dropdown>-->
+                <!--                  <el-button type="warning" plain size="small">-->
+                <!--                    处理<i class="el-icon-arrow-down el-icon&#45;&#45;right"></i>-->
+                <!--                  </el-button>-->
+                <!--                  <el-dropdown-menu slot="dropdown">-->
+                <!--                    &lt;!&ndash; <el-dropdown-item>-->
+                <!--                      <el-button-->
+                <!--                        size="mini"-->
+                <!--                        type="text"-->
+                <!--                        icon="el-icon-edit"-->
+                <!--                        @click="excuteHandler(scope.row)"-->
+                <!--                        v-hasPermi="['system:user:edit']"-->
+                <!--                      >处理-->
+                <!--                      </el-button>-->
+                <!--                    </el-dropdown-item> &ndash;&gt;-->
+                <!--                    <el-dropdown-item   v-if="scope.row.exceptionScriptList && scope.row.exceptionScriptList.length">-->
+                <!--                      <el-dropdown size="mini">-->
+                <!--                        <el-button size="mini" type="text" icon="el-icon-d-arrow-right">触发异常</el-button>-->
+                <!--                        <el-dropdown-menu slot="dropdown">-->
+                <!--                                  <el-dropdown-item-->
+                <!--                                    v-for="item in scope.row.exceptionScriptList" :key="item.id">-->
+                <!--                                    <el-button @click="exceptionTrigger(scope.row, item)" size="mini" type="text">{{ item.scriptName }}</el-button>-->
+                <!--                                  </el-dropdown-item>-->
+                <!--                        </el-dropdown-menu>-->
+                <!--                      </el-dropdown>-->
+                <!--                    </el-dropdown-item>-->
+                <!--                  </el-dropdown-menu>-->
+                <!--                </el-dropdown>-->
               </div>
             </template>
           </el-table-column>
@@ -168,20 +168,20 @@
             :value="jsonData"
           /> -->
 
-            <component
-              :is="myForm"
-              :formData="formData"
-              :row="row"
-              :timestamp="timestamp"
-              ref="myFormRef"
-              v-if="myForm"
-            ></component>
+          <component
+            :is="myForm"
+            :formData="formData"
+            :row="row"
+            :timestamp="timestamp"
+            ref="myFormRef"
+            v-if="myForm"
+          ></component>
 
           <!-- <Sorting ref="myFormRef" :formData="formData" :row="row"></Sorting> -->
-<!--         <NodeInStorage-->
-<!--            :formData="formData"-->
-<!--            :row="row"-->
-<!--          ></NodeInStorage>-->
+          <!--         <NodeInStorage-->
+          <!--            :formData="formData"-->
+          <!--            :row="row"-->
+          <!--          ></NodeInStorage>-->
 
           <span slot="footer" class="dialog-footer" style="margin-top: 60px">
             <el-button @click="closeExecuteNode">取消</el-button>

+ 2 - 2
zkqy-ui/src/views/amichi/qualityinspectioninformation/bp_leavefactory/QualityStatement.vue

@@ -50,9 +50,9 @@
 <!--          <td>{{ index+1 }}</td>-->
           <td>{{ item.orderNumber }}</td>
           <td>{{ item.modelName }}</td>
-          <td>{{ item.modelName }}</td>
-          <td>{{ item.disqualificationNumber }}</td>
           <td>{{ item.causeOfNonconformity }}</td>
+          <td>{{ item.disqualificationNumber }}</td>
+          <td>{{ item.handlingSituation }}</td>
 
           <td>{{ item.jobNumber }}</td>
           <td>{{ item.dateOfInspection }}</td>

+ 147 - 119
zkqy-ui/src/views/bussiness/processMange.vue

@@ -100,24 +100,16 @@
             <template slot-scope="scope">
               <div class="excute-wrap">
                 <el-button
-                  type="warning"
-                  plain
-                  size="small"
-                  class="mr10 mb5"
-                  v-show="scope.row.bepTaskProcessState == '0'"
-                  @click="opneExecuteNode(scope.row)"
-                >
-                  运行
+                  type="warning" plain size="small" class="mr10 mb5" v-show="scope.row.bepTaskProcessState == '0'" @click="opneExecuteNode(scope.row)">运行
                 </el-button>
-                <el-dropdown>
+
+                 <!-- 下拉刷新按钮-->
+                <el-dropdown  v-if="scope.row.exceptionScriptList &&scope.row.exceptionScriptList.length">
                   <el-button type="warning" plain size="small">
                     处理<i class="el-icon-arrow-down el-icon--right"></i>
                   </el-button>
                   <el-dropdown-menu
-                    v-if="
-                      scope.row.exceptionScriptList &&
-                      scope.row.exceptionScriptList.length
-                    "
+                    v-if="scope.row.exceptionScriptList &&scope.row.exceptionScriptList.length"
                     slot="dropdown"
                   >
                     <!-- <el-dropdown-item>
@@ -186,13 +178,9 @@
             :value="jsonData"
           /> -->
 
-          <component
-            :is="myForm"
-            :formData="formData"
-            :row="row"
-            ref="myFormRef"
-            v-if="myForm"
-          ></component>
+          <component v-show="oldModule1Show" :is="myForm" :formData="formData" :row="row" ref="myFormRef" v-if="myForm"></component>
+
+          <component v-show="oldModule2Show" :is="remote" v-bind="$attrs" :formData="formData" :row="row" v-if="remote"  @verifyFun="verifyFun" @cancelFun="cancelFun"></component>
 
           <!-- <Sorting ref="myFormRef" :formData="formData" :row="row"></Sorting> -->
           <!-- <PhysicalInspection
@@ -211,12 +199,16 @@
 </template>
 
 <script>
+import * as Vue from "vue"
+import {loadModule} from "vue3-sfc-loader/dist/vue2-sfc-loader"
 import {
   processList,
   runProcessNodeExecution,
   getProcessNodeFormTemplate,
   getProcessNodeFormInfoData,
+  queryCurrentNodeType, getVueHtml
 } from "@/api/bpmprocess/run/executeProcess";
+
 import { triggerExceptionNode } from "@/api/bpmprocess/process";
 
 import getNodeSequence from "@/utils/bpmn/getNodeSequence";
@@ -224,7 +216,6 @@ import GY02 from "./dialogCompments/GongYi/GY02.vue";
 import ZL01 from "./dialogCompments/ZhiLiang/ZL1.vue";
 import { getForm } from "@/api/dragform/form";
 import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
-
 // 弹窗表单组件
 import GY01 from "./dialogCompments/GongYi/GY01.vue";
 import GY03 from "./dialogCompments/GongYi/GY03.vue";
@@ -241,7 +232,6 @@ import Processing from "./dialogCompments/Edu/Processing.vue";
 import Assemble from "./dialogCompments/Edu/Assemble.vue";
 import Detection from "./dialogCompments/Edu/Detection.vue";
 import WareHousing from "./dialogCompments/Edu/WareHousing.vue";
-
 //Mec组件
 import AssignEmployees from "./dialogCompments/Mec/AssignEmployees.vue";
 import Notes from "./dialogCompments/Mec/Notes.vue";
@@ -259,7 +249,6 @@ import ScrapDisposition from "./dialogCompments/Mec/ScrapDisposition.vue";
 
 import QRCode from "./dialogCompments/Mec/QRCode.vue";
 import Inspect from "./dialogCompments/GongYi/Inspect.vue";
-
 // 物理指标
 import PhysicalInspection from "./dialogCompments/GongYi/PhysicalInspection.vue";
 // 外观指标
@@ -267,12 +256,9 @@ import AppearanceInspection from "./dialogCompments/GongYi/AppearanceInspection.
 //
 import Sorting from "./dialogCompments/GongYi/Sorting.vue";
 import UpSilk from "./dialogCompments/GongYi/UpSilk.vue";
-
-
-
 //节点报工
 import NodeReport from "../amichi/dialogCompments/NodeReport.vue";
-
+import { submitNodeForm } from "@/api/bpmprocess/runDialogApi/index";
 export default {
   name: "processMange",
   props: [],
@@ -394,6 +380,11 @@ export default {
       formData: {},
       backExceptionTaskList: ["GY06"], //特殊回退表单组件列表
       loading: true,
+      //新老组件
+      oldModule:false,
+      oldModule1Show:false,
+      oldModule2Show:false,
+      remote: null,
     };
   },
   computed: {
@@ -434,8 +425,16 @@ export default {
     this.getList();
     this.getDoneNumber();
     this.getDoingNumber();
+
   },
   methods: {
+    verifyFun(){
+      console.log("提交函数");
+    },
+    //单文件组件取消事件
+    cancelFun(){
+      console.log("取消函数")
+    },
     // 获取列表数据
     getList() {
       this.loading = true;
@@ -498,28 +497,6 @@ export default {
     // 获取表单数据
     async getFormData() {
       let formData = {};
-      // switch (this.formType) {
-      //   case "dragForm":
-      //     try {
-      //       formData = await this.$refs.addFromRef.getData();
-      //     } catch (error) {
-      //       console.log(error);
-      //       this.$message.error("表单校验异常,请稍后重试");
-      //       return {};
-      //     }
-      //     break;
-      //   case "designForm":
-      //     let temp = await this.$refs.myFormRef.getFormData();
-      //     if (!temp.flag) {
-      //       this.$message.error(temp.msg);
-      //       return {};
-      //     } else {
-      //       formData = temp.data;
-      //     }
-      //     break;
-      //   default:
-      //     break;
-      // }
       let temp = await this.$refs.myFormRef?.getFormData();
       console.log("temp", temp);
       if (!temp?.flag) {
@@ -538,85 +515,135 @@ export default {
     },
     // 重置弹窗数据
     resetDialogForm() {
-      this.formType = ""; //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单   designForm:定制表单
-      // k-form-build 数据
+      this.formType = ""; // 表单类型 dragForm:拖拽表单  composeForm:工艺组合表单 designForm:定制表单
+      //=================k-form-build 数据==================
       this.dynamicData = {};
       this.defaultValue = {};
       this.jsonData = {};
     },
     // 打开运行节点弹窗
     async opneExecuteNode(row) {
-      this.resetDialogForm();
       console.log(row);
-      this.nodeTitle = row.benTaskNodeName;
-      // let preFix = row.benTaskNodeName.split("-")[0];
-      let preFix = row.benTaskNodeFormKey;
-      let {
-        benTaskNodeFormKey,
-        benTaskNodeFormType,
-        bepTaskPlanKey,
-        bepTaskKey,
-        bepTaskNodeKey,
-        benTaskProcessKey,
-        benmTaskAutomaticScriptTriggerType,
-        bepTaskNodeNextKey,
-      } = row;
-      // 新的运行逻辑
-      let payLoad = {
-        taskNodeKey: bepTaskNodeNextKey,
-        taskProcessKey: benTaskProcessKey,
-        taskAutomaticScriptTriggerType: benmTaskAutomaticScriptTriggerType,
-        taskPlanKey: bepTaskPlanKey,
-      };
-
-      // let formData = await getProcessNodeFormTemplate(payLoad);
-      // console.log(formData);
-      // if (benTaskNodeFormKey) {
-      //   if (benTaskNodeFormType == "dragForm") {
-      //     let templateInfo = formData.data[0]?.template;
-      //     //拖拽表单
-      //     this.formType = "dragForm";
-      //     this.jsonData = JSON.parse(templateInfo.dfVueTemplate);
-      //     this.tableName = templateInfo.dfTableName;
-      //     if (Object.keys(JSON.parse(templateInfo.dfFormSql)).length) {
-      //       this.dynamicData = JSON.parse(templateInfo.dfFormSql);
-      //     }
-      //     // await this.getDragFormInfo(benTaskNodeFormKey);
-      //   } else if (benTaskNodeFormType == "composeForm") {
-      //     //工艺组合表单
-      //     this.formType = "composeForm";
-      //     this.groupKey = benTaskNodeFormKey;
-      //     let queryPayload = {
-      //       row,
-      //       groupKey: benTaskNodeFormKey,
-      //     };
-      //     this.$nextTick(() => {
-      //       this.$refs.dialogRef.getLists(queryPayload);
-      //     });
-      //   }
-      // } else if (preFix) {
-      //   //定制表单
-      //   this.formType = "designForm";
-      //   this.myForm = preFix;
-      // }
-      //定制表单
-      this.formType = "designForm";
-      this.myForm = preFix;
-      let res = await getProcessNodeFormInfoData(payLoad);
-      if (res.code == 200) {
-        this.formData = res.data;
-      } else {
-        this.$message.error("网络异常,请稍后再试");
+      //发送请求查询当前节点是老节点还是新节点,做到新老节点融合
+      let requestArgument = {"scriptKey": row.benmTaskAutomaticScriptTriggerType};
+      let res = await queryCurrentNodeType(requestArgument);
+      if(res.code==200){
+        //判断是新表单还是老表单
+        res.data.isOld==0?this.oldModule=true:this.oldModule=false;
+        //是老节点重置表单
+        if(res.data.isOld==0){this.resetDialogForm()}
+      }
+      if(this.oldModule){
+        console.log(row);
+        this.nodeTitle = row.benTaskNodeName;
+        // let preFix = row.benTaskNodeName.split("-")[0];
+        let preFix = row.benTaskNodeFormKey;
+        let {
+          benTaskNodeFormKey,
+          benTaskNodeFormType,
+          bepTaskPlanKey,
+          bepTaskKey,
+          bepTaskNodeKey,
+          benTaskProcessKey,
+          benmTaskAutomaticScriptTriggerType,
+          bepTaskNodeNextKey,
+        } = row;
+        // 新的运行逻辑
+        let payLoad = {
+          taskNodeKey: bepTaskNodeNextKey,
+          taskProcessKey: benTaskProcessKey,
+          taskAutomaticScriptTriggerType: benmTaskAutomaticScriptTriggerType,
+          taskPlanKey: bepTaskPlanKey,
+        };
+        //定制表单
+        this.formType = "designForm";
+        this.myForm = preFix;
+        let res = await getProcessNodeFormInfoData(payLoad);
+        if (res.code == 200) {
+          this.formData = res.data;
+        } else {
+          this.$message.error("网络异常,请稍后再试");
+        }
+        //记录当前行数据
+        this.row = row;
+        //没有表单,直接掉运行逻辑
+        // if (!this.formType) return;
+        // 打开弹窗
+        this.open = true;
+        this.oldModule1Show=true
+        this.oldModule2Show=false
+        // 重置表单内容
+        this.$nextTick(() => {
+          // this.$refs.myFormRef?.resetForm();
+        });
+      }else {
+        //当前流程数据---->formKey 例如:Notes
+        //查询当前组件的表单结构信息
+        let pageNameObj={"pageName":row.benTaskNodeFormKey}
+        //查询到的html结构信息
+        let res= await getVueHtml(pageNameObj);
+
+        //构造动态加载单页面文件的选项参数
+        const options = {
+          moduleCache: {
+            vue: Vue,
+            '@/api/bpmprocess/runDialogApi/index': {submitNodeForm} // 注册 API 模块
+          },
+          async getFile () {
+            return res.fileStr
+          },
+          addStyle (textContent) {
+            const style = Object.assign(document.createElement('style'), { textContent })
+            const ref = document.head.getElementsByTagName('style')[0] || null
+            document.head.insertBefore(style, ref)
+          }
+        }
+        // 回显组件数据start
+        this.nodeTitle = row.benTaskNodeName;
+        // let preFix = row.benTaskNodeName.split("-")[0];
+        let preFix = row.benTaskNodeFormKey;
+        let {
+          benTaskNodeFormKey,
+          benTaskNodeFormType,
+          bepTaskPlanKey,
+          bepTaskKey,
+          bepTaskNodeKey,
+          benTaskProcessKey,
+          benmTaskAutomaticScriptTriggerType,
+          bepTaskNodeNextKey,
+        } = row;
+        // 新的运行逻辑
+        let payLoad = {
+          taskNodeKey: bepTaskNodeNextKey,
+          taskProcessKey: benTaskProcessKey,
+          taskAutomaticScriptTriggerType: benmTaskAutomaticScriptTriggerType,
+          taskPlanKey: bepTaskPlanKey,
+        };
+        //定制表单
+        this.formType = "designForm";
+        this.myForm = preFix;
+        let res1 = await getProcessNodeFormInfoData(payLoad);
+        if (res.code == 200) {
+          this.formData = res1.data;
+        } else {
+          this.$message.error("网络异常,请稍后再试");
+        }
+        //记录当前行数据
+        this.row = row;
+        // 回显组件数据end
+
+        // 加载远程组件
+        this.remote = await loadModule(res.fileName || 'loader.vue', options)
+        console.log("dddddd",this.remote);
+        console.log()
+        this.oldModule1Show=false;
+        this.oldModule2Show=true;
+        this.open=true;
+        console.log(this.oldModule1Show,this.oldModule2Show);
       }
 
-      this.row = row; //记录当前行数据
-      // if (!this.formType) return; //没有表单,直接掉运行逻辑
-      this.open = true; // 打开弹窗
-      this.$nextTick(() => {
-        // this.$refs.myFormRef?.resetForm();
-      });
-      // 根据当前节点绑定的表单信息查询对应的表单进行展示
     },
+
     // 运行节点按钮 确认运行回调
     async executeNode() {
       let { benTaskNodeKey, bepTaskProcessXmlContent, implementationName } =
@@ -664,6 +691,7 @@ export default {
         subformData.append(key, payLoad[key] == null ? "" : payLoad[key]);
       }
       runProcessNodeExecution(subformData).then((res) => {
+        console.log(res,"hmc");
         if (res.code == 200) {
           this.$message.success("运行成功!");
           this.getList();
@@ -671,7 +699,7 @@ export default {
           this.getDoingNumber();
           this.open = false;
         }
-      });
+      })
     },
     // 获取拖拽表单数据
     async getDragFormInfo(fid) {

+ 806 - 0
zkqy-ui/src/views/bussiness/processMange2.vue

@@ -0,0 +1,806 @@
+<template>
+  <div class="process-mange-wrap">
+    <!-- <el-card shadow="always" :body-style="{ padding: '20px' }"> -->
+    <el-row>
+      <el-col :xs="24" :md="8" :xl="8" class="col">
+        <div class="statistic-wrap">
+          <div class="discription">
+            <span class="title">已完成</span>
+            <span class="sub-title">已经完成的生产任务数</span>
+          </div>
+          <span class="data">{{ doneNum }}</span>
+        </div>
+      </el-col>
+      <el-col :xs="24" :md="8" :xl="8" class="col">
+        <div class="statistic-wrap">
+          <div class="discription">
+            <span class="title">进行中</span>
+            <span class="sub-title">正在进行的生产任务数</span>
+          </div>
+          <span class="data">{{ doingNum }}</span>
+        </div>
+      </el-col>
+      <!-- <el-col :xs="24" :md="8" :xl="8" class="col">
+        <div class="statistic-wrap">
+          <div class="discription">
+            <span class="title">完成</span>
+            <span class="sub-title">已经完成的管道</span>
+          </div>
+          <span class="data">0</span>
+        </div>
+      </el-col> -->
+    </el-row>
+    <!-- </el-card> -->
+    <div class="main-area">
+      <div class="show-header">
+        <h3 class="header">流程列表</h3>
+        <div class="search-list">
+          <div class="search-tab">
+            <el-radio-group v-model="taskType" v-show="false">
+              <el-radio-button :label="1">我的处理</el-radio-button>
+              <el-radio-button :label="2">其他处理</el-radio-button>
+            </el-radio-group>
+            <el-radio-group
+              class="btn-list-two"
+              v-model="queryParams.taskProcessState"
+              @change="getList"
+            >
+              <el-radio-button label="3">已完成</el-radio-button>
+              <el-radio-button label="0">进行中</el-radio-button>
+              <!-- <el-radio-button label="">所有</el-radio-button> -->
+            </el-radio-group>
+          </div>
+          <div class="search-input">
+            <el-input
+              placeholder="请输入..."
+              v-model="queryString"
+              @keyup.enter.native="getList"
+            >
+              <el-button
+                slot="append"
+                icon="el-icon-search"
+                @click="getList"
+              ></el-button>
+            </el-input>
+          </div>
+        </div>
+      </div>
+      <div class="show-body">
+        <!--    流程任务列表    -->
+        <el-table :data="tableData" v-loading="loading" border stripe>
+          <el-table-column type="selection" width="55" align="center" />
+          <el-table-column type="index" width="50" align="center" />
+          <el-table-column
+            v-for="col in newColumn"
+            :prop="col.prop"
+            :key="col.prop"
+            :label="col.label"
+            align="center"
+          >
+            <template slot-scope="scope">
+              <span v-if="col.prop == 'benCreateTime'">{{
+                scope.row.benCreateTime.replace("T", " ")
+              }}</span>
+              <span v-else-if="col.prop == 'bepTaskProcessType'">{{
+                getDictLabel(scope.row.bepTaskProcessType, dict.type.bpm_type)
+              }}</span>
+              <span v-else-if="col.prop == 'benTaskNodeState'">{{
+                scope.row.benTaskNodeState == "0" ? "未执行" : "已执行"
+              }}</span>
+              <span v-else-if="col.prop == 'bepTaskProcessState'">{{
+                getDictLabel(
+                  scope.row.bepTaskProcessState,
+                  dict.type.task_process_state
+                )
+              }}</span>
+              <span v-else>{{ scope.row[col.prop] }}</span>
+            </template>
+          </el-table-column>
+          <el-table-column label="操作" align="center">
+            <template slot-scope="scope">
+              <div class="excute-wrap">
+                <el-button
+                  type="warning" plain size="small" class="mr10 mb5" v-show="scope.row.bepTaskProcessState == '0'" @click="opneExecuteNode()">运行
+                </el-button>
+
+                 <!-- 下拉刷新按钮-->
+                <el-dropdown  v-if="scope.row.exceptionScriptList &&scope.row.exceptionScriptList.length">
+                  <el-button type="warning" plain size="small">
+                    处理<i class="el-icon-arrow-down el-icon--right"></i>
+                  </el-button>
+                  <el-dropdown-menu
+                    v-if="scope.row.exceptionScriptList &&scope.row.exceptionScriptList.length"
+                    slot="dropdown"
+                  >
+                    <!-- <el-dropdown-item>
+                      <el-button
+                        size="mini"
+                        type="text"
+                        icon="el-icon-edit"
+                        @click="excuteHandler(scope.row)"
+                        v-hasPermi="['system:user:edit']"
+                      >处理
+                      </el-button>
+                    </el-dropdown-item> -->
+                    <el-dropdown-item>
+                      <el-dropdown size="mini">
+                        <el-button
+                          size="mini"
+                          type="text"
+                          icon="el-icon-d-arrow-right"
+                          >触发异常
+                        </el-button>
+                        <el-dropdown-menu slot="dropdown">
+                          <el-dropdown-item
+                            v-for="item in scope.row.exceptionScriptList"
+                            :key="item.id"
+                          >
+                            <el-button
+                              @click="exceptionTrigger(scope.row, item)"
+                              size="mini"
+                              type="text"
+                              >{{ item.scriptName }}
+                            </el-button>
+                          </el-dropdown-item>
+                        </el-dropdown-menu>
+                      </el-dropdown>
+                    </el-dropdown-item>
+                  </el-dropdown-menu>
+                </el-dropdown>
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+
+        <!--    分页    -->
+        <pagination
+          v-show="total > 0"
+          :total="total"
+          :page.sync="queryParams.pageNum"
+          :limit.sync="queryParams.pageSize"
+          @pagination="getList"
+        />
+      </div>
+
+      <div class="show-window">
+        <!-- 运行节点弹窗 -->
+
+        <el-dialog :title="nodeTitle" :visible.sync="open">
+          <!--  <el-form label-width="100px" :model="commonData">
+            <h1>这里会引入当前节点需要处理的表单</h1>
+          </el-form> -->
+          <!-- <k-form-build
+            v-if="formType == 'dragForm'"
+            class="formBuild"
+            ref="addFromRef"
+            :dynamicData="dynamicData"
+            :defaultValue="defaultValue"
+            :value="jsonData"
+          /> -->
+
+<!--          <component-->
+<!--            :is="myForm"-->
+<!--            :formData="formData"-->
+<!--            :row="row"-->
+<!--            ref="myFormRef"-->
+<!--            v-if="myForm"-->
+<!--          ></component>-->
+
+          <!-- <Sorting ref="myFormRef" :formData="formData" :row="row"></Sorting> -->
+          <!-- <PhysicalInspection
+            :formData="formData"
+            :row="row"
+          ></PhysicalInspection> -->
+
+          <span slot="footer" class="dialog-footer">
+            <el-button @click="closeExecuteNode">取消</el-button>
+            <el-button type="primary" @click="executeNode">确认运行</el-button>
+          </span>
+        </el-dialog>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import * as Vue from "vue"
+import {loadModule} from "vue3-sfc-loader/dist/vue2-sfc-loader"
+import {
+  processList,
+  runProcessNodeExecution,
+  getProcessNodeFormTemplate,
+  getProcessNodeFormInfoData,
+} from "@/api/bpmprocess/run/executeProcess";
+import { triggerExceptionNode } from "@/api/bpmprocess/process";
+
+import getNodeSequence from "@/utils/bpmn/getNodeSequence";
+import GY02 from "./dialogCompments/GongYi/GY02.vue";
+import ZL01 from "./dialogCompments/ZhiLiang/ZL1.vue";
+import { getForm } from "@/api/dragform/form";
+import DialogTemplate from "@/views/dialogTemplate/components/index.vue";
+// 弹窗表单组件
+import GY01 from "./dialogCompments/GongYi/GY01.vue";
+import GY03 from "./dialogCompments/GongYi/GY03.vue";
+import CG1 from "./dialogCompments/test-component/CaiGou/CG1.vue";
+import CG02 from "./dialogCompments/test-component/CaiGou/CG02.vue";
+import KC01 from "./dialogCompments/test-component/KuCun/KC1.vue";
+import KC02 from "./dialogCompments/test-component/KuCun/KC02.vue";
+import GY06 from "./dialogCompments/GongYi/GY06.vue";
+import KB01 from "./dialogCompments/KongBai/KB01.vue"; //空白提示组件
+import SC01 from "./dialogCompments/ShengChan/SC01.vue";
+
+import Loading from "./dialogCompments/Edu/Loading.vue";
+import Processing from "./dialogCompments/Edu/Processing.vue";
+import Assemble from "./dialogCompments/Edu/Assemble.vue";
+import Detection from "./dialogCompments/Edu/Detection.vue";
+import WareHousing from "./dialogCompments/Edu/WareHousing.vue";
+//Mec组件
+import AssignEmployees from "./dialogCompments/Mec/AssignEmployees.vue";
+import Notes from "./dialogCompments/Mec/Notes.vue";
+import Print from "./dialogCompments/Mec/Print.vue";
+import NodeShow from "./dialogCompments/Mec/NodeShow.vue";
+import RecordQuality from "./dialogCompments/Mec/RecordQuality.vue";
+import ProductionProcesses from "./dialogCompments/Mec/ProductionProcesses.vue";
+import PersonalDistribution from "./dialogCompments/Mec/PersonalDistribution.vue";
+import RecordSplitData from "./dialogCompments/Mec/RecordSplitData.vue";
+import EditFinishTime from "./dialogCompments/Mec/EditFinishTime.vue";
+import EditQualityCard from "./dialogCompments/Mec/EditQualityCard.vue";
+import FinishTask from "./dialogCompments/Mec/FinishTask.vue";
+import QualityControlCardSubCardProcessing from "./dialogCompments/Mec/QualityControlCardSubCardProcessing.vue";
+import ScrapDisposition from "./dialogCompments/Mec/ScrapDisposition.vue";
+
+import QRCode from "./dialogCompments/Mec/QRCode.vue";
+import Inspect from "./dialogCompments/GongYi/Inspect.vue";
+// 物理指标
+import PhysicalInspection from "./dialogCompments/GongYi/PhysicalInspection.vue";
+// 外观指标
+import AppearanceInspection from "./dialogCompments/GongYi/AppearanceInspection.vue";
+//
+import Sorting from "./dialogCompments/GongYi/Sorting.vue";
+import UpSilk from "./dialogCompments/GongYi/UpSilk.vue";
+//节点报工
+import NodeReport from "../amichi/dialogCompments/NodeReport.vue";
+
+export default {
+  name: "processMange",
+  props: [],
+  components: {
+    GY01,
+    DialogTemplate,
+    CG1,
+    CG02,
+    KC01,
+    GY06,
+    GY03,
+    KC02,
+    GY02,
+    KB01,
+    SC01,
+    ZL01,
+    NodeShow,
+    AssignEmployees,
+    Notes,
+    Print,
+    RecordQuality,
+    ProductionProcesses,
+    PersonalDistribution,
+    RecordSplitData,
+    EditFinishTime,
+    EditQualityCard,
+    FinishTask,
+    QualityControlCardSubCardProcessing,
+    ScrapDisposition,
+    QRCode,
+    Inspect,
+    Loading,
+    Processing,
+    Assemble,
+    Detection,
+    WareHousing,
+    PhysicalInspection,
+    AppearanceInspection,
+    Sorting, //分拣
+    UpSilk, //上丝
+    NodeReport,//节点报工
+  },
+  dicts: ["bpm_type", "task_process_state"],
+  data() {
+    return {
+      doneNum: 0, //已完成数
+      doingNum: 0, //进行中数
+      row: {}, //当前操作行数据
+      myForm: "", //自定义表单组件名
+      // 节点弹窗title
+      nodeTitle: "节点弹窗",
+      open: false,
+      // 节点弹窗对应的formData
+      commonData: {},
+      taskType: 1,
+      queryString: "",
+      taskStatus: "",
+      tableData: [], //表格数据
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        taskProcessState: "0",
+        taskProcessType: 0,
+      },
+      total: 0,
+      columns: [
+        {
+          prop: "bepTaskKey",
+          label: "任务编号",
+        },
+        {
+          prop: "bepTaskName",
+          label: "任务名称",
+        },
+        // {
+        //   prop: "bepTaskProcessType",
+        //   label: "任务流程类型",
+        // },
+        {
+          prop: "bepTaskProcessState",
+          label: "任务流程状态",
+        },
+        {
+          prop: "benTaskNodeName",
+          label: "节点名称",
+        },
+        {
+          prop: "benTaskNodeType",
+          label: "节点类型",
+        },
+        {
+          prop: "benTaskNodeState",
+          label: "节点状态",
+        },
+        {
+          prop: "benCreateBy",
+          label: "创建人",
+        },
+        {
+          prop: "benCreateTime",
+          label: "创建时间",
+        },
+      ],
+      formType: "", //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单   designForm:定制表单
+      // k-form-build 数据
+      dynamicData: {},
+      tableName: "",
+      defaultValue: {},
+      jsonData: {},
+      // 拖拽数据
+      taskInfo: {},
+      groupKey: "",
+      subCount: {},
+      tableCount: {},
+      subTableName: "",
+
+      // 弹窗表单渲染数据
+      formData: {},
+      backExceptionTaskList: ["GY06"], //特殊回退表单组件列表
+      loading: true,
+    };
+  },
+  computed: {
+    newColumn() {
+      if (this.queryParams.taskProcessState == "3") {
+        return [
+          {
+            prop: "bepTaskKey",
+            label: "任务编号",
+          },
+          {
+            prop: "bepTaskName",
+            label: "任务名称",
+          },
+          // {
+          //   prop: "bepTaskProcessType",
+          //   label: "任务流程类型",
+          // },
+          {
+            prop: "bepTaskProcessState",
+            label: "任务流程状态",
+          },
+          {
+            prop: "benCreateBy",
+            label: "创建人",
+          },
+          {
+            prop: "benCreateTime",
+            label: "创建时间",
+          },
+        ];
+      } else {
+        return this.columns;
+      }
+    },
+  },
+  mounted() {
+    this.getList();
+    this.getDoneNumber();
+    this.getDoingNumber();
+  },
+  methods: {
+    // 获取列表数据
+    getList() {
+      this.loading = true;
+      processList({ ...this.queryParams, taskName: this.queryString })
+        .then((res) => {
+          if (res.code == 200) {
+            this.tableData = res.rows.map((item) => item.resultMap);
+            this.total = res.total;
+            console.log(this.tableData);
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+          this.loading = false;
+        })
+        .finally((e) => {
+          console.log(e);
+          this.loading = false;
+        });
+    },
+    getDoneNumber() {
+      let params = {
+        pageNum: 1,
+        pageSize: 10,
+        taskProcessState: "3",
+        taskProcessType: 0,
+      };
+      processList(params)
+        .then((res) => {
+          if (res.code == 200) {
+            this.doneNum = res.total;
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+        })
+        .finally((e) => {
+          console.log(e);
+          this.loading = false;
+        });
+    },
+    getDoingNumber() {
+      let params = {
+        pageNum: 1,
+        pageSize: 10,
+        taskProcessState: "0",
+        taskProcessType: 0,
+      };
+      processList(params)
+        .then((res) => {
+          if (res.code == 200) {
+            this.doingNum = res.total;
+          } else {
+            this.$message.error("网络异常,请稍后再试");
+          }
+        })
+        .finally((e) => {
+          console.log(e);
+          this.loading = false;
+        });
+    },
+    // 获取表单数据
+    async getFormData() {
+      let formData = {};
+      // switch (this.formType) {
+      //   case "dragForm":
+      //     try {
+      //       formData = await this.$refs.addFromRef.getData();
+      //     } catch (error) {
+      //       console.log(error);
+      //       this.$message.error("表单校验异常,请稍后重试");
+      //       return {};
+      //     }
+      //     break;
+      //   case "designForm":
+      //     let temp = await this.$refs.myFormRef.getFormData();
+      //     if (!temp.flag) {
+      //       this.$message.error(temp.msg);
+      //       return {};
+      //     } else {
+      //       formData = temp.data;
+      //     }
+      //     break;
+      //   default:
+      //     break;
+      // }
+      let temp = await this.$refs.myFormRef?.getFormData();
+      console.log("temp", temp);
+      if (!temp?.flag) {
+        if (!temp) {
+          //没有表单
+          // formData.flag = true;
+        } else {
+          //表单数据不合法
+          this.$message.error(temp.msg);
+          return false;
+        }
+      } else {
+        formData = temp.data;
+      }
+      return formData;
+    },
+    // 重置弹窗数据
+    resetDialogForm() {
+      this.formType = ""; //表单类型 dragForm:拖拽表单 composeForm:工艺组合表单   designForm:定制表单
+      // k-form-build 数据
+      this.dynamicData = {};
+      this.defaultValue = {};
+      this.jsonData = {};
+    },
+    // 打开运行节点弹窗
+    opneExecuteNode(row) {
+      console.log("hmc")
+      this.resetDialogForm();
+      console.log(row);
+
+      //
+      // this.nodeTitle = row.benTaskNodeName;
+      // // let preFix = row.benTaskNodeName.split("-")[0];
+      // let preFix = row.benTaskNodeFormKey;
+      // let {
+      //   benTaskNodeFormKey,
+      //   benTaskNodeFormType,
+      //   bepTaskPlanKey,
+      //   bepTaskKey,
+      //   bepTaskNodeKey,
+      //   benTaskProcessKey,
+      //   benmTaskAutomaticScriptTriggerType,
+      //   bepTaskNodeNextKey,
+      // } = row;
+      // // 新的运行逻辑
+      // let payLoad = {
+      //   taskNodeKey: bepTaskNodeNextKey,
+      //   taskProcessKey: benTaskProcessKey,
+      //   taskAutomaticScriptTriggerType: benmTaskAutomaticScriptTriggerType,
+      //   taskPlanKey: bepTaskPlanKey,
+      // };
+      //
+      //
+      // //定制表单
+      // this.formType = "designForm";
+      // this.myForm = preFix;
+      // let res = await getProcessNodeFormInfoData(payLoad);
+      // if (res.code == 200) {
+      //   this.formData = res.data;
+      // } else {
+      //   this.$message.error("网络异常,请稍后再试");
+      // }
+      //
+      // this.row = row; //记录当前行数据
+      // // if (!this.formType) return; //没有表单,直接掉运行逻辑
+
+          // this.$nextTick(() => {
+          //   this.open = true; // 打开弹窗
+          // });
+    },
+    // 运行节点按钮 确认运行回调
+    async executeNode() {
+      let { benTaskNodeKey, bepTaskProcessXmlContent, implementationName } =
+        this.row;
+      let { nodeId, nextNodeId } = this.getNextNodeKey(
+        benTaskNodeKey,
+        bepTaskProcessXmlContent
+      );
+      // 只有完成状态的可以运行
+      if (this.formType == "composeForm") {
+        let res = this.$refs.dialogRef.getComposeFormData();
+        if (!res.isSuccess) {
+          this.$message.warning("非完成状态节点不能运行!");
+          return;
+        }
+      }
+      // return;
+      let formData = await this.getFormData();
+      if (!formData) return;
+      formData.taskPlanKey = this.row.bepTaskPlanKey;
+      let payLoad = {
+        taskProcessKey: this.row.bepTaskKey, //当前任务流程编码
+        taskNodeKey: nodeId, //当前执行节点唯一编码
+        nextNodeKey: nextNodeId, //下一节点编码
+        implementationName: this.row.benmTaskAutomaticScriptTriggerType, //当前节点绑定的脚本名
+        // taskProcessXmlContent: this.row.bepTaskProcessXmlContent, //当前流程xml
+        tableName: this.tableName,
+        formDataMapString: JSON.stringify(formData), //自定义表单组件收集的表单数据
+        taskNodeType: this.backExceptionTaskList.includes(
+          this.row.benTaskNodeFormKey
+        )
+          ? "backExceptionTask"
+          : this.row.benTaskNodeType,
+      };
+      let fileXML = new File(
+        [this.row.bepTaskProcessXmlContent],
+        this.row.bepTaskKey + ".bpmn",
+        {
+          type: "text/bpmn",
+        }
+      );
+      const subformData = new FormData();
+      subformData.append("fileXML", fileXML);
+      for (let key in payLoad) {
+        subformData.append(key, payLoad[key] == null ? "" : payLoad[key]);
+      }
+      runProcessNodeExecution(subformData).then((res) => {
+        console.log(res,"hmc");
+        if (res.code == 200) {
+          this.$message.success("运行成功!");
+          this.getList();
+          this.getDoneNumber();
+          this.getDoingNumber();
+          this.open = false;
+        }
+      })
+    },
+    // 获取拖拽表单数据
+    async getDragFormInfo(fid) {
+      try {
+        let res = await getForm(fid);
+        console.log(res);
+        if (res.code == 200) {
+          this.jsonData = JSON.parse(res.data.dfVueTemplate);
+          this.tableName = res.data.dfTableName;
+          if (res.data.dfFormSql) {
+            this.dynamicData = JSON.parse(res.data.dfFormSql);
+            console.log(this.dynamicData);
+          }
+        } else {
+          console.log(res);
+          throw new Error(res);
+        }
+      } catch (error) {
+        console.log(error);
+        this.$message.error("网络异常,请稍后再试");
+      }
+    },
+    // 关闭运行节点弹窗
+    closeExecuteNode(row) {
+      this.open = false;
+    },
+    // 获取下一个节点的nodekey
+    getNextNodeKey(nodeKey, xmlStr) {
+      let xmlObj = this.xmlStr2XmlObj(xmlStr);
+      let nodeSequence = getNodeSequence(xmlObj);
+      return nodeSequence.find((item) => item.nodeId == nodeKey) || {};
+    },
+    // xml字符串转xml对象
+    xmlStr2XmlObj(xmlStr) {
+      var xmlObj = {};
+      if (document.all) {
+        var xmlDom = new ActiveXObject("Microsoft.XMLDOM");
+        xmlDom.loadXML(xmlStr);
+        xmlObj = xmlDom;
+      } else {
+        xmlObj = new DOMParser().parseFromString(xmlStr, "text/xml");
+      }
+      return xmlObj;
+    },
+    // 触发异常回调
+    exceptionTrigger(row, scriptData) {
+      // console.log(taskNodeType);
+      let _this = this;
+      this.$modal
+        .confirm("是否确认触发<" + scriptData.scriptName + ">异常?")
+        .then(function (val) {
+          console.log(val);
+          // 发送触发异常节点的请求
+          let payLoad = {
+            taskProcessKey: row.bepTaskKey,
+            taskNodeKey: row.benTaskNodeKey,
+            sysBpmNodeScriptVO: scriptData,
+            taskNodeType: row.benTaskNodeType,
+          };
+          // 异常节点抛异常  需要下一个节点key
+          if (row.benTaskNodeType == "exceptionTask") {
+            let { nodeId, nextNodeId } = _this.getNextNodeKey(
+              row.benTaskNodeKey,
+              row.bepTaskProcessXmlContent
+            );
+
+            payLoad.taskNextNodeKey = nextNodeId;
+          }
+          triggerExceptionNode(payLoad).then((res) => {
+            console.log(res);
+            if (res.code == 200) {
+              _this.$message.success("触发成功");
+              _this.open = false;
+              _this.getList();
+            } else {
+              _this.$message.error("触发失败请稍后再试");
+            }
+          });
+        })
+        .catch((err) => {
+          console.log(err);
+          _this.open = false;
+          _this.$message.info("取消成功");
+        });
+    },
+    // 获取字典对应label
+    getDictLabel(value, dictLsit = []) {
+      return dictLsit.find((item) => {
+        return item.value == value;
+      })?.label;
+    },
+  },
+};
+</script>
+
+<style scoped lang="scss">
+.process-mange-wrap {
+  background-color: #f2f3f8;
+  padding: 20px;
+
+  .col {
+    background-color: #fff;
+    border-right: 1px solid #ebedf2;
+    /* margin-right: 3px; */
+    .statistic-wrap {
+      /* // height: 70px; */
+      box-sizing: border-box;
+      display: flex;
+      align-items: center;
+      padding: 10px 17px;
+      justify-content: space-between;
+
+      .discription {
+        display: flex;
+        flex-direction: column;
+
+        .title {
+          line-height: 20px;
+          font-size: 18px;
+          font-weight: 700;
+          margin-bottom: 5px;
+        }
+
+        .sub-title {
+          font-size: 14px;
+        }
+      }
+
+      .data {
+        font-size: 20px;
+        font-weight: 700;
+      }
+    }
+  }
+
+  .main-area {
+    margin-top: 30px;
+    box-shadow: 0 1px 15px 1px rgb(69 65 78 / 8%);
+    background-color: #fff;
+
+    .show-header {
+      border-bottom: 1px solid #ebedf2;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      padding: 0px 20px 0px 20px;
+      height: 70px;
+
+      /* .header {
+      } */
+
+      .search-list {
+        display: flex;
+
+        .search-tab {
+          margin-right: 20px;
+
+          .btn-list-two {
+            margin-left: 10px;
+          }
+        }
+      }
+    }
+
+    .show-body {
+      padding: 25px;
+    }
+  }
+}
+</style>

+ 41 - 8
zkqy-ui/src/views/orderMange/oldOutStock/index.vue

@@ -255,7 +255,7 @@ import {
   saleStorageDetails,
   queryDropDownBoxData,
   noticeOutStorage,
-  oldNoticeOutStorage,
+  oldNoticeOutStorage, checkOldInventory,
 } from "@/api/tablelist/commonTable";
 import { mapState } from "vuex";
 
@@ -378,14 +378,47 @@ export default {
                 return;
               }
               delete payLoad.documentTypeName;
-              let res = await oldNoticeOutStorage(payLoad);
-              if (res.code == 200) {
-                this.$message.success("出库成功");
-                this.currentIndex = 0;
-                await this.initData();
-                this.refreshHandler();
+              //校验库存是否足够
+              let res1 = await checkOldInventory(payLoad);
+              //等于200 可以进行老库存出库
+              if (res1.code == 200) {
+                if(res1.isG==1){
+                    this.$confirm(res1.msg, "库存不足提示", {
+                      confirmButtonText: "确定",
+                      cancelButtonText: "取消",
+                      type: "warning",
+                    })
+                    .then(async () => {
+                      this.$message.success("出库成功");
+                      let res = await oldNoticeOutStorage(payLoad);
+                      if (res.code == 200) {
+                        this.$message.success("出库成功");
+                        this.currentIndex = 0;
+                        await this.initData();
+                        this.refreshHandler();
+                      } else {
+                        this.$message.error(res.msg);
+                      }
+                    }).catch(() => {
+                        this.$message({
+                          type: "info",
+                          message: "已取消出库",
+                        });
+                  });
+                }else {
+                  let res = await oldNoticeOutStorage(payLoad);
+                  if (res.code == 200) {
+                    this.$message.success("出库成功");
+                    this.currentIndex = 0;
+                    await this.initData();
+                    this.refreshHandler();
+                  } else {
+                    this.$message.error(res.msg);
+                  }
+                }
               } else {
-                this.$message.error(res.msg);
+                console.log("当前code",res1);
+
               }
             })
             .catch(() => {

+ 1 - 0
zkqy-ui/src/views/orderMange/planTable/show/fangsi.vue

@@ -578,6 +578,7 @@ export default {
         updateSelectedProductCategory: "",
         updateSelectedProductState: "",
       },
+      counter: 0,
     };
   },
   created() {

+ 1 - 0
zkqy-ui/src/views/orderMange/planTable/show/fankuang.vue

@@ -649,6 +649,7 @@ export default {
         updateSelectedProductCategory: "",
         updateSelectedProductState: "",
       },
+      counter: 0,
     };
   },
   mounted() {

+ 1 - 0
zkqy-ui/src/views/orderMange/planTable/show/luotong.vue

@@ -654,6 +654,7 @@ export default {
         updateSelectedProductCategory: "",
         updateSelectedProductState: "",
       },
+      counter: 0,
     };
   },
   created() {

+ 1 - 0
zkqy-ui/src/views/orderMange/planTable/show/northWorkshop.vue

@@ -189,6 +189,7 @@ export default {
         { value: "A面", lable: "A面" },
         { value: "B面", lable: "B面" },
       ],
+      counter: 0,
     };
   },
   created() {

Некоторые файлы не были показаны из-за большого количества измененных файлов