diff --git a/DSWeb.Common/DB/DS6Comm.cs b/DSWeb.Common/DB/DS6Comm.cs index 469bd787..03cd5051 100644 --- a/DSWeb.Common/DB/DS6Comm.cs +++ b/DSWeb.Common/DB/DS6Comm.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; +using System.Reflection; using System.Text.RegularExpressions; using System.Web; @@ -876,4 +877,109 @@ namespace DSWeb.Common.DB public decimal? 拆分汇率 { get; set; } } + + + /// + /// 业务函电 + /// + [Table("t_op_letter")] + + public partial class t_op_letter_md + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int LE_ID { get; set; } = 0; + public string 编号 { get; set; } + public string 函电名称 { get; set; } + public string HEAD_TO { get; set; } + public string HEAD_ATTN { get; set; } + public string 签发人 { get; set; } + public DateTime? 签发日期 { get; set; } + public int? LF { get; set; } + + public long? DJYBOOKINGID { get; set; } + + public long? DJYLETTERID { get; set; } + } + + public class OpLetterBase { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.None)] + public int LE_ID { get; set; } = 0; + + public long DJYLETTERID { get; set; } + public long DJYBOOKINGID { get; set; } + + public void getCopy(OpLetterBase newrec, Type lettertype) + { + + PropertyInfo[] properties = lettertype.GetProperties(); + + // 遍历属性打印到控制台。 + foreach (PropertyInfo prop in properties) + { + if (prop.Name == "LE_ID" || prop.Name == "DJYID" || prop.Name == "DJYBOOKINGID") + continue; + //Console.WriteLine(prop.Name); + prop.SetValue(this, prop.GetValue(newrec), null); + } + } + } + + /// + /// 业务函电 派车 + /// + [Table("t_op_letter_pc")] + + public partial class t_op_letter_pc_md: OpLetterBase + { + public string 承运车队 { get; set; } + public string 箱型箱量 { get; set; } + public string 背箱场站 { get; set; } + public string 场站联系人 { get; set; } + public string 场站电话 { get; set; } + public string 要求到厂时间 { get; set; } + public string 厂家地址 { get; set; } + public string 厂家联系人 { get; set; } + public string 厂家联系电话 { get; set; } + public string 返箱地址 { get; set; } + public string 返箱联系人 { get; set; } + public string 返箱联系电话 { get; set; } + public string 备注 { get; set; } + public decimal? 陆运费 { get; set; } + public string 结算方式 { get; set; } + + + } + + + /// + /// + /// + [Table("t_op_letter_rh")] + + public partial class t_op_letter_rh_md : OpLetterBase + { + + public string 入货场站 { get; set; } + public string 入货截至时间 { get; set; } + public string 场站联系人 { get; set; } + public string 场站联系电话 { get; set; } + public string 备注 { get; set; } + + + public t_op_letter_rh_md() { } + + //public void getCopy(t_op_letter_rh_md updrec) { + // 入货场站 = updrec.入货场站; + // 入货截至时间 = updrec.入货截至时间; + // 场站联系人 = updrec.场站联系人; + // 场站联系电话 = updrec.场站联系电话; + // 场站电话 = updrec.场站电话; + // 备注 = updrec.备注; + // DJYID = updrec.DJYID; + //} + } + + } \ No newline at end of file diff --git a/DSWeb.Common/DB/DS6DataContext.cs b/DSWeb.Common/DB/DS6DataContext.cs index 477bad9c..45837a2a 100644 --- a/DSWeb.Common/DB/DS6DataContext.cs +++ b/DSWeb.Common/DB/DS6DataContext.cs @@ -34,7 +34,12 @@ namespace DSWeb.Common.DB public DbSet t_sys_code_emp { get; set; } public DbSet t_code_goods { get; set; } public DbSet t_ch_fee { get; set; } - + + public DbSet t_op_letter { get; set; } + + public DbSet t_op_letter_rh { get; set; } + public DbSet t_op_letter_pc { get; set; } + } diff --git a/DSWeb.DJYMQ/App.config b/DSWeb.DJYMQ/App.config index d1e1c3e6..0ac2eb98 100644 --- a/DSWeb.DJYMQ/App.config +++ b/DSWeb.DJYMQ/App.config @@ -12,16 +12,17 @@ - - + - + diff --git a/DSWeb.DJYMQ/DS7Service.cs b/DSWeb.DJYMQ/DS7Service.cs index 0460a766..ada84f4e 100644 --- a/DSWeb.DJYMQ/DS7Service.cs +++ b/DSWeb.DJYMQ/DS7Service.cs @@ -23,6 +23,7 @@ using System.Security.Policy; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using System.Xml.Linq; using Topshelf; using static DSWeb.Service.Output.DS7.DS7Service; @@ -43,6 +44,10 @@ namespace DSWeb.Service.Output.DS7 private const string QueuePrefix_DingCang = "djy.output.dingcang.ds6."; private const string QueuePrefix_Del = "djy.output.dingcang.ds6_delete."; + + private const string QueuePrefix_Letter_RH = "djy.output.dingcang.ds6_fangcang."; + private const string QueuePrefix_Letter_PC = "djy.output.booktruck.ds6."; + /// /// 在大简云的公司ID /// @@ -55,10 +60,15 @@ namespace DSWeb.Service.Output.DS7 //private string FeeInputUserId = ConfigurationManager.AppSettings["FeeInputUserId"]; - private static string UserNameStr = ConfigurationManager.AppSettings["UserNameStr"]; + //private static string UserNameStr = ConfigurationManager.AppSettings["UserNameStr"]; private IConnection mqConn; + private IConnection mqConn2; + + private IConnection mqConn3; + + private IConnection mqConn4; //费用相关配置 //private static string FeePayName = ConfigurationManager.AppSettings["FeePayName"]; //private static string FeePayCustomer = ConfigurationManager.AppSettings["FeePayCustomer"]; @@ -82,23 +92,34 @@ namespace DSWeb.Service.Output.DS7 dS7Data.Database.Log = (x => { logger.Debug(x); }); - if (!string.IsNullOrWhiteSpace(UserNameStr)) { - usernamelist = UserNameStr.Split(',').ToList() ; - } + //if (!string.IsNullOrWhiteSpace(UserNameStr)) { + // usernamelist = UserNameStr.Split(',').ToList() ; + //} try { - ConnectionFactory factory = new ConnectionFactory(); - factory.Uri = new Uri(RecMqUri); - mqConn = factory.CreateConnection(); + //测试数据 + #region 测试文本 //var testjson = @"[{""Id"":410220620034118,""BSNO"":null,""BSSTATUS"":null,""BSSTATUSNAME"":null,""BSDATE"":null,""MBLNO"":""AMQ0105704"",""HBLNO"":"""",""BOOKINGNO"":""410220620034117"",""CONTRACTNO"":"""",""SERVICECONTRACTNO"":null,""SHIPPERID"":null,""CONSIGNEEID"":null,""NOTIFYPARTYID"":null,""SHIPPER"":""QIXIAN JIBANG AGRICULTURAL \nPRODUCTS CO.,LTD.\nGROUP 4 CAOGANG VILLAGE,WULIHE \nTOWN,QIXIAN,KAIFENG\nCITY,HENAN PROVINCE,CHINA"",""CONSIGNEE"":""PT LANGGENG REJEKI INDONESIA\nGEDUNG DISTRICT 8,TOWER TREASURY \nLANTAI 6 UNIT F,JL.JENDERAL SUDIRMAN \nKAV.52-53,DESA/KELURAHAN SENAYAN,\nKEC.KEBAYORAN BARU,KOTA ADM.JAKARTA SELATAN,\nPROVINSI DKI JAKARTA,12190-INDONESIA"",""NOTIFYPARTY"":""PT LANGGENG REJEKI INDONESIA\nGEDUNG DISTRICT 8,TOWER TREASURY \nLANTAI 6 UNIT F,JL.JENDERAL SUDIRMAN \nKAV.52-53,DESA/KELURAHAN SENAYAN,\nKEC.KEBAYORAN BARU,KOTA ADM.JAKARTA SELATAN,\nPROVINSI DKI JAKARTA,12190-INDONESIA"",""NOTIFYPARTY2"":null,""YARDID"":""GangLianXin"",""YARD"":""港联欣场站"",""VESSELID"":null,""VESSEL"":""SPIRIT OF LISBON"",""VOYNO"":"""",""VOYNOINNER"":""0XL2LS1NC"",""ETD"":""2023-04-29T00:00:00"",""ATD"":null,""CLOSINGDATE"":null,""CLOSEDOCDATE"":null,""CLOSEVGMDATE"":null,""ETA"":null,""PLACERECEIPTID"":""CNTAO"",""PLACERECEIPT"":""QINGDAO,CHINA"",""PORTLOADID"":""CNTAO"",""PORTLOAD"":""QINGDAO,CHINA"",""PORTDISCHARGEID"":""IDJKT"",""PORTDISCHARGE"":""JAKARTA"",""PLACEDELIVERYID"":"""",""PLACEDELIVERY"":"""",""DESTINATIONID"":"""",""DESTINATION"":"""",""NOBILL"":"""",""COPYNOBILL"":"""",""ISSUETYPE"":"""",""ISSUEDATE"":null,""ISSUEPLACEID"":""CNTAO"",""ISSUEPLACE"":""QINGDAO,CHINA"",""BLFRT"":"""",""PREPARDAT"":"""",""PAYABLEAT"":"""",""SERVICE"":"""",""MARKS"":"""",""HSCODE"":"""",""DESCRIPTION"":""FRESH GARLIC\nTEMP:-3'C\nVENT:CLOSED\nHS CODE:070320"",""PKGS"":14500,""KINDPKGS"":"""",""KGS"":290000.00000,""CBM"":545.0000,""TOTALNO"":"""",""CNTRTOTAL"":""40RH*10"",""CARRIERID"":""CNC"",""CARRIER"":""CNC"",""CARGOID"":""R"",""DCLASS"":"""",""DUNNO"":"""",""DPAGE"":"""",""DLABEL"":"""",""LINKMAN"":"""",""TEMPID"":"""",""TEMPSET"":"""",""REEFERF"":"""",""HUMIDITY"":"""",""TEMPMIN"":"""",""TEMPMAX"":"""",""ISCONTAINERSOC"":false,""SOREMARK"":"""",""SIREMARK"":"""",""YARDREMARK"":"""",""COMPID"":null,""COMPNAME"":null,""SHIPPERNAME"":null,""SHIPPERADDR1"":null,""SHIPPERADDR2"":null,""SHIPPERADDR3"":null,""SHIPPERCITY"":null,""SHIPPERPROVINCE"":null,""SHIPPERPOSTCODE"":null,""SHIPPERCOUNTRY"":null,""SHIPPERATTN"":null,""SHIPPERTEL"":null,""CONSIGNEENAME"":null,""CONSIGNEEADDR1"":null,""CONSIGNEEADDR2"":null,""CONSIGNEEADDR3"":null,""CONSIGNEECITY"":null,""CONSIGNEEPROVINCE"":null,""CONSIGNEEPOSTCODE"":null,""CONSIGNEERCOUNTRY"":null,""CONSIGNEEATTN"":null,""CONSIGNEETEL"":null,""NOTIFYPARTYNAME"":null,""NOTIFYPARTYADDR1"":null,""NOTIFYPARTYADDR2"":null,""NOTIFYPARTYADDR3"":null,""NOTIFYPARTYCITY"":null,""NOTIFYPARTYPROVINCE"":null,""NOTIFYPARTYPOSTCODE"":null,""NOTIFYPARTYCOUNTRY"":null,""NOTIFYPARTYATTN"":null,""NOTIFYPARTYTEL"":null,""PONO"":"""",""OPID"":""360682469556293"",""DOCID"":""398912062132293"",""OP"":""初晓宁"",""DOC"":""姜新迪"",""SALEID"":""386903955771461"",""SALE"":""刘晓程"",""CUSTSERVICEID"":""356029265842245"",""CUSTSERVICE"":""王起凤"",""CUSTOMERNAME"":""杞县旺弘-吉邦"",""FORWARDER"":""新华鑫"",""SHIPAGENCY"":"""",""CUSTOMSER"":"""",""TRUCKER"":"""",""AGENTID"":"""",""CUSTOMERID"":410165595791429,""FORWARDERID"":""XHX"",""SHIPAGENCYID"":"""",""CUSTOMSERID"":"""",""TRUCKERID"":"""",""AGENTNAME"":"""",""WEITUO"":"""",""CONSIGNEEDOORADDR"":null,""SHIPPERDOORADDR"":null,""SCACCODE"":"""",""ITNCODE"":"""",""PREPARDATID"":"""",""PAYABLEATID"":"""",""CUSTNO"":"""",""TRANSPORTID"":"""",""TRANSPORT"":"""",""THIRDPAYADDR"":"""",""YARDCONTRACT"":"""",""YARDCONTRACTTEL"":"""",""YARDCONTRACTEMAIL"":"""",""FEESELF"":false,""LANECODE"":"""",""LANENAME"":""KCS"",""FREIGHTPAYER"":"""",""GOODSCODE"":"""",""GOODSNAME"":"""",""PKGSTOTAL"":"""",""KGSTOTAL"":"""",""CBMTOTAL"":"""",""ROUTEID"":""360682469556293"",""ROUTE"":""初晓宁"",""Warehouse"":"""",""WarehouseID"":"""",""EPCode"":"""",""LineName"":""印尼"",""DZRemark"":""V"",""CZRemark"":""0 蒜 FOB约号 建CODE 条码废2!"",""TMBLNO"":null,""ShippingMethod"":null,""CtnDayNum"":null,""CreatedUserName"":""初晓宁OP37"",""ZhanCangFlag"":""否"",""SourceCode"":""1"",""SourceName"":""自揽货"",""ctnInputs"":[{""Id"":410259908636741,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""SZLU9688263"",""SEALNO"":""C4541505"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4700.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33700.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908649029,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""CGMU6534921"",""SEALNO"":""C4541580"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4610.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33610.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908681797,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""CXRU1541670"",""SEALNO"":""C4542721"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4530.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33530.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908698181,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""CGMU5462806"",""SEALNO"":""C4541502"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4610.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33610.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908710469,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""TEMU9096457"",""SEALNO"":""C4542666"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4600.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33600.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908722757,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""TRIU8130385"",""SEALNO"":""C4542696"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4750.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33750.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908735045,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""TCLU1148074"",""SEALNO"":""C4541501"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4680.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33680.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908747333,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""TEMU9173717"",""SEALNO"":""C4542674"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":50.0000,""TAREWEIGHT"":4540.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33540.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908759621,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""CGMU5529638"",""SEALNO"":""C4542794"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4560.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33560.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]},{""Id"":410259908771909,""BILLID"":410220620034118,""CTNCODE"":null,""CTNALL"":""40RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":""CGMU9338080"",""SEALNO"":""C4542638"",""PKGS"":1450,""KINDPKGS"":""PKGS"",""KGS"":29000.0000,""CBM"":55.0000,""TAREWEIGHT"":4620.0000,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":33620.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":null,""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]}],""BookingEDIExt"":{""WeiTuoFang"":"""",""SendCode"":"""",""ReceiveCode"":"""",""NotifyCdoe"":"""",""SalerCode"":""CN097 | CHARLES GAO"",""MasterBolIndicator"":""3"",""EmanifestHbl"":"""",""ConsigneeEdiCode"":"""",""ShipperEdiCode"":""CN218868"",""EDIAttn"":"""",""EDIAttnTel"":"""",""EDIAttnMail"":"""",""AMSConsignee"":"""",""AMSNotifyParty"":"""",""OpEName"":"""",""OpTel"":"""",""OpEmail"":"""",""ACIHBL"":"""",""S0CC0C"":"""",""GoodsName"":"""",""MasterBolIndicatorName"":""Not Applicable/Straight bl | 无HBL"",""SalerCodeName"":"""",""CKHI"":"""",""CNCM"":"""",""WNCM"":"""",""OrderRemark"":""CN218868"",""ExRemark1"":"""",""ExRemark2"":"""",""ExRemark3"":"""",""ExRemark4"":"""",""KingTareweight"":null},""childrens"":[],""GoodsStatus"":[]}]"; + + //var testjson = @"[{ ""Id"":409151833878597,""BSNO"":null,""BSSTATUS"":null,""BSSTATUSNAME"":null,""BSDATE"":null,""MBLNO"":""TEST230421001"",""HBLNO"":"""",""BOOKINGNO"":""409151833858117"",""CONTRACTNO"":"""",""SERVICECONTRACTNO"":null,""SHIPPERID"":null,""CONSIGNEEID"":null,""NOTIFYPARTYID"":null,""SHIPPER"":""A"",""CONSIGNEE"":""B"",""NOTIFYPARTY"":""C"",""NOTIFYPARTY2"":null,""YARDID"":""GANGWAN"",""YARD"":""港联海场站"",""VESSELID"":null,""VESSEL"":"""",""VOYNO"":"""",""VOYNOINNER"":"""",""ETD"":""2100-12-12T00:00:00"",""ATD"":null,""CLOSINGDATE"":null,""CLOSEDOCDATE"":null,""CLOSEVGMDATE"":null,""ETA"":null,""PLACERECEIPTID"":"""",""PLACERECEIPT"":"""",""PORTLOADID"":"""",""PORTLOAD"":"""",""PORTDISCHARGEID"":""INMAA"",""PORTDISCHARGE"":""CHENNAI"",""PLACEDELIVERYID"":"""",""PLACEDELIVERY"":"""",""DESTINATIONID"":"""",""DESTINATION"":"""",""NOBILL"":""THREE"",""COPYNOBILL"":""THREE"",""ISSUETYPE"":null,""ISSUEDATE"":null,""ISSUEPLACEID"":"""",""ISSUEPLACE"":"""",""BLFRT"":""FREIGHT COLLECT"",""PREPARDAT"":"""",""PAYABLEAT"":""CHENNAI"",""SERVICE"":""CY-CY"",""MARKS"":"""",""HSCODE"":"""",""DESCRIPTION"":"""",""PKGS"":1256,""KINDPKGS"":""COILS"",""KGS"":236.00000,""CBM"":56.0000,""TOTALNO"":""SAY:ONE THOUSAND TWO HUNDRED AND FIFTY-SIX COILS ONLY."",""CNTRTOTAL"":""20'RH*1"",""CARRIERID"":""ESL"",""CARRIER"":""联酋船舶代理"",""CARGOID"":"""",""DCLASS"":"""",""DUNNO"":"""",""DPAGE"":"""",""DLABEL"":"""",""LINKMAN"":"""",""TEMPID"":"""",""TEMPSET"":"""",""REEFERF"":"""",""HUMIDITY"":"""",""TEMPMIN"":"""",""TEMPMAX"":"""",""ISCONTAINERSOC"":false,""SOREMARK"":"""",""SIREMARK"":"""",""YARDREMARK"":"""",""COMPID"":null,""COMPNAME"":null,""SHIPPERNAME"":null,""SHIPPERADDR1"":null,""SHIPPERADDR2"":null,""SHIPPERADDR3"":null,""SHIPPERCITY"":null,""SHIPPERPROVINCE"":null,""SHIPPERPOSTCODE"":null,""SHIPPERCOUNTRY"":null,""SHIPPERATTN"":null,""SHIPPERTEL"":null,""CONSIGNEENAME"":null,""CONSIGNEEADDR1"":null,""CONSIGNEEADDR2"":null,""CONSIGNEEADDR3"":null,""CONSIGNEECITY"":null,""CONSIGNEEPROVINCE"":null,""CONSIGNEEPOSTCODE"":null,""CONSIGNEERCOUNTRY"":null,""CONSIGNEEATTN"":null,""CONSIGNEETEL"":null,""NOTIFYPARTYNAME"":null,""NOTIFYPARTYADDR1"":null,""NOTIFYPARTYADDR2"":null,""NOTIFYPARTYADDR3"":null,""NOTIFYPARTYCITY"":null,""NOTIFYPARTYPROVINCE"":null,""NOTIFYPARTYPOSTCODE"":null,""NOTIFYPARTYCOUNTRY"":null,""NOTIFYPARTYATTN"":null,""NOTIFYPARTYTEL"":null,""PONO"":"""",""OPID"":""400234750476357"",""DOCID"":""400234750476357"",""OP"":""单证007"",""DOC"":""单证007"",""SALEID"":""400234750476357"",""SALE"":""单证007"",""CUSTSERVICEID"":""400234750476357"",""CUSTSERVICE"":""单证007"",""CUSTOMERNAME"":"""",""FORWARDER"":""青岛德贸"",""SHIPAGENCY"":"""",""CUSTOMSER"":"""",""TRUCKER"":"""",""AGENTID"":"""",""CUSTOMERID"":null,""FORWARDERID"":""QDDM"",""SHIPAGENCYID"":"""",""CUSTOMSERID"":"""",""TRUCKERID"":"""",""AGENTNAME"":"""",""WEITUO"":"""",""CONSIGNEEDOORADDR"":null,""SHIPPERDOORADDR"":null,""SCACCODE"":"""",""ITNCODE"":"""",""PREPARDATID"":"""",""PAYABLEATID"":""INMAA"",""CUSTNO"":"""",""TRANSPORTID"":"""",""TRANSPORT"":"""",""THIRDPAYADDR"":"""",""YARDCONTRACT"":"""",""YARDCONTRACTTEL"":"""",""YARDCONTRACTEMAIL"":"""",""FEESELF"":false,""LANECODE"":"""",""LANENAME"":"""",""FREIGHTPAYER"":"""",""GOODSCODE"":"""",""GOODSNAME"":"""",""PKGSTOTAL"":"""",""KGSTOTAL"":"""",""CBMTOTAL"":"""",""ROUTEID"":"""",""ROUTE"":"""",""Warehouse"":"""",""WarehouseID"":"""",""EPCode"":"""",""LineName"":""印度"",""DZRemark"":"""",""CZRemark"":"""",""TMBLNO"":null,""ShippingMethod"":null,""CtnDayNum"":null,""CreatedUserName"":""单证007"",""ZhanCangFlag"":null,""SourceCode"":null,""SourceName"":null,""ctnInputs"":[{ ""Id"":409151833956421,""BILLID"":409151833878597,""CTNCODE"":""14"",""CTNALL"":""20'RH"",""CTNNUM"":1,""TEU"":null,""CNTRNO"":"""",""SEALNO"":"""",""PKGS"":1256,""KINDPKGS"":""COILS"",""KGS"":236.0000,""CBM"":56.0000,""TAREWEIGHT"":null,""CTNSTATUS"":null,""WEIGHTYPE"":""累加"",""WEIGHKGS"":236.0000,""WEIGHATTN"":null,""VGMCONNCOM"":null,""WEIGHTEL"":null,""WEIGHDATE"":"""",""VGMADDR"":null,""VGMEMAIL"":null,""REMARK"":null,""ctnDetailInputs"":[]}],""BookingEDIExt"":{ ""WeiTuoFang"":"""",""SendCode"":"""",""ReceiveCode"":"""",""NotifyCdoe"":"""",""SalerCode"":""CN097 | CHARLES GAO"",""MasterBolIndicator"":""3"",""EmanifestHbl"":"""",""ConsigneeEdiCode"":"""",""ShipperEdiCode"":""CN218868"",""EDIAttn"":"""",""EDIAttnTel"":"""",""EDIAttnMail"":"""",""AMSConsignee"":"""",""AMSNotifyParty"":"""",""OpEName"":"""",""OpTel"":"""",""OpEmail"":"""",""ACIHBL"":"""",""S0CC0C"":"""",""GoodsName"":"""",""MasterBolIndicatorName"":""Not Applicable/Straight bl | 无HBL"",""SalerCodeName"":"""",""CKHI"":"""",""CNCM"":"""",""WNCM"":"""",""OrderRemark"":""CN218868"",""ExRemark1"":"""",""ExRemark2"":"""",""ExRemark3"":"""",""ExRemark4"":"""",""KingTareweight"":null},""BookingLetteryard"":{ ""BookingId"":409151833878597,""ToName"":""asdfsfsdfsdf"",""Attn"":"""",""AttnTel"":"""",""AttnMail"":"""",""FromName"":""单证007"",""FromTel"":"""",""FromMail"":"""",""Description"":"""",""CloseDocTime"":""2023-04-27T13:45:23"",""ClosingTime"":""2023-04-27T13:45:20"",""VgmTime"":""2023-04-29T13:45:24"",""Remark"":""点开始附件国家大事gf就、\n鬼斧神工电饭锅电饭锅\n东风浩荡和\n股东会让他忽然他忽然好"",""YARDID"":""GANGWAN"",""YARD"":""港联海场站"",""YARDCONTRACT"":""对对对"",""YARDCONTRACTTEL"":""123123"",""TenantId"":349708986646597,""CreatedTime"":""2023-04-26T13:44:47"",""UpdatedTime"":""2023-04-26T13:45:28"",""CreatedUserId"":400234750476357,""CreatedUserName"":""单证007"",""UpdatedUserId"":400234750476357,""UpdatedUserName"":""单证007"",""IsDeleted"":false,""Id"":410921719222341},""childrens"":[],""GoodsStatus"":[]}]"; + //DingCangToDS6(JArray.Parse(testjson)); + //byte[] byteArray = System.Text.Encoding.Default.GetBytes(testjson); //var strBody = Encoding.UTF8.GetString(byteArray.ToArray()); //DingCangToDS6(JArray.Parse(strBody)); + // + #endregion + + #region 订舱业务和删除订舱业务 + + ConnectionFactory factory = new ConnectionFactory(); + factory.Uri = new Uri(RecMqUri); + mqConn = factory.CreateConnection(); IModel modelDingCang = mqConn.CreateModel(); modelDingCang.ExchangeDeclare(ExchangeName, ExchangeType.Direct); @@ -134,9 +155,13 @@ namespace DSWeb.Service.Output.DS7 - IModel modelDel = mqConn.CreateModel(); + ConnectionFactory factory2 = new ConnectionFactory(); + factory2.Uri = new Uri(RecMqUri); + mqConn2 = factory2.CreateConnection(); + + IModel modelDel = mqConn2.CreateModel(); modelDel.ExchangeDeclare(ExchangeName, ExchangeType.Direct); - modelDel.QueueDeclare($"{QueuePrefix_Del}{CompanyId}", false, false, false, null); + modelDel.QueueDeclare($"{QueuePrefix_Letter_RH}{CompanyId}", false, false, false, null); var consumerDel = new EventingBasicConsumer(modelDel); consumerDel.Received += (ch, ea) => @@ -164,9 +189,89 @@ namespace DSWeb.Service.Output.DS7 }; //第二个参数控制【是否消费掉队列里的数据】 - modelDel.BasicConsume($"{QueuePrefix_Del}{CompanyId}", true, consumerDingCang); + modelDel.BasicConsume($"{QueuePrefix_Letter_RH}{CompanyId}", true, consumerDel); + + #endregion + + #region 业务函电 入货通知 + ConnectionFactory factory3 = new ConnectionFactory(); + factory3.Uri = new Uri(RecMqUri); + mqConn3 = factory3.CreateConnection(); + + IModel model_Letter_RH = mqConn3.CreateModel(); + model_Letter_RH.ExchangeDeclare(ExchangeName, ExchangeType.Direct); + model_Letter_RH.QueueDeclare($"{QueuePrefix_Letter_RH}{CompanyId}", false, false, false, null); + + var consumer_Letter_RH = new EventingBasicConsumer(model_Letter_RH); + consumer_Letter_RH.Received += (ch, ea) => + { + var body = ea.Body; + var strBody = Encoding.UTF8.GetString(body.ToArray()); + logger.Debug($"收到大简云入货通知:{strBody}"); + + try + { + //导出到东胜6 + DS6OpLetter_RH(strBody); + } + catch (Exception ex) + { + var excep = ex; + while (excep != null) + { + logger.Error(excep.Message); + logger.Error(excep.StackTrace); + + excep = excep.InnerException; + } + } + + }; + //第二个参数控制【是否消费掉队列里的数据】 + model_Letter_RH.BasicConsume($"{QueuePrefix_Letter_RH}{CompanyId}", false, consumer_Letter_RH); + + #endregion + + #region 业务函电 派车 + + ConnectionFactory factory4 = new ConnectionFactory(); + factory4.Uri = new Uri(RecMqUri); + mqConn4 = factory4.CreateConnection(); + + IModel model_Letter_PC = mqConn4.CreateModel(); + model_Letter_PC.ExchangeDeclare(ExchangeName, ExchangeType.Direct); + model_Letter_PC.QueueDeclare($"{QueuePrefix_Letter_PC}{CompanyId}", false, false, false, null); + + var consumer_Letter_PC = new EventingBasicConsumer(model_Letter_PC); + consumer_Letter_PC.Received += (ch, ea) => + { + var body = ea.Body; + var strBody = Encoding.UTF8.GetString(body.ToArray()); + logger.Debug($"收到大简云派车通知:{strBody}"); + + try + { + //导出到东胜6 + DS6OpLetter_PC(strBody); + } + catch (Exception ex) + { + var excep = ex; + while (excep != null) + { + logger.Error(excep.Message); + logger.Error(excep.StackTrace); + + excep = excep.InnerException; + } + } + + }; + //第二个参数控制【是否消费掉队列里的数据】 + model_Letter_PC.BasicConsume($"{QueuePrefix_Letter_PC}{CompanyId}", false, consumer_Letter_PC); + + #endregion - } catch (Exception e) { @@ -182,6 +287,9 @@ namespace DSWeb.Service.Output.DS7 //StdSchedulerFactory.GetDefaultScheduler().Shutdown(); mqConn.Close(); + mqConn2.Close(); + mqConn3.Close(); + mqConn4.Close(); return true; } @@ -1571,6 +1679,7 @@ SELECT @ps_BillNo as N'billno'"; } } + public bool 人员是否具备权限(string username, string 权限值) { //SELECT [人员] FROM[dbo].[t_sys_code_emp] where 权限代码 = '776' and 是否可操作 = 1 /* @@ -1658,6 +1767,47 @@ SELECT @ps_BillNo as N'billno'"; } + #endregion + + #region 处理业务函电 + public void DS6OpLetter_RH(string itemstr) + { + + try + { + DS6DataContext DS6Data = new DS6DataContext(); + + var rh= JsonConvert.DeserializeObject<大简云入货通知>(itemstr); + + var letter= rh.GetLetter(); + + letter.SaveLetter(); + } + catch (Exception e) + { + logger.Error($"入货通知出错:{e}////" + itemstr); + } + } + + public void DS6OpLetter_PC(string itemstr) + { + + try + { + DS6DataContext DS6Data = new DS6DataContext(); + + var rh = JsonConvert.DeserializeObject<大简云派车>(itemstr); + + var letter = rh.GetLetter(); + + letter.SaveLetter(); + } + catch (Exception e) + { + logger.Error($"派车通知出错:{e}////" + itemstr); + } + } + #endregion #region 大简云订舱数据解析类 @@ -2016,14 +2166,25 @@ SELECT @ps_BillNo as N'billno'"; } } + public int get周次(DateTime? etd) { + try + { + DateTime dateTime = new DateTime(((DateTime)etd).Year, 1, 1); + TimeSpan ts1 = ((DateTime)etd).Subtract(dateTime).Duration(); + var days = ts1.Days; + var weeks = (int)(Math.Ceiling(days / 7.0)); + return weeks; + } + catch (Exception e) { + return 0; + } + } + //记录品名 public t_op_seae_md GetOpseae() { - DateTime dateTime = new DateTime(((DateTime)etd).Year, 1, 1); - TimeSpan ts1 = ((DateTime)etd).Subtract(dateTime).Duration(); - var days = ts1.Days; - var weeks = (int)(Math.Ceiling(days / 7.0)); + var weeks = get周次(etd); //20230410 根据箱信息重新计算 集装箱 和 箱数大写 var d6 = new DS6DataContext(); @@ -2457,6 +2618,7 @@ SELECT @ps_BillNo as N'billno'"; //{ var item = bookingEDIExt; + var newrec = new t_op_ams_md { 编号 = head.编号, @@ -2469,7 +2631,8 @@ SELECT @ps_BillNo as N'billno'"; 南美东NCM = 设置换行(SetLength(item.cncm, 600)), 巴西木质包装说明 = 设置换行(SetLength(item.wncm, 300)), 实际开船日期 = head.ETD, - HBL发送方式 = SetLength(item.masterBolIndicator, 1) + HBL发送方式 = SetLength(item.masterBolIndicator, 1), + ESL航线代码 = lineName }; result.Add(newrec); //} @@ -2487,16 +2650,70 @@ SELECT @ps_BillNo as N'billno'"; foreach (var item in childrens) { - var 当前货名 = d6.t_code_goods.Where(x => x.代码 == goodscode).ToList(); + var weeks = get周次(item.etd); + + var 箱型箱量 = new 箱型箱量(); + + var 箱号封号 = ""; + var 件数包装 = ""; + var 货物重量 = ""; + var 货物尺码 = ""; + + foreach (var ctn in item.ctnInputs) + { + var 箱型infoList = d6.t_code_ctn.Where(x => (x.尺寸 + x.箱型) == ctn.ctnall || (x.尺寸 + "'" + x.箱型) == ctn.ctnall).ToList(); + var 箱型info = new t_code_ctn_md(); + if (箱型infoList != null && 箱型infoList.Count > 0) + { + 箱型info = 箱型infoList[0]; + } + else + { + continue; + } + + 箱型箱量.Add(new 箱型箱量item(箱型info, ctn.ctnnum == null ? 1 : (int)ctn.ctnnum)); + + if (!string.IsNullOrWhiteSpace(ctn.cntrno) || !string.IsNullOrWhiteSpace(ctn.sealno)) + { + if (箱号封号 != "") 箱号封号 += "\r\n"; + 箱号封号 += (string.IsNullOrWhiteSpace(ctn.cntrno) ? "" : ctn.cntrno) + (string.IsNullOrWhiteSpace(ctn.sealno) ? "" : "/" + ctn.sealno); + } + + if (ctn.pkgs != null && ctn.pkgs != 0 && !string.IsNullOrWhiteSpace(ctn.kindpkgs)) + { + if (件数包装 != "") 件数包装 += "\r\n"; + 件数包装 += ctn.pkgs.ToString() + ctn.kindpkgs; + } + + if (ctn.kgs != null)// && ctn.重量 != 0 + { + if (货物重量 != "") 货物重量 += "\r\n"; + 货物重量 += ctn.kgs.ToString() + "KGS"; + } + + if (ctn.cbm != null)//&& ctn.尺码 != 0 + { + if (货物尺码 != "") 货物尺码 += "\r\n"; + 货物尺码 += ctn.cbm.ToString() + "CBM"; + } + } + + var 集装箱 = 箱型箱量.get集装箱(); + var 箱数大写 = 箱型箱量.get箱数大写(); + + + + var 当前货名 = d6.t_code_goods.Where(x => x.代码 == item.goodscode).ToList(); if (当前货名 == null || 当前货名.Count == 0) { var newcodegoods = new t_code_goods_md(); - newcodegoods.代码 = SetLength(goodscode, 10); - newcodegoods.货物名称 = SetLength(goodsname, 100); + newcodegoods.代码 = SetLength(item.goodscode, 10); + newcodegoods.货物名称 = SetLength(item.goodsname, 100); 货物名称 = newcodegoods.货物名称; - newcodegoods.货物描述 = SetLength(description, 600); - newcodegoods.商品编码 = SetLength(hscode, 10); + newcodegoods.货物描述 = SetLength(item.description, 600); + newcodegoods.商品编码 = SetLength(item.hscode, 10); d6.t_code_goods.Add(newcodegoods); d6.SaveChanges(); } @@ -2518,6 +2735,8 @@ SELECT @ps_BillNo as N'billno'"; 发货人代码 = 设置换行(item.shipper), 收货人代码 = 设置换行(item.consignee), 通知人代码 = 设置换行(item.notifyparty), + 代理内容 = 设置换行(item.agentname), + 提单份数 = item.nobill, 签单方式 = item.issuetype, 签单日期 = item.issuedate, @@ -2552,6 +2771,65 @@ SELECT @ps_BillNo as N'billno'"; //总价 = (item.bookingEDIExt == null) ? 0M : item.bookingEDIExt.kingTareweight == null ? 0M : item.bookingEDIExt.kingTareweight, //预付地点= item.prepardatid, //到付地点= item.payableatid, + + 周次 = weeks, + + 运费协议号 = item.contractno, + + 场站 = item.yard, + 船名 = item.vessel, + 航次 = item.voynoinner, + 开船日期 = SetDayZero(item.etd), + 截港日期 = SetDayZero(item.closingdate), + + 装港代码 = item.portloadid, + 装货港 = item.portload, + 卸货代码 = item.portdischargeid, + 卸货港 = item.portdischarge, + 交货代码 = item.placedeliveryid, + 交货地点 = item.placedelivery, + 目的地代码 = item.destinationid, + 目的地 = item.destination, + + //集装箱 = 集装箱, + 箱数大写 = 箱数大写, + + 合同号 = item.pono, + + 委托单位 = item.customername, + 报关行 = item.customser, + 承运车队 = item.trucker, + 货代公司 = item.forwarder,//大简云“订舱代理”,ds6界面的“订舱代理”,ds6数据库的货代 + 备案号 = item.lanename, + 航线 = item.lineName, + + 代理 = item.agentname,//大简云“国外代理”,ds6界面的“代理”,ds6数据库的代理 + + + 录入人 = createdUserName, + + + 箱TEU = 箱型箱量.getTeu(), + 箱型1 = 箱型箱量.get箱型1(), + 箱型2 = 箱型箱量.get箱型2(), + 箱型3 = 箱型箱量.get箱型3(), + 箱型4 = 箱型箱量.get箱型4(), + 箱型5 = 箱型箱量.get箱型5(), + 箱型6 = 箱型箱量.get箱型6(), + 箱型7 = 箱型箱量.get箱型7(), + 箱型8 = 箱型箱量.get箱型8(), + 箱型9 = 箱型箱量.get箱型9(), + 箱型10 = 箱型箱量.get箱型10(), + + 辅助字段一 = 设置换行(item.bookingEDIExt.exRemark1), + 辅助字段二 = 设置换行(item.bookingEDIExt.exRemark2), + 辅助字段三 = 设置换行(item.bookingEDIExt.exRemark3), + 辅助字段四 = 设置换行(item.bookingEDIExt.exRemark4), + + 箱号封号 = 箱号封号, + 件数包装 = 件数包装, + 货物重量 = 货物重量, + 货物尺码 = 货物尺码 }; var lengthDic = new Dictionary @@ -2589,8 +2867,37 @@ SELECT @ps_BillNo as N'billno'"; {"揽货人",10}, {"客服员",10}, + {"运费协议号",20}, + {"场站",20}, + {"船名",60}, + {"航次",20}, + {"装港代码",10}, + {"装货港",60}, + {"卸货代码",10}, + {"卸货港",100}, + {"交货代码",10}, + {"交货地点",100}, + {"目的地代码",10}, + {"目的地",30}, + {"合同号",20}, + {"委托单位",20}, + {"报关行",20}, + {"承运车队",20}, + {"货代公司",20}, + {"备案号",20}, + {"航线",30}, + {"代理",20}, + {"录入人",12}, + {"辅助字段一",600}, + {"辅助字段二",600}, + {"辅助字段三",600}, + {"辅助字段四",600}, }; + + + + foreach (var _item in lengthDic) { try @@ -2656,6 +2963,7 @@ SELECT @ps_BillNo as N'billno'"; curr.操作员 = item.操作员; curr.揽货人 = item.揽货人; curr.客服员 = item.客服员; + } } @@ -2911,6 +3219,457 @@ SELECT @ps_BillNo as N'billno'"; public string extData { get; set; }//"string", } + + public class 大简云业务函电 { + public t_op_seae_md opseae { get; set; } + public t_op_letter_md HeadLetter { get; set; } + + public OpLetterBase ChildLetter { get; set; } + + public 大简云业务函电() { } + + public bool IsDeleted { get; set; } = false; + + public static 大简云业务函电 getHelper(string lettername, OpLetterBase childletter) { + var ds6 = new DS6DataContext(); + var opseaeList = ds6.t_op_seae.Where(x => x.DJYID == childletter.DJYBOOKINGID).ToList(); + var result = new 大简云业务函电(); + if (opseaeList == null || opseaeList.Count == 0) { + return result; + } + result.opseae = opseaeList[0]; + result.HeadLetter = new t_op_letter_md(); + result.HeadLetter.编号 = result.opseae.编号; + result.HeadLetter.函电名称 = lettername; + + //该字段用于:保存新增的业务函电时,需先保存op_letter ,但该表是自增序列号表, + //如这种业务函电在一个订舱中多于一个(如派车),则无法定位到正确的新增op_letter + //故增加此字段,以记录该条业务函电的主键。 + + //如这种业务函电在一个订舱中只有一个(如订舱),则djyid和DJYBOOKINGID字符串相同; + + //如多于一个(如派车),则op_letter.djybookingid=op_letter_pc.djybookingid + //且这种业务函电 需要在调用getHelper方法获得【大简云业务函电】对象时,传DJYBOOKINGID字段值 + result.HeadLetter.DJYBOOKINGID = childletter.DJYBOOKINGID; + result.HeadLetter.DJYLETTERID = childletter.DJYLETTERID; + + result.ChildLetter = childletter; + return result; + } + + public void DoSave() { + if (string.IsNullOrWhiteSpace(HeadLetter.编号)) + { + return; + } + else { + //如果具体业务函电已存在 则更新之 + //判断依据为是否存在 + SaveLetter(); + } + } + + public void SaveLetter() { + var result = new OpLetterBase(); + var ds6 = new DS6DataContext(); + + void SaveHeadLetter() { + // + ds6.t_op_letter.Add(HeadLetter); + ds6.SaveChanges(); + + var letterheads = ds6.t_op_letter.Where(x => x.DJYLETTERID == HeadLetter.DJYLETTERID).ToList(); + + if (letterheads != null || letterheads.Count > 0) { + + HeadLetter = letterheads[0]; + } + //return new t_op_letter_md(); + + } + + + void UpdHeadLetter() + { + // + + var UpdHeadLetterList = ds6.t_op_letter.Where(x => x.DJYLETTERID == HeadLetter.DJYLETTERID).ToList(); + + if (UpdHeadLetterList != null || UpdHeadLetterList.Count > 0) + { + var UpdHead = UpdHeadLetterList[0]; + UpdHead.HEAD_TO = HeadLetter.HEAD_TO; + UpdHead.HEAD_ATTN = HeadLetter.HEAD_ATTN; + UpdHead.签发人 = HeadLetter.签发人; + UpdHead.签发日期 = HeadLetter.签发日期; + } + //return new t_op_letter_md(); + + } + + void DelHeadLetter(long DJYLETTERID) + { + var delheadList = ds6.t_op_letter.Where(x => x.DJYLETTERID == DJYLETTERID).ToList(); + if (delheadList != null && delheadList.Count > 0) { + var delhead= delheadList[0]; + ds6.t_op_letter.Remove(delhead); + } + } + + //没有找到业务 也就没有可以保存的op_letter 直接退出 + if (HeadLetter == null) return; + + //var currlist = new List(); + if (HeadLetter.函电名称 == "入货通知") { + var currlist = ds6.t_op_letter_rh.Where(x => x.DJYLETTERID == ((t_op_letter_rh_md)ChildLetter).DJYLETTERID).ToList(); + + //首先判断是否为删除 如果是 执行删除 + if (IsDeleted) + { + //找到具体letter 如有则定位到opletter + //两个都要删除 + if (currlist != null && currlist.Count > 0) + { + var delrec = currlist[0]; + ds6.t_op_letter_rh.Remove(delrec); + + DelHeadLetter(delrec.DJYLETTERID); + + ds6.SaveChanges(); + return; + } + } + + if (currlist != null && currlist.Count > 0) + { + UpdHeadLetter(); + //寻找 + var updrec = currlist[0]; + updrec.getCopy(ChildLetter,typeof(t_op_letter_rh_md)); + ds6.t_op_letter_rh.AddOrUpdate(updrec); + + } + else + { + SaveHeadLetter(); + if (HeadLetter.LE_ID == 0) return ; + ChildLetter.LE_ID = HeadLetter.LE_ID; + ds6.t_op_letter_rh.Add((t_op_letter_rh_md)ChildLetter); + } + } + if (HeadLetter.函电名称 == "派车") + { + var currlist = ds6.t_op_letter_pc.Where(x => x.DJYLETTERID == ((t_op_letter_pc_md)ChildLetter).DJYLETTERID).ToList(); + + if (IsDeleted) + { + //找到具体letter 如有则定位到opletter + //两个都要删除 + if (currlist != null && currlist.Count > 0) + { + var delrec = currlist[0]; + ds6.t_op_letter_pc.Remove(delrec); + + DelHeadLetter(delrec.DJYLETTERID); + + ds6.SaveChanges(); + return; + } + } + + if (currlist != null && currlist.Count > 0) + { + //寻找 + var updrec = currlist[0]; + updrec.getCopy(ChildLetter, typeof(t_op_letter_pc_md)); + ds6.t_op_letter_pc.AddOrUpdate(updrec); + + } + else + { + SaveHeadLetter(); + if (HeadLetter.LE_ID == 0) return; + ChildLetter.LE_ID = HeadLetter.LE_ID; + ds6.t_op_letter_pc.Add((t_op_letter_pc_md)ChildLetter); + } + } + + ds6.SaveChanges(); + } + } + + public class 大简云入货通知 + { + public long BookingId { get; set; } + /// + /// TO + /// + public string ToName { get; set; } + /// + /// ATTN + /// + public string Attn { get; set; } + /// + /// ATTN电话 + /// + public string AttnTel { get; set; } + /// + /// ATTN邮箱 + /// + public string AttnMail { get; set; } + /// + /// FROM + /// + public string FromName { get; set; } + /// + /// FROM电话 + /// + public string FromTel { get; set; } + /// + /// FROM邮箱 + /// + public string FromMail { get; set; } + /// + /// 描述 + /// + public string Description { get; set; } + /// + /// 截单时间 + /// + public DateTime? CloseDocTime { get; set; } + /// + /// 截港时间 + /// + public DateTime? ClosingTime { get; set; } + /// + /// 截VGM时间 + /// + public DateTime? VgmTime { get; set; } + /// + /// 备注 + /// + public string Remark { get; set; } + + /// + /// 场站代码 + /// + public string YARDID { get; set; } + /// + /// 场站 + /// + public string YARD { get; set; } + /// + /// 场站联系人 + /// + public string YARDCONTRACT { get; set; } + /// + /// 场站联系人电话 + /// + public string YARDCONTRACTTEL { get; set; } + + /// + /// 是否删除 ture删除 否则新增或修改 + /// + public bool IsDeleted { get; set; } = false; + + public 大简云业务函电 GetLetter() { + var letterchild = new t_op_letter_rh_md + { + LE_ID = 0, + 入货场站 = SetLength( YARD,30), + 入货截至时间 = ClosingTime == null ? "" : ((DateTime)ClosingTime).ToString("yyyy-MM-dd"), + 场站联系人 = SetLength(YARDCONTRACT,60), + 场站联系电话 = SetLength(YARDCONTRACTTEL,60), + 备注 = SetLength(Remark,200), + DJYLETTERID = BookingId, + DJYBOOKINGID= BookingId + }; + var result = 大简云业务函电.getHelper( "入货通知", letterchild); + result.HeadLetter.HEAD_TO = SetLength(ToName,60); + result.HeadLetter.HEAD_ATTN = SetLength(Attn,60); + result.HeadLetter.签发人 = SetLength(FromName,10); + result.HeadLetter.签发日期 = DateTime.Now; + + result.IsDeleted= IsDeleted; + //result.IsDeleted = true; + return result; + } + } + + public class 大简云派车 + { + public class 派车head + { + public long gid { get; set; } + public string messageType { get; set; } + public string senderId { get; set; } + public string senderName { get; set; } + public string receiverId { get; set; } + public string receiverName { get; set; } + public string token { get; set; } + public string version { get; set; } + public string requestDate { get; set; } + public string senderKey { get; set; } + public string requestAction { get; set; } + } + + public class 派车main + { + public string operType { get; set; } + + //tenantId + + /// + /// 派车单ID + /// + public long id { get; set; } + /// + /// 订舱ID + /// + public long bookingId { get; set; } + + public long truckId { get; set; } + public string truckCode { get; set; } + public string truckName { get; set; } + public string toName { get; set; } + public string attn { get; set; } + public string attnTel { get; set; } + public string attnMail { get; set; } + public string attnFax { get; set; } + public string fromName { get; set; } + public string fromTel { get; set; } + public string fromMail { get; set; } + public string fromFax { get; set; } + public decimal? kgs { get; set; } + public decimal? fee { get; set; } + public string payMethod { get; set; } + public string payMethodName { get; set; } + public DateTime? truckTime { get; set; } + public string yardid { get; set; } + public string yard { get; set; } + public string yardcontract { get; set; } + public string yardcontracttel { get; set; } + public string factoryId { get; set; } + public string factoryCode { get; set; } + public string factoryName { get; set; } + public string factoryContact { get; set; } + public string factoryTel { get; set; } + public string returnTime { get; set; } + public string inYardID { get; set; } + public string inYard { get; set; } + public string inYardContact { get; set; } + public string inYardContractTel { get; set; } + public DateTime? needArriveTime { get; set; } + public string closingTime { get; set; } + public string pickUpTime { get; set; } + public string isGuaJi { get; set; } + public string attention { get; set; } + public string remark { get; set; } + public string dispatcherId { get; set; } + public string dispatcherName { get; set; } + public string factoryAddr { get; set; } + public string callBackStatus { get; set; } + + public bool IsDeleted { get { + return operType == "Delete"; + } + } + public List contaList { get; set; }=new List(); + + public string 箱型箱量() { + var result = ""; + var 箱型箱量dic=new Dictionary(); + foreach (var conta in contaList) { + if (箱型箱量dic.ContainsKey(conta.ctnall)) + { + 箱型箱量dic[conta.ctnall] += conta.ctnnum == null ? 0 : (int)conta.ctnnum; + } + else { + 箱型箱量dic.Add(conta.ctnall, conta.ctnnum == null ? 0 : (int)conta.ctnnum); + } + } + + if (箱型箱量dic.Count > 0) { + foreach (var item in 箱型箱量dic) { + if (result == "") result += " "; + result += item.Key+"*"+item.Value.ToString(); + } + + } + + return result; + } + } + + public class conta + { + public string ctncode { get; set; } + public string ctnall { get; set; } + public int? ctnnum { get; set; } + public int? teu { get; set; } + public string cntrno { get; set; } + public string sealno { get; set; } + public decimal? pkgs { get; set; } + public string kindpkgs { get; set; } + public decimal? kgs { get; set; } + public decimal? cbm { get; set; } + public decimal? tareweight { get; set; } + public string ctnstatus { get; set; } + public string weightype { get; set; } + public string weighkgs { get; set; } + public string weighattn { get; set; } + public string vgmconncom { get; set; } + public string weightel { get; set; } + public string weighdate { get; set; } + public string vgmaddr { get; set; } + public string vgmemail { get; set; } + public string remark { get; set; } + public string carNumber { get; set; } + public string carDriver { get; set; } + public string carDriverTel { get; set; } + } + + public 派车head head { get; set; } + public 派车main main { get; set; } + + + public 大简云业务函电 GetLetter() + { + var letterchild = new t_op_letter_pc_md + { + 承运车队 = SetLength(main.truckName,30), + 箱型箱量 = SetLength(main.箱型箱量(),50), + 背箱场站 = SetLength(main.yard,30), + 场站联系人 = SetLength(main.yardcontract,60), + 场站电话 = SetLength(main.yardcontracttel,60), + 要求到厂时间 = main.needArriveTime == null ? "" : ((DateTime)main.needArriveTime).ToString("yyyy-MM-dd HH:mm:ss"), + 厂家地址 = SetLength(main.factoryAddr,100), + 厂家联系人 = SetLength(main.factoryContact,60), + 厂家联系电话 = SetLength(main.factoryTel,60), + 返箱地址 = SetLength(main.inYard,100), + 返箱联系人 = SetLength(main.inYardContact,60), + 返箱联系电话 = SetLength(main.inYardContractTel,60), + 备注 = SetLength(main.remark,200), + 陆运费 = main.fee, + 结算方式 = main.payMethodName, + DJYLETTERID = main.id, + DJYBOOKINGID = main.bookingId + }; + var result = 大简云业务函电.getHelper( "派车", letterchild); + if (result.HeadLetter == null) return result; + result.IsDeleted = main.IsDeleted; + if(!string.IsNullOrWhiteSpace(main.toName)) + result.HeadLetter.HEAD_TO = SetLength(main.toName,60); + if (!string.IsNullOrWhiteSpace(main.attn)) + result.HeadLetter.HEAD_ATTN = SetLength(main.attn,60); + if (!string.IsNullOrWhiteSpace(main.fromName)) + result.HeadLetter.签发人 = SetLength(main.fromName,10); + if (!string.IsNullOrWhiteSpace(main.fromName)) + result.HeadLetter.签发日期 = DateTime.Now; + return result; + } + } + #endregion static string NumberToEnglishString(int number) diff --git a/JobReqWebData/quartz_jobs_Backup.xml b/JobReqWebData/quartz_jobs_Backup.xml new file mode 100644 index 00000000..7b573140 --- /dev/null +++ b/JobReqWebData/quartz_jobs_Backup.xml @@ -0,0 +1,584 @@ + + + + true + + + + + + + JobSendRequest + SendRequest + 发送数据请求 + JobReqWebData.JobSendRequest,JobReqWebData + true + false + + + + ConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + QuerySql + + select MBLNO,C.YARDCODE as YARDNAME,'' as WEBUSERNAME,'' as WEBUSERPASS FROM OP_SEAE b + left join code_yarddata_set c on (c.YARD=b.YARD) WHERE MBLNO!='' AND ETD>=GETDATE()-30 AND ETD<=GETDATE()+10 AND ISNULL(C.YARDCODE,'')!='' + and not exists (SELECT 1 FROM op_status s where s.bsno=b.bsno and s.STATUS='重箱返场') + UNION + select MBLNO,'YGT' as YARDNAME,'15163472790' as WEBUSERNAME,'19861115qq' as WEBUSERPASS FROM OP_SEAE b + WHERE MBLNO!='' AND ETD>=GETDATE()-10 AND ETD<=GETDATE()+10 AND + exists (SELECT 1 FROM op_status s where s.bsno=b.bsno and s.STATUS='空箱出场' ) + and not EXISTS (SELECT 1 FROM op_status s where s.bsno=b.bsno and s.STATUS='装船出运') + + + + + ReqUrl + http://47.104.90.170:5000/save + + + + Customer + SDBT + + + + Password + abc123 + + + + RequestTimeout + 30 + + + + + + + + TriggerSendRequest + SendRequest + 发送数据请求触发器 + JobSendRequest + SendRequest + 0 0/10 * * * ? * + + + + + + JobGetData + GetData + 获取数据 + JobReqWebData.JobGetData,JobReqWebData + true + false + + + + ReqUrl + http://47.104.90.170:5000/extract + + + + ConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + Customer + SDBT + + + + Password + abc123 + + + + RequestTimeout + 60 + + + + + + + + TriggerGetData + GetData + 获取数据触发器 + JobGetData + GetData + 0 0/3 * * * ? * + + + + + + JobSendAccount + SendAccount + 获取数据 + JobReqWebData.JobSendAccount,JobReqWebData + true + false + + + + ReqUrl + http://47.104.90.170:5000/account/password + + + + Customer + SDBT + + + + Password + abc123 + + + + RequestTimeout + 30 + + + + AccountJson + + [{ + "WEBUSERNAME": "18560748070", + "WEBPASSWORD": "SDbt8888", + "YARDNAME": "YGT" + },{ + "WEBUSERNAME": "18678203935", + "WEBPASSWORD": "Qd123456", + "YARDNAME": "YGT" + },{ + "WEBUSERNAME": "13805337465", + "WEBPASSWORD": "QingDao123", + "YARDNAME": "YGT" + }] + + + + + + + + + TriggerSendAccount + SendAccount + 发送账号任务触发器 + JobSendAccount + SendAccount + 0 + 0 + + + + + + + JobXmcSend + JobXmcSend + 发送数据请求 + JobReqWebData.JobXmcSend,JobReqWebData + true + false + + + + ConnectString + Data Source=qdhaohong.dongshengsoft.net;Initial Catalog=ShippingWeb_QDHH;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + QuerySql + + select MBLNO,'XMC' as YARDNAME FROM OP_SEAE b left join code_yarddata_set c on (c.YARD=b.YARD) WHERE MBLNO<>'' AND ETD>=CONVERT(DATETIME,CONVERT(VARCHAR(10),dateadd(day,-90,GETDATE()),21)) AND ETD<CONVERT(DATETIME,CONVERT(VARCHAR(10),dateadd(day,-60,GETDATE()),21)) AND FORWARDER = '山东外运' + + + + + ReqUrl + + http://47.104.90.170:6000/xmc/savedata + + + + + custname + + QDHH + + + + custpsw + + QDHH123 + + + + + + RequestTimeout + 60 + + + + + + + + + + TriggerJobXmcSend + JobXmcSend + 发送数据请求触发器 + JobXmcSend + JobXmcSend + 0 45 17 1/1 * ? * + + + + + + + JobXmcGet + JobXmcGet + 箱满仓按提单号取费用_获取 + JobReqWebData.JobXmcGet,JobReqWebData + true + false + + + + + ConnectString + Data Source=qdhaohong.dongshengsoft.net;Initial Catalog=ShippingWeb_QDHH;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + + ReqUrl + + http://47.104.90.170:6000/xmc/extract + + + + + custname + + QDHH + + + + custpsw + + QDHH123 + + + + + + RequestTimeout + 60 + + + + + + + + + TriggerXmcGet + JobXmcGet + 箱满仓按提单号取费用_读取信息触发器 + JobXmcGet + JobXmcGet + 0 0/2 * * * ? * + + + + + + + JobSendATDRequest + SendATDRequest + 发送数据请求 + JobReqWebData.JobSendATDRequest,JobReqWebData + true + false + + + + ConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + QuerySql + + select distinct VESSEL ship_name,VOYNO as voyage_number,'' as web_name,'' as web_psw FROM OP_SEAE b + WHERE MBLNO!='' AND ETD>=GETDATE()-30 AND ETD<=GETDATE()+10 + + + + + ReqUrl + http://118.190.106.151:5500/ygt/cbjh/new/extract + + + + Customer + SDBT + + + + Password + abc123 + + + + RequestTimeout + 30 + + + + + + + + TriggerSendRequest + SendATDRequest + 发送数据请求触发器 + JobSendATDRequest + SendATDRequest + 0 0/10 * * * ? * + + + + + + JobGetATDData + GetATDData + 获取数据 + JobReqWebData.JobGetATDData,JobReqWebData + true + false + + + + ConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + + ReqUrl + http://118.190.106.151:5500/ygt/cbjh/new/save + + + + Customer + SDBT + + + + Password + abc123 + + + + RequestTimeout + 30 + + + + + + + + TriggerSendRequest + GetATDData + 发送数据请求触发器 + JobGetATDData + GetATDData + 0 0/10 * * * ? * + + + + + + + JobGetImpData + GetImpData + 发送数据请求 + JobReqWebData.JobGetImpData,JobReqWebData + true + false + + + + ConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + QuerySql + + select MBLNO FROM OP_SEAI b + WHERE MBLNO!='' AND ETD>=GETDATE()-10 AND ETD<=GETDATE()+10 + and not EXISTS (SELECT 1 FROM op_status s where s.bsno=b.bsno and s.STATUS='海关放行') + + + + + ReqUrl + http://47.104.90.170:5000/query + + + + Customer + SDBT + + + + Password + abc123 + + + + YGTUser + SDBT + + + + YGTPsw + abc123 + + + + Yardid + YGT_ZHCW + + + + RequestTimeout + 30 + + + + SleepTime + 70 + + + + + + + + TriggerSendRequest + SendRequest + 发送数据请求触发器 + JobSendRequest + SendRequest + 0 0/10 * * * ? * + + + + + + + JobDs7ToWeb + SendDs7DataRequest + 发送数据请求 + JobReqWebData.JobDs7ToWeb,JobReqWebData + true + false + + + + ConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + QuerySql + + select bl.AS_ID,bl.BSNO,b.CUSTNO,b.CONTRACTNO PONO,bl.MBLNO,bl.HBLNO,b.CUSTOMERNAME,bl.SHIPPER,bl.CONSIGNEE,bl.PORTLOAD,bl.DESTINATION + ,CASE WHEN len(b.DESTINATIONID)!=5 THEN '' ELSE (select top 1 c_country_name from t_sys_country_code where c_country_code=LEFT(b.DESTINATIONID,2)) END as COUNTRY + ,b.VESSEL,b.VOYNO,bl.CNTRTOTAL,b.BLTYPE,b.[SERVICE],b.ETD,b.ATD,b.CARRIER,bl.NOPKGS,bl.DESCRIPTION,bl.GROSSWEIGHT,bl.MEASUREMENT,b.HSCODE,b.FINANCIALSTAFFFAX INSURANCEOP + ,(SELECT TOP 1 COMPTIME FROM op_status WHERE [STATUS]='Approached' AND BSNO=B.BSNO) LINKCUSTTIME + ,(SELECT TOP 1 OpTime FROM op_SeaCover WHERE coverTitle='接单' AND BSNO=B.BSNO) CREATETIME + ,(SELECT TOP 1 OpTime FROM op_SeaCover WHERE coverTitle='出号' AND BSNO=B.BSNO) MBLNOTIME + ,bl.MODIFYTIME BSDATE + FROM op_seae_billmanage bl + LEFT JOIN op_seae b on (b.bsno=bl.BSNO) + WHERE + bl.MODIFYTIME>=DATEADD(HOUR,-12 ,getdate()) + + + + + WebConnectString + Data Source=47.105.157.231;Initial Catalog=Shippingweb;Persist Security Info=True;User ID=sa;Password=Ds20040201 + + + + + RequestTimeout + 30 + + + + + + + + TriggerSendRequest + SendDs7DataRequest + 发送数据请求触发器 + JobDs7ToWeb + SendDs7DataRequest + * 0/1 * * * ? + + + + + + + + + \ No newline at end of file