|
@@ -4018,11 +4018,94 @@ class common {
|
|
|
foreach($h_serial_no_arr as $serial_no){
|
|
foreach($h_serial_no_arr as $serial_no){
|
|
|
$oceanInfo = common::excuteObjectSql("select (select manifest_type from public.ocean o where o.serial_no = ooc.serial_no limit 1) as manifest_type
|
|
$oceanInfo = common::excuteObjectSql("select (select manifest_type from public.ocean o where o.serial_no = ooc.serial_no limit 1) as manifest_type
|
|
|
from public.kln_ocean oo where o.serial_no ='".$serial_no."'" );
|
|
from public.kln_ocean oo where o.serial_no ='".$serial_no."'" );
|
|
|
- $ctnr = common::excuteObjectSql("select ctnr,seal_no,size,qty,unit, FROM oc_container oc where oc.serial_no::text = '".$serial_no."'
|
|
|
|
|
|
|
+
|
|
|
|
|
+ $ctnrs = common::excuteListSql("select ctnr,seal_no,size,qty,unit,grs_kgs,cbm,marks,description,is_lcl FROM oc_container oc where oc.serial_no::text = '".$serial_no."'
|
|
|
and oc.ctnr in (select regexp_split_to_table('".$ctnr."', ','))" );
|
|
and oc.ctnr in (select regexp_split_to_table('".$ctnr."', ','))" );
|
|
|
|
|
|
|
|
|
|
+ $total_pcs = "";
|
|
|
|
|
+ $total_pcs_unit = "";
|
|
|
|
|
+ $total_weight = "";
|
|
|
|
|
+ $total_weight_unit = "";
|
|
|
|
|
+ $total_volume = "";
|
|
|
|
|
+ $total_volume_unit = "";
|
|
|
|
|
+
|
|
|
|
|
+ $biztype = $oceanInfo['ex_im'] == "Export" && $oceanInfo['transport_mode'] == "sea" ? "SE" :(
|
|
|
|
|
+ $oceanInfo['ex_im'] == "Import" && $oceanInfo['transport_mode'] == "sea" ? "SI" :(
|
|
|
|
|
+ $oceanInfo['ex_im'] == "Export" && $oceanInfo['transport_mode'] == "air" ? "AE" :(
|
|
|
|
|
+ $oceanInfo['ex_im'] == "Import" && $oceanInfo['transport_mode'] == "air" ? "AI" : "" )));
|
|
|
|
|
+
|
|
|
|
|
+ // 记录
|
|
|
|
|
+ // "INSERT INTO public.do_header(
|
|
|
|
|
+ // id,air_ocean, station_code, do_no, biztype, delivery_type,mode_type,
|
|
|
|
|
+ // serial_no, lot_no, awbbl_no, job_no, do_date,
|
|
|
|
|
+ // consignee, consignee_name, consignee_exp,consignee_pic, consignee_tel, consignee_fax,
|
|
|
|
|
+ // collect, collect_name,collect_exp, collect_pic, collect_tel, collect_fax,
|
|
|
|
|
+ // notify, notify_name, shipper, shipper_name,
|
|
|
|
|
+ // transport_agent, transport_agent_name, transport_agent_exp,transport_agent_pic, transport_agent_tel, transport_agent_fax,
|
|
|
|
|
+ // truck_no, driver_name,do_release_to, total_pcs, total_pcs_unit, total_weight,
|
|
|
|
|
+ // est_delivery_date, est_delivery_time,
|
|
|
|
|
+ // instructions,
|
|
|
|
|
+ // total_weight_unit, total_volume, total_volume_unit, commodity1, commodity2, remark, create_user, create_time,
|
|
|
|
|
+ // modify_user, modify_time, booking_no,total_chrgwt_unit,departure_airport,discharge_airport,chrgwt, consignee_addr_type, collect_addr_type, consignee2, consignee2_name,
|
|
|
|
|
+ // broker, broker_name, broker_exp, broker_pic, broker_tel, broker_fax, broker_addr_type,
|
|
|
|
|
+ // terminal_code, terminal_name, terminal_signed_by, terminal_reference,terminal_time,terminal_date,terminal_address,terminal_tel,terminal_fax,terminal_pic,
|
|
|
|
|
+ // delivery_vehicle_type, delivery_fuel_type,
|
|
|
|
|
+ // delivery_is_refrigerated_shipment,collect_addr_type_id,consignee_addr_type_id,broker_addr_type_id,loadterm,collect_addr_key,consignee_addr_key,
|
|
|
|
|
+ // broker_addr_key,collect_city_code,collect_country_code,consignee_country_code,consignee_city_code)
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 这个id,和no, 我这边应该不生成,每个站点的应该不一样
|
|
|
|
|
+ * delivery_type 按逻辑来说是 Select code,description,category From kerry_system_code Where category in ('DELIVERYTYPE') and is_active =true order by sno取出来的。
|
|
|
|
|
+ * online上没有值,暂时取截图里面的值 "Awaiting Confirmation"
|
|
|
|
|
+ *
|
|
|
|
|
+ * over_balance,total_chrgwt_unit,chrgwt
|
|
|
|
|
+ *
|
|
|
|
|
+ * delivery_vehicle_type, delivery_fuel_type, 如果选择的是road ,会有默认的配置信息,每个站点应该不一样
|
|
|
|
|
+ */
|
|
|
|
|
+ $doNo = common::GeneralDoNo($oceanInfo['agent']);
|
|
|
|
|
+ $Id = common::excuteOneSql("select nextval('do_header_id_seq')");
|
|
|
|
|
+ "INSERT INTO public.do_header(
|
|
|
|
|
+ id,air_ocean, station_code, do_no, biztype, delivery_type,mode_type,
|
|
|
|
|
+ serial_no, lot_no, awbbl_no, job_no, do_date,
|
|
|
|
|
+ total_pcs, total_pcs_unit,
|
|
|
|
|
+ total_weight,total_weight_unit,
|
|
|
|
|
+ total_volume, total_volume_unit,
|
|
|
|
|
+ est_delivery_date, est_delivery_time,
|
|
|
|
|
+ instructions,
|
|
|
|
|
+ create_user, create_time,modify_user, modify_time,
|
|
|
|
|
+ booking_no,delivery_vehicle_type, delivery_fuel_type,
|
|
|
|
|
+ consignee, consignee_name, consignee_exp,consignee_pic, consignee_tel, consignee_fax)
|
|
|
|
|
+ VALUES ('".$Id."', '".$oceanInfo['transport_mode']."', '".$oceanInfo['agent']."','".$doNo."','".$biztype."','Awaiting Confirmation','".$delivery_booking['delivery_mode']."',
|
|
|
|
|
+ '".$serial_no."','".$oceanInfo['m_bol']."','".$oceanInfo['h_bol']."','".$oceanInfo['job_no']."',now(),
|
|
|
|
|
+ '".$total_pcs."','".$total_pcs_unit."','".$total_weight."','".$total_weight_unit."','".$total_volume."','".$total_volume_unit."',
|
|
|
|
|
+ '".$delivery_booking['delivery_date']."','".$delivery_booking['delivery_date']."',
|
|
|
|
|
+ '".$delivery_booking['special_requirements']."',
|
|
|
|
|
+ '"._getLoginName()."',now(),'"._getLoginName()."',now(),
|
|
|
|
|
+ '".$oceanInfo['booking_no']."');";
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * sno
|
|
|
|
|
+ */
|
|
|
|
|
+ foreach($ctnrs as $ctnr){
|
|
|
|
|
+ "INSERT INTO public.do_detail(
|
|
|
|
|
+ do_header_id, pcs, pcs_unit, weight, weight_unit, volume,
|
|
|
|
|
+ marks, description, create_user, create_time, modify_user, modify_time,
|
|
|
|
|
+ ctnr, size, seal_no, is_lcl)
|
|
|
|
|
+ VALUES ('".$Id."','".$ctnr['qty']."', '".$ctnr['unit']."','".$ctnr['grs_kgs']."','KGS','".$ctnr['cbm']."',
|
|
|
|
|
+ '".$ctnr['marks']."','".$ctnr['description']."','"._getLoginName()."',now(),'"._getLoginName()."',now(),
|
|
|
|
|
+ '".$ctnr['ctnr']."','".$ctnr['size']."','".$ctnr['seal_no']."','".$ctnr['is_lcl']."');";
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ public static function GeneralDoNo($agent){
|
|
|
|
|
+ // 构建前缀:DO- + 站点 + 年(2位) + 月(2位)
|
|
|
|
|
+ $prefix = 'DO-' . $agent;
|
|
|
|
|
+ $prefix .= date('y'); // 两位年份
|
|
|
|
|
+ $prefix .= str_pad(date('m'), 2, '0', STR_PAD_LEFT); // 两位月份
|
|
|
|
|
+ // 数据库函数调用:gen_serial_no(key, prefix, length, padding)
|
|
|
|
|
+ $sql = "SELECT * FROM gen_serial_no('invoice_no', :prefix, 1, 4)";
|
|
|
|
|
+ return common::excuteOneSql($sql);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
?>
|
|
?>
|