|
|
using HcUtility.Core;
|
|
|
using Newtonsoft.Json;
|
|
|
using Newtonsoft.Json.Linq;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Data;
|
|
|
using System.Data.SqlClient;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using Microsoft.Practices.EnterpriseLibrary.Data;
|
|
|
using System.Xml;
|
|
|
|
|
|
namespace Job_JieFeng_FTP
|
|
|
{
|
|
|
|
|
|
|
|
|
[JsonObject]
|
|
|
public class FTP_SeaeOrderMC //op_seaeorder
|
|
|
{
|
|
|
|
|
|
#region private Fields
|
|
|
private string _BSNO = string.Empty;
|
|
|
private string _ORSTATUS = string.Empty;
|
|
|
private string _BSDATE = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
private string _MBLNO = string.Empty;
|
|
|
private string _CUSTOMERNAME = string.Empty;
|
|
|
private string _SHIPPER = string.Empty;
|
|
|
private string _CONSIGNEE = string.Empty;
|
|
|
private string _NOTIFYPARTY = string.Empty;
|
|
|
private string _CARRIER = string.Empty;
|
|
|
private string _VESSEL = string.Empty;
|
|
|
private string _VOYNO = string.Empty;
|
|
|
private string _ETD = string.Empty;
|
|
|
private string _PlACERECEIPT = string.Empty;
|
|
|
private string _PORTLOADID = string.Empty;
|
|
|
private string _PORTLOAD = string.Empty;
|
|
|
private string _PORTDISCHARGEID = string.Empty;
|
|
|
private string _PORTDISCHARGE = string.Empty;
|
|
|
private string _PLACEDELIVERYID = string.Empty;
|
|
|
private string _PLACEDELIVERY = string.Empty;
|
|
|
private string _DESTINATIONID = string.Empty;
|
|
|
private string _DESTINATION = string.Empty;
|
|
|
private string _NOBILL = string.Empty;
|
|
|
private string _ISSUETYPE = string.Empty;
|
|
|
private string _ISSUEDATE = string.Empty;
|
|
|
private string _ISSUEPLACE = string.Empty;
|
|
|
private string _BLFRT = string.Empty;
|
|
|
private string _PREPARDAT = string.Empty;
|
|
|
private string _PAYABLEAT = string.Empty;
|
|
|
private string _SERVICE = string.Empty;
|
|
|
private string _MARKS = string.Empty;
|
|
|
private string _NOPKGS = string.Empty;
|
|
|
private string _DESCRIPTION = string.Empty;
|
|
|
private string _GOODSNAME = string.Empty;
|
|
|
private string _GROSSWEIGHT = string.Empty;
|
|
|
private string _MEASUREMENT = string.Empty;
|
|
|
private string _PKGS = "0";
|
|
|
private string _KINDPKGS = string.Empty;
|
|
|
private string _KGS = "0";
|
|
|
private string _CBM = "0";
|
|
|
private string _TOTALNO = string.Empty;
|
|
|
private string _CNTRTOTAL = string.Empty;
|
|
|
private string _INPUTBY = string.Empty;
|
|
|
private string _INVNO = string.Empty;
|
|
|
private string _CARGOID = string.Empty;
|
|
|
private string _DCLASS = string.Empty;
|
|
|
private string _DUNNO = string.Empty;
|
|
|
private string _REEFERF = string.Empty;
|
|
|
private string _TEMPID = string.Empty;
|
|
|
private string _TEMPSET = string.Empty;
|
|
|
private string _TEMPMAX = string.Empty;
|
|
|
private string _TEMPMIN = string.Empty;
|
|
|
private string _CUSTOMSNUM = "0";
|
|
|
private string _REMARK = string.Empty;
|
|
|
private string _DPAGE = string.Empty;
|
|
|
private string _DLABEL = string.Empty;
|
|
|
private string _LANE = string.Empty;
|
|
|
private string _SERVICECONTRACTNO = string.Empty;
|
|
|
#endregion
|
|
|
|
|
|
#region R&W
|
|
|
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
|
|
|
public string BSNO
|
|
|
{
|
|
|
get { return _BSNO; }
|
|
|
set { _BSNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string ORSTATUS
|
|
|
{
|
|
|
get { return _ORSTATUS; }
|
|
|
set { _ORSTATUS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string BSDATE
|
|
|
{
|
|
|
get { return _BSDATE; }
|
|
|
set { _BSDATE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string MBLNO
|
|
|
{
|
|
|
get { return _MBLNO; }
|
|
|
set { _MBLNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CUSTOMERNAME
|
|
|
{
|
|
|
get { return _CUSTOMERNAME; }
|
|
|
set { _CUSTOMERNAME = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string SHIPPER
|
|
|
{
|
|
|
get { return _SHIPPER; }
|
|
|
set { _SHIPPER = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CONSIGNEE
|
|
|
{
|
|
|
get { return _CONSIGNEE; }
|
|
|
set { _CONSIGNEE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string NOTIFYPARTY
|
|
|
{
|
|
|
get { return _NOTIFYPARTY; }
|
|
|
set { _NOTIFYPARTY = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CARRIER
|
|
|
{
|
|
|
get { return _CARRIER; }
|
|
|
set { _CARRIER = value; }
|
|
|
}
|
|
|
|
|
|
[ModelDB]
|
|
|
public string VESSEL
|
|
|
{
|
|
|
get { return _VESSEL; }
|
|
|
set { _VESSEL = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string VOYNO
|
|
|
{
|
|
|
get { return _VOYNO; }
|
|
|
set { _VOYNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string ETD
|
|
|
{
|
|
|
get { return _ETD; }
|
|
|
set { _ETD = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PlACERECEIPT
|
|
|
{
|
|
|
get { return _PlACERECEIPT; }
|
|
|
set { _PlACERECEIPT = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PORTLOADID
|
|
|
{
|
|
|
get { return _PORTLOADID; }
|
|
|
set { _PORTLOADID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PORTLOAD
|
|
|
{
|
|
|
get { return _PORTLOAD; }
|
|
|
set { _PORTLOAD = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PORTDISCHARGEID
|
|
|
{
|
|
|
get { return _PORTDISCHARGEID; }
|
|
|
set { _PORTDISCHARGEID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PORTDISCHARGE
|
|
|
{
|
|
|
get { return _PORTDISCHARGE; }
|
|
|
set { _PORTDISCHARGE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PLACEDELIVERYID
|
|
|
{
|
|
|
get { return _PLACEDELIVERYID; }
|
|
|
set { _PLACEDELIVERYID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PLACEDELIVERY
|
|
|
{
|
|
|
get { return _PLACEDELIVERY; }
|
|
|
set { _PLACEDELIVERY = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DESTINATIONID
|
|
|
{
|
|
|
get { return _DESTINATIONID; }
|
|
|
set { _DESTINATIONID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DESTINATION
|
|
|
{
|
|
|
get { return _DESTINATION; }
|
|
|
set { _DESTINATION = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string NOBILL
|
|
|
{
|
|
|
get { return _NOBILL; }
|
|
|
set { _NOBILL = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string ISSUETYPE
|
|
|
{
|
|
|
get { return _ISSUETYPE; }
|
|
|
set { _ISSUETYPE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string ISSUEDATE
|
|
|
{
|
|
|
get { return _ISSUEDATE; }
|
|
|
set { _ISSUEDATE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string ISSUEPLACE
|
|
|
{
|
|
|
get { return _ISSUEPLACE; }
|
|
|
set { _ISSUEPLACE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string BLFRT
|
|
|
{
|
|
|
get { return _BLFRT; }
|
|
|
set { _BLFRT = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PREPARDAT
|
|
|
{
|
|
|
get { return _PREPARDAT; }
|
|
|
set { _PREPARDAT = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PAYABLEAT
|
|
|
{
|
|
|
get { return _PAYABLEAT; }
|
|
|
set { _PAYABLEAT = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string SERVICE
|
|
|
{
|
|
|
get { return _SERVICE; }
|
|
|
set { _SERVICE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string MARKS
|
|
|
{
|
|
|
get { return _MARKS; }
|
|
|
set { _MARKS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string NOPKGS
|
|
|
{
|
|
|
get { return _NOPKGS; }
|
|
|
set { _NOPKGS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DESCRIPTION
|
|
|
{
|
|
|
get { return _DESCRIPTION; }
|
|
|
set { _DESCRIPTION = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string GOODSNAME
|
|
|
{
|
|
|
get { return _GOODSNAME; }
|
|
|
set { _GOODSNAME = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string GROSSWEIGHT
|
|
|
{
|
|
|
get { return _GROSSWEIGHT; }
|
|
|
set { _GROSSWEIGHT = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string MEASUREMENT
|
|
|
{
|
|
|
get { return _MEASUREMENT; }
|
|
|
set { _MEASUREMENT = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string PKGS
|
|
|
{
|
|
|
get { return _PKGS; }
|
|
|
set { _PKGS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string KINDPKGS
|
|
|
{
|
|
|
get { return _KINDPKGS; }
|
|
|
set { _KINDPKGS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string KGS
|
|
|
{
|
|
|
get { return _KGS; }
|
|
|
set { _KGS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CBM
|
|
|
{
|
|
|
get { return _CBM; }
|
|
|
set { _CBM = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string TOTALNO
|
|
|
{
|
|
|
get { return _TOTALNO; }
|
|
|
set { _TOTALNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CNTRTOTAL
|
|
|
{
|
|
|
get { return _CNTRTOTAL; }
|
|
|
set { _CNTRTOTAL = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string INPUTBY
|
|
|
{
|
|
|
get { return _INPUTBY; }
|
|
|
set { _INPUTBY = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string INVNO
|
|
|
{
|
|
|
get { return _INVNO; }
|
|
|
set { _INVNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CARGOID
|
|
|
{
|
|
|
get { return _CARGOID; }
|
|
|
set { _CARGOID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DCLASS
|
|
|
{
|
|
|
get { return _DCLASS; }
|
|
|
set { _DCLASS = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DUNNO
|
|
|
{
|
|
|
get { return _DUNNO; }
|
|
|
set { _DUNNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string REEFERF
|
|
|
{
|
|
|
get { return _REEFERF; }
|
|
|
set { _REEFERF = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string TEMPID
|
|
|
{
|
|
|
get { return _TEMPID; }
|
|
|
set { _TEMPID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string TEMPSET
|
|
|
{
|
|
|
get { return _TEMPSET; }
|
|
|
set { _TEMPSET = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string TEMPMAX
|
|
|
{
|
|
|
get { return _TEMPMAX; }
|
|
|
set { _TEMPMAX = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string TEMPMIN
|
|
|
{
|
|
|
get { return _TEMPMIN; }
|
|
|
set { _TEMPMIN = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CUSTOMSNUM
|
|
|
{
|
|
|
get { return _CUSTOMSNUM; }
|
|
|
set { _CUSTOMSNUM = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string REMARK
|
|
|
{
|
|
|
get { return _REMARK; }
|
|
|
set { _REMARK = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DPAGE
|
|
|
{
|
|
|
get { return _DPAGE; }
|
|
|
set { _DPAGE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string DLABEL
|
|
|
{
|
|
|
get { return _DLABEL; }
|
|
|
set { _DLABEL = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string LANE
|
|
|
{
|
|
|
get { return _LANE; }
|
|
|
set { _LANE = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string SERVICECONTRACTNO
|
|
|
{
|
|
|
get { return _SERVICECONTRACTNO; }
|
|
|
set { _SERVICECONTRACTNO = value; }
|
|
|
}
|
|
|
public string CUSTATTN { get; set; }
|
|
|
public string CUSTTEL { get; set; }
|
|
|
|
|
|
public string 退舱任务类型 { get { return "'EDI订舱退舱'"; } }
|
|
|
public string 修改任务类型 { get { return "'EDI订舱修改'"; } }
|
|
|
public string 新增任务类型 { get { return "'EDI订舱'"; } }
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
#region 简易分解XML
|
|
|
|
|
|
private XmlDocument _root { get; set; }
|
|
|
|
|
|
XmlNode root { get { return XmlReader.GetFirstChildNodeByName(_root, "v4:Order", nsp); } }
|
|
|
XmlNode DataArea
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetFirstChildNodeByName(root, "DataArea", nsp);
|
|
|
}
|
|
|
}
|
|
|
#region 增删标记
|
|
|
XmlNode Action
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetFirstChildNodeByName(DataArea, "Action", nsp);
|
|
|
}
|
|
|
}
|
|
|
public string 增删标记 {
|
|
|
get {
|
|
|
XmlNode ActionCode = XmlReader.GetFirstChildNodeByName(Action, "ActionCode", nsp);
|
|
|
return XmlReader.ReadNodeText(ActionCode);
|
|
|
}
|
|
|
}
|
|
|
public string 增删标记str
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
if (增删标记 == "9") return "";
|
|
|
if (增删标记 == "5") return "";
|
|
|
if (增删标记 == "1") return "【退舱】\r\n";
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
public string 任务类型增删标记
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
|
|
|
if (增删标记 == "9") return $"(case when exists (select 1 from t_op_task where 提单号='{CUSTNO}' and [任务类型]={退舱任务类型}) then {修改任务类型} else {新增任务类型} end)";
|
|
|
if (增删标记 == "5") return $"{修改任务类型}";
|
|
|
if (增删标记 == "1") return "'EDI订舱退舱'";
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
#region 联系人联系方式
|
|
|
XmlNode MessageContact
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetFirstChildNodeByName(DataArea, "MessageContact", nsp);
|
|
|
}
|
|
|
}
|
|
|
XmlNode SimsID
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetFirstChildNodeByName(MessageContact, "SimsID", nsp);
|
|
|
}
|
|
|
}
|
|
|
string 联系人 {
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.ReadNodeText(SimsID);
|
|
|
}
|
|
|
}
|
|
|
string 联系电话
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var ContactCommunicationList = XmlReader.GetChildNodesByName(MessageContact, "ContactCommunication");
|
|
|
foreach (XmlNode item in ContactCommunicationList) {
|
|
|
string Type = XmlReader.ReadFirstChildNodeTextByName(item, "Type");
|
|
|
if (Type == "TE") {
|
|
|
return XmlReader.ReadFirstChildNodeTextByName(item, "CommID");
|
|
|
}
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
string 联系邮箱
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var ContactCommunicationList = XmlReader.GetChildNodesByName(MessageContact, "ContactCommunication");
|
|
|
foreach (XmlNode item in ContactCommunicationList)
|
|
|
{
|
|
|
string Type = XmlReader.ReadFirstChildNodeTextByName(item, "Type");
|
|
|
if (Type == "EM")
|
|
|
{
|
|
|
return XmlReader.ReadFirstChildNodeTextByName(item, "CommID");
|
|
|
}
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
private XmlNode OrderDescription
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
|
|
|
return XmlReader.GetFirstChildNodeByName(DataArea, "OrderDescription");
|
|
|
}
|
|
|
}
|
|
|
#region 付费方式
|
|
|
private XmlNode TransportConditions
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetFirstChildNodeByName(OrderDescription, "TransportConditions");
|
|
|
}
|
|
|
}
|
|
|
private XmlNode PaymentTerm
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetFirstChildNodeByName(TransportConditions, "PaymentTerm");
|
|
|
}
|
|
|
}
|
|
|
private string _PaymentTerm()
|
|
|
{
|
|
|
return XmlReader.ReadNodeText( XmlReader.GetFirstChildNodeByName(TransportConditions, "PaymentTerm")).ToUpper();
|
|
|
}
|
|
|
private string 付费方式 {
|
|
|
get {
|
|
|
if (_PaymentTerm() == "CC") return "FREIGHT COLLECT";
|
|
|
if (_PaymentTerm() == "PP") return "FREIGHT PREPAID";
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string 付费地点 {
|
|
|
get
|
|
|
{
|
|
|
if (_PaymentTerm() == "CC") {
|
|
|
return 地点名称(卸货港);
|
|
|
}
|
|
|
if (_PaymentTerm() == "PP") {
|
|
|
return 地点名称(起运港);
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
public XmlNode Identification { get { return XmlReader.GetFirstChildNodeByName(OrderDescription, "Identification"); } }
|
|
|
public XmlNode UniqueOrderNumber { get { return XmlReader.GetFirstChildNodeByName(Identification, "UniqueOrderNumber"); } }
|
|
|
|
|
|
public XmlNode OrderReason { get { return XmlReader.GetFirstChildNodeByName(Identification, "OrderReason"); } }
|
|
|
public string legCounter { get { return XmlReader.ReadAttrValue(UniqueOrderNumber, "legCounter"); } }
|
|
|
public string CUSTNO { get { return XmlReader.ReadNodeText(UniqueOrderNumber); } }
|
|
|
public string BLTYPE{ get { return XmlReader.ReadNodeText(OrderReason); } }
|
|
|
|
|
|
private XmlNodeList PartnerList
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetChildNodesByName(OrderDescription, "Partner");
|
|
|
}
|
|
|
}
|
|
|
#region 相关外围公司:委托单位 发货人 收货人 通知人
|
|
|
private XmlNode 委托单位
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Partner", "roleCode", "OY", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 发货人
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Partner", "roleCode", "CZ", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 收货人
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Partner", "roleCode", "CN", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 通知人
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Partner", "roleCode", "N1", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 船公司
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Partner", "roleCode", "CA", nsp);
|
|
|
}
|
|
|
}
|
|
|
public static string getMBLNO(XmlNode OrderDescription, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var MBLNO = XmlReader.getNodeByAttr(OrderDescription, "MasterNumber", "agencyID", "CA", nsp);
|
|
|
if (MBLNO != null)
|
|
|
return XmlReader.ReadNodeText(MBLNO);
|
|
|
else return "";
|
|
|
}
|
|
|
private string companyname(XmlNode comp)
|
|
|
{
|
|
|
var result = "";
|
|
|
try
|
|
|
{
|
|
|
var Address = XmlReader.GetFirstChildNodeByName(comp, "Address", nsp);
|
|
|
if (Address == null) return "";
|
|
|
var AddressDetails = XmlReader.GetChildNodesByName(Address, "AddressDetails", nsp);
|
|
|
foreach (XmlNode item in AddressDetails)
|
|
|
{
|
|
|
var AddressDetailShared = XmlReader.GetFirstChildNodeByName(item, "AddressDetailShared", nsp);
|
|
|
var Language = XmlReader.ReadFirstChildNodeTextByName(AddressDetailShared, "Language", nsp);
|
|
|
if (Language == "en")
|
|
|
{
|
|
|
var PrintPreview = XmlReader.GetChildNodesByName(AddressDetailShared, "PrintPreview", nsp);
|
|
|
foreach (XmlNode pp in PrintPreview)
|
|
|
{
|
|
|
if (result != "") result += "\r\n";
|
|
|
result += XmlReader.ReadFirstChildNodeTextByName(pp, "PrintLine", nsp);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
//if (Language == "zhCN")
|
|
|
//{
|
|
|
// var Name = XmlReader.GetFirstChildNodeByName(AddressDetailShared, "Name", nsp);
|
|
|
// result = XmlReader.ReadFirstChildNodeTextByName(Name, "Name", nsp);
|
|
|
// return result;
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
catch{
|
|
|
return result;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private string companyshortname(XmlNode comp)
|
|
|
{
|
|
|
var result = "";
|
|
|
|
|
|
var Address = XmlReader.GetFirstChildNodeByName(comp, "Address", nsp);
|
|
|
if (Address == null) return "";
|
|
|
var AddressDetails = XmlReader.GetChildNodesByName(Address, "AddressDetails", nsp);
|
|
|
foreach (XmlNode item in AddressDetails)
|
|
|
{
|
|
|
var AddressDetailShared = XmlReader.GetFirstChildNodeByName(item, "AddressDetailShared", nsp);
|
|
|
var Language = XmlReader.ReadFirstChildNodeTextByName(AddressDetailShared, "Language", nsp);
|
|
|
if (Language == "en")
|
|
|
{
|
|
|
var Name = XmlReader.GetFirstChildNodeByName(AddressDetailShared, "Name", nsp);
|
|
|
|
|
|
result = XmlReader.ReadFirstChildNodeTextByName(Name, "Name", nsp);
|
|
|
return result;
|
|
|
}
|
|
|
//if (Language == "zhCN")
|
|
|
//{
|
|
|
// var Name = XmlReader.GetFirstChildNodeByName(AddressDetailShared, "Name", nsp);
|
|
|
// result = XmlReader.ReadFirstChildNodeTextByName(Name, "Name", nsp);
|
|
|
// return result;
|
|
|
//}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 航程 分段的航行路径
|
|
|
|
|
|
private XmlNode 主航程
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Legs", "legCounter", legCounter, nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private XmlNodeList 所有航程 {
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetChildNodesByName(OrderDescription, "Legs", nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private Int32 航程数 {
|
|
|
get { return 所有航程.Count; }
|
|
|
}
|
|
|
|
|
|
private string get船名(XmlNode 航程) {
|
|
|
var vessel = XmlReader.getNodeByAttr(航程, "TransportMeansName", "type", "VesselName", nsp);
|
|
|
return XmlReader.ReadNodeText(vessel);
|
|
|
}
|
|
|
private string get航次(XmlNode 航程)
|
|
|
{
|
|
|
return XmlReader.ReadFirstChildNodeTextByName(航程, "ConveyanceNumber");
|
|
|
}
|
|
|
|
|
|
private string getContractNo() {
|
|
|
var Carrier = XmlReader.GetFirstChildNodeByName(主航程, "Carrier", nsp);
|
|
|
var ContractNumber = XmlReader.getNodeByAttr(Carrier, "ReferenceID", "referenceQualifier", "ContractNumber", nsp);
|
|
|
return XmlReader.ReadNodeText(ContractNumber);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 地点
|
|
|
private XmlNodeList 所有地点
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetChildNodesByName(OrderDescription, "Locations", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 卸货港
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Locations", "type", "DES", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 起运港
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Locations", "type", "DEP", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 收货地
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Locations", "type", "POR", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 目的地
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Locations", "type", "FDEL", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 非起运港的收货地
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Locations", "type", "CY/O", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 非卸货港的目的地
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "Locations", "type", "CY/D", nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
private string 地点名称(XmlNode 地点) {
|
|
|
if (地点 == null) return "";
|
|
|
return XmlReader.ReadFirstChildNodeTextByName(地点, "LocationName");
|
|
|
}
|
|
|
|
|
|
private string 地点ID(XmlNode 地点)
|
|
|
{
|
|
|
if (地点 == null) return "";
|
|
|
var idnode = XmlReader.getNodeByAttr(地点, "LocationID", "codeType", "UNLOCODE", nsp);
|
|
|
return XmlReader.ReadNodeText(idnode);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 日期
|
|
|
|
|
|
//private XmlNodeList 所有日期
|
|
|
//{
|
|
|
// get
|
|
|
// {
|
|
|
// return XmlReader.GetChildNodesByName(OrderDescription, "DateTimes", nsp);
|
|
|
// }
|
|
|
//}
|
|
|
|
|
|
private XmlNode 开船日期node
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "DateTimes", "type", "133", nsp);
|
|
|
}
|
|
|
}
|
|
|
private XmlNode 到港日期node
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.getNodeByAttr(OrderDescription, "DateTimes", "type", "132", nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string 开船日期 {
|
|
|
get {
|
|
|
var datestr = XmlReader.ReadFirstChildNodeTextByName(开船日期node, "Date");
|
|
|
return datestr.Substring(0, 10);
|
|
|
}
|
|
|
}
|
|
|
private string 到港日期
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var datestr = XmlReader.ReadFirstChildNodeTextByName(到港日期node, "Date");
|
|
|
return datestr.Substring(0, 10);
|
|
|
}
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
private string 运输条款
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
//运输条款表 条款list = new 运输条款表();
|
|
|
var result = "";
|
|
|
var 运输条款_node= XmlReader.GetFirstChildNodeByName(OrderDescription, "ServiceRequest", nsp);
|
|
|
|
|
|
if (运输条款_node == null) { } else {
|
|
|
var 条款文本= XmlReader.ReadFirstChildNodeTextByName(运输条款_node, "ServiceType");
|
|
|
var 捷丰条款文本 = "";
|
|
|
if (运输条款dic.TryGetValue(条款文本, out 捷丰条款文本))
|
|
|
{
|
|
|
result = 捷丰条款文本;
|
|
|
}
|
|
|
if (result == "") result = 条款文本;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string 签单方式
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
|
|
|
var result = "正本";
|
|
|
var 运输条款_node = XmlReader.GetFirstChildNodeByName(OrderDescription, "ServiceRequest", nsp);
|
|
|
|
|
|
if (运输条款_node != null)
|
|
|
{
|
|
|
var 签单方式node = XmlReader.GetFirstChildNodeByName(运输条款_node, "MoreServiceInfo");
|
|
|
if (签单方式node!= null){
|
|
|
var _r = XmlReader.ReadFirstChildNodeTextByName(签单方式node, "Text");
|
|
|
if (_r == "EXPRESS") {
|
|
|
result = "Seaway";
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string getRemark
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var result = "";
|
|
|
var _remark = XmlReader.getNodeByAttr(主航程, "AdditionalInformation", "type", "SIN", nsp);
|
|
|
if (_remark == null) return "";
|
|
|
|
|
|
var strarray = XmlReader.ReadChildNodeTexts(_remark);
|
|
|
|
|
|
foreach (string textline in strarray) {
|
|
|
if (result != "") result += "\r\n";
|
|
|
result += textline;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#region 集装箱信息 PackageOutToIn
|
|
|
|
|
|
private XmlNodeList 所有集装箱
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetChildNodesByName(OrderDescription, "PackageOutToIn", nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string getMarks() {
|
|
|
var result = "";
|
|
|
var mllist = new List<string>();
|
|
|
|
|
|
foreach (XmlNode PackageOutToIn in 所有集装箱) {
|
|
|
|
|
|
//var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
|
|
|
var MarksAndLabels = XmlReader.GetChildNodesByName(PackageOutToIn, "MarksAndLabels", nsp);
|
|
|
|
|
|
var Trans = "";
|
|
|
var TransportEquipment = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "TransportEquipment", nsp);
|
|
|
if (TransportEquipment != null)
|
|
|
{
|
|
|
var TM = XmlReader.GetFirstChildNodeByName(TransportEquipment, "MarksAndLabels", nsp);
|
|
|
Trans = XmlReader.getmlstr(TM);
|
|
|
}
|
|
|
|
|
|
foreach (XmlNode ml in MarksAndLabels) {
|
|
|
|
|
|
var nml = XmlReader.getmlstr(ml);
|
|
|
|
|
|
if (nml == Trans)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
else {
|
|
|
|
|
|
if (mllist.IndexOf(nml) >= 0)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
mllist.Add(nml);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (mllist.Count > 0) {
|
|
|
foreach (var nm in mllist) {
|
|
|
if (result != "")
|
|
|
{
|
|
|
result += "\r\n";
|
|
|
}
|
|
|
result += nm;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//直接获得pkgs信息
|
|
|
private string getKINDPKGS_0(List<PKGSEDI_MB> mpkglist)
|
|
|
{
|
|
|
var result = "";
|
|
|
var mllist = new List<string>();
|
|
|
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
|
|
|
var _pkgs = FTP_SeaeOrderMC.getKINDPKGS_0(ctn, nsp,mpkglist);
|
|
|
|
|
|
if (mllist.IndexOf(_pkgs) >= 0)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
if(!string.IsNullOrWhiteSpace( _pkgs))
|
|
|
mllist.Add(_pkgs);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (mllist.Count >= 0)
|
|
|
{
|
|
|
foreach (var nm in mllist)
|
|
|
{
|
|
|
|
|
|
if (result != "") result += ",";
|
|
|
result += nm;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//private static string getPKGSByEDICODE(string EDICODE) {
|
|
|
|
|
|
// if (mpkglist.Exists(o => o.EDICODE == EDICODE))
|
|
|
// {
|
|
|
// var pkgs = PKGSEDI.FindAll(o => o.EDICODE == EDICODE);
|
|
|
|
|
|
// return pkgs[0].PKGS;
|
|
|
// }
|
|
|
// return "";
|
|
|
//}
|
|
|
|
|
|
private bool haveDangerous()
|
|
|
{
|
|
|
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var NextInnerPackages = XmlReader.GetChildNodesByName(ctn, "NextInnerPackage", nsp);
|
|
|
foreach (XmlNode NextInnerPackage in NextInnerPackages)
|
|
|
{
|
|
|
var Goods = XmlReader.GetChildNodesByName(NextInnerPackage, "Goods", nsp);
|
|
|
|
|
|
foreach (XmlNode good in Goods)
|
|
|
{
|
|
|
var DngrsGoods = XmlReader.GetFirstChildNodeByName(good, "DngrsGoods", nsp);
|
|
|
|
|
|
if (DngrsGoods != null) return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
private bool haveFrozen()
|
|
|
{
|
|
|
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var NextInnerPackages = XmlReader.GetChildNodesByName(ctn, "NextInnerPackage", nsp);
|
|
|
foreach (XmlNode NextInnerPackage in NextInnerPackages)
|
|
|
{
|
|
|
var PackageDetails = XmlReader.GetChildNodesByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
foreach (XmlNode PackageDetail in PackageDetails)
|
|
|
{
|
|
|
var Measures = XmlReader.GetChildNodesByName(PackageDetail, "Measures", nsp);
|
|
|
|
|
|
foreach (XmlNode item in Measures)
|
|
|
{
|
|
|
if (XmlReader.ReadAttrValue(item, "type") == "TemperatureMax")
|
|
|
{
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
public static string getKINDPKGS_0(XmlNode PackageOutToIn, XmlNamespaceManager nsp, List<PKGSEDI_MB> mpkglist)
|
|
|
{
|
|
|
var result = "";
|
|
|
try
|
|
|
{
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
var PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
var Package = XmlReader.GetFirstChildNodeByName(PackageDetails, "Package", nsp);
|
|
|
|
|
|
var _pkgs = XmlReader.ReadChildNodeTextsByName(Package, "PackageTypeCode", nsp);
|
|
|
result = _pkgs[0];
|
|
|
if (!string.IsNullOrEmpty(result)) {
|
|
|
var PKGS = mpkglist.Find(e => e.EDICODE == result);
|
|
|
if (PKGS != null) {
|
|
|
result = PKGS.PKGS;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
catch {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public static string getPKGS(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "0";
|
|
|
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
if (NextInnerPackage != null)
|
|
|
{
|
|
|
var PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
if (PackageDetails != null)
|
|
|
{
|
|
|
var Measures = XmlReader.getNodeByAttr(PackageDetails, "Measures", "type", "NoUnits", nsp);
|
|
|
if (Measures == null) return "0";
|
|
|
result = XmlReader.ReadChildNodeTextsByName(Measures, "MeasureValue", nsp)[0];
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
public static string getKGS(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "0";
|
|
|
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
if (NextInnerPackage != null)
|
|
|
{
|
|
|
var PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
if (PackageDetails != null)
|
|
|
{
|
|
|
var Measures = XmlReader.getNodeByAttr(PackageDetails, "Measures", "type", "G", nsp);
|
|
|
if (Measures == null) return "0";
|
|
|
result = XmlReader.ReadChildNodeTextsByName(Measures, "MeasureValue", nsp)[0];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public static string getCBM(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "0";
|
|
|
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
if (NextInnerPackage != null)
|
|
|
{
|
|
|
var PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
if (PackageDetails != null)
|
|
|
{
|
|
|
var Measures = XmlReader.getNodeByAttr(PackageDetails, "Measures", "type", "ABJ", nsp);
|
|
|
//if (Measures == null) Measures = XmlReader.getNodeByAttr(PackageDetails, "Measures", "type", "AAL", nsp);//AAL是净重
|
|
|
if (Measures == null) return "0";
|
|
|
result = XmlReader.ReadChildNodeTextsByName(Measures, "MeasureValue", nsp)[0];
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public static string getCNTRNO(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var CNTRNO = XmlReader.getNodeByAttr(PackageOutToIn, "PackageID", "identificationSystem", "PackageNumber", nsp);
|
|
|
if (CNTRNO != null)
|
|
|
return XmlReader.ReadNodeText(CNTRNO);
|
|
|
else return "";
|
|
|
|
|
|
}
|
|
|
public static string getSEALNO(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var SEALNO = XmlReader.getNodeByAttr(PackageOutToIn, "PackageID", "identificationSystem", "Seal", nsp);
|
|
|
if (SEALNO != null)
|
|
|
return XmlReader.ReadNodeText(SEALNO);
|
|
|
else return "";
|
|
|
}
|
|
|
|
|
|
public static string getMarks(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "";
|
|
|
XmlNode PackageDetails = null;
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
if (NextInnerPackage != null)
|
|
|
PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
else PackageDetails = PackageOutToIn;
|
|
|
|
|
|
var MarksAndLabels = XmlReader.GetChildNodesByName(PackageDetails, "MarksAndLabels", nsp);
|
|
|
var desList = new NoRepeatStrList();
|
|
|
desList._add(XmlReader.getmlstr(MarksAndLabels));
|
|
|
return desList.getstr();
|
|
|
}
|
|
|
|
|
|
public static string getGoodsname(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "";
|
|
|
|
|
|
var Goods = XmlReader.GetChildNodesByName(PackageOutToIn, "Goods", nsp);
|
|
|
|
|
|
var gslist = new NoRepeatStrList();
|
|
|
foreach (XmlNode Good in Goods)
|
|
|
{
|
|
|
|
|
|
var GoodsDescription = XmlReader.GetFirstChildNodeByName(Good, "GoodsDescription", nsp);
|
|
|
if (GoodsDescription == null) continue;
|
|
|
gslist._add( XmlReader.ReadFirstChildNodeTextByName(GoodsDescription, "Text", nsp));
|
|
|
|
|
|
|
|
|
}
|
|
|
if (gslist.Count > 0) {
|
|
|
result = gslist.getstr();
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static string getGoodsDescription(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "";
|
|
|
XmlNode PackageDetails = null;
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "NextInnerPackage", nsp);
|
|
|
if (NextInnerPackage != null)
|
|
|
PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
else PackageDetails = PackageOutToIn;
|
|
|
|
|
|
var Goods = XmlReader.GetChildNodesByName(PackageDetails, "Goods", nsp);
|
|
|
var desList = new NoRepeatStrList();
|
|
|
foreach (XmlNode Good in Goods)
|
|
|
{
|
|
|
|
|
|
|
|
|
var GoodsDescription = XmlReader.GetChildNodesByName(Good, "GoodsDescription", nsp);
|
|
|
|
|
|
desList._add(XmlReader.getmlstr(GoodsDescription));
|
|
|
|
|
|
}
|
|
|
return desList.getstr();
|
|
|
}
|
|
|
public static string getHSCODE(XmlNode PackageOutToIn, XmlNamespaceManager nsp)
|
|
|
{
|
|
|
var result = "";
|
|
|
|
|
|
var GoodsList = XmlReader.GetChildNodesByName(PackageOutToIn, "Goods", nsp);
|
|
|
|
|
|
foreach (XmlNode Goods in GoodsList)
|
|
|
{
|
|
|
var Product = XmlReader.GetFirstChildNodeByName(Goods, "Product", nsp);
|
|
|
if (Product == null) continue;
|
|
|
var hscodenod = XmlReader.getNodeByAttr(Product, "ProductID", "numberingSystem", "HS", nsp);
|
|
|
if (hscodenod == null) continue;
|
|
|
result = XmlReader.ReadNodeText(hscodenod);
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 总货物信息 TotalMeasures
|
|
|
|
|
|
private XmlNodeList 所有总货物信息
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetChildNodesByName(OrderDescription, "TotalMeasures", nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private XmlNode getgoodsinfo(string type) {
|
|
|
foreach (XmlNode item in 所有总货物信息)
|
|
|
{
|
|
|
var _type = XmlReader.ReadAttrValue(item, "type");
|
|
|
if (type== _type && (XmlReader.ReadFirstChildNodeTextByName(item, "TypeClassification",nsp)== "Ordered")) {
|
|
|
return item;
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
|
}
|
|
|
private string getgoodsinfostr(string type)
|
|
|
{
|
|
|
var node = getgoodsinfo(type);
|
|
|
|
|
|
if (node == null) { return "0"; }
|
|
|
else
|
|
|
{
|
|
|
return XmlReader.ReadFirstChildNodeTextByName(node, "MeasureValue", nsp);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
private string 总件数包装
|
|
|
{
|
|
|
get {
|
|
|
var result = "";
|
|
|
result = getgoodsinfostr("NoUnits");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
private string 总体积
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var result = "";
|
|
|
result = getgoodsinfostr("ABJ");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
private string 总重量
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var result = "";
|
|
|
result = getgoodsinfostr("G");
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private XmlNodeList 所有箱信息
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
return XmlReader.GetChildNodesByName(OrderDescription, "PackageOutToIn", nsp);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private XmlNodeList getGoods(XmlNode PackageOutToIn) {
|
|
|
return XmlReader.GetChildNodesByName(PackageOutToIn, "Goods", nsp);
|
|
|
}
|
|
|
|
|
|
private string 总唛头
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
var result = "";
|
|
|
var _markslist = new NoRepeatStrList();
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var goodsdescription = FTP_SeaeOrderMC.getMarks(ctn, nsp);
|
|
|
_markslist._add(goodsdescription);
|
|
|
|
|
|
}
|
|
|
|
|
|
result = _markslist.getstr();
|
|
|
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string 总品名 {
|
|
|
get {
|
|
|
var result = "";
|
|
|
var namelist = new NoRepeatStrList();
|
|
|
//var hscodelist = new NoRepeatStrList();
|
|
|
|
|
|
foreach (XmlNode item in 所有箱信息) {
|
|
|
var pm = FTP_SeaeOrderMC.getGoodsname(item, nsp);
|
|
|
//var hscode = getHSCODE(item,nsp);
|
|
|
namelist._add(pm);
|
|
|
//hscodelist._add(hscode);
|
|
|
}
|
|
|
result = namelist.getstr();
|
|
|
|
|
|
//if (hscodelist.Count > 0) {
|
|
|
// result += "\r\nHSCODE:" + hscodelist.getstr();
|
|
|
//}
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private string 总货描 {
|
|
|
get
|
|
|
{
|
|
|
var result = "";
|
|
|
var _descriptionlist = new NoRepeatStrList();
|
|
|
var hscodelist = new NoRepeatStrList();
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var goodsdescription = FTP_SeaeOrderMC.getGoodsDescription(ctn, nsp);
|
|
|
_descriptionlist._add(goodsdescription);
|
|
|
|
|
|
var hscode = getHSCODE(ctn, nsp);
|
|
|
hscodelist._add(hscode);
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result= _descriptionlist.getstr();
|
|
|
if (hscodelist.Count > 0)
|
|
|
{
|
|
|
result += "\r\nHSCODE:" + hscodelist.getstr();
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region CARGOID 普通S 冷冻R 危险D 超限O
|
|
|
|
|
|
private string getCARGOID() {
|
|
|
string result = "S";
|
|
|
|
|
|
if (haveDangerous()) {
|
|
|
result = "D";
|
|
|
return result;
|
|
|
}
|
|
|
if (haveFrozen())
|
|
|
{
|
|
|
result = "R";
|
|
|
return result;
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 危险品信息 DCLASS
|
|
|
|
|
|
//多个危险品 取不重复的所有
|
|
|
private List<XmlNode> 危险品Nodes()
|
|
|
{
|
|
|
var result = new List<XmlNode>();
|
|
|
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var Goods = XmlReader.GetFirstChildNodeByName(ctn, "Goods", nsp);
|
|
|
var DngrsGoods = XmlReader.GetFirstChildNodeByName(Goods, "DngrsGoods", nsp);
|
|
|
|
|
|
if (DngrsGoods != null) {
|
|
|
result.Add(DngrsGoods);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private string 危险品分类Total() {
|
|
|
var result = "";
|
|
|
var codelist = new List<string>();
|
|
|
if (危险品Nodes() != null)
|
|
|
{
|
|
|
foreach (XmlNode item in 危险品Nodes())
|
|
|
{
|
|
|
var DngrsCode = XmlReader.ReadFirstChildNodeTextByName(item, "DngrsCode", nsp);
|
|
|
if (codelist.IndexOf(DngrsCode) < 0)
|
|
|
{
|
|
|
codelist.Add(DngrsCode);
|
|
|
}
|
|
|
}
|
|
|
foreach (var code in codelist)
|
|
|
{
|
|
|
if (result != "") result += ",";
|
|
|
result += code;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
private string 危险品编号Total()
|
|
|
{
|
|
|
var result = "";
|
|
|
var codelist = new List<string>();
|
|
|
if (危险品Nodes() != null)
|
|
|
{
|
|
|
foreach (XmlNode item in 危险品Nodes())
|
|
|
{
|
|
|
var DngrsNumberUN = XmlReader.ReadFirstChildNodeTextByName(item, "DngrsNumberUN", nsp);
|
|
|
if (codelist.IndexOf(DngrsNumberUN) < 0)
|
|
|
{
|
|
|
codelist.Add(DngrsNumberUN);
|
|
|
}
|
|
|
}
|
|
|
foreach (var code in codelist)
|
|
|
{
|
|
|
if (result != "") result += ",";
|
|
|
result += code;
|
|
|
}
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
private string 危险品联系人() {
|
|
|
var result = "";
|
|
|
var codelist = new List<string>();
|
|
|
if (危险品Nodes() != null)
|
|
|
{
|
|
|
var 联系人list = new NoRepeatStrList();
|
|
|
foreach (XmlNode item in 危险品Nodes())
|
|
|
{
|
|
|
XmlNode node = null;
|
|
|
node = XmlReader.GetFirstChildNodeByName(item, "Contact");
|
|
|
if (node != null) node= XmlReader.GetFirstChildNodeByName(node, "Name");
|
|
|
if (node != null) node = XmlReader.GetFirstChildNodeByName(node, "Name");
|
|
|
if (node != null) 联系人list._add(XmlReader.ReadNodeText(node).Trim());
|
|
|
|
|
|
}
|
|
|
result = 联系人list.getstr();
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
private string 危险品电话()
|
|
|
{
|
|
|
var result = "";
|
|
|
var codelist = new List<string>();
|
|
|
if (危险品Nodes() != null)
|
|
|
{
|
|
|
var list = new NoRepeatStrList();
|
|
|
foreach (XmlNode item in 危险品Nodes())
|
|
|
{
|
|
|
XmlNode ContactCommunication = null;
|
|
|
var Contact = XmlReader.GetFirstChildNodeByName(item, "Contact");
|
|
|
if (Contact != null) ContactCommunication = XmlReader.GetFirstChildNodeByName(Contact, "ContactCommunication");
|
|
|
if (ContactCommunication != null && XmlReader.ReadFirstChildNodeTextByName(ContactCommunication, "Type") == "AL") {
|
|
|
list._add(XmlReader.ReadFirstChildNodeTextByName(ContactCommunication, "CommID").Trim());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
result = list.getstr();
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#region 温度信息 DCLASS
|
|
|
|
|
|
private string 最低温度()
|
|
|
{
|
|
|
decimal TMin = 0.0M;
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(ctn, "NextInnerPackage", nsp);
|
|
|
var PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
var Measures = XmlReader.GetChildNodesByName(PackageDetails, "Measures", nsp);
|
|
|
if (Measures != null)
|
|
|
foreach (XmlNode item in Measures)
|
|
|
{
|
|
|
if (XmlReader.ReadAttrValue(item, "type") == "TemperatureMin")
|
|
|
{
|
|
|
var MeasureValue = XmlReader.ReadFirstChildNodeTextByName(item, "MeasureValue", nsp);
|
|
|
decimal currT = 0.0M;
|
|
|
try
|
|
|
{
|
|
|
currT = Convert.ToDecimal(MeasureValue);
|
|
|
}
|
|
|
catch {
|
|
|
currT = 0.0M;
|
|
|
}
|
|
|
if (TMin == 0.0M || ((TMin != 0.0M) && (currT < TMin))) {
|
|
|
TMin = currT;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return TMin.ToString();
|
|
|
}
|
|
|
|
|
|
private string 最高温度()
|
|
|
{
|
|
|
decimal TMax = 0.0M;
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var NextInnerPackage = XmlReader.GetFirstChildNodeByName(ctn, "NextInnerPackage", nsp);
|
|
|
var PackageDetails = XmlReader.GetFirstChildNodeByName(NextInnerPackage, "PackageDetails", nsp);
|
|
|
var Measures = XmlReader.GetChildNodesByName(PackageDetails, "Measures", nsp);
|
|
|
if (Measures != null)
|
|
|
foreach (XmlNode item in Measures)
|
|
|
{
|
|
|
if (XmlReader.ReadAttrValue(item, "type") == "TemperatureMax")
|
|
|
{
|
|
|
var MeasureValue = XmlReader.ReadFirstChildNodeTextByName(item, "MeasureValue", nsp);
|
|
|
decimal currT = 0.0M;
|
|
|
try
|
|
|
{
|
|
|
currT = Convert.ToDecimal(MeasureValue);
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
|
currT = 0.0M;
|
|
|
}
|
|
|
if (TMax == 0.0M || ((TMax != 0.0M) && (currT > TMax)))
|
|
|
{
|
|
|
TMax = currT;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return TMax.ToString();
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
public List<FTP_SeaeOrder_CtnMC> CtnList= new List<FTP_SeaeOrder_CtnMC>();
|
|
|
|
|
|
XmlNamespaceManager nsp { get; set; }
|
|
|
|
|
|
运输条款表 运输条款dic { get; set; }
|
|
|
|
|
|
public FTP_SeaeOrderMC(XmlDocument xmlobj,List<CARRIER> carrierList,运输条款表 _运输条款dic, List<PKGSEDI_MB> pkglist, List<PKGSEDI_MB> ctncodelist, out string msg)
|
|
|
{
|
|
|
|
|
|
//填充数据
|
|
|
BSNO = Guid.NewGuid().ToString();
|
|
|
CtnList = new List<FTP_SeaeOrder_CtnMC>();
|
|
|
msg = "1";
|
|
|
_root = xmlobj;
|
|
|
|
|
|
try
|
|
|
{
|
|
|
nsp = new XmlNamespaceManager(_root.NameTable); //导入命名空间
|
|
|
nsp.AddNamespace("v4", "http://www.schenker.com/SGI/v4");
|
|
|
nsp.AddNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/");
|
|
|
msg = "2";
|
|
|
运输条款dic = _运输条款dic;
|
|
|
msg = "3";
|
|
|
#region 委托单位 发货人 收货人 通知人 船公司
|
|
|
|
|
|
//var 委托单位 = XmlReader.getNodeByAttr(OrderDescription, "Partner", "roleCode", "CZ", nsp);
|
|
|
CUSTOMERNAME = "全球青岛公司";
|
|
|
SHIPPER = companyname(发货人);
|
|
|
CONSIGNEE = companyname(收货人);
|
|
|
NOTIFYPARTY = companyname(通知人);
|
|
|
msg = "4";
|
|
|
var _carrier = companyshortname(船公司);
|
|
|
CARRIER = "";
|
|
|
if (carrierList.Exists(o => o.enname == _carrier))
|
|
|
{
|
|
|
CARRIER = carrierList.Find(o => o.enname == _carrier).edicode;
|
|
|
}
|
|
|
msg = "5";
|
|
|
MBLNO = getMBLNO(OrderDescription, nsp);
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region 船名 航次
|
|
|
|
|
|
//取一程船名
|
|
|
if (航程数 > 1)
|
|
|
{
|
|
|
VESSEL = get船名(主航程);
|
|
|
VOYNO = get航次(主航程);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
VESSEL = get船名(所有航程[0]);
|
|
|
VOYNO = get航次(所有航程[0]);
|
|
|
}
|
|
|
msg = "6";
|
|
|
#endregion
|
|
|
ETD = 开船日期;
|
|
|
msg = "7";
|
|
|
#region 港
|
|
|
PORTLOAD = "QINGDAO,CHINA";//地点名称(起运港);
|
|
|
PORTLOADID = "CNTAO";// 地点ID(起运港);
|
|
|
|
|
|
PLACEDELIVERY = 地点名称(收货地);
|
|
|
PLACEDELIVERYID = 地点ID(收货地);
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(PLACEDELIVERY))
|
|
|
{
|
|
|
PLACEDELIVERY = 地点名称(非起运港的收货地);
|
|
|
}
|
|
|
if (string.IsNullOrWhiteSpace(PLACEDELIVERYID))
|
|
|
{
|
|
|
PLACEDELIVERYID = 地点ID(非起运港的收货地);
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(PLACEDELIVERY))
|
|
|
{
|
|
|
PLACEDELIVERY = PORTLOAD;
|
|
|
}
|
|
|
if (string.IsNullOrWhiteSpace(PLACEDELIVERYID))
|
|
|
{
|
|
|
PLACEDELIVERYID = PORTLOADID;
|
|
|
}
|
|
|
|
|
|
PORTDISCHARGE = 地点名称(卸货港);
|
|
|
PORTDISCHARGEID = 地点ID(卸货港);
|
|
|
|
|
|
if (非卸货港的目的地 == null)
|
|
|
{
|
|
|
DESTINATION = 地点名称(卸货港);
|
|
|
DESTINATIONID = 地点ID(卸货港);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
DESTINATION = 地点名称(非卸货港的目的地);
|
|
|
DESTINATIONID = 地点ID(非卸货港的目的地);
|
|
|
}
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(NOTIFYPARTY))
|
|
|
{
|
|
|
NOTIFYPARTY = CONSIGNEE;
|
|
|
}
|
|
|
msg = "8";
|
|
|
#endregion
|
|
|
|
|
|
SERVICE = 运输条款;
|
|
|
|
|
|
MARKS = 总唛头;
|
|
|
|
|
|
GOODSNAME = 总品名;
|
|
|
|
|
|
DESCRIPTION = 总货描;
|
|
|
msg = "9";
|
|
|
|
|
|
GROSSWEIGHT = 总重量;
|
|
|
msg = "9.1";
|
|
|
MEASUREMENT = 总体积;
|
|
|
msg = "9.2";
|
|
|
PKGS = 总件数包装;
|
|
|
msg = "9.3";
|
|
|
KINDPKGS = getKINDPKGS_0(pkglist);
|
|
|
msg = "10";
|
|
|
KGS = 总重量;
|
|
|
CBM = 总体积;
|
|
|
msg = "11";
|
|
|
CARGOID = getCARGOID();
|
|
|
|
|
|
if (CARGOID == "D")
|
|
|
{
|
|
|
DCLASS = 危险品分类Total();
|
|
|
DUNNO = 危险品编号Total();
|
|
|
}
|
|
|
msg = "12";
|
|
|
if (CARGOID == "R")
|
|
|
{
|
|
|
TEMPMIN = 最低温度();
|
|
|
TEMPMAX = 最高温度();
|
|
|
|
|
|
}
|
|
|
msg = "13";
|
|
|
SERVICECONTRACTNO = getContractNo();
|
|
|
msg = "14";
|
|
|
REMARK = getRemark;
|
|
|
if (CARGOID == "D")
|
|
|
{
|
|
|
//危险品的联系人和联系方式放海运出口业务备注
|
|
|
REMARK += "\r\n危险品联系人:" + 危险品联系人();
|
|
|
|
|
|
REMARK += "\r\n危险品联系人电话:" + 危险品电话();
|
|
|
}
|
|
|
msg = "15";
|
|
|
BLFRT = 付费方式;
|
|
|
msg = "16";
|
|
|
if (_PaymentTerm() == "CC") PAYABLEAT = 付费地点;
|
|
|
if (_PaymentTerm() == "PP") PREPARDAT = 付费地点;
|
|
|
msg = "17";
|
|
|
CUSTATTN = 联系人;
|
|
|
CUSTTEL = 联系电话 + " " + 联系邮箱;
|
|
|
msg = "18";
|
|
|
if (CARRIER == "")
|
|
|
{
|
|
|
REMARK = companyshortname(船公司) + "\r\n" + REMARK;
|
|
|
}
|
|
|
msg = "19";
|
|
|
ISSUETYPE = 签单方式;
|
|
|
msg = "20";
|
|
|
CtnList.Clear();
|
|
|
msg = "21";
|
|
|
foreach (XmlNode ctn in 所有集装箱)
|
|
|
{
|
|
|
var _ctn = new FTP_SeaeOrder_CtnMC(ctn, this, nsp, pkglist,ctncodelist);
|
|
|
}
|
|
|
msg = "over";
|
|
|
}
|
|
|
catch (Exception ex) {
|
|
|
msg = msg + "_" + ex.Message;
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public string getFieldstr() {
|
|
|
return "insert into op_seaeorder (BSNO,ORSTATUS,BSDATE,MBLNO,CUSTOMERNAME,SHIPPER,CONSIGNEE,NOTIFYPARTY,CARRIER,VESSEL,VOYNO,ETD,PlACERECEIPT,PORTLOADID,PORTLOAD,PORTDISCHARGEID,PORTDISCHARGE,PLACEDELIVERYID,PLACEDELIVERY,DESTINATIONID,DESTINATION,NOBILL,ISSUETYPE,ISSUEDATE,ISSUEPLACE,BLFRT,PREPARDAT,PAYABLEAT,SERVICE,MARKS,NOPKGS,DESCRIPTION,GOODSNAME,GROSSWEIGHT,MEASUREMENT,PKGS,KINDPKGS,KGS,CBM,TOTALNO,CNTRTOTAL,INPUTBY,INVNO,CARGOID,DCLASS,DUNNO,REEFERF,TEMPID,TEMPSET,TEMPMAX,TEMPMIN,CUSTOMSNUM,REMARK,DPAGE,DLABEL,LANE,SERVICECONTRACTNO,CUSTNO,CUSTATTN,CUSTTEL,BLTYPE) ";
|
|
|
}
|
|
|
|
|
|
public string getvaluestr() {
|
|
|
var valuesstr = $" values ('{BSNO.Replace("'", "''")}'," +//BSNO
|
|
|
$"'{ORSTATUS.Replace("'", "''")}'," + //ORSTATUS
|
|
|
$"'{BSDATE.Replace("'", "''")}'," + //BSDATE
|
|
|
$"'{MBLNO.Replace("'", "''")}'," + //MBLNO
|
|
|
$"'{CUSTOMERNAME.Replace("'", "''")}'," + //CUSTOMERNAME
|
|
|
$"'{SHIPPER.Replace("'", "''")}'," + //SHIPPER
|
|
|
$"'{CONSIGNEE.Replace("'", "''")}'," + //CONSIGNEE
|
|
|
$"'{NOTIFYPARTY.Replace("'", "''")}'," + //NOTIFYPARTY
|
|
|
$"'{CARRIER.Replace("'", "''")}'," + //CARRIER
|
|
|
$"'{VESSEL.Replace("'", "''")}'," + //VESSEL
|
|
|
$"'{VOYNO.Replace("'", "''")}'," + //VOYNO
|
|
|
$"'{ETD.Replace("'", "''")}'," + //ETD
|
|
|
$"'{PlACERECEIPT.Replace("'", "''")}'," + //PlACERECEIPT
|
|
|
$"'{PORTLOADID.Replace("'", "''")}'," + //PORTLOADID
|
|
|
$"'{PORTLOAD.Replace("'", "''")}'," + //PORTLOAD
|
|
|
$"'{PORTDISCHARGEID.Replace("'", "''")}'," + //PORTDISCHARGEID
|
|
|
$"'{PORTDISCHARGE.Replace("'", "''")}'," + //PORTDISCHARGE
|
|
|
$"'{PLACEDELIVERYID.Replace("'", "''")}'," + //PLACEDELIVERYID
|
|
|
$"'{PLACEDELIVERY.Replace("'", "''")}'," + //PLACEDELIVERY
|
|
|
$"'{DESTINATIONID.Replace("'", "''")}'," + //DESTINATIONID
|
|
|
$"'{DESTINATION.Replace("'", "''")}'," + //DESTINATION
|
|
|
$"'{NOBILL.Replace("'", "''")}'," + //NOBILL
|
|
|
$"'{ISSUETYPE.Replace("'", "''")}'," + //ISSUETYPE
|
|
|
$"'{ISSUEDATE.Replace("'", "''")}'," + //ISSUEDATE
|
|
|
$"'{ISSUEPLACE.Replace("'", "''")}'," + //ISSUEPLACE
|
|
|
$"'{BLFRT.Replace("'", "''")}'," + //BLFRT
|
|
|
$"'{PREPARDAT.Replace("'", "''")}'," + //PREPARDAT
|
|
|
$"'{PAYABLEAT.Replace("'", "''")}'," + //PAYABLEAT
|
|
|
$"'{SERVICE.Replace("'", "''")}'," + //SERVICE
|
|
|
$"'{MARKS.Replace("'", "''")}'," + //MARKS
|
|
|
$"'{NOPKGS.Replace("'", "''")}'," + //NOPKGS
|
|
|
$"'{DESCRIPTION.Replace("'", "''")}'," + //DESCRIPTION
|
|
|
$"'{GOODSNAME.Replace("'", "''")}'," + //GOODSNAME
|
|
|
$"'{GROSSWEIGHT.Replace("'", "''")}'," + //GROSSWEIGHT
|
|
|
$"'{MEASUREMENT.Replace("'", "''")}'," + //MEASUREMENT
|
|
|
$"'{PKGS.Replace("'", "''")}'," + //PKGS
|
|
|
$"'{KINDPKGS.Replace("'", "''")}'," + //KINDPKGS
|
|
|
$"'{KGS.Replace("'", "''")}'," + //KGS
|
|
|
$"'{CBM.Replace("'", "''")}'," + //CBM
|
|
|
$"'{TOTALNO.Replace("'", "''")}'," + //TOTALNO
|
|
|
$"'{CNTRTOTAL.Replace("'", "''")}'," + //CNTRTOTAL
|
|
|
$"'{INPUTBY.Replace("'", "''")}'," + //INPUTBY
|
|
|
$"'{INVNO.Replace("'", "''")}'," + //INVNO
|
|
|
$"'{CARGOID.Replace("'", "''")}'," + //CARGOID
|
|
|
$"'{DCLASS.Replace("'", "''")}'," + //DCLASS
|
|
|
$"'{DUNNO.Replace("'", "''")}'," + //DUNNO
|
|
|
$"'{REEFERF.Replace("'", "''")}'," + //REEFERF
|
|
|
$"'{TEMPID.Replace("'", "''")}'," + //TEMPID
|
|
|
$"'{TEMPSET.Replace("'", "''")}'," + //TEMPSET
|
|
|
$"'{TEMPMAX.Replace("'", "''")}'," + //TEMPMAX
|
|
|
$"'{TEMPMIN.Replace("'", "''")}'," + //TEMPMIN
|
|
|
$"'{CUSTOMSNUM.Replace("'", "''")}'," + //CUSTOMSNUM
|
|
|
$"'{REMARK.Replace("'", "''")}'," + //REMARK
|
|
|
$"'{DPAGE.Replace("'", "''")}'," + //DPAGE
|
|
|
$"'{DLABEL.Replace("'", "''")}'," + //DLABEL
|
|
|
$"'{LANE.Replace("'", "''")}'," + //LANE
|
|
|
$"'{SERVICECONTRACTNO.Replace("'", "''")}'," + //SERVICECONTRACTNO
|
|
|
$"'{CUSTNO.Replace("'", "''")}'," + //CUSTNO
|
|
|
$"'{CUSTATTN.Replace("'", "''")}'," + //CUSTATTN
|
|
|
$"'{CUSTTEL.Replace("'", "''")}'," + //CUSTTEL
|
|
|
$"'{BLTYPE.Replace("'", "''")}'" + //CUSTTEL
|
|
|
$")";
|
|
|
return valuesstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
[JsonObject]
|
|
|
public class FTP_SeaeOrder_CtnMC
|
|
|
{
|
|
|
|
|
|
#region private Fields
|
|
|
private string _CTN_ID = string.Empty;
|
|
|
private string _ORDNO = string.Empty;
|
|
|
private string _CTNALL = string.Empty;
|
|
|
private string _CTNNUM = string.Empty;
|
|
|
private string _REMARK = string.Empty;
|
|
|
|
|
|
private string _KINDPKGS = string.Empty;
|
|
|
private string _PKGS = "0";
|
|
|
private string _KGS = "0";
|
|
|
private string _CBM = "0";
|
|
|
private string _GOODSNAME = string.Empty;
|
|
|
private string _HSCODE = string.Empty;
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#region R&W
|
|
|
[ModelDB(MDBType = ModelDBOprationType.All, IsPrimary = true)]
|
|
|
public string CTN_ID
|
|
|
{
|
|
|
get { return _CTN_ID; }
|
|
|
set { _CTN_ID = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string ORDNO
|
|
|
{
|
|
|
get { return _ORDNO; }
|
|
|
set { _ORDNO = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CTNALL
|
|
|
{
|
|
|
get { return _CTNALL; }
|
|
|
set { _CTNALL = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string CTNNUM
|
|
|
{
|
|
|
get { return _CTNNUM; }
|
|
|
set { _CTNNUM = value; }
|
|
|
}
|
|
|
[ModelDB]
|
|
|
public string REMARK
|
|
|
{
|
|
|
get { return _REMARK; }
|
|
|
set { _REMARK = value; }
|
|
|
}
|
|
|
|
|
|
public string KINDPKGS
|
|
|
{
|
|
|
get { return _KINDPKGS; }
|
|
|
set { _KINDPKGS = value; }
|
|
|
}
|
|
|
|
|
|
public string PKGS
|
|
|
{
|
|
|
get { return _PKGS; }
|
|
|
set { _PKGS = value; }
|
|
|
}
|
|
|
public string KGS
|
|
|
{
|
|
|
get { return _KGS; }
|
|
|
set { _KGS = value; }
|
|
|
}
|
|
|
public string CBM
|
|
|
{
|
|
|
get { return _CBM; }
|
|
|
set { _CBM = value; }
|
|
|
}
|
|
|
public string GOODSNAME
|
|
|
{
|
|
|
get { return _GOODSNAME; }
|
|
|
set { _GOODSNAME = value; }
|
|
|
}
|
|
|
public string HSCODE
|
|
|
{
|
|
|
get { return _HSCODE; }
|
|
|
set { _HSCODE = value; }
|
|
|
}
|
|
|
|
|
|
public string CNTRNO { get; set; }
|
|
|
|
|
|
public string SEALNO { get; set; }
|
|
|
#endregion
|
|
|
|
|
|
public FTP_SeaeOrder_CtnMC(XmlNode PackageOutToIn, FTP_SeaeOrderMC head, XmlNamespaceManager nsp, List<PKGSEDI_MB> mpkglist, List<PKGSEDI_MB> ctncodelist)
|
|
|
{
|
|
|
//填充数据
|
|
|
CTN_ID = Guid.NewGuid().ToString();
|
|
|
ORDNO = head.BSNO;
|
|
|
|
|
|
var TransportEquipment = XmlReader.GetFirstChildNodeByName(PackageOutToIn, "TransportEquipment", nsp);
|
|
|
var xiangxing = XmlReader.GetFirstChildNodeByName(TransportEquipment, "MarksAndLabels", nsp);
|
|
|
CTNALL = XmlReader.ReadFirstChildNodeTextByName(xiangxing,"Text",nsp);
|
|
|
if (!string.IsNullOrEmpty(CTNALL))
|
|
|
{
|
|
|
var PKGS = ctncodelist.Find(e => e.EDICODE == CTNALL);
|
|
|
if (PKGS != null)
|
|
|
{
|
|
|
CTNALL = PKGS.PKGS;
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
CTNNUM = "1";
|
|
|
|
|
|
KINDPKGS = FTP_SeaeOrderMC.getKINDPKGS_0(PackageOutToIn,nsp, mpkglist);
|
|
|
PKGS = FTP_SeaeOrderMC.getPKGS(PackageOutToIn, nsp);
|
|
|
KGS = FTP_SeaeOrderMC.getKGS(PackageOutToIn, nsp);
|
|
|
CBM = FTP_SeaeOrderMC.getCBM(PackageOutToIn, nsp);
|
|
|
GOODSNAME = FTP_SeaeOrderMC.getGoodsDescription(PackageOutToIn, nsp);
|
|
|
HSCODE = FTP_SeaeOrderMC.getHSCODE(PackageOutToIn, nsp);
|
|
|
CNTRNO = FTP_SeaeOrderMC.getCNTRNO(PackageOutToIn,nsp);
|
|
|
SEALNO = FTP_SeaeOrderMC.getSEALNO(PackageOutToIn,nsp);
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(HSCODE)) {
|
|
|
GOODSNAME = "HS CODE:" + HSCODE + "\r\n" + GOODSNAME;
|
|
|
}
|
|
|
|
|
|
head.CtnList.Add(this);
|
|
|
}
|
|
|
|
|
|
public string getFieldstr() {
|
|
|
return "insert into op_seaeorderctn (CTN_ID,ORDNO,CTNALL,CTNNUM,REMARK,KINDPKGS,PKGS,KGS,CBM,GOODSNAME,HSCODE,CNTRNO,SEALNO) ";
|
|
|
}
|
|
|
|
|
|
public string getvaluestr()
|
|
|
{
|
|
|
var valuesstr = $" values ('{CTN_ID.Replace("'", "''")}'," +//
|
|
|
$"'{ORDNO.Replace("'", "''")}'," + //ORDNO
|
|
|
$"'{CTNALL.Replace("'", "''")}'," + //CTNALL
|
|
|
$"'{CTNNUM.Replace("'", "''")}'," + //CTNNUM
|
|
|
$"'{REMARK.Replace("'", "''")}'," + //REMARK
|
|
|
$"'{KINDPKGS.Replace("'", "''")}'," + //KINDPKGS
|
|
|
$"'{PKGS.Replace("'", "''")}'," + //PKGS
|
|
|
$"'{KGS.Replace("'", "''")}'," + //KGS
|
|
|
$"'{CBM.Replace("'", "''")}'," + //CBM
|
|
|
$"'{GOODSNAME.Replace("'", "''")}'," + //GOODSNAME
|
|
|
$"'{HSCODE.Replace("'", "''")}'," + //HSCODE
|
|
|
$"'{CNTRNO.Replace("'", "''")}'," + //CNTRNO
|
|
|
$"'{SEALNO.Replace("'", "''")}'" + //SEALNO
|
|
|
$")";
|
|
|
return valuesstr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
public class DBWork
|
|
|
{
|
|
|
public static int Save(string connStr, FTP_SeaeOrderMC head) {
|
|
|
|
|
|
var sqlstr = getSaveSql(connStr,head);
|
|
|
return ExecSql(connStr, sqlstr);
|
|
|
|
|
|
}
|
|
|
|
|
|
public static string getSaveSql(string connStr, FTP_SeaeOrderMC head) {
|
|
|
var insertstr = head.getFieldstr();
|
|
|
|
|
|
var valuestr = head.getvaluestr();
|
|
|
|
|
|
var headStr = insertstr + valuestr;
|
|
|
|
|
|
var ctnStr = "";
|
|
|
|
|
|
foreach (var ctn in head.CtnList)
|
|
|
{
|
|
|
var insertstr_ctn = ctn.getFieldstr();
|
|
|
|
|
|
var valuestr_ctn = ctn.getvaluestr();
|
|
|
|
|
|
ctnStr += insertstr_ctn + valuestr_ctn + " ";
|
|
|
}
|
|
|
|
|
|
//向一个指定表中写入一些数据
|
|
|
|
|
|
var tastStr = "";
|
|
|
|
|
|
if (head.BLTYPE != "WaybillInstructions")
|
|
|
{
|
|
|
var 任务相关人员 = Get任务相关人员(connStr, head);
|
|
|
|
|
|
var 是否公共 = "0";
|
|
|
|
|
|
if (任务相关人员 == "")
|
|
|
{
|
|
|
是否公共 = "1";
|
|
|
}
|
|
|
|
|
|
tastStr = $" INSERT INTO [t_op_task] ([任务编号],[上级任务号],[任务类型],[任务来源],[任务状态],[任务说明],[发起人],[录入日期],[任务开始时间],[完成方式],[完成时间],[KPI值],[提单号],[文件编号],[邮件编号],[电子档案路径],[是否公共],[任务相关人员],[SEA编号]) select newid(),null,{head.任务类型增删标记},'FTP','未开始','{head.增删标记str}辛克订舱:{head.PORTDISCHARGE};{head.DESTINATION}','DEMO-SA',GETDATE(),GETDATE(),'手动',NULL,0,'{head.CUSTNO}',null,null,null,{是否公共},'{任务相关人员}','{head.BSNO}' ";
|
|
|
}
|
|
|
var sqlstr = headStr + " " + ctnStr + tastStr;
|
|
|
return sqlstr;
|
|
|
}
|
|
|
|
|
|
public static int ExecSql(string connStr, string SqlStr)
|
|
|
{
|
|
|
SqlConnection SCON = null;//连接对象
|
|
|
|
|
|
SqlCommand SCom = new SqlCommand();//命令对象
|
|
|
|
|
|
SCON = new SqlConnection(connStr);
|
|
|
|
|
|
SCON.Open();
|
|
|
|
|
|
SCom.CommandText = SqlStr;
|
|
|
|
|
|
SCom.Connection = SCON;
|
|
|
|
|
|
SCom.CommandType = CommandType.Text;
|
|
|
|
|
|
int num = SCom.ExecuteNonQuery();
|
|
|
|
|
|
SCON.Close();
|
|
|
|
|
|
return num;
|
|
|
}
|
|
|
|
|
|
public static DataTable QuerySql(string connStr, string condition)
|
|
|
{
|
|
|
SqlConnection conn = new SqlConnection(connStr);
|
|
|
SqlDataAdapter dataAdapter = new SqlDataAdapter(condition, conn);
|
|
|
DataTable tQuery = new DataTable();
|
|
|
dataAdapter.Fill(tQuery);
|
|
|
return tQuery;
|
|
|
}
|
|
|
|
|
|
public static List<PKGSEDI_MB> GetPKGSList(string connStr)
|
|
|
{
|
|
|
|
|
|
|
|
|
var result = new List<PKGSEDI_MB>();
|
|
|
|
|
|
var sqlQuery = " select * from t_code_package ";
|
|
|
|
|
|
DataTable tQuery = QuerySql(connStr, sqlQuery);
|
|
|
|
|
|
if (tQuery.Rows.Count >= 0)
|
|
|
{
|
|
|
foreach (DataRow row in tQuery.Rows)
|
|
|
{
|
|
|
PKGSEDI_MB item = new PKGSEDI_MB();
|
|
|
item.EDICODE = row["EDI代码"].ToString().Trim();
|
|
|
item.PKGS = row["代码"].ToString();
|
|
|
result.Add(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static List<PKGSEDI_MB> GetCtnCodeList(string connStr)
|
|
|
{
|
|
|
|
|
|
|
|
|
var result = new List<PKGSEDI_MB>();
|
|
|
|
|
|
var sqlQuery = " select * from t_code_ctn ";
|
|
|
|
|
|
DataTable tQuery = QuerySql(connStr, sqlQuery);
|
|
|
|
|
|
if (tQuery.Rows.Count >= 0)
|
|
|
{
|
|
|
foreach (DataRow row in tQuery.Rows)
|
|
|
{
|
|
|
PKGSEDI_MB item = new PKGSEDI_MB();
|
|
|
item.EDICODE = row["EDI代码辛克"].ToString().Trim();
|
|
|
item.PKGS = row["表现形式"].ToString();
|
|
|
result.Add(item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static string GetMailStmp(string connStr,string StmpID="")
|
|
|
{
|
|
|
|
|
|
|
|
|
var result ="";
|
|
|
|
|
|
var sqlQuery = " select * from Mail_Send_Smtp ";
|
|
|
if (StmpID != "") sqlQuery = sqlQuery+" WHERE GID='"+ StmpID + "'";
|
|
|
|
|
|
DataTable tQuery = QuerySql(connStr, sqlQuery);
|
|
|
|
|
|
if (tQuery.Rows.Count >= 0)
|
|
|
{
|
|
|
result=tQuery.Rows[0]["GID"].ToString();
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
public static int SaveMail(string connStr,string sendto,string title,string body,string smtpid)
|
|
|
{
|
|
|
|
|
|
var sqlstr = $" INSERT INTO [Mail_Send] ([GID],[SendTo],[Title],[Body],[SendStatus],[TryCount],[CreateTime],[SmtpConfig],[Sender],[ShowName]) select newid(),'{sendto}','{title}','{body.Replace("'","''")}','Create',0,GETDATE(),'{smtpid}','','' ";
|
|
|
return ExecSql(connStr, sqlstr);
|
|
|
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
/// 返回带单引号的用逗号隔开的人员姓名
|
|
|
/// </summary>
|
|
|
/// <param name="connStr"></param>
|
|
|
/// <param name="head"></param>
|
|
|
/// <returns></returns>
|
|
|
public static string Get任务相关人员(string connStr, FTP_SeaeOrderMC head)
|
|
|
{
|
|
|
|
|
|
if (head.CARRIER == "") return "";
|
|
|
|
|
|
var result = "";
|
|
|
|
|
|
var sqlQuery = $" select 姓名 from t_sys_employee where 辛克代码 like'%{head.CARRIER}%' ";
|
|
|
|
|
|
DataTable tQuery = QuerySql(connStr, sqlQuery);
|
|
|
|
|
|
if (tQuery.Rows.Count >= 0)
|
|
|
{
|
|
|
foreach (DataRow row in tQuery.Rows)
|
|
|
{
|
|
|
if (result != "") result += ",";
|
|
|
result += row["姓名"].ToString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public static string Get任务相关人员邮箱(string connStr, FTP_SeaeOrderMC head)
|
|
|
{
|
|
|
|
|
|
if (head.CARRIER == "") return "";
|
|
|
|
|
|
var result = "";
|
|
|
|
|
|
var sqlQuery = $" select 邮箱 from t_sys_employee where 辛克代码 like'%{head.CARRIER}%' ";
|
|
|
|
|
|
DataTable tQuery = QuerySql(connStr, sqlQuery);
|
|
|
|
|
|
if (tQuery.Rows.Count >= 0)
|
|
|
{
|
|
|
foreach (DataRow row in tQuery.Rows)
|
|
|
{
|
|
|
if (result != "") result += ",";
|
|
|
result += row["邮箱"].ToString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
public static int DealDel(string connStr, FTP_SeaeOrderMC head) {
|
|
|
var sqlstr = getDealDelSql(connStr, head);
|
|
|
return ExecSql(connStr, sqlstr);
|
|
|
}
|
|
|
|
|
|
public static string getDealDelSql(string connStr, FTP_SeaeOrderMC head) {
|
|
|
var tastStr = $" delete from [t_op_task] where [任务状态]='未开始' and [提单号]='{head.CUSTNO}' ";
|
|
|
|
|
|
tastStr += " del ";
|
|
|
|
|
|
tastStr += " update [t_op_task] set [任务说明]='【已退舱!】 '+[任务说明] where [任务状态]<>'未开始' and [提单号]='"+head.CUSTNO+"' ";
|
|
|
|
|
|
return tastStr;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
[JsonObject]//箱型表
|
|
|
public class PKGSEDI_MB
|
|
|
{
|
|
|
public string EDICODE { get; set; }
|
|
|
|
|
|
public string PKGS { get; set; }
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|