浏览代码

推送,预装箱单导入,面辅料供应商简称

huxy 2 年之前
父节点
当前提交
ef551e448f

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

@@ -1626,7 +1626,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                 long startTime = System.currentTimeMillis();
                 refreshSheet(workbook);
                 long endTime = System.currentTimeMillis();
-                System.out.println("导入模板运行时间:" + (endTime - startTime) + "ms");
+                System.out.println("模板运行时间:" + (endTime - startTime) + "ms");
                 params.setTitleRows(2);
                 params.setHeadRows(1);
                 params.setNeedSave(true);
@@ -1658,7 +1658,9 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             list.add("PREACKSKU");
             list.add("净净重");
             list.add("配码规格");
+            int num1=10;
             for (int x=0;x<=sheet.getLastRowNum();x++){
+                //System.out.println("sheet.getLastRowNum()\t"+sheet.getLastRowNum());
                 Row row=sheet.getRow(x);//列
                 if(row==null){
                     continue;
@@ -1669,18 +1671,26 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                 }
                 List<String> strs=new ArrayList<String>();//装主要数据
                 List<String> strs2=new ArrayList<String>();//获取尺码的信息
-                for (int i=0;i<row.getLastCellNum();i++){
+                if(x==0){
+                    num1= sheet.getRow(0).getLastCellNum();
+                }
+                for (int i=0;i<num1;i++){
                     Cell cell=row.getCell(i);
-                    if(x==0){//获取字段名称
-                        if((i>7&&i<row.getLastCellNum()-18)||i==row.getLastCellNum()-4){
+                    if(x==0){
+                        //System.out.println("cell.getstring\t"+cell.getStringCellValue());
+                        if((i>7&&i<num1-18)||i==num1-4){
                             strs3.add(cell.getStringCellValue());
                         }
                         if(list.contains(cell.getStringCellValue())){
                             nums.add(i);
-                            System.out.println("字段\t"+cell.getStringCellValue()+"\t"+i);
+                        }
+                        if(cell.getStringCellValue().equals("申报要素ID")){
+                            num1=i+1;
+                            break;
                         }
                     }else{
-                        if((i>7&&i<row.getLastCellNum()-18)||i==row.getLastCellNum()-4){
+                        //System.out.println("i\t"+i);
+                        if((i>7&&i<num1-18)||i==num1-4){
                             if(cell==null){
                                 strs2.add("");
                             }else{
@@ -1692,9 +1702,6 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                                 throw new JeecgBootException("第"+num+"页的"+"第"+(x+1)+"行的"+
                                         sheet.getRow(0).getCell(i).getStringCellValue()+"未填值!");
                             }else{
-                                if(sheet.getRow(0).getCell(i).getStringCellValue().equals("净净重")||sheet.getRow(0).getCell(i).getStringCellValue().equals("总体积")){
-                                    continue;
-                                }
                                 if(cell!=null){
                                     cell.setCellType(CellType.STRING);//获取的都转换成String
                                     if(cell.getStringCellValue().length()<1&&!nums.contains(i)){
@@ -1717,14 +1724,14 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                         }
                     }
                     if(total.doubleValue()==0){
-                        throw new JeecgBootException("一行数据中至少有一个尺码得填值");
+                        throw new JeecgBootException("每行数据里至少得有一个尺码填上值");
                     }
                     SyPreAssembledPackingListItem item=
                             new SyPreAssembledPackingListItem(strs.toArray(new String[strs.size()]),
                                     strs2.toArray(new String[strs2.size()]),
                                     strs3.toArray(new String[strs3.size()]));
                     items.add(item);
-                   main=new SyPreAssembledPackingList(strs.toArray(new String[strs.size()]));
+                    main=new SyPreAssembledPackingList(strs.toArray(new String[strs.size()]));
                 }
             }
             main.setSyPreAssembledPackingListItemList(items);//获取集合
@@ -1783,6 +1790,8 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
             list.add("PREACKSKU");
             list.add("净净重");
             list.add("配码规格");
+            System.out.println("第"+num+"页");
+            int num1=10;
             for (int x=0;x<=sheet.getLastRowNum();x++){
                 //System.out.println("sheet.getLastRowNum()\t"+sheet.getLastRowNum());
                 Row row=sheet.getRow(x);//列
@@ -1795,17 +1804,28 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
                 }
                 List<String> strs=new ArrayList<String>();//装主要数据
                 List<String> strs2=new ArrayList<String>();//获取尺码的信息
-                for (int i=0;i<row.getLastCellNum();i++){
+                //int num1= sheet.getRow(0).getLastCellNum();
+                if(x==0){
+                    num1= sheet.getRow(0).getLastCellNum();
+                }
+                System.out.println("num1.size\t"+num1);
+                for (int i=0;i<num1;i++){
                     Cell cell=row.getCell(i);
                     if(x==0){
-                        if((i>7&&i<row.getLastCellNum()-18)||i==row.getLastCellNum()-4){
+                        //System.out.println("cell.getstring\t"+cell.getStringCellValue());
+                        if((i>7&&i<num1-18)||i==num1-4){
                             strs3.add(cell.getStringCellValue());
                         }
                         if(list.contains(cell.getStringCellValue())){
                             nums.add(i);
                         }
+                        if(cell.getStringCellValue().equals("申报要素ID")){
+                            num1=i+1;
+                            break;
+                        }
                     }else{
-                        if((i>7&&i<row.getLastCellNum()-18)||i==row.getLastCellNum()-4){
+                        //System.out.println("i\t"+i);
+                        if((i>7&&i<num1-18)||i==num1-4){
                             if(cell==null){
                                 strs2.add("");
                             }else{

+ 8 - 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingList.java

@@ -232,10 +232,16 @@ public class SyPreAssembledPackingList implements Serializable {
 	}
 
 	public SyPreAssembledPackingList(String [] params){
+		//System.out.println("params.size\t"+params.length);
+		/*for (String param : params){
+			System.out.println(param);
+		}*/
 		//客户简称	发运明细分组ID	发运明细主表ID	申报要素ID//从17开始
 		customerAbbreviation=params[15];
-		syDeclarationElementsId=params[16+6];
-		elementsId=params[16+7];
+		syDeclarationElementsId=params[16+7];
+		elementsId=params[16+8];
+		System.out.println("syDeclarationElementsId\t"+syDeclarationElementsId);
+		System.out.println("elements_id\t"+elementsId);
 	}
 
 	public String toString1(){

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

@@ -312,6 +312,8 @@ public class SyPreAssembledPackingListItem implements Serializable {
 		//成衣工厂	款号	小po	分销点	起始箱号	结束箱号	item NO./SKU NO./UPC NO./PACKS CODE	PREACKSKU
 		//颜色	计划装箱数量	净重/箱	毛重/箱	外箱长度	外箱宽度	外箱高度	净净重	客户简称	发运明细分组ID	发运明细主表ID	申报要素ID
 		//try{
+		System.out.println("params2.size\t"+parsms2.length);
+		System.out.println("parsms3.size\t"+parsms3.length);
 			garmentFactory=parsms[0];
 			styleNo=parsms[1];
 			smallPo=parsms[2];
@@ -340,8 +342,8 @@ public class SyPreAssembledPackingListItem implements Serializable {
 
 			withCode=parsms[16];//配码
 			//发运明细分组ID	发运明细主表ID	申报要素ID
-			groupId=parsms[16+5];//分组id
-			syDeclarationElementsId=parsms[16+6];
+			groupId=parsms[16+6];//分组id
+			syDeclarationElementsId=parsms[16+7];
 			sizeTables=new ArrayList<>();
 			String planSize="";
 			int piecesBox=0;
@@ -357,7 +359,7 @@ public class SyPreAssembledPackingListItem implements Serializable {
 				planSize+=parsms3[i]+":"+(boxNumber.intValue()*sizeTable.getProportion())+"+";
 				sizeTable.setItemId(parsms2[parsms2.length-1].split(",")[i]);//发运明细子表id
 				sizeTables.add(sizeTable);
-				System.out.println(sizeTable.getSize()+"\t"+sizeTable.getItemId());
+				//System.out.println(sizeTable.getSize()+"\t"+sizeTable.getItemId());
 			}
 			this.planSize=planSize.substring(0,planSize.length()-1);
 			this.piecesBox=new BigDecimal(piecesBox);//每箱件数

+ 8 - 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/mapper/xml/SyPackingListFabricItemMapper.xml

@@ -58,10 +58,14 @@
 		SELECT
 			a.id syShippingDetailsId,
 			b.id syShippingDetailsItemId,
-			(SELECT supplier FROM sy_shipping_details_item WHERE inventory_Ccode LIKE '03%'
-			AND inventory_Ccode!='0399' AND sy_shipping_details_item.id=b.id) supplierDyeingPlant,
-			(SELECT supplier_code FROM sy_shipping_details_item WHERE inventory_Ccode LIKE '03%'
-			AND inventory_Ccode!='0399' AND sy_shipping_details_item.id=b.id) supplierCodeDyeingPlant,
+			(SELECT supplier FROM sy_shipping_details_item WHERE
+			inventory_Ccode LIKE '03%'
+			AND inventory_Ccode!='0399' AND
+			sy_shipping_details_item.id=b.id) supplierDyeingPlant,
+			(SELECT supplier_code FROM sy_shipping_details_item WHERE
+			inventory_Ccode LIKE '03%'
+			AND inventory_Ccode!='0399' AND
+			sy_shipping_details_item.id=b.id) supplierCodeDyeingPlant,
 			(SELECT supplier FROM sy_shipping_details_item WHERE inventory_Ccode LIKE '04%'
 			AND inventory_Ccode!='0499' AND sy_shipping_details_item.id=b.id) supplierPrintingPlant,
 			(SELECT supplier_code FROM sy_shipping_details_item WHERE inventory_Ccode LIKE '04%'

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

@@ -149,6 +149,9 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 			entity.setPrice(detailsItem.getSalesUnitPrice());//单价
 			entity.setFactoryUnitPrice(detailsItem.getFactoryUnitPrice());//工厂单价
 
+			if(entity.getMasterMetering()==null){
+				throw new JeecgBootException("没有单位的物料");
+			}
 			if(entity.getMasterMetering().equals("KG")){
 				updateQuantity(entity.getNetWeight(),entity.getSyShippingDetailsItemId(),entity.getMasterMetering());
 			}else{
@@ -406,6 +409,12 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 				syPackingListFabricItem.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
 				syPackingListFabricItem.setSupplierDyeingPlant(syShippingDetailsItem.getRSupplier());//染厂
 			}
+			/*if(syPackingListFabricItem.getVenId()!=null&&syPackingListFabricItem.getVenId().indexOf("03")>-1&&!syPackingListFabricItem.getVenId().equals("0399")){
+				//当物料分类为04开头的印厂面料时
+				SyShippingDetailsItem syShippingDetailsItem=syShippingDetailsItemMapper.selectById(syPackingListFabricItem.getSyShippingDetailsItemId());//获取出运明细子表数据
+				syPackingListFabricItem.setSupplierCodeDyeingPlant(syShippingDetailsItem.getRSupplierCode());//染厂编码
+				syPackingListFabricItem.setSupplierDyeingPlant(syShippingDetailsItem.getRSupplier());//染厂
+			}*/
 		}
 		syPackingListFabric.setSyPackingListFabricItem(syPackingListFabricItems);
 		return syPackingListFabric;
@@ -609,6 +618,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					s1.setPurOrSubOrder(item.getPurOrSubOrder());//委外采购订单
 					s1.setOrderNumber(item.getOrderNumber());//订单号
 					s1.setFactoryUnitPrice(item.getFactoryUnitPrice());//工厂单价
+					s1.setSupplier(item.getSupplier());
+					s1.setSupplierCode(item.getSupplierCode());
 
 					if((s1.getInventoryCcode().indexOf("03")!=-1&&!s1.getInventoryCcode().equals("0399")) ||
 							(s1.getInventoryCcode().indexOf("02")!=-1&&!s1.getInventoryCcode().equals("0299"))||
@@ -713,6 +724,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 					item.setOmpoId(syShippingDetailsItem.getOmpoId());//采购/委外订单主表id
 					item.setOmpoIdItem(syShippingDetailsItem.getOmpoIdItem());//采购/委外订单子表id
 					item.setOmpoAccount(syShippingDetailsItem.getOmpoAccount());//采购/委外订单账套号
+					item.setSupplier(syShippingDetailsItem.getSupplier());
+					item.setSupplierCode(syShippingDetailsItem.getSupplierCode());
 					item.setAccount(syShippingDetailsItem.getAccount());//账套号
 					item.setSyOrderDataItemId(syShippingDetailsItem.getSyOrderDataItemId());//销售订单主表id
 					item.setSyOrderDataId(syShippingDetailsItem.getSyOrderDataId());//销售订单子表id
@@ -1298,6 +1311,13 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 						map3.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
 						map4.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
 						map6.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
+						if(!order.get("cexch_name").equals("人民币")){//不为人民币
+							SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-M-dd");
+							String dd = sf1.format(new Date());
+							String rateSplit[] = dd.split("-");
+							Map<String, Object> rate= syShippingOrderMapper.queryU8Rate(rateSplit[0], rateSplit[1]);
+							map6.put("IEXCHRATE",rate.get("nflat").toString());//汇率(如果传空,接口默认1)cPayCode
+						}
 					}
 				}
 
@@ -1941,6 +1961,8 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 							sy1.setManualYarnFlag(syShippingDetailsItem.getManualYarnFlag());//是否手册纱
 							sy1.setManualYarnProportion(syShippingDetailsItem.getManualYarnProportion());//手册纱占比
 							sy.setGarmentFactory(syShippingDetailsItem.getGarmentFactory());//获取成衣工厂
+							sy1.setSupplier(syShippingDetailsItem.getSupplier());
+							sy1.setSupplierCode(syShippingDetailsItem.getSupplierCode());
 							if(sy1.getPrice()!=null&&sy1.getActualDeclaredQuantity()!=null){
 								sy1.setTotalPrice(sy1.getActualDeclaredQuantity().multiply(sy1.getPrice()));//实际报关数量*单价
 							}

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

@@ -1042,6 +1042,13 @@ public class SyPackingListTailoringServiceImpl extends ServiceImpl<SyPackingList
 						map3.put("CEXCH_NAME",order.get("cexch_name"));//币种名称(如果传空,传来源单据;无来源单据,默认人民币)
 						map4.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
 						map6.put("CEXCH_NAME",order.get("cexch_name"));//CEXCH_NAME 币种名称
+						if(!order.get("cexch_name").equals("人民币")){//不为人民币
+							SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-M-dd");
+							String dd = sf1.format(new Date());
+							String rateSplit[] = dd.split("-");
+							Map<String, Object> rate= syShippingOrderMapper.queryU8Rate(rateSplit[0], rateSplit[1]);
+							map6.put("IEXCHRATE",rate.get("nflat").toString());//汇率(如果传空,接口默认1)cPayCode
+						}
 					}
 				}