Browse Source

成本分配表修改,染厂入库单调整

huxy 1 year ago
parent
commit
b801b5a900

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

@@ -29,5 +29,5 @@ public interface SyCostAllocationMapper extends BaseMapper<SyCostAllocation> {
 
 
     //查询销售订单总数量
     //查询销售订单总数量
     @DS("multi-three")
     @DS("multi-three")
-    SyCostAllocation querySalerIauantity(@Param("csocode") String csocode);
+    SyCostAllocation querySalerIauantity(@Param("csocode") List csocode);
 }
 }

+ 4 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/cost/mapper/xml/SyCostAllocationFabricMapper.xml

@@ -39,7 +39,10 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		from
 		from
 		(
 		(
 		select vim.cInvCode, max(vim.goodsName) as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
 		select vim.cInvCode, max(vim.goodsName) as goodsName,sum(vim.unitConsumption) as unitConsumption,sum(vim.planQuantity) as planQuantity,
-		sum(vim.usageQuantity) as usageQuantity from UFDATA_103_2021.dbo.cost_allocation_fabric_view vif
+		sum(vim.usageQuantity) as usageQuantity from
+		(select max(cInvCode) cInvCode,count(1) a from UFDATA_103_2021.dbo.cost_allocation_fabric_view
+		where trim(cCode) like CONCAT(#{code},'%') GROUP BY cInvCode)
+		vif
 		join(
 		join(
 		select om.cCode as cCode,oti.cInvCode,max(oti.cInvName) as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
 		select om.cCode as cCode,oti.cInvCode,max(oti.cInvName) as goodsName,sum(ot.iQuantity)/sum(od.iQuantity) as unitConsumption,sum(ot.iQuantity) as planQuantity,
 		sum(ot.iSendQTY) as usageQuantity
 		sum(ot.iSendQTY) as usageQuantity
@@ -54,7 +57,6 @@ where trim(cSOCode) like CONCAT(#{code},'%') and cSOCode not like '%样%'
 		and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) ) or om.cCloser='asuser')
 		and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) ) or om.cCloser='asuser')
 		GROUP BY om.cCode,oti.cInvCode
 		GROUP BY om.cCode,oti.cInvCode
 		) vim on vim.cInvCode = vif.cInvCode
 		) vim on vim.cInvCode = vif.cInvCode
-		where trim(vif.cCode) like CONCAT(#{code},'%')
 		GROUP BY vim.cInvCode
 		GROUP BY vim.cInvCode
 		) tab
 		) tab
 		left join
 		left join

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

@@ -20,7 +20,7 @@
     <select id="queryByCostHead" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
     <select id="queryByCostHead" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
          SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'101' as pkOrg,
          SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'101' as pkOrg,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
-            max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
+            STRING_AGG(ss.cSOCode,',') as garmentContractno,max(de.cDepName) as department,
             max(cc.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
             max(cc.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
             max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal, 
             max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal, 
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity    
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity    
@@ -51,7 +51,7 @@
         
         
         SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'103' as pkOrg,
         SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'103' as pkOrg,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
-            max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
+            STRING_AGG(ss.cSOCode,',') as garmentContractno,max(de.cDepName) as department,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
             max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal, 
             max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal, 
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity    
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity    
@@ -89,7 +89,7 @@
         
         
         SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'103' as pkOrg,
         SELECT max(ss.iExchRate) as exchangeRate,min(s.iTaxUnitPrice) as soPrice,'103' as pkOrg,
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
             max(o.omCode) as planNum,max(s.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales, 
-            max(ss.cSOCode) as garmentContractno,max(de.cDepName) as department, 
+            STRING_AGG(ss.cSOCode,',') as garmentContractno,max(de.cDepName) as department,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
             max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
             max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal, 
             max(ss.iTaxRate) as taxrate,max(ss.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal, 
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity    
             sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity    
@@ -162,6 +162,53 @@
         inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss1.cCusCode = cu.cCusCode
         inner JOIN UFDATA_101_2021.dbo.Customer cu ON ss1.cCusCode = cu.cCusCode
         WHERE cc.cCusCode in ('0001') and ss.cCusCode in ('T020001') and c.cInvCcode like '19%' GROUP BY v.cVenAbbName
         WHERE cc.cCusCode in ('0001') and ss.cCusCode in ('T020001') and c.cInvCcode like '19%' GROUP BY v.cVenAbbName
 
 
+
+    /* UNION ALL
+
+
+
+
+             SELECT max(ss1.iExchRate) as exchangeRate,min(s1.iTaxUnitPrice) as soPrice,'103' as pkOrg,
+            max(o.omCode) as planNum,max(s1.cdefine22) as poStyleNum,max(pe.cPersonName) as exportSales,
+            max(ss1.cSOCode) as garmentContractno,max(de.cDepName) as department,
+            max(cu.cCusAbbName) as customerShortame,v.cVenAbbName as processUnit,
+            max(ss1.iTaxRate) as taxrate,max(ss1.cMaker) as preparedBy,sum(s.iNatSum) as salesordersLocaltotal,
+            sum(s.iSum) as salesrrdersOriginaltotal,sum(o.iQuantity) as planQuantity
+        FROM  UFDATA_103_2021.dbo.SO_SODetails a
+        inner JOIN UFDATA_103_2021.dbo.SO_SOMain b on b.ID= a.ID
+        inner JOIN (
+                     SELECT
+                     om.cCode AS omCode, od.csoordercode,
+                     om.MOID AS ompoId,od.MODetailsID AS ompoIdItem,
+                     om.cVenCode AS supplierCode,od.cInvCode,od.isosid,od.iQuantity
+                     FROM
+                     UFDATA_103_2021.dbo.OM_MOMain om
+                     inner JOIN UFDATA_103_2021.dbo.OM_MODetails od ON om.MOID = od.MOID
+                        inner JOIN (select MOID,max(iSendQTY) as iSendQTY from UFDATA_103_2021.dbo.OM_MOMaterials GROUP BY MOID) ot on ot.MOID=om.MOID
+                           WHERE
+                     om.iVerifyStateNew = 2  and om.cCode like CONCAT('SYE604','%')
+                     and (om.cCloser is null or ( (od.iReceivedQTY is not null or od.iReceivedQTY != 0) and (ot.iSendQTY is not null or ot.iSendQTY !=0) )or om.cCloser='asuser')
+                     ) o ON a.isosid  = o.isosid AND a.cInvCode = o.cInvCode
+        inner JOIN UFDATA_103_2021.dbo.Vendor v ON o.supplierCode= v.cVenCode
+        inner JOIN UFDATA_103_2021.dbo.Inventory c on c.cInvCode=a.cInvCode
+        inner JOIN UFDATA_103_2021.dbo.Person  pe ON b.cPersonCode = pe.cPersonCode
+        inner JOIN UFDATA_103_2021.dbo.Department de ON b.cDepCode = de.cDepCode
+        inner JOIN UFDATA_103_2021.dbo.Customer cc ON b.cCusCode = cc.cCusCode
+        left join UFDATA_102_2021.dbo.PO_Pomain f on f.cPOID=o.csoordercode
+        left join UFDATA_102_2021.dbo.po_podetails g on g.POID=f.POID and g.ivouchrowno=a.iRowNo
+        left join UFDATA_102_2021.dbo.SO_SODetails s on s.iSOsID=g.iorderdid
+        left join UFDATA_102_2021.dbo.so_somain ss on ss.id=s.id
+
+				left join UFDATA_101_2021.dbo.PO_Pomain f1 on f1.cPOID=ss.csocode
+        left join UFDATA_101_2021.dbo.po_podetails g1 on g1.POID=f1.POID and g1.ivouchrowno=s.iRowNo
+        left join UFDATA_101_2021.dbo.SO_SODetails s1 on s1.iSOsID=g1.iorderdid
+        left join UFDATA_101_2021.dbo.so_somain ss1 on ss1.id=s1.id
+
+        left join UFDATA_101_2021.dbo.Person j on j.cPersonCode=ss1.cPersonCode
+        left JOIN UFDATA_101_2021.dbo.Customer cu ON ss1.cCusCode = cu.cCusCode
+       -- WHERE cc.cCusCode in ('0001') and ss.cCusCode in ('T020001') and c.cInvCcode like '19%'
+				GROUP BY v.cVenAbbName;
+*/
     </select>
     </select>
 
 
 
 
@@ -212,17 +259,27 @@ select omi.cInvName as cInvName,sum(pbs.iOriSum) as iOriSum,sum(round(pbs.iOriSu
     <select id="querySalerIauantity" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
     <select id="querySalerIauantity" resultType="org.jeecg.modules.cost.entity.SyCostAllocation">
 
 
 select t.salerIquantity from (
 select t.salerIquantity from (
-select sum(iquantity) as salerIquantity from UFDATA_101_2021.dbo.SO_SODetails where csocode = #{csocode}
+select sum(iquantity) as salerIquantity from UFDATA_101_2021.dbo.SO_SODetails where csocode in
+<foreach collection="csocode" item="value" index="index" open="(" separator="," close=")">
+#{value}
+</foreach>
 union all
 union all
 select sum(iquantity) as salerIquantity from UFDATA_102_2021.dbo.SO_SODetails a
 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.SO_SOMain b on a.ID = b.ID
 	inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
 	inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
- WHERE b.cCusCode not in ('0001','T020001') and a.csocode = #{csocode}
+ 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
 union all
 select sum(iquantity) as salerIquantity from UFDATA_103_2021.dbo.SO_SODetails a
 select sum(iquantity) as salerIquantity from UFDATA_103_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.SO_SOMain b on a.ID = b.ID
 	inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
 	inner JOIN UFDATA_102_2021.dbo.Customer cu ON b.cCusCode = cu.cCusCode
- WHERE b.cCusCode not in ('0001','T020001') and a.csocode = #{csocode}
+ WHERE b.cCusCode not in ('0001','T020001')
+ and a.csocode in
+<foreach collection="csocode" item="value" index="index" open="(" separator="," close=")">
+    #{value}
+</foreach>
 ) as t where t.salerIquantity is not null
 ) as t where t.salerIquantity is not null
 
 
     </select>
     </select>

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

@@ -173,7 +173,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
     //查询森宇u8数据
     //查询森宇u8数据
     @Override
     @Override
     public SyCostAllocation queryByPlanNum(String plannum, String type) {
     public SyCostAllocation queryByPlanNum(String plannum, String type) {
-        //返回数据
+        //返回数据 garmentContractno
         SyCostAllocation syCostAllocation=new SyCostAllocation();
         SyCostAllocation syCostAllocation=new SyCostAllocation();
 
 
         //查询面损表头 判断是否有面损数据
         //查询面损表头 判断是否有面损数据
@@ -190,7 +190,11 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
             return null;
             return null;
         }
         }
         syCostAllocation = list.get(0);
         syCostAllocation = list.get(0);
-
+//        System.out.println("Arrays.asList(syCostAllocation.getGarmentContractno().split(\",\"))\t"+Arrays.asList(syCostAllocation.getGarmentContractno().split(",")));
+        List<String> strs=Arrays.asList(syCostAllocation.getGarmentContractno().split(",")).stream().distinct().collect(Collectors.toList());
+//        System.out.println("获取成衣strs.size\t"+strs.size());
+//        System.out.println("获取成衣strs\t"+strs);
+        syCostAllocation.setGarmentContractno(strs.toString().substring(1,strs.toString().length()-2));
         // 销售订单附件
         // 销售订单附件
         List<AccessorItem> accessorItemList = new ArrayList<>();
         List<AccessorItem> accessorItemList = new ArrayList<>();
         if (org.jeecg.modules.system.util.oConvertUtils.isNotEmpty(syCostAllocation.getGarmentContractno())) {
         if (org.jeecg.modules.system.util.oConvertUtils.isNotEmpty(syCostAllocation.getGarmentContractno())) {
@@ -404,7 +408,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
 
 
 //            2023.08.30 改为美元金额 = 人民币金额除以销售订单汇率
 //            2023.08.30 改为美元金额 = 人民币金额除以销售订单汇率
             if(oConvertUtils.isNotEmpty(Ingredient.getRmbAmount())){
             if(oConvertUtils.isNotEmpty(Ingredient.getRmbAmount())){
-                Ingredient.setUsdAmount(Ingredient.getRmbAmount().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
+               // Ingredient.setUsdAmount(Ingredient.getRmbAmount().divide(syCostAllocation.getExchangeRate(),2,BigDecimal.ROUND_HALF_UP));
             }
             }
              //辅料成本 美元和人民币
              //辅料成本 美元和人民币
             if(Ingredient.getUsdAmount()!=null){
             if(Ingredient.getUsdAmount()!=null){
@@ -493,7 +497,7 @@ public class SyCostAllocationServiceImpl extends ServiceImpl<SyCostAllocationMap
         //费用支出
         //费用支出
         List<SyCostAllocationCostpay> syCostAllocationCostpays = syCostAllocationCostpayMapper.queryByCostPay(plannum);
         List<SyCostAllocationCostpay> syCostAllocationCostpays = syCostAllocationCostpayMapper.queryByCostPay(plannum);
         //查询销售订单总数量(用来计算占比),有一个销售订单关联多个委外订单的情况,使用占比算金额
         //查询销售订单总数量(用来计算占比),有一个销售订单关联多个委外订单的情况,使用占比算金额
-        SyCostAllocation entity = syCostAllocationMapper.querySalerIauantity(syCostAllocation.getGarmentContractno());
+        SyCostAllocation entity = syCostAllocationMapper.querySalerIauantity(strs);
         //计算占比
         //计算占比
         BigDecimal zhanBi = syCostAllocation.getPlanQuantity().divide(entity.getSalerIquantity(),2);
         BigDecimal zhanBi = syCostAllocation.getPlanQuantity().divide(entity.getSalerIquantity(),2);
 
 

+ 70 - 14
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java

@@ -25,6 +25,7 @@ import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.hssf.util.HSSFColor;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellRangeAddress;
+import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.hibernate.engine.jdbc.Size;
 import org.hibernate.engine.jdbc.Size;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.exception.JeecgBootException;
@@ -2182,13 +2183,40 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                                 throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
                                 throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
                                         sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
                                         sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
                             }else{
                             }else{
+//                                if(cell!=null){
+//                                    cell.setCellType(CellType.STRING);//获取的都转换成String
+//                                    if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
+//                                        throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
+//                                                sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
+//                                    }
+//                                    strs.add(cell.getStringCellValue());
+//                                }else{
+//                                    strs.add(null);
+//                                }
                                 if(cell!=null){
                                 if(cell!=null){
-                                    cell.setCellType(CellType.STRING);//获取的都转换成String
-                                    if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
-                                        throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
-                                                sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
+                                    FormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook1);
+                                    //获取单元格内容的类型 =R17-Q17*0.35
+                                    CellType cellType = cell.getCellType();
+                                    //System.out.println("是公式吗\t"+(cellType.equals(CellType.FORMULA)==true?"是":"否"));
+                                    //判断是否存储的为公式,此处本可以不加判断
+                                    if (cellType.equals(CellType.FORMULA)){
+                                        // System.out.println("formula cell\t"+cell);
+                                        //获取公式,可以理解为已String类型获取cell的值输出
+                                        String cellFormula = cell.getCellFormula();
+                                        //System.out.println(cellFormula);
+                                        //执行公式,此处cell的值就是公式
+                                        CellValue evaluate = formulaEvaluator.evaluate(cell);
+                                        //System.out.println(evaluate.formatAsString());
+                                        strs.add(evaluate.formatAsString());
+                                    }else{
+                                        // System.out.println("string cell\t"+cell);
+                                        cell.setCellType(CellType.STRING);//获取的都转换成String
+                                        if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
+                                            throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
+                                                    sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
+                                        }
+                                        strs.add(cell.toString());
                                     }
                                     }
-                                    strs.add(cell.getStringCellValue());
                                 }else{
                                 }else{
                                     strs.add(null);
                                     strs.add(null);
                                 }
                                 }
@@ -2285,10 +2313,10 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             list.add("包数/箱");
             list.add("包数/箱");
             list.add("件数/箱");
             list.add("件数/箱");
             list.add("包数");
             list.add("包数");
-            list.add("PCS/PACK");//英文
-            list.add("PACKS/CTN");//英文
-            list.add("PCS/CTN");//英文
-            list.add("PACK QTY");//英文
+            list.add("PCS/PACK");//
+            list.add("PACKS/CTN");//
+            list.add("PCS/CTN");//
+            list.add("PACK QTY");//
 
 
             System.out.println("第"+num+"页\t"+sheet.getSheetName());
             System.out.println("第"+num+"页\t"+sheet.getSheetName());
             int num1=10;
             int num1=10;
@@ -2342,13 +2370,41 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                                 throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
                                 throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
                                         sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
                                         sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
                             }else{
                             }else{
+//                                if(cell!=null){
+//                                    System.out.println("cell2\t"+cell2);
+//                                    cell.setCellType(CellType.STRING);//获取的都转换成String
+//                                    if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
+//                                        throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
+//                                                sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
+//                                    }
+//                                    strs.add(cell.getStringCellValue());
+//                                }else{
+//                                    strs.add(null);
+//                                }
                                 if(cell!=null){
                                 if(cell!=null){
-                                    cell.setCellType(CellType.STRING);//获取的都转换成String
-                                    if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
-                                        throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
-                                                sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
+                                    FormulaEvaluator formulaEvaluator = new XSSFFormulaEvaluator((XSSFWorkbook) workbook1);
+                                    //获取单元格内容的类型 =R17-Q17*0.35
+                                    CellType cellType = cell.getCellType();
+                                    //System.out.println("是公式吗\t"+(cellType.equals(CellType.FORMULA)==true?"是":"否"));
+                                    //判断是否存储的为公式,此处本可以不加判断
+                                    if (cellType.equals(CellType.FORMULA)){
+                                        // System.out.println("formula cell\t"+cell);
+                                        //获取公式,可以理解为已String类型获取cell的值输出
+                                        String cellFormula = cell.getCellFormula();
+                                        //System.out.println(cellFormula);
+                                        //执行公式,此处cell的值就是公式
+                                        CellValue evaluate = formulaEvaluator.evaluate(cell);
+                                        //System.out.println(evaluate.formatAsString());
+                                        strs.add(evaluate.formatAsString());
+                                    }else{
+                                        // System.out.println("string cell\t"+cell);
+                                        cell.setCellType(CellType.STRING);//获取的都转换成String
+                                        if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
+                                            throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
+                                                    sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
+                                        }
+                                        strs.add(cell.toString());
                                     }
                                     }
-                                    strs.add(cell.getStringCellValue());
                                 }else{
                                 }else{
                                     strs.add(null);
                                     strs.add(null);
                                 }
                                 }

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingListItem.java

@@ -356,7 +356,8 @@ public class SyPreAssembledPackingListItem implements Serializable {
 			unitPrice=new BigDecimal("0");//初始化
 			unitPrice=new BigDecimal("0");//初始化
 			totalPrice=new BigDecimal("0");//初始化
 			totalPrice=new BigDecimal("0");//初始化
 			planQuantity=new BigDecimal(parsms[10]);
 			planQuantity=new BigDecimal(parsms[10]);
-			boxNumber=new BigDecimal(Integer.parseInt(endCaseNumber)-Integer.parseInt(startingBoxNumber)+1);//箱数
+			boxNumber=new BigDecimal(Double.parseDouble(endCaseNumber)-Double.parseDouble(startingBoxNumber)+1);//箱数
+			System.out.println("boxNumber\t"+boxNumber);
 			netWeight=new BigDecimal(parsms[11]);
 			netWeight=new BigDecimal(parsms[11]);
 			grossWeight=new BigDecimal(parsms[12]);
 			grossWeight=new BigDecimal(parsms[12]);
 			outerBoxLength=new BigDecimal(parsms[13]);
 			outerBoxLength=new BigDecimal(parsms[13]);
@@ -420,6 +421,7 @@ public class SyPreAssembledPackingListItem implements Serializable {
 			this.totalGrossWeight=this.boxNumber.multiply(this.grossWeight);
 			this.totalGrossWeight=this.boxNumber.multiply(this.grossWeight);
 			this.totalVolume=this.boxNumber.multiply(this.outerBoxLength).multiply(this.outerBoxWidth).multiply(this.outerBoxHeight).divide(new BigDecimal(1000000));
 			this.totalVolume=this.boxNumber.multiply(this.outerBoxLength).multiply(this.outerBoxWidth).multiply(this.outerBoxHeight).divide(new BigDecimal(1000000));
 		}catch (Exception e){
 		}catch (Exception e){
+			e.printStackTrace();
 			throw new JeecgBootException("第"+error.get("num")+"页数据有问题,需要调整");
 			throw new JeecgBootException("第"+error.get("num")+"页数据有问题,需要调整");
 		}
 		}
 	}
 	}

+ 3 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/mapper/xml/SyPackingListFabricMapper.xml

@@ -170,8 +170,10 @@
             inner join (SELECT om1.isosid,om2.cinvcode
             inner join (SELECT om1.isosid,om2.cinvcode
             FROM om_modetails om1  left join OM_MOMaterials om2
             FROM om_modetails om1  left join OM_MOMaterials om2
             on om1.MODetailsID=om2.MODetailsID
             on om1.MODetailsID=om2.MODetailsID
-            where  om1.MODetailsID=#{id}  and om1.cinvcode=#{cinvCode} )om2
+            where  om1.MODetailsID=#{id}  and om1.cinvcode=#{cinvCode}
+            and (cbCloser is null or cbCloser='asuser') )om2
             on om1.isosid=om2.isosid and om1.cinvcode=om2.cinvcode
             on om1.isosid=om2.isosid and om1.cinvcode=om2.cinvcode
+            and (cbCloser is null or cbCloser='asuser')
         ) om3
         ) om3
         on om1.moid=om3.moid
         on om1.moid=om3.moid
     </select>
     </select>

+ 2 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringMapper.xml

@@ -265,7 +265,7 @@
     </select>
     </select>
 
 
     <select id="getSoMain" parameterType="java.lang.String" resultType="java.util.HashMap">
     <select id="getSoMain" parameterType="java.lang.String" resultType="java.util.HashMap">
-        select cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,iExchRate,cCusCode,cSOCode,cSTCode,cexch_name   from SO_SOMain WHERE id=#{id}
+        select cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,iExchRate,cCusCode,cSOCode,cSTCode,cexch_name,cDefine13,cDefine11   from SO_SOMain WHERE id=#{id}
     </select>
     </select>
 
 
     <select id="getSoMainItem" parameterType="java.lang.String" resultType="java.util.HashMap">
     <select id="getSoMainItem" parameterType="java.lang.String" resultType="java.util.HashMap">
@@ -397,7 +397,7 @@
 
 
 
 
     <select id="getSoMainCode" parameterType="java.lang.String" resultType="java.util.HashMap">
     <select id="getSoMainCode" parameterType="java.lang.String" resultType="java.util.HashMap">
-        select cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,iExchRate,cCusCode,cSOCode,cSTCode,cexch_name,iTaxRate
+        select cPersonCode,cDepCode,cBusType,cPayCode,cexch_name,iExchRate,cCusCode,cSOCode,cSTCode,cexch_name,iTaxRate,cDefine13,cDefine11
         from SO_SOMain WHERE  cSOCode=
         from SO_SOMain WHERE  cSOCode=
         (select top 1 cSOCode  from DispatchList where cDLCode
         (select top 1 cSOCode  from DispatchList where cDLCode
         in (select cbuscode from rdrecord32
         in (select cbuscode from rdrecord32

+ 17 - 8
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/service/impl/SyPackingListTailoringServiceImpl.java

@@ -1201,12 +1201,12 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			map6.put("CDEFINE6",main.getTheFinalShippingDate2());//合同日期
 			map6.put("CDEFINE6",main.getTheFinalShippingDate2());//合同日期
 
 
 			if(main.getShippingOrderNumber()!=null){
 			if(main.getShippingOrderNumber()!=null){
-				map.put("CDEFINE10",main.getShippingOrderNumber());
-				//map2.put("CDEFINE10",main.getShippingOrderNumber());
-				map3.put("CDEFINE10",main.getShippingOrderNumber());
-				map4.put("CDEFINE10",main.getShippingOrderNumber());
-				map5.put("CDEFINE10",main.getShippingOrderNumber());
-				map6.put("CDEFINE10",main.getShippingOrderNumber());
+				map.put("CDEFINE10",main.getShippingOrderNumber().replace("&","(-)"));
+				//map2.put("CDEFINE10",main.getShippingOrderNumber().replace("&","(-)"));
+				map3.put("CDEFINE10",main.getShippingOrderNumber().replace("&","(-)"));
+				map4.put("CDEFINE10",main.getShippingOrderNumber().replace("&","(-)"));
+				map5.put("CDEFINE10",main.getShippingOrderNumber().replace("&","(-)"));
+				map6.put("CDEFINE10",main.getShippingOrderNumber().replace("&","(-)"));
 			}
 			}
 
 
 			JSONArray mapItems=new JSONArray();
 			JSONArray mapItems=new JSONArray();
@@ -1441,6 +1441,14 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						map3.put("IEXCHRATE",order.get("iExchRate"));//IEXCHRATE 汇率
 						map3.put("IEXCHRATE",order.get("iExchRate"));//IEXCHRATE 汇率
 						map4.put("IEXCHRATE",order.get("iExchRate"));//IEXCHRATE 汇率
 						map4.put("IEXCHRATE",order.get("iExchRate"));//IEXCHRATE 汇率
 						//map.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,接口默认人民币)
 						//map.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,接口默认人民币)
+						map3.put("CDEFINE13",order.get("cDefine13"));// 客户名称
+						if (order.get("cDefine13")!=null&&order.get("cDefine13").toString().indexOf("&")>-1){
+							map3.put("CDEFINE13",order.get("cDefine13").toString().replace("&","(-)"));// 客户名称
+						}
+						map3.put("CDEFINE11",order.get("cDefine11"));// 客户名称
+						if (order.get("cDefine11")!=null&&order.get("cDefine11").toString().indexOf("&")>-1){
+							map3.put("CDEFINE11",order.get("cDefine11").toString().replace("&","(-)"));// 客户名称
+						}
 						map3.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
 						map3.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
 						map4.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
 						map4.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
 						map6.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
 						map6.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
@@ -2255,7 +2263,8 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			jsonObject1.put("CACCID",account);//账套号
 			jsonObject1.put("CACCID",account);//账套号
 			jsonObject1.put("CTYPE","普通");//发票类型
 			jsonObject1.put("CTYPE","普通");//发票类型
 			jsonObject1.put("CGLTYPE","销售出库单");//上游单据
 			jsonObject1.put("CGLTYPE","销售出库单");//上游单据
-			jsonObject1.put("CDEFINE11",syPackingListTailoring.getEndCustomer());//最终客户
+			jsonObject1.put("CDEFINE13",syPackingListTailoring.getShippingOrderNumber().replace("&","(-)"));// 客户名称
+			jsonObject1.put("CDEFINE11",syPackingListTailoring.getEndCustomer().replace("&","(-)"));//最终客户
 
 
 			Map<String,Object> order=syPackingListTailoringMapper.getSoMainCode(syPackingListTailoring.getRdrecord32Code());//随便哪一个做主表信息
 			Map<String,Object> order=syPackingListTailoringMapper.getSoMainCode(syPackingListTailoring.getRdrecord32Code());//随便哪一个做主表信息
 			if (order.size()==0){
 			if (order.size()==0){
@@ -2274,7 +2283,7 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 			jsonObject1.put("DDATE",syPackingListTailoring.getTheFinalShippingDate().substring(0,10));//日期
 			jsonObject1.put("DDATE",syPackingListTailoring.getTheFinalShippingDate().substring(0,10));//日期
 			jsonObject1.put("CDEFINE4",syPackingListTailoring.getTheFinalShippingDate());//最终船期
 			jsonObject1.put("CDEFINE4",syPackingListTailoring.getTheFinalShippingDate());//最终船期
 			jsonObject1.put("CDEFINE6",syPackingListTailoring.getTheFinalShippingDate2());//合同日期
 			jsonObject1.put("CDEFINE6",syPackingListTailoring.getTheFinalShippingDate2());//合同日期
-			jsonObject1.put("CDEFINE10",syPackingListTailoring.getShippingOrderNumber());//托书号
+			jsonObject1.put("CDEFINE10",syPackingListTailoring.getShippingOrderNumber().replace("&","(-)"));//托书号
 			System.out.println("syPackingListFabric.getSupplierCode()\t"+syPackingListTailoring.getSupplierCode());
 			System.out.println("syPackingListFabric.getSupplierCode()\t"+syPackingListTailoring.getSupplierCode());
 			if(syPackingListTailoring.getSupplierCode()!=null){
 			if(syPackingListTailoring.getSupplierCode()!=null){
 				String	venName=syPackingListTailoringMapper.getCvenName2(syPackingListTailoring.getSupplier());
 				String	venName=syPackingListTailoringMapper.getCvenName2(syPackingListTailoring.getSupplier());