From 6e6c883bdd015b9552d0f983a634b588574b4198 Mon Sep 17 00:00:00 2001
From: lvleigang <957075182@qq.com>
Date: Sun, 27 Apr 2025 09:41:46 +0800
Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E5=AF=B9=E7=A7=B0=E4=BF=AE?=
 =?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 ...terielSynchronizationEventServiceImpl.java | 105 +++++++++++++++++-
 1 file changed, 101 insertions(+), 4 deletions(-)

diff --git a/base-buildpackage/src/main/java/com/hzya/frame/plugin/zjmaterielsynchronizationevent/service/impl/ZjMaterielSynchronizationEventServiceImpl.java b/base-buildpackage/src/main/java/com/hzya/frame/plugin/zjmaterielsynchronizationevent/service/impl/ZjMaterielSynchronizationEventServiceImpl.java
index 24b2b3e5..01d94513 100644
--- a/base-buildpackage/src/main/java/com/hzya/frame/plugin/zjmaterielsynchronizationevent/service/impl/ZjMaterielSynchronizationEventServiceImpl.java
+++ b/base-buildpackage/src/main/java/com/hzya/frame/plugin/zjmaterielsynchronizationevent/service/impl/ZjMaterielSynchronizationEventServiceImpl.java
@@ -407,7 +407,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
                     //否:取消勾选勾选存货属性的”委外”,计划页面的委外属性设置成“采购”
                     // 整体逻辑  12100物料分类 0非贴片 002流水号  01品牌号
                     if(lsh.get(entity.getField0043code()) != null){
-                        if(entity.getField0017code() != null && "贴片".equals(entity.getField0017code())){
+                        if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
                             maxnum = lsh.get(entity.getField0043code()+9);
                         }else {
                             maxnum = lsh.get(entity.getField0043code()+0);
@@ -415,7 +415,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
                     }
                     if(maxnum == null){
                         entity.setDataSourceCode(zju8);
-                        if(entity.getField0017code() != null && "贴片".equals(entity.getField0017code())){
+                        if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
                             entity.setQuerycode(entity.getField0043code()+9);
                         }else {
                             entity.setQuerycode(entity.getField0043code()+0);
@@ -427,7 +427,7 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
                     String formattedNum = String.format("%03d", ++maxnum);
                     lsh.put(entity.getField0043code(),maxnum);
                     wlcode.append(entity.getField0043code());
-                    if(entity.getField0017code() != null && "贴片".equals(entity.getField0017code())){
+                    if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
                         wlcode.append("9");
                     }else {
                         wlcode.append("0");
@@ -640,9 +640,106 @@ public class ZjMaterielSynchronizationEventServiceImpl extends BaseService<ZjMat
             //if(entity.getField0018code() == null || "".equals(entity.getField0018code())){
             //    return BaseResult.getFailureMessageEntity("序号为"+entity.getField0004()+"明细行的申请原因为空");
             //}
-            if("修改".equals(entity.getField0018code())){
+            if(!"新增".equals(entity.getField0018code())){
                 if(entity.getField0005() == null || "".equals(entity.getField0005())){
                     str.append("序号为"+entity.getField0004()+"明细行的货品编码为空。");
+                }else {
+                    if(entity.getField0043code().equals("12400")
+                            || entity.getField0043code().equals("12500")
+                            || entity.getField0043code().equals("12418")
+                            || entity.getField0043code().equals("12001")
+                            || entity.getField0043code().equals("12003")
+                            || entity.getField0043code().equals("12900")
+                            || entity.getField0043code().equals("12005")){
+                        //货品分类(12400-贴片电阻, 12500-贴片电容, 12418-贴片检测电阻, 12001-单面板, 12003-双面板, 12005-多层板)
+                        //封装分类(贴片 0 , 其他 0 )
+                        //当前分类最大流水号
+                        //品牌(单据内填写品牌 01,未填写 00)
+                        //是否委外
+                        //是:勾选存货属性的委外,计划页面的委外属性
+                        //否:取消勾选勾选存货属性的”委外”,计划页面的委外属性设置成“采购”
+                        // 整体逻辑  12400物料分类 0贴片 002流水号  01品牌号
+                        //例:12400  0 002 01
+                        //货品分类以这几个开头的。封装分类是贴片,依然填0
+                        String subStrfz = entity.getField0005().substring(5, 6);
+                        if(!subStrfz.equals("0")){
+                            str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类,编码对应应该填写0");
+                        }
+                        String subStr = entity.getField0005().substring(9, 11);
+                        if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
+                            if("000".equals(entity.getField0008code())){
+                                if(!subStr.equals("00")){
+                                    str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为000,编码对应应该填写00");
+                                }
+                            }else {
+                                if(!subStr.equals("01")){
+                                    str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在,编码对应应该填写01");
+                                }
+                            }
+                        }else {
+                            if(!subStr.equals("00")){
+                                str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为空,应该填写00");
+                            }
+                        }
+                    }else if(entity.getField0043code().startsWith("1") || entity.getField0043code().startsWith("4") || entity.getField0043code().startsWith("5")){
+                        //货品分类(区分是否是原材料通过分类首位1,4,5)
+                        //封装分类(贴片 9 , 其他 0 )
+                        //当前分类最大流水号
+                        //品牌(单据内填写品牌 01,未填写 00)
+                        //是否委外
+                        //是:勾选存货属性的委外,计划页面的委外属性
+                        //否:取消勾选勾选存货属性的”委外”,计划页面的委外属性设置成“采购”
+                        // 整体逻辑  12100物料分类 0非贴片 002流水号  01品牌号
+
+                        String subStrfz = entity.getField0005().substring(5, 6);
+
+                        if(entity.getField0017code() != null && "A贴片类".equals(entity.getField0017code())){
+                            if(!subStrfz.equals("9")){
+                                str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类为贴片,编码对应应该填写9");
+                            }
+                        }else {
+                            if(!subStrfz.equals("0")){
+                                str.append("序号为"+entity.getField0004()+"明细行的物料编码的封装分类不是贴片,编码对应应该填写0");
+                            }
+                        }
+                        String subStr = entity.getField0005().substring(9, 11);
+                        if(entity.getField0008code() != null && !"".equals(entity.getField0008code())){
+                            if("000".equals(entity.getField0008code())){
+                                if(!subStr.equals("00")){
+                                    str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为000,编码对应应该填写00");
+                                }
+                            }else {
+                                if(!subStr.equals("01")){
+                                    str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌存在,编码对应应该填写01");
+                                }
+                            }
+                        }else {
+                            if(!subStr.equals("00")){
+                                str.append("序号为"+entity.getField0004()+"明细行的物料编码品牌为空,应该填写00");
+                            }
+                        }
+                    }else if(entity.getField0043code().startsWith("6") || entity.getField0043code().startsWith("7") || entity.getField0043code().startsWith("8") || entity.getField0043code().startsWith("9")){
+                        //货品分类(区分是否是”产品”通过分类首位6,7,8,9)
+                        //当前分类最大流水号(编码第6-9是顺序号)
+                        //最后2位默认11
+                        //整体逻辑  62100物料分类  0001流水  11默认
+                        //例:62100 0001 11
+                        String subStr = entity.getField0005().substring(9, 11);
+                        if(!subStr.equals("11")){
+                            str.append("序号为"+entity.getField0004()+"明细行的物料编码,末尾编码应该填写11");
+                        }
+
+                    }else if(entity.getField0043code().startsWith("A")){
+                        //货品分类(区分是”软件”通过分类首位A)
+                        //当前分类最大流水号(编码第6-10是顺序号)
+                        //最后1位默认1
+                        //整体逻辑  A0110物料分类  00001流水  1默认
+                        //例:A0110 00001 1
+                        String subStr = entity.getField0005().substring(10, 11);
+                        if(!subStr.equals("1")){
+                            str.append("序号为"+entity.getField0004()+"明细行的物料编码,末尾编码应该填写1");
+                        }
+                    }
                 }
             }
             //if(flag){