ソースを参照

预托书,托书打印调整

zengtx 2 年 前
コミット
ad53fad33c

+ 6 - 6
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/controller/SyLetterDepositController.java

@@ -103,26 +103,26 @@ public class SyLetterDepositController extends JeecgController<SyLetterDeposit,
 			Page<SyLetterDeposit> page = new Page<SyLetterDeposit>(pageNo, pageSize);
 			//客户简称
 			if(oConvertUtils.isNotEmpty(syLetterDeposit.getClientAbbreviation())){
-				queryWrapper.like("b.client_abbreviation",syLetterDeposit.getClientAbbreviation().trim());
+				queryWrapper.like("t.clientAbbreviation",syLetterDeposit.getClientAbbreviation().trim());
 			}
 			//制单人
 			if(oConvertUtils.isNotEmpty(syLetterDeposit.getCreateBy())){
-				queryWrapper.eq("b.create_by",syLetterDeposit.getCreateBy().trim());
+				queryWrapper.eq("t.createBy",syLetterDeposit.getCreateBy().trim());
 			}
 			//小PO
 			if(oConvertUtils.isNotEmpty(syLetterDeposit.getSmallPo())){
-				queryWrapper.like("b.small_po",syLetterDeposit.getSmallPo().trim());
+				queryWrapper.like("t.smallPo",syLetterDeposit.getSmallPo().trim());
 			}
 			//预托书号
 			if(oConvertUtils.isNotEmpty(syLetterDeposit.getDepositaryReceiptNo())){
-				queryWrapper.like("a.depositary_receipt_no",syLetterDeposit.getDepositaryReceiptNo().trim());
+				queryWrapper.like("t.depositaryReceiptNo",syLetterDeposit.getDepositaryReceiptNo().trim());
 			}
 			//托书日期
 			if(oConvertUtils.isNotEmpty(syLetterDeposit.getShippingOrderDate())){
-				queryWrapper.eq("a.shipping_order_date",syLetterDeposit.getShippingOrderDate());
+				queryWrapper.eq("t.shippingOrderDate",syLetterDeposit.getShippingOrderDate());
 			}
 
-			queryWrapper.eq("a.del_flag",0).groupBy("a.id").orderByDesc("a.create_time");
+			queryWrapper.groupBy("t.sy_letter_deposit_id").orderByDesc("t.createTime");
 			IPage<SyLetterDeposit> pageList = syLetterDepositService.querySyLetterDeposit(page, queryWrapper);
 			for (SyLetterDeposit li:pageList.getRecords()){
 				//转换运抵国别

+ 16 - 13
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/mapper/xml/SyLetterDepositMapper.xml

@@ -79,14 +79,17 @@ on a.id = b.sy_pre_assembled_packing_list_id
 <!--    </select>-->
 
     <select id="querySyLetterDeposit" resultType="org.jeecg.modules.documents.letterDeposit.entity.SyLetterDeposit">
-select a.id as id,a.depositary_receipt_no as depositaryReceiptNo,b.order_number as orderNumber,a.export_invoice_no as exportInvoiceNo,
-b.client_abbreviation as clientAbbreviation,a.exchange_earnings_value as exchangeEarningsValue,b.sy_pre_assembled_packing_list_id as syPreAssembledPackingListId,
-b.distribution_point as distributionPoint,a.unit_in_operation as unitInOperation,a.box_number as boxNumber,sum(b.total_gross_weight) as totalGrossWeight,sum(b.total_volume) as totalVolume,
-a.money as money,a.the_actual_shipping_date as theActualShippingDate,a.exchange_earnings_text as exchangeEarningsText,a.consignee as consignee,a.bill_of_lading_or_carriage_receipt as billOfLadingOrCarriageReceipt,
-a.addressee as addressee,a.trade_country as tradeCountry,a.arrive_in_country as arriveInCountry,a.export_port as exportPort,a.notifier as notifier,a.nottfy as nottfy,a.destination_port as destinationPort,
-a.the_documents_state as theDocumentsState from sy_letter_deposit a
-left join sy_letter_deposit_item b
-on a.id = b.sy_letter_deposit_id
+ select t.depositaryReceiptNo,t.id,t.createTime,t.shippingOrderDate,t.smallPo,t.clientAbbreviation,t.createBy,t.unitInOperation, sum(t.total) as total,sum(t.boxNumber) as boxNumber,t.tradeCountry,t.arriveInCountry,t.exportPort,t.destinationPort,t.theDocumentsState,
+sum(t.totalGrossWeight) as totalGrossWeight,sum(t.totalNetWeight) as totalNetWeight,sum(t.totalVolume) as totalVolume,t.distributionPoint,
+t.unitPrice,sum(t.totalPrice) as money from( select b.sy_letter_deposit_id as sy_letter_deposit_id,a.depositary_receipt_no as depositaryReceiptNo,b.distribution_point as distributionPoint,a.unit_in_operation as unitInOperation, sum(b.total) as total,b.box_number as boxNumber,a.trade_country as tradeCountry,a.arrive_in_country as arriveInCountry,a.export_port as exportPort,a.destination_port as destinationPort,a.the_documents_state as theDocumentsState,
+b.total_gross_weight as totalGrossWeight,b.total_net_weight as totalNetWeight,b.total_volume as totalVolume,
+a.shipping_order_date as shippingOrderDate,b.small_po as smallPo,b.create_by as createBy,b.client_abbreviation as clientAbbreviation,
+a.create_time as createTime,b.unit_price as unitPrice,sum(b.total_price) as totalPrice,a.id as id
+         from sy_letter_deposit_item b
+				 left join sy_letter_deposit a
+				 on a.id = b.sy_letter_deposit_id
+         where a.del_flag = 0 and  b.del_flag = 0 group by letter_groupid) t
+
   ${ew.customSqlSegment}
 
     </select>
@@ -94,19 +97,19 @@ on a.id = b.sy_letter_deposit_id
     <select id="queryItem" resultType="org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem">
 
         select item_number as itemNumber,small_po as smallPo,sum(total) as total,box_number as boxNumber,pre_ids as syPreAssembledPackingListItemId,sy_pre_assembled_packing_list_id as syPreAssembledPackingListId,
-sum(total_gross_weight) as totalGrossWeight,sum(total_net_weight) as totalNetWeight,sum(total_volume) as totalVolume,distribution_point as distributionPoint,
+total_gross_weight as totalGrossWeight,total_net_weight as totalNetWeight,total_volume as totalVolume,distribution_point as distributionPoint,
 container_code as containerCode,container_number as containerNumber,unit_price as unitPrice,sum(total_price) as totalPrice,
 hod,salesman,sales_Department as salesDepartment,spur_or_sub_order as spurOrSubOrder,supplier,client_abbreviation as clientAbbreviation
          from sy_letter_deposit_item
-         where del_flag = 0 and sy_letter_deposit_id = #{syId} group by letter_groupid
+         where del_flag = 0 and sy_letter_deposit_id = #{syId} group by letter_groupid order by item_number,small_po desc
 
 
     </select>
 
     <select id="printItem" resultType="org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem">
 
-         select a.item_number as itemNumber,a.small_po as smallPo,sum(a.total) as total,a.box_number as boxNumber,
-sum(a.total_gross_weight) as totalGrossWeight,sum(a.total_net_weight) as totalNetWeight,sum(a.total_volume) as totalVolume,
+         select a.item_number as itemNumber,a.small_po as smallPo,round(sum(a.total),2) as total,round(a.box_number,0) as boxNumber,
+round(a.total_gross_weight,2) as totalGrossWeight,round(a.total_net_weight,2) as totalNetWeight,round(a.total_volume,3) as totalVolume,
 a.container_code as containerCode,a.container_number as containerNumber,a.unit_price as unitPrice,sum(a.total_price) as totalPrice,
 a.hod,a.salesman,a.sales_Department as salesDepartment,a.spur_or_sub_order as spurOrSubOrder,a.supplier,
 c.english_product_name as englishName,'PCS' as pcs, 'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm
@@ -115,7 +118,7 @@ c.english_product_name as englishName,'PCS' as pcs, 'CTNS' as ctns,'KGS' as kgs,
          on a.sy_pre_assembled_packing_list_id = b.id
          left join sy_declaration_elements c
          on b.elements_id = c.id
-         where a.del_flag = 0 and a.sy_letter_deposit_id = #{id} group by letter_groupid
+         where a.del_flag = 0 and a.sy_letter_deposit_id = #{id} group by letter_groupid  order by a.item_number,a.small_po desc
 
     </select>
 </mapper>

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/seclarationElements/entity/SyDeclarationElements.java

@@ -101,4 +101,7 @@ public class SyDeclarationElements {
 	/**发运明细子表ID*/
 	@TableField(exist = false)
 	private String syShippingids;
+
+	//报关单位
+	private String declarationUnit;
 }

+ 381 - 295
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/controller/SyShippingOrderController.java

@@ -669,119 +669,115 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 			 }
 
 
+				 if (testName.equals("报关信息-报关单")) {
+					 int size = 0;
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
 
-			 //String[] nameList = new String[]{"报关信息-报关单","报关信息-申报要素-成衣","报关信息-发票","报关信息-合同","报关信息-申报要素-面料","报关信息-装箱单"};
-
-			 if(testName.equals("报关信息-报关单")){
-				 int size = 0;
-				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
-
-				 //转map
-				 Field[] fields = entity.getClass().getDeclaredFields();
-				 for (Field field : fields) {
-					 field.setAccessible(true);
-					 map.put(field.getName(), field.get(entity));
-				 }
-                 //集合转map
-				 for(SyShippingOrderItem li:list){
-					 size++;
-					 Field[] fieldsList = li.getClass().getDeclaredFields();
-					 Map<String, Object> mapList = new HashMap<String, Object>();
-					 for (Field field : fieldsList) {
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
 						 field.setAccessible(true);
-						 mapList.put(field.getName(), field.get(li));
+						 map.put(field.getName(), field.get(entity));
 					 }
-					 mapList.put("size",size);
-					 listMap.add(mapList);
-				 }
-				 map.put("item", listMap);
-
-				 Workbook workbook = ExcelExportUtil.exportExcel(params,map);
-
-				 ServletOutputStream outputStream = response.getOutputStream();
-
-				 workbook.write(outputStream);
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+						 size++;
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 mapList.put("size", size);
+						 listMap.add(mapList);
+					 }
+					 map.put("item", listMap);
+
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+
+					 ServletOutputStream outputStream = response.getOutputStream();
+
+					 workbook.write(outputStream);
+
+				 } else if (testName.equals("报关信息-申报要素")) {
+
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
+
+					 QueryWrapper<SyShippingOrderItem> queryWrapper = new QueryWrapper<>();
+					 queryWrapper.eq("sy_shipping_order_item_id", entity.getId()).eq("del_flag", 0).groupBy("elements_Id");
+					 List<SyShippingOrderItem> itemList = syShippingOrderItemService.list(queryWrapper);
+
+					 int i = 1;
+					 for (SyShippingOrderItem li : itemList) {
+						 map.put("name", "没用" + li.getReadyFabric());
+
+						 Map<String, Object> map1 = new HashMap<String, Object>();
+						 Map<String, Object> map3 = new HashMap<String, Object>();
+						 Map<String, Object> map4 = new HashMap<String, Object>();
+						 Map<String, Object> map5 = new HashMap<String, Object>();
+						 Map<String, Object> map6 = new HashMap<String, Object>();
+
+						 //查询主表
+						 SyDeclarationElements elementEntity = syDeclarationElementsService.getById(li.getElementsId());
+						 //查询子表
+						 QueryWrapper<SyDeclarationElementsItem> itemQueryWrapper = new QueryWrapper<>();
+						 itemQueryWrapper.eq("sy_declaration_elements_id", li.getElementsId()).eq("del_flag", 0).orderByAsc("create_time");
+						 List<SyDeclarationElementsItem> itemList1 = syDeclarationElementsItemService.list(itemQueryWrapper);
+						 if (itemList1.size() == 0) {
+							 map1.put("name", i + "、商品编码:");
+							 map1.put("value", "");
+							 listMap.add(map1);
+
+							 map3.put("name", "商品描述:");
+							 map3.put("value", "");
+							 listMap.add(map3);
+
+							 map4.put("name", "申报要素:");
+							 map4.put("value", "");
+							 listMap.add(map4);
+						 } else {
+							 map1.put("name", i + "、商品编码:");
+							 map1.put("value", elementEntity.getHsCode());
+							 listMap.add(map1);
+
+							 map3.put("name", "商品描述:");
+							 map3.put("value", "");
+							 listMap.add(map3);
+
+							 map4.put("name", "申报要素:");
+							 map4.put("value", "");
+							 listMap.add(map4);
+
+							 int m = 1;
+							 for (SyDeclarationElementsItem li1 : itemList1) {
+								 Map<String, Object> map2 = new HashMap<String, Object>();
+								 if (li1.getTypeValue().equals("品名")) {
+									 li1.setDescribeText(elementEntity.getDeclarationName());
+								 }
+								 map2.put("name", m + "、" + li1.getTypeValue() + ":");
+								 map2.put("value", li1.getDescribeText());
+								 listMap.add(map2);
+								 m++;
+							 }
+							 i++;
 
-			 }
-			 else if(testName.equals("报关信息-申报要素")){
-
-				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
-
-				 QueryWrapper<SyShippingOrderItem> queryWrapper = new QueryWrapper<>();
-				 queryWrapper.eq("sy_shipping_order_item_id",entity.getId()).eq("del_flag",0).groupBy("elements_Id");
-				 List<SyShippingOrderItem> itemList = syShippingOrderItemService.list(queryWrapper);
-
-				 int i = 1;
-				for(SyShippingOrderItem li:itemList) {
-					map.put("name", "没用" + li.getReadyFabric());
-
-					Map<String, Object> map1 = new HashMap<String, Object>();
-					Map<String, Object> map3 = new HashMap<String, Object>();
-					Map<String, Object> map4 = new HashMap<String, Object>();
-					Map<String, Object> map5 = new HashMap<String, Object>();
-					Map<String, Object> map6 = new HashMap<String, Object>();
-
-					//查询主表
-					SyDeclarationElements elementEntity = syDeclarationElementsService.getById(li.getElementsId());
-					//查询子表
-					QueryWrapper<SyDeclarationElementsItem> itemQueryWrapper = new QueryWrapper<>();
-					itemQueryWrapper.eq("sy_declaration_elements_id", li.getElementsId()).eq("del_flag", 0).orderByAsc("create_time");
-					List<SyDeclarationElementsItem> itemList1 = syDeclarationElementsItemService.list(itemQueryWrapper);
-					if (itemList1.size() == 0) {
-						map1.put("name", i + "、商品编码:");
-						map1.put("value", "");
-						listMap.add(map1);
-
-						map3.put("name", "商品描述:");
-						map3.put("value", "");
-						listMap.add(map3);
-
-						map4.put("name", "申报要素:");
-						map4.put("value", "");
-						listMap.add(map4);
-					} else {
-						map1.put("name", i + "、商品编码:");
-						map1.put("value", elementEntity.getHsCode());
-						listMap.add(map1);
-
-						map3.put("name", "商品描述:");
-						map3.put("value", "");
-						listMap.add(map3);
-
-						map4.put("name", "申报要素:");
-						map4.put("value", "");
-						listMap.add(map4);
-
-						int m = 1;
-						for (SyDeclarationElementsItem li1 : itemList1) {
-							Map<String, Object> map2 = new HashMap<String, Object>();
-							if (li1.getTypeValue().equals("品名")) {
-								li1.setDescribeText(elementEntity.getDeclarationName());
-							}
-							map2.put("name", m + "、" + li1.getTypeValue() + ":");
-							map2.put("value", li1.getDescribeText());
-							listMap.add(map2);
-							m++;
-						}
-						i++;
-
-						map6.put("name", "等......");
-						map6.put("value", "");
-						listMap.add(map6);
-						map5.put("name", "");
-						map5.put("value", "");
-						listMap.add(map5);
+							 map6.put("name", "等......");
+							 map6.put("value", "");
+							 listMap.add(map6);
+							 map5.put("name", "");
+							 map5.put("value", "");
+							 listMap.add(map5);
 
-					}
-				}
-				 map.put("readyFabric",readyFabric);
-				 map.put("list", listMap);
+						 }
+					 }
+					 map.put("readyFabric", readyFabric);
+					 map.put("list", listMap);
 
-				 Workbook workbook = ExcelExportUtil.exportExcel(params,map);
-				 ServletOutputStream outputStream = response.getOutputStream();
-				 workbook.write(outputStream);
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+					 ServletOutputStream outputStream = response.getOutputStream();
+					 workbook.write(outputStream);
 
-			 }
+				 }
 //			 else if(testName.equals("报关信息-申报要素-面料")){
 //
 //				 List<Map<String, Object>> listMap1 = new ArrayList<Map<String, Object>>();
@@ -853,211 +849,276 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 //				 workbook.write(outputStream);
 //
 //			 }
-			 else if(testName.equals("报关信息-发票")){
-
-			 	List<Map<String,Object>> maiTouList = new ArrayList<Map<String,Object>>();
-
-                boolean boo = true;
-				 //重新赋值
-				 entity.setLatestDateOfShipment(sf.format(date));
-				 //出口口岸转大写拼音
-				 String exportPort = py.toPinYin(entity.getExportPort());
-				 entity.setExportPort(exportPort);
-				 //目的港+,+运抵国别转英文
-				 //查询数据字典获取英文
-				 List<DictModel> sysDicts = sysDictService.queryDictItemsByCode("port_of_destination");
-				 for(DictModel di:sysDicts){
-					 if(di.getText().equals(entity.getDestinationPort())){
-						 entity.setDestinationPort(di.getValue());
+				 else if (testName.equals("报关信息-发票")) {
+
+					 List<Map<String, Object>> maiTouList = new ArrayList<Map<String, Object>>();
+
+					 boolean boo = true;
+					 //重新赋值
+					 entity.setLatestDateOfShipment(sf.format(date));
+					 //出口口岸转大写拼音
+					 String exportPort = py.toPinYin(entity.getExportPort());
+					 entity.setExportPort(exportPort);
+					 //目的港+,+运抵国别转英文
+					 //查询数据字典获取英文
+					 List<DictModel> sysDicts = sysDictService.queryDictItemsByCode("port_of_destination");
+					 for (DictModel di : sysDicts) {
+						 if (di.getText().equals(entity.getDestinationPort())) {
+							 entity.setDestinationPort(di.getValue());
+						 }
 					 }
-				 }
-				 List<DictModel> sysDicts1 = sysDictService.queryDictItemsByCode("country_of_arrival");
-				 for(DictModel di:sysDicts1){
-					 if(di.getText().equals(entity.getArriveInCountry())){
-						 entity.setArriveInCountry(di.getValue());
+					 List<DictModel> sysDicts1 = sysDictService.queryDictItemsByCode("country_of_arrival");
+					 for (DictModel di : sysDicts1) {
+						 if (di.getText().equals(entity.getArriveInCountry())) {
+							 entity.setArriveInCountry(di.getValue());
+						 }
 					 }
-				 }
 
-				 if(oConvertUtils.isNotEmpty(list.get(0).getClientAbbreviation())) {
-					 //查询数据字典唛头
-					 List<DictModel> test = sysDictService.queryDictItemsByCode("test0902002");
-					 for (DictModel di : test) {
-						 if (di.getText().equals(list.get(0).getClientAbbreviation())) {
-							 String split[] = di.getValue().split("\\+");
-							 for (int i = 0; i < split.length; i++) {
-								 Map<String, Object> maiTou = new HashMap<>();
-								 maiTou.put("name", split[i]);
-								 maiTouList.add(maiTou);
+					 if (oConvertUtils.isNotEmpty(list.get(0).getClientAbbreviation())) {
+						 //查询数据字典唛头
+						 List<DictModel> test = sysDictService.queryDictItemsByCode("test0902002");
+						 for (DictModel di : test) {
+							 if (di.getText().equals(list.get(0).getClientAbbreviation())) {
+								 String split[] = di.getValue().split("\\+");
+								 for (int i = 0; i < split.length; i++) {
+									 Map<String, Object> maiTou = new HashMap<>();
+									 maiTou.put("name", split[i]);
+									 maiTouList.add(maiTou);
+								 }
+								 boo = false;
 							 }
-							 boo = false;
 						 }
 					 }
-				 }
-				 if(boo == true){
-					 Map<String,Object> maiTou = new HashMap<>();
-					 maiTou.put("name", " ");
-					 maiTouList.add(maiTou);
-				 }
+					 if (boo == true) {
+						 Map<String, Object> maiTou = new HashMap<>();
+						 maiTou.put("name", " ");
+						 maiTouList.add(maiTou);
+					 }
 
-				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
 
-				 //转map
-				 Field[] fields = entity.getClass().getDeclaredFields();
-				 for (Field field : fields) {
-					 field.setAccessible(true);
-					 map.put(field.getName(), field.get(entity));
-				 }
-				 //集合转map
-				 for(SyShippingOrderItem li:list){
-					 Field[] fieldsList = li.getClass().getDeclaredFields();
-					 Map<String, Object> mapList = new HashMap<String, Object>();
-					 for (Field field : fieldsList) {
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
 						 field.setAccessible(true);
-						 mapList.put(field.getName(), field.get(li));
+						 map.put(field.getName(), field.get(entity));
+					 }
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 listMap.add(mapList);
 					 }
-					 listMap.add(mapList);
-				 }
 
-				 map.put("item", listMap);
-				 map.put("list",maiTouList);
+					 map.put("item", listMap);
+					 map.put("list", maiTouList);
 
-				 Workbook workbook = ExcelExportUtil.exportExcel(params,map);
-				 ServletOutputStream outputStream = response.getOutputStream();
-				 workbook.write(outputStream);
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+					 ServletOutputStream outputStream = response.getOutputStream();
+					 workbook.write(outputStream);
 
 
-			 }else if(testName.equals("报关信息-合同")){
+				 } else if (testName.equals("报关信息-合同")) {
 
-			 	//获取当前日期减去60天
-				 Calendar calendar = Calendar.getInstance();
-				 calendar.setTime(date);
-				 calendar.add(Calendar.DAY_OF_MONTH,-60);
-                 String dateTime = sf.format(calendar.getTime());
-				 Date locale = sf.parse(dateTime);
-				 SimpleDateFormat sdf1 = new SimpleDateFormat("MMM'.'dd'th,' yyyy", Locale.UK); // 月日年
-				 entity.setDateTime(sdf1.format(locale));
+					 //获取当前日期减去60天
+					 Calendar calendar = Calendar.getInstance();
+					 calendar.setTime(date);
+					 calendar.add(Calendar.DAY_OF_MONTH, -60);
+					 String dateTime = sf.format(calendar.getTime());
+					 Date locale = sf.parse(dateTime);
+					 SimpleDateFormat sdf1 = new SimpleDateFormat("MMM'.'dd'th,' yyyy", Locale.UK); // 月日年
+					 entity.setDateTime(sdf1.format(locale));
 
-				 //出口口岸转大写拼音
-				 String exportPort = py.toPinYin(entity.getExportPort());
-				 entity.setExportPort(exportPort);
+					 //出口口岸转大写拼音
+					 String exportPort = py.toPinYin(entity.getExportPort());
+					 entity.setExportPort(exportPort);
 
-				 //目的港+,+运抵国别转英文
-				 //查询数据字典获取英文
-				 List<DictModel> sysDicts = sysDictService.queryDictItemsByCode("port_of_destination");
-				 for(DictModel di:sysDicts){
-					 if(di.getText().equals(entity.getDestinationPort())){
-						 entity.setDestinationPort(di.getValue());
+					 //目的港+,+运抵国别转英文
+					 //查询数据字典获取英文
+					 List<DictModel> sysDicts = sysDictService.queryDictItemsByCode("port_of_destination");
+					 for (DictModel di : sysDicts) {
+						 if (di.getText().equals(entity.getDestinationPort())) {
+							 entity.setDestinationPort(di.getValue());
+						 }
 					 }
-				 }
-				 List<DictModel> sysDicts1 = sysDictService.queryDictItemsByCode("country_of_arrival");
-				 for(DictModel di:sysDicts1){
-					 if(di.getText().equals(entity.getArriveInCountry())){
-						 entity.setArriveInCountry(di.getValue());
+					 List<DictModel> sysDicts1 = sysDictService.queryDictItemsByCode("country_of_arrival");
+					 for (DictModel di : sysDicts1) {
+						 if (di.getText().equals(entity.getArriveInCountry())) {
+							 entity.setArriveInCountry(di.getValue());
+						 }
 					 }
-				 }
 
-				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
 
-				 //转map
-				 Field[] fields = entity.getClass().getDeclaredFields();
-				 for (Field field : fields) {
-					 field.setAccessible(true);
-					 map.put(field.getName(), field.get(entity));
-				 }
-				 //集合转map
-				 for(SyShippingOrderItem li:list){
-					 Field[] fieldsList = li.getClass().getDeclaredFields();
-					 Map<String, Object> mapList = new HashMap<String, Object>();
-					 for (Field field : fieldsList) {
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
 						 field.setAccessible(true);
-						 mapList.put(field.getName(), field.get(li));
+						 map.put(field.getName(), field.get(entity));
+					 }
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 listMap.add(mapList);
 					 }
-					 listMap.add(mapList);
-				 }
 
-				 map.put("item", listMap);
+					 map.put("item", listMap);
 
-				 Workbook workbook = ExcelExportUtil.exportExcel(params,map);
-				 ServletOutputStream outputStream = response.getOutputStream();
-				 workbook.write(outputStream);
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+					 ServletOutputStream outputStream = response.getOutputStream();
+					 workbook.write(outputStream);
 
 
-			 }else if(testName.equals("报关信息-装箱单")){
-				 List<Map<String,Object>> maiTouList = new ArrayList<>();
-                 boolean boo = true;
+				 }  else if (testName.equals("报关信息-合同-面料")) {
 
-				 entity.setDateTime(sf.format(date));
+					 //获取当前日期减去60天
+					 Calendar calendar = Calendar.getInstance();
+					 calendar.setTime(date);
+					 calendar.add(Calendar.DAY_OF_MONTH, -60);
+					 String dateTime = sf.format(calendar.getTime());
+					 Date locale = sf.parse(dateTime);
+					 SimpleDateFormat sdf1 = new SimpleDateFormat("MMM'.'dd'th,' yyyy", Locale.UK); // 月日年
+					 entity.setDateTime(sdf1.format(locale));
 
-				 //出口口岸中文
-				 entity.setExportPortName(entity.getExportPort());
-				 //出口口岸转大写拼音
-				 String exportPort = py.toPinYin(entity.getExportPort());
-				 entity.setExportPort(exportPort);
+					 //出口口岸转大写拼音
+					 String exportPort = py.toPinYin(entity.getExportPort());
+					 entity.setExportPort(exportPort);
 
-				 if(oConvertUtils.isNotEmpty(list.get(0).getClientAbbreviation())) {
-					 //查询数据字典唛头
-					 List<DictModel> test = sysDictService.queryDictItemsByCode("test0902002");
-					 for (DictModel di : test) {
-						 if (di.getText().equals(list.get(0).getClientAbbreviation())) {
-							 String split[] = di.getValue().split("\\+");
-							 for (int i = 0; i < split.length; i++) {
-								 Map<String, Object> maiTou = new HashMap<>();
-								 maiTou.put("name", split[i]);
-								 maiTouList.add(maiTou);
-							 }
-							 boo = false;
+					 //目的港+,+运抵国别转英文
+					 //查询数据字典获取英文
+					 List<DictModel> sysDicts = sysDictService.queryDictItemsByCode("port_of_destination");
+					 for (DictModel di : sysDicts) {
+						 if (di.getText().equals(entity.getDestinationPort())) {
+							 entity.setDestinationPort(di.getValue());
 						 }
+					 }
+					 List<DictModel> sysDicts1 = sysDictService.queryDictItemsByCode("country_of_arrival");
+					 for (DictModel di : sysDicts1) {
+						 if (di.getText().equals(entity.getArriveInCountry())) {
+							 entity.setArriveInCountry(di.getValue());
+						 }
+					 }
 
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
+
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
+						 field.setAccessible(true);
+						 map.put(field.getName(), field.get(entity));
+					 }
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 listMap.add(mapList);
 					 }
-				 }
-				 if(boo == true){
-					 Map<String,Object> maiTou = new HashMap<>();
-					 maiTou.put("name", " ");
-					 maiTouList.add(maiTou);
-				 }
 
-				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
+					 map.put("item", listMap);
+
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+					 ServletOutputStream outputStream = response.getOutputStream();
+					 workbook.write(outputStream);
+
+
+				 }else if (testName.equals("报关信息-装箱单")) {
+					 List<Map<String, Object>> maiTouList = new ArrayList<>();
+					 boolean boo = true;
+
+					 entity.setDateTime(sf.format(date));
+
+					 //出口口岸中文
+					 entity.setExportPortName(entity.getExportPort());
+					 //出口口岸转大写拼音
+					 String exportPort = py.toPinYin(entity.getExportPort());
+					 entity.setExportPort(exportPort);
+
+					 if (oConvertUtils.isNotEmpty(list.get(0).getClientAbbreviation())) {
+						 //查询数据字典唛头
+						 List<DictModel> test = sysDictService.queryDictItemsByCode("test0902002");
+						 for (DictModel di : test) {
+							 if (di.getText().equals(list.get(0).getClientAbbreviation())) {
+								 String split[] = di.getValue().split("\\+");
+								 for (int i = 0; i < split.length; i++) {
+									 Map<String, Object> maiTou = new HashMap<>();
+									 maiTou.put("name", split[i]);
+									 maiTouList.add(maiTou);
+								 }
+								 boo = false;
+							 }
 
-				 //转map
-				 Field[] fields = entity.getClass().getDeclaredFields();
-				 for (Field field : fields) {
-					 field.setAccessible(true);
-					 map.put(field.getName(), field.get(entity));
-				 }
-				 //集合转map
-				 for(SyShippingOrderItem li:list){
-					 Field[] fieldsList = li.getClass().getDeclaredFields();
-					 Map<String, Object> mapList = new HashMap<String, Object>();
-					 for (Field field : fieldsList) {
+						 }
+					 }
+					 if (boo == true) {
+						 Map<String, Object> maiTou = new HashMap<>();
+						 maiTou.put("name", " ");
+						 maiTouList.add(maiTou);
+					 }
+
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
+
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
 						 field.setAccessible(true);
-						 mapList.put(field.getName(), field.get(li));
+						 map.put(field.getName(), field.get(entity));
+					 }
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 listMap.add(mapList);
 					 }
-					 listMap.add(mapList);
-				 }
 
-				 map.put("item", listMap);
-				 map.put("list", maiTouList);
+					 map.put("item", listMap);
+					 map.put("list", maiTouList);
 
-				 Workbook workbook = ExcelExportUtil.exportExcel(params,map);
-				 ServletOutputStream outputStream = response.getOutputStream();
-				 workbook.write(outputStream);
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+					 ServletOutputStream outputStream = response.getOutputStream();
+					 workbook.write(outputStream);
 
-			 }else if(testName.equals("报关信息-结汇发票")){
+				 } else if (testName.equals("报关信息-结汇发票")) {
 
-				 List<Map<String,Object>> taitouList = new ArrayList<>();
+					 List<Map<String, Object>> taitouList = new ArrayList<>();
 
-				 //查询数据字典-公司抬头
-				 List<DictModel> test = sysDictService.queryDictItemsByCode("company_title");
+					 //查询数据字典-公司抬头
+					 List<DictModel> test = sysDictService.queryDictItemsByCode("company_title");
 
-				 if(oConvertUtils.isNotEmpty(list.get(0).getClientAbbreviation())) {
-					 if (list.get(0).getClientAbbreviation().equals("宁波森语")) {
-						 String split[] = test.get(0).getValue().split("\\+");
-						 for (int i = 0; i < split.length; i++) {
-							 Map<String, Object> maiTou = new HashMap<>();
-							 maiTou.put("name", split[i]);
-							 taitouList.add(maiTou);
+					 if (oConvertUtils.isNotEmpty(list.get(0).getClientAbbreviation())) {
+						 if (list.get(0).getClientAbbreviation().equals("宁波森语")) {
+							 String split[] = test.get(0).getValue().split("\\+");
+							 for (int i = 0; i < split.length; i++) {
+								 Map<String, Object> maiTou = new HashMap<>();
+								 maiTou.put("name", split[i]);
+								 taitouList.add(maiTou);
+							 }
+							 entity.setClientAbbreviation(split[0]);
+						 } else {
+							 String split[] = test.get(1).getValue().split("\\+");
+							 for (int i = 0; i < split.length; i++) {
+								 Map<String, Object> maiTou = new HashMap<>();
+								 maiTou.put("name", split[i]);
+								 taitouList.add(maiTou);
+							 }
+							 entity.setClientAbbreviation(split[0]);
 						 }
-						 entity.setClientAbbreviation(split[0]);
 					 } else {
 						 String split[] = test.get(1).getValue().split("\\+");
 						 for (int i = 0; i < split.length; i++) {
@@ -1067,43 +1128,68 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 						 }
 						 entity.setClientAbbreviation(split[0]);
 					 }
-				 }else {
-					 String split[] = test.get(1).getValue().split("\\+");
-					 for (int i = 0; i < split.length; i++) {
-						 Map<String, Object> maiTou = new HashMap<>();
-						 maiTou.put("name", split[i]);
-						 taitouList.add(maiTou);
+
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
+						 field.setAccessible(true);
+						 map.put(field.getName(), field.get(entity));
+					 }
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 listMap.add(mapList);
 					 }
-					 entity.setClientAbbreviation(split[0]);
-				 }
 
-				 //转map
-				 Field[] fields = entity.getClass().getDeclaredFields();
-				 for (Field field : fields) {
-					 field.setAccessible(true);
-					 map.put(field.getName(), field.get(entity));
+					 map.put("item", listMap);
+					 map.put("list", taitouList);
+
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
+
+
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
+					 ServletOutputStream outputStream = response.getOutputStream();
+					 workbook.write(outputStream);
 				 }
-				 //集合转map
-				 for(SyShippingOrderItem li:list){
-					 Field[] fieldsList = li.getClass().getDeclaredFields();
-					 Map<String, Object> mapList = new HashMap<String, Object>();
-					 for (Field field : fieldsList) {
+
+				 if (testName.equals("报关信息-报关单-面料")) {
+					 int size = 0;
+					 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\" + testName + ".xlsx");
+
+					 //转map
+					 Field[] fields = entity.getClass().getDeclaredFields();
+					 for (Field field : fields) {
 						 field.setAccessible(true);
-						 mapList.put(field.getName(), field.get(li));
+						 map.put(field.getName(), field.get(entity));
 					 }
-					 listMap.add(mapList);
-				 }
+					 //集合转map
+					 for (SyShippingOrderItem li : list) {
+					 	li.setTotalPrice(li.getNetWeight().multiply(li.getUnitPrice()));//重新计算金额 =  净重*单价
+						 size++;
+						 Field[] fieldsList = li.getClass().getDeclaredFields();
+						 Map<String, Object> mapList = new HashMap<String, Object>();
+						 for (Field field : fieldsList) {
+							 field.setAccessible(true);
+							 mapList.put(field.getName(), field.get(li));
+						 }
+						 mapList.put("size", size);
+						 listMap.add(mapList);
+					 }
+					 map.put("item", listMap);
 
-				 map.put("item", listMap);
-				 map.put("list", taitouList);
+					 Workbook workbook = ExcelExportUtil.exportExcel(params, map);
 
-				 TemplateExportParams params = new TemplateExportParams("D:\\单证模板\\"+testName+".xlsx");
+					 ServletOutputStream outputStream = response.getOutputStream();
 
+					 workbook.write(outputStream);
+
+				 }
 
-				 Workbook workbook = ExcelExportUtil.exportExcel(params,map);
-				 ServletOutputStream outputStream = response.getOutputStream();
-				 workbook.write(outputStream);
-			 }
 
 			 result.setSuccess(true);
 			 result.setMessage("导出成功,请往桌面查看!");

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrder.java

@@ -259,8 +259,10 @@ public class SyShippingOrder {
 	private String readyFabric;
 
 	//货代编码
+	@TableField(exist = false)
 	private String cvencode;
 	//货代名称
+	@TableField(exist = false)
 	private String cvenname;
 
 	//总数量

+ 7 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java

@@ -258,4 +258,11 @@ public class SyShippingOrderItem {
 	//保存接收单价
 	@TableField(exist = false)
 	private String price;
+
+	//报关单位
+	@TableField(exist = false)
+	private String declarationUnit;
+	//米数
+	@TableField(exist = false)
+	private String meter;
 }

+ 19 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/xml/SyShippingOrderMapper.xml

@@ -6,7 +6,7 @@
   select a.id,a.shipping_order_number as shippingOrderNumber,b.order_number as orderNumber,a.export_invoice_no as exportInvoiceNo,
   b.distribution_point as distributionPoint,a.unit_in_operation as unitInOperation,a.box_number as boxNumber,b.garment_factory as garmentFactory,
   a.total_gross_weight as totalGrossWeight,case when b.ready_fabric != '成衣' then b.volume else a.total_volume end as totalVolume,b.box_number as planQuantity,b.client_abbreviation as clientAbbreviation,
-  a.money,a.the_actual_shipping_date as theActualShippingDate,a.exchange_earnings_text as exchangeEarningsText,
+  a.money,a.the_actual_shipping_date as theActualShippingDate,a.exchange_earnings_text as exchangeEarningsText,a.ready_fabric as readyFabric,
   a.consignee,a.bill_of_lading_or_carriage_receipt as billOfLadingOrCarriageReceipt,a.the_final_shipping_date as theFinalShippingDate,
   a.addressee,a.trade_country as tradeCountry,a.arrive_in_country as arriveInCountry,a.export_port as exportPort,
   a.notifier,a.nottfy,a.destination_port as destinationPort,a.latest_date_of_shipment as latestDateOfShipment,a.the_documents_state as theDocumentsState
@@ -19,8 +19,8 @@
 
 <!--    查询装箱单-成衣-->
   <select id="queryTailoring" resultType="org.jeecg.modules.documents.syShippingOrder.entity.VO.SyPackingList">
-select a.id as id ,GROUP_CONCAT(b.id) as itemId,a.document_No as documentNo,a.order_Number as orderNumber,
-a.item_number as itemNumber,a.customer_abbreviation as customerAbbreviation,b.hod as preDeliveryDate,ac_set_no as acSetNo,
+select a.id as id ,GROUP_CONCAT(DISTINCT b.id) as itemId,a.document_No as documentNo,a.order_Number as orderNumber,
+a.item_number as itemNumber,a.customer_abbreviation as customerAbbreviation,b.hod as preDeliveryDate,b.ac_set_no as acSetNo,
 b.small_po as smallPo,b.distribution_point as distributionPoint,b.spur_Or_Sub_Order as purOrSubOrder,
 a.total as number,a.total_Boxes as planQuantity,round(a.total_Gross_Weight,2) as grossWeight,round(a.total_Net_Weight,2) as netWeight,
 a.total_Volume as totalVolume,a.container_code as containerCode,a.container_number as containerNumber,
@@ -46,9 +46,9 @@ d.terms_of_deliveryvalue as termsOfDeliveryvalue
     <!--    查询装箱单-面料-->
     <select id="queryFabric" resultType="org.jeecg.modules.documents.syShippingOrder.entity.VO.SyPackingList">
 
-  select c.hs_code as hsCode,c.declaration_name as declarationName,a.id as id ,GROUP_CONCAT(b.id) as itemId,a.document_No as documentNo,a.create_by as createBy,
+  select c.hs_code as hsCode,c.declaration_name as declarationName,a.id as id ,GROUP_CONCAT(DISTINCT b.id) as itemId,a.document_No as documentNo,a.create_by as createBy,
   a.export_invoice_no as exportInvoiceNo,a.container_number as containerNumber,a.garment_Factory as garmentFactory,
-  b.supplier as supplier,a.plumbum_No as plumbumNo,a.customer_abbreviation as customerAbbreviation,account as acSetNo,
+  b.supplier as supplier,a.plumbum_No as plumbumNo,a.customer_abbreviation as customerAbbreviation,b.account as acSetNo,
   case when b.u8_Pid is null then sum(b.actual_declared_quantity) else sum(b.gross_weight) end as Total,concat(sum(b.actual_declared_quantity),'.00') as number,
    sum(b.rolls) as planQuantity,
   b.item_Number as itemNumber,b.small_Po as smallPo,round(sum(b.gross_weight),2) as grossWeight,
@@ -84,7 +84,7 @@ d.terms_of_deliveryvalue as termsOfDeliveryvalue
     <select id="queryItem" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
 SELECT GROUP_CONCAT(id) as id, sy_shipping_order_item_id as syShippingOrderItemId, english_name as englishName, style_number as styleNumber, smail_po as smailPo,create_by as createBy,
 sum(number) as number,
-case when ready_fabric != '成衣' then sum(box_number) else box_number end as boxNumber,
+case when ready_fabric != '成衣' then sum(box_number) else box_number end as boxNumber,pk_org as pkOrg,
 case when ready_fabric != '成衣' then sum(gross_weight) else gross_weight end as grossWeight,
 case when ready_fabric != '成衣' then sum(net_weight) else net_weight end as netWeight,
 case when ready_fabric != '成衣' then volume else volume end as volume,round(sum(total_price),2) as totalPrice,
@@ -92,23 +92,25 @@ distribution_point as distributionPoint, container_code as containerCode, contai
 salesman, operating_department as operatingDepartment, purchase_outsourcing_order_no as purOrSubOrder, outsourcing_factory_for_procurement as outsourcingFactoryForProcurement,
  memo, sort, ready_fabric as readyFabric, tailoring_fabric_id as tailoringFabricId, GROUP_CONCAT(tailoring_fabric_item_id) as tailoringFabricItemId,client_abbreviation as clientAbbreviation
  FROM sy_shipping_order_item where del_flag = 0 and sy_shipping_order_item_id = #{id}
-group by group_id
+group by group_id order by style_number,smail_po desc
     </select>
 
 
+
+<!--    面料托书-->
     <select id="queryEelementMerge" resultType="org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem">
 
-select GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName, sum(a.number) as number,a.unit_price as unitPrice,
-round(a.number*a.unit_price,2) as totalPrice,round(a.gross_weight,2) as grossWeight,round(a.net_weight,2) as netWeight,'PCS' as pcs,a.volume as volume,
-a.box_number as boxNumber,
-'USD' as curr,'CHINA' as dree,'宁波其他/宁波象山县' as place,'照章征税' as certificate,a.style_number as styleNumber,a.smail_po as smailPo,
-a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm
+select GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,sum(c.meter) as meter,sum(a.number) as number,a.unit_price as unitPrice,
+round(sum(a.number*a.unit_price),2) as totalPrice,round(sum(a.gross_weight),2) as grossWeight,round(sum(a.net_weight),2) as netWeight,a.master_metering as pcs,a.volume as volume,
+'USD' as curr,'CHIAN' as dree,'宁波其他/宁波象山县' as place,'照章征税' as certificate,a.style_number as styleNumber,a.smail_po as smailPo,sum(a.box_number) as boxNumber,
+a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,b.declaration_unit as declarationUnit
  from sy_shipping_order_item a
 left join sy_declaration_elements b
 on a.elements_Id = b.id
-where a.sy_shipping_order_item_id = #{id}
-group by a.group_id
-
+left join sy_packing_list_fabric_item c
+on a.tailoring_fabric_item_id = c.id
+where a.sy_shipping_order_item_id =#{id}
+ GROUP BY a.group_id
     </select>
 
 
@@ -119,14 +121,14 @@ round(sum(t.totalPrice),2) as totalPrice,round(sum(t.grossWeight),2) as grossWei
 round(sum(t.volume),3) as volume,t.curr,t.dree,t.place,t.certificate,t.styleNumber,t.smailPo,t.orderNumber,t.ctns,t.kgs,t.cbm,
 t.clientAbbreviation from (
 select GROUP_CONCAT(a.id) as id,b.hs_code as hsCode,b.declaration_name as declarationName,b.english_product_name as englishProductName,sum(a.number) as number,a.unit_price as unitPrice,
-sum(a.number*a.unit_price) as totalPrice,a.gross_weight as grossWeight,a.net_weight as netWeight,a.master_metering as pcs,a.volume as volume,
+sum(a.number*a.unit_price) as totalPrice,a.gross_weight as grossWeight,a.net_weight as netWeight,a.master_metering as pcs,a.volume as volume,a.elements_Id as elementsId,
 'USD' as curr,'CHIAN' as dree,'宁波其他/宁波象山县' as place,'照章征税' as certificate,a.style_number as styleNumber,a.smail_po as smailPo,a.box_number as boxNumber,
 a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm
  from sy_shipping_order_item a
 left join sy_declaration_elements b
 on a.elements_Id = b.id
 where a.sy_shipping_order_item_id =#{id}
-group by a.group_id) t group by styleNumber
+group by a.group_id) t group by t.elementsId,t.smailPo order by t.styleNumber,t.smailPo desc
 
     </select>