Browse Source

托书发票打印

zengtx 1 year ago
parent
commit
51ca38d577

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

@@ -1242,7 +1242,8 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 				 	List<Map<String,Object>> mergeMap = new ArrayList<>();
 
 					 entity.setDateTime(sdf1.format(entity.getShippingOrderDate()));
-
+					 String earliestDeliveryDate[] = list.get(list.size()-1).getEarliestDeliveryDate().split(" ");
+					 entity.setEarliestDeliveryDate(earliestDeliveryDate[0]);
 					 //转map
 					 Field[] fields = entity.getClass().getDeclaredFields();
 					 for (Field field : fields) {
@@ -1391,6 +1392,8 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 	 public Result<Integer> expensesU8(SyShippingOrder syShippingOrder) throws IllegalAccessException {
 		 Result<Integer> result = new Result<Integer>();
 
+		 SimpleDateFormat sf = new SimpleDateFormat("yyyy-M-dd 00:00:00.000");
+
 		 if(oConvertUtils.isEmpty(syShippingOrder.getId())){
 		 	result.setSuccess(false);
 		 	result.setMessage("未获取到ID!");
@@ -1408,6 +1411,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 		 try {
 			 //查询主表信息
 			 SyShippingOrder entity = syShippingOrderService.getById(syShippingOrder.getId());
+			 String rateDate = sf.format(entity.getTheFinalShippingDate());
 			 //判断是否已提交
 			 if(entity.getTheDocumentsState().equals("0")){
 				 result.setResult(0);
@@ -1489,6 +1493,7 @@ public class SyShippingOrderController extends JeecgController<SyShippingOrder,
 				 }
 			 }
 
+			 map.put("rateDate",rateDate);
 			 int i = 0;
 			 if (itemList.get(0).getPkOrg().equals("901")) {
 				 i = syShippingOrderService.saveSalePayVouchOne(map, listmap, rmbmap, usdmap);

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

@@ -97,8 +97,6 @@ public class SyShippingOrder {
 	private String latestDateOfShipment;
 	/**最终船期*/
 	@Excel(name = "最终船期", width = 20, format = "yyyy-MM-dd")
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
-    @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "最终船期")
 	private java.util.Date theFinalShippingDate;
 	/**收货人*/
@@ -316,4 +314,7 @@ public class SyShippingOrder {
 	//国外发票加工费总金额
 	@TableField(exist = false)
 	private String sumMoneyGw;
+	//最早交期
+	@TableField(exist = false)
+	private String earliestDeliveryDate;
 }

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

@@ -331,4 +331,7 @@ public class SyShippingOrderItem {
 	//根据款号合并字段
 	@TableField(exist = false)
 	private String mergeStyleNumber;
+	//最早交期
+	@TableField(exist = false)
+	private String earliestDeliveryDate;
 }

+ 3 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/mapper/SyShippingOrderMapper.java

@@ -74,4 +74,7 @@ public interface SyShippingOrderMapper extends BaseMapper<SyShippingOrder> {
 
     //根据款号合并数据(国外报关单使用)
     public List<SyShippingOrderItem> mergeStyleNumber(@Param("id") String id);
+
+    //查询U8 汇率
+    public Map<String,Object> queryU8Rate(@Param("year") String year,@Param("month") String month);
 }

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

@@ -126,13 +126,13 @@ where a.sy_shipping_order_item_id =#{id}
 select t.id, t.hsCode,sum(t.boxNumber) as boxNumber, t.declarationName,t.englishProductName,sum(t.number) as number,round(t.unitPrice,2) as unitPrice,
 round(sum(t.totalPrice),2) as totalPrice,round(sum(t.grossWeight),2) as grossWeight,round(sum(t.netWeight),2) as netWeight,t.pcs,t.pacs,
 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,pkOrg,t.factoryUnitPrice,
-t.outerBoxLength,t.outerBoxWidth,t.outerBoxHeight,t.hod,t.unIt,t.emp,t.purchaseOutsourcingOrderNo,t.packId,
+t.outerBoxLength,t.outerBoxWidth,t.outerBoxHeight,t.hod,t.unIt,t.emp,t.purchaseOutsourcingOrderNo,t.packId,t.salesman,t.earliestDeliveryDate,
 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,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,'PCS' as pacs,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,
-c.factory_Unit_Price as factoryUnitPrice,c.outer_box_length as outerBoxLength,c.outer_box_width as outerBoxWidth,c.outer_box_height as outerBoxHeight,c.hod as hod,
+a.order_number as orderNumber,a.client_abbreviation as clientAbbreviation,'PCS' as pacs,'CTNS' as ctns,'KGS' as kgs,'CBM' as cbm,c.salesman as salesman,
+c.factory_Unit_Price as factoryUnitPrice,c.outer_box_length as outerBoxLength,c.outer_box_width as outerBoxWidth,c.outer_box_height as outerBoxHeight,c.hod as hod,min(c.hod) as earliestDeliveryDate,
 a.pk_org as pkOrg,round((a.unit_price*0.9),2) as unIt,'' as emp,a.purchase_outsourcing_order_no as purchaseOutsourcingOrderNo,c.pack_id as packId
  from sy_shipping_order_item a
 left join sy_declaration_elements b
@@ -240,4 +240,8 @@ where del_flag = 0 and sy_shipping_order_item_id = #{id}  group by group_id) t
         group by a.style_number
     </select>
 
+    <select id="queryU8Rate"  parameterType="java.lang.String" resultType="java.util.HashMap">
+        SELECT nflat FROM exch WHERE iYear = #{year} and iperiod like concat(#{month},'%')
+    </select>
+
 </mapper>

+ 29 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/impl/SyShippingOrderServiceImpl.java

@@ -35,6 +35,7 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
+import java.time.ZonedDateTime;
 import java.util.*;
 
 /**
@@ -259,10 +260,10 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                         syShippingOrderItem.setDelFlag("0");
                         syShippingOrderItem.setSmailPo(lit.getSmallPo());
                         syShippingOrderItem.setGrossWeight(lit.getTotalGrossWeight());//毛重
-
+                        syShippingOrderItem.setOperatingDepartment(lit.getSalesDepartment());
                         syShippingOrderItem.setNetWeight(lit.getTotalNetWeight());//净重
                         syShippingOrderItem.setVolume(lit.getTotalVolume());//体积
-
+                        syShippingOrderItem.setSalesman(lit.getSalesman());
                         syShippingOrderItem.setDistributionPoint(lit.getDistributionPoint());
                         syShippingOrderItem.setUnitPrice(lit.getUnitPrice());
                         syShippingOrderItem.setPreShipmentDate(lit.getHod());
@@ -571,6 +572,31 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
         //单据id
         //cVouchID = org.jeecg.modules.system.util.oConvertUtils.addOne(purchaseWarehousingMapper.getMaxCode("cVouchID","SalePayVouch","dcreatesystime"));
 
+        //查询U8汇率
+        Map<String, Object> rate = null;
+        String nflat = "";
+        String lastTime = map1.get("rateDate").toString();
+        if(oConvertUtils.isEmpty(lastTime)){
+            SimpleDateFormat sf1 = new SimpleDateFormat("yyyy-M-dd");
+            String dd = sf1.format(new Date());
+            String rateSplit[] = dd.split("-");
+            rate = syShippingOrderMapper.queryU8Rate(rateSplit[0], rateSplit[1]);
+            if(oConvertUtils.isEmpty(rate)){
+                nflat = "1";
+            }else{
+                nflat = rate.get("nflat").toString();
+            }
+
+        }else {
+            String rateSplit[] = lastTime.split("-");
+            rate = syShippingOrderMapper.queryU8Rate(rateSplit[0], rateSplit[1]);
+            if(oConvertUtils.isEmpty(rate)){
+                nflat = "1";
+            }else{
+                nflat = rate.get("nflat").toString();
+            }
+        }
+
         int ii = 0;
 
         try {
@@ -667,7 +693,7 @@ public class SyShippingOrderServiceImpl extends ServiceImpl<SyShippingOrderMappe
                     map.put("cSourceCode", li.get("orderNumber"));//订单号li.get("orderNumber")
                     map.put("cSOCode", li.get("orderNumber"));//订单号
                     map.put("cnextsystem", "其他应付单");//单据流向
-                    map.put("iexchrate", "1");//汇率
+                    map.put("iexchrate", nflat);//汇率
                     map.put("Cexch_Name", "美元");
                     map.put("iVTid", "57");//单据模板号
                     map.put("cvencode", usd.get("freightForwarder"));