Browse Source

成本分配、出运明细、销售订单、面辅料调整

huxy 5 days ago
parent
commit
ce5006b142

+ 8 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationMapper.xml

@@ -391,7 +391,7 @@
 	join UFDATA_101_2021.dbo.Inventory omi on omi.cInvCode=pbs.cInvCode
 		join UFDATA_101_2021.dbo.SO_SOMain so on pd.csoordercode = so.csocode
 	where pm.cPOID like CONCAT('%',#{code},'%') and (omi.cInvCcode like '03%' or omi.cInvCcode like '04%') and omi.cInvCCode != '0399' and omi.cInvCCode != '0499' and omi.cInvCCode != '0299'
-	 and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001')
+	 and omi.cInvCCode != '07'and omi.cInvCCode != '06'and omi.cInvCCode != '05' and pb.cVenCode not in('T010001','T020001','T030001')
    group by omi.cInvName
 	UNION ALL
 
@@ -432,18 +432,18 @@ select sum(iquantity) as salerIquantity from UFDATA_101_2021.dbo.SO_SODetails wh
 </foreach>
 union all
 select sum(iquantity) as salerIquantity from UFDATA_102_2021.dbo.SO_SODetails a
-		inner join UFDATA_102_2021.dbo.SO_SOMain b on a.ID = b.ID
-	inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
- WHERE b.cCusCode not in ('0001','T020001') and a.csocode in
+inner join UFDATA_102_2021.dbo.SO_SOMain b on a.ID = b.ID
+inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
+WHERE b.cCusCode not in ('0001','T020001') and a.csocode in
 <foreach collection="csocode" item="value" index="index" open="(" separator="," close=")">
 #{value}
 </foreach>
 union all
 select sum(iquantity) as salerIquantity from UFDATA_103_2021.dbo.SO_SODetails a
-		inner join UFDATA_103_2021.dbo.SO_SOMain b on a.ID = b.ID
-	inner JOIN UFDATA_103_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
- WHERE b.cCusCode not in ('0001','T020001')
- and a.csocode in
+inner join UFDATA_103_2021.dbo.SO_SOMain b on a.ID = b.ID
+inner JOIN UFDATA_103_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
+WHERE b.cCusCode not in ('0001','T020001')
+and a.csocode in
 <foreach collection="csocode" item="value" index="index" open="(" separator="," close=")">
     #{value}
 </foreach>

+ 34 - 22
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/service/impl/SyCostAllocationServiceImpl.java

@@ -445,8 +445,11 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
             //多发少发链接结合赋值 syFabricMaps
 //            List<SyCostAllocationFabric> pilosityFeweList = syCostAllocationFabricMapper.querypilosityFewer(plannum,Fabric.getGoodsName());
+
             List<SyCostAllocationFabric> pilosityFeweList = syFabricMaps.get(Fabric.getGoodsName());
-            System.out.println("多发少发链接\t"+pilosityFeweList);
+            if (Fabric.getGoodsName().indexOf("--")!=-1){
+                pilosityFeweList=syFabricMaps.get(Fabric.getGoodsName().substring(0,Fabric.getGoodsName().indexOf("--")));
+            }
             Fabric.setPilosityFewerList(pilosityFeweList);
 
             //多发少发 = 使用数量-计划数量------>购入数量-计划数量
@@ -475,34 +478,43 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             //合计面料成本美元
             BigDecimal includestaxTotal = BigDecimal.ZERO;
             if(fabriccostIncludestax.size()!=0){
-
                 for(SyCostAllocation str : fabriccostIncludestax){
-
                     for(SyCostAllocationFabric li:list3){
-                        if(str.getCInvName().equals(li.getGoodsName())){
-//                            if (str.getInvoiceQuantity().compareTo(li.getUsageQuantity())!=0){
-//                                BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-//                                BigDecimal num = money.multiply(li.getUsageQuantity());
-//                                usageQuantityTotal = usageQuantityTotal.add(num);
-//                            }else{
-//                                usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
-//                            }
-                            BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                            BigDecimal num = money.multiply(li.getUsageQuantity());
-                            usageQuantityTotal = usageQuantityTotal.add(num);
-
-                            BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                            BigDecimal num1 = money1.multiply(li.getUsageQuantity());
-                            notincludestaxTotal = notincludestaxTotal.add(num1);
-                            BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
-                            BigDecimal num2 = money2.multiply(li.getUsageQuantity());
-                            includestaxTotal = includestaxTotal.add(num2);
+                        String goodsName=li.getGoodsName();
+                        if (goodsName.indexOf("--")!=-1){
+                            goodsName=goodsName.substring(0,goodsName.indexOf("--"));
+                        }
+                        if(str.getCInvName().equals(goodsName)){
+                            if (str.getInvoiceQuantity().compareTo(li.getUsageQuantity())!=0){
+                                BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+                                BigDecimal num = money.multiply(li.getUsageQuantity());
+                                usageQuantityTotal = usageQuantityTotal.add(num);
+                                BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+                                BigDecimal num1 = money1.multiply(li.getUsageQuantity());
+                                notincludestaxTotal = notincludestaxTotal.add(num1);
+                                BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+                                BigDecimal num2 = money2.multiply(li.getUsageQuantity());
+                                includestaxTotal = includestaxTotal.add(num2);
+                            }else{
+                                usageQuantityTotal = usageQuantityTotal.add(str.getFabriccostIncludestax());
+                                notincludestaxTotal = notincludestaxTotal.add(str.getFabriccostNotincludestax());
+                                includestaxTotal = includestaxTotal.add(str.getFabriccostIncludestaxUsd());
+                            }
+//                            BigDecimal money = str.getFabriccostIncludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                            BigDecimal num = money.multiply(li.getUsageQuantity());
+//                            usageQuantityTotal = usageQuantityTotal.add(num);
+//
+//                            BigDecimal money1 = str.getFabriccostNotincludestax().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                            BigDecimal num1 = money1.multiply(li.getUsageQuantity());
+//                            notincludestaxTotal = notincludestaxTotal.add(num1);
+//                            BigDecimal money2 = str.getFabriccostIncludestaxUsd().divide(str.getInvoiceQuantity(),2,BigDecimal.ROUND_HALF_UP);
+//                            BigDecimal num2 = money2.multiply(li.getUsageQuantity());
+//                            includestaxTotal = includestaxTotal.add(num2);
                             //(发票金额/发票数量)*使用数量
 //                            System.out.println("面料含税成本\t"+usageQuantityTotal+"\t面料不含税成本\t"+notincludestaxTotal+"\t发票数量\t"+str.getInvoiceQuantity()+"\t使用数量\t"+li.getUsageQuantity());
                         }
                     }
                 }
-
                 syCostAllocation.setFabriccostIncludestax(usageQuantityTotal.setScale(2,BigDecimal.ROUND_HALF_UP));
 //                System.out.println("实际总金额2\t"+usageQuantityTotal);
                 syCostAllocation.setFabriccostNotincludestax(notincludestaxTotal);

+ 6 - 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/orderData/service/impl/SyOrderDataServiceImpl.java

@@ -269,7 +269,6 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     }
                     sy2.setSyOrderDataId(sy.getAccount()+sy2.getSyOrderDataId());
                     List<SyOrderDataVO> ordervo = queryOrder(sy2.getId());
-
                     if(ordervo.size()!=0 && ordervo.size() == 1){
                         sy2.setOmpoAccount(ordervo.get(0).getOmpoAccount());
                         sy2.setOmpoCode(ordervo.get(0).getOmpoCode());
@@ -458,9 +457,6 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
             result.setMessage("同步失败!请联系管理员!!!");
             return result;
         }
-        //newCount	140	count	0
-        //newCount	140	count	140
-        System.out.println("newCount\t"+newCount+"\tcount\t"+count);
         if (newCount!=count){
             if (newCount-count>0){
                 result.setMessage("同步成功,新增"+(newCount-count)+"条数据");
@@ -649,7 +645,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid,od.iQuantity as quantity " +
                     " FROM OM_MOMain om" +
                     " LEFT JOIN  OM_MODetails  od on om.MOID =od.MOID" +
-                    " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
+                    " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
                     ") p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode" +
                     " where s.autoid ="+syOrderDataVO.getId();
@@ -671,7 +667,7 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     " pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
                     " FROM PO_Pomain pm" +
                     " LEFT JOIN  PO_Podetails pd on pm.POID=pd.POID" +
-                    " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
+                    " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
                     ") p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode"+
                     " where s.autoid ="+syOrderDataVO.getId();
@@ -700,14 +696,14 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     " pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
                     " FROM PO_Pomain pm" +
                     " LEFT JOIN  PO_Podetails pd on pm.POID=pd.POID" +
-                    " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
+                    " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
                     " UNION" +
                     " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem,od.iQuantity as quantity," +
                     " od.cDefine23  as guangpeiGateWidth,od.dArriveDate,"+
                     " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
                     " FROM OM_MOMain om" +
                     " LEFT JOIN  OM_MODetails  od on om.MOID =od.MOID" +
-                    " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
+                    " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
                     " ) p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode"+
                     " where hy.predid ="+syOrderDataVO.getOmpoIdItem() +" and ss.cSOCode='"+syOrderDataVO.getOmpoCode()+"'";
@@ -729,14 +725,14 @@ public class SyOrderDataServiceImpl extends ServiceImpl<SyOrderDataMapper, SyOrd
                     " pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
                     " FROM PO_Pomain pm" +
                     " LEFT JOIN  PO_Podetails pd on pm.POID=pd.POID" +
-                    " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
+                    " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
                     " UNION" +
                     " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem,od.iQuantity as quantity," +
                     " od.cDefine23  as guangpeiGateWidth,od.dArriveDate,"+
                     " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
                     " FROM OM_MOMain om" +
                     " LEFT JOIN  OM_MODetails  od on om.MOID =od.MOID" +
-                    " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
+                    " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
                     ") p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode"+
                     " where s.autoid ="+syOrderDataVO.getId();

+ 3 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/controller/SyShippingDetailsController.java

@@ -997,6 +997,7 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 					  }
 					  //判断重复自由项数据
 					  String key = generateKey(li);
+					  System.out.println("出运明细key:\t"+key);
 					  if (seenData.contains(key)) {
 						  result.setSuccess(false);
 						  result.setMessage("有重复数据,无法提交");
@@ -1059,15 +1060,14 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
 		  log.error("提交失败:" + ex.getMessage());
 		  result.error500("提交失败:" + ex.getMessage());
 	  }
-
 	  return  result;
   }
 
 
-  //处理拼接
+  	 //处理拼接
 	 private String generateKey(SyShippingDetailsItem item) {
 		 // 根据需要拼接一个唯一标识字符串,用于比较
-		 return item.getGroupId()+item.getSmallPo() + item.getOrderNumber() + item.getPreDeliveryDate() + item.getPreCompletionDate()
+		 return item.getGroupId()+item.getPackId()+item.getSmallPo() + item.getOrderNumber() + item.getPreDeliveryDate() + item.getPreCompletionDate()
 				 + item.getItemNumber() + item.getInventoryCode() + item.getColour() + item.getSize()
 				 + item.getGuangpeiGateWidth() + item.getWeight() + item.getCodingRules();
 	 }

+ 151 - 41
jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/job/AddOrderJob.java

@@ -21,6 +21,7 @@ import org.jeecg.modules.openApi.service.ISenYuDataSourceThree;
 import org.jeecg.modules.openApi.service.ISenYuDataSourceTwo;
 import org.jeecg.modules.system.util.JsonChangeUtils;
 import org.quartz.*;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeansException;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
@@ -133,7 +134,8 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                         " LEFT JOIN Customer cc ON s.cCusCode = cc.cCusCode" +
                         " LEFT JOIN Person  pe ON s.cPersonCode = pe.cPersonCode" +
                         " left join Vendor v on s.cDefine12=v.cVenName" +
-                        " where s.iStatus = 1 and (s.cCloser is null or s.cCloser='asuser') AND (s.cdefine15 is null or  s.cdefine15 !='1' and s.cdefine15 !='2') and dverifydate > "+formattedDate;
+                        " where s.iStatus = 1 and (s.cCloser is null or s.cCloser='asuser') AND (s.cdefine15 is null or  s.cdefine15 !='1' and s.cdefine15 !='2') and dverifydate > "
+                        +formattedDate;
 
                 //103的销售订单只取客户是101的
                 if(account.equals("103")){
@@ -269,44 +271,151 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                         }
                     }
                     sy2.setSyOrderDataId(sy.getAccount()+sy2.getSyOrderDataId());
-                    SyOrderDataVO ordervo = queryOrder(sy2.getId());
-                    if(ordervo != null){
-                        sy2.setOmpoAccount(ordervo.getOmpoAccount());
-                        sy2.setOmpoCode(ordervo.getOmpoCode());
-                        sy2.setOmpoId(ordervo.getOmpoId());
-                        sy2.setDArriveDate(ordervo.getDArriveDate());
-                        sy2.setOmpoIdItem(ordervo.getOmpoIdItem());
-                        sy2.setITaxPrice(ordervo.getITaxPrice());
+                    List<SyOrderDataVO> ordervo = queryOrder(sy2.getId());
+
+                    if(ordervo.size()!=0 && ordervo.size() == 1){
+                        sy2.setOmpoAccount(ordervo.get(0).getOmpoAccount());
+                        sy2.setOmpoCode(ordervo.get(0).getOmpoCode());
+                        sy2.setOmpoId(ordervo.get(0).getOmpoId());
+                        sy2.setDArriveDate(ordervo.get(0).getDArriveDate());
+                        sy2.setOmpoIdItem(ordervo.get(0).getOmpoIdItem());
+                        sy2.setITaxPrice(ordervo.get(0).getITaxPrice());
                         if(sy2.getGuangpeiGateWidth()==null||sy2.getGuangpeiGateWidth().equals("/")||sy2.getGuangpeiGateWidth().equals("")){
-                            sy2.setGuangpeiGateWidth(ordervo.getGuangpeiGateWidth());
+                            sy2.setGuangpeiGateWidth(ordervo.get(0).getGuangpeiGateWidth());
                         }
-                        sy2.setSupplier(ordervo.getSupplier());
+                        sy2.setSupplier(ordervo.get(0).getSupplier());
                         if(sy2.getInventoryCcode().substring(0,2).equals("19")){
-                            sy2.setGarmentFactory(ordervo.getSupplier());
+                            sy2.setGarmentFactory(ordervo.get(0).getSupplier());
                         }/*else if(sy.getCustomerAbbreviation().equals("International Apparel Group") || sy.getCustomerAbbreviation().equals("宁波森语") ) {
                             sy2.setGarmentFactory(queryGSupplier(sy.getOrderNumber(),sy.getAccount(),sy.getCustomerCode()));
                         }*/else {
                             sy2.setGarmentFactory(sy.getGarmentFactory());
                         }
-                        sy2.setSupplierCode(ordervo.getSupplierCode());
+                        sy2.setSupplierCode(ordervo.get(0).getSupplierCode());
+
+                        if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
+                            continue;
+                        }
+                        if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
+                            List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
+                            if(rsup.size()>0){
+                                sy2.setRSupplierCode(rsup.get(0));
+                                sy2.setRSupplier(rsup.get(1));
+                            }
+                        }
+                        if(isNewOrder){
+                            syOrderDataItemService.save(sy2);
+                            continue;
+                        }
+
+                        syItemList.add(sy2);
                     }else {
-                        continue;
-                    }
-                    if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
-                        continue;
-                    }
-                    if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
-                        List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
-                        if(rsup.size()>0){
-                            sy2.setRSupplierCode(rsup.get(0));
-                            sy2.setRSupplier(rsup.get(1));
+                        int indexi = 0;
+                        for(SyOrderDataVO li:ordervo) {
+
+                            sy2.setQuantity(li.getQuantity());//数量
+                            sy2.setSurplusNum(li.getQuantity());
+
+                            sy2.setOmpoAccount(li.getOmpoAccount());
+                            sy2.setOmpoCode(li.getOmpoCode());
+                            sy2.setOmpoId(li.getOmpoId());
+                            sy2.setDArriveDate(li.getDArriveDate());
+                            sy2.setOmpoIdItem(li.getOmpoIdItem());
+                            sy2.setITaxPrice(li.getITaxPrice());
+                            if(sy2.getGuangpeiGateWidth()==null||sy2.getGuangpeiGateWidth().equals("/")||sy2.getGuangpeiGateWidth().equals("")){
+                                sy2.setGuangpeiGateWidth(li.getGuangpeiGateWidth());
+                            }
+                            sy2.setSupplier(li.getSupplier());
+                            if(sy2.getInventoryCcode().substring(0,2).equals("19")){
+                                sy2.setGarmentFactory(li.getSupplier());
+                            }/*else if(sy.getCustomerAbbreviation().equals("International Apparel Group") || sy.getCustomerAbbreviation().equals("宁波森语") ) {
+                            sy2.setGarmentFactory(queryGSupplier(sy.getOrderNumber(),sy.getAccount(),sy.getCustomerCode()));
+                        }*/else {
+                                sy2.setGarmentFactory(sy.getGarmentFactory());
+                            }
+                            sy2.setSupplierCode(li.getSupplierCode());
+
+                            if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
+                                continue;
+                            }
+                            if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
+                                List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
+                                if(rsup.size()>0){
+                                    sy2.setRSupplierCode(rsup.get(0));
+                                    sy2.setRSupplier(rsup.get(1));
+                                }
+                            }
+
+                            indexi++;
+                            SyOrderDataItem syEntity = new SyOrderDataItem();
+                            BeanUtils.copyProperties(sy2, syEntity);
+                            if(indexi>1 ){
+                                syEntity.setId(syEntity.getId()+"-("+indexi+")");
+                            }
+
+                            if(isNewOrder){
+                                String item = syOrderDataItemService.queryItemMub(syEntity.getId());
+                                if(item!=null && item.equals("已被参照")) {
+                                    idsID.add(syEntity.getId());
+                                    continue;
+                                }else {
+                                    if(indexi>1){
+                                        idsID.add(syEntity.getId());
+                                    }
+                                    //更新数据前 删除旧数据防止id冲突
+                                    syOrderDataItemService.deleteByID(syEntity.getId());
+                                }
+                                syOrderDataItemService.save(syEntity);
+                                continue;
+                            }
+                            syItemList.add(syEntity);
                         }
+
                     }
-                    if(isNewOrder){
-                        syOrderDataItemService.save(sy2);
-                        continue;
-                    }
-                    syItemList.add(sy2);
+
+
+//                    if(ordervo != null){
+//                        sy2.setOmpoAccount(ordervo.getOmpoAccount());
+//                        sy2.setOmpoCode(ordervo.getOmpoCode());
+//                        sy2.setOmpoId(ordervo.getOmpoId());
+//                        sy2.setDArriveDate(ordervo.getDArriveDate());
+//                        sy2.setOmpoIdItem(ordervo.getOmpoIdItem());
+//                        sy2.setITaxPrice(ordervo.getITaxPrice());
+//                        if(sy2.getGuangpeiGateWidth()==null||sy2.getGuangpeiGateWidth().equals("/")||sy2.getGuangpeiGateWidth().equals("")){
+//                            sy2.setGuangpeiGateWidth(ordervo.getGuangpeiGateWidth());
+//                        }
+//                        sy2.setSupplier(ordervo.getSupplier());
+//                        if(sy2.getInventoryCcode().substring(0,2).equals("19")){
+//                            sy2.setGarmentFactory(ordervo.getSupplier());
+//                        }/*else if(sy.getCustomerAbbreviation().equals("International Apparel Group") || sy.getCustomerAbbreviation().equals("宁波森语") ) {
+//                            sy2.setGarmentFactory(queryGSupplier(sy.getOrderNumber(),sy.getAccount(),sy.getCustomerCode()));
+//                        }*/else {
+//                            sy2.setGarmentFactory(sy.getGarmentFactory());
+//                        }
+//                        sy2.setSupplierCode(ordervo.getSupplierCode());
+//                    }else {
+//                        continue;
+//                    }
+//                    if(sy2.getOmpoIdItem()==null || sy2.getOmpoIdItem().equals("")){
+//                        continue;
+//                    }
+//                    if(sy2.getOmpoIdItem()!=null && sy.getAccount()!=null){
+//                        List<String> rsup = queryRSupplier(sy2.getOmpoIdItem(),sy.getAccount());
+//                        if(rsup.size()>0){
+//                            sy2.setRSupplierCode(rsup.get(0));
+//                            sy2.setRSupplier(rsup.get(1));
+//                        }
+//                    }
+//                    if(isNewOrder){
+//                        syOrderDataItemService.save(sy2);
+//                        continue;
+//                    }
+//                    syItemList.add(sy2);
+
+
+
+
+
                 }
                 //处理U8已经删除的数据,单证系统也需要删除
                 //第一查询改订单下所有行数据
@@ -509,11 +618,11 @@ public class AddOrderJob implements Job,ApplicationContextAware {
     /*
    查询最终供应商数据
     */
-    public SyOrderDataVO queryOrder(String orderItemID) throws Exception{
+    public List<SyOrderDataVO> queryOrder(String orderItemID) throws Exception{
         SyOrderDataVO syOrderDataVO = new SyOrderDataVO();
         syOrderDataVO.setId(orderItemID);
         List<Map<String, Object>> listSon = new ArrayList<>();
-        SyOrderDataVO result = new SyOrderDataVO();
+        List<SyOrderDataVO> result = new ArrayList<>();
         /*
         查询账套用于判断
          */
@@ -545,14 +654,14 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
                     " FROM OM_MOMain om" +
                     " LEFT JOIN  OM_MODetails  od on om.MOID =od.MOID" +
-                    " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
+                    " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
                     ") p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode" +
                     " where s.autoid ="+syOrderDataVO.getId();
             listSon = senYuDataSourceOne.queryForList(sql);
             List<JSONObject> jian = JsonChangeUtils.toJSONObject(listSon);
             for (JSONObject jsonObject:jian) {
-                result = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
+                result.add(JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class));
             }
             return result;
 
@@ -567,7 +676,7 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     " pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
                     " FROM PO_Pomain pm" +
                     " LEFT JOIN  PO_Podetails pd on pm.POID=pd.POID" +
-                    " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
+                    " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
                     ") p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode"+
                     " where s.autoid ="+syOrderDataVO.getId();
@@ -577,10 +686,11 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                 syOrderDataVO = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
             }
             if(syOrderDataVO.getSupplier()==null){
-                return syOrderDataVO;
+                return result;
             }
             if(!syOrderDataVO.getSupplier().equals("马菲羊")){
-                return syOrderDataVO;
+                result.add(syOrderDataVO);
+                return result;
             }
             String sql2 = "SELECT" +
                     " ompoCode,ompoIdItem,ompoId,supplierCode,v.cVenAbbName as supplier,iTaxPrice,dArriveDate,guangpeiGateWidth," +account[2]+" as ompoAccount"+
@@ -594,21 +704,21 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     " pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
                     " FROM PO_Pomain pm" +
                     " LEFT JOIN  PO_Podetails pd on pm.POID=pd.POID" +
-                    " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
+                    " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
                     " UNION" +
                     " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem," +
                     " od.cDefine23  as guangpeiGateWidth,od.dArriveDate,"+
                     " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
                     " FROM OM_MOMain om" +
                     " LEFT JOIN  OM_MODetails  od on om.MOID =od.MOID" +
-                    " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
+                    " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
                     " ) p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode"+
                     " where hy.predid ="+syOrderDataVO.getOmpoIdItem() +" and ss.cSOCode='"+syOrderDataVO.getOmpoCode()+"'";
             listSon = senYuDataSourceThree.queryForList(sql2);
             List<JSONObject> jian2 = JsonChangeUtils.toJSONObject(listSon);
             for (JSONObject jsonObject:jian2) {
-                result = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
+                result.add(JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class));
             }
             return result;
 
@@ -623,21 +733,21 @@ public class AddOrderJob implements Job,ApplicationContextAware {
                     " pm.cVenCode as supplierCode,pd.iTaxPrice,pd.cInvCode,pd.iorderdid as isosid" +
                     " FROM PO_Pomain pm" +
                     " LEFT JOIN  PO_Podetails pd on pm.POID=pd.POID" +
-                    " where pm.iverifystateex = 2 and (pm.cCloser is null or pm.cCloser='asuser')" +
+                    " where pm.iverifystateex = 2 and (pd.cbCloser is null or pd.cbCloser='asuser')" +
                     " UNION" +
                     " SELECT om.cCode as ompoCode,om.MOID as ompoId,od.MODetailsID as ompoIdItem," +
                     " od.cDefine23  as guangpeiGateWidth,od.dArriveDate,"+
                     " om.cVenCode as supplierCode,od.iTaxPrice,od.cInvCode,od.isosid" +
                     " FROM OM_MOMain om" +
                     " LEFT JOIN  OM_MODetails  od on om.MOID =od.MOID" +
-                    " where om.iVerifyStateNew = 2 and (om.cCloser is null or om.cCloser='asuser')" +
+                    " where om.iVerifyStateNew = 2 and (od.cbCloser is null or od.cbCloser='asuser')" +
                     ") p on s.isosid  = p.isosid and s.cInvCode = p.cInvCode" +
                     " left join Vendor v on p.supplierCode=v.cVenCode"+
                     " where s.autoid ="+syOrderDataVO.getId();
             listSon = senYuDataSourceThree.queryForList(sql);
             List<JSONObject> jian = JsonChangeUtils.toJSONObject(listSon);
             for (JSONObject jsonObject:jian) {
-                result = JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class);
+                result.add(JSONObject.toJavaObject(jsonObject, SyOrderDataVO.class));
             }
             return result;
 

+ 15 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -752,6 +752,11 @@ public class SyPackingListFabricController implements Job {
 		 return Result.OK("文件导入失败!");
 	 }
 
+	 public String clearStr(String clearStr){
+	 	clearStr=clearStr.replace("\n","");
+	 	return clearStr;
+	 }
+
 	 public Map<String,SyPackingListFabric>  refreshSheet(Workbook workbook1) throws ParseException {
 		 Map<String,SyPackingListFabric> maps=new HashMap<>();
 		 Iterator sheets=workbook1.sheetIterator();
@@ -859,7 +864,11 @@ public class SyPackingListFabricController implements Job {
 					 mainStrs.add(row.getCell(16)==null?"":row.getCell(16).toString());
 					 mainStrs.add(row.getCell(20)==null?"":row.getCell(16).toString());
 				 }else if(x==2){
-					 main =new SyPackingListFabric(mainStrs.toArray(new String[mainStrs.size()]));
+					 List<String> mainStrs1=new ArrayList<>();
+					 mainStrs.forEach(m->{
+						 mainStrs1.add(clearStr(m));
+					 });
+					 main =new SyPackingListFabric(mainStrs1.toArray(new String[mainStrs1.size()]));
 				 }else if(x>3){
 					 if(row.getCell(1)==null||row.getCell(1).toString().length()<10){//如果这一列为空就退出
 						 break;
@@ -917,7 +926,11 @@ public class SyPackingListFabricController implements Job {
 
 						 }*/
 					 }
-					 SyPackingListFabricItem syPackingListFabricItem=new SyPackingListFabricItem(itemStrs.toArray(new String[itemStrs.size()]),x+1);
+					 List<String> itemStrs1=new ArrayList<>();
+					 itemStrs.forEach(m->{
+						 itemStrs1.add(clearStr(m));
+					 });
+					 SyPackingListFabricItem syPackingListFabricItem=new SyPackingListFabricItem(itemStrs1.toArray(new String[itemStrs1.size()]),x+1);
 					 items.add(syPackingListFabricItem);
 				 }
 			 }

+ 3 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -1905,7 +1905,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 //			e.printStackTrace();
 //		}
 		String recording=null;
-		if(main.getRecording()!=null){
+		if(main.getRecording()!=null&&main.getRecording().indexOf(",")>-1){
 			String[] recordings=main.getRecording().split(",");
 			Map<String,Map<String,String>> maps=new HashMap<>();
 			for (int i=0;i<recordings.length;i++){
@@ -1919,6 +1919,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				switch (maps.get(account).get("index")){
 					case "1":	//代表已完成第一道
 						//JSONObject jsonObject1=resturn1.getJSONObject(0);//采购入库单
+						text(mapList,mapt.get("ordertype")+"入库单");
 						String purchaseinName=maps.get(account).get("code");//获取采购入库单
 						//String purchaseinName=jsonObject1.get("U8ReceiptNo").toString();//获取销售发货单
 						List<Map<String,Object>> purchaseinMaps= syPackingListTailoringMapper.getRdRecord01(purchaseinName);
@@ -2152,7 +2153,7 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 	 * @param recording
 	 */
 	public void recording(SyPackingListFabric syPackingListTailoring,String recording){
-		if(syPackingListTailoring.getRecording()!=null){
+		if(syPackingListTailoring.getRecording()!=null&&syPackingListTailoring.getRecording().indexOf(",")>-1){
 			String[] recordings=syPackingListTailoring.getRecording().split(",");
 			Map<String,Map<String,String>> maps=new HashMap<>();
 			for (int i=0;i<recordings.length;i++){