浏览代码

feat:质检报告拆分,工序扫码单量推送,和全量推送,管道查询bug

lucky 5 月之前
父节点
当前提交
cd90989455
共有 74 个文件被更改,包括 5385 次插入842 次删除
  1. 23 0
      zkqy-admin/src/main/java/com/zkqy/DynamicBeanRegistrarInitializer.java
  2. 118 5
      zkqy-admin/src/test/java/com/zkqy/Test01.java
  3. 2 1
      zkqy-framework/src/main/java/com/zkqy/framework/config/SecurityConfig.java
  4. 6 0
      zkqy-framework/src/main/java/com/zkqy/framework/security/filter/JwtAuthenticationTokenFilter.java
  5. 1 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/BpLeaveFactoryController.java
  6. 41 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/IndoorMaterialInformationController.java
  7. 30 9
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/IndoorProductionGroupInformationController.java
  8. 2 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/JlIncomingInspectionController.java
  9. 107 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/ProductionReportingRecordController.java
  10. 11 2
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/QualityinspectioninformationController.java
  11. 3 2
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/RingScanInformationController.java
  12. 1 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/RingTerminalController.java
  13. 30 6
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/IndoorMaterialInformation.java
  14. 13 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/IndoorProductionGroupInformation.java
  15. 11 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/PlanTaskDetails.java
  16. 24 13
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/ProcedureList.java
  17. 94 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/ProductionReportingRecord.java
  18. 44 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/vo/IndoorProductionGroupInformationTreeVo.java
  19. 48 38
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/vo/PlanTaskDetailsListAndFlowCardDataVo.java
  20. 12 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/vo/PlanTaskDetailsVo.java
  21. 22 11
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/domain/JdProductionOrder.java
  22. 1 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/domain/MaterialRetentionLogVo.java
  23. 296 199
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/service/impl/JdProductionOrderServiceImpl.java
  24. 6 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/BpLeaveFactoryMapper.java
  25. 36 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/IndoorMaterialInformationMapper.java
  26. 9 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/IndoorProductionGroupInformationMapper.java
  27. 7 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/JlIncomingInspectionMapper.java
  28. 1 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/PlanTaskDetailsMapper.java
  29. 9 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/ProcedureListMapper.java
  30. 5 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/ProductionCardFlowMapper.java
  31. 63 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/ProductionReportingRecordMapper.java
  32. 14 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/QualityinspectioninformationMapper.java
  33. 130 42
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/scheduling/ScheduledBean.java
  34. 34 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IIndoorMaterialInformationService.java
  35. 20 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IIndoorProductionGroupInformationService.java
  36. 61 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IProductionReportingRecordService.java
  37. 8 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IQualityinspectioninformationService.java
  38. 4 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/BpLeaveFactoryServiceImpl.java
  39. 45 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/IndoorMaterialInformationServiceImpl.java
  40. 8 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/IndoorPlanInformationServiceImpl.java
  41. 81 1
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/IndoorProductionGroupInformationServiceImpl.java
  42. 4 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/JlIncomingInspectionServiceImpl.java
  43. 93 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/ProductionReportingRecordServiceImpl.java
  44. 16 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/QualityinspectioninformationServiceImpl.java
  45. 442 178
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/StationInformationServiceImpl.java
  46. 2436 0
      zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/StationInformationServiceImpl.javabak
  47. 3 0
      zkqy-fujian-amichi/src/main/resources/mapper/BpLeaveFactoryMapper.xml
  48. 81 3
      zkqy-fujian-amichi/src/main/resources/mapper/IndoorMaterialInformationMapper.xml
  49. 18 1
      zkqy-fujian-amichi/src/main/resources/mapper/IndoorProductionGroupInformationMapper.xml
  50. 3 0
      zkqy-fujian-amichi/src/main/resources/mapper/JlIncomingInspectionMapper.xml
  51. 22 74
      zkqy-fujian-amichi/src/main/resources/mapper/PlanTaskDetailsMapper.xml
  52. 17 0
      zkqy-fujian-amichi/src/main/resources/mapper/ProcedureListMapper.xml
  53. 9 0
      zkqy-fujian-amichi/src/main/resources/mapper/ProductionCardFlowMapper.xml
  54. 73 0
      zkqy-fujian-amichi/src/main/resources/mapper/ProductionReportingRecordMapper.xml
  55. 34 0
      zkqy-fujian-amichi/src/main/resources/mapper/QualityinspectioninformationMapper.xml
  56. 77 8
      zkqy-fujian-amichi/src/main/resources/mapper/RingScanInformationMapper.xml
  57. 1 0
      zkqy-fujian-amichi/src/main/resources/storage.json
  58. 2 2
      zkqy-ui/.env.production
  59. 44 0
      zkqy-ui/src/api/amichi/indoorMaterialInformation/information.js
  60. 10 2
      zkqy-ui/src/api/amichi/qualityinspectioninformation/qualityinspectioninformation.js
  61. 2 1
      zkqy-ui/src/permission.js
  62. 21 0
      zkqy-ui/src/router/index.js
  63. 2 1
      zkqy-ui/src/views/amichi/dialogCompments/customizedVersion/components/taskListTotal.vue
  64. 1 1
      zkqy-ui/src/views/amichi/dialogCompments/customizedVersion/processDisplay4.vue
  65. 220 26
      zkqy-ui/src/views/amichi/planTask/inPlanPage/indoorMaterialInformation/index.vue
  66. 180 179
      zkqy-ui/src/views/amichi/planTask/inPlant.vue
  67. 16 7
      zkqy-ui/src/views/amichi/planTask/salesPlan.vue
  68. 1 1
      zkqy-ui/src/views/amichi/processDocumentManagement/index.vue
  69. 21 5
      zkqy-ui/src/views/amichi/qualityinspectioninformation/bp_inspection/QualityStatement.vue
  70. 24 8
      zkqy-ui/src/views/amichi/qualityinspectioninformation/bp_leavefactory/QualityStatement.vue
  71. 20 6
      zkqy-ui/src/views/amichi/qualityinspectioninformation/jl_inspection/QualityStatement.vue
  72. 3 3
      zkqy-ui/src/views/login.vue
  73. 5 0
      zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue
  74. 3 2
      zkqy-ui/vue.config.js

+ 23 - 0
zkqy-admin/src/main/java/com/zkqy/DynamicBeanRegistrarInitializer.java

@@ -0,0 +1,23 @@
+package com.zkqy;
+
+import com.zkqy.web.controller.tool.DynamicBeanRegistrar;
+import org.springframework.boot.context.event.ApplicationReadyEvent;
+import org.springframework.context.ApplicationListener;
+import org.springframework.context.ConfigurableApplicationContext;
+
+public class DynamicBeanRegistrarInitializer implements ApplicationListener<ApplicationReadyEvent> {
+    @Override
+    public void onApplicationEvent(ApplicationReadyEvent event) {
+        // 获取 ConfigurableApplicationContext
+        ConfigurableApplicationContext applicationContext = event.getApplicationContext();
+
+        // 创建 DynamicBeanRegistrar 实例
+        DynamicBeanRegistrar dynamicBeanRegistrar = new DynamicBeanRegistrar(applicationContext);
+
+        // 注册到 Spring 容器
+        applicationContext.getBeanFactory().registerSingleton("dynamicBeanRegistrar", dynamicBeanRegistrar);
+
+        // 打印确认
+        System.out.println("DynamicBeanRegistrar registered successfully!");
+    }
+}

+ 118 - 5
zkqy-admin/src/test/java/com/zkqy/Test01.java

@@ -7,21 +7,30 @@ import com.google.gson.Gson;
 import com.kingdee.bos.webapi.entity.IdentifyInfo;
 import com.kingdee.bos.webapi.entity.QueryParam;
 import com.kingdee.bos.webapi.sdk.K3CloudApi;
+import com.zkqy.amichi.domain.ProcedureList;
 import com.zkqy.amichi.domain.RingScanInformation;
+import com.zkqy.amichi.mapper.ProcedureListMapper;
+import com.zkqy.amichi.service.ISharedFileService;
 import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.common.core.domain.R;
+import com.zkqy.system.domain.sso.User;
 import org.apache.http.client.HttpClient;
 import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.data.redis.support.collections.RedisList;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import javax.annotation.Resource;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.*;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 import java.util.stream.Collectors;
 
-//@SpringBootTest(classes = ZkqyApplication.class)
+@SpringBootTest(classes = ZkqyApplication.class)
 
 public class Test01 {
 
@@ -114,6 +123,110 @@ public class Test01 {
             throw new RuntimeException(e);
         }
     }
+
+
+    @Resource
+    private ISharedFileService sharedFileService;
+
+    @Test
+    public void test01(){
+        // 配置共享文件夹路径
+//        String sharedPath = "smb://username:password@192.168.1.100/share/";
+
+        // Windows共享文件夹路径
+        // 注意:中文需要使用 URLEncoder 进行编码
+
+
+            sharedFileService.syncSharedFiles();
+
+    }
+
+    @Autowired
+    public ThreadPoolTaskExecutor threadPoolTaskExecutor;
+
+    @Test
+    public void test03(){
+        // 模拟大数据集
+        List<String> largeDataSet = new ArrayList<>();
+        for (int i = 0; i < 50000; i++) {
+            largeDataSet.add("Data " + i);
+        }
+        // 分割数据集
+        int batchSize = 500;
+        int totalBatches = (int) Math.ceil((double) largeDataSet.size() / batchSize);
+
+        // 创建固定大小的线程池
+//        int threadPoolSize = 40; // 根据实际情况调整线程池大小
+//        ExecutorService executorService = Executors.newFixedThreadPool(threadPoolSize);
+
+        List<CompletableFuture<Void>> futures = new ArrayList<>();
+
+        long  l= System.currentTimeMillis();
+        System.out.println("开始时间"+l+"ms");
+        for (int i = 0; i < totalBatches; i++) {
+            int start = i * batchSize;
+            int end = Math.min(start + batchSize, largeDataSet.size());
+
+            // 创建一个子列表
+            List<String> subList = largeDataSet.subList(start, end);
+// 异步处理每个子列表
+            CompletableFuture<Void> future = CompletableFuture.runAsync(() -> {
+                processData(subList); // 调用处理方法
+            }, threadPoolTaskExecutor);
+
+            futures.add(future);
+        }
+        // 等待所有异步任务完成
+        CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join();
+        // 关闭线程池
+        long  l1= System.currentTimeMillis();
+        System.out.println("结束时间"+l1);
+        System.out.println("总计耗时:"+(l1-l));
+        threadPoolTaskExecutor.shutdown();
+    }
+
+
+    private static void processData(List<String> data) {
+        // 这里是处理数据的地方,例如插入数据库
+        System.out.println("Processing " + data.size() + " items.");
+        // 模拟耗时操作
+        try {
+            Thread.sleep(30); // 假设每个批次处理需要1秒
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void abc(){
+        Map<String, User> abc=new HashMap<>();
+        abc.put("1",new User());
+        abc.put("2",new User());
+        System.out.println(abc.get("3"));
+        if(abc.get("3")==null){
+            System.out.println("为null");
+        }
+        if(abc.get("1")!=null){
+            System.out.println("不为null");
+        }
+        double a=3.4;
+        System.out.println(a);
+    }
+
+    @Autowired
+    ProcedureListMapper procedureListMapper;
+    @Test
+    public  void setSharedFileService(){
+        List<ProcedureList> procedureLists = procedureListMapper.selectProcedureListMap();
+
+        Map<String, String> collect = procedureLists.stream()
+                .filter(procedureList ->
+                        procedureList.getElpname() != null && !procedureList.getElpname().isEmpty()) // 过滤条件
+                .collect(Collectors.toMap(ProcedureList::getElpname, ProcedureList::getProcedurName));
+
+
+
+    }
 }
 
 

+ 2 - 1
zkqy-framework/src/main/java/com/zkqy/framework/config/SecurityConfig.java

@@ -115,7 +115,8 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
                 // 单点授权
                 .antMatchers("/oauth2/**", "/Oauth2Login/**", "/oauth/callback", "/authorize").permitAll()
                 //模拟登录授权
-                .antMatchers("/pageTransfer","/lims/Login/","pageTransferTo").permitAll()
+                .antMatchers("/pageTransfer","/lims/Login/","pageTransferTo","/jl_inspection","/system/inspection/list","/bpleavefactory/bpleavefactory/list",
+                        "/qualityinspectioninformation/qualityinspectioninformation/list/getOne").permitAll()
 
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated()

+ 6 - 0
zkqy-framework/src/main/java/com/zkqy/framework/security/filter/JwtAuthenticationTokenFilter.java

@@ -32,13 +32,19 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
             throws ServletException, IOException
     {
         LoginUser loginUser = tokenService.getLoginUser(request);
+        //判断当前用户有么有登录
         if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
         {
+            //如果登录就校验token是否过期 没有过期的情况下就进行续期操作
             tokenService.verifyToken(loginUser);
+            //创建一个认证对象( 1:认证成功的用户 2:不需要解码 3:用户的权限列表)
             UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(loginUser, null, loginUser.getAuthorities());
+            //设置认证详情(构建认证详情(如 IP 地址、会话 ID 等)) 将这些信息附加到认证对象中
             authenticationToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));
+            //将认证对象设置到当前线程的 SecurityContext 中
             SecurityContextHolder.getContext().setAuthentication(authenticationToken);
         }
+        //继续执行过滤器链
         chain.doFilter(request, response);
     }
 }

+ 1 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/BpLeaveFactoryController.java

@@ -69,6 +69,7 @@ public class BpLeaveFactoryController extends BaseController
     @GetMapping(value = "/{id}")
     public AjaxResult getInfo(@PathVariable("id") Long id)
     {
+
         return success(bpLeaveFactoryService.selectBpLeaveFactoryById(id));
     }
 

+ 41 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/IndoorMaterialInformationController.java

@@ -1,8 +1,10 @@
 package com.zkqy.amichi.controller;
 
 import java.util.List;
+import java.util.Map;
 import javax.servlet.http.HttpServletResponse;
 
+import com.zkqy.common.annotation.Anonymous;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
@@ -49,6 +51,44 @@ public class IndoorMaterialInformationController extends BaseController
         return getDataTable(list);
     }
 
+
+    /**
+     * 查询物料名称分类信息
+     */
+//    @PreAuthorize("@ss.hasPermi('indoorMaterialInformation:information:list')")
+    @Anonymous
+    @GetMapping("/productClassification")
+    public AjaxResult productClassification(IndoorMaterialInformation indoorMaterialInformation)
+    {
+        List<Map<String,String>> list = indoorMaterialInformationService.productClassification(indoorMaterialInformation);
+        return AjaxResult.success(list);
+    }
+
+    @Anonymous
+    @GetMapping("/typeClassification")
+    public AjaxResult typeClassification(IndoorMaterialInformation indoorMaterialInformation)
+    {
+        List<Map<String,String>> list = indoorMaterialInformationService.typeClassification(indoorMaterialInformation);
+        return AjaxResult.success(list);
+    }
+
+
+    @Anonymous
+    @GetMapping("/queryMaterialCode")
+    public AjaxResult queryMaterialCode(IndoorMaterialInformation indoorMaterialInformation)
+    {
+        IndoorMaterialInformation list = indoorMaterialInformationService.queryMaterialCode(indoorMaterialInformation);
+        return AjaxResult.success(list);
+    }
+
+
+    @Anonymous
+    @GetMapping("/specificationClassification")
+    public AjaxResult specificationClassification(IndoorMaterialInformation indoorMaterialInformation)
+    {
+        List<Map<String,String>> list = indoorMaterialInformationService.specificationClassification(indoorMaterialInformation);
+        return AjaxResult.success(list);
+    }
     /**
      * 导出场内计划信息列表
      */
@@ -75,7 +115,7 @@ public class IndoorMaterialInformationController extends BaseController
     /**
      * 新增场内计划信息
      */
-    @PreAuthorize("@ss.hasPermi('indoorMaterialInformation:information:add')")
+//    @PreAuthorize("@ss.hasPermi('indoorMaterialInformation:information:add')")
     @Log(title = "场内计划信息", businessType = BusinessType.INSERT)
     @PostMapping
     public AjaxResult add(@RequestBody IndoorMaterialInformation indoorMaterialInformation)

+ 30 - 9
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/IndoorProductionGroupInformationController.java

@@ -1,27 +1,31 @@
 package com.zkqy.amichi.controller;
 
+import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
 
+import com.alibaba.excel.EasyExcel;
+import com.zkqy.amichi.domain.*;
+import com.zkqy.amichi.utils.ExcelHeaderDataListener;
+import com.zkqy.amichi.utils.MergeRowListener;
+import com.zkqy.common.annotation.Anonymous;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.core.domain.entity.SysUser;
 import com.zkqy.common.core.page.TableDataInfo;
 import com.zkqy.common.enums.BusinessType;
+import com.zkqy.common.utils.SecurityUtils;
+import com.zkqy.common.utils.StringUtils;
 import com.zkqy.common.utils.poi.ExcelUtil;
+import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
 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.amichi.domain.IndoorProductionGroupInformation;
 import com.zkqy.amichi.service.IIndoorProductionGroupInformationService;
+import org.springframework.web.multipart.MultipartFile;
 
 
 /**
@@ -82,7 +86,24 @@ public class IndoorProductionGroupInformationController extends BaseController
     {
         return toAjax(indoorProductionGroupInformationService.insertIndoorProductionGroupInformation(indoorProductionGroupInformation));
     }
+    @Anonymous
+    @GetMapping(value = "/treeList/{id}")
+    public AjaxResult treeList(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(indoorProductionGroupInformationService.treeList(id));
+    }
 
+    @Log(title = "导入产品信息", businessType = BusinessType.IMPORT)
+    //@PreAuthorize("@ss.hasPermi('system:user:import')")
+    @PostMapping("/importData")
+    public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
+        ExcelUtil<IndoorMaterialInformation> util = new ExcelUtil<>(IndoorMaterialInformation.class);
+        //解析出数据列表
+        List<IndoorMaterialInformation> importExcelList = util.importExcel(file.getInputStream());
+        String operName = getUsername();
+        String message = indoorProductionGroupInformationService.importUser(importExcelList, updateSupport, operName);
+        return success("成功");
+    }
     /**
      * 修改分组信息:用于记录各个分组的基本信息
      */

+ 2 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/JlIncomingInspectionController.java

@@ -3,6 +3,7 @@ package com.zkqy.amichi.controller;
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
 
+import com.zkqy.common.annotation.Anonymous;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
@@ -42,6 +43,7 @@ public class JlIncomingInspectionController extends BaseController
      */
 //    @PreAuthorize("@ss.hasPermi('jl_inspection:inspection:list')")
     @GetMapping("/list")
+    @Anonymous
     public TableDataInfo list(JlIncomingInspection jlIncomingInspection)
     {
         startPage();

+ 107 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/ProductionReportingRecordController.java

@@ -0,0 +1,107 @@
+package com.zkqy.amichi.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.zkqy.common.annotation.Log;
+import com.zkqy.common.core.controller.BaseController;
+import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.core.page.TableDataInfo;
+import com.zkqy.common.enums.BusinessType;
+import com.zkqy.common.utils.poi.ExcelUtil;
+import org.springframework.security.access.prepost.PreAuthorize;
+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 com.zkqy.amichi.domain.ProductionReportingRecord;
+import com.zkqy.amichi.service.IProductionReportingRecordService;
+
+
+/**
+ * 汇报审核单据Controller
+ * 
+ * @author ruoyi
+ * @date 2025-02-25
+ */
+@RestController
+@RequestMapping("/productionreportingrecord/record")
+public class ProductionReportingRecordController extends BaseController
+{
+    @Autowired
+    private IProductionReportingRecordService productionReportingRecordService;
+
+    /**
+     * 查询汇报审核单据列表
+     */
+//    @PreAuthorize("@ss.hasPermi('productionreportingrecord:record:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(ProductionReportingRecord productionReportingRecord)
+    {
+        startPage();
+        List<ProductionReportingRecord> list = productionReportingRecordService.selectProductionReportingRecordList(productionReportingRecord);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出汇报审核单据列表
+     */
+//    @PreAuthorize("@ss.hasPermi('productionreportingrecord:record:export')")
+    @Log(title = "汇报审核单据", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, ProductionReportingRecord productionReportingRecord)
+    {
+        List<ProductionReportingRecord> list = productionReportingRecordService.selectProductionReportingRecordList(productionReportingRecord);
+        ExcelUtil<ProductionReportingRecord> util = new ExcelUtil<ProductionReportingRecord>(ProductionReportingRecord.class);
+        util.exportExcel(response, list, "汇报审核单据数据");
+    }
+
+    /**
+     * 获取汇报审核单据详细信息
+     */
+//    @PreAuthorize("@ss.hasPermi('productionreportingrecord:record:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(productionReportingRecordService.selectProductionReportingRecordById(id));
+    }
+
+    /**
+     * 新增汇报审核单据
+     */
+//    @PreAuthorize("@ss.hasPermi('productionreportingrecord:record:add')")
+    @Log(title = "汇报审核单据", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody ProductionReportingRecord productionReportingRecord)
+    {
+        return toAjax(productionReportingRecordService.insertProductionReportingRecord(productionReportingRecord));
+    }
+
+    /**
+     * 修改汇报审核单据
+     */
+//    @PreAuthorize("@ss.hasPermi('productionreportingrecord:record:edit')")
+    @Log(title = "汇报审核单据", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody ProductionReportingRecord productionReportingRecord)
+    {
+        return toAjax(productionReportingRecordService.updateProductionReportingRecord(productionReportingRecord));
+    }
+
+    /**
+     * 删除汇报审核单据
+     */
+//    @PreAuthorize("@ss.hasPermi('productionreportingrecord:record:remove')")
+    @Log(title = "汇报审核单据", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(productionReportingRecordService.deleteProductionReportingRecordByIds(ids));
+    }
+}

+ 11 - 2
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/QualityinspectioninformationController.java

@@ -89,6 +89,13 @@ public class QualityinspectioninformationController extends BaseController
         return success(qualityinspectioninformationService.selectQualityinspectioninformationById(id));
     }
 
+//    @Log(title = "质检信息", businessType = BusinessType.DELETE)
+    @GetMapping("/list/getOne")
+    public AjaxResult getOne(Qualityinspectioninformation qualityinspectioninformation )
+    {
+        return AjaxResult.success(qualityinspectioninformationService.selectQualityinspectioninformation(qualityinspectioninformation));
+    }
+
     /**
      * 新增质检信息
      */
@@ -122,6 +129,8 @@ public class QualityinspectioninformationController extends BaseController
         return toAjax(qualityinspectioninformationService.deleteQualityinspectioninformationByIds(ids));
     }
 
+
+
 //    @PreAuthorize("@ss.hasPermi('amichi:onSiteProgramDetails:add')")
     @Log(title = "场内计划详情crud", businessType = BusinessType.INSERT)
     @PostMapping("/importExcelData")
@@ -160,8 +169,8 @@ public class QualityinspectioninformationController extends BaseController
                 switch(headerListener.getProcess()) {
                     case "来料检验":
                         qualityinspectioninformation.setJlOneFailedBatch(headerListener.getOne()); //一次不合格批次
-                        qualityinspectioninformation.setJlTotalBatchForInspection(headerListener.getTwo()); //报检总批次
-                        qualityinspectioninformation.setJlQuantityOfRejectsReturns(headerListener.getThree().equals("null")?"0":headerListener.getThree()); //废品/退换货数量
+                        qualityinspectioninformation.setJlQuantityOfRejectsReturns(headerListener.getTwo()); //报检总批次
+                        qualityinspectioninformation.setJlTotalBatchForInspection(headerListener.getThree().equals("null")?"0":headerListener.getThree()); //废品/退换货数量
                         qualityinspectioninformation.setJlQualifiedRateOfTheMonth(headerListener.getFour()); //本月合格率批次
                         System.out.println("1");
                         break;

+ 3 - 2
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/controller/RingScanInformationController.java

@@ -143,7 +143,8 @@ public class RingScanInformationController extends BaseController
     {
         //用户名,工位,生产订单总数,成功数量,失败数量,订单号
         List<Map> list = ringScanInformationService.handHeldJournal(ringScanInformation);
-        //
+
+
         List<Map> list1=new ArrayList<>();
         list.forEach(item->{
             String s = ringScanInformationService.selectRingScanInfoByUserNameAndOrderNumber(item.get("uname").toString(),
@@ -375,7 +376,7 @@ public class RingScanInformationController extends BaseController
     /**
      * 删除指环王扫描日志信息
      */
-    @PreAuthorize("@ss.hasPermi('ringScanInformation:information:remove')")
+//    @PreAuthorize("@ss.hasPermi('ringScanInformation:information:remove')")
     @Log(title = "指环王扫描日志信息", businessType = BusinessType.DELETE)
 	@DeleteMapping("/{ids}")
     public AjaxResult remove(@PathVariable Long[] ids)

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

@@ -47,7 +47,7 @@ public class RingTerminalController extends BaseController
     /**
      * 查询指环终端列表
      */
-    @PreAuthorize("@ss.hasPermi('RingTerminal:terminal:list')")
+//    @PreAuthorize("@ss.hasPermi('RingTerminal:terminal:list')")
     @GetMapping("/list")
     public TableDataInfo list(RingTerminal ringTerminal)
     {

+ 30 - 6
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/IndoorMaterialInformation.java

@@ -16,34 +16,58 @@ public class IndoorMaterialInformation extends BaseEntity
 {
     private static final long serialVersionUID = 1L;
 
+    private  Long  id;
+
     /** 物料编码:物料的唯一编码 */
+    @Excel(name = "父项物料编码")
     private String materialCode;
 
     /** 物料名称:物料的具体名称 */
-    @Excel(name = "物料名称:物料的具体名称")
+    @Excel(name = "物料名称")
     private String materialName;
 
     /** 型号:物料的型号描述 */
-    @Excel(name = "型号:物料的型号描述")
+    @Excel(name = "型号")
     private String model;
 
     /** 规格型号:物料的具体规格参数 */
-    @Excel(name = "规格型号:物料的具体规格参数")
+    @Excel(name = "规格型号")
     private String specification;
 
     /** 描述:对物料的详细描述 */
-    @Excel(name = "描述:对物料的详细描述")
+    @Excel(name = "描述")
     private String description;
 
     /** 单位:物料的计量单位 */
-    @Excel(name = "单位:物料的计量单位")
+    @Excel(name = "父项物料单位")
     private String unit;
 
     /** 组ID:所属分组的ID,关联分组表 */
     @Excel(name = "组ID:所属分组的ID,关联分组表")
     private Long groupId;
 
-    public void setMaterialCode(String materialCode) 
+    @Excel(name="BOM分组")
+    private String groupName;
+
+
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getGroupName() {
+        return groupName;
+    }
+
+    public void setGroupName(String groupName) {
+        this.groupName = groupName;
+    }
+
+    public void setMaterialCode(String materialCode)
     {
         this.materialCode = materialCode;
     }

+ 13 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/IndoorProductionGroupInformation.java

@@ -23,7 +23,19 @@ public class IndoorProductionGroupInformation extends BaseEntity
     @Excel(name = "组名:分组的名称")
     private String groupName;
 
-    public void setId(Long id) 
+    @Excel(name = "父级id")
+    private  String  parentId;
+
+
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId;
+    }
+
+    public void setId(Long id)
     {
         this.id = id;
     }

+ 11 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/PlanTaskDetails.java

@@ -25,7 +25,18 @@ public class PlanTaskDetails extends BaseEntity
     /** 描述信息 */
     private Long description;
 
+    /**
+     * 单据类型
+     */
+    private  String  documentType;
 
+    public String getDocumentType() {
+        return documentType;
+    }
+
+    public void setDocumentType(String documentType) {
+        this.documentType = documentType;
+    }
 
     /** 当前生产订单的状态*/
     private  String status;

+ 24 - 13
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/ProcedureList.java

@@ -5,6 +5,8 @@ import com.zkqy.common.core.domain.BaseEntity;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 
+import java.util.StringJoiner;
+
 
 /**
  * 工序列表对象 procedure_list
@@ -23,6 +25,16 @@ public class ProcedureList extends BaseEntity
     @Excel(name = "工序编号")
     private String procedureNumber;
 
+    private  String  elpname;
+
+    public String getElpname() {
+        return elpname;
+    }
+
+    public void setElpname(String elpname) {
+        this.elpname = elpname;
+    }
+
     /** 工序名称 */
     @Excel(name = "工序名称")
     private String procedurName;
@@ -132,18 +144,17 @@ public class ProcedureList extends BaseEntity
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("procedureNumber", getProcedureNumber())
-            .append("procedurName", getProcedurName())
-            .append("remarks", getRemarks())
-            .append("createById", getCreateById())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateById", getUpdateById())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("delFlag", getDelFlag())
-            .toString();
+        return new StringJoiner(", ", ProcedureList.class.getSimpleName() + "[", "]")
+                .add("id=" + id)
+                .add("procedureNumber='" + procedureNumber + "'")
+                .add("elpname='" + elpname + "'")
+                .add("procedurName='" + procedurName + "'")
+                .add("remarks='" + remarks + "'")
+                .add("createById=" + createById)
+                .add("updateById=" + updateById)
+                .add("delFlag='" + delFlag + "'")
+                .add("bindingStatus='" + bindingStatus + "'")
+                .add("sort='" + sort + "'")
+                .toString();
     }
 }

+ 94 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/ProductionReportingRecord.java

@@ -0,0 +1,94 @@
+package com.zkqy.amichi.domain;
+
+import com.zkqy.common.annotation.Excel;
+import com.zkqy.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+
+/**
+ * 汇报审核单据对象 production_reporting_record
+ * 
+ * @author ruoyi
+ * @date 2025-02-25
+ */
+public class ProductionReportingRecord extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 单据编号 */
+    @Excel(name = "单据编号")
+    private String number;
+
+    /** xlh */
+    @Excel(name = "xlh")
+    private String xlh;
+
+    /** 1:成品检验 2:试机检验 */
+    @Excel(name = "1:成品检验 2:试机检验")
+    private String type;
+
+    /** xlhString */
+    @Excel(name = "xlhString")
+    private String xlhArray;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setNumber(String number) 
+    {
+        this.number = number;
+    }
+
+    public String getNumber() 
+    {
+        return number;
+    }
+    public void setXlh(String xlh) 
+    {
+        this.xlh = xlh;
+    }
+
+    public String getXlh() 
+    {
+        return xlh;
+    }
+    public void setType(String type) 
+    {
+        this.type = type;
+    }
+
+    public String getType() 
+    {
+        return type;
+    }
+    public void setXlhArray(String xlhArray) 
+    {
+        this.xlhArray = xlhArray;
+    }
+
+    public String getXlhArray() 
+    {
+        return xlhArray;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("number", getNumber())
+            .append("xlh", getXlh())
+            .append("type", getType())
+            .append("xlhArray", getXlhArray())
+            .toString();
+    }
+}

+ 44 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/vo/IndoorProductionGroupInformationTreeVo.java

@@ -0,0 +1,44 @@
+package com.zkqy.amichi.domain.vo;
+
+import java.util.List;
+
+public class IndoorProductionGroupInformationTreeVo {
+    private  String  id;
+    private  String  label;
+
+    private  String  parentId;
+
+    private List<IndoorProductionGroupInformationTreeVo>  children;
+
+    public List<IndoorProductionGroupInformationTreeVo> getChildren() {
+        return children;
+    }
+
+    public void setChildren(List<IndoorProductionGroupInformationTreeVo> children) {
+        this.children = children;
+    }
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getLabel() {
+        return label;
+    }
+
+    public void setLabel(String label) {
+        this.label = label;
+    }
+
+    public String getParentId() {
+        return parentId;
+    }
+
+    public void setParentId(String parentId) {
+        this.parentId = parentId;
+    }
+}

+ 48 - 38
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/vo/PlanTaskDetailsListAndFlowCardDataVo.java

@@ -6,46 +6,49 @@ import java.util.List;
 
 public class PlanTaskDetailsListAndFlowCardDataVo extends BaseEntity {
 
-    private  String orderNumber;
-//序列号
-    private  String  serialNumber;
-//母粒编码
-    private  String  materialCode;
-//型号
-    private  String  model;
-//功率
-    private  String  power;
-//颜色
-    private  String  colour;
-//铭牌
-    private String   mingPai;
-//包装箱
-    private  String  packingBox;
-//开关箱
-    private  String  switchBox;
-//铁心长度
-    private  String  coreLength;
-//电压频率
-    private  String  voltageFrequency;
-//机盖端顶
-    private  String  caseEndCover;
-//接口盘片
-    private  String  platterInterface;
-//数据
-    private  String  dataInfo;
-//说明书
-    private  String specificationBook;
-//合格证
-    private  String certificateOfConformity;
-//特殊要求
-    private  String specialRequirements;
-
-    private  String  base46MaD;
-
-    private  String  base46MaZ;
+    private String orderNumber;
+    //序列号
+    private String serialNumber;
+    //母粒编码
+    private String materialCode;
+    //型号
+    private String model;
+    //功率
+    private String power;
+    //颜色
+    private String colour;
+    //铭牌
+    private String mingPai;
+    //包装箱
+    private String packingBox;
+    //开关箱
+    private String switchBox;
+    //单据类型
+    private String documentType;
+
+    //铁心长度
+    private String coreLength;
+    //电压频率
+    private String voltageFrequency;
+    //机盖端顶
+    private String caseEndCover;
+    //接口盘片
+    private String platterInterface;
+    //数据
+    private String dataInfo;
+    //说明书
+    private String specificationBook;
+    //合格证
+    private String certificateOfConformity;
+    //特殊要求
+    private String specialRequirements;
+
+    private String base46MaD;
+
+    private String base46MaZ;
 
     //需求日期
-    private  String  xqrq;
+    private String xqrq;
 
     public String getXqrq() {
         return xqrq;
@@ -71,6 +74,13 @@ public class PlanTaskDetailsListAndFlowCardDataVo extends BaseEntity {
         this.base46MaZ = base46MaZ;
     }
 
+    public String getDocumentType() {
+        return documentType;
+    }
+
+    public void setDocumentType(String documentType) {
+        this.documentType = documentType;
+    }
     private List<String> orderNumberList;
 
     public List<String> getOrderNumberList() {

+ 12 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/domain/vo/PlanTaskDetailsVo.java

@@ -18,6 +18,18 @@ public class PlanTaskDetailsVo extends BaseEntity {
     @Excel(name = "单据编号")
     private String fbillno;
 
+    /** 单据类型 */
+    @Excel(name = "单据类型")
+    private  String documentType;
+
+    public String getDocumentType() {
+        return documentType;
+    }
+
+    public void setDocumentType(String documentType) {
+        this.documentType = documentType;
+    }
+
     @Excel(name = "BOM版本")
     private String fbomIdFnumber;
 

+ 22 - 11
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/domain/JdProductionOrder.java

@@ -30,9 +30,18 @@ public class JdProductionOrder extends BaseEntity
 
 
 
+    /** 明细备注 */
+    @Excel(name = "明细备注")
+    @JSONField(name = "FMemoItem")
+    private String FMemoItem;
 
+    public String getFMemoItem() {
+        return FMemoItem;
+    }
 
-
+    public void setFMemoItem(String FMemoItem) {
+        this.FMemoItem = FMemoItem;
+    }
 
     /** 单据编号 */
     @Excel(name = "单据主键")
@@ -52,6 +61,8 @@ public class JdProductionOrder extends BaseEntity
     @JSONField(name = "FUnitId.FNumber")
     private String funitidfNumber;
 
+
+
     @Excel(name = "需求日期")
     @JSONField(name = "F.PONP.XQRQ")
     private String   completionTime;
@@ -59,7 +70,7 @@ public class JdProductionOrder extends BaseEntity
     /** 单据类型 */
     @Excel(name = "单据类型")
     @JSONField(name = "FBillType")
-    private String documentTyep;
+    private String documentType;
 
     /** 单据日期 */
 //    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@@ -211,6 +222,14 @@ public class JdProductionOrder extends BaseEntity
     @JSONField(name = "F.PONP.DianYaPinLv")
     private String dianYaPinLv;
 
+    public String getDocumentType() {
+        return documentType;
+    }
+
+    public void setDocumentType(String documentType) {
+        this.documentType = documentType;
+    }
+
     public String getDianYaPinLv() {
         return dianYaPinLv;
     }
@@ -379,15 +398,7 @@ public class JdProductionOrder extends BaseEntity
     {
         return documentNumber;
     }
-    public void setDocumentTyep(String documentTyep) 
-    {
-        this.documentTyep = documentTyep;
-    }
 
-    public String getDocumentTyep() 
-    {
-        return documentTyep;
-    }
     public void setDocumentDate(String documentDate)
     {
         this.documentDate = documentDate;
@@ -574,7 +585,7 @@ public class JdProductionOrder extends BaseEntity
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
             .append("id", getId())
             .append("documentNumber", getDocumentNumber())
-            .append("documentTyep", getDocumentTyep())
+            .append("documentType", getDocumentType())
             .append("documentDate", getDocumentDate())
             .append("documentStatus", getDocumentStatus())
             .append("productType", getProductType())

+ 1 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/domain/MaterialRetentionLogVo.java

@@ -93,7 +93,7 @@ public class MaterialRetentionLogVo extends BaseEntity {
 
     /** 实发数量 */
     @Excel(name = "实发数量")
-    @JSONField(name = "FNumerator")
+    @JSONField(name = "FMustQty")
     private String actualQuantityIssued;
 
 

+ 296 - 199
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/jd/service/impl/JdProductionOrderServiceImpl.java

@@ -3,6 +3,7 @@ package com.zkqy.amichi.jd.service.impl;
 import com.alibaba.fastjson2.JSON;
 import com.kingdee.bos.webapi.sdk.K3CloudApi;
 import com.zkqy.amichi.domain.PlanTaskDetails;
+import com.zkqy.amichi.domain.ProductionCardFlow;
 import com.zkqy.amichi.domain.ProductionPlanningManagement;
 import com.zkqy.amichi.jd.domain.JdProductionOrder;
 import com.zkqy.amichi.jd.domain.ProductionCardFlowVo;
@@ -28,7 +29,7 @@ import java.util.stream.Collectors;
 
 /**
  * 金蝶-生产订单信息Service业务层处理
- * 
+ *
  * @author ruoyi
  * @date 2024-10-12
  */
@@ -37,6 +38,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 {
     @Autowired
     private JdProductionOrderMapper jdProductionOrderMapper;
+
     @Autowired
     private ProductionPlanningManagementMapper productionPlanningManagementMapper;
 
@@ -60,7 +62,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 
     /**
      * 查询金蝶-生产订单信息
-     * 
+     *
      * @param id 金蝶-生产订单信息主键
      * @return 金蝶-生产订单信息
      */
@@ -72,7 +74,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 
     /**
      * 查询金蝶-生产订单信息列表
-     * 
+     *
      * @param jdProductionOrder 金蝶-生产订单信息
      * @return 金蝶-生产订单信息
      */
@@ -84,7 +86,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 
     /**
      * 新增金蝶-生产订单信息
-     * 
+     *
      * @param jdProductionOrder 金蝶-生产订单信息
      * @return 结果
      */
@@ -97,7 +99,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 
     /**
      * 修改金蝶-生产订单信息
-     * 
+     *
      * @param jdProductionOrder 金蝶-生产订单信息
      * @return 结果
      */
@@ -110,7 +112,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 
     /**
      * 批量删除金蝶-生产订单信息
-     * 
+     *
      * @param ids 需要删除的金蝶-生产订单信息主键
      * @return 结果
      */
@@ -122,7 +124,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
 
     /**
      * 删除金蝶-生产订单信息信息
-     * 
+     *
      * @param id 金蝶-生产订单信息主键
      * @return 结果
      */
@@ -147,49 +149,106 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
         if (aTrue) {
             try {
                 AjaxResult ajaxResult = jdMaterialInfoService.pullMaterialBaseInfo();
+
                 //金蝶工具key
                 K3CloudApi api = new K3CloudApi();
                 //定义查询条件
                 String query = "{\n" +
                         "    \"FormId\": \"PRD_MO\",\n" +
                         "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
-                        "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,FSaleOrderNo,FPickMtrlStatus," +
+                        "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,FSaleOrderNo,FPickMtrlStatus,FMemoItem," +
                         "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" +
-                        "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"(\",\"FieldName\":\"FDate\",\"Compare\":\"13\",\"Value\":\"\",\"Right\":\"\",\"Logic\":1},{\"Left\":\"\",\"FieldName\":\"FDate\",\"Compare\":\"3\",\"Value\":\"60\",\"Right\":\")\",\"Logic\":0}],\n" +
+                        "    \"FilterString\": [" +
+                        "{\"Left\":\"(\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FDate\",\"Compare\":\"13\",\"Value\":\"\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\")\",\"Logic\":1}," +
+                        "{\"Left\":\"(\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FDate\",\"Compare\":\"3\",\"Value\":\"70\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\")\",\"Logic\":0}],\n" +
                         "    \"OrderString\": \"\",\n" +
                         "    \"TopRowCount\": 0,\n" +
                         "    \"StartRow\": 0,\n" +
                         "    \"Limit\": 8000,\n" +
                         "    \"SubSystemId\": \"\"\n" +
                         "}";
+
                 //查询结果
                 String resultJson = api.billQuery(query);
+
                 //生产信息
                 List<JdProductionOrder> jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+
+                //处理生产订单数据(可能变更的问题)
+                //问题1:是我生产到一半了,他又要换.这肯定是不行的.你只能是新增生产订单,生产错了,你要点结案按钮. 那么就扫不上码了。 回记录是因为生产错了才不生产了
+
+                //问题2:处理的是,没生产第一次开始扫码的时候,这个生产订单对应的 原材料信息,数量信息,单据类型信息都不太一样
+                //生产订单号集合
+
+                //存在MES中有订单信息,但是订单信息不全的可能
+                //查询所有生产订单
+                PlanTaskDetails planTaskDetailsAll=new PlanTaskDetails();
+                planTaskDetailsAll.setStatus("1");
+                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetailsAll);
+
+                //已经有的数据
+                Map<String, PlanTaskDetails> planTaskDetailsMap = planTaskDetails1.stream()
+                        .collect(Collectors.toMap(
+                                PlanTaskDetails::getDemandDocument,
+                                a -> a,
+                                (existing, replacement) -> existing // 如果有重复键,保留原来的值
+                        ));
+                //有改动的订单信息
+                List<String> stringList=new ArrayList<>();
+                PlanTaskDetails mo060721 = planTaskDetailsMap.get("MO060721");
+                System.out.println(mo060721);
+                //循环订单
+                jdProductionOrders.stream().forEach(item->{
+                    System.out.println(item.getDocumentNumber());
+                    if(planTaskDetailsMap.get(item.getDocumentNumber())!=null){
+                        System.out.println(planTaskDetailsMap.get(item.getDocumentNumber())+"1111");
+                        //得到计划信息
+                        PlanTaskDetails planTaskDetails2 = planTaskDetailsMap.get(item.getDocumentNumber());
+
+                        //判断当前生产订单下的物料,跟原来的物料信息,数量信息是否匹配
+                        if(!planTaskDetails2.getMaterialId().equals(item.getMaterialCode()) //物料信息
+                                ||!planTaskDetails2.getQuantity().equals(item.getQuantity())){ //数量
+                            //list集合中添加数据
+                            stringList.add(planTaskDetails2.getDemandDocument());
+                        }
+                    }
+                });
+
+                //执行删除逻辑
+                if (stringList.size()>0){
+                    //删除订单
+                    int i1 = planTaskDetailsMapper.deletePlanTaskDetailsByDemandDocument(stringList);
+                    //删除流转卡数据
+                    int i2 = productionCardFlowMapper.deleteProductionCardFlowByDemandDocumentNumber(stringList);
+                }
+
                 //查询系统中的订单信息
                 ProductionPlanningManagement productionPlanningManagement1 = new ProductionPlanningManagement();
                 productionPlanningManagement1.setIsWeldSheet("1");//1 标识为普通订单
                 List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementList(productionPlanningManagement1);
+
                 //拿到所有订单号
                 List<String> collectTwo = productionPlanningManagements.stream().map(ProductionPlanningManagement::getOrderNumber).collect(Collectors.toSet())
                         .stream().collect(Collectors.toList());
 
-                //对比分析(过滤出来MES系统中不存在的订单)
+                //过滤出来MES系统中不存在的订单
                 Map<String, List<JdProductionOrder>> groupedByDemandDocument = jdProductionOrders.stream()
                         .filter(item -> !collectTwo.contains(item.getDemandDocument()))
                         .collect(Collectors.groupingBy(JdProductionOrder::getDemandDocument));
 
-//                //做一个map用户存订单和计划的对应关系
-//                HashMap<String,String> mapGX = new HashMap<>();
                 //如果有数据
                 if (groupedByDemandDocument.size() > 0) {
                     //订单循环
                     groupedByDemandDocument.forEach((k, v) -> {
                         ProductionPlanningManagement productionPlanningManagement = new ProductionPlanningManagement();
-                        //编号订单号
+                        // 编号订单号
                         productionPlanningManagement.setOrderNumber(k);
-                        //计划编号
+                        // 计划编号
                         String planNumnber = generator.generateCommissionNumber();
                         productionPlanningManagement.setPlanNumber(planNumnber);
                         productionPlanningManagement.setPlanType("0"); //待生产
@@ -203,8 +262,8 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                             productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
                         }
                         //单据类型
-                        if (StringUtils.isNotNull(v.get(0).getDocumentTyep())) {
-                            productionPlanningManagement.setOrderType(v.get(0).getDocumentTyep()); //单据类型
+                        if (StringUtils.isNotNull(v.get(0).getDocumentType())) {
+                            productionPlanningManagement.setOrderType(v.get(0).getDocumentType()); //单据类型
                         }
                         //订单的创建时间
                         productionPlanningManagement.setCreationtimeString(v.get(0).getDocumentDate());//单据的创建时间
@@ -227,17 +286,13 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                                 productionPlanningManagement.setContractNumber(mapList.get(0).get("F.PONP.Text").toString());
                             }
                             productionPlanningManagement.setCompletionTime(fDeliveryDate);
-//                            productionPlanningManagement.setQuantity(String.valueOf(v.size()));//单据数量
                             //======处理基本的订单信息
                             productionPlanningManagementMapper.insertProductionPlanningManagement(productionPlanningManagement);
                             v.forEach(a -> {
                                 PlanTaskDetails planTaskDetails = new PlanTaskDetails();
                                 planTaskDetails.setDemandDocument(a.getDocumentNumber());//需求单据号
                                 planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
-
-                                //订单号 ----计划id
-//                                mapGX.put(a.getDemandDocument(),productionPlanningManagement.getId().toString());
-
+                                planTaskDetails.setDocumentType(a.getDocumentType());//单据类型
                                 planTaskDetails.setMaterialId(a.getMaterialCode());//原材料编码
                                 planTaskDetails.setMaterialName(a.getMaterialName());//名称
                                 planTaskDetails.setQuantity(a.getQuantity());//数量
@@ -269,6 +324,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                             });
                         }
                     });
+
                     //处理订单序列号问题
                     groupedByDemandDocument.forEach((k, v) -> {
                         String stringQuery = "{\n" +
@@ -292,26 +348,30 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                         }
                     });
                 }
-                //更新生产订单数据(能走到这里说明数据拉取成功-存在MES中有订单信息,但是订单信息不全的可能)
+
+                //订单数据拉取成功
+                //存在MES中有订单信息,但是订单信息不全的可能
                 //查询所有生产订单
-                PlanTaskDetails planTaskDetails=new PlanTaskDetails();
-                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+                PlanTaskDetails planTaskDetailsAll2=new PlanTaskDetails();
+                planTaskDetailsAll.setStatus("1");
+                List<PlanTaskDetails> planTaskDetails2 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetailsAll2);
                 //生产订单号集合
-                Set<String> collectA = planTaskDetails1.stream().map(PlanTaskDetails::getDemandDocument).collect(Collectors.toSet());
+                Set<String> collectA = planTaskDetails2.stream().map(PlanTaskDetails::getDemandDocument).collect(Collectors.toSet());
+
                 //拿到MES系统中不存在的生产订单 documentNumber
                 List<JdProductionOrder> collect = jdProductionOrders.stream().filter(item -> !collectA.contains(item.getDocumentNumber())).collect(Collectors.toList());
-                System.out.println(collect.size()+"hmc");
+
                 //生产订单循环
                 collect.forEach(a->{
                     PlanTaskDetails planTaskDetailsAdd = new PlanTaskDetails();
                     planTaskDetailsAdd.setDemandDocument(a.getDocumentNumber());//需求单据号
-//                    String planId = mapGX.get(a.getDocumentNumber());
                     ProductionPlanningManagement productionPlanningManagement2=new ProductionPlanningManagement();
                     productionPlanningManagement2.setOrderNumber(a.getDemandDocument());
                     List<ProductionPlanningManagement> productionPlanningManagements1 = productionPlanningManagementMapper.
                             selectProductionPlanningManagementList(productionPlanningManagement2);
                     if(productionPlanningManagements1.size()>0){
                         planTaskDetailsAdd.setPlanId(Long.valueOf(productionPlanningManagements1.get(0).getId()));//计划id
+                        planTaskDetailsAdd.setDocumentType(a.getDocumentType());//单据类型
                         planTaskDetailsAdd.setMaterialId(a.getMaterialCode());//原材料编码
                         planTaskDetailsAdd.setMaterialName(a.getMaterialName());//名称
                         planTaskDetailsAdd.setQuantity(a.getQuantity());//数量
@@ -340,31 +400,69 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                         planTaskDetailsAdd.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
                         planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetailsAdd);
 
-                        //处理新增订单的序列号问题
-                        String stringQuery = "{\n" +
-                                "    \"FormId\": \"PRD_MO\",\n" +
-                                "    \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
-                                "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\"" + a.getDocumentNumber() + "\",\"Right\":\"\",\"Logic\":0}],\n" +
-                                "    \"OrderString\": \"\",\n" +
-                                "    \"TopRowCount\": 0,\n" +
-                                "    \"StartRow\": 0,\n" +
-                                "    \"Limit\": 2000,\n" +
-                                "    \"SubSystemId\": \"\"\n" +
-                                "}";
-                        try {
-                            //金蝶工具key
-                            K3CloudApi api2 = new K3CloudApi();
-                            String xlhString = api2.billQuery(stringQuery);
-                            if (!xlhString.equals("[]")) {
-                                List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString, ProductionCardFlowVo.class);
-                                int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
+                        //判断那个字段是否为空
+                        boolean present = Optional.ofNullable(a)
+                                .filter(s -> !a.getFMemoItem().isEmpty())
+                                .isPresent();
+                        if(present){
+                            //如果不为空,
+                            String fMemoItem = a.getFMemoItem();
+                            //查询这个单据的序列号是多少
+                            ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                            productionCardFlow.setDemandDocumentNumber(fMemoItem);
+                            List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                            if(productionCardFlows.size()>0){
+                                //循环替换........单据号
+                                List<ProductionCardFlowVo> collect1 = productionCardFlows.stream().map(item -> {
+                                    ProductionCardFlowVo productionCardFlowVo = new ProductionCardFlowVo();
+                                    //生产订单号
+                                    productionCardFlowVo.setDemandDocumentNumber(a.getDocumentNumber());
+                                    productionCardFlowVo.setSerialNumber(item.getSerialNumber());
+                                    productionCardFlowVo.setProductionOrderListId(item.getProductionOrderListId());
+                                    productionCardFlowVo.setPrintQuantity(item.getPrintQuantity());
+                                    productionCardFlowVo.setCreateTime(new Date());//穿管是按
+                                    //返回ok
+                                    return productionCardFlowVo;
+                                }).collect(Collectors.toList());
+                                //插入新的单据号
+                                int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(collect1);
+                                //删除老的订单序列号绑定关系
+                                List<String> mapList1=new ArrayList<>();
+                                mapList1.add(a.getFMemoItem());
+                                if(mapList1.size()>0){
+                                    int i1 = productionCardFlowMapper.deleteProductionCardFlowByDemandDocumentNumber(mapList1);
+                                    System.out.println(i1+"删除几个");
+                                }
+                            }
+                        }else {
+                            //处理新增订单的序列号问题
+                            String stringQuery = "{\n" +
+                                    "    \"FormId\": \"PRD_MO\",\n" +
+                                    "    \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
+                                    "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\"" + a.getDocumentNumber() + "\",\"Right\":\"\",\"Logic\":0}],\n" +
+                                    "    \"OrderString\": \"\",\n" +
+                                    "    \"TopRowCount\": 0,\n" +
+                                    "    \"StartRow\": 0,\n" +
+                                    "    \"Limit\": 2000,\n" +
+                                    "    \"SubSystemId\": \"\"\n" +
+                                    "}";
+                            try {
+                                //金蝶工具key
+                                K3CloudApi api2 = new K3CloudApi();
+                                String xlhString = api2.billQuery(stringQuery);
+                                if (!xlhString.equals("[]")) {
+                                    List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString, ProductionCardFlowVo.class);
+                                    int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
+                                }
+                            } catch (Exception e) {
+                                throw new RuntimeException(e);
                             }
-                        } catch (Exception e) {
-                            throw new RuntimeException(e);
                         }
                     }
 
                 });
+
+
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }finally {
@@ -437,7 +535,7 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
             String resultJson = String.valueOf(api.billQuery(jsonString));
             //查询返回结果json
             List<Map> mapList = JSON.parseArray(resultJson, Map.class);
-             return  mapList;
+            return  mapList;
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
@@ -477,7 +575,6 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                 .stream().collect(Collectors.toList());
         //处理订单序列号问题
         collectOne.stream().forEach(item->{
-//            String documentNumber = item.getDocumentNumber();//需求单据编号
             String stringQuery="{\n" +
                     "    \"FormId\": \"PRD_MO\",\n" +
                     "    \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
@@ -490,10 +587,10 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
                     "}";
             try {
                 String xlhString = api.billQuery(stringQuery);
-                 if(!xlhString.equals("[]")){
-                        List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString,  ProductionCardFlowVo.class);
-                        int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
-                    }
+                if(!xlhString.equals("[]")){
+                    List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString,  ProductionCardFlowVo.class);
+                    int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
+                }
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
@@ -511,157 +608,157 @@ public class JdProductionOrderServiceImpl implements JdProductionOrderService
         Boolean aTrue = stringRedisTemplate.opsForValue().setIfAbsent("fjqy:hjd:pulled", "true");
         if (aTrue) {
 
-                try {
-                    //金蝶工具key
-                    K3CloudApi api = new K3CloudApi();
-                    // 获取当前时间
-                    LocalDateTime now = LocalDateTime.now();
-                    System.out.println("当前时间: " + now);
-                    // 减去三个月
-                    LocalDateTime threeMonthsAgo = now.minusMonths(6);
-                    System.out.println("三个月前的时间: " + threeMonthsAgo);
-                    LocalDateTime localDateTime1 = threeMonthsAgo.withMinute(0).withSecond(0).withNano(0);
-                    DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-                    String format = localDateTime1.format(formatter);
-                    //定义查询条件
-                    String query="{\n" +
-                            "    \"FormId\": \"PRD_MO\",\n" +
-                            "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
-                            "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,,FSaleOrderNo,FPickMtrlStatus," +
-                            "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,F_PONP_XQRQ,FDate,FPlanStartDate,FPlanFinishDate\",\n" +
-                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"17\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0}," +
-                            "{\"Left\":\"\",\"FieldName\":\"FCreateDate\",\"Compare\":\"39\",\"Value\":\""+format+"\",\"Right\":\"\",\"Logic\":0}],\n" +
-                            "    \"OrderString\": \"\",\n" +
-                            "    \"TopRowCount\": 0,\n" +
-                            "    \"StartRow\": 0,\n" +
-                            "    \"Limit\": 5000,\n" +
-                            "    \"SubSystemId\": \"\"\n" +
-                            "}";
-                    int startRow = 0; // 起始行号
-                    int limit = 5000; // 每次查询的数量
+            try {
+                //金蝶工具key
+                K3CloudApi api = new K3CloudApi();
+                // 获取当前时间
+                LocalDateTime now = LocalDateTime.now();
+                System.out.println("当前时间: " + now);
+                // 减去三个月
+                LocalDateTime threeMonthsAgo = now.minusMonths(6);
+                System.out.println("三个月前的时间: " + threeMonthsAgo);
+                LocalDateTime localDateTime1 = threeMonthsAgo.withMinute(0).withSecond(0).withNano(0);
+                DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+                String format = localDateTime1.format(formatter);
+                //定义查询条件
+                String query="{\n" +
+                        "    \"FormId\": \"PRD_MO\",\n" +
+                        "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
+                        "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,,FSaleOrderNo,FPickMtrlStatus," +
+                        "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,F_PONP_XQRQ,FDate,FPlanStartDate,FPlanFinishDate\",\n" +
+                        "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"17\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FCreateDate\",\"Compare\":\"39\",\"Value\":\""+format+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                        "    \"OrderString\": \"\",\n" +
+                        "    \"TopRowCount\": 0,\n" +
+                        "    \"StartRow\": 0,\n" +
+                        "    \"Limit\": 5000,\n" +
+                        "    \"SubSystemId\": \"\"\n" +
+                        "}";
+                int startRow = 0; // 起始行号
+                int limit = 5000; // 每次查询的数量
+                // 更新查询条件中的起始行号
+                //查询条件
+                Map<String, Object> map = JSON.parseObject(query, Map.class);
+                List<JdProductionOrder> jdProductionOrders;
+                boolean flag = true;
+                do {
                     // 更新查询条件中的起始行号
-                    //查询条件
-                    Map<String, Object> map = JSON.parseObject(query, Map.class);
-                    List<JdProductionOrder> jdProductionOrders;
-                    boolean flag = true;
-                    do {
-                        // 更新查询条件中的起始行号
-                        map.put("StartRow", startRow);
-                        //查询结果
-                        String resultJson = api.billQuery(JSON.toJSONString(map));
-                        if (resultJson.isEmpty()||resultJson.equals("[]")) {
-                            // 处理空结果的情况
-                            flag = false;
-                        }else {
-                            //生产信息
-                           jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
-                            //查询系统中的订单信息
-                            ProductionPlanningManagement productionPlanningManagement1=new ProductionPlanningManagement();
-                            productionPlanningManagement1.setIsWeldSheet("2");
-                            List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementList(productionPlanningManagement1);
-
-                            List<String> collectTwo = productionPlanningManagements.stream().map(ProductionPlanningManagement::getOrderNumber).collect(Collectors.toSet())
-                                    .stream().collect(Collectors.toList());
-                            // 过滤掉 collectTwo 中包含的需求文档编号,并按 demandDocument 分组
-                            Map<String, List<JdProductionOrder>> groupedByDemandDocument = jdProductionOrders.stream()
-                                    .filter(item -> !collectTwo.contains(item.getDemandDocument()))
-                                    .collect(Collectors.groupingBy(JdProductionOrder::getDemandDocument));
-                            if(groupedByDemandDocument.size()>0){
-                                //订单循环
-                                groupedByDemandDocument.forEach((k,v)->{
-                                    //计划编号
-                                    String planNumnber = generator.generateCommissionNumber();
-                                    //订单号
-                                    ProductionPlanningManagement productionPlanningManagement=new ProductionPlanningManagement();
-                                    productionPlanningManagement.setOrderNumber(k); //订单编号
-                                    productionPlanningManagement.setPlanNumber(planNumnber);//计划号
-                                    productionPlanningManagement.setPlanType("0"); //待生产
-                                    productionPlanningManagement.setTaskStatus("4");//待排产
-                                    productionPlanningManagement.setIsWeldSheet("2");//焊接订单
-                                    //备注
-                                    if(StringUtils.isNotNull(v.get(0).getRemark())){
-                                        productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
-                                    }
-                                    //订单的创建时间
-                                    productionPlanningManagement.setCreationtimeString(v.get(0).getDocumentDate());//单据的创建时间
-                                    //特殊要求
-                                    if(StringUtils.isNotNull(v.get(0).getTsyq())){
-                                        productionPlanningManagement.setSpecialRequirements(v.get(0).getTsyq());//特殊要求
-                                    }
-                                    //单据类型
-                                    if(StringUtils.isNotNull(v.get(0).getDocumentTyep())){
-                                        productionPlanningManagement.setOrderType(v.get(0).getDocumentTyep()); //单据类型
-                                    }
+                    map.put("StartRow", startRow);
+                    //查询结果
+                    String resultJson = api.billQuery(JSON.toJSONString(map));
+                    if (resultJson.isEmpty()||resultJson.equals("[]")) {
+                        // 处理空结果的情况
+                        flag = false;
+                    }else {
+                        //生产信息
+                        jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+                        //查询系统中的订单信息
+                        ProductionPlanningManagement productionPlanningManagement1=new ProductionPlanningManagement();
+                        productionPlanningManagement1.setIsWeldSheet("2");
+                        List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementList(productionPlanningManagement1);
+
+                        List<String> collectTwo = productionPlanningManagements.stream().map(ProductionPlanningManagement::getOrderNumber).collect(Collectors.toSet())
+                                .stream().collect(Collectors.toList());
+                        // 过滤掉 collectTwo 中包含的需求文档编号,并按 demandDocument 分组
+                        Map<String, List<JdProductionOrder>> groupedByDemandDocument = jdProductionOrders.stream()
+                                .filter(item -> !collectTwo.contains(item.getDemandDocument()))
+                                .collect(Collectors.groupingBy(JdProductionOrder::getDemandDocument));
+                        if(groupedByDemandDocument.size()>0){
+                            //订单循环
+                            groupedByDemandDocument.forEach((k,v)->{
+                                //计划编号
+                                String planNumnber = generator.generateCommissionNumber();
+                                //订单号
+                                ProductionPlanningManagement productionPlanningManagement=new ProductionPlanningManagement();
+                                productionPlanningManagement.setOrderNumber(k); //订单编号
+                                productionPlanningManagement.setPlanNumber(planNumnber);//计划号
+                                productionPlanningManagement.setPlanType("0"); //待生产
+                                productionPlanningManagement.setTaskStatus("4");//待排产
+                                productionPlanningManagement.setIsWeldSheet("2");//焊接订单
+                                //备注
+                                if(StringUtils.isNotNull(v.get(0).getRemark())){
+                                    productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
+                                }
+                                //订单的创建时间
+                                productionPlanningManagement.setCreationtimeString(v.get(0).getDocumentDate());//单据的创建时间
+                                //特殊要求
+                                if(StringUtils.isNotNull(v.get(0).getTsyq())){
+                                    productionPlanningManagement.setSpecialRequirements(v.get(0).getTsyq());//特殊要求
+                                }
+                                //单据类型
+                                if(StringUtils.isNotNull(v.get(0).getDocumentType())){
+                                    productionPlanningManagement.setOrderType(v.get(0).getDocumentType()); //单据类型
+                                }
 
-                                    //编号订单号
-                                    List<Map> mapList = this.jdSalesOrderInfoS(k);//订单详情信息
-                                    String fDeliveryDate;
-                                    if(mapList.size()>0){
-                                        fDeliveryDate = mapList.get(0).get("FDeliveryDate").toString();
-                                    } else {
-                                        fDeliveryDate = "";
+                                //编号订单号
+                                List<Map> mapList = this.jdSalesOrderInfoS(k);//订单详情信息
+                                String fDeliveryDate;
+                                if(mapList.size()>0){
+                                    fDeliveryDate = mapList.get(0).get("FDeliveryDate").toString();
+                                } else {
+                                    fDeliveryDate = "";
+                                }
+                                //拿到了关于这个订单的销售订单
+                                if(mapList.size()>0){
+                                    if(StringUtils.isNotNull(mapList.get(0).get("F.PONP.Text"))){
+                                        productionPlanningManagement.setContractNumber(mapList.get(0).get("F.PONP.Text").toString());
                                     }
-                                    //拿到了关于这个订单的销售订单
-                                    if(mapList.size()>0){
-                                        if(StringUtils.isNotNull(mapList.get(0).get("F.PONP.Text"))){
-                                            productionPlanningManagement.setContractNumber(mapList.get(0).get("F.PONP.Text").toString());
+                                    productionPlanningManagement.setCompletionTime(fDeliveryDate);
+                                    //======处理基本的订单信息
+                                    productionPlanningManagementMapper.insertProductionPlanningManagement(productionPlanningManagement);
+                                    v.forEach(a->{
+                                        PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                                        planTaskDetails.setDemandDocument(a.getDocumentNumber());//需求单据号
+                                        planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
+                                        planTaskDetails.setMaterialId(a.getMaterialCode());//原材料编码
+                                        planTaskDetails.setMaterialName(a.getMaterialName());//名称
+                                        planTaskDetails.setQuantity(a.getQuantity());//数量
+                                        //                                    planTaskDetails.setTimeOfRequest(a.getCompletionTime());//要货时间
+                                        planTaskDetails.setModelNumber(a.getModelNumber());//型号
+                                        planTaskDetails.setSpecification(a.getSpecification());//规格
+                                        planTaskDetails.setMaterialUnit(a.getUnit());//单位
+                                        planTaskDetails.setPower(a.getGl());//功率
+                                        planTaskDetails.setVoltage(a.getDianYaPinLv());//电压频率
+                                        planTaskDetails.setColour(a.getYanse());//颜色
+                                        planTaskDetails.setMingpai(a.getMingpai());//铭牌
+                                        planTaskDetails.setShuomingshu(a.getShuomingshu());//说明书
+                                        planTaskDetails.setHegezheng(a.getHegezheng());//合格证
+                                        planTaskDetails.setBaozhuangxiang(a.getBaozhuangxiang());//包装箱
+                                        planTaskDetails.setSwitchBox(a.getKaiguanxiang());//开关箱
+                                        planTaskDetails.setScheduledCommencement(a.getFPlanStartDate()); //计划开始时间
+                                        planTaskDetails.setScheduledCompletion(a.getFPlanFinishDate()); //计划完工时间
+                                        planTaskDetails.setRemark(a.getRemark());
+                                        if(StringUtils.isNotNull(a.getDocumentDate())){
+                                            planTaskDetails.setTimeOfRequest(a.getDocumentDate());//单据日期
                                         }
-                                        productionPlanningManagement.setCompletionTime(fDeliveryDate);
-                                        //======处理基本的订单信息
-                                        productionPlanningManagementMapper.insertProductionPlanningManagement(productionPlanningManagement);
-                                        v.forEach(a->{
-                                            PlanTaskDetails planTaskDetails=new PlanTaskDetails();
-                                            planTaskDetails.setDemandDocument(a.getDocumentNumber());//需求单据号
-                                            planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
-                                            planTaskDetails.setMaterialId(a.getMaterialCode());//原材料编码
-                                            planTaskDetails.setMaterialName(a.getMaterialName());//名称
-                                            planTaskDetails.setQuantity(a.getQuantity());//数量
-        //                                    planTaskDetails.setTimeOfRequest(a.getCompletionTime());//要货时间
-                                            planTaskDetails.setModelNumber(a.getModelNumber());//型号
-                                            planTaskDetails.setSpecification(a.getSpecification());//规格
-                                            planTaskDetails.setMaterialUnit(a.getUnit());//单位
-                                            planTaskDetails.setPower(a.getGl());//功率
-                                            planTaskDetails.setVoltage(a.getDianYaPinLv());//电压频率
-                                            planTaskDetails.setColour(a.getYanse());//颜色
-                                            planTaskDetails.setMingpai(a.getMingpai());//铭牌
-                                            planTaskDetails.setShuomingshu(a.getShuomingshu());//说明书
-                                            planTaskDetails.setHegezheng(a.getHegezheng());//合格证
-                                            planTaskDetails.setBaozhuangxiang(a.getBaozhuangxiang());//包装箱
-                                            planTaskDetails.setSwitchBox(a.getKaiguanxiang());//开关箱
-                                            planTaskDetails.setScheduledCommencement(a.getFPlanStartDate()); //计划开始时间
-                                            planTaskDetails.setScheduledCompletion(a.getFPlanFinishDate()); //计划完工时间
-                                            planTaskDetails.setRemark(a.getRemark());
-                                            if(StringUtils.isNotNull(a.getDocumentDate())){
-                                                planTaskDetails.setTimeOfRequest(a.getDocumentDate());//单据日期
-                                            }
-                                            planTaskDetails.setFid(a.getFid());
-                                            planTaskDetails.setFtreeEntityFentryid(a.getFtreeEntityFentryid());
-                                            planTaskDetails.setFbillno(a.getDocumentNumber());//生产订单号
-                                            planTaskDetails.setFsrcbillno(a.getDemandDocument());//销售订单号
-                                            planTaskDetails.setFunitidfNumber(a.getFunitidfNumber());//单位
-                                            planTaskDetails.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
-                                            planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
-                                        });
-                                    }
-                                });
-                            }
-                            System.out.println(1);
-                            if (jdProductionOrders.size() < 5000) {
-                                flag = false;
-                            }
-                            // 更新起始行号
-                            startRow += limit;
-                            // 如果返回的数据量小于5000,说明已经没有更多的数据,结束循环
+                                        planTaskDetails.setFid(a.getFid());
+                                        planTaskDetails.setFtreeEntityFentryid(a.getFtreeEntityFentryid());
+                                        planTaskDetails.setFbillno(a.getDocumentNumber());//生产订单号
+                                        planTaskDetails.setFsrcbillno(a.getDemandDocument());//销售订单号
+                                        planTaskDetails.setFunitidfNumber(a.getFunitidfNumber());//单位
+                                        planTaskDetails.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
+                                        planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetails);
+                                    });
+                                }
+                            });
                         }
-                    } while (flag);
-                } catch (Exception e) {
-                    throw new RuntimeException(e);
-                }finally {
-                    stringRedisTemplate.delete("fjqy:ptd:pulled");
-                }
-                return  AjaxResult.success("焊接单拉取成功");
-     }else {
+                        System.out.println(1);
+                        if (jdProductionOrders.size() < 5000) {
+                            flag = false;
+                        }
+                        // 更新起始行号
+                        startRow += limit;
+                        // 如果返回的数据量小于5000,说明已经没有更多的数据,结束循环
+                    }
+                } while (flag);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }finally {
+                stringRedisTemplate.delete("fjqy:ptd:pulled");
+            }
+            return  AjaxResult.success("焊接单拉取成功");
+        }else {
             System.out.println("定时任务正在执行请稍后在拉去");
             return AjaxResult.success("定时任务正在执行请稍后在拉去");
         }

+ 6 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/BpLeaveFactoryMapper.java

@@ -76,4 +76,10 @@ public interface BpLeaveFactoryMapper
      */
     public int deleteBpLeaveFactoryByfIds(String id);
 
+    /**
+     * 查询最大值
+     * @param id
+     * @return
+     */
+    int  selectBpLeaveFactoryByIdMax(Long id);
 }

+ 36 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/IndoorMaterialInformationMapper.java

@@ -1,6 +1,8 @@
 package com.zkqy.amichi.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.zkqy.amichi.domain.IndoorMaterialInformation;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -60,4 +62,38 @@ public interface IndoorMaterialInformationMapper
      * @return 结果
      */
     public int deleteIndoorMaterialInformationByMaterialCodes(String[] materialCodes);
+
+    /**
+     * 批量插入产品信息
+     * @param importExcelList
+     */
+    int  insertIndoorMaterialInformationBatch(List<IndoorMaterialInformation> importExcelList);
+
+    /**
+     * 查看产品分类信息
+     * @param indoorMaterialInformation
+     * @return
+     */
+    List<Map<String, String>> productClassification(IndoorMaterialInformation indoorMaterialInformation);
+
+    /**
+     * 根据产品名称查询型号分类
+     * @param indoorMaterialInformation
+     * @return
+     */
+    List<Map<String, String>> typeClassification(IndoorMaterialInformation indoorMaterialInformation);
+
+    /**
+     * 规格分类
+     * @param indoorMaterialInformation
+     * @return
+     */
+    List<Map<String, String>> specificationClassification(IndoorMaterialInformation indoorMaterialInformation);
+
+    /**
+     * 根据  名称 型号 规格 反查物料编码
+     * @param indoorMaterialInformation
+     * @return
+     */
+    IndoorMaterialInformation queryMaterialCode(IndoorMaterialInformation indoorMaterialInformation);
 }

+ 9 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/IndoorProductionGroupInformationMapper.java

@@ -2,6 +2,7 @@ package com.zkqy.amichi.mapper;
 
 import java.util.List;
 import com.zkqy.amichi.domain.IndoorProductionGroupInformation;
+import org.apache.ibatis.annotations.Mapper;
 
 /**
  * 分组信息:用于记录各个分组的基本信息Mapper接口
@@ -9,6 +10,7 @@ import com.zkqy.amichi.domain.IndoorProductionGroupInformation;
  * @author ruoyi
  * @date 2025-02-11
  */
+@Mapper
 public interface IndoorProductionGroupInformationMapper 
 {
     /**
@@ -58,4 +60,11 @@ public interface IndoorProductionGroupInformationMapper
      * @return 结果
      */
     public int deleteIndoorProductionGroupInformationByIds(Long[] ids);
+
+    /**
+     * 批量插入组信息
+     * @param collect
+     * @return
+     */
+    int  insertIndoorProductionGroupInformationBatch(List<IndoorProductionGroupInformation> collect);
 }

+ 7 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/JlIncomingInspectionMapper.java

@@ -76,4 +76,11 @@ public interface JlIncomingInspectionMapper
      * @return
      */
     int deleteJlIncomingInspectionByfId(Long id);
+
+    /**
+     * 进料
+     * @param id
+     * @return
+     */
+    int selectJlIncomingInspectionByIdMax(Long id);
 }

+ 1 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/PlanTaskDetailsMapper.java

@@ -74,6 +74,7 @@ public interface PlanTaskDetailsMapper
      */
     public int deletePlanTaskDetailsByIds(Long[] ids);
 
+    public int deletePlanTaskDetailsByDemandDocument(List<String> ids);
     /**
      * 查询计划详情列表根据计划id
      * @return

+ 9 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/ProcedureListMapper.java

@@ -1,6 +1,8 @@
 package com.zkqy.amichi.mapper;
 
 import java.util.List;
+import java.util.Map;
+
 import com.zkqy.amichi.domain.ProcedureList;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -29,6 +31,13 @@ public interface ProcedureListMapper
      */
     public List<ProcedureList> selectProcedureListList(ProcedureList procedureList);
 
+    /**
+     * 返回Map
+     * @return
+     */
+    public List<ProcedureList> selectProcedureListMap();
+
+
     /**
      * 新增工序列表
      * 

+ 5 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/ProductionCardFlowMapper.java

@@ -65,6 +65,9 @@ public interface ProductionCardFlowMapper
      */
     public int deleteProductionCardFlowByIds(Long[] ids);
 
+
+
+
     /**
      * 批量插入流转卡数据
      * @param productionCardFlows
@@ -75,5 +78,6 @@ public interface ProductionCardFlowMapper
 
     public int insertProductionCardFlowBatchVo(List<ProductionCardFlowVo> productionCardFlows);
 
-
+//    批量删除工序流转卡流水
+    int deleteProductionCardFlowByDemandDocumentNumber(List<String> stringList);
 }

+ 63 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/ProductionReportingRecordMapper.java

@@ -0,0 +1,63 @@
+package com.zkqy.amichi.mapper;
+
+import java.util.List;
+import com.zkqy.amichi.domain.ProductionReportingRecord;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 汇报审核单据Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2025-02-25
+ */
+@Mapper
+public interface ProductionReportingRecordMapper 
+{
+    /**
+     * 查询汇报审核单据
+     * 
+     * @param id 汇报审核单据主键
+     * @return 汇报审核单据
+     */
+    public ProductionReportingRecord selectProductionReportingRecordById(Long id);
+
+    /**
+     * 查询汇报审核单据列表
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 汇报审核单据集合
+     */
+    public List<ProductionReportingRecord> selectProductionReportingRecordList(ProductionReportingRecord productionReportingRecord);
+
+    /**
+     * 新增汇报审核单据
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 结果
+     */
+    public int insertProductionReportingRecord(ProductionReportingRecord productionReportingRecord);
+
+    /**
+     * 修改汇报审核单据
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 结果
+     */
+    public int updateProductionReportingRecord(ProductionReportingRecord productionReportingRecord);
+
+    /**
+     * 删除汇报审核单据
+     * 
+     * @param id 汇报审核单据主键
+     * @return 结果
+     */
+    public int deleteProductionReportingRecordById(Long id);
+
+    /**
+     * 批量删除汇报审核单据
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteProductionReportingRecordByIds(Long[] ids);
+}

+ 14 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/mapper/QualityinspectioninformationMapper.java

@@ -60,4 +60,18 @@ public interface QualityinspectioninformationMapper
      * @return 结果
      */
     public int deleteQualityinspectioninformationByIds(Long[] ids);
+
+    /**
+     * 最大计算
+     * @param manufacturingProcess
+     * @return
+     */
+    int selectQualityinspectioninformationListMax(String manufacturingProcess);
+
+    /**
+     * 查询单个质检信息
+     * @param qualityinspectioninformation
+     * @return
+     */
+    Qualityinspectioninformation selectQualityinspectioninformation(Qualityinspectioninformation qualityinspectioninformation);
 }

+ 130 - 42
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/scheduling/ScheduledBean.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSON;
 import com.kingdee.bos.webapi.sdk.K3CloudApi;
 import com.zkqy.amichi.domain.MaterialBaseInfo;
 import com.zkqy.amichi.domain.PlanTaskDetails;
+import com.zkqy.amichi.domain.ProductionCardFlow;
 import com.zkqy.amichi.domain.ProductionPlanningManagement;
 import com.zkqy.amichi.jd.domain.JdMaterialBaseInfoVo;
 import com.zkqy.amichi.jd.domain.JdProductionOrder;
@@ -77,13 +78,19 @@ public class ScheduledBean {
                 //金蝶工具key
                 K3CloudApi api = new K3CloudApi();
                 //定义查询条件
-                String query="{\n" +
+                String query = "{\n" +
                         "    \"FormId\": \"PRD_MO\",\n" +
                         "    \"FieldKeys\": \"FBomId.FNumber,FUnitId.FNumber,fid,FSrcBillNo,FTreeEntity_FEntryId,FDescription,F_PONP_teshuyaoqiu,FBillNo,FBillType,FDate,FDocumentStatus," +
-                        "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,FSaleOrderNo,FPickMtrlStatus," +
+                        "FProductType,FMaterialId,FWorkShopID0,FQty,FStatus,FSaleOrderNo,FPickMtrlStatus,FMemoItem," +
                         "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" +
-                        "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FDate\",\"Compare\":\"13\",\"Value\":\"\",\"Right\":\"\",\"Logic\":1}],\n" +
+                        "    \"FilterString\": [" +
+                        "{\"Left\":\"(\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FDate\",\"Compare\":\"13\",\"Value\":\"\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\")\",\"Logic\":1}," +
+                        "{\"Left\":\"(\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FDate\",\"Compare\":\"3\",\"Value\":\"70\",\"Right\":\"\",\"Logic\":0}," +
+                        "{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\")\",\"Logic\":0}],\n" +
                         "    \"OrderString\": \"\",\n" +
                         "    \"TopRowCount\": 0,\n" +
                         "    \"StartRow\": 0,\n" +
@@ -94,6 +101,55 @@ public class ScheduledBean {
                 String resultJson = api.billQuery(query);
                 //生产信息
                 List<JdProductionOrder> jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+
+                //处理生产订单数据(可能变更的问题)
+                //问题1:是我生产到一半了,他又要换.这肯定是不行的.你只能是新增生产订单,生产错了,你要点结案按钮. 那么就扫不上码了。 回记录是因为生产错了才不生产了
+
+                //问题2:处理的是,没生产第一次开始扫码的时候,这个生产订单对应的 原材料信息,数量信息,单据类型信息都不太一样
+                //生产订单号集合
+
+                //存在MES中有订单信息,但是订单信息不全的可能
+                //查询所有生产订单
+                PlanTaskDetails planTaskDetailsAll=new PlanTaskDetails();
+                planTaskDetailsAll.setStatus("1");
+                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetailsAll);
+
+                //已经有的数据
+                Map<String, PlanTaskDetails> planTaskDetailsMap = planTaskDetails1.stream()
+                        .collect(Collectors.toMap(
+                                PlanTaskDetails::getDemandDocument,
+                                a -> a,
+                                (existing, replacement) -> existing // 如果有重复键,保留原来的值
+                        ));
+                //有改动的订单信息
+                List<String> stringList=new ArrayList<>();
+
+                //循环订单
+                jdProductionOrders.stream().forEach(item->{
+                    if(planTaskDetailsMap.get(item.getDemandDocument())!=null){
+                        //得到计划信息
+                        PlanTaskDetails planTaskDetails2 = planTaskDetailsMap.get(item.getDemandDocument());
+
+                        //判断当前生产订单下的物料,跟原来的物料信息,数量信息是否匹配
+                        if(!planTaskDetails2.getMaterialId().equals(item.getMaterialCode()) //物料信息
+                                ||!planTaskDetails2.getQuantity().equals(item.getQuantity())){ //数量
+                            //list集合中添加数据
+                            stringList.add(planTaskDetails2.getDemandDocument());
+                        }
+                    }
+                });
+
+                //执行删除逻辑
+                if (stringList.size()>0){
+                    //删除订单
+                    int i1 = planTaskDetailsMapper.deletePlanTaskDetailsByDemandDocument(stringList);
+                    //删除流转卡数据
+                    int i2 = productionCardFlowMapper.deleteProductionCardFlowByDemandDocumentNumber(stringList);
+                    if (i1>0&&i2>0){
+                        System.out.println("删除成功更新"+i1+"条订单"+i2+"条流转卡数据");
+                    }
+                }
+
                 //查询系统中的订单信息
                 ProductionPlanningManagement productionPlanningManagement1=new ProductionPlanningManagement();
                 productionPlanningManagement1.setIsWeldSheet("1");
@@ -126,8 +182,8 @@ public class ScheduledBean {
                             productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
                         }
                         //单据类型
-                        if(StringUtils.isNotNull(v.get(0).getDocumentTyep())){
-                            productionPlanningManagement.setOrderType(v.get(0).getDocumentTyep()); //单据类型
+                        if(StringUtils.isNotNull(v.get(0).getDocumentType())){
+                            productionPlanningManagement.setOrderType(v.get(0).getDocumentType()); //单据类型
                         }
                         //订单的创建时间
                         productionPlanningManagement.setCreationtimeString(v.get(0).getDocumentDate());//单据的创建时间
@@ -156,6 +212,7 @@ public class ScheduledBean {
                                 PlanTaskDetails planTaskDetails=new PlanTaskDetails();
                                 planTaskDetails.setDemandDocument(a.getDocumentNumber());//需求单据号
                                 planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
+                                planTaskDetails.setDocumentType(a.getDocumentType());//单据类型
                                 planTaskDetails.setMaterialId(a.getMaterialCode());//原材料编码
                                 planTaskDetails.setMaterialName(a.getMaterialName());//名称
                                 planTaskDetails.setQuantity(a.getQuantity());//数量
@@ -212,14 +269,17 @@ public class ScheduledBean {
                         }
                     });
                 }
-                //更新生产订单数据(能走到这里说明数据拉取成功-存在MES中有订单信息,但是订单信息不全的可能)
-                //查询所有生产订单
-                PlanTaskDetails planTaskDetails=new PlanTaskDetails();
-                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+                //订单数据拉取成功
+
                 //生产订单号集合
-                Set<String> collectA = planTaskDetails1.stream().map(PlanTaskDetails::getDemandDocument).collect(Collectors.toSet());
+                PlanTaskDetails planTaskDetailsAll2=new PlanTaskDetails();
+                planTaskDetailsAll.setStatus("1");
+                List<PlanTaskDetails> planTaskDetails2 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetailsAll2);
+                Set<String> collectA = planTaskDetails2.stream().map(PlanTaskDetails::getDemandDocument).collect(Collectors.toSet());
+
                 //拿到MES系统中不存在的生产订单 documentNumber
                 List<JdProductionOrder> collect = jdProductionOrders.stream().filter(item -> !collectA.contains(item.getDocumentNumber())).collect(Collectors.toList());
+
                 //生产订单循环
                 collect.forEach(a->{
                     PlanTaskDetails planTaskDetailsAdd = new PlanTaskDetails();
@@ -231,6 +291,7 @@ public class ScheduledBean {
                             selectProductionPlanningManagementList(productionPlanningManagement2);
                     if(productionPlanningManagements1.size()>0){
                         planTaskDetailsAdd.setPlanId(Long.valueOf(productionPlanningManagements1.get(0).getId()));//计划id
+                        planTaskDetailsAdd.setDocumentType(a.getDocumentType());//单据类型
                         planTaskDetailsAdd.setMaterialId(a.getMaterialCode());//原材料编码
                         planTaskDetailsAdd.setMaterialName(a.getMaterialName());//名称
                         planTaskDetailsAdd.setQuantity(a.getQuantity());//数量
@@ -259,30 +320,65 @@ public class ScheduledBean {
                         planTaskDetailsAdd.setFbomIdFnumber(a.getFbomIdFnumber());//BOM版本
                         planTaskDetailsMapper.insertPlanTaskDetails(planTaskDetailsAdd);
 
-                        //处理新增订单的序列号问题
-                        String stringQuery = "{\n" +
-                                "    \"FormId\": \"PRD_MO\",\n" +
-                                "    \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
-                                "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\"" + a.getDocumentNumber() + "\",\"Right\":\"\",\"Logic\":0}],\n" +
-                                "    \"OrderString\": \"\",\n" +
-                                "    \"TopRowCount\": 0,\n" +
-                                "    \"StartRow\": 0,\n" +
-                                "    \"Limit\": 2000,\n" +
-                                "    \"SubSystemId\": \"\"\n" +
-                                "}";
-                        try {
-                            //金蝶工具key
-                            K3CloudApi api2 = new K3CloudApi();
-                            String xlhString = api2.billQuery(stringQuery);
-                            if (!xlhString.equals("[]")) {
-                                List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString, ProductionCardFlowVo.class);
-                                int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
+                        //判断那个字段是否为空
+                        boolean present = Optional.ofNullable(a)
+                                .filter(s -> !a.getFMemoItem().isEmpty())
+                                .isPresent();
+                        if(present){
+                            //如果不为空,
+                            String fMemoItem = a.getFMemoItem();
+                            //查询这个单据的序列号是多少
+                            ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+                            productionCardFlow.setDemandDocumentNumber(fMemoItem);
+                            List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                            if(productionCardFlows.size()>0){
+                                //循环替换........单据号
+                                List<ProductionCardFlowVo> collect1 = productionCardFlows.stream().map(item -> {
+                                    ProductionCardFlowVo productionCardFlowVo = new ProductionCardFlowVo();
+                                    //生产订单号
+                                    productionCardFlowVo.setDemandDocumentNumber(a.getDocumentNumber());
+                                    productionCardFlowVo.setSerialNumber(item.getSerialNumber());
+                                    productionCardFlowVo.setProductionOrderListId(item.getProductionOrderListId());
+                                    productionCardFlowVo.setPrintQuantity(item.getPrintQuantity());
+                                    productionCardFlowVo.setCreateTime(new Date());//穿管是按
+                                    //返回ok
+                                    return productionCardFlowVo;
+                                }).collect(Collectors.toList());
+                                //插入新的单据号
+                                int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(collect1);
+                                //删除老的订单序列号绑定关系
+                                List<String> mapList1=new ArrayList<>();
+                                mapList1.add(a.getFMemoItem());
+                                if(mapList1.size()>0){
+                                    int i1 = productionCardFlowMapper.deleteProductionCardFlowByDemandDocumentNumber(mapList1);
+                                    System.out.println("删除一个");
+                                }
+                            }
+                        }else {
+                            //处理新增订单的序列号问题
+                            String stringQuery = "{\n" +
+                                    "    \"FormId\": \"PRD_MO\",\n" +
+                                    "    \"FieldKeys\": \"FBillNo,FSNQty1,FSaleOrderNo,FSerialNo\",\n" +
+                                    "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FMaterialId.FNumber\",\"Compare\":\"34\",\"Value\":\"焊\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"4\",\"Right\":\"\",\"Logic\":0},{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\"" + a.getDocumentNumber() + "\",\"Right\":\"\",\"Logic\":0}],\n" +
+                                    "    \"OrderString\": \"\",\n" +
+                                    "    \"TopRowCount\": 0,\n" +
+                                    "    \"StartRow\": 0,\n" +
+                                    "    \"Limit\": 2000,\n" +
+                                    "    \"SubSystemId\": \"\"\n" +
+                                    "}";
+                            try {
+                                //金蝶工具key
+                                K3CloudApi api2 = new K3CloudApi();
+                                String xlhString = api2.billQuery(stringQuery);
+                                if (!xlhString.equals("[]")) {
+                                    List<ProductionCardFlowVo> mapList1 = JSON.parseArray(xlhString, ProductionCardFlowVo.class);
+                                    int i = productionCardFlowMapper.insertProductionCardFlowBatchVo(mapList1);
+                                }
+                            } catch (Exception e) {
+                                throw new RuntimeException(e);
                             }
-                        } catch (Exception e) {
-                            throw new RuntimeException(e);
                         }
                     }
-
                 });
             } catch (Exception e) {
                 throw new RuntimeException(e);
@@ -479,15 +575,6 @@ public class ScheduledBean {
                                 productionPlanningManagement.setPlanType("0"); //待生产
                                 productionPlanningManagement.setTaskStatus("4");//待排产
                                 productionPlanningManagement.setIsWeldSheet("2");//焊接订单
-                                //                            //计算订单的最大完成时间
-                                //                            Optional<LocalDateTime> maxCompletionTime = v.stream()
-                                //                                    .map(item -> LocalDateTime.parse(item.getCompletionTime(), DateTimeFormatter.ISO_LOCAL_DATE_TIME))
-                                //                                    .max(Comparator.naturalOrder());
-                                //                            maxCompletionTime.ifPresent(maxTime ->{
-                                //                                System.out.println("最大的时间: " + maxTime);
-                                //                                String format1 = maxTime.format(formatter);
-                                //                                productionPlanningManagement.setCompletionTime(format1);//订单的最大完成时间
-                                //                            });
                                 //备注
                                 if (StringUtils.isNotNull(v.get(0).getRemark())) {
                                     productionPlanningManagement.setRemark(v.get(0).getRemark()); //备注
@@ -499,8 +586,8 @@ public class ScheduledBean {
                                     productionPlanningManagement.setSpecialRequirements(v.get(0).getTsyq());//特殊要求
                                 }
                                 //单据类型
-                                if (StringUtils.isNotNull(v.get(0).getDocumentTyep())) {
-                                    productionPlanningManagement.setOrderType(v.get(0).getDocumentTyep()); //单据类型
+                                if (StringUtils.isNotNull(v.get(0).getDocumentType())) {
+                                    productionPlanningManagement.setOrderType(v.get(0).getDocumentType()); //单据类型
                                 }
 
                                 //编号订单号
@@ -523,6 +610,7 @@ public class ScheduledBean {
                                         PlanTaskDetails planTaskDetails = new PlanTaskDetails();
                                         planTaskDetails.setDemandDocument(a.getDocumentNumber());//需求单据号
                                         planTaskDetails.setPlanId(productionPlanningManagement.getId());//计划id
+                                        planTaskDetails.setDocumentType(a.getDocumentType());//单据类型
                                         planTaskDetails.setMaterialId(a.getMaterialCode());//原材料编码
                                         planTaskDetails.setMaterialName(a.getMaterialName());//名称
                                         planTaskDetails.setQuantity(a.getQuantity());//数量

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

@@ -1,6 +1,8 @@
 package com.zkqy.amichi.service;
 
 import java.util.List;
+import java.util.Map;
+
 import com.zkqy.amichi.domain.IndoorMaterialInformation;
 
 /**
@@ -58,4 +60,36 @@ public interface IIndoorMaterialInformationService
      * @return 结果
      */
     public int deleteIndoorMaterialInformationByMaterialCode(String materialCode);
+
+
+    /**
+     * 产品分类
+     * label  value
+     * @param indoorMaterialInformation
+     * @return
+     */
+    List<Map<String,String>> productClassification(IndoorMaterialInformation indoorMaterialInformation);
+
+    /**
+     * 型号分类
+     * label  value
+     * @param indoorMaterialInformation
+     * @return
+     */
+    List<Map<String, String>> typeClassification(IndoorMaterialInformation indoorMaterialInformation);
+
+    /**
+     * 规格分类
+     * label  value
+     * @param indoorMaterialInformation
+     * @return
+     */
+    List<Map<String, String>> specificationClassification(IndoorMaterialInformation indoorMaterialInformation);
+
+    /**
+     * 反查物料编码
+     * @param indoorMaterialInformation
+     * @return
+     */
+    IndoorMaterialInformation queryMaterialCode(IndoorMaterialInformation indoorMaterialInformation);
 }

+ 20 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IIndoorProductionGroupInformationService.java

@@ -1,7 +1,11 @@
 package com.zkqy.amichi.service;
 
 import java.util.List;
+import java.util.Map;
+
+import com.zkqy.amichi.domain.IndoorMaterialInformation;
 import com.zkqy.amichi.domain.IndoorProductionGroupInformation;
+import com.zkqy.amichi.domain.vo.IndoorProductionGroupInformationTreeVo;
 
 /**
  * 分组信息:用于记录各个分组的基本信息Service接口
@@ -58,4 +62,20 @@ public interface IIndoorProductionGroupInformationService
      * @return 结果
      */
     public int deleteIndoorProductionGroupInformationById(Long id);
+
+    /**
+     * 创建树形菜单列表
+     * @param id
+     * @return
+     */
+    List<IndoorProductionGroupInformationTreeVo> treeList(Long id);
+
+    /**
+     * 导入产品信息
+     * @param importExcelList
+     * @param updateSupport
+     * @param operName
+     * @return
+     */
+    String importUser(List<IndoorMaterialInformation> importExcelList, boolean updateSupport, String operName);
 }

+ 61 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IProductionReportingRecordService.java

@@ -0,0 +1,61 @@
+package com.zkqy.amichi.service;
+
+import java.util.List;
+import com.zkqy.amichi.domain.ProductionReportingRecord;
+
+/**
+ * 汇报审核单据Service接口
+ * 
+ * @author ruoyi
+ * @date 2025-02-25
+ */
+public interface IProductionReportingRecordService 
+{
+    /**
+     * 查询汇报审核单据
+     * 
+     * @param id 汇报审核单据主键
+     * @return 汇报审核单据
+     */
+    public ProductionReportingRecord selectProductionReportingRecordById(Long id);
+
+    /**
+     * 查询汇报审核单据列表
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 汇报审核单据集合
+     */
+    public List<ProductionReportingRecord> selectProductionReportingRecordList(ProductionReportingRecord productionReportingRecord);
+
+    /**
+     * 新增汇报审核单据
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 结果
+     */
+    public int insertProductionReportingRecord(ProductionReportingRecord productionReportingRecord);
+
+    /**
+     * 修改汇报审核单据
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 结果
+     */
+    public int updateProductionReportingRecord(ProductionReportingRecord productionReportingRecord);
+
+    /**
+     * 批量删除汇报审核单据
+     * 
+     * @param ids 需要删除的汇报审核单据主键集合
+     * @return 结果
+     */
+    public int deleteProductionReportingRecordByIds(Long[] ids);
+
+    /**
+     * 删除汇报审核单据信息
+     * 
+     * @param id 汇报审核单据主键
+     * @return 结果
+     */
+    public int deleteProductionReportingRecordById(Long id);
+}

+ 8 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/IQualityinspectioninformationService.java

@@ -58,4 +58,12 @@ public interface IQualityinspectioninformationService
      * @return 结果
      */
     public int deleteQualityinspectioninformationById(Long id);
+
+
+    /**
+     * 单个查询质检信息
+     * @param qualityinspectioninformation
+     * @return
+     */
+    Qualityinspectioninformation selectQualityinspectioninformation(Qualityinspectioninformation qualityinspectioninformation);
 }

+ 4 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/BpLeaveFactoryServiceImpl.java

@@ -30,6 +30,10 @@ public class BpLeaveFactoryServiceImpl implements IBpLeaveFactoryService
     @Override
     public BpLeaveFactory selectBpLeaveFactoryById(Long id)
     {
+        if(id.equals("0000")){
+            int i = bpLeaveFactoryMapper.selectBpLeaveFactoryByIdMax(id);
+            id=Long.parseLong(String.valueOf(i));
+        }
         return bpLeaveFactoryMapper.selectBpLeaveFactoryById(id);
     }
 

+ 45 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/IndoorMaterialInformationServiceImpl.java

@@ -1,6 +1,8 @@
 package com.zkqy.amichi.service.impl;
 
 import java.util.List;
+import java.util.Map;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zkqy.amichi.mapper.IndoorMaterialInformationMapper;
@@ -31,6 +33,9 @@ public class IndoorMaterialInformationServiceImpl implements IIndoorMaterialInfo
         return indoorMaterialInformationMapper.selectIndoorMaterialInformationByMaterialCode(materialCode);
     }
 
+
+
+
     /**
      * 查询场内计划信息列表
      * 
@@ -90,4 +95,44 @@ public class IndoorMaterialInformationServiceImpl implements IIndoorMaterialInfo
     {
         return indoorMaterialInformationMapper.deleteIndoorMaterialInformationByMaterialCode(materialCode);
     }
+
+    /**
+     * 产品分类
+     * @param indoorMaterialInformation
+     * @return
+     */
+    @Override
+    public List<Map<String, String>> productClassification(IndoorMaterialInformation indoorMaterialInformation) {
+        return indoorMaterialInformationMapper.productClassification(indoorMaterialInformation);
+    }
+
+    /**
+     * 型号分类
+     * @param indoorMaterialInformation
+     * @return
+     */
+    @Override
+    public List<Map<String, String>> typeClassification(IndoorMaterialInformation indoorMaterialInformation) {
+        return indoorMaterialInformationMapper.typeClassification(indoorMaterialInformation);
+    }
+
+    /**
+     * 规格分类
+     * @param indoorMaterialInformation
+     * @return
+     */
+    @Override
+    public List<Map<String, String>> specificationClassification(IndoorMaterialInformation indoorMaterialInformation) {
+        return indoorMaterialInformationMapper.specificationClassification(indoorMaterialInformation);
+    }
+
+    /**
+     * 反查物料编码
+     * @param indoorMaterialInformation
+     * @return
+     */
+    @Override
+    public IndoorMaterialInformation queryMaterialCode(IndoorMaterialInformation indoorMaterialInformation) {
+        return indoorMaterialInformationMapper.queryMaterialCode(indoorMaterialInformation);
+    }
 }

+ 8 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/IndoorPlanInformationServiceImpl.java

@@ -1,6 +1,9 @@
 package com.zkqy.amichi.service.impl;
 
 import java.util.List;
+import java.util.Random;
+import java.util.UUID;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zkqy.amichi.mapper.IndoorPlanInformationMapper;
@@ -40,6 +43,7 @@ public class IndoorPlanInformationServiceImpl implements IIndoorPlanInformationS
     @Override
     public List<IndoorPlanInformation> selectIndoorPlanInformationList(IndoorPlanInformation indoorPlanInformation)
     {
+
         return indoorPlanInformationMapper.selectIndoorPlanInformationList(indoorPlanInformation);
     }
 
@@ -52,6 +56,10 @@ public class IndoorPlanInformationServiceImpl implements IIndoorPlanInformationS
     @Override
     public int insertIndoorPlanInformation(IndoorPlanInformation indoorPlanInformation)
     {
+        //任务状态
+        indoorPlanInformation.setPlanStatus("1");
+        //任务id
+        indoorPlanInformation.setTaskId(UUID.randomUUID().toString());
         return indoorPlanInformationMapper.insertIndoorPlanInformation(indoorPlanInformation);
     }
 

+ 81 - 1
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/IndoorProductionGroupInformationServiceImpl.java

@@ -1,6 +1,13 @@
 package com.zkqy.amichi.service.impl;
 
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import com.zkqy.amichi.domain.IndoorMaterialInformation;
+import com.zkqy.amichi.domain.vo.IndoorProductionGroupInformationTreeVo;
+import com.zkqy.amichi.domain.vo.SemiFinishedMaterialListVo;
+import com.zkqy.amichi.mapper.IndoorMaterialInformationMapper;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.zkqy.amichi.mapper.IndoorProductionGroupInformationMapper;
@@ -19,6 +26,9 @@ public class IndoorProductionGroupInformationServiceImpl implements IIndoorProdu
     @Autowired
     private IndoorProductionGroupInformationMapper indoorProductionGroupInformationMapper;
 
+    @Autowired
+    private IndoorMaterialInformationMapper indoorMaterialInformationMapper;
+
     /**
      * 查询分组信息:用于记录各个分组的基本信息
      * 
@@ -90,4 +100,74 @@ public class IndoorProductionGroupInformationServiceImpl implements IIndoorProdu
     {
         return indoorProductionGroupInformationMapper.deleteIndoorProductionGroupInformationById(id);
     }
+
+    @Override
+    public String importUser(List<IndoorMaterialInformation> importExcelList, boolean updateSupport, String operName) {
+        //批量插入数据
+        int i = indoorMaterialInformationMapper.insertIndoorMaterialInformationBatch(importExcelList);
+
+        //收集一个Set集合,然后转换成一个List<String> 因为Set具备天然去重的功能
+        List<String> collectA = importExcelList.stream().map(IndoorMaterialInformation::getGroupName)
+                .collect(Collectors.toSet())
+                .stream().collect(Collectors.toList());
+
+        //查询当前分组列表数据,取差集
+        IndoorProductionGroupInformation productionGroupInformation=new IndoorProductionGroupInformation();
+        List<IndoorProductionGroupInformation> indoorProductionGroupInformations =
+                indoorProductionGroupInformationMapper.selectIndoorProductionGroupInformationList(productionGroupInformation);
+
+        List<String> collectB = indoorProductionGroupInformations.stream().map(IndoorProductionGroupInformation::getGroupName)
+                .collect(Collectors.toSet())
+                .stream().collect(Collectors.toList());
+
+        //从A中删除已经存在即的组名数据
+        collectA.removeAll(collectB);
+        if(collectA.size()>0){
+            List<IndoorProductionGroupInformation> collect = collectA.stream().map(item -> {
+                IndoorProductionGroupInformation groupInformation = new IndoorProductionGroupInformation();
+                groupInformation.setParentId("1");
+                groupInformation.setGroupName(item);
+                return groupInformation;
+            }).collect(Collectors.toList());
+            //添加组数据
+            indoorProductionGroupInformationMapper.insertIndoorProductionGroupInformationBatch(collect);
+        }
+
+        //循环输出
+        collectA.stream().forEach(System.out::println);
+
+        return "导入成功"+i;
+    }
+
+    @Override
+    public List<IndoorProductionGroupInformationTreeVo> treeList(Long id) {
+        // 查询组信息列表
+        IndoorProductionGroupInformation  IndoorProductionGroupInformation=new IndoorProductionGroupInformation();
+        List<IndoorProductionGroupInformation> indoorProductionGroupInformations = indoorProductionGroupInformationMapper
+                .selectIndoorProductionGroupInformationList(IndoorProductionGroupInformation);
+        List<IndoorProductionGroupInformationTreeVo> children = this.findChildren(id.toString(), indoorProductionGroupInformations);
+        return children;
+    }
+
+
+
+
+    // 构建树形结构的方法
+    private List<IndoorProductionGroupInformationTreeVo> findChildren(String parentId, List<IndoorProductionGroupInformation> IndoorProductionGroupInformationTreeVoAll) {
+        List<IndoorProductionGroupInformationTreeVo> collect = IndoorProductionGroupInformationTreeVoAll.stream()
+                .filter(child -> child.getParentId().equals(parentId))
+                .map(child -> {
+                    // 创建一个新的节点对象
+                    IndoorProductionGroupInformationTreeVo indoorProductionGroupInformationTreeVo = new IndoorProductionGroupInformationTreeVo();
+                    indoorProductionGroupInformationTreeVo.setId(child.getId().toString());
+                    indoorProductionGroupInformationTreeVo.setLabel(child.getGroupName());
+                    // 递归查找孙子节点
+                    List<IndoorProductionGroupInformationTreeVo> children = findChildren(child.getId().toString(), IndoorProductionGroupInformationTreeVoAll);
+                    if (!children.isEmpty()) {
+                        indoorProductionGroupInformationTreeVo.setChildren(children);
+                    }
+                    return  indoorProductionGroupInformationTreeVo;
+                }).collect(Collectors.toList());
+        return  collect;
+    }
 }

+ 4 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/JlIncomingInspectionServiceImpl.java

@@ -30,6 +30,10 @@ public class JlIncomingInspectionServiceImpl implements IJlIncomingInspectionSer
     @Override
     public JlIncomingInspection selectJlIncomingInspectionById(Long id)
     {
+        if(id.equals("0000")){
+            int i = jlIncomingInspectionMapper.selectJlIncomingInspectionByIdMax(id);
+            id=Long.parseLong(String.valueOf(i));
+        }
         return jlIncomingInspectionMapper.selectJlIncomingInspectionById(id);
     }
 

+ 93 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/ProductionReportingRecordServiceImpl.java

@@ -0,0 +1,93 @@
+package com.zkqy.amichi.service.impl;
+
+import java.util.List;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.zkqy.amichi.mapper.ProductionReportingRecordMapper;
+import com.zkqy.amichi.domain.ProductionReportingRecord;
+import com.zkqy.amichi.service.IProductionReportingRecordService;
+
+/**
+ * 汇报审核单据Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2025-02-25
+ */
+@Service
+public class ProductionReportingRecordServiceImpl implements IProductionReportingRecordService 
+{
+    @Autowired
+    private ProductionReportingRecordMapper productionReportingRecordMapper;
+
+    /**
+     * 查询汇报审核单据
+     * 
+     * @param id 汇报审核单据主键
+     * @return 汇报审核单据
+     */
+    @Override
+    public ProductionReportingRecord selectProductionReportingRecordById(Long id)
+    {
+        return productionReportingRecordMapper.selectProductionReportingRecordById(id);
+    }
+
+    /**
+     * 查询汇报审核单据列表
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 汇报审核单据
+     */
+    @Override
+    public List<ProductionReportingRecord> selectProductionReportingRecordList(ProductionReportingRecord productionReportingRecord)
+    {
+        return productionReportingRecordMapper.selectProductionReportingRecordList(productionReportingRecord);
+    }
+
+    /**
+     * 新增汇报审核单据
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 结果
+     */
+    @Override
+    public int insertProductionReportingRecord(ProductionReportingRecord productionReportingRecord)
+    {
+        return productionReportingRecordMapper.insertProductionReportingRecord(productionReportingRecord);
+    }
+
+    /**
+     * 修改汇报审核单据
+     * 
+     * @param productionReportingRecord 汇报审核单据
+     * @return 结果
+     */
+    @Override
+    public int updateProductionReportingRecord(ProductionReportingRecord productionReportingRecord)
+    {
+        return productionReportingRecordMapper.updateProductionReportingRecord(productionReportingRecord);
+    }
+
+    /**
+     * 批量删除汇报审核单据
+     * 
+     * @param ids 需要删除的汇报审核单据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteProductionReportingRecordByIds(Long[] ids)
+    {
+        return productionReportingRecordMapper.deleteProductionReportingRecordByIds(ids);
+    }
+
+    /**
+     * 删除汇报审核单据信息
+     * 
+     * @param id 汇报审核单据主键
+     * @return 结果
+     */
+    @Override
+    public int deleteProductionReportingRecordById(Long id)
+    {
+        return productionReportingRecordMapper.deleteProductionReportingRecordById(id);
+    }
+}

+ 16 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/QualityinspectioninformationServiceImpl.java

@@ -90,4 +90,20 @@ public class QualityinspectioninformationServiceImpl implements IQualityinspecti
     {
         return qualityinspectioninformationMapper.deleteQualityinspectioninformationById(id);
     }
+
+    /**
+     * 查询单个质检信息
+     * @param qualityinspectioninformation
+     * @return
+     */
+    @Override
+    public Qualityinspectioninformation selectQualityinspectioninformation(Qualityinspectioninformation qualityinspectioninformation) {
+        //逻辑判断
+        if(qualityinspectioninformation.getManufacturingProcess()!=null&&qualityinspectioninformation.getManufacturingProcess()!=""){
+            int i = qualityinspectioninformationMapper.selectQualityinspectioninformationListMax(qualityinspectioninformation.getManufacturingProcess());
+            qualityinspectioninformation.setId(Long.valueOf(i));
+        }
+        //查询检验信息
+        return qualityinspectioninformationMapper.selectQualityinspectioninformation(qualityinspectioninformation);
+    }
 }

+ 442 - 178
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/StationInformationServiceImpl.java

@@ -35,6 +35,7 @@ import org.springframework.core.io.Resource;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.io.IOException;
 import java.time.LocalDateTime;
@@ -55,6 +56,7 @@ public class StationInformationServiceImpl implements IStationInformationService
 {
     @Autowired
     private StationInformationMapper stationInformationMapper;
+
     @Autowired
     private ReportInformationSheetMapper reportInformationSheetMapper;
 
@@ -119,6 +121,10 @@ public class StationInformationServiceImpl implements IStationInformationService
     @Autowired
     WarehouseEntryNumberGenerator warehouseEntryNumberGenerator;
 
+
+    @Autowired
+    ProductionReportingRecordMapper productionReportingRecordMapper;
+
     /**
      * 查询工位信息
      * 
@@ -423,15 +429,27 @@ public class StationInformationServiceImpl implements IStationInformationService
                     String materialId = planTaskDetails2.getMaterialId();
                     if(materialId.startsWith("1")){// 成品检验
                         ringScanInformationFirst1.setPackingOrInspection("1");//1开头的 成品检验, 入库
-                        ringScanInformationFirst1.setPackingQuantity("1"); //插入第一条的时候数量为1
                     }else if(materialId.startsWith("2")) { //试机检验
                         ringScanInformationFirst1.setPackingOrInspection("2");//2试机检验,入库
-                        ringScanInformationFirst1.setInspectionQuantity("1"); //插入第一条的时候数量为1
                     }
                 }
+
                 //扫一次产品记录一次
                 int i = ringScanInformationFirstMapper.insertRingScanInformationFirst(ringScanInformationFirst1);
                 //有可能订单数量就是一台,我扫一回订单就结束掉了
+
+                //这个订单,我直接扫一次,就扫一次,并且扫描的工序是成品检验或者试机检验,那我就进行报工
+                if(planTaskDetails1.size()>0){{
+                    PlanTaskDetails planTaskDetails2 = planTaskDetails1.get(0);
+                    String materialId = planTaskDetails2.getMaterialId();
+                    if(materialId.startsWith("1")&&ringScanInformation.getProcessName().equals("成品检验")){
+                        ringScanInformationFirst1.setPackingQuantity("1");
+                        this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"3",ringScanInformation);//生产订单号,工序名
+                    }else if(materialId.startsWith("2")&&ringScanInformation.getProcessName().equals("试机检验")) {
+                        ringScanInformationFirst1.setInspectionQuantity("1");
+                        this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"4",ringScanInformation);//生产订单号,工序名
+                    }
+                }}
             }else {
                 //更新包装或者检验的数量
                 //拿到老的包装数量
@@ -456,8 +474,7 @@ public class StationInformationServiceImpl implements IStationInformationService
                             RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getPackingQuantity(), ringScanInformation, "1");
                             ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
                             //生产汇报  等于代表走工序汇报逻辑 1 和 2代表入的什么仓库(1:成品 2:利库)   3和4 代表走工序汇报逻辑(3:成品 4:利库)
-//                            this.generateWarehouseWarrant2(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName());//生产订单号,工序名
-                             this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"3");//生产订单号,工序名
+                             this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"3",ringScanInformation);//生产订单号,工序名
                         }
                     }else if(materialId.startsWith("2")&&ringScanInformation.getProcessName().equals("试机检验")) {
                         //有关于这个产品的扫描信息就不更新数量了
@@ -469,9 +486,8 @@ public class StationInformationServiceImpl implements IStationInformationService
                             RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getInspectionQuantity(), ringScanInformation,"2");
                             ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
                             //生产汇报
-//                         this.generateWarehouseWarrant2(ringScanInformation.getProductionOrderNumber());
-                            // 等于代表走工序汇报逻辑 1 和 2代表入的什么仓库(1:成品 2:利库)   3和4 代表走工序汇报逻辑(3:成品 4:利库)
-                           this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"4");//生产订单号,工序名
+                            //等于代表走工序汇报逻辑 1 和 2代表入的什么仓库(1:成品 2:利库)   3和4 代表走工序汇报逻辑(3:成品 4:利库)
+                           this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"4",ringScanInformation);//生产订单号,工序名
                         }
                     }
                     else if(materialId.startsWith("1")&&ringScanInformation.getProcessName().equals("入库")){//1开头产品的入库逻辑
@@ -484,8 +500,7 @@ public class StationInformationServiceImpl implements IStationInformationService
                             RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getRks(), ringScanInformation, "3");
                             ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
                             //生产汇报
-//                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName());//生产订单号,工序名
-                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"1");
+                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"1",ringScanInformation);
                         }
                     }else if(materialId.startsWith("2")&&ringScanInformation.getProcessName().equals("入库")) {  //2开头产品的入库逻辑
                         //有关于这个产品的扫描信息就不更新数量了
@@ -497,7 +512,7 @@ public class StationInformationServiceImpl implements IStationInformationService
                             RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getRks(), ringScanInformation,"3");
                             ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
                             //生产逻辑
-                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"2");//生产订单号,工序名
+                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"2",ringScanInformation);//生产订单号,工序名
                         }
                     }
                 }
@@ -587,9 +602,6 @@ public class StationInformationServiceImpl implements IStationInformationService
             }
             int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
 
-//            //扣料操作
-            String s = this.sweepingMaterial(ringScanInformation.getOrderNumber(), ringScanInformation.getProductionOrderNumber(), //订单号   生产订单号
-                        ringScanInformation.getProcessName(), ringScanInformation.getNativeNumbering());//工序     流转卡信息
 
             //查询当前工位信息
             ScanStatistics scanStatistics = null;
@@ -620,8 +632,7 @@ public class StationInformationServiceImpl implements IStationInformationService
      * @param lxkNumber
      * @return
      */
-    @Override
-    public  String   sweepingMaterial(String orderNumber,String productNumber,String gxm,String lxkNumber){
+    public  String   sweepingMaterial2(String orderNumber,String productNumber,String gxm,String lxkNumber){
        if(gxm.equals("入库")){
            return "入库不扣料";
        }
@@ -681,8 +692,6 @@ public class StationInformationServiceImpl implements IStationInformationService
                        if(jdProductionOrders.size()>0) {
                            //单据编号
                            String documentNumber = jdProductionOrders.get(0).getDocumentNumber();
-                           //这个生产订单生产的数量
-                           //String quantity = jdProductionOrders.get(0).getQuantity();
                            //根据生产订单号查询生产用料清单
                            String productionMaterialsListQuery="{\n" +
                                    "    \"FormId\": \"PRD_PPBOM\",\n" +
@@ -696,7 +705,6 @@ public class StationInformationServiceImpl implements IStationInformationService
                                    "}";
                            //查询生产用料清单
                            Map<String, Object> map2 = JSON.parseObject(productionMaterialsListQuery, Map.class);
-
                            String filterString = map2.get("FilterString").toString();
                            List<Map> mapList = JSON.parseArray(filterString, Map.class);
                            if(procedureListErps.size()>0){
@@ -735,7 +743,7 @@ public class StationInformationServiceImpl implements IStationInformationService
                        }
                    }
                } catch (Exception e) {
-                   throw new RuntimeException(e);
+                   TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                }
                return productNumber+gxm+"扣料成功";
            }else {
@@ -824,14 +832,111 @@ public class StationInformationServiceImpl implements IStationInformationService
                    }
                }
            } catch (Exception e) {
-               throw new RuntimeException(e);
+               TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            }
            return productNumber+gxm+"扣料成功";
        }
-
    }
 
 
+    @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.of(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 + "扣料成功";
+    }
+
+
     /**
      * 更新包装还是更新检验
      * @param ringScanInformationFirstNumber
@@ -846,31 +951,14 @@ public class StationInformationServiceImpl implements IStationInformationService
             RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
             newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
             newRingScanInformationFirst.setPackingQuantity(i1.toString());
-
-            //1开头的机器,如果成品检验了就代表入库了
-            String rKQuantity = ringScanInformationFirstNumber;
-            Double newRkQuantity = Double.parseDouble(rKQuantity) + 1;
-            Integer i3 = newRkQuantity.intValue();
-            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
-            newRingScanInformationFirst.setRks(i3.toString());
             return newRingScanInformationFirst;
-
         }else if(type.equals("2")) { //试机检验
-
             String inspectionQuantity = ringScanInformationFirstNumber;
             Double newInspectionQuantity = Double.parseDouble(inspectionQuantity) + 1;
-
             Integer i2 = newInspectionQuantity.intValue();
             RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
             newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
             newRingScanInformationFirst.setInspectionQuantity(i2.toString());
-
-            //2开头的机器,如果试机检验了就代表入库了
-            String rKQuantity = ringScanInformationFirstNumber;
-            Double newRkQuantity = Double.parseDouble(rKQuantity) + 1;
-            Integer i3 = newRkQuantity.intValue();
-            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
-            newRingScanInformationFirst.setRks(i3.toString());
             return newRingScanInformationFirst;
         }else if(type.equals("3")) {//入库
             String rKQuantity = ringScanInformationFirstNumber;
@@ -892,7 +980,7 @@ public class StationInformationServiceImpl implements IStationInformationService
      * @param productionOrderNumber
      * type 1入成品 type 2 入利库 type 3走工序汇报逻辑,实际我并没有获取这个参数
      */
-    public  String  generateWarehouseWarrant(String productionOrderNumber,String gxName,String type){
+    public  String  generateWarehouseWarrant(String productionOrderNumber,String gxName,String type,RingScanInformation ringScanInformation){
           if(gxName.equals("入库")){
               RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
               newRingScanInformationFirst.setProductionOrderNumber(productionOrderNumber);
@@ -900,19 +988,40 @@ public class StationInformationServiceImpl implements IStationInformationService
               List<RingScanInformationFirst> ringScanInformationFirsts1 = ringScanInformationFirstMapper.selectRingScanInformationFirstList(newRingScanInformationFirst);
               if(ringScanInformationFirsts1.size()>0) {
                   RingScanInformationFirst ringScanInformationFirst = ringScanInformationFirsts1.get(0);
-                  //入库数量等于生产订单总数那么就发起入库申请
-                  if(ringScanInformationFirst.getRks().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                  //包装或者检验
+                  String packingOrInspection = ringScanInformationFirst.getPackingOrInspection();
+
+                  if(packingOrInspection.equals("1")){//检查包装检验  --够了--下推入库单
                       PlanTaskDetails planTaskDetails=new PlanTaskDetails();
                       planTaskDetails.setDemandDocument(productionOrderNumber);
-                      int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
                       //查询即将入库的产品信息
                       List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+                      if(ringScanInformationFirst.getRks().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                          //加更正生产订单状态
+                          planTaskDetails.setStatus("2");//生产完成
+                          int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                      }
                       //入库 typ 1 入成品 type 入利库
-                      erpWareHouSing(planTaskDetails1.get(0),type);
-                      //加更正生产订单状态
-                      planTaskDetails.setStatus("2");//生产完成
-                      int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
-                      return "入库成功";
+                      erpWareHouSing(planTaskDetails1.get(0),type,ringScanInformation,"单量推送");
+                      System.out.println("入库汇报单量推送");
+
+
+                  }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 入利库
+                          erpWareHouSing(planTaskDetails1.get(0),type,ringScanInformation,"全量推送");
+                          System.out.println("入库汇报全量推送");
+                          //加更正生产订单状态
+                          planTaskDetails.setStatus("2");//生产完成
+                          int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                          return "入库成功";
+                      }
                   }
               }
               return "正在入库";
@@ -929,41 +1038,46 @@ public class StationInformationServiceImpl implements IStationInformationService
                   planTaskDetails.setDemandDocument(productionOrderNumber);
                   //查询即将入库的产品信息
                   List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
-//                  //加更正生产订单状态
-//                  planTaskDetails.setStatus("2");//生产完成
                   //检查包装或者试机数量
-                  if(packingOrInspection.equals("1")){//检查包装检验  --如果够了-下推生产汇报单
+                  if(packingOrInspection.equals("1")){//检查成品检验  --如果够了-下推生产汇报单
                       //看包装跟当前生产订单总数量是否相等
                       if(ringScanInformationFirst.getPackingQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
-//                          int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
-                          //工序汇报
-                          erpProcessReport(planTaskDetails1.get(0),type);
                           //加更正生产订单状态
                           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())){
-//                          int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
-                          //生产汇报
-                          erpProcessReport(planTaskDetails1.get(0),type);
+                          //生产汇报 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 "有问题请联系管理";
+         return "有问题请联系管理";
     }
 
     /**
      * 生产汇报单是否下推提交审核成功
+     * txfs:判断是成品检验还是试机检验
      * @param planTaskDetails1
      */
-    private void erpProcessReport(PlanTaskDetails planTaskDetails1,String type) {
+    private String erpProcessReport(PlanTaskDetails planTaskDetails1,String type,String txfs,RingScanInformation ringScanInformation) {
         //生产汇报
         ObjectMapper objectMapper = new ObjectMapper();
         try {
@@ -985,7 +1099,8 @@ public class StationInformationServiceImpl implements IStationInformationService
             map1.put("FNumber",planTaskDetails1.getMaterialId());
             map.put("FMaterialId",map1);
             map.put("FMoBillNo",planTaskDetails1.getDemandDocument());
-            map.put("FSrcBillNo",planTaskDetails1.getDemandDocument());
+            map.put("FSrcBillNo",planTaskDetails1.getDemandDocument()); //生产订单号
+            map.put("FReqBillNo",ringScanInformation.getOverNumber()); //订单号
             map.put("FStartTime",localDateTimeStr);
             map.put("FEndTime",localDateTimeStr);
             HashMap fbomdIdMap=new HashMap();
@@ -1007,52 +1122,92 @@ public class StationInformationServiceImpl implements IStationInformationService
             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<>();
+                        }
 
-            //序列号单据体---循环
-            ProductionCardFlow productionCardFlow=new ProductionCardFlow();
-            productionCardFlow.setDemandDocumentNumber(planTaskDetails1.getDemandDocument());//流转卡序列号
-            List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+                        // 修改 FSerialId 中的 FNUMBER
+                        fSerialIdMap.put("FNUMBER", item.getSerialNumber());
+                        map2.put("FSerialId", fSerialIdMap);
 
-            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<>();
+                        // 将修改后的 map2 添加到 list1
+                        list1.add(map2);
+                    } catch (JsonProcessingException e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     }
-
-                    // 修改 FSerialId 中的 FNUMBER
-                    fSerialIdMap.put("FNUMBER", item.getSerialNumber());
-                    map2.put("FSerialId", fSerialIdMap);
-
-                    // 将修改后的 map2 添加到 list1
-                    list1.add(map2);
-                } catch (JsonProcessingException e) {
-                    throw new RuntimeException(e);
-                }
-            });
-            map.put("FSerialSubEntity",list1);
-
+                });
+                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 = map.get("FEntity_Link").toString();
             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);
@@ -1069,9 +1224,6 @@ public class StationInformationServiceImpl implements IStationInformationService
 
             jsonData.put("Model", modelMap);
 
-//            HashMap<String, Object> map11 = new HashMap<>();
-//            map11.put("formid","PRD_MORPT");
-//            map11.put("data",jsonData);
             String zxJson = objectMapper.writeValueAsString(jsonData);
             //生产用料清单结果
             K3CloudApi api = new K3CloudApi();
@@ -1085,8 +1237,10 @@ public class StationInformationServiceImpl implements IStationInformationService
                 Map<String,Object>  resultMap= objectMapper.readValue(result, Map.class);
                 String number = resultMap.get("Number").toString();//编号
 
-                documentExecutionJudgment(objectMapper, resultJsonJG,"工序创建成功","工序汇报提交失败");
-
+                String s4 = documentExecutionJudgment(objectMapper, resultJsonJG, "工序创建成功", "工序汇报提交失败");
+                if(s4.equals("工序汇报提交失败")){
+                    return resultJsonJG;
+                }
                 //执行提交
                 String tjQuery="{\n" +
                         "    \"Numbers\": [],\n" +
@@ -1102,8 +1256,10 @@ public class StationInformationServiceImpl implements IStationInformationService
                 map4.put("Numbers",numberjson);
                 String tjExeJSON = objectMapper.writeValueAsString(map4);
                 String s1 = api.submit("PRD_MORPT",tjExeJSON);
-                documentExecutionJudgment(objectMapper, s1,"工序汇提交成功","工序汇报提交失败");
-
+                String s3 = documentExecutionJudgment(objectMapper, s1, "工序汇提交成功", "工序汇报提交失败");
+                if(s3.equals("工序汇报提交失败")){
+                    return s1;
+                }
                 //执行审核
                 String shQuery="{\n" +
                         "    \"Numbers\": [],\n" +
@@ -1121,37 +1277,100 @@ public class StationInformationServiceImpl implements IStationInformationService
                 map5.put("Numbers",number2json);
                 String shExeJSON = objectMapper.writeValueAsString(map4);
                 String s2 = api.audit("PRD_MORPT",shExeJSON);
-                documentExecutionJudgment(objectMapper, s2,"工序汇报审核成功","工序汇报审核失败");
+                String s = documentExecutionJudgment(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) {
-                throw new RuntimeException(e);
+                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             }
         } catch (IOException e) {
-            throw new RuntimeException(e);
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         }
+        return "汇报成功";
     }
 
     /**
      * 操作ERP生产入库单
      * @param planTaskDetails1
+     * planTaskDetails1 产品信息
      * type 入那个库
+     * ringScanInformation 扫描信息
      */
-    private  String erpWareHouSing(PlanTaskDetails planTaskDetails1,String type){
+    private  String erpWareHouSing(PlanTaskDetails planTaskDetails1,String type,RingScanInformation ringScanInformation,String isDOrQ){
         //生产汇报
         ObjectMapper objectMapper = new ObjectMapper();
         //生产用料清单结果
         K3CloudApi api = new K3CloudApi();
         try {
-            //查询生产汇报工序的基本信息
-            String 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 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{
+                    return "未查询到生产汇报信息";
+                }
+            }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);
@@ -1179,6 +1398,7 @@ public class StationInformationServiceImpl implements IStationInformationService
             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")){
@@ -1199,57 +1419,94 @@ public class StationInformationServiceImpl implements IStationInformationService
             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);
 
-
-
-            //序列号单据体---循环
-            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 FSerialSubEntity = map.get("FSerialSubEntity").toString();
-            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<>();
+                        // 将修改后的 map2 添加到 list1
+                        list1.add(map2two);
+                    } catch (JsonProcessingException e) {
+                        TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                     }
+                });
+                map7.put("FSerialSubEntity",list1);
+            }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) {
-                    throw new RuntimeException(e);
-                }
-            });
-            map7.put("FSerialSubEntity",list1);
+                        // 修改 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" +
@@ -1269,12 +1526,13 @@ public class StationInformationServiceImpl implements IStationInformationService
             jsonData2.put("Model",map6);
 
             String rkdcrateJosn = api.save("PRD_INSTOCK",JSONObject.toJSONString(jsonData2));
-
-            documentExecutionJudgment(objectMapper, rkdcrateJosn,"生成入库单创建","入库单创建失败");
-
+            System.out.println(rkdcrateJosn+"dddddddddddddddddddddddddddddddddddddd");
+            String s1 = documentExecutionJudgment(objectMapper, rkdcrateJosn, "生成入库单创建", "入库单创建失败");
+            if(s1.equals("入库单创建失败")){
+             return   rkdcrateJosn;
+            }
             //解析入库单创建结果
             Map rkdCrateJsonResultString = objectMapper.readValue(rkdcrateJosn, Map.class);
-//            String rkdCrateResultJson = rkdCrateJsonResultString.get("Result").toString();
             String rkdCrateResultJson = objectMapper.writeValueAsString(rkdCrateJsonResultString.get("Result"));
             Map<String,String>  rkdResultMap= objectMapper.readValue(rkdCrateResultJson, Map.class);
             String rkdNumber = rkdResultMap.get("Number");//编号
@@ -1292,8 +1550,10 @@ public class StationInformationServiceImpl implements IStationInformationService
             list5.add(rkdNumber);
             jsonData3.put("Numbers",list5);
             String tkdtjR = api.submit("PRD_INSTOCK",JSONObject.toJSONString(jsonData3));
-            documentExecutionJudgment(objectMapper, tkdtjR,"入库单提交成功","入库单提交失败");
-
+            String s2 = documentExecutionJudgment(objectMapper, tkdtjR, "入库单提交成功", "入库单提交失败");
+            if(s2.equals("入库单提交失败")){
+                return   tkdtjR;
+            }
             //审核
             String rkdsh="{\n" +
                     "    \"Numbers\": [],\n" +
@@ -1308,9 +1568,13 @@ public class StationInformationServiceImpl implements IStationInformationService
             jsonData4.put("Number",list5);
 
             String rkdshR = api.audit("PRD_INSTOCK",JSONObject.toJSONString(jsonData3));
-            documentExecutionJudgment(objectMapper, rkdshR,"入库单审核成功","入库单审核失败");
+            String s = documentExecutionJudgment(objectMapper, rkdshR, "入库单审核成功", "入库单审核失败");
+            if(s.equals("入库单审核失败")){
+                return   rkdshR;
+            }
+            System.out.println("入库审核成功");
         } catch (Exception e) {
-            throw new RuntimeException(e);
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
         }
         return "入库成功";
     }
@@ -1336,7 +1600,7 @@ public class StationInformationServiceImpl implements IStationInformationService
             return msg1;
         }else {
             System.out.println(msg2);
-            throw new RuntimeException(msg2);
+           return  msg2;
         }
     }
 

+ 2436 - 0
zkqy-fujian-amichi/src/main/java/com/zkqy/amichi/service/impl/StationInformationServiceImpl.javabak

@@ -0,0 +1,2436 @@
+package com.zkqy.amichi.service.impl;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.util.CharsetUtil;
+import cn.hutool.crypto.symmetric.SymmetricAlgorithm;
+import cn.hutool.crypto.symmetric.SymmetricCrypto;
+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.domain.vo.ScanStatistics;
+import com.zkqy.amichi.domain.vo.StationProductScanningRingVo;
+import com.zkqy.amichi.jd.domain.JdProductionOrder;
+import com.zkqy.amichi.jd.domain.MaterialRetentionLogVo;
+import com.zkqy.amichi.mapper.*;
+import com.zkqy.amichi.service.IStationInformationService;
+import com.zkqy.amichi.utils.WarehouseEntryNumberGenerator;
+import com.zkqy.common.core.domain.entity.SysTenant;
+import com.zkqy.common.utils.DateUtils;
+import com.zkqy.common.utils.StringUtils;
+import com.zkqy.execution.produce.dispersed.entity.BpmExecuteNodeLog;
+import com.zkqy.execution.produce.dispersed.entity.BpmExecuteProcess;
+import com.zkqy.execution.produce.dispersed.mapper.BpmExecuteNodeLogMapper;
+import com.zkqy.execution.produce.dispersed.mapper.BpmExecuteProcessMapper;
+import com.zkqy.framework.web.service.SysLoginService;
+import com.zkqy.system.mapper.SysDictDataMapper;
+import com.zkqy.system.mapper.SysTenantMapper;
+import org.springframework.beans.BeanUtils;
+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.annotation.Transactional;
+
+import java.io.IOException;
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.util.*;
+import java.util.stream.Collectors;
+
+
+
+/**
+ * 工位信息Service业务层处理
+ * 
+ * @author zkqy
+ * @date 2024-08-20
+ */
+@Service
+public class StationInformationServiceImpl implements IStationInformationService
+{
+    @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;
+
+    /**
+     * 查询工位信息
+     * 
+     * @param id 工位信息主键
+     * @return 工位信息
+     */
+    @Override
+    public StationInformation selectStationInformationById(Long id)
+    {
+        return stationInformationMapper.selectStationInformationById(id);
+    }
+
+    /**
+     * 查询工位信息列表
+     * 
+     * @param stationInformation 工位信息
+     * @return 工位信息
+     */
+    @Override
+    public List<StationInformation> selectStationInformationList(StationInformation stationInformation)
+    {
+        return stationInformationMapper.selectStationInformationList(stationInformation);
+    }
+
+    /**
+     * 新增工位信息
+     * 
+     * @param stationInformation 工位信息
+     * @return 结果
+     */
+    @Override
+    public int insertStationInformation(StationInformation stationInformation)
+    {
+        stationInformation.setCreateTime(DateUtils.getNowDate());
+        return stationInformationMapper.insertStationInformation(stationInformation);
+    }
+
+    /**
+     * 修改工位信息
+     * 
+     * @param stationInformation 工位信息
+     * @return 结果
+     */
+    @Override
+    public int updateStationInformation(StationInformation stationInformation)
+    {
+        stationInformation.setUpdateTime(DateUtils.getNowDate());
+        return stationInformationMapper.updateStationInformation(stationInformation);
+    }
+
+    /**
+     * 批量删除工位信息
+     * 
+     * @param ids 需要删除的工位信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteStationInformationByIds(Long[] ids)
+    {
+        return stationInformationMapper.deleteStationInformationByIds(ids);
+    }
+
+    /**
+     * 删除工位信息信息
+     * 
+     * @param id 工位信息主键
+     * @return 结果
+     */
+    @Override
+    public int deleteStationInformationById(Long id)
+    {
+        return stationInformationMapper.deleteStationInformationById(id);
+    }
+
+    @Autowired
+    private SysLoginService loginService;
+
+    @Autowired
+    private  SysTenantMapper sysTenantMapper;
+    /**
+     * 手持扫描真实逻辑
+     * @param contentString
+     * @return
+     */
+    @Override
+    @Transactional
+    public String stationProductScanningTwo2(String contentString) throws Exception {
+        //abc
+        SysTenant sysTenant = sysTenantMapper.selectSysTenantByTenantId(216L);
+        //检查租户过期时间
+        if (sysTenant.getTenantExpirationTime() == null || sysTenant.getTenantExpirationTime().isEmpty()) {
+            return "未激活-系统-扫描失败-0-0-0-0";
+        }
+        SymmetricCrypto symmetricCrypto = new SymmetricCrypto(SymmetricAlgorithm.DES, "sgEsnN6QWq8W7j5H01020304".getBytes());
+        //当前时间
+        LocalDateTime now = LocalDateTime.now();
+        long nowSecond = now.toEpochSecond(ZoneOffset.ofHours(8));
+        //到期时间
+        String LastActiveTimeStr = symmetricCrypto.decryptStr(sysTenant.getTenantExpirationTime(), CharsetUtil.CHARSET_UTF_8);
+        LocalDateTime LastActiveDateTime = DateUtils.toLocalDateTime(LastActiveTimeStr, "yyyy-MM-dd HH:mm:ss");
+        long expirationTimeSecond = LastActiveDateTime.toEpochSecond(ZoneOffset.ofHours(8));
+        //计算时间戳
+        long difference = expirationTimeSecond - nowSecond; //相差的时间数 后边减前边
+        //如果是负数证明已经过期了
+        if (difference < 0) {
+            return "未激活-系统-扫描失败-0-0-0-0";
+        }
+        //扫描人员码信息
+        if(contentString.contains("scan@")){
+            //扫描标记替换为空
+            String replace = contentString.replace("scan@", "");
+            //首先把内容拆分下
+            String[] content = replace.split("&");
+            //人员信息
+            String personneString = content[0];
+            //更改当前人员的扫码信息
+            String[] personneList = personneString.split("#");
+            //设备编码信息
+            String sbMacAddress= content[1];
+            //更改当前工位码的设备信息
+            StationInformation stationInformation = new StationInformation();
+            stationInformation.setDeviceNumber(sbMacAddress);//设备编号
+            List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationListByDEviceNumber(stationInformation);
+
+            if (stationInformations.size()>0){
+                //重置以前的绑定(手持机在哪我就把那变成空)
+                stationInformationMapper.updateStationInformationDeviceNameAndBluetoothName(stationInformation);
+            }
+            stationInformation.setPersonnelId(personneList[0]);//员工id
+//            stationInformation.setPersonnelName(personneList[1]);//员工姓名
+            int i = stationInformationMapper.updateStationInformationByUseIdAndUserName(stationInformation);
+            if(i>0){
+                System.out.println("手持设备绑定成功");
+            }
+            StationInformation stationInformation2 = new StationInformation();
+            stationInformation2.setPersonnelId(personneList[0]);//设备编号
+            List<StationInformation> stationInformations1 = stationInformationMapper.selectStationInformationList(stationInformation2);
+            if(stationInformations1.size()<=0){
+                return "当前工序没有此-人员-扫描失败-0-0-0-0";
+            }
+            System.out.println("工位:"+stationInformations1.get(0).getStationName()+"人员:"+stationInformations1.get(0).getPersonnelName());
+            return stationInformations1.get(0).getStationName()+"-"+stationInformations1.get(0).getPersonnelName()+"-手持设备绑定成功";
+        }else {
+            //产品编码&mac地址
+            String[] content = contentString.split("&");
+            //产品编码
+            String s1 = content[0];
+            //mac地址
+            String s2 = content[1];
+
+            //1、判断扫的是不是厂内流转卡
+            /*boolean fjqyD = stationProductScanningRingVo.getContentInformation().contains("D");
+            boolean fjqyZ = stationProductScanningRingVo.getContentInformation().contains("Z");
+            if(!fjqyD||!fjqyZ){return "请扫描相关二维码";}*/
+
+            //2、扫描间距判断
+            /* RingScanInformation ringScanInformationQuery=new RingScanInformation();
+            ringScanInformationQuery.setDeviceNumber(split[1]);//设备Mac地址
+            RingScanInformation ringScanInformations = ringScanInformationMapper.selectRingScanInformationListDateTimeMax(ringScanInformationQuery);
+            if(ringScanInformations!=null){
+                //拿到上次扫描的时间
+                LocalDateTime scanningTime1 = ringScanInformations.getScanningTime();
+                //拿到当前系统时间
+                LocalDateTime now = LocalDateTime.now();
+                //计算两次时间的时间差
+                Duration duration = Duration.between(scanningTime1, now);
+                boolean isTwoMinutesPassed = duration.toMinutes() < 1;
+                //判断两次时间是否大于
+                if (isTwoMinutesPassed) {
+                  return "同一设备,两分钟之内不能重复扫描";
+                }
+            }*/
+
+            //扫码内容
+            RingScanInformation ringScanInformation=new RingScanInformation();
+            //扫描内容
+            ringScanInformation.setContentInformation(s1);
+            //当前时间
+            ringScanInformation.setScanningTime(LocalDateTime.now());
+            //mac地址
+            ringScanInformation.setDeviceNumber(s2);//mac地址
+
+
+
+
+            //4、查询当前机器绑定的工位信息和人信息
+            StationInformation terminalInformation=new StationInformation();
+            terminalInformation.setDeviceNumber(s2);//mac地址
+            List<StationInformation> stationInformations =
+                    stationInformationMapper.selectStationInformationListByDEviceNumber(terminalInformation);
+            if(stationInformations.size()>0){
+                ringScanInformation.setPersonnelName(stationInformations.get(0).getPersonnelName());//人员姓名
+                ringScanInformation.setProcess(stationInformations.get(0).getProcessId()); //工序id
+                ringScanInformation.setProcessName(stationInformations.get(0).getProcessName()); //工序名称
+                ringScanInformation.setStationId(stationInformations.get(0).getId().toString()); //工位id
+                ringScanInformation.setStationName(stationInformations.get(0).getStationName());//工位名称
+            }else {//当前没有绑定Mac地址直接返回
+                ringScanInformation.setExecutionMark("2");//成功
+                ringScanInformation.setExecutionMessage("未绑定-人员-扫描失败");
+                int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+                return "未绑定-人员-扫描失败-0-0-0-0";
+            }
+            String nativeNumber="";
+            if(s1.contains("Z")){nativeNumber = s1.replace("Z", "");}
+            if(s1.contains("D")){nativeNumber=s1.replace("D","");}
+            if(StringUtils.isNotNull(nativeNumber)&&nativeNumber!=""){
+                //取值真实的扫描内容
+                ringScanInformation.setNativeNumbering(nativeNumber);
+            }else {
+                //扫描内容---直接就是产品码
+                ringScanInformation.setNativeNumbering(s1);
+            }
+            //根据扫描内容拿到生产订单号和订单号--查询流转卡序列号
+            ProductionCardFlow productionCardFlow=new ProductionCardFlow();
+            productionCardFlow.setSerialNumber(ringScanInformation.getNativeNumbering());//流转卡序列号
+            List<ProductionCardFlow> productionCardFlows = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow);
+            if(productionCardFlows.size()>0){
+                ProductionCardFlow productionCardFlow1 = productionCardFlows.get(0);
+                //需求单据号
+                ringScanInformation.setOrderNumber(productionCardFlow1.getProductionOrderListId());
+                //生产订单号
+                ringScanInformation.setProductionOrderNumber(productionCardFlow1.getDemandDocumentNumber());
+            }else {
+                System.out.println("erp未同步当前流转卡序列号");
+                ringScanInformation.setExecutionMark("2");//成功
+                ringScanInformation.setExecutionMessage("失败-未同步ERP");
+                int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+                return stationInformations.get(0).getStationName()+"-"+stationInformations.get(0).getPersonnelName()+"-失败,未同步ERP-无-0-0-0";
+            }
+
+            //判断这个生产订单是否结案
+            String isJn="{\n" +
+                    "    \"FormId\": \"PRD_MO\",\n" +
+                    "    \"FieldKeys\": \"FBillNo,FSerialNo\",\n" +
+                    "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FStatus\",\"Compare\":\"105\",\"Value\":\"6\",\"Right\":\"\",\"Logic\":0}," +
+                    "        {\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\""+ringScanInformation.getProductionOrderNumber()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                    "    \"OrderString\": \"\",\n" +
+                    "    \"TopRowCount\": 0,\n" +
+                    "    \"StartRow\": 0,\n" +
+                    "    \"Limit\": 2000,\n" +
+                    "    \"SubSystemId\": \"\"\n" +
+                    "}";
+            K3CloudApi api = new K3CloudApi();
+            String jnIs = api.billQuery(isJn);
+            if (!jnIs.equals("[]")) {
+                System.out.println("该流转卡生产订单已结案");
+                ringScanInformation.setExecutionMark("2");//成功
+                ringScanInformation.setExecutionMessage("失败-已结案");
+                int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+                //改变订单详情的状态
+                PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                planTaskDetails.setStatus("3");
+                planTaskDetails.setDemandDocument(ringScanInformation.getProductionOrderNumber());
+                int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                //返回失败信息
+                return stationInformations.get(0).getStationName()+"-"+stationInformations.get(0).getPersonnelName()+"-失败,已结案-无-0-0-0";
+            }
+            //验证重复扫描
+            RingScanInformation prodOrderScanning=new RingScanInformation();
+            prodOrderScanning.setContentInformation(s1);
+            prodOrderScanning.setProcessName(ringScanInformation.getProcessName());
+            List<RingScanInformation> ringScanInformations = ringScanInformationMapper.selectRingScanInformationListisNotNull(prodOrderScanning);
+            if(ringScanInformations.size()>0){
+                ringScanInformation.setExecutionMark("2");//成功
+                ringScanInformation.setExecutionMessage("重复扫描");
+                ringScanInformation.setOverNumber(ringScanInformations.get(0).getOverNumber());
+                int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+                //查询订单号,订单总数量 完成数量,失败数量
+                //查询当前工位信息
+                ScanStatistics scanStatistics = ringScanInformationMapper.selectScanStatistics(ringScanInformation);
+                return stationInformations.get(0).getStationName()+"-"+stationInformations.get(0).getPersonnelName()+"-"+"重复扫描"+"-"
+                        +scanStatistics.getdOrder()+"-"+scanStatistics.getdCount()+"-"+scanStatistics.getDsCount()+"-"+scanStatistics.getDfCount();
+            }
+            //查询生产订单日志里有没有这个生产订单有就不添加了
+            RingScanInformationFirst ringScanInformationFirst=new RingScanInformationFirst();
+            ringScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            //有一个
+            List<RingScanInformationFirst> ringScanInformationFirsts = ringScanInformationFirstMapper.selectRingScanInformationFirstList(ringScanInformationFirst);
+            if(ringScanInformationFirsts.size()<=0){
+                RingScanInformationFirst ringScanInformationFirst1=new RingScanInformationFirst();
+                ringScanInformationFirst1.setOrderNumber(ringScanInformation.getOrderNumber());//订单号
+                ringScanInformationFirst1.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());//生产订单号
+                ringScanInformationFirst1.setStatus("1");
+                ringScanInformationFirst1.setStartTime(LocalDateTime.now());//开始时间
+
+                //有多少个序列号就是有多少台
+                ProductionCardFlow productionCardFlow2=new ProductionCardFlow();
+                productionCardFlow2.setProductionOrderListId(ringScanInformation.getOrderNumber());//订单号
+                List<ProductionCardFlow> productionCardFlows2 = productionCardFlowMapper.selectProductionCardFlowList(productionCardFlow2);
+                ringScanInformationFirst1.setTotalQuantity(String.valueOf(productionCardFlows2.size()));//订单的总数
+
+                //判断当前生产订单 到包装还是检验
+                PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                planTaskDetails.setDemandDocument(ringScanInformation.getProductionOrderNumber());
+                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsService.selectPlanTaskDetailsList(planTaskDetails);
+
+                Double v = Double.parseDouble(planTaskDetails1.get(0).getQuantity());
+                Integer i1 = v.intValue();
+                ringScanInformationFirst1.setProductionOrderTotalQuantity(i1.toString());//生产订单的总数
+
+                if(planTaskDetails1.size()>0){
+                    PlanTaskDetails planTaskDetails2 = planTaskDetails1.get(0);
+                    String materialId = planTaskDetails2.getMaterialId();
+                    if(materialId.startsWith("1")){// 成品检验
+                        ringScanInformationFirst1.setPackingOrInspection("1");//1开头的 成品检验, 入库
+                    }else if(materialId.startsWith("2")) { //试机检验
+                        ringScanInformationFirst1.setPackingOrInspection("2");//2试机检验,入库
+                    }
+                }
+                //扫一次产品记录一次
+                int i = ringScanInformationFirstMapper.insertRingScanInformationFirst(ringScanInformationFirst1);
+
+                //这个订单,我直接扫一次,就扫一次,并且扫描的工序是成品检验或者试机检验,那我就进行报工
+                if(planTaskDetails1.size()>0){{
+                    PlanTaskDetails planTaskDetails2 = planTaskDetails1.get(0);
+                    String materialId = planTaskDetails2.getMaterialId();
+                    if(materialId.startsWith("1")&&ringScanInformation.getProcessName().equals("成品检验")){
+                        ringScanInformationFirst1.setPackingQuantity("1");
+                        this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"3");//生产订单号,工序名
+                    }else if(materialId.startsWith("2")&&ringScanInformation.getProcessName().equals("试机检验")) {
+                        ringScanInformationFirst1.setInspectionQuantity("1");
+                        this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"4");//生产订单号,工序名
+                    }
+                }}
+            }else {
+                //更新包装或者检验的数量
+                //拿到老的包装数量
+                RingScanInformationFirst ringScanInformationFirst1=new RingScanInformationFirst();
+                ringScanInformationFirst1.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                List<RingScanInformationFirst> ringScanInformationFirsts1 = ringScanInformationFirstMapper.selectRingScanInformationFirstList(ringScanInformationFirst1);
+                RingScanInformationFirst ringScanInformationFirstNumber = ringScanInformationFirsts1.get(0);
+                //判断当前生产订单 到包装还是检验
+                PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                planTaskDetails.setDemandDocument(ringScanInformation.getProductionOrderNumber());
+                List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsService.selectPlanTaskDetailsList(planTaskDetails);
+                if(planTaskDetails1.size()>0){
+                    PlanTaskDetails planTaskDetails2 = planTaskDetails1.get(0);
+                    String materialId = planTaskDetails2.getMaterialId();
+                    if(materialId.startsWith("1")&&ringScanInformation.getProcessName().equals("成品检验")){//1卡头并且当前工序未包装,扫描信息为,更新包装数量
+                        RingScanInformation ringScanInformation1=new RingScanInformation();
+                        ringScanInformation1.setNativeNumbering(ringScanInformation.getNativeNumbering());
+                        ringScanInformation1.setProcessName(ringScanInformation.getProcessName());//工序
+                        //有关于这个产品的扫描信息就不更新数量了
+                        List<RingScanInformation> ringScanInformations1 = ringScanInformationMapper.selectRingScanInformationList(ringScanInformation1);
+                        if(ringScanInformations1.size()<=0) { //
+                            RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getPackingQuantity(), ringScanInformation, "1");
+                            ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
+
+                            //生产汇报  等于代表走工序汇报逻辑 1 和 2代表入的什么仓库(1:成品 2:利库)   3和4 代表走工序汇报逻辑(3:成品 4:利库)
+//                            this.generateWarehouseWarrant2(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName());//生产订单号,工序名
+                             this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"3");//生产订单号,工序名
+                        }
+                    }else if(materialId.startsWith("2")&&ringScanInformation.getProcessName().equals("试机检验")) {
+                        //有关于这个产品的扫描信息就不更新数量了
+                        RingScanInformation ringScanInformation1=new RingScanInformation();
+                        ringScanInformation1.setNativeNumbering(ringScanInformation.getNativeNumbering());
+                        ringScanInformation1.setProcessName(ringScanInformation.getProcessName());//工序
+                        List<RingScanInformation> ringScanInformations1 = ringScanInformationMapper.selectRingScanInformationList(ringScanInformation1);
+                        if(ringScanInformations1.size()<=0){
+                            RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getInspectionQuantity(), ringScanInformation,"2");
+                            ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
+
+                            //生产汇报
+//                         this.generateWarehouseWarrant2(ringScanInformation.getProductionOrderNumber());
+                            // 等于代表走工序汇报逻辑 1 和 2代表入的什么仓库(1:成品 2:利库)   3和4 代表走工序汇报逻辑(3:成品 4:利库)
+                           this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"4");//生产订单号,工序名
+                        }
+                    }
+                    else if(materialId.startsWith("1")&&ringScanInformation.getProcessName().equals("入库")){//1开头产品的入库逻辑
+                        RingScanInformation ringScanInformation1=new RingScanInformation();
+                        ringScanInformation1.setNativeNumbering(ringScanInformation.getNativeNumbering());
+                        ringScanInformation1.setProcessName(ringScanInformation.getProcessName());//工序
+                        //有关于这个产品的扫描信息就不更新数量了
+                        List<RingScanInformation> ringScanInformations1 = ringScanInformationMapper.selectRingScanInformationList(ringScanInformation1);
+                        if(ringScanInformations1.size()<=0) {
+                            RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getRks(), ringScanInformation, "3");
+                            ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
+                            //入库汇报
+//                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName());//生产订单号,工序名
+                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"1");
+                        }
+                    }else if(materialId.startsWith("2")&&ringScanInformation.getProcessName().equals("入库")) {  //2开头产品的入库逻辑
+                        //有关于这个产品的扫描信息就不更新数量了
+                        RingScanInformation ringScanInformation1=new RingScanInformation();
+                        ringScanInformation1.setNativeNumbering(ringScanInformation.getNativeNumbering());
+                        ringScanInformation1.setProcessName(ringScanInformation.getProcessName());//工序
+                        List<RingScanInformation> ringScanInformations1 = ringScanInformationMapper.selectRingScanInformationList(ringScanInformation1);
+                        if(ringScanInformations1.size()<=0){
+                            RingScanInformationFirst newRingScanInformationFirst = getRingScanInformationFirst(ringScanInformationFirstNumber.getRks(), ringScanInformation,"3");
+                            ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(newRingScanInformationFirst);
+                            //入库汇报
+                            this.generateWarehouseWarrant(ringScanInformation.getProductionOrderNumber(),ringScanInformation.getProcessName(),"2");//生产订单号,工序名
+                        }
+                    }
+                }
+            }
+            //插入扫描日志前判定当前生产订单是否变为生成完成
+            PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+            planTaskDetails.setStatus("1");//状态
+            planTaskDetails.setDemandDocument(ringScanInformation.getProductionOrderNumber());//生产订单
+            List<PlanTaskDetails> planTaskDetails1 = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails);
+            //生产汇报完了就把当前生产订单状态改为2了,然后把总的生产订单记录数改为2
+            if(planTaskDetails1.size()<=0){
+                //生产订单状态
+                RingScanInformationFirst ringScanInformationFirst1=new RingScanInformationFirst();
+                ringScanInformationFirst1.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                ringScanInformationFirst1.setStatus("2");
+                ringScanInformationFirstMapper.updateRingScanInformationFirstByproductionOrderNumber(ringScanInformationFirst1);
+            }
+            ProductionPlanningManagement productionPlanningManagement=new ProductionPlanningManagement();
+            productionPlanningManagement.setOrderNumber(ringScanInformation.getOrderNumber());
+            List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper
+                    .selectProductionPlanningManagementList(productionPlanningManagement);
+            if(productionPlanningManagements.size()>0){
+                ProductionPlanningManagement productionPlanningManagement1 = productionPlanningManagements.get(0);
+                //订单号
+                PlanTaskDetails planTaskDetailsTwo=new PlanTaskDetails();
+                planTaskDetailsTwo.setPlanId(productionPlanningManagement1.getId());//生产订单
+                planTaskDetailsTwo.setStatus("1");
+                List<PlanTaskDetails> planTaskDetailsPlan = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetailsTwo);
+                if(planTaskDetailsPlan.size()<=0){
+                    PlanTaskDetails planTaskDetails2=new PlanTaskDetails();
+                    planTaskDetails2.setDemandDocument(ringScanInformation.getProductionOrderNumber());//生产订单
+                    List<PlanTaskDetails> planTaskDetails2s = planTaskDetailsMapper.selectPlanTaskDetailsList(planTaskDetails2);
+                    //改订单状态
+                    ProductionPlanningManagement productionPlanningManagementUpdate=new ProductionPlanningManagement();
+                    productionPlanningManagementUpdate.setOrderNumber(ringScanInformation.getOrderNumber());
+                    productionPlanningManagementUpdate.setTaskStatus("3");
+                    productionPlanningManagementUpdate.setId(planTaskDetails2s.get(0).getPlanId());
+                    productionPlanningManagementMapper.updateProductionPlanningManagement(productionPlanningManagementUpdate);
+                }
+            }
+            if(ringScanInformation.getProcessName().equals("焊接")){
+                String contentInformation = ringScanInformation.getContentInformation();
+                if(contentInformation.contains("D")){
+                    RingScanInformation ringScanInformation1=new RingScanInformation();
+                    ringScanInformation1.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                    ringScanInformation1.setProcessName("焊接D");
+                    ringScanInformation1.setOrderNumber(ringScanInformation.getOrderNumber());
+                    String s = ringScanInformationMapper.selectRingScanInformationListLike(ringScanInformation1);
+                    int i = Integer.parseInt(s);
+                    int ss=i+1;
+                    ringScanInformation.setOverNumber(String.valueOf(ss));
+                }else if(contentInformation.contains("Z")){
+                    RingScanInformation ringScanInformation1=new RingScanInformation();
+                    ringScanInformation1.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                    ringScanInformation1.setProcessName("焊接Z");
+                    ringScanInformation1.setOrderNumber(ringScanInformation.getOrderNumber());
+                    String s = ringScanInformationMapper.selectRingScanInformationListLike(ringScanInformation1);
+                    int i = Integer.parseInt(s);
+                    int ss=i+1;
+                    ringScanInformation.setOverNumber(String.valueOf(ss));
+                }
+            }else {
+                String s = ringScanInformationMapper.selectRingScanInformationListLike(ringScanInformation);
+                int i = Integer.parseInt(s);
+                int ss=i+1;
+                ringScanInformation.setOverNumber(String.valueOf(ss));
+            }
+            //插入扫描日志信息
+            ringScanInformation.setExecutionMark("1");
+            ringScanInformation.setExecutionMessage("扫描成功");
+            if(ringScanInformation.getProcessName().equals("白坯检验")){
+                RingScanInformation ringScanInformation1=new RingScanInformation();
+                BeanUtils.copyProperties(ringScanInformation,ringScanInformation1);
+                ringScanInformation1.setProcessName("浸漆");
+                ringScanInformation1.setProcess("32");
+                ringScanInformation1.setStationId("0");
+                ringScanInformation1.setStationName("浸漆");
+                int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation1);
+            }
+            if(ringScanInformation.getProcessName().equals("成品检验")){
+                RingScanInformation ringScanInformation1=new RingScanInformation();
+                BeanUtils.copyProperties(ringScanInformation,ringScanInformation1);
+                ringScanInformation1.setProcessName("包装");
+                ringScanInformation1.setProcess("28");
+                ringScanInformation1.setStationId("0");
+                ringScanInformation1.setStationName("包装工位");
+                int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation1);
+            }
+            int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+
+//            //扣料操作
+            String s = this.sweepingMaterial(ringScanInformation.getOrderNumber(), ringScanInformation.getProductionOrderNumber(), //订单号   生产订单号
+                        ringScanInformation.getProcessName(), ringScanInformation.getNativeNumbering());//工序     流转卡信息
+
+            //查询当前工位信息
+            ScanStatistics scanStatistics = null;
+            RingScanInformation ringScanInformation1=new RingScanInformation();
+            ringScanInformation1.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            ringScanInformation1.setProcessName(ringScanInformation.getProcessName());
+            if(ringScanInformation.getProcessName().equals("焊接")) {
+                if (ringScanInformation.getContentInformation().contains("D")) {
+                    ringScanInformation1.setProcessName("焊接D");
+                } else {
+                    ringScanInformation1.setProcessName("焊接Z");
+                }
+            }
+            scanStatistics = ringScanInformationMapper.selectScanStatistics(ringScanInformation1);
+            //记录扫迈欧
+            return ringScanInformation.getStationName()+"-"+ringScanInformation.getPersonnelName()+"-"+"扫描成功"+"-"+
+                    scanStatistics.getdOrder()+"-"+scanStatistics.getdCount()+"-"+scanStatistics.getDsCount()+"-"+scanStatistics.getDfCount();
+        }
+    }
+
+
+
+    /**
+     * 扣料
+     * @param orderNumber
+     * @param productNumber
+     * @param gxm
+     * @param lxkNumber
+     * @return
+     */
+    @Override
+    public  String   sweepingMaterial(String orderNumber,String productNumber,String gxm,String lxkNumber){
+       if(gxm.equals("入库")){
+           return "入库不扣料";
+       }
+       ProcedureList procedureList=new ProcedureList();
+       procedureList.setProcedurName(gxm);
+       List<ProcedureList> procedureLists = procedureListMapper.selectProcedureListList(procedureList);
+       if(procedureLists.size()<=0){
+           return "此工序不存在";
+       }
+       //输入产品编号查询,
+       MaterialRetentionLog materialRetentionLog=new MaterialRetentionLog();
+       materialRetentionLog.setFlowSequenceNumber(productNumber);
+       materialRetentionLog.setProcess(gxm);
+       List<MaterialRetentionLog> materialRetentionLogs = materialRetentionLogMapper.selectMaterialRetentionLogList(materialRetentionLog);
+       if(materialRetentionLogs.size()>0){
+           return "此料已扣除";
+       }
+       //查询MES对应的ERP
+       ProcedureListErp procedureListErp=new ProcedureListErp();
+       procedureListErp.setErpJobName(procedureLists.get(0).getId().toString());
+       List<ProcedureListErp> procedureListErps = procedureListErpMapper.selectProcedureListErpList(procedureListErp);
+
+       if(gxm.equals("焊接")){
+           RingScanInformation ringScanInformation=new RingScanInformation();
+           ringScanInformation.setProcessName(gxm);//工序
+           ringScanInformation.setProductionOrderNumber(productNumber); //生产订单
+           ringScanInformation.setNativeNumbering(lxkNumber);//流转卡
+           List<RingScanInformation> ringScanInformations = ringScanInformationMapper.selectRingScanInformationList(ringScanInformation);
+           //当前流转卡在当前工序可以的话就进行扣料处理
+           // 人员id,产品id
+           if(ringScanInformations.size()==2){
+               //查询条件
+               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.equals("[]")){
+                       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);
+                           if(procedureListErps.size()>0){
+                               //循环条件
+                               procedureListErps.forEach(map1 -> {
+                                   String ddh="{\"Left\":\"\",\"FieldName\":\"FMOBillNO\",\"Compare\":\"67\",\"Value\":\"11\",\"Right\":\"\",\"Logic\":0}";
+                                   String mapTj="{\"Left\":\"\",\"FieldName\":\"FProcessID.FName\",\"Compare\":\"67\",\"Value\":\"111\",\"Right\":\"\",\"Logic\":1}";
+                                   Map mapObj = JSONObject.parseObject(mapTj, Map.class);
+                                   Map ddhObj = JSONObject.parseObject(ddh, Map.class);
+                                   ddhObj.put("Value", productNumber);
+                                   mapObj.put("Value", map1.getProcedurName());
+                                   mapList.add(ddhObj);
+                                   mapList.add(mapObj);
+                               });
+
+                               map2.put("FilterString", mapList);//从新绑定条件
+
+                               //生产用料清单结果
+                               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);//流转序列号
+                                   item.setMesprocess(gxm);
+                                   item.setOrderNumber(orderNumber);
+                                   item.setProductionOrderNumber(productNumber);
+                                   item.setCreateTime(new Date());
+                                   return item;
+                               }).collect(Collectors.toList());
+                               //分子数量基本的扣料单位
+                               int i = materialRetentionLogMapper.insertMaterialRetentionLogBatch(collect);
+                           }
+                       }
+                   }
+               } catch (Exception e) {
+                   throw new RuntimeException(e);
+               }
+               return productNumber+gxm+"扣料成功";
+           }else {
+               return productNumber+gxm+"未完不扣料";
+           }
+       }else {
+           //查询条件
+           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);
+                       if(procedureListErps.size()>0){
+                           //循环条件
+                           procedureListErps.forEach(map1 -> {
+                               String ddh="{\"Left\":\"\",\"FieldName\":\"FMOBillNO\",\"Compare\":\"67\",\"Value\":\"11\",\"Right\":\"\",\"Logic\":0}";
+                               String mapTj="{\"Left\":\"\",\"FieldName\":\"FProcessID.FName\",\"Compare\":\"67\",\"Value\":\"111\",\"Right\":\"\",\"Logic\":1}";
+                               Map mapObj = JSONObject.parseObject(mapTj, Map.class);
+                               Map ddhObj = JSONObject.parseObject(ddh, Map.class);
+                               ddhObj.put("Value", productNumber);
+                               mapObj.put("Value", map1.getProcedurName());
+                               mapList.add(ddhObj);
+                               mapList.add(mapObj);
+                           });
+                           map2.put("FilterString", mapList);//从新绑定条件
+
+
+                           //生产用料清单结果
+                           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);//流转序列号
+                               item.setMesprocess(gxm); //工序
+                               item.setOrderNumber(orderNumber); //订单
+                               item.setProductionOrderNumber(productNumber); //生产订单
+                               item.setCreateTime(new DateTime());//创建时间
+                               return item;
+                           }).collect(Collectors.toList());
+                           //分子数量基本的扣料单位
+                           int i = materialRetentionLogMapper.insertMaterialRetentionLogBatch(collect);
+                       }
+                   }
+               }
+           } catch (Exception e) {
+               throw new RuntimeException(e);
+           }
+           return productNumber+gxm+"扣料成功";
+       }
+
+   }
+
+
+    /**
+     * 更新包装还是更新检验
+     * @param ringScanInformationFirstNumber
+     * @param ringScanInformation
+     * @return
+     */
+    private static RingScanInformationFirst getRingScanInformationFirst(String ringScanInformationFirstNumber, RingScanInformation ringScanInformation,String type) {
+        if(type.equals("1")){      //成品检验
+            String inspectionQuantity = ringScanInformationFirstNumber;
+            Double newInspectionQuantity = Double.parseDouble(inspectionQuantity) + 1;
+            Integer i1 = newInspectionQuantity.intValue();
+            RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
+            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            newRingScanInformationFirst.setPackingQuantity(i1.toString());
+
+            //1开头的机器,如果成品检验了就代表入库了
+            String rKQuantity = ringScanInformationFirstNumber;
+            Double newRkQuantity = Double.parseDouble(rKQuantity) + 1;
+            Integer i3 = newRkQuantity.intValue();
+
+            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            newRingScanInformationFirst.setRks(i3.toString());
+            return newRingScanInformationFirst;
+        }else if(type.equals("2")) { //试机检验
+            String inspectionQuantity = ringScanInformationFirstNumber;
+            Double newInspectionQuantity = Double.parseDouble(inspectionQuantity) + 1;
+
+            Integer i2 = newInspectionQuantity.intValue();
+            RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
+            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            newRingScanInformationFirst.setInspectionQuantity(i2.toString());
+
+            //2开头的机器,如果试机检验了就代表入库了
+            String rKQuantity = ringScanInformationFirstNumber;
+            Double newRkQuantity = Double.parseDouble(rKQuantity) + 1;
+            Integer i3 = newRkQuantity.intValue();
+            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            newRingScanInformationFirst.setRks(i3.toString());
+            return newRingScanInformationFirst;
+        }else if(type.equals("3")) {//入库
+            String rKQuantity = ringScanInformationFirstNumber;
+            Double newRkQuantity = Double.parseDouble(rKQuantity) + 1;
+            Integer i2 = newRkQuantity.intValue();
+            RingScanInformationFirst newRingScanInformationFirst = new RingScanInformationFirst();
+            newRingScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+            newRingScanInformationFirst.setRks(i2.toString());
+            return newRingScanInformationFirst;
+        }
+        return null;
+    }
+
+
+    /**
+     * 判断走入库还是走生产汇报的逻辑
+     *   前置一直在更新,包装检验,或者试机的数量,如果满足就创建生产汇报单据
+     *   前置也在更新,可入库的数量,如果满足就下推生产入库单。
+     * @param productionOrderNumber
+     * type 1入成品 type 2 入利库 type 3走工序汇报逻辑,实际我并没有获取这个参数
+     */
+    public  String  generateWarehouseWarrant(String productionOrderNumber,String gxName,String type){
+          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);
+                  //入库数量等于生产订单总数那么就发起入库申请
+                  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=2 入利库
+                      erpWareHouSing(planTaskDetails1.get(0),type);
+                      //加更正生产订单状态
+                      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);
+//                  //加更正生产订单状态
+//                  planTaskDetails.setStatus("2");//生产完成
+                  //检查包装或者试机数量
+                  if(packingOrInspection.equals("1")){//检查包装检验  --如果够了-下推生产汇报单
+                      //看包装跟当前生产订单总数量是否相等
+                      if(ringScanInformationFirst.getPackingQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+//                          int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                          //工序汇报
+                          erpProcessReport(planTaskDetails1.get(0),type);
+                          //加更正生产订单状态
+                          planTaskDetails.setStatus("2");//生产完成
+                          int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                      }
+                  }else if(packingOrInspection.equals("2")){ //试机数量--下推生产汇报单
+                      //看包装跟当前生产订单总数量是否相等
+                      if(ringScanInformationFirst.getInspectionQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+//                          int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                          //生产汇报
+                          erpProcessReport(planTaskDetails1.get(0),type);
+                          //加更正生产订单状态
+                          planTaskDetails.setStatus("2");//生产完成
+                          int i2 = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                      }
+                  }
+              }
+              return "工序汇报成功";
+          }
+         return "有问题请联系管理源";
+    }
+
+    /**
+     * 生产汇报单是否下推提交审核成功
+     * @param planTaskDetails1
+     */
+    private void erpProcessReport(PlanTaskDetails planTaskDetails1,String type) {
+        //生产汇报
+        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","179813");
+            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);
+            map.put("FMoBillNo",planTaskDetails1.getDemandDocument());
+            map.put("FSrcBillNo",planTaskDetails1.getDemandDocument());
+            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());
+
+
+            //序列号单据体---循环
+            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) {
+                    throw new RuntimeException(e);
+                }
+            });
+            map.put("FSerialSubEntity",list1);
+
+            //表连接关系
+//            String FEntity_LinkJSON = map.get("FEntity_Link").toString();
+            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);
+
+//            HashMap<String, Object> map11 = new HashMap<>();
+//            map11.put("formid","PRD_MORPT");
+//            map11.put("data",jsonData);
+            String zxJson = objectMapper.writeValueAsString(jsonData);
+            //生产用料清单结果
+            K3CloudApi api = new K3CloudApi();
+            try {
+                System.out.println(zxJson+"json字符串");
+                //执行JSO结果
+                String resultJsonJG = api.save("PRD_MORPT", zxJson);
+                System.out.println(resultJsonJG);
+                //分析结构
+                Map resultString = objectMapper.readValue(resultJsonJG, Map.class);
+
+                String result = objectMapper.writeValueAsString(resultString.get("Result"));
+                System.out.println(result+"汇报单提交执行结果");
+                Map<String,Object>  resultMap= objectMapper.readValue(result, Map.class);
+
+                String number = resultMap.get("Number").toString();//编号
+
+                documentExecutionJudgment(objectMapper, 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);
+                documentExecutionJudgment(objectMapper, 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);
+                documentExecutionJudgment(objectMapper, s2,"工序汇报审核成功","工序汇报审核失败");
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    /**
+     * 操作ERP生产入库单
+     * @param planTaskDetails1
+     * type 入那个库
+     */
+    private  String erpWareHouSing(PlanTaskDetails planTaskDetails1,String type){
+        //生产汇报
+        ObjectMapper objectMapper = new ObjectMapper();
+        //生产用料清单结果
+        K3CloudApi api = new K3CloudApi();
+        try {
+            //查询生产汇报工序的基本信息
+            String 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("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);
+
+            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);
+
+
+
+
+
+            //序列号单据体---循环
+            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 FSerialSubEntity = map.get("FSerialSubEntity").toString();
+            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) {
+                    throw new RuntimeException(e);
+                }
+            });
+            map7.put("FSerialSubEntity",list1);
+
+            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));
+
+            documentExecutionJudgment(objectMapper, rkdcrateJosn,"生成入库单创建","入库单创建失败");
+
+            //解析入库单创建结果
+            Map rkdCrateJsonResultString = objectMapper.readValue(rkdcrateJosn, Map.class);
+//            String rkdCrateResultJson = rkdCrateJsonResultString.get("Result").toString();
+            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));
+            documentExecutionJudgment(objectMapper, tkdtjR,"入库单提交成功","入库单提交失败");
+
+            //审核
+            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));
+            documentExecutionJudgment(objectMapper, rkdshR,"入库单审核成功","入库单审核失败");
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+        return "入库成功";
+    }
+
+    /**
+     * erp创建单据是否成功
+     * @param objectMapper
+     * @param resultJson
+     * @param msg1
+     * @param msg2
+     * @return
+     * @throws JsonProcessingException
+     */
+    private 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"));
+        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();
+        if(isSuccess3.equals("true")){
+            return msg1;
+        }else {
+            System.out.println(msg2);
+            throw new RuntimeException(msg2);
+        }
+    }
+
+
+    /**
+     * 没有调用ERP入库单之前的入库逻辑
+     * @param productionOrderNumber
+     * @return
+     */
+    public  String  generateWarehouseWarrant2(String productionOrderNumber){
+        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")){
+                //看包装跟当前生产订单总数量是否相等
+                if(ringScanInformationFirst.getPackingQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                    //生成入库单
+                    System.out.println("包装生成入库单-入成品仓库");
+                    //入库这个生产订单下的所有产品信息
+
+                    //改当前生产订单的状态
+                    PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                    planTaskDetails.setDemandDocument(productionOrderNumber);
+                    planTaskDetails.setStatus("2");//生产完成
+                    int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                }
+            }else if(packingOrInspection.equals("2")){
+                //看包装跟当前生产订单总数量是否相等
+                if(ringScanInformationFirst.getInspectionQuantity().equals(ringScanInformationFirst.getProductionOrderTotalQuantity())){
+                    //生成入库单
+                    System.out.println("包装生成入库单--入利庫");
+                    //入库这个生产订单下的所有产品信息
+                    PlanTaskDetails planTaskDetails=new PlanTaskDetails();
+                    planTaskDetails.setDemandDocument(productionOrderNumber);
+                    planTaskDetails.setStatus("2");//生产完成
+                    int i = planTaskDetailsMapper.updatePlanTaskDetailsByDemandDocument(planTaskDetails);
+                }
+            }
+        }
+        return "数量够了入库";
+    }
+
+
+    /**
+     * 蓝牙扫描枪扫描(作废)
+     * @param stationProductScanningRingVo
+     * @return
+     */
+    @Override
+    @Transactional
+    public String bluetoothScannerGun(StationProductScanningRingVo stationProductScanningRingVo) {
+        String contentInformation = stationProductScanningRingVo.getContentInformation();
+        if(contentInformation.contains("addRing")){//添加二维扫描枪
+            //编号拆分 蓝牙名-mac地址
+            String[] split = stationProductScanningRingVo.getDeviceNumber().split("-");
+            //位置1是蓝牙名称-位置二实mac地址
+            String split1=split[0];
+            //位置2是mac地址
+            String split2=split[1];
+            RingTerminal ringTerminal=new RingTerminal();
+            ringTerminal.setBluetoothName(split1);
+            ringTerminal.setHandheldTerminalNumber(split2);
+            int i = ringTerminalMapper.updateRingTerminalByBluetoothName(ringTerminal);
+            if(i>0){
+                System.out.println("扫描枪添加成功");
+            }
+        }else if(contentInformation.contains("scan@")){//扫描的是员工码
+            //更改当前人员的扫码信息
+            String replace = contentInformation.replace("scan@", "");
+            String[] personeList = replace.split("#");
+            //把当前设备给切换到这个人身上
+            //先找到当前设备在那个人身上
+            //更改当前工位码的设备信息
+            StationInformation stationInformation = new StationInformation();
+            String[] split1 = stationProductScanningRingVo.getDeviceNumber().split("-");
+            stationInformation.setDeviceNumber(split1[1]);//设备编号
+            stationInformation.setBluetoothName(split1[0]);//蓝牙名称
+            List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationListByDEviceNumber(stationInformation);
+            if (stationInformations.size()>0){
+                //重置以前的绑定(手持机在哪我就把那变成空)
+                stationInformationMapper.updateStationInformationDeviceNameAndBluetoothName(stationInformation);
+            }
+            stationInformation.setPersonnelId(personeList[0]);//员工id
+            stationInformation.setPersonnelName(personeList[1]);//员工姓名
+            int i = stationInformationMapper.updateStationInformationByUseIdAndUserName(stationInformation);
+            if(i>0){
+                System.out.println("扫枪绑定信息切换成功");
+            }
+        }else {
+
+
+            String scanningTime = stationProductScanningRingVo.getScanningTime();
+            String[] split = stationProductScanningRingVo.getDeviceNumber().split("-");
+            //1、判断扫的是不是厂内流转卡
+            /*boolean fjqyD = stationProductScanningRingVo.getContentInformation().contains("D");
+            boolean fjqyZ = stationProductScanningRingVo.getContentInformation().contains("Z");
+            if(!fjqyD||!fjqyZ){return "请扫描相关二维码";}*/
+
+            //2、扫描间距判断
+            /* RingScanInformation ringScanInformationQuery=new RingScanInformation();
+            ringScanInformationQuery.setDeviceNumber(split[1]);//设备Mac地址
+            RingScanInformation ringScanInformations = ringScanInformationMapper.selectRingScanInformationListDateTimeMax(ringScanInformationQuery);
+            if(ringScanInformations!=null){
+                //拿到上次扫描的时间
+                LocalDateTime scanningTime1 = ringScanInformations.getScanningTime();
+                //拿到当前系统时间
+                LocalDateTime now = LocalDateTime.now();
+                //计算两次时间的时间差
+                Duration duration = Duration.between(scanningTime1, now);
+                boolean isTwoMinutesPassed = duration.toMinutes() < 1;
+                //判断两次时间是否大于
+                if (isTwoMinutesPassed) {
+                  return "同一设备,两分钟之内不能重复扫描";
+                }
+            }*/
+
+            //3、扫描录入数据
+            RingScanInformation ringScanInformation=new RingScanInformation();
+            ringScanInformation.setContentInformation(contentInformation);
+            LocalDateTime localDateTime = DateUtils.toLocalDateTime(scanningTime, "yyyy-MM-dd HH:mm:ss");
+            ringScanInformation.setScanningTime(localDateTime);
+            ringScanInformation.setDeviceName(split[0]);//蓝牙名称
+            ringScanInformation.setDeviceNumber(split[1]);//mac地址
+            //4、查询当前机器绑定的工位信息和人信息
+            StationInformation terminalInformation=new StationInformation();
+            terminalInformation.setBluetoothName(split[0]); //蓝牙名称
+            terminalInformation.setDeviceNumber(split[1]);//mac地址
+            List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationListByDEviceNumber(terminalInformation);
+            if(stationInformations.size()>0){
+                ringScanInformation.setPersonnelName(stationInformations.get(0).getPersonnelName());
+                ringScanInformation.setProcess(stationInformations.get(0).getProcessId());
+                ringScanInformation.setProcessName(stationInformations.get(0).getProcessName());
+                ringScanInformation.setStationId(stationInformations.get(0).getId().toString()); //工位名称
+                ringScanInformation.setStationName(stationInformations.get(0).getStationName());//工位名称
+            }
+            String nativeNumber="";
+            if(contentInformation.contains("Z")){
+                nativeNumber = contentInformation.replace("Z", "");
+            }
+            if(contentInformation.contains("D")){
+                nativeNumber=contentInformation.replace("D","");
+            }
+            if(StringUtils.isNotNull(nativeNumber)&&nativeNumber!=""){
+                //取值真实的扫描内容
+                ringScanInformation.setNativeNumbering(nativeNumber);
+            }else {
+                //扫描内容
+                ringScanInformation.setNativeNumbering(contentInformation);
+            }
+            //根据扫描内容拿到生产订单号和订单号
+            String  queryStringOrderNumberAndProductionOrderNumber="{\n" +
+                    "    \"FormId\": \"PRD_MO\",\n" +
+                    "    \"FieldKeys\": \"FSaleOrderNo,FBillNo\",\n" +
+                    "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FSerialNo\",\"Compare\":\"17\",\"Value\":\""+ringScanInformation.getNativeNumbering()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                    "    \"OrderString\": \"\",\n" +
+                    "    \"TopRowCount\": 0,\n" +
+                    "    \"StartRow\": 0,\n" +
+                    "    \"Limit\": 2000,\n" +
+                    "    \"SubSystemId\": \"\"\n" +
+                    "}";
+            Map<String, Object> map = JSON.parseObject(queryStringOrderNumberAndProductionOrderNumber, Map.class);
+            K3CloudApi api = new K3CloudApi();
+            String resultJson = null;
+            try {
+                resultJson = api.billQuery(JSON.toJSONString(map));
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+            //判断内不为空
+            if(resultJson!=""&resultJson!="[]"){
+                List<JdProductionOrder>    jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+                if(jdProductionOrders.size()>0){
+                    //需求单据号
+                    ringScanInformation.setOrderNumber(jdProductionOrders.get(0).getDemandDocument());
+                    //生产订单号
+                    ringScanInformation.setProductionOrderNumber(jdProductionOrders.get(0).getDocumentNumber());
+                }
+            }
+            if(StringUtils.isNotNull(ringScanInformation.getOrderNumber())){
+                //--记录第一扫描(将来第一扫描的单据记录)
+                RingScanInformationFirst ringScanInformationFirst=new RingScanInformationFirst();
+                ringScanInformationFirst.setOrderNumber(ringScanInformation.getOrderNumber());
+                List<RingScanInformationFirst> ringScanInformationFirsts = ringScanInformationFirstMapper.selectRingScanInformationFirstList(ringScanInformationFirst);
+                //订单扫描记录
+                if(ringScanInformationFirsts.size()<=0){
+                    ringScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                    ringScanInformationFirst.setStatus("1");
+                    ringScanInformationFirst.setStartTime(LocalDateTime.now());//开始时间
+                    //查询这个订单的总数量是多少
+                    String sa="{\n" +
+                            "    \"FormId\": \"SAL_SaleOrder\",\n" +
+                            "    \"FieldKeys\": \"FBillNo,FQty\",\n" +
+                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"17\",\"Value\":\""+ringScanInformation.getOrderNumber()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                    Map<String, Object> mapTotal = JSON.parseObject(sa, Map.class);
+                    String resultJsonTotal = null;
+                    try {
+                        resultJsonTotal = api.billQuery(JSON.toJSONString(mapTotal));
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                    List<Map> mapListTotal = JSON.parseArray(resultJsonTotal, Map.class);
+                    if(mapListTotal.size()<=0){
+                        return "扫码失败订单已关闭";
+                    }
+                    Double totalAmount = mapListTotal.stream()
+                            .filter(map1 -> map1.containsKey("FQty")) // 确保 map 中包含 "amount" 字段
+                            .mapToDouble(map1 -> ((Number) map1.get("FQty")).doubleValue()) // 将 "amount" 字段转换为 double
+                            .sum(); // 求和
+
+                    ringScanInformationFirst.setTotalQuantity(String.valueOf(totalAmount.intValue()));
+                    //第一次扫码记录订单扫描记录信息
+                    int i = ringScanInformationFirstMapper.insertRingScanInformationFirst(ringScanInformationFirst);
+                }
+                //先查生产订单日志表没有在新增
+                RingScanInformationProdOrderScanning prodOrderScanning=new RingScanInformationProdOrderScanning();
+                prodOrderScanning.setOrderNumber(ringScanInformation.getOrderNumber());
+                prodOrderScanning.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                List<RingScanInformationProdOrderScanning> ringScanInformationProdOrderScannings =
+                        prodOrderScanningMapper.selectRingScanInformationProdOrderScanningList(prodOrderScanning);
+                if(ringScanInformationProdOrderScannings.size()<0){
+                    //看看这个生产订单包装节点Or检验
+                    String query="{\n" +
+                            "    \"FormId\": \"PRD_MO\",\n" +
+                            "    \"FieldKeys\": \"FMaterialId.FNumber\",\n" +
+                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\""+ringScanInformation.getProductionOrderNumber()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                    Map<String, Object> prodListQuery = JSON.parseObject(query, Map.class);
+                    String prodListQueryJson = null;
+                    try {
+                        prodListQueryJson = api.billQuery(JSON.toJSONString(prodListQuery));
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                    List<Map> prodListQueryJsonList = JSON.parseArray(prodListQueryJson, Map.class);
+                    //如果ERP存在这个生产订单
+                    if(prodListQueryJsonList.size()>0){
+                        //[{"FMaterialId.FNumber":"1010040050034","FQty":2.0000000000}]
+                        //生产订单日志记录
+                        prodOrderScanning.setTotalQuantity(prodListQueryJsonList.get(0).get("FQty").toString());//数量
+                        if(prodListQueryJsonList.get(0).get("FMaterialId.FNumber").toString().startsWith("1")){
+                            prodOrderScanning.setToPackagingorinspection("1");//到包装
+                        }else if(prodListQueryJsonList.get(0).get("FMaterialId.FNumber").toString().startsWith("2")){
+                            prodOrderScanning.setToPackagingorinspection("2");//到检验
+                        }else {
+                            prodOrderScanning.setToPackagingorinspection("0");//其他
+                        }
+                        int i = prodOrderScanningMapper.insertRingScanInformationProdOrderScanning(prodOrderScanning);
+                        if(i>0){
+                            System.out.println("新增生产订单日志信息成功");
+                        }
+                    }
+                }
+            }
+
+            //插入扫描日志信息
+            int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+
+            if(i2>0){
+                //最后一个节点判定逻辑
+                RingScanInformationProdOrderScanning prodOrderScanning=new RingScanInformationProdOrderScanning();
+                prodOrderScanning.setOrderNumber(ringScanInformation.getOrderNumber());
+                prodOrderScanning.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                List<RingScanInformationProdOrderScanning> ringScanInformationProdOrderScannings =
+                        prodOrderScanningMapper.selectRingScanInformationProdOrderScanningList(prodOrderScanning);
+                if(ringScanInformationProdOrderScannings.size()>0){
+                    String toPackagingorinspection = ringScanInformationProdOrderScannings.get(0).getToPackagingorinspection();
+                    if(toPackagingorinspection.equals("1")){//更新包装数量
+                        String toPackagingorinspection1 = ringScanInformationProdOrderScannings.get(0).getPackingQuantity();
+                        Double d=Double.valueOf(toPackagingorinspection1)+1;
+                        ringScanInformationProdOrderScannings.get(0).setPackingQuantity(d.toString());
+                        int i = prodOrderScanningMapper.updateRingScanInformationProdOrderScanning(ringScanInformationProdOrderScannings.get(0));
+                        System.out.println("包装节点更新成功");
+                        String rk = this.rk(prodOrderScanning);
+                        System.out.println(rk);
+                    }else {//更新检验数量
+                        String toPackagingorinspection1 = ringScanInformationProdOrderScannings.get(0).getInspectionQuantity();
+                        Double d=Double.valueOf(toPackagingorinspection1)+1;
+                        ringScanInformationProdOrderScannings.get(0).setInspectionQuantity(d.toString());
+                        int i = prodOrderScanningMapper.updateRingScanInformationProdOrderScanning(ringScanInformationProdOrderScannings.get(0));
+                        System.out.println("检验节点更新成功");
+                        String rk = this.rk(prodOrderScanning);
+                        System.out.println(rk);
+                    }
+                }
+                return "扫描成功";
+            }else {
+                return "扫描失败";
+            }
+        }
+        return "扫描成功";
+    }
+
+    /**
+     * 产品扫描
+     * @param contentString
+     * @return
+     */
+    @Override
+    public String stationProductScanning(String contentString) {
+        try {
+            if (contentString.contains("scan@")) {//这个是工位码扫描逻辑
+                String[] content = contentString.split("&");
+                //更改当前工位码的设备信息
+                StationInformation stationInformation = new StationInformation();
+                stationInformation.setDeviceName(content[2]);//设备信息
+                //查询当前设备是否已经绑定了工位信息
+                List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationList(stationInformation);
+                if (stationInformations.size() > 0) { //更新原先绑定的工位信息为空
+                    stationInformation.setDeviceName("");//设备信息
+                    stationInformation.setTeamCode("");//班组码信息
+                    stationInformation.setStationCode(stationInformations.get(0).getStationCode());//工位码信息
+                    stationInformationMapper.updateStationInformationByStationUpdateEquipment(stationInformation);
+                }
+                stationInformation.setDeviceName(content[2]);//设备信息
+                stationInformation.setStationCode(content[1]);//工位码
+                int i = stationInformationMapper.updateStationInformationByStationUpdateEquipment(stationInformation);
+                return "手持机工位信息绑定成功";
+            } else if (contentString.contains("team@")){
+                String[] content = contentString.split("&");
+                //扫工位码之前先判断你当前手持机扫没扫过工位码信息
+                StationInformation stationInformationByDeviceName=new StationInformation();
+                stationInformationByDeviceName.setDeviceName(content[2]);//手持机标识
+                List<StationInformation> stationInformationsByDeviceName = stationInformationMapper.selectStationInformationList(stationInformationByDeviceName);
+                if(stationInformationsByDeviceName.size()<=0){
+                    return "请先用当前手持先扫工位码";
+                }
+                //先查询当前班组码有没有在其他工位上有就先给他清空
+                StationInformation stationInformation=new StationInformation();
+                stationInformation.setTeamCode(content[1]);//班组码信息
+                List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationList(stationInformation);
+                if (stationInformations.size() > 0) { //更新原先绑定的工位信息为空
+                    stationInformation.setTeamName("");//班组码信息
+                    stationInformation.setStationCode(stationInformations.get(0).getStationCode());//工位码信息
+                    stationInformationMapper.updateStationInformationByStationUpdateEquipment(stationInformation);
+                }
+                stationInformation.setTeamCode(content[1]);//班组码
+                stationInformation.setDeviceName(content[2]);//手持机码
+                int i = stationInformationMapper.updateStationInformationByStationUpdateByDeviceName(stationInformation);
+
+                List<StationInformation> stationInformationsTwo = stationInformationMapper.selectStationInformationList(stationInformation);
+                //拿到工位id
+                StationInformation stationInformation1 = stationInformationsTwo.get(0);
+                return "工位:"+stationInformation1.getStationName()+" 班组:"+stationInformation1.getTeamName();
+            } else{
+                //产品扫描逻辑
+                String[] content = contentString.split("&");
+                StationInformation stationInformation=new StationInformation();
+                stationInformation.setDeviceName(content[1]);//设备名称
+                //查询工位信息表
+                List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationList(stationInformation);
+                //节点.
+                if(stationInformations.size()>0){
+                    StationInformation stationInformation1 = stationInformations.get(0);//根据手持机设备名称得到工位信息
+                    ReportInformationSheet reportInformationSheet=new ReportInformationSheet();
+                    reportInformationSheet.setCurrentStationStationPeople(stationInformation1.getPersonnelName());//工位人员姓名
+                    reportInformationSheet.setStationCode(stationInformation1.getStationCode());//工位码
+                    reportInformationSheet.setProcess(stationInformation1.getStationName());//工序名称
+                    reportInformationSheet.setProductCode(content[0]);//产品码
+                    reportInformationSheet.setHandheldDevice(content[1]);//手持机
+                    reportInformationSheet.setCreateTime(new DateTime());//创建时间
+                    //推算出来产品编号或者订单编号
+                    String modifiedString = "DQY" + content[0].substring(0, content[0].length() - 3);
+                    reportInformationSheet.setOrderNumber(modifiedString);//订单号或任务号
+                    //更新节点生产数量
+                    //先拿到当前任务数量
+                    List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementByOrderNumebrOrPlanNumber(modifiedString, modifiedString);
+                    if(productionPlanningManagements.size()<=0){
+                        //插入异常报工信息
+                        extracted(reportInformationSheet,"未找到当前产品计划报工失败--信息不匹配");
+                        return "未找到当前产品计划报工失败--信息不匹配";
+                    }else {
+                        boolean equals = productionPlanningManagements.get(0).getPlanType().equals("3");
+                        if(equals){
+                            //插入异常报工信息
+                            extracted(reportInformationSheet,"该计划已经完成--信息不匹配");
+                            return "该计划已经完成--信息不匹配";
+                        }else {
+                            //找到计划了先确认下数量(我计划下的数量)
+                            ProductionPlanningManagement productionPlanningManagement = productionPlanningManagements.get(0);
+                            //拿到计划id------->根据计划id查询流程信息
+                            BpmExecuteProcess process=new BpmExecuteProcess();
+                            process.setTaskPlanKey(productionPlanningManagement.getId().toString());//计划id
+                            List<BpmExecuteProcess> bpmExecuteProcesses = bpmExecuteProcessMapper.selectBpmExecuteProcessListfjqy(process);
+                            if(bpmExecuteProcesses.size()<=0){
+                                //插入异常报工信息
+                                extracted(reportInformationSheet,"没有找到当前计划的流程管道--信息不匹配");
+                                return "没有找到当前计划的流程管道--信息不匹配";
+                            }else {
+                                //管道
+                                String taskKey = bpmExecuteProcesses.get(0).getTaskKey();
+                                BpmExecuteNodeLog bpmExecuteNodeLog=new BpmExecuteNodeLog();
+                                bpmExecuteNodeLog.setTaskProcessKey(taskKey);//流程编号
+                                bpmExecuteNodeLog.setTaskNodeName(stationInformation1.getStationName());//工序名称
+                                List<BpmExecuteNodeLog> bpmExecuteNodeLogs = bpmExecuteNodeLogMapper.selectBpmExecuteNodeLogListfjqy(bpmExecuteNodeLog);
+                                String taskNodeNumber = bpmExecuteNodeLogs.get(0).getTaskNodeNumber();//节点数量
+                                //判断你当前报工工序节点是否已经报够数量了
+                                if(taskNodeNumber==null||taskNodeNumber.equals("")){
+                                    taskNodeNumber="0";
+                                }
+                                if(Integer.parseInt(taskNodeNumber)>=Integer.parseInt(productionPlanningManagement.getQuantity())){
+                                    //插入异常报工信息
+                                    extracted(reportInformationSheet,"当前工序已完成计划数量");
+                                    return "当前工序已完成计划数量";
+                                }else {
+                                    //否则更新接单已完成数量
+                                    int i = Math.addExact(Integer.parseInt(taskNodeNumber), 1);
+                                    BpmExecuteNodeLog upBpmExecuteNodeLog=new BpmExecuteNodeLog();
+                                    upBpmExecuteNodeLog.setTaskNodeNumber(String.valueOf(i));//更新数量
+                                    upBpmExecuteNodeLog.setId(bpmExecuteNodeLogs.get(0).getId());//节点日志id
+                                    //判断同一部手持机扫描时间间隔是否超过一分钟
+                                    ReportInformationSheet sheetsjjg=new ReportInformationSheet();
+                                    sheetsjjg.setProcess(stationInformation1.getStationName());//工序
+                                    sheetsjjg.setHandheldDevice(content[2]);//设备信息
+                                    ReportInformationSheet reportInformationSheetsSc = reportInformationSheetMapper.selectReportInformationSheetListOrderBy(sheetsjjg);
+                                    Date date1 = reportInformationSheetsSc.getCreateTime(); //上次扫码时间
+                                    Date date2 = new Date();//当前时间
+                                    String s = DateUtils.timeDistanceMin(date2, date1);
+                                    if(Integer.parseInt(s)<1){
+                                        //插入异常报工信息
+                                        extracted(reportInformationSheet,"两次扫码之间的间隔不能小于1分钟");//???? 看看那个小工人有这个坏心思
+                                        return "两次扫码之间的间隔不能小于1分钟";
+                                    }
+                                    //工序--产品重复扫描
+                                    ReportInformationSheet reportInformationSheet1=new ReportInformationSheet();
+                                    reportInformationSheet1.setProcess(stationInformation1.getStationName());//工序名称
+                                    reportInformationSheet1.setProductCode(stationInformation1.getStationName());//产品码
+                                    List<ReportInformationSheet> reportInformationSheets = reportInformationSheetMapper.selectReportInformationSheetList(reportInformationSheet1);
+                                    if(reportInformationSheets.size()>0){
+                                        //插入异常报工信息
+                                        extracted(reportInformationSheet,"产品不能重复扫描");
+                                        return "产品不能重复扫描";
+                                    }
+
+                                    //当前产品只能被下一个工序进行扫描
+                                    //查询当前计划的所有工序信息
+                                    BpmExecuteNodeLog bpmExecuteNodeLogString=new BpmExecuteNodeLog();
+                                    bpmExecuteNodeLog.setTaskProcessKey(taskKey);//流程编号
+                                    List<BpmExecuteNodeLog> bpmExecuteNodeLogsString = bpmExecuteNodeLogMapper.selectBpmExecuteNodeLogListfjqy(bpmExecuteNodeLogString);
+                                    List<String> collect = bpmExecuteNodeLogsString.stream().map(BpmExecuteNodeLog::getTaskNodeName).collect(Collectors.toList());
+                                    //所有的集合我拿到了
+                                    ReportInformationSheet reportInformationSheet1String=new ReportInformationSheet();
+                                    reportInformationSheet1String.setProductCode(stationInformation1.getStationName());//产品码
+                                    List<ReportInformationSheet> reportInformationSheetsString = reportInformationSheetMapper.selectReportInformationSheetList(reportInformationSheet1String);
+                                    ReportInformationSheet reportInformationSheet2 = reportInformationSheetsString.get(0);
+                                    String process1 = reportInformationSheet2.getProcess();//这个产品编码上一次是那个工序扫的?
+                                    int nextIndex=0;
+                                    for (int i1 = 0; i1 < collect.size(); i1++) {
+                                        //如果工序名称相同
+                                        if(collect.get(i1).equals(process1)){
+                                            nextIndex=i1+1;
+                                        }
+                                    }
+                                    //说明已经在最后一个节点了,你前边的手持工序在怎么扫都扫不上的
+                                    if(nextIndex>=collect.size()){
+                                        //插入异常报工信息
+                                        extracted(reportInformationSheet,"请选择对应工序的手持机进行扫描");
+                                        return "请选择对应工序的手持机进行扫描";
+                                    }else {
+                                        if(!stationInformation1.getStationName().equals(collect.get(nextIndex))){
+                                            //插入异常报工信息
+                                            extracted(reportInformationSheet,"请选择当前产品对应的工序信息进行扫描");
+                                            return "请选择当前产品对应的工序信息进行扫描";
+                                        }
+                                    }
+                                    //当前工序有没有漏扫
+                                    int result = Math.subtractExact(Integer.parseInt(stationInformation1.getStationName()), 1);
+                                    reportInformationSheet1.setProductCode(String.valueOf(result));//产品码
+                                    List<ReportInformationSheet> reportInformationSheetsLS = reportInformationSheetMapper.selectReportInformationSheetList(reportInformationSheet1);
+                                    if(reportInformationSheetsLS.size()>0){
+                                        //插入异常报工信息
+                                        extracted(reportInformationSheet,"当前工序漏扫了一个产品信息--请核对信息");
+                                        return "当前工序漏扫了一个产品信息--请核对信息";
+                                    }
+                                    //根据工位码查询 ---->节点报工日志
+                                    reportInformationSheetMapper.insertReportInformationSheet(reportInformationSheet);
+                                    int i1 = bpmExecuteNodeLogMapper.updateBpmExecuteNodeLogfjqy(upBpmExecuteNodeLog);
+                                    //更新当前工序节点信息
+                                    if(i1 >0){
+                                        return "产品信息扫描成功";
+                                    }else {
+                                        extracted(reportInformationSheet,"更新节点管道工序任务数量失败");
+                                        return "扫码报工失败";
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }else{
+                    return  "当前设备未绑定工位信息";
+                }
+            }
+        } catch (Exception e) {
+            System.out.println(
+                    e.getMessage()
+            );
+            return  "扫描失败";
+        }
+    }
+    /**
+     * 有其他方法调用这个这个基础逻辑
+     * @param contentString
+     * @return
+     */
+    private String  rk(RingScanInformationProdOrderScanning contentString){
+        return "rk";
+    }
+
+
+    /**
+     * 手持扫描实现(作废)
+     * @param contentString
+     * @return
+     */
+    @Override
+    public String stationProductScanningTwo(String contentString) {
+        //扫描人员码信息
+        if(contentString.contains("scan@")){
+            //扫描标记替换为空
+            String replace = contentString.replace("scan@", "");
+            //首先把内容拆分下
+            String[] content = replace.split("&");
+            //人员信息
+            String personneString = content[0];
+            //更改当前人员的扫码信息
+            String[] personneList = personneString.split("#");
+            //设备编码信息
+            String sbMacAddress= content[1];
+            //更改当前工位码的设备信息
+            StationInformation stationInformation = new StationInformation();
+            stationInformation.setDeviceNumber(sbMacAddress);//设备编号
+            List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationListByDEviceNumber(stationInformation);
+            if (stationInformations.size()>0){
+                //重置以前的绑定(手持机在哪我就把那变成空)
+                stationInformationMapper.updateStationInformationDeviceNameAndBluetoothName(stationInformation);
+            }
+            stationInformation.setPersonnelId(personneList[0]);//员工id
+            stationInformation.setPersonnelName(personneList[1]);//员工姓名
+            int i = stationInformationMapper.updateStationInformationByUseIdAndUserName(stationInformation);
+            if(i>0){
+                System.out.println("工位:"+stationInformations.get(0).getStationName()+"人员:"+stationInformations.get(0).getPersonnelName());
+            }
+        }else {
+            //产品编码&mac地址
+            String[] content = contentString.split("&");
+            //产品编码
+            String s1 = content[0];
+            //mac地址
+            String s2 = content[1];
+
+            //1、判断扫的是不是厂内流转卡
+            /*boolean fjqyD = stationProductScanningRingVo.getContentInformation().contains("D");
+            boolean fjqyZ = stationProductScanningRingVo.getContentInformation().contains("Z");
+            if(!fjqyD||!fjqyZ){return "请扫描相关二维码";}*/
+
+            //2、扫描间距判断
+            /* RingScanInformation ringScanInformationQuery=new RingScanInformation();
+            ringScanInformationQuery.setDeviceNumber(split[1]);//设备Mac地址
+            RingScanInformation ringScanInformations = ringScanInformationMapper.selectRingScanInformationListDateTimeMax(ringScanInformationQuery);
+            if(ringScanInformations!=null){
+                //拿到上次扫描的时间
+                LocalDateTime scanningTime1 = ringScanInformations.getScanningTime();
+                //拿到当前系统时间
+                LocalDateTime now = LocalDateTime.now();
+                //计算两次时间的时间差
+                Duration duration = Duration.between(scanningTime1, now);
+                boolean isTwoMinutesPassed = duration.toMinutes() < 1;
+                //判断两次时间是否大于
+                if (isTwoMinutesPassed) {
+                  return "同一设备,两分钟之内不能重复扫描";
+                }
+            }*/
+
+            //扫码内容
+            RingScanInformation ringScanInformation=new RingScanInformation();
+            //扫描内容
+            ringScanInformation.setContentInformation(s1);
+            //当前时间
+            ringScanInformation.setScanningTime(LocalDateTime.now());
+            //mac地址
+            ringScanInformation.setDeviceNumber(s2);//mac地址
+
+            //4、查询当前机器绑定的工位信息和人信息
+            StationInformation terminalInformation=new StationInformation();
+            terminalInformation.setDeviceNumber(s2);//mac地址
+            List<StationInformation> stationInformations =
+                    stationInformationMapper.selectStationInformationListByDEviceNumber(terminalInformation);
+            if(stationInformations.size()>0){
+                ringScanInformation.setPersonnelName(stationInformations.get(0).getPersonnelName());
+                ringScanInformation.setProcess(stationInformations.get(0).getProcessId()); //人员id
+                ringScanInformation.setProcessName(stationInformations.get(0).getProcessName()); //人员姓名
+                ringScanInformation.setStationId(stationInformations.get(0).getId().toString()); //工位id
+                ringScanInformation.setStationName(stationInformations.get(0).getStationName());//工位名称
+            }
+            String nativeNumber="";
+            if(s1.contains("Z")){nativeNumber = s1.replace("Z", "");}
+            if(s1.contains("D")){nativeNumber=s1.replace("D","");}
+            if(StringUtils.isNotNull(nativeNumber)&&nativeNumber!=""){
+                //取值真实的扫描内容
+                ringScanInformation.setNativeNumbering(nativeNumber);
+            }else {
+                //扫描内容---直接就是产品码
+                ringScanInformation.setNativeNumbering(s1);
+            }
+
+
+            //根据扫描内容拿到生产订单号和订单号
+            String  queryStringOrderNumberAndProductionOrderNumber="{\n" +
+                    "    \"FormId\": \"PRD_MO\",\n" +
+                    "    \"FieldKeys\": \"FSaleOrderNo,FBillNo\",\n" +
+                    "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FSerialNo\",\"Compare\":\"17\",\"Value\":\""+ringScanInformation.getNativeNumbering()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                    "    \"OrderString\": \"\",\n" +
+                    "    \"TopRowCount\": 0,\n" +
+                    "    \"StartRow\": 0,\n" +
+                    "    \"Limit\": 2000,\n" +
+                    "    \"SubSystemId\": \"\"\n" +
+                    "}";
+            Map<String, Object> map = JSON.parseObject(queryStringOrderNumberAndProductionOrderNumber, Map.class);
+            K3CloudApi api = new K3CloudApi();
+            String resultJson = null;
+            try {
+                resultJson = api.billQuery(JSON.toJSONString(map));
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            //判断内不为空
+            if(resultJson!=""&resultJson!="[]"){
+                List<JdProductionOrder>    jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+                if(jdProductionOrders.size()>0){
+                    //需求单据号
+                    ringScanInformation.setOrderNumber(jdProductionOrders.get(0).getDemandDocument());
+                    //生产订单号
+                    ringScanInformation.setProductionOrderNumber(jdProductionOrders.get(0).getDocumentNumber());
+                    //唯一标识id
+//                    ringScanInformation.setId(UUID.randomUUID().toString());
+                }
+            }
+
+            if(StringUtils.isNotNull(ringScanInformation.getOrderNumber())){
+                //--记录第一扫描(将来第一扫描的单据记录)
+                RingScanInformationFirst ringScanInformationFirst=new RingScanInformationFirst();
+                ringScanInformationFirst.setOrderNumber(ringScanInformation.getOrderNumber());
+                List<RingScanInformationFirst> ringScanInformationFirsts = ringScanInformationFirstMapper.selectRingScanInformationFirstList(ringScanInformationFirst);
+                //订单扫描记录
+                if(ringScanInformationFirsts.size()<=0){
+                    ringScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                    ringScanInformationFirst.setStatus("1");
+                    ringScanInformationFirst.setStartTime(LocalDateTime.now());//开始时间
+                    //查询这个订单的总数量是多少
+                    String sa="{\n" +
+                            "    \"FormId\": \"SAL_SaleOrder\",\n" +
+                            "    \"FieldKeys\": \"FBillNo,FQty\",\n" +
+                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"17\",\"Value\":\""+ringScanInformation.getOrderNumber()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                    Map<String, Object> mapTotal = JSON.parseObject(sa, Map.class);
+                    String resultJsonTotal = null;
+                    try {
+                        resultJsonTotal = api.billQuery(JSON.toJSONString(mapTotal));
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                    List<Map> mapListTotal = JSON.parseArray(resultJsonTotal, Map.class);
+                    if(mapListTotal.size()<=0){
+                        ringScanInformation.setExecutionMark("2");//成功
+                        ringScanInformation.setExecutionMessage("扫描失败");
+                        int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+                        return "订单已关闭-扫描失败";
+                    }
+                    Double totalAmount = mapListTotal.stream()
+                            .filter(map1 -> map1.containsKey("FQty")) // 确保 map 中包含 "amount" 字段
+                            .mapToDouble(map1 -> ((Number) map1.get("FQty")).doubleValue()) // 将 "amount" 字段转换为 double
+                            .sum(); // 求和
+
+                    ringScanInformationFirst.setTotalQuantity(String.valueOf(totalAmount.intValue()));
+                    //第一次扫码记录订单扫描记录信息
+                    int i = ringScanInformationFirstMapper.insertRingScanInformationFirst(ringScanInformationFirst);
+                }
+                //先查生产订单日志表没有在新增
+                RingScanInformationProdOrderScanning prodOrderScanning=new RingScanInformationProdOrderScanning();
+                prodOrderScanning.setOrderNumber(ringScanInformation.getOrderNumber());
+                prodOrderScanning.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                List<RingScanInformationProdOrderScanning> ringScanInformationProdOrderScannings =
+                        prodOrderScanningMapper.selectRingScanInformationProdOrderScanningList(prodOrderScanning);
+                if(ringScanInformationProdOrderScannings.size()<0){
+                    //看看这个生产订单包装节点Or检验
+                    String query="{\n" +
+                            "    \"FormId\": \"PRD_MO\",\n" +
+                            "    \"FieldKeys\": \"FMaterialId.FNumber\",\n" +
+                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"67\",\"Value\":\""+ringScanInformation.getProductionOrderNumber()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                    Map<String, Object> prodListQuery = JSON.parseObject(query, Map.class);
+                    String prodListQueryJson = null;
+                    try {
+                        prodListQueryJson = api.billQuery(JSON.toJSONString(prodListQuery));
+                    } catch (Exception e) {
+                        throw new RuntimeException(e);
+                    }
+                    List<Map> prodListQueryJsonList = JSON.parseArray(prodListQueryJson, Map.class);
+                    //如果ERP存在这个生产订单
+                    if(prodListQueryJsonList.size()>0){
+                        //[{"FMaterialId.FNumber":"1010040050034","FQty":2.0000000000}]
+                        //生产订单日志记录
+                        prodOrderScanning.setTotalQuantity(prodListQueryJsonList.get(0).get("FQty").toString());//数量
+                        if(prodListQueryJsonList.get(0).get("FMaterialId.FNumber").toString().startsWith("1")){
+                            prodOrderScanning.setToPackagingorinspection("1");//到包装
+                        }else if(prodListQueryJsonList.get(0).get("FMaterialId.FNumber").toString().startsWith("2")){
+                            prodOrderScanning.setToPackagingorinspection("2");//到检验
+                        }else {
+                            prodOrderScanning.setToPackagingorinspection("0");//其他
+                        }
+                        int i = prodOrderScanningMapper.insertRingScanInformationProdOrderScanning(prodOrderScanning);
+                        if(i>0){
+                            System.out.println("新增生产订单日志信息成功");
+                        }
+                    }
+                }
+            }
+
+            //插入扫描日志信息
+            int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+
+            if(i2>0){
+                //最后一个节点判定逻辑
+                RingScanInformationProdOrderScanning prodOrderScanning=new RingScanInformationProdOrderScanning();
+                prodOrderScanning.setOrderNumber(ringScanInformation.getOrderNumber());
+                prodOrderScanning.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                List<RingScanInformationProdOrderScanning> ringScanInformationProdOrderScannings =
+                        prodOrderScanningMapper.selectRingScanInformationProdOrderScanningList(prodOrderScanning);
+                if(ringScanInformationProdOrderScannings.size()>0){
+                    String toPackagingorinspection = ringScanInformationProdOrderScannings.get(0).getToPackagingorinspection();
+                    if(toPackagingorinspection.equals("1")){//更新包装数量
+                        String toPackagingorinspection1 = ringScanInformationProdOrderScannings.get(0).getPackingQuantity();
+                        Double d=Double.valueOf(toPackagingorinspection1)+1;
+                        ringScanInformationProdOrderScannings.get(0).setPackingQuantity(d.toString());
+                        int i = prodOrderScanningMapper.updateRingScanInformationProdOrderScanning(ringScanInformationProdOrderScannings.get(0));
+                        System.out.println("包装节点更新成功");
+                        String rk = this.rk(prodOrderScanning);
+                        System.out.println(rk);
+                    }else {//更新检验数量
+                        String toPackagingorinspection1 = ringScanInformationProdOrderScannings.get(0).getInspectionQuantity();
+                        Double d=Double.valueOf(toPackagingorinspection1)+1;
+                        ringScanInformationProdOrderScannings.get(0).setInspectionQuantity(d.toString());
+                        int i = prodOrderScanningMapper.updateRingScanInformationProdOrderScanning(ringScanInformationProdOrderScannings.get(0));
+                        System.out.println("检验节点更新成功");
+                        String rk = this.rk(prodOrderScanning);
+                        System.out.println(rk);
+                    }
+                }
+                return "扫描成功";
+            }else {
+                return "扫描失败";
+            }
+        }
+        return "扫描成功";
+    }
+
+
+    /**
+     * 指环王扫描信息hmc
+     * @param stationProductScanningRingVo
+     * @return
+     */
+    @Override
+    @Transactional
+    public String stationProductScanningRing(StationProductScanningRingVo stationProductScanningRingVo) {
+          //判断扫的是不是厂内流转卡
+//        boolean fjqy = stationProductScanningRingVo.getContentInformation().contains("FJQY");
+//        if(!fjqy){
+//            return "请扫描相关二维码";
+//        };
+        try {
+//            String string = Base64.getDecoder().decode(stationProductScanningRingVo.getDeviceNumber()).toString();
+            String deviceNumberAndName = stationProductScanningRingVo.getDeviceNumber();//设备号
+            String[] split = deviceNumberAndName.split("-");
+            String deviceNumber=split[0];
+            String deviceName=split[1];
+            String scanningTime = stationProductScanningRingVo.getScanningTime();//扫描时间
+           //先获取到当前设备上次的扫描时间
+//            RingScanInformation ringScanInformationQuery=new RingScanInformation();
+//            ringScanInformationQuery.setDeviceName(deviceName);
+//            RingScanInformation ringScanInformations = ringScanInformationMapper.selectRingScanInformationListDateTimeMax(ringScanInformationQuery);
+////            if(ringScanInformations!=null){
+//                //拿到上次扫描的时间
+//                LocalDateTime scanningTime1 = ringScanInformations.getScanningTime();
+//                //拿到当前系统时间
+//                LocalDateTime now = LocalDateTime.now();
+//                //计算两次时间的时间差
+//                Duration duration = Duration.between(scanningTime1, now);
+//                boolean isTwoMinutesPassed = duration.toMinutes() < 1;
+//                //判断两次时间是否大于
+//                if (isTwoMinutesPassed) {
+//                  return "同一设备,两分钟之内不能重复扫描";
+//                }
+//            }
+            String contentInformation = stationProductScanningRingVo.getContentInformation();//扫描内容
+            RingScanInformation ringScanInformation=new RingScanInformation();
+            ringScanInformation.setContentInformation(contentInformation);
+            LocalDateTime localDateTime = DateUtils.toLocalDateTime(scanningTime, "yyyy-MM-dd HH:mm:ss");
+            ringScanInformation.setScanningTime(localDateTime);
+            ringScanInformation.setDeviceName(deviceName);
+            ringScanInformation.setDeviceNumber(deviceNumber);
+            //赋值当前扫描人
+            TerminalInformation terminalInformation=new TerminalInformation();
+            terminalInformation.setStationName(deviceNumber);
+            List<TerminalInformation> terminalInformations = terminalInformationMapper.selectTerminalInformationList(terminalInformation);
+            if(terminalInformations.size()>0){
+                ringScanInformation.setPersonnelName(terminalInformations.get(0).getPersonnelName());
+                ringScanInformation.setProcess(terminalInformations.get(0).getProcess());
+                ringScanInformation.setProcessName(terminalInformations.get(0).getProcessName());
+            }
+
+            String nativeNumber="";
+            if(contentInformation.contains("Z")){
+                nativeNumber = contentInformation.replace("Z", "");
+            }
+            if(contentInformation.contains("D")){
+                nativeNumber=contentInformation.replace("D","");
+            }
+            if(StringUtils.isNotNull(nativeNumber)&&nativeNumber!=""){
+                //取值真实的扫描内容
+                ringScanInformation.setNativeNumbering(nativeNumber);
+            }else {
+                //扫描内容
+                ringScanInformation.setNativeNumbering(contentInformation);
+            }
+            //根据扫描内容拿到生产订单号和订单号
+            String  queryStringOrderNumberAndProductionOrderNumber="{\n" +
+                    "    \"FormId\": \"PRD_MO\",\n" +
+                    "    \"FieldKeys\": \"FSaleOrderNo,FBillNo\",\n" +
+                    "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FSerialNo\",\"Compare\":\"17\",\"Value\":\""+ringScanInformation.getNativeNumbering()+"\",\"Right\":\"\",\"Logic\":0}],\n" +
+                    "    \"OrderString\": \"\",\n" +
+                    "    \"TopRowCount\": 0,\n" +
+                    "    \"StartRow\": 0,\n" +
+                    "    \"Limit\": 2000,\n" +
+                    "    \"SubSystemId\": \"\"\n" +
+                    "}";
+            Map<String, Object> map = JSON.parseObject(queryStringOrderNumberAndProductionOrderNumber, Map.class);
+            K3CloudApi api = new K3CloudApi();
+            String resultJson = api.billQuery(JSON.toJSONString(map));
+            //判断内不为空
+            if(resultJson!=""&resultJson!="[]"){
+                List<JdProductionOrder>    jdProductionOrders = JSON.parseArray(resultJson, JdProductionOrder.class);
+                if(jdProductionOrders.size()>0){
+                    //需求单据号
+                    ringScanInformation.setOrderNumber(jdProductionOrders.get(0).getDemandDocument());
+                    //生产订单号
+                    ringScanInformation.setProductionOrderNumber(jdProductionOrders.get(0).getDocumentNumber());
+                }
+            }
+            if(StringUtils.isNotNull(ringScanInformation.getOrderNumber())){
+                //--记录第一扫描(将来第一扫描的单据记录)
+                RingScanInformationFirst ringScanInformationFirst=new RingScanInformationFirst();
+                ringScanInformationFirst.setOrderNumber(ringScanInformation.getOrderNumber());
+                List<RingScanInformationFirst> ringScanInformationFirsts = ringScanInformationFirstMapper.selectRingScanInformationFirstList(ringScanInformationFirst);
+                if(ringScanInformationFirsts.size()<=0){
+                    ringScanInformationFirst.setProductionOrderNumber(ringScanInformation.getProductionOrderNumber());
+                    ringScanInformationFirst.setStatus("1");
+                    ringScanInformationFirst.setStartTime(LocalDateTime.now());//开始时间
+                    //查询这个订单的总数量是多少
+                    String sa="{\n" +
+                            "    \"FormId\": \"SAL_SaleOrder\",\n" +
+                            "    \"FieldKeys\": \"FBillNo,FQty\",\n" +
+                            "    \"FilterString\": [{\"Left\":\"\",\"FieldName\":\"FBillNo\",\"Compare\":\"17\",\"Value\":\""+ringScanInformation.getOrderNumber()+"+\",\"Right\":\"\",\"Logic\":0}],\n" +
+                            "    \"OrderString\": \"\",\n" +
+                            "    \"TopRowCount\": 0,\n" +
+                            "    \"StartRow\": 0,\n" +
+                            "    \"Limit\": 2000,\n" +
+                            "    \"SubSystemId\": \"\"\n" +
+                            "}";
+                    Map<String, Object> mapTotal = JSON.parseObject(sa, Map.class);
+                    String resultJsonTotal = api.billQuery(JSON.toJSONString(mapTotal));
+                    List<Map> mapListTotal = JSON.parseArray(resultJsonTotal, Map.class);
+                    Double totalAmount = mapListTotal.stream()
+                            .filter(map1 -> map1.containsKey("FQty")) // 确保 map 中包含 "amount" 字段
+                            .mapToDouble(map1 -> ((Number) map1.get("FQty")).doubleValue()) // 将 "amount" 字段转换为 double
+                            .sum(); // 求和
+                    ringScanInformationFirst.setTotalQuantity(String.valueOf(totalAmount.intValue()));
+                    int i = ringScanInformationFirstMapper.insertRingScanInformationFirst(ringScanInformationFirst);
+                }
+            }
+            int i2 = ringScanInformationMapper.insertRingScanInformation(ringScanInformation);
+            if(i2>0){
+                return "扫描成功";
+            }else {
+                return "扫描失败";
+            }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+
+//        //产品扫描逻辑
+//            String[] content = stationProductScanningRingVo.getContentInformation().split("&");
+//            StationInformation stationInformation=new StationInformation();
+//            stationInformation.setDeviceName(content[1]);//设备名称
+//            //查询工位信息表
+//            List<StationInformation> stationInformations = stationInformationMapper.selectStationInformationList(stationInformation);
+//            //节点.
+//            if(stationInformations.size()>0){
+//                StationInformation stationInformation1 = stationInformations.get(0);//根据手持机设备名称得到工位信息
+//                ReportInformationSheet reportInformationSheet=new ReportInformationSheet();
+//                reportInformationSheet.setCurrentStationStationPeople(stationInformation1.getPersonnelName());//工位人员姓名
+//                reportInformationSheet.setStationCode(stationInformation1.getStationCode());//工位码
+//                reportInformationSheet.setProcess(stationInformation1.getStationName());//工序名称
+//                reportInformationSheet.setProductCode(content[0]);//产品码
+//                reportInformationSheet.setHandheldDevice(content[1]);//手持机
+//                reportInformationSheet.setCreateTime(new DateTime());//创建时间
+//                //推算出来产品编号或者订单编号
+//                String modifiedString = "DQY" + content[0].substring(0, content[0].length() - 3);
+//                reportInformationSheet.setOrderNumber(modifiedString);//订单号或任务号
+//                //更新节点生产数量
+//                //先拿到当前任务数量
+//                List<ProductionPlanningManagement> productionPlanningManagements = productionPlanningManagementMapper.selectProductionPlanningManagementByOrderNumebrOrPlanNumber(modifiedString, modifiedString);
+//                if(productionPlanningManagements.size()<=0){
+//                    //插入异常报工信息
+//                    extracted(reportInformationSheet,"未找到当前产品计划报工失败--信息不匹配");
+//                    return "未找到当前产品计划报工失败--信息不匹配";
+//                }else {
+//                    boolean equals = productionPlanningManagements.get(0).getPlanType().equals("3");
+//                    if(equals){
+//                        //插入异常报工信息
+//                        extracted(reportInformationSheet,"该计划已经完成--信息不匹配");
+//                        return "该计划已经完成--信息不匹配";
+//                    }else {
+//                        //找到计划了先确认下数量(我计划下的数量)
+//                        ProductionPlanningManagement productionPlanningManagement = productionPlanningManagements.get(0);
+//                        //拿到计划id------->根据计划id查询流程信息
+//                        BpmExecuteProcess process=new BpmExecuteProcess();
+//                        process.setTaskPlanKey(productionPlanningManagement.getId().toString());//计划id
+//                        List<BpmExecuteProcess> bpmExecuteProcesses = bpmExecuteProcessMapper.selectBpmExecuteProcessListfjqy(process);
+//                        if(bpmExecuteProcesses.size()<=0){
+//                            //插入异常报工信息
+//                            extracted(reportInformationSheet,"没有找到当前计划的流程管道--信息不匹配");
+//                            return "没有找到当前计划的流程管道--信息不匹配";
+//                        }else {
+//                            //管道
+//                            String taskKey = bpmExecuteProcesses.get(0).getTaskKey();
+//                            BpmExecuteNodeLog bpmExecuteNodeLog=new BpmExecuteNodeLog();
+//                            bpmExecuteNodeLog.setTaskProcessKey(taskKey);//流程编号
+//                            bpmExecuteNodeLog.setTaskNodeName(stationInformation1.getStationName());//工序名称
+//                            List<BpmExecuteNodeLog> bpmExecuteNodeLogs = bpmExecuteNodeLogMapper.selectBpmExecuteNodeLogListfjqy(bpmExecuteNodeLog);
+//                            String taskNodeNumber = bpmExecuteNodeLogs.get(0).getTaskNodeNumber();//节点数量
+//                            //判断你当前报工工序节点是否已经报够数量了
+//                            if(taskNodeNumber==null||taskNodeNumber.equals("")){
+//                                taskNodeNumber="0";
+//                            }
+//                            if(Integer.parseInt(taskNodeNumber)>=Integer.parseInt(productionPlanningManagement.getQuantity())){
+//                                //插入异常报工信息
+//                                extracted(reportInformationSheet,"当前工序已完成计划数量");
+//                                return "当前工序已完成计划数量";
+//                            }else {
+//                                //否则更新接单已完成数量
+//                                int i = Math.addExact(Integer.parseInt(taskNodeNumber), 1);
+//                                BpmExecuteNodeLog upBpmExecuteNodeLog=new BpmExecuteNodeLog();
+//                                upBpmExecuteNodeLog.setTaskNodeNumber(String.valueOf(i));//更新数量
+//                                upBpmExecuteNodeLog.setId(bpmExecuteNodeLogs.get(0).getId());//节点日志id
+//                                //判断同一部手持机扫描时间间隔是否超过一分钟
+//                                ReportInformationSheet sheetsjjg=new ReportInformationSheet();
+//                                sheetsjjg.setProcess(stationInformation1.getStationName());//工序
+//                                sheetsjjg.setHandheldDevice(content[2]);//设备信息
+//                                ReportInformationSheet reportInformationSheetsSc = reportInformationSheetMapper.selectReportInformationSheetListOrderBy(sheetsjjg);
+//                                Date date1 = reportInformationSheetsSc.getCreateTime(); //上次扫码时间
+//                                Date date2 = new Date();//当前时间
+//                                String s = DateUtils.timeDistanceMin(date2, date1);
+//                                if(Integer.parseInt(s)<1){
+//                                    //插入异常报工信息
+//                                    extracted(reportInformationSheet,"两次扫码之间的间隔不能小于1分钟");//???? 看看那个小工人有这个坏心思
+//                                    return "两次扫码之间的间隔不能小于1分钟";
+//                                }
+//                                //工序--产品重复扫描
+//                                ReportInformationSheet reportInformationSheet1=new ReportInformationSheet();
+//                                reportInformationSheet1.setProcess(stationInformation1.getStationName());//工序名称
+//                                reportInformationSheet1.setProductCode(stationInformation1.getStationName());//产品码
+//                                List<ReportInformationSheet> reportInformationSheets = reportInformationSheetMapper.selectReportInformationSheetList(reportInformationSheet1);
+//                                if(reportInformationSheets.size()>0){
+//                                    //插入异常报工信息
+//                                    extracted(reportInformationSheet,"产品不能重复扫描");
+//                                    return "产品不能重复扫描";
+//                                }
+//
+//                                //当前产品只能被下一个工序进行扫描
+//                                //查询当前计划的所有工序信息
+//                                BpmExecuteNodeLog bpmExecuteNodeLogString=new BpmExecuteNodeLog();
+//                                bpmExecuteNodeLog.setTaskProcessKey(taskKey);//流程编号
+//                                List<BpmExecuteNodeLog> bpmExecuteNodeLogsString = bpmExecuteNodeLogMapper.selectBpmExecuteNodeLogListfjqy(bpmExecuteNodeLogString);
+//                                List<String> collect = bpmExecuteNodeLogsString.stream().map(BpmExecuteNodeLog::getTaskNodeName).collect(Collectors.toList());
+//                                //所有的集合我拿到了
+//                                ReportInformationSheet reportInformationSheet1String=new ReportInformationSheet();
+//                                reportInformationSheet1String.setProductCode(stationInformation1.getStationName());//产品码
+//                                List<ReportInformationSheet> reportInformationSheetsString = reportInformationSheetMapper.selectReportInformationSheetList(reportInformationSheet1String);
+//                                ReportInformationSheet reportInformationSheet2 = reportInformationSheetsString.get(0);
+//                                String process1 = reportInformationSheet2.getProcess();//这个产品编码上一次是那个工序扫的?
+//                                int nextIndex=0;
+//                                for (int i1 = 0; i1 < collect.size(); i1++) {
+//                                    //如果工序名称相同
+//                                    if(collect.get(i1).equals(process1)){
+//                                        nextIndex=i1+1;
+//                                    }
+//                                }
+//                                //说明已经在最后一个节点了,你前边的手持工序在怎么扫都扫不上的
+//                                if(nextIndex>=collect.size()){
+//                                    //插入异常报工信息
+//                                    extracted(reportInformationSheet,"请选择对应工序的手持机进行扫描");
+//                                    return "请选择对应工序的手持机进行扫描";
+//                                }else {
+//                                    if(!stationInformation1.getStationName().equals(collect.get(nextIndex))){
+//                                        //插入异常报工信息
+//                                        extracted(reportInformationSheet,"请选择当前产品对应的工序信息进行扫描");
+//                                        return "请选择当前产品对应的工序信息进行扫描";
+//                                    }
+//                                }
+//                                //当前工序有没有漏扫
+//                                int result = Math.subtractExact(Integer.parseInt(stationInformation1.getStationName()), 1);
+//                                reportInformationSheet1.setProductCode(String.valueOf(result));//产品码
+//                                List<ReportInformationSheet> reportInformationSheetsLS = reportInformationSheetMapper.selectReportInformationSheetList(reportInformationSheet1);
+//                                if(reportInformationSheetsLS.size()>0){
+//                                    //插入异常报工信息
+//                                    extracted(reportInformationSheet,"当前工序漏扫了一个产品信息--请核对信息");
+//                                    return "当前工序漏扫了一个产品信息--请核对信息";
+//                                }
+//                                //根据工位码查询 ---->节点报工日志
+//                                reportInformationSheetMapper.insertReportInformationSheet(reportInformationSheet);
+//                                int i1 = bpmExecuteNodeLogMapper.updateBpmExecuteNodeLogfjqy(upBpmExecuteNodeLog);
+//                                //更新当前工序节点信息
+//                                if(i1 >0){
+//                                    return "产品信息扫描成功";
+//                                }else {
+//                                    extracted(reportInformationSheet,"更新节点管道工序任务数量失败");
+//                                    return "扫码报工失败";
+//                                }
+//                            }
+//                        }
+//                    }
+//                }
+//            }else{
+//                return  "当前设备未绑定工位信息";
+//            }
+        }
+
+
+    /**
+     * 插入异常报工信息
+     * @param reportInformationSheet
+     * @param msg
+     */
+    private void extracted(ReportInformationSheet reportInformationSheet,String msg) {
+        ExceptionReportInformationSheet exceptionReportInformationSheet = new ExceptionReportInformationSheet();
+        BeanUtils.copyProperties(reportInformationSheet, exceptionReportInformationSheet);
+        exceptionReportInformationSheet.setExceptionMessage(msg);
+        exceptionReportInformationSheetMapper.insertExceptionReportInformationSheet(exceptionReportInformationSheet);
+    }
+
+}
+
+
+
+

+ 3 - 0
zkqy-fujian-amichi/src/main/resources/mapper/BpLeaveFactoryMapper.xml

@@ -39,6 +39,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectBpLeaveFactoryVo"/>
         where id = #{id}
     </select>
+    <select id="selectBpLeaveFactoryByIdMax" resultType="java.lang.Integer">
+       select  max(id) from fjqydb.bp_leave_factory
+    </select>
 
     <insert id="insertBpLeaveFactory" parameterType="com.zkqy.amichi.domain.BpLeaveFactory">
         insert into fjqydb.bp_leave_factory

+ 81 - 3
zkqy-fujian-amichi/src/main/resources/mapper/IndoorMaterialInformationMapper.xml

@@ -5,6 +5,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.zkqy.amichi.mapper.IndoorMaterialInformationMapper">
     
     <resultMap type="com.zkqy.amichi.domain.IndoorMaterialInformation" id="IndoorMaterialInformationResult">
+        <result property="id" column="id"></result>
         <result property="materialCode"    column="material_code"    />
         <result property="materialName"    column="material_name"    />
         <result property="model"    column="model"    />
@@ -12,10 +13,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="description"    column="description"    />
         <result property="unit"    column="unit"    />
         <result property="groupId"    column="group_id"    />
+        <result property="groupName"    column="group_name"    />
     </resultMap>
 
     <sql id="selectIndoorMaterialInformationVo">
-        select material_code, material_name, model, specification, description, unit, group_id from fjqydb.indoor_material_information
+        select material_code, material_name, model, specification, description, unit, group_id,group_name from fjqydb.indoor_material_information
     </sql>
 
     <select id="selectIndoorMaterialInformationList" parameterType="com.zkqy.amichi.domain.IndoorMaterialInformation" resultMap="IndoorMaterialInformationResult">
@@ -34,7 +36,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectIndoorMaterialInformationVo"/>
         where material_code = #{materialCode}
     </select>
-        
+
+    <select id="productClassification" resultType="java.util.Map">
+        select id as `value`,material_name as label from fjqydb.indoor_material_information
+        <where>
+            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
+            <if test="groupId != null "> and group_id = #{groupId}</if>
+        </where>
+        group by material_name
+    </select>
+    <select id="typeClassification" resultType="java.util.Map">
+        select id as `value`,model as label from fjqydb.indoor_material_information
+        <where>
+            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
+            <if test="groupId != null "> and group_id = #{groupId}</if>
+        </where>
+        group by model
+    </select>
+    <select id="specificationClassification" resultType="java.util.Map">
+        select id as `value`,specification as label from fjqydb.indoor_material_information
+        <where>
+            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
+            <if test="groupId != null "> and group_id = #{groupId}</if>
+        </where>
+        group by specification
+    </select>
+    <select id="queryMaterialCode" resultType="com.zkqy.amichi.domain.IndoorMaterialInformation">
+        <include refid="selectIndoorMaterialInformationVo"/>
+        <where>
+            <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="specification != null  and specification != ''"> and specification = #{specification}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
+            <if test="groupId != null "> and group_id = #{groupId}</if>
+        </where>
+    </select>
+
     <insert id="insertIndoorMaterialInformation" parameterType="com.zkqy.amichi.domain.IndoorMaterialInformation">
         insert into fjqydb.indoor_material_information
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -45,18 +95,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="description != null">description,</if>
             <if test="unit != null and unit != ''">unit,</if>
             <if test="groupId != null">group_id,</if>
+            <if test="groupName !=null">group_name</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="materialCode != null">#{materialCode},</if>
-            <if test="materialName != null and materialName != ''">#{materialName},</if>
             <if test="model != null">#{model},</if>
             <if test="specification != null">#{specification},</if>
             <if test="description != null">#{description},</if>
             <if test="unit != null and unit != ''">#{unit},</if>
             <if test="groupId != null">#{groupId},</if>
+            <if test="groupName !=null">#{groupName}</if>
          </trim>
     </insert>
 
+    <insert id="insertIndoorMaterialInformationBatch">
+        <foreach collection ="list" item="item" separator =";">
+            insert into fjqydb.indoor_material_information
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.materialCode != null">material_code,</if>
+                <if test="item.materialName != null and item.materialName != ''">material_name,</if>
+                <if test="item.model != null">model,</if>
+                <if test="item.specification != null">specification,</if>
+                <if test="item.description != null">description,</if>
+                <if test="item.unit != null and item.unit != ''">unit,</if>
+                <if test="item.groupId != null">group_id,</if>
+                <if test="item.groupName != null">group_name,</if>
+            </trim>
+            VALUES
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.materialCode != null">#{item.materialCode},</if>
+                <if test="item.materialName != null and item.materialName != ''">#{item.materialName},</if>
+                <if test="item.model != null">#{item.model},</if>
+                <if test="item.specification != null">#{item.specification},</if>
+                <if test="item.description != null">#{item.description},</if>
+                <if test="item.unit != null and item.unit != ''">#{item.unit},</if>
+                <if test="item.groupId != null">#{item.groupId},</if>
+                <if test="item.groupName != null">#{item.groupName},</if>
+            </trim>
+        </foreach>
+    </insert>
+
     <update id="updateIndoorMaterialInformation" parameterType="com.zkqy.amichi.domain.IndoorMaterialInformation">
         update fjqydb.indoor_material_information
         <trim prefix="SET" suffixOverrides=",">

+ 18 - 1
zkqy-fujian-amichi/src/main/resources/mapper/IndoorProductionGroupInformationMapper.xml

@@ -7,16 +7,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <resultMap type="com.zkqy.amichi.domain.IndoorProductionGroupInformation" id="IndoorProductionGroupInformationResult">
         <result property="id"    column="id"    />
         <result property="groupName"    column="group_name"    />
+        <result property="parentId"    column="parent_id"    />
     </resultMap>
 
     <sql id="selectIndoorProductionGroupInformationVo">
-        select `id`, `group_name` from fjqydb.indoor_production_group_information
+        select `id`, `group_name`,parent_id from fjqydb.indoor_production_group_information
     </sql>
 
     <select id="selectIndoorProductionGroupInformationList" parameterType="com.zkqy.amichi.domain.IndoorProductionGroupInformation" resultMap="IndoorProductionGroupInformationResult">
         <include refid="selectIndoorProductionGroupInformationVo"/>
         <where>  
             <if test="groupName != null  and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if>
+            <if test="parentId != null  and parentId != ''"> and parent_id = #{parentId}</if>
         </where>
     </select>
     
@@ -35,6 +37,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
          </trim>
     </insert>
 
+    <insert id="insertIndoorProductionGroupInformationBatch">
+        <foreach collection ="list" item="item" separator =";">
+            INSERT INTO  fjqydb.indoor_production_group_information
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.groupName != null and item.groupName != ''">group_name,</if>
+                <if test="item.parentId != null and item.parentId != ''">parent_id,</if>
+            </trim>
+            VALUES
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.groupName != null and item.groupName != ''">#{item.groupName},</if>
+                <if test="item.parentId != null and item.parentId != ''">#{item.parentId},</if>
+            </trim>
+        </foreach>
+    </insert>
+
     <update id="updateIndoorProductionGroupInformation" parameterType="com.zkqy.amichi.domain.IndoorProductionGroupInformation">
         update fjqydb.indoor_production_group_information
         <trim prefix="SET" suffixOverrides=",">

+ 3 - 0
zkqy-fujian-amichi/src/main/resources/mapper/JlIncomingInspectionMapper.xml

@@ -40,6 +40,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectJlIncomingInspectionVo"/>
         where id = #{id}
     </select>
+    <select id="selectJlIncomingInspectionByIdMax" resultType="java.lang.Integer">
+        select max(id) from fjqydb.jl_incoming_inspection
+    </select>
 
     <insert id="insertJlIncomingInspection" parameterType="com.zkqy.amichi.domain.JlIncomingInspection">
         insert into fjqydb.jl_incoming_inspection

+ 22 - 74
zkqy-fujian-amichi/src/main/resources/mapper/PlanTaskDetailsMapper.xml

@@ -5,18 +5,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 <mapper namespace="com.zkqy.amichi.mapper.PlanTaskDetailsMapper">
     <resultMap type="com.zkqy.amichi.domain.PlanTaskDetails" id="PlanTaskDetailsResult">
         <result property="id"    column="id"    />
-        <result property="taskId"    column="task_id"    />
-        <result property="model"    column="model"    />
-        <result property="nameplate"    column="nameplate"    />
-        <result property="capacity"    column="capacity"    />
-        <result property="interfaceDisk"    column="interface_disk"    />
-        <result property="lengthString"    column="length"    />
-        <result property="voltage"    column="voltage"    />
-        <result property="programme"    column="programme"    />
         <result property="quantity"    column="quantity"    />
-        <result property="sparea"    column="sparea"    />
-        <result property="spareb"    column="spareb"    />
-        <result property="sparec"    column="sparec"    />
+        <result property="documentType" column="document_type"/>
         <result property="remark"    column="remark"    />
         <result property="createById"    column="create_by_id"    />
         <result property="createBy"    column="create_by"    />
@@ -58,14 +48,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="planId"    column="plan_id"    />
         <result property="materialId"    column="material_id"    />
+        <result property="documentType" column="document_type"/>
         <result property="materialName"    column="material_name"    />
         <result property="modelNumber"    column="model_number"    />
         <result property="specification"    column="specification"    />
         <result property="materialUnit"    column="material_unit"    />
         <result property="quantity"    column="quantity"    />
-        <result property="sparea"    column="sparea"    />
-        <result property="spareb"    column="spareb"    />
-        <result property="sparec"    column="sparec"    />
         <result property="remark"    column="remark"    />
         <result property="createById"    column="create_by_id"    />
         <result property="createBy"    column="create_by"    />
@@ -92,7 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectPlanTaskDetailsVo">
-        select fid,fbomIdFnumber,ftreeEntity_fentryid,funitidfNumber,fbillno,fsrcbillno,id, task_id, model, nameplate, capacity, interface_disk, length, voltage, programme, quantity, sparea, spareb, sparec, remark,
+        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
@@ -102,18 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectPlanTaskDetailsList" parameterType="com.zkqy.amichi.domain.PlanTaskDetails" resultMap="PlanTaskDetailsResult">
         <include refid="selectPlanTaskDetailsVo"/>
         <where>
-            <if test="taskId != null  and taskId != ''"> and task_id = #{taskId}</if>
-            <if test="model != null  and model != ''"> and model = #{model}</if>
-            <if test="nameplate != null  and nameplate != ''"> and nameplate = #{nameplate}</if>
-            <if test="capacity != null  and capacity != ''"> and capacity = #{capacity}</if>
-            <if test="interfaceDisk != null  and interfaceDisk != ''"> and interface_disk = #{interfaceDisk}</if>
-            <if test="lengthString != null  and lengthString != ''"> and `length` = #{lengthString}</if>
-            <if test="voltage != null  and voltage != ''"> and voltage = #{voltage}</if>
-            <if test="programme != null  and programme != ''"> and programme = #{programme}</if>
             <if test="quantity != null  and quantity != ''"> and quantity = #{quantity}</if>
-            <if test="sparea != null  and sparea != ''"> and sparea = #{sparea}</if>
-            <if test="spareb != null  and spareb != ''"> and spareb = #{spareb}</if>
-            <if test="sparec != null  and sparec != ''"> and sparec = #{sparec}</if>
             <if test="createById != null "> and create_by_id = #{createById}</if>
             <if test="updateById != null "> and update_by_id = #{updateById}</if>
             <if test="dataApprovalStatus != null  and dataApprovalStatus != ''"> and data_approval_status = #{dataApprovalStatus}</if>
@@ -149,18 +126,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <insert id="insertPlanTaskDetails" parameterType="com.zkqy.amichi.domain.PlanTaskDetails" useGeneratedKeys="true" keyProperty="id">
         insert into fjqydb.plan_task_details
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="taskId != null">task_id,</if>
-            <if test="model != null">model,</if>
-            <if test="nameplate != null">nameplate,</if>
-            <if test="capacity != null">capacity,</if>
-            <if test="interfaceDisk != null">interface_disk,</if>
-            <if test="lengthString != null">`length`,</if>
-            <if test="voltage != null">voltage,</if>
-            <if test="programme != null">programme,</if>
             <if test="quantity != null">quantity,</if>
-            <if test="sparea != null">sparea,</if>
-            <if test="spareb != null">spareb,</if>
-            <if test="sparec != null">sparec,</if>
+            <if test="documentType != null">document_type,</if>
             <if test="remark != null">remark,</if>
             <if test="createById != null">create_by_id,</if>
             <if test="createBy != null">create_by,</if>
@@ -201,18 +168,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="fbomIdFnumber != null  and fbomIdFnumber != ''">fbomIdFnumber,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="taskId != null">#{taskId},</if>
-            <if test="model != null">#{model},</if>
-            <if test="nameplate != null">#{nameplate},</if>
-            <if test="capacity != null">#{capacity},</if>
-            <if test="interfaceDisk != null">#{interfaceDisk},</if>
-            <if test="lengthString != null">#{lengthString},</if>
-            <if test="voltage != null">#{voltage},</if>
-            <if test="programme != null">#{programme},</if>
+
             <if test="quantity != null">#{quantity},</if>
-            <if test="sparea != null">#{sparea},</if>
-            <if test="spareb != null">#{spareb},</if>
-            <if test="sparec != null">#{sparec},</if>
+            <if test="documentType != null">#{documentType},</if>
             <if test="remark != null">#{remark},</if>
             <if test="createById != null">#{createById},</if>
             <if test="createBy != null">#{createBy},</if>
@@ -257,18 +215,9 @@ 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="taskId != null">task_id = #{taskId},</if>
-            <if test="model != null">model = #{model},</if>
-            <if test="nameplate != null">nameplate = #{nameplate},</if>
-            <if test="capacity != null">capacity = #{capacity},</if>
-            <if test="interfaceDisk != null">interface_disk = #{interfaceDisk},</if>
-            <if test="lengthString != null">`length` = #{lengthString},</if>
-            <if test="voltage != null">voltage = #{voltage},</if>
-            <if test="programme != null">programme = #{programme},</if>
+
             <if test="quantity != null">quantity = #{quantity},</if>
-            <if test="sparea != null">sparea = #{sparea},</if>
-            <if test="spareb != null">spareb = #{spareb},</if>
-            <if test="sparec != null">sparec = #{sparec},</if>
+            <if test="documentType != null">document_type = #{documentType},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="createById != null">create_by_id = #{createById},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
@@ -305,18 +254,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updatePlanTaskDetails" parameterType="com.zkqy.amichi.domain.PlanTaskDetails">
         update {DBNAME}.plan_task_details
         <trim prefix="SET" suffixOverrides=",">
-            <if test="taskId != null">task_id = #{taskId},</if>
-            <if test="model != null">model = #{model},</if>
-            <if test="nameplate != null">nameplate = #{nameplate},</if>
-            <if test="capacity != null">capacity = #{capacity},</if>
-            <if test="interfaceDisk != null">interface_disk = #{interfaceDisk},</if>
-            <if test="lengthString != null">`length` = #{lengthString},</if>
-            <if test="voltage != null">voltage = #{voltage},</if>
-            <if test="programme != null">programme = #{programme},</if>
+
             <if test="quantity != null">quantity = #{quantity},</if>
-            <if test="sparea != null">sparea = #{sparea},</if>
-            <if test="spareb != null">spareb = #{spareb},</if>
-            <if test="sparec != null">sparec = #{sparec},</if>
+            <if test="documentType != null">document_type = #{documentType},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="createById != null">create_by_id = #{createById},</if>
             <if test="createBy != null">create_by = #{createBy},</if>
@@ -361,8 +301,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
+    <delete id="deletePlanTaskDetailsByDemandDocument" parameterType="String">
+        delete from {DBNAME}.plan_task_details where demand_document in
+        <foreach item="id" collection="list" open="(" separator="," close=")">
+            #{demandDocument}
+        </foreach>
+    </delete>
+
     <select id="selectPlanTaskDetailsListInPlanId" parameterType="String" resultMap="PlanTaskDetailsResultVo">
-        select ptd.id,ptd.material_id,ptd.material_name,ptd.model_number,ptd.specification,ptd.material_unit, ptd.quantity, ptd.sparea, ptd.spareb, ptd.sparec, ptd.remark,
+        select ptd.id,ptd.document_type,ptd.material_id,ptd.material_name,ptd.model_number,ptd.specification,ptd.material_unit, ptd.quantity,  ptd.remark,
         ptd.create_by_id, ptd.create_by, ptd.create_time, ptd.update_by_id, ptd.update_by, ptd.update_time, ptd.del_flag, ptd.data_approval_status, ptd.process_key,
         ptd.task_process_key, ptd.task_node_key, ptd.plan_id,ptd.demand_document,ppm.order_number from fjqydb.plan_task_details as ptd
         left join fjqydb.production_planning_management ppm
@@ -375,15 +322,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectPlanTaskDetailsListByOrderNumber" parameterType="String" resultMap="PlanTaskDetailsResultVo">
         select ptd.id,
+               ptd.document_type,
                ptd.material_id,
                ptd.material_name,
                ptd.model_number,
                ptd.specification,
                ptd.material_unit,
                FORMAT(ptd.quantity,2) as quantity,
-               ptd.sparea,
-               ptd.spareb,
-               ptd.sparec,
                ptd.remark,
         ptd.create_by_id,
         ptd.create_by,
@@ -428,6 +373,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="specialRequirements"    column="special_requirements"/>
         <result property="remark"    column="remark"/>
         <result property="xqrq"    column="time_of_request"/>
+        <result property="documentType"    column="document_type"/>
     </resultMap>
 
     <select id="selectPlanTaskDetailsListAndFlowCardData" parameterType="String" resultMap="PlanTaskDetailsListAndFlowCardDataVoRp">
@@ -437,6 +383,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             ptd.material_id,
             mbi.model,
             ptd.power,
+            ptd.document_type,
             ptd.colour,
             ptd.mingpai,
             ptd.baozhuangxiang,
@@ -468,5 +415,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <foreach item="orderNumber" collection="list" open="(" separator="," close=")">
             #{orderNumber}
         </foreach>
+        order by pcf.serial_number
     </select>
 </mapper>

+ 17 - 0
zkqy-fujian-amichi/src/main/resources/mapper/ProcedureListMapper.xml

@@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="id"    column="id"    />
         <result property="procedureNumber"    column="procedure_number"    />
         <result property="procedurName"    column="procedur_name"    />
+        <result property="elpname" column="elpname"></result>
         <result property="remarks"    column="remarks"    />
         <result property="createById"    column="create_by_id"    />
         <result property="createBy"    column="create_by"    />
@@ -50,12 +51,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         pl.procedur_name
         order by   pl.sort
     </select>
+    <select id="selectProcedureListMap"  resultMap="ProcedureListResult">
+        SELECT
+        pl.procedur_name,
+        ple.procedur_name as elpname
+        FROM
+        fjqydb.procedure_list AS pl
+        LEFT JOIN fjqydb.procedure_list_erp AS ple ON ple.erp_job_name = pl.id
+        <where>
+            <if test="procedureNumber != null  and procedureNumber != ''"> and pl.procedure_number = #{procedureNumber}</if>
+            <if test="procedurName != null  and procedurName != ''"> and  pl.procedur_name like concat('%', #{procedurName}, '%')</if>
+            <if test="remarks != null  and remarks != ''"> and  pl.remarks = #{remarks}</if>
+            <if test="createById != null "> and  pl.create_by_id = #{createById}</if>
+            <if test="updateById != null "> and  pl.update_by_id = #{updateById}</if>
+        </where>
+    </select>
     
     <select id="selectProcedureListById" parameterType="Long" resultMap="ProcedureListResult">
         <include refid="selectProcedureListVo"/>
         where id = #{id}
     </select>
 
+
     <insert id="insertProcedureList" parameterType="com.zkqy.amichi.domain.ProcedureList" useGeneratedKeys="true" keyProperty="id">
         insert into fjqydb.procedure_list
         <trim prefix="(" suffix=")" suffixOverrides=",">

+ 9 - 0
zkqy-fujian-amichi/src/main/resources/mapper/ProductionCardFlowMapper.xml

@@ -118,6 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="item.demandDocumentNumber != null and item.demandDocumentNumber != ''">demand_document_number,</if>
                 <if test="item.printQuantity != null and item.printQuantity != ''">print_quantity,</if>
                 <if test="item.remark != null">remark,</if>
+                <if test="item.createTime != null">create_time,</if>
             </trim>
             VALUES
             <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -126,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 <if test="item.demandDocumentNumber != null and item.demandDocumentNumber != ''">#{item.demandDocumentNumber},</if>
                 <if test="item.printQuantity != null and item.printQuantity != ''">#{item.printQuantity},</if>
                 <if test="item.remark != null">#{item.remark},</if>
+                <if test="item.createTime != null">#{item.createTime},</if>
             </trim>
         </foreach>
     </insert>
@@ -164,4 +166,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <delete id="deleteProductionCardFlowByDemandDocumentNumber">
+        delete from {DBNAME}.production_card_flow where demand_document_number in
+        <foreach item="id" collection="list" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
 </mapper>

+ 73 - 0
zkqy-fujian-amichi/src/main/resources/mapper/ProductionReportingRecordMapper.xml

@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zkqy.amichi.mapper.ProductionReportingRecordMapper">
+    
+    <resultMap type="com.zkqy.amichi.domain.ProductionReportingRecord" id="ProductionReportingRecordResult">
+        <result property="id"    column="id"    />
+        <result property="number"    column="number"    />
+        <result property="xlh"    column="xlh"    />
+        <result property="type"    column="type"    />
+        <result property="xlhArray"    column="xlhArray"    />
+    </resultMap>
+
+    <sql id="selectProductionReportingRecordVo">
+        select id, number, xlh, type, xlhArray from fjqydb.production_reporting_record
+    </sql>
+
+    <select id="selectProductionReportingRecordList" parameterType="com.zkqy.amichi.domain.ProductionReportingRecord" resultMap="ProductionReportingRecordResult">
+        <include refid="selectProductionReportingRecordVo"/>
+        <where>  
+            <if test="number != null  and number != ''"> and number = #{number}</if>
+            <if test="xlh != null  and xlh != ''"> and xlh = #{xlh}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="xlhArray != null  and xlhArray != ''"> and xlhArray = #{xlhArray}</if>
+        </where>
+    </select>
+    
+    <select id="selectProductionReportingRecordById" parameterType="Long" resultMap="ProductionReportingRecordResult">
+        <include refid="selectProductionReportingRecordVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertProductionReportingRecord" parameterType="com.zkqy.amichi.domain.ProductionReportingRecord">
+        insert into  fjqydb.production_reporting_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="number != null">number,</if>
+            <if test="xlh != null">xlh,</if>
+            <if test="type != null">type,</if>
+            <if test="xlhArray != null">xlhArray,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="number != null">#{number},</if>
+            <if test="xlh != null">#{xlh},</if>
+            <if test="type != null">#{type},</if>
+            <if test="xlhArray != null">#{xlhArray},</if>
+         </trim>
+    </insert>
+
+    <update id="updateProductionReportingRecord" parameterType="com.zkqy.amichi.domain.ProductionReportingRecord">
+        update  fjqydb.production_reporting_record
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="number != null">number = #{number},</if>
+            <if test="xlh != null">xlh = #{xlh},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="xlhArray != null">xlhArray = #{xlhArray},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteProductionReportingRecordById" parameterType="Long">
+        delete from  fjqydb.production_reporting_record where id = #{id}
+    </delete>
+
+    <delete id="deleteProductionReportingRecordByIds" parameterType="String">
+        delete from  fjqydb.production_reporting_record where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 34 - 0
zkqy-fujian-amichi/src/main/resources/mapper/QualityinspectioninformationMapper.xml

@@ -64,6 +64,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectQualityinspectioninformationVo"/>
         where id = #{id}
     </select>
+    <select id="selectQualityinspectioninformationListMax" resultType="java.lang.Integer">
+        select max(id) from fjqydb.qualityinspectioninformation
+        <where>
+        <if test="manufacturingProcess != null  and manufacturingProcess != '' and manufacturingProcess != '全部'"> and manufacturing_process = #{manufacturingProcess}</if>
+        </where>
+    </select>
+
+    <select id="selectQualityinspectioninformation"
+            resultType="com.zkqy.amichi.domain.Qualityinspectioninformation">
+        <include refid="selectQualityinspectioninformationVo"/>
+        <where>
+            <if test="id != null  and id != ''"> and id = #{id}</if>
+            <if test="manufacturingProcess != null  and manufacturingProcess != '' and manufacturingProcess != '全部'"> and manufacturing_process = #{manufacturingProcess}</if>
+            <if test="reportName != null  and reportName != ''"> and report_name like concat('%', #{reportName}, '%')</if>
+            <if test="reportDate != null  and reportDate != ''"> and report_date = #{reportDate}</if>
+            <if test="inspector != null  and inspector != ''"> and inspector = #{inspector}</if>
+            <if test="examine != null  and examine != ''"> and examine = #{examine}</if>
+            <if test="examineDate != null  and examineDate != ''"> and examine_date = #{examineDate}</if>
+            <if test="inspectorDate != null  and inspectorDate != ''"> and inspector_date = #{inspectorDate}</if>
+            <if test="type != null  and type != ''"> and type = #{type}</if>
+            <if test="jlOneFailedBatch != null  and jlOneFailedBatch != ''"> and jl_one_failed_batch = #{jlOneFailedBatch}</if>
+            <if test="jlTotalBatchForInspection != null  and jlTotalBatchForInspection != ''"> and jl_total_batch_for_inspection = #{jlTotalBatchForInspection}</if>
+            <if test="jlQuantityOfRejectsReturns != null  and jlQuantityOfRejectsReturns != ''"> and jl_quantity_of_rejects_returns = #{jlQuantityOfRejectsReturns}</if>
+            <if test="jlQualifiedRateOfTheMonth != null  and jlQualifiedRateOfTheMonth != ''"> and jl_qualified_rate_of_the_month = #{jlQualifiedRateOfTheMonth}</if>
+            <if test="bpNumberOfFailures != null  and bpNumberOfFailures != ''"> and bp_number_of_failures = #{bpNumberOfFailures}</if>
+            <if test="bpScrapQuantity != null  and bpScrapQuantity != ''"> and bp_scrap_quantity = #{bpScrapQuantity}</if>
+            <if test="bpTotalForTheMonth != null  and bpTotalForTheMonth != ''"> and bp_total_for_the_month = #{bpTotalForTheMonth}</if>
+            <if test="bpPassRateThisMonth != null  and bpPassRateThisMonth != ''"> and bp_pass_rate_this_month = #{bpPassRateThisMonth}</if>
+            <if test="ccNumberOfFailures != null  and ccNumberOfFailures != ''"> and cc_number_of_failures = #{ccNumberOfFailures}</if>
+            <if test="ccScrapQuantity != null  and ccScrapQuantity != ''"> and cc_scrap_quantity = #{ccScrapQuantity}</if>
+            <if test="ccTotalForTheMonth != null  and ccTotalForTheMonth != ''"> and cc_total_for_the_month = #{ccTotalForTheMonth}</if>
+            <if test="ccPassRateThisMonth != null  and ccPassRateThisMonth != ''"> and cc_pass_rate_this_month = #{ccPassRateThisMonth}</if>
+        </where>
+    </select>
 
     <insert id="insertQualityinspectioninformation" parameterType="Qualityinspectioninformation" keyProperty="id" useGeneratedKeys="true">
         insert into fjqydb.qualityinspectioninformation

+ 77 - 8
zkqy-fujian-amichi/src/main/resources/mapper/RingScanInformationMapper.xml

@@ -27,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         fjqydb.ring_scan_information
         <where>
             <if test="deviceNumber != null  and deviceNumber != ''"> and device_number = #{deviceNumber}</if>
-            and DATE(scanning_time) = CURDATE() order by scanning_time desc limit #{offset},#{pageSize}
+            order by scanning_time desc limit #{offset},#{pageSize}
         </where>
     </select>
     <select id="selectRingScanInformationListScfyCount" resultType="java.lang.Integer" parameterType="com.zkqy.amichi.domain.RingScanInformation">
@@ -268,10 +268,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         sub.sort,
         rsif.start_time desc
     </select>
-
-
-    <select id="selectRingScanInformationLog2" resultType="com.zkqy.amichi.domain.vo.RingScanInformationLogVo">
-        SELECT
+<!--
+SELECT
         count(sub.count) as `count`,
         sub.process_name,
         sub.order_number,
@@ -298,8 +296,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         FROM
         fjqydb.ring_scan_information AS rsi
         LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
-        WHERE
-        rsi.execution_mark = '1'
+        <where>
+            <if test="list != null and list.size()>0">
+                rsi.production_order_number  in
+                <foreach item="id" collection="list" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+            <if test="list == null or list.size() == 0">
+                rsi.production_order_number = 'X'
+            </if>
+            and  rsi.execution_mark = '1'
+        </where>
         GROUP BY
         rsi.production_order_number,rsi.process_name,rsi.native_numbering
         ) AS sub
@@ -321,6 +329,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             sub.process_name
         ORDER BY
         rsif.start_time desc,sub.sort
+-->
+
+    <select id="selectRingScanInformationLog2" resultType="com.zkqy.amichi.domain.vo.RingScanInformationLogVo">
+        SELECT
+            sub.process_name,
+            sub.order_number,
+            sub.scanning_time,
+            sub.production_order_number,
+            sub.sort,
+            sub.`status`,
+            sub.start_time,
+            sub.end_time,
+            sub.total_quantity,
+            sub.production_order_total_quantity,
+            sub.modelNumber AS modelNumber,
+            sub.specification AS specification,
+            COUNT(sub.process_name)  as `count`
+        FROM
+            (
+                SELECT
+                    rsi.process_name,
+                    rsi.native_numbering,
+                    rsi.order_number,
+                    rsi.production_order_number,
+                    MAX( rsi.scanning_time ) AS scanning_time,
+                    pl.sort,
+                    rsif.`status`,
+                    rsif.start_time,
+                    rsif.end_time,
+                    rsif.total_quantity,
+                    rsif.production_order_total_quantity,
+                    ptd.model_number AS modelNumber,
+                    ptd.specification AS specification
+                FROM
+                    fjqydb.ring_scan_information AS rsi
+                        LEFT JOIN fjqydb.procedure_list AS pl ON pl.procedur_name = rsi.process_name
+                        LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON ( rsi.production_order_number = rsif.production_order_number )
+                        LEFT JOIN fjqydb.plan_task_details AS ptd ON ptd.demand_document = rsi.production_order_number
+                <where>
+                    <if test="list != null and list.size()>0">
+                        rsif.production_order_number IN
+                        <foreach item="id" collection="list" open="(" separator="," close=")">
+                            #{id}
+                        </foreach>
+                    </if>
+                    <if test="list == null or list.size() == 0">
+                        rsi.production_order_number = 'X'
+                    </if>
+                     and  rsi.execution_mark = '1'
+                </where>
+                GROUP BY
+                    rsi.production_order_number,
+                    rsi.process_name,
+                    rsi.native_numbering
+            ) AS sub
+        GROUP BY
+            sub.production_order_number,
+            sub.process_name
+        ORDER BY
+            sub.start_time DESC,
+            sub.sort
     </select>
 
     <select id="selectScanStatistics" resultType="com.zkqy.amichi.domain.vo.ScanStatistics" parameterType="com.zkqy.amichi.domain.RingScanInformation">
@@ -399,7 +468,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 LEFT JOIN fjqydb.ring_scan_information_first AS rsif ON rsi.production_order_number = rsif.production_order_number
                 left join fjqydb.plan_task_details as ptd on rsi.production_order_number=ptd.demand_document
         where DATE(rsi.scanning_time) = CURDATE() and
-            rsi.execution_message !='失败-未同步ERP'
+            rsi.execution_message !='失败-未同步ERP' and  rsi.execution_message !='未绑定-人员-扫描失败'
         GROUP BY
             rsi.order_number,
             rsi.personnel_name,

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

@@ -73,6 +73,7 @@
         "FSrcBillType": "PRD_MORPT",
         "FSrcInterId": 101306,
         "FSrcBillNo": "SCHB00001092",
+        "FReqBillNo": "NQY250342",
         "FBasePrdRealQty": 1.0,
         "FIsFinished": false,
         "FStockStatusId": {

+ 2 - 2
zkqy-ui/.env.production

@@ -9,9 +9,9 @@ VUE_APP_BASE_API = '/prod-api'
 
 # 生产环境
 # VUE_APP_BASE_API1 = 'http://62.234.61.92:8055/'
- #VUE_APP_BASE_API1 = 'http://192.168.2.135:8066/'
+VUE_APP_BASE_API1 = 'http://192.168.2.135:8066/'
 #VUE_APP_BASE_API1 = 'http://192.168.3.17:8066/'
-VUE_APP_BASE_API1 = 'http://192.168.110.83:8066/'
+#VUE_APP_BASE_API1 = 'http://192.168.110.83:8066/'
 #VUE_APP_BASE_API1 = 'http://175.27.169.173:8066/'
 
 

+ 44 - 0
zkqy-ui/src/api/amichi/indoorMaterialInformation/information.js

@@ -9,6 +9,50 @@ export function listInformation(query) {
   })
 }
 
+
+export function productClassification(query) {
+  return request({
+    url: '/indoorMaterialInformation/information/productClassification',
+    method: 'get',
+    params: query
+  })
+}
+
+export function typeClassification(query) {
+  return request({
+    url: '/indoorMaterialInformation/information/typeClassification',
+    method: 'get',
+    params: query
+  })
+}
+
+
+export function specificationClassification(query) {
+  return request({
+    url: '/indoorMaterialInformation/information/specificationClassification',
+    method: 'get',
+    params: query
+  })
+}
+
+
+export function queryMaterialCode(query) {
+  return request({
+    url: '/indoorMaterialInformation/information/queryMaterialCode',
+    method: 'get',
+    params: query
+  })
+}
+
+
+export function treeList(query) {
+  return request({
+    url: "/indoorProductionGroupInfo/information/treeList/"+query.id,
+    method: 'get',
+  })
+}
+
+
 // 查询场内计划信息详细
 export function getInformation(materialCode) {
   return request({

+ 10 - 2
zkqy-ui/src/api/amichi/qualityinspectioninformation/qualityinspectioninformation.js

@@ -12,8 +12,16 @@ export function listQualityinspectioninformation(query) {
 // 查询质检信息详细
 export function getQualityinspectioninformation(id) {
   return request({
-    url: '/qualityinspectioninformation/qualityinspectioninformation/' + id,
-    method: 'get'
+    url: '/qualityinspectioninformation/qualityinspectioninformation/'+id,
+    method: 'get',
+  })
+}
+
+export function getQualityinspectioninformationOne(query) {
+  return request({
+    url: '/qualityinspectioninformation/qualityinspectioninformation/list/getOne',
+    method: 'get',
+    params: query
   })
 }
 

+ 2 - 1
zkqy-ui/src/permission.js

@@ -8,7 +8,8 @@ import {isRelogin} from '@/utils/request'
 
 NProgress.configure({showSpinner: false})
 
-const whiteList = ['/login', '/register', '/404', '/401','/redirectAuth',"/pageTransferPage","/amichi/dialogCompments/customizedVersion/processDisplay"]
+const whiteList = ['/login', '/register', '/404', '/401','/redirectAuth',"/pageTransferPage","/amichi/dialogCompments/customizedVersion/processDisplay",
+  "/amichi/bp", "/amichi/ch","/amichi/jl"]
 
 router.beforeEach((to, from, next) => {
   NProgress.start()

+ 21 - 0
zkqy-ui/src/router/index.js

@@ -115,6 +115,27 @@ export const constantRoutes = [
     },
     hidden: true,
   },
+  {
+    path: '/amichi/jl',
+    component: () => {
+      return import('@/views/amichi/qualityinspectioninformation/jl_inspection/QualityStatement.vue')
+    },
+    hidden: true,
+  },
+  {
+    path: '/amichi/bp',
+    component: () => {
+      return import('@/views/amichi/qualityinspectioninformation/bp_inspection/QualityStatement.vue')
+    },
+    hidden: true,
+  },
+  {
+    path: '/amichi/ch',
+    component: () => {
+      return import('@/views/amichi/qualityinspectioninformation/bp_leavefactory/QualityStatement')
+    },
+    hidden: true,
+  },
   {
     path: '/amichi/print/FlowCardPrint',
     component: () => {

+ 2 - 1
zkqy-ui/src/views/amichi/dialogCompments/customizedVersion/components/taskListTotal.vue

@@ -55,7 +55,7 @@ import TaskItemTotal from "./TaskItemTotal.vue";
 import {scanCodeMonitoringLogs3} from "@/api/amichi/ringScanInformation";
 export default {
   name: "TaskListTotal",
-  props: ["cardData", "orderNumber"],
+  props: ["cardData", "orderNumber","status"],
   components: { TaskItemTotal,TaskList },
   data() {
     return {
@@ -100,6 +100,7 @@ export default {
     getNrInfo(orderNumber){
       this.nrLoading=true;
       this.queryParams.orderNumber = orderNumber;
+      this.queryParams.status=this.status;
       scanCodeMonitoringLogs3({ ...this.queryParams})
         .then(
           res => {

+ 1 - 1
zkqy-ui/src/views/amichi/dialogCompments/customizedVersion/processDisplay4.vue

@@ -36,7 +36,7 @@
       <!--主体内容部分-->
       <div class="show-body" v-loading="loading">
         <template v-if="total > 0">
-          <TaskListTotal v-for="(value, key,index) of tableData" :key="index + 1" :orderNumber="key"  :cardData="value"></TaskListTotal>
+          <TaskListTotal v-for="(value, key,index) of tableData" :key="index + 1" :orderNumber="key"  :cardData="value" :status="queryParams.status"></TaskListTotal>
         </template>
         <el-empty v-else description="暂无数据"></el-empty>
         <!--分页列表-->

+ 220 - 26
zkqy-ui/src/views/amichi/planTask/inPlanPage/indoorMaterialInformation/index.vue

@@ -2,7 +2,28 @@
   <div class="app-container">
 
       <div  class="left-container">
-          1
+<!--          <div class="left-container-top">-->
+<!--            <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">-->
+<!--              <el-form-item label="组名称:" prop="groupId">-->
+<!--                <el-input-->
+<!--                  v-model="queryParams.groupId"-->
+<!--                  placeholder="请输入组名称:"-->
+<!--                  clearable-->
+<!--                  @keyup.enter.native="handleQuery"-->
+<!--                />-->
+<!--              </el-form-item>-->
+<!--              <el-form-item>-->
+<!--                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>-->
+<!--              </el-form-item>-->
+<!--            </el-form>-->
+<!--          </div>-->
+<!--          <div class="left-container-bottom">-->
+<!--            <el-tree :data="data" :props="defaultProps" v-loading="treeLoading"  @node-click="handleNodeClick">-->
+<!--                     <span class="custom-tree-node"  slot-scope="{ node, data }">-->
+<!--                     <span>{{ node.label }}</span>-->
+<!--                </span>-->
+<!--            </el-tree>-->
+<!--          </div>-->
       </div>
       <div class="right-container">
         <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="88px">
@@ -95,6 +116,16 @@
               v-hasPermi="['indoorMaterialInformation:information:export']"
             >导出</el-button>
           </el-col>
+          <el-col :span="1.5">
+            <el-button
+              type="warning"
+              plain
+              icon="el-icon-download"
+              size="mini"
+              @click="handleImport"
+              v-hasPermi="['indoorMaterialInformation:information:import']"
+            >导入</el-button>
+          </el-col>
           <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
         </el-row>
 
@@ -106,23 +137,18 @@
           <el-table-column label="规格型号" align="center" prop="specification" />
           <el-table-column label="描述" align="center" prop="description" />
           <el-table-column label="单位" align="center" prop="unit" />
-          <el-table-column label="组ID" align="center" prop="groupId" />
+          <el-table-column label="BOM分组" align="center" prop="groupName" />
           <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
             <template slot-scope="scope">
-              <el-button
-                size="mini"
-                type="text"
-                icon="el-icon-edit"
-                @click="handleUpdate(scope.row)"
-                v-hasPermi="['indoorMaterialInformation:information:edit']"
-              >修改</el-button>
-              <el-button
-                size="mini"
-                type="text"
-                icon="el-icon-delete"
-                @click="handleDelete(scope.row)"
-                v-hasPermi="['indoorMaterialInformation:information:remove']"
-              >删除</el-button>
+              <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
+                <el-button type="warning">
+                  操作<i class="el-icon-arrow-down el-icon--right"></i>
+                </el-button>
+                <el-dropdown-menu slot="dropdown">
+                  <el-dropdown-item  icon="el-icon-edit"  command="handleUpdate">修改</el-dropdown-item>
+                  <el-dropdown-item  icon="el-icon-delete" command="handleDelete">删除</el-dropdown-item>
+                </el-dropdown-menu>
+              </el-dropdown>
             </template>
           </el-table-column>
         </el-table>
@@ -136,8 +162,8 @@
         />
 
         <!-- 添加或修改场内计划信息对话框 -->
-        <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
-          <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
+          <el-form ref="form" :model="form" :rules="rules" label-width="110px">
             <el-form-item label="物料名称:" prop="materialName">
               <el-input v-model="form.materialName" placeholder="请输入物料名称" />
             </el-form-item>
@@ -153,8 +179,8 @@
             <el-form-item label="单位:" prop="unit">
               <el-input v-model="form.unit" placeholder="请输入单位" />
             </el-form-item>
-            <el-form-item label="组ID:" prop="groupId">
-              <el-input v-model="form.groupId" placeholder="请输入组ID" />
+            <el-form-item label="BOM分组:" prop="groupId">
+              <el-input v-model="form.groupName" placeholder="请输入组ID" />
             </el-form-item>
           </el-form>
           <div slot="footer" class="dialog-footer">
@@ -164,16 +190,94 @@
         </el-dialog>
       </div>
 
+    <!-- 质检导入对话框 -->
+    <el-dialog
+      :title="upload.title"
+      :visible.sync="upload.open"
+      width="400px"
+      append-to-body
+    >
+      <el-upload
+        ref="upload"
+        :limit="1"
+        accept=".xlsx, .xls"
+        :headers="upload.headers"
+        :action="upload.url + '?updateSupport=' + upload.updateSupport"
+        :disabled="upload.isUploading"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
+        <div class="el-upload__tip text-center" slot="tip">
+          <span>仅允许导入xls、xlsx格式文件。</span>
+          <!--          <el-link-->
+          <!--            type="primary"-->
+          <!--            :underline="false"-->
+          <!--            style="font-size: 12px; vertical-align: baseline"-->
+          <!--            @click="importTemplate"-->
+          <!--          >下载模板-->
+          <!--          </el-link>-->
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">确 定</el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import { listInformation, getInformation, delInformation, addInformation, updateInformation } from "@/api/amichi/indoorMaterialInformation/information";
+import { listInformation, getInformation, delInformation, addInformation, updateInformation,treeList } from "@/api/amichi/indoorMaterialInformation/information";
+import {getToken} from "@/utils/auth";
+import {delWorkmanship, getWorkmanship} from "@/api/amichi/workmanship/workmanship";
 
 export default {
   name: "Information",
   data() {
     return {
+      data: [{
+        label: '一级 1',
+        children: [{
+          label: '二级 1-1',
+          children: [{
+            label: '三级 1-1-1'
+          }]
+        }]
+      }, {
+        label: '一级 2',
+        children: [{
+          label: '二级 2-1',
+          children: [{
+            label: '三级 2-1-1'
+          }]
+        }, {
+          label: '二级 2-2',
+          children: [{
+            label: '三级 2-2-1'
+          }]
+        }]
+      }, {
+        label: '一级 3',
+        children: [{
+          label: '二级 3-1',
+          children: [{
+            label: '三级 3-1-1'
+          }]
+        }, {
+          label: '二级 3-2',
+          children: [{
+            label: '三级 3-2-1'
+          }]
+        }]
+      }],
+      defaultProps: {
+        children: 'children',
+        label: 'label'
+      },
       // 遮罩层
       loading: true,
       // 选中数组
@@ -192,6 +296,7 @@ export default {
       title: "",
       // 是否显示弹出层
       open: false,
+      treeLoading:false,
       // 查询参数
       queryParams: {
         pageNum: 1,
@@ -203,6 +308,21 @@ export default {
         unit: null,
         groupId: null
       },
+      // 质检导入参数
+      upload: {
+        // 是否显示弹出层(质检导入)
+        open: false,
+        // 弹出层标题(质检导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: { Authorization: "Bearer " + getToken() },
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/indoorProductionGroupInfo/information/importData",
+      },
       // 表单参数
       form: {},
       // 表单校验
@@ -221,8 +341,56 @@ export default {
   },
   created() {
     this.getList();
+    this.treeList();
   },
   methods: {
+    //修改工艺信息编辑按钮
+    updateTechnology(node, data) {
+      console.log("ddd")
+    },
+    //删除工艺信息
+    deleteTechnology(node,data){
+      console.log("删除")
+    },
+    //下拉菜单点击事件
+    handleCommand(command, row) {
+      switch (command) {
+        case "handleUpdate":
+          this.handleUpdate(row)
+          break;
+        case "handleDelete":
+          this.handleDelete(row)
+          break;
+        default:
+          break;
+      }
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+      this.treeList();
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.$alert(
+        "<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" +
+        response.msg +
+        "</div>",
+        "导入结果",
+        { dangerouslyUseHTMLString: true }
+      );
+      this.getList();
+    },
+    handleNodeClick(){
+      console.log("");
+    },
     /** 查询场内计划信息列表 */
     getList() {
       this.loading = true;
@@ -232,6 +400,14 @@ export default {
         this.loading = false;
       });
     },
+    treeList(){
+      this.treeLoading = true;
+      let query={id:"0"}
+      treeList(query).then(response => {
+        this.data = response.data;
+        this.treeLoading = false;
+      });
+    },
     // 取消按钮
     cancel() {
       this.open = false;
@@ -312,6 +488,11 @@ export default {
         this.$modal.msgSuccess("删除成功");
       }).catch(() => {});
     },
+    /** 导入按钮从按钮操作 */
+    handleImport() {
+      this.upload.title = "场内计划产品信息导入";
+      this.upload.open = true;
+    },
     /** 导出按钮操作 */
     handleExport() {
       this.download('indoorMaterialInformation/information/export', {
@@ -330,16 +511,29 @@ export default {
     display: flex;
     padding: 0px;
     .left-container{
-      width: 20%;
-      height: 900px;
-      border-right: 3px solid blue;
+      width: 0%;
+      //padding: 20px;
+      //height: 900px;
+      //border-right: 3px solid #A6D5FA;
     }
     .right-container{
-      width: 80%;
-      height: 900px;
+      width: 100%;
+      //height: 900px;
+      min-height: 900px;
       padding: 20px;
       //border: 1px solid blue;
     }
+    .custom-tree-node {
+      flex: 1;
+      display: flex;
+      align-items: center;
+      justify-content: space-between;
+      font-size: 14px;
+      padding-right: 8px;
+    }
+    ::v-deep  .el-tree-node__content{
+      height: 40px;
+    }
   }
 
 </style>

+ 180 - 179
zkqy-ui/src/views/amichi/planTask/inPlant.vue

@@ -99,117 +99,62 @@
       <!--表格 -->
       <el-table
         :data="tableData"
-        @selection-change="handleSelectionChange"
-        style="width: 100%;margin-top:20px">
+        style="width: 100%;margin-top: 20px">
+<!--        <el-table-column-->
+<!--          prop="taskId"-->
+<!--          align="center"-->
+<!--          label="任务编号"-->
+<!--        >-->
+<!--        </el-table-column>-->
         <el-table-column
-          type="selection"
+          prop="materialCode"
           align="center"
-          width="55">
+          label="物料编码"
+          >
         </el-table-column>
-        <el-table-column type="expand"  width="30">
-          <template slot-scope="scopes">
-            <el-table :data="scopes.row.onSiteProgramDetails" border
-                      style="width:calc(100% - 80px);float:right" id="child_tab">
-              <el-table-column
-                label="半成品编码"
-                align="center"
-                prop="itemCode"
-              > </el-table-column>
-              <el-table-column
-                label="半成品"
-                align="center"
-                prop="itemName"
-              >
-              </el-table-column>
-              <el-table-column
-                prop="modelMumber"
-                align="center"
-                label="型号"
-              >
-
-              </el-table-column>
-              <el-table-column
-                prop="specification"
-                align="center"
-                label="规格"
-              >
-              </el-table-column>
-              <el-table-column
-                prop="quantity"
-                align="center"
-                label="数量台"
-              >
-                <template v-slot="{ row, column }">
-                  <el-input
-                    v-if="rowIndex === row.index && columnIndex === column.index"
-                    v-model="row.quantity"
-                    @blur="hideInput()"
-                  >
-                  </el-input>
-                  <!-- 显示 -->
-                  <span v-else>{{ row.quantity }}</span>
-                </template>
-              </el-table-column>
-              <el-table-column  label="备注"   prop="remark"  align="center">
-                <template v-slot="{ row, column }">
-                  <el-input
-                    v-if="rowIndex === row.index && columnIndex === column.index"
-                    v-model="row.remark"
-                    @blur="hideInput()"
-                  >
-                  </el-input>
-                  <!-- 显示 -->
-                  <span v-else>{{ row.remark }}</span>
-                </template>
-              </el-table-column>
-            </el-table>
-          </template>
-
-
+        <el-table-column
+          prop="materialName"
+          align="center"
+          label="物料名称">
         </el-table-column>
-<!--        <el-table-column   label="序号" prop="id"  align="center" width="55"></el-table-column>-->
+
         <el-table-column
-          label="物料编码"
+          prop="materialModel"
           align="center"
-          prop="completionTime">
+          label="物料型号">
         </el-table-column>
+
         <el-table-column
-          label="物料名称"
           align="center"
-          prop="completionTime">
+          prop="materialSpecification"
+          label="物料规格">
         </el-table-column>
-          <el-table-column
-            label="物料型号"
-            align="center"
-            prop="completionTime">
-          </el-table-column>
-            <el-table-column
-              label="物料规格"
-              align="center"
-              prop="completionTime">
-            </el-table-column>
+
         <el-table-column
-          label="生产时间"
+          prop="productionTime"
           align="center"
-          prop="completionTime">
+          label="生产时间">
         </el-table-column>
+
         <el-table-column
-          label="任务数量"
           align="center"
-          prop="quantity">
+          prop="taskQuantity"
+          label="任务数量">
         </el-table-column>
+
         <el-table-column
-          label="计划状态"
           align="center"
-          prop="taskStatus">
-          <template  v-slot="scope">
-            <dict-tag  :options="dict.type.tczt" :value="scope.row.taskStatus"/>
-          </template>
+          prop="planStatus"
+          label="状态">
+            <template  v-slot="scope">
+              <dict-tag  :options="dict.type.indoor_plan_type" :value="scope.row.planStatus"/>
+            </template>
         </el-table-column>
+
         <el-table-column
-          label="备注"
           align="center"
-          prop="remark">
+          prop="remarks"
+          label="状态">
         </el-table-column>
         <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
           <template slot-scope="scope">
@@ -219,8 +164,7 @@
               </el-button>
               <el-dropdown-menu slot="dropdown">
                 <el-dropdown-item  icon="el-icon-edit"  command="handleUpdate">修改</el-dropdown-item>
-                <el-dropdown-item  icon="el-icon-delete"  command="handleDelete">删除</el-dropdown-item>
-                <el-dropdown-item  icon="el-icon-edit" v-if="scope.row.taskStatus==0" command="tc">投产</el-dropdown-item>
+                <el-dropdown-item  icon="el-icon-delete" command="handleDelete">删除</el-dropdown-item>
               </el-dropdown-menu>
             </el-dropdown>
           </template>
@@ -389,53 +333,59 @@
         >
           <el-row type="flex" class="row-bg" justify="space-between">
             <el-col :span="8">
-              <el-form-item label="物料信息">
-                <el-select v-model="value" placeholder="请选择">
+              <el-form-item label="物料编码" prop="materialCode">
+                <el-input v-model="inPlanForm.materialCode" :disabled="true" style="width: 218px"></el-input>
+              </el-form-item>
+            </el-col>
+            <el-col :span="8">
+              <el-form-item label="物料信息" prop="materialName">
+                <el-select v-model="inPlanForm.materialName" filterable  placeholder="请选择物料" @change="materialNameChange">
                   <el-option
-                    v-for="item in cities"
+                    v-for="item in productCategoryCollection"
                     :key="item.value"
                     :label="item.label"
-                    :value="item.value">
+                    :value="item.label">
                     <span style="float: left">{{ item.label }}</span>
-                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
+<!--                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>-->
                   </el-option>
                 </el-select>
               </el-form-item>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="型号">
-                <el-select v-model="value" placeholder="请选择">
+              <el-form-item label="型号" prop="materialModel">
+                <el-select v-model="inPlanForm.materialModel" filterable  placeholder="请选择型号" @change="materialModelChange">
                   <el-option
-                    v-for="item in cities"
+                    v-for="item in productModelCollection"
                     :key="item.value"
                     :label="item.label"
-                    :value="item.value">
+                    :value="item.label">
                     <span style="float: left">{{ item.label }}</span>
-                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
+<!--                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>-->
                   </el-option>
                 </el-select>
               </el-form-item>
             </el-col>
+
+          </el-row>
+          <el-row>
             <el-col :span="8">
-              <el-form-item label="规格">
-                <el-select v-model="value" placeholder="请选择">
+              <el-form-item label="规格" prop="materialSpecification">
+                <el-select v-model="inPlanForm.materialSpecification" filterable @change="specificationChange" placeholder="请选择规格">
                   <el-option
-                    v-for="item in cities"
+                    v-for="item in productSpecificationCollection"
                     :key="item.value"
                     :label="item.label"
-                    :value="item.value">
+                    :value="item.label">
                     <span style="float: left">{{ item.label }}</span>
-                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
+<!--                    <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>-->
                   </el-option>
                 </el-select>
               </el-form-item>
             </el-col>
-          </el-row>
-          <el-row>
             <el-col :span="8">
-              <el-form-item label="生产时间">
+              <el-form-item label="生产时间" prop="productionTime">
                 <el-date-picker
-                  v-model="inPlanForm.completionTime"
+                  v-model="inPlanForm.productionTime"
                   type="date"
                   format="yyyy 年 MM 月 dd 日"
                   value-format="yyyy-MM-dd"
@@ -444,15 +394,15 @@
               </el-form-item>
             </el-col>
             <el-col :span="8">
-              <el-form-item label="计划数量">
-                <el-input v-model="inPlanForm.quantity" style="width: 218px"></el-input>
+              <el-form-item label="计划数量" prop="taskQuantity">
+                <el-input v-model="inPlanForm.taskQuantity" style="width: 218px"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
           <el-row type="flex" class="row-bg" justify="space-between">
             <el-col :span="24">
-              <el-form-item label="备注">
-                <el-input type="textarea" v-model="inPlanForm.remark" style="width: 990px" :rows="6"></el-input>
+              <el-form-item label="备注" prop="remarks">
+                <el-input type="textarea" v-model="inPlanForm.remarks" style="width: 990px" :rows="6"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -587,52 +537,66 @@ import {
   deleteOnSiteProgramDetailsVoById,
   semiFinishedListInventory,
   inPlanAutomaticScheduling
+
 } from "@/api/amichi/planTask/index";
+//新增场内计划信息
+import {addInformation,listInformation,getInformation,updateInformation} from "@/api/amichi/indoorPlanInformation/information.js";
 import {listTableData,btnCommonApi} from "@/api/tablelist/commonTable.js";
 import { getToken } from "@/utils/auth";
 import {productDataList} from "@/api/amichi/BOMList";
 import {delExportproductionscheduling} from "@/api/amichi/productionscheduling/exportproductionscheduling";
+  import {productClassification,typeClassification,specificationClassification,queryMaterialCode} from "@/api/amichi/indoorMaterialInformation/information";
 
 
 export default {
   name: "listInfo",
-  dicts: ["schedule_type","tczt","scheduling_state"],
+  dicts: ["schedule_type","tczt","scheduling_state","indoor_plan_type"],
   components: {
   },
   data() {
     return {
-      cities: [{
-        value: 'Beijing',
-        label: '北京'
-      }, {
-        value: 'Shanghai',
-        label: '上海'
-      }, {
-        value: 'Nanjing',
-        label: '南京'
-      }, {
-        value: 'Chengdu',
-        label: '成都'
-      }, {
-        value: 'Shenzhen',
-        label: '深圳'
-      }, {
-        value: 'Guangzhou',
-        label: '广州'
-      }],
+      productModelCollection:[],
+      productCategoryCollection: [],
+      productSpecificationCollection:[],
       value: '',
       productOptions:[],
       // 行index
       rowIndex: null,
       // 列index
       columnIndex: null,
-      inPlanForm:{},
-      inPlanFormRules: {},
+      tableData:[],
+      inPlanForm:{
+        "materialCode":null,
+        "materialName":null,
+        "materialModel":null,
+        "materialSpecification":null,
+        "productionTime":null,
+        "taskQuantity":null,
+        "productDescription":null,
+        "remarks":null
+      },
+      inPlanFormRules: {
+        materialName: [
+          { required: true, message: '请选择物料名称', trigger: 'blur' }
+        ],
+        materialModel: [
+          { required: true, message: '请选择物料型号', trigger: 'blur' }
+        ],
+        materialSpecification: [
+          { required: true, message: '请选择物料规格', trigger: 'blur' }
+        ],
+        productionTime: [
+          { required: true, message: '请输入生产时间', trigger: 'blur' }
+        ],
+        taskQuantity: [
+          { required: true, message: '请输入生产数量', trigger: 'blur' }
+        ]
+      },
       inPlanTitle:"",
       inPlanBoolean:false,
       bomFormTableData: [],
       showCount:false,
-      tableData:[],
+      tableDatatableData:[],
       planOne:{},
       listProcess:[],
       tcForm:{
@@ -700,7 +664,10 @@ export default {
         pageSize: 10, // 每页大小
         orderByColumn: "", // 根据某列排序
         isAsc: "", // desc(降序)或 asc(升序)
-        planType:"1" //场内计划
+        planType:"1", //场内计划
+        materialName:"", //物料名称
+        model:"", //型号
+        specification:"" //规格
       },
       detailData:[],
     };
@@ -723,6 +690,57 @@ export default {
 
   },
   methods: {
+    //物料名称选择查询型号列表下拉数据
+    materialNameChange(){
+      //型号置空
+      this.$set(this.inPlanForm,"materialModel","");
+      //规格置空
+      this.$set(this.inPlanForm,"materialSpecification","");
+      //型号置空
+      this.queryParams.Model="";
+
+      this.productModelCollection=null;
+      this.queryParams.materialName=this.inPlanForm.materialName
+      typeClassification(this.queryParams).then(res => {
+        this.productModelCollection=res.data;
+      })
+    },
+    //型号切换函数
+    materialModelChange(){
+      //型号改变-清空规格下拉框
+      this.$set(this.inPlanForm,"materialSpecification","");
+      //规格list置空
+      this.productSpecificationCollection=null;
+      //赋值名称
+      this.queryParams.materialName=this.inPlanForm.materialName
+      //赋值型号
+      this.queryParams.Model=this.inPlanForm.materialModel
+      //查询规格分类
+      specificationClassification(this.queryParams).then(res => {
+        this.productSpecificationCollection=res.data;
+      })
+    },
+    //主要是为了回显,物料编码.
+    specificationChange(){
+      console.log("规格查找变化")
+      //查询规格分类
+      let obj={
+        "materialName":this.inPlanForm.materialName,
+        "model":this.inPlanForm.materialModel,
+        "specification":this.inPlanForm.materialSpecification
+      }
+      //查询物料信息
+      queryMaterialCode(obj).then(res => {
+        console.log(res.data.materialCode,"abcdfaskldfjlaksdjflaksdjfaklsdfjasdfadfdfasdf");
+        this.$set(this.inPlanForm,"materialCode",res.data.materialCode);
+      })
+    },
+    //查询场内计划物料名称分类
+    productClassification(){
+      productClassification(this.queryParams).then(res => {
+        this.productCategoryCollection=res.data;
+      })
+    },
     //计算总条数
     calculateTotalQuantity() {
       console.log(this.detailData.length,"mdzk")
@@ -744,19 +762,6 @@ export default {
       console.log(this.calculateTotalQuantity())
       this.$set(this.inPlanForm,"quantity",this.calculateTotalQuantity());
     },
-    //查询半成品列表信息
-    productDataList(){
-      productDataList().then(res=>{
-        const transformedData = res.data.map(item => ({
-          label: item.materialName,
-          value: item.id,
-          modelNumber: item.modelNumber,
-          specification: item.specification,
-          itemCode: item.materialCode
-        }));
-        this.productOptions=transformedData;
-      })
-    },
     //产品选择下拉框
     productOptionsSelected(row){
       console.log(row);
@@ -958,43 +963,41 @@ export default {
     },
     //新增计划
     handleAdd(){
-      console.log("新增计划")
+      this.inPlanForm={};
       this.inPlanBoolean=true;
       this.inPlanTitle="新增计划"
-      //查看半成品信息
-      this.productDataList();
-      this.detailData=[];
-      this.inPlanForm={};
+      this.productClassification();
     },
     handleUpdate(row){
       console.log(row);
       this.inPlanBoolean=true;
       this.inPlanTitle="修改计划"
-      this.$set(this.inPlanForm,"quantity",row.quantity);
-      this.$set(this.inPlanForm,"remark",row.quantity);
-      this.$set(this.inPlanForm,"planNumber",row.planNumber);
-      this.$set(this.inPlanForm,"taskStatus",row.taskStatus);
-      this.$set(this.inPlanForm,"completionTime",row.completionTime);
-      this.$set(this.inPlanForm,"id",row.id);
-      this.detailData=row.onSiteProgramDetails;
+      //查询数据库信息
+      getInformation(row.id).then(res=>{
+        if(res.code=200){
+          this.inPlanBoolean=true;
+          this.inPlanForm=res.data;
+        }
+      })
     },
     inPlanConfirmHandler(){
       console.log("厂内计划新增确认")
       console.log(this.inPlanForm);
-      if(this.inPlanTitle=="新增厂内计划"){
-        let argument={"onSiteProgramDetails":this.detailData,...this.inPlanForm,};
-        addOnSiteProgramDetails(argument).then(res=>{
-          console.log(res);
-          if(res.code=200){
-            this.$modal.msgSuccess("新增场内计划成功");
-            this.inPlanBoolean=false;
-            //查询表格数据
-            this.getPlanList(this.queryParams);
-          }
+      if(this.inPlanTitle=="新增计划"){
+        this.$refs.inPlanForm.validate(flag => {
+          //校验表单是否通过
+          addInformation(this.inPlanForm).then(res=>{
+            if(res.code=200){
+              this.$modal.msgSuccess("新增场内计划成功");
+              this.inPlanBoolean=false;
+              //查询表格数据
+              this.getPlanList(this.queryParams);
+            }
+          })
         })
       }else {
-        let argument={"onSiteProgramDetails":this.detailData,...this.inPlanForm,};
-        updateOnSiteProgramDetails(argument).then(res=>{
+        // let argument={"onSiteProgramDetails":this.detailData,...this.inPlanForm,};
+        updateInformation(this.inPlanForm).then(res=>{
           console.log(res);
           if(res.code=200){
             this.$modal.msgSuccess("修改场内计划成功");
@@ -1023,8 +1026,7 @@ export default {
     },
     //计划列表渲染
     getPlanList(){
-      this.queryParams.planType=1
-      getOnSiteProgramDetailsInfoVo(this.queryParams).then((res) => {
+      listInformation(this.queryParams).then((res) => {
         console.log(res.data);
         this.tableData=res.rows;
         this.total = res.total;
@@ -1047,7 +1049,6 @@ export default {
       this.getPlanList(this.queryParams);
     },
 
-
   }
 };
 </script>

+ 16 - 7
zkqy-ui/src/views/amichi/planTask/salesPlan.vue

@@ -170,15 +170,24 @@
                       @selection-change="handleSelectionChangeTwo"
                       style="width:calc(100% - 80px);float:right" id="child_tab">
               <el-table-column type="selection" align="center" width="55"></el-table-column>
+
               <el-table-column align="center"  label="生产订单编号" prop="demandDocument"/>
-                      <el-table-column
+
+              <el-table-column align="center"  label="单据类型" prop="documentType" >
+                        <template  v-slot="scope">
+                          <dict-tag  :options="dict.type.djlx" :value="scope.row.documentType"/>
+                        </template>
+              </el-table-column>
+
+              <el-table-column
                         prop="timeOfRequest"
                         label="单据日期"
                         align="center">
                         <template slot-scope="scope">
                           {{ formatDateTime(scope.row.timeOfRequest) }}
                         </template>
-                      </el-table-column>
+              </el-table-column>
+
               <el-table-column align="center"  label="物料编码" prop="materialId" />
               <el-table-column align="center"  label="物料名称" prop="materialName"/>
               <el-table-column align="center"  label="型号"    prop="modelNumber" />
@@ -222,11 +231,11 @@
           align="center"
           prop="orderNumber">
         </el-table-column>
-        <el-table-column align="center"  label="单据类型" prop="orderType">
-          <template  v-slot="scope">
-            <dict-tag  :options="dict.type.djlx" :value="scope.row.orderType"/>
-          </template>
-        </el-table-column>
+<!--        <el-table-column align="center"  label="单据类型" prop="orderType">-->
+<!--          <template  v-slot="scope">-->
+<!--            <dict-tag  :options="dict.type.djlx" :value="scope.row.orderType"/>-->
+<!--          </template>-->
+<!--        </el-table-column>-->
 <!--        <el-table-column-->
 <!--          prop="creationtimeString"-->
 <!--          label="单据日期"-->

+ 1 - 1
zkqy-ui/src/views/amichi/processDocumentManagement/index.vue

@@ -37,7 +37,7 @@
                           @click.stop="() => deleteTechnology (node, data)">
                         </el-button>
                       </span>
-             </span>
+                </span>
             </el-tree>
           </div>
         </div>

+ 21 - 5
zkqy-ui/src/views/amichi/qualityinspectioninformation/bp_inspection/QualityStatement.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-  <div class="quality-report-dialog">
+  <div class="quality-report-dialog" style="padding: 100px">
     <div class="dialog-header">
       <div class="company-logo">
         <!-- <span class="back-button" @click="goBack">返回</span> -->
@@ -94,7 +94,7 @@
 
 <script>
 import {
-  getQualityinspectioninformation,
+  getQualityinspectioninformation, getQualityinspectioninformationOne,
   listQualityinspectioninformation
 } from "@/api/amichi/qualityinspectioninformation/qualityinspectioninformation";
 
@@ -133,7 +133,7 @@ export default {
 
   computed: {
     displayData () {
-      return this.isScrolling ? this.scrollData : this.tableData
+      return this.isScrolling ?  this.tableData:this.scrollData
     },
     tableStyle () {
       if (this.isScrolling) {
@@ -227,21 +227,37 @@ export default {
       }
     },
     checkMasterInfo () {
+      // this.masterInfo.isEnablePaging=false;
+      // getQualityinspectioninformation(this.masterInfo.id).then(response => {
+      //   this.masterInfo = response.data;
+      // });
+
       this.masterInfo.isEnablePaging=false;
-      getQualityinspectioninformation(this.masterInfo.id).then(response => {
+      this.masterInfo.manufacturingProcess="白胚检验";
+      getQualityinspectioninformationOne(this.masterInfo).then(response => {
         this.masterInfo = response.data;
       });
+
       this.loading=true
       listInspection({"fid":this.masterInfo.id,"isEnablePaging":"false"}).then(response => {
         this.tableData = response.rows;
         this.loading = false;
+        this.$nextTick(() => {
+          this.isScrolling=true;
+          this.displayRows=10;
+          this.handleScrollChange();
+        });
       });
     }
   },
   created () {
     // 移除这里的初始化,改为在开关打开时初始化
     this.masterInfo.id =this.$route.query.id;
-     this.checkMasterInfo();
+    if(this.masterInfo.id==null||this.masterInfo.id==""){
+      console.log("为空");
+      this.masterInfo.id=="0000"
+    }
+    this.checkMasterInfo();
   },
   mounted () {
     // 移除这里的自动开始滚动

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

@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" style="padding: 100px">
   <div class="quality-report-dialog">
     <div class="dialog-header">
       <div class="company-logo">
@@ -51,8 +51,9 @@
           <td>{{ item.orderNumber }}</td>
           <td>{{ item.modelName }}</td>
           <td>{{ item.modelName }}</td>
-          <td>{{ item.causeOfNonconformity }}</td>
           <td>{{ item.disqualificationNumber }}</td>
+          <td>{{ item.causeOfNonconformity }}</td>
+
           <td>{{ item.jobNumber }}</td>
           <td>{{ item.dateOfInspection }}</td>
         </tr>
@@ -95,7 +96,7 @@
 
 <script>
 import {
-  getQualityinspectioninformation,
+  getQualityinspectioninformation, getQualityinspectioninformationOne,
   listQualityinspectioninformation
 } from "@/api/amichi/qualityinspectioninformation/qualityinspectioninformation";
 import {listBpleavefactory} from "@/api/amichi/qualityinspectioninformation/bpleavefactory";
@@ -112,7 +113,7 @@ export default {
       scrollData: [], // 用于滚动的数据
       timer: null,
       currentIndex: 0,
-      displayRows: 3, // 默认显示3行
+      displayRows: 10, // 默认显示3行
       isPaused: false, // 添加暂停状态标记
       masterInfo:{
         id:null,
@@ -131,10 +132,10 @@ export default {
   },
   computed: {
     displayData () {
-      return this.isScrolling ? this.scrollData : this.tableData
+      return this.isScrolling ?  this.tableData:this.scrollData
     },
     tableStyle () {
-      if (this.isScrolling) {
+      if (!this.isScrolling) {
         return {
           height: `${this.displayRows * 40}px`,
           overflow: 'hidden'
@@ -225,21 +226,36 @@ export default {
       }
     },
     checkMasterInfo () {
+      // this.masterInfo.isEnablePaging=false;
+      // getQualityinspectioninformation(this.masterInfo.id).then(response => {
+      //   this.masterInfo = response.data;
+      // });
+
       this.masterInfo.isEnablePaging=false;
-      getQualityinspectioninformation(this.masterInfo.id).then(response => {
+      this.masterInfo.manufacturingProcess="出厂检验";
+      getQualityinspectioninformationOne(this.masterInfo).then(response => {
         this.masterInfo = response.data;
       });
       this.loading=true
       listBpleavefactory({"fid":this.masterInfo.id,"isEnablePaging":"false"}).then(response => {
         this.tableData = response.rows;
         this.loading = false;
+        this.$nextTick(() => {
+          this.isScrolling=true;
+          this.displayRows=10;
+          this.handleScrollChange();
+        });
       });
     }
   },
   created () {
     // 移除这里的初始化,改为在开关打开时初始化
     this.masterInfo.id =this.$route.query.id;
-     this.checkMasterInfo();
+    if(this.masterInfo.id==null||this.masterInfo.id==""){
+      console.log("为空");
+      this.masterInfo.id=="0000"
+    }
+    this.checkMasterInfo();
   },
   mounted () {
     // 移除这里的自动开始滚动

+ 20 - 6
zkqy-ui/src/views/amichi/qualityinspectioninformation/jl_inspection/QualityStatement.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="app-container">
+  <div class="app-container" style="padding: 100px">
   <div class="quality-report-dialog">
     <div class="dialog-header">
       <div class="company-logo">
@@ -46,7 +46,7 @@
         </tr>
         </thead>
         <tbody ref="tbody">
-        <tr v-for="(item,index) in displayData" :key="item.id" v-loading="loading">
+        <tr v-for="(item,index) in displayData" :key="index" v-loading="loading">
 <!--          <td>{{ index+1 }}</td>-->
           <td>{{ item.orderNumber }}</td>
           <td>{{ item.modelName }}</td>
@@ -95,7 +95,7 @@
 
 <script>
 import {
-  getQualityinspectioninformation,
+  getQualityinspectioninformation, getQualityinspectioninformationOne,
   listQualityinspectioninformation
 } from "@/api/amichi/qualityinspectioninformation/qualityinspectioninformation";
 import {listInspection} from "@/api/amichi/qualityinspectioninformation/jlinspection";
@@ -108,7 +108,7 @@ export default {
       tableData: [
 
       ],
-      isScrolling: false, // 控制是否滚动的开关
+      isScrolling: true, // 控制是否滚动的开关
       scrollData: [], // 用于滚动的数据
       timer: null,
       currentIndex: 0,
@@ -131,7 +131,7 @@ export default {
   },
   computed: {
     displayData () {
-      return this.isScrolling ? this.scrollData : this.tableData
+      return this.isScrolling ?  this.tableData:this.scrollData
     },
     tableStyle () {
       if (this.isScrolling) {
@@ -226,19 +226,33 @@ export default {
     },
     checkMasterInfo () {
       this.masterInfo.isEnablePaging=false;
-      getQualityinspectioninformation(this.masterInfo.id).then(response => {
+      this.masterInfo.manufacturingProcess="来料检验";
+      // getQualityinspectioninformation(this.masterInfo).then(response => {
+      //   this.masterInfo = response.data;
+      // });
+      getQualityinspectioninformationOne(this.masterInfo).then(response => {
         this.masterInfo = response.data;
       });
       this.loading=true
       listInspection({"fid":this.masterInfo.id,"isEnablePaging":"false"}).then(response => {
         this.tableData = response.rows;
         this.loading = false;
+        this.$nextTick(() => {
+          this.isScrolling=true;
+          this.displayRows=10;
+          this.handleScrollChange();
+        });
+
       });
     }
   },
   created () {
     // 移除这里的初始化,改为在开关打开时初始化
     this.masterInfo.id =this.$route.query.id;
+    if(this.masterInfo.id==null||this.masterInfo.id==""){
+      console.log("为空");
+      this.masterInfo.id=="0000"
+    }
      this.checkMasterInfo();
   },
   mounted () {

+ 3 - 3
zkqy-ui/src/views/login.vue

@@ -308,11 +308,11 @@ export default {
           }
           let form = {
                 // uri: "?client_id=hmc&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.2.190:8066/oauth/callback",
-               // uri:"?client_id=mestools&scope=basic&response_type=code&state=AB1357&redirect_uri=http://62.234.61.92:8055/oauth/callback",
+                //uri:"?client_id=mestools&scope=basic&response_type=code&state=AB1357&redirect_uri=http://175.27.169.173:8055/oauth/callback",
                // uri:"?client_id=mestools&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.128.171:8066/oauth/callback",
-               // uri:"?client_id=mestools&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.2.135:8066/oauth/callback",
-             uri:"?client_id=hmc&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.83:8066/oauth/callback",
+                 uri:"?client_id=mestools&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.2.135:8066/oauth/callback",
              // uri:"?client_id=hmc&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.83:8066/oauth/callback",
+             //  uri:"?client_id=hmc&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.110.83:8066/oauth/callback",
             // uri:"?client_id=hmc&scope=basic&response_type=code&state=AB1357&redirect_uri=http://172.20.10.5:8066/oauth/callback",
             //   uri:"?client_id=mestools&scope=basic&response_type=code&state=AB1357&redirect_uri=http://192.168.3.17:8066/oauth/callback",
             ...this.loginForm,

+ 5 - 0
zkqy-ui/src/views/orderMange/codeListManage/printIndex.vue

@@ -1071,6 +1071,7 @@ export default {
         remark,
         machineToolNo,
       } = this.form;
+
       let {
         productName,
         productSpecifications,
@@ -1079,10 +1080,12 @@ export default {
         directionOfTwist,
         productId,
       } = this.currentRow;
+
       let directionOfTwistLabel =
         this.dict.type.direction_of_twist.find(
           (item) => item.value == directionOfTwist
         )?.label || " ";
+
       newData = {
         productionLineNo: this.lineOptions.find(
           (i) => i.id == this.form.machineTool
@@ -1155,11 +1158,13 @@ export default {
         qrCodeId,
         otherStates,
       } = printRow;
+
       let temp =id + "@" + qrCodeId + "@" + canisterNum + "@" + suttle + "@" + grossWeight + "@" +
         qrCode;
       if (otherStates == 1) {
         temp += "@" + 1; //总码单标识
       }
+
       console.log("二维码数据", temp);
       payload.qrCodeVal = temp;
       payload.remark = remark || "注:不同批号,请勿混用";

+ 3 - 2
zkqy-ui/vue.config.js

@@ -39,9 +39,10 @@ module.exports = {
       // detail: https://cli.vuejs.org/config/#devserver-proxy
       [process.env.VUE_APP_BASE_API]: {
          // target: `http://172.20.10.5:8066`,
-        target: `http://192.168.110.83:8066`,
+         // target: `http://175.27.169.173:8066`,
+        // target: `http://192.168.110.83:8066`,
         // target: `http://192.168.128.171:8066`,
-        //target: `http://192.168.2.135:8066`, //铨一开发
+         target: `http://192.168.2.135:8066`, //铨一开发
         // target: `http://192.168.2.190:8066`,
         // target: `http://192.168.3.17:8066`,
         // target: `http://192.168.2.135:8066`,