diff --git a/DSWeb.Common/DB/DS6Comm.cs b/DSWeb.Common/DB/DS6Comm.cs
index 692726f3..469bd787 100644
--- a/DSWeb.Common/DB/DS6Comm.cs
+++ b/DSWeb.Common/DB/DS6Comm.cs
@@ -310,6 +310,9 @@ namespace DSWeb.Common.DB
public string 成交方式 { get; set; }
public decimal? 净重 { get; set; }
public string 单价 { get; set; }
+ ///
+ /// 第一层包装皮重
+ ///
public string 总价 { get; set; }
public string 商品名称 { get; set; }
public string 数量单位 { get; set; }
@@ -621,6 +624,8 @@ namespace DSWeb.Common.DB
public string 运输方式 { get; set; }
public bool? 是否自有箱 { get; set; }
public string 运费协议号 { get; set; }
+
+ public long DJYCHILDRENID { get; set; }
}
[Table("t_op_state")]
@@ -680,6 +685,8 @@ namespace DSWeb.Common.DB
public DateTime? 装船时间 { get; set; }
public decimal? 皮重 { get; set; }
public int? 堆存天数 { get; set; }
+
+ public long? DJYCTNID { get; set; }
}
[Table("t_op_ams")]
@@ -815,6 +822,58 @@ namespace DSWeb.Common.DB
public string 货物描述 { get; set; }
}
-
+ [Table("t_ch_fee")]
+
+ public partial class t_ch_fee_md {
+ [Key]
+ [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
+ public string CH_ID { 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 decimal? 数量 { get; set; }
+ public decimal? 金额 { get; set; }
+ public string 币别 { get; set; }
+ public decimal? 汇率 { get; set; }
+ public string 备注 { get; set; }
+ public decimal? 结算金额 { get; set; }
+ public decimal? 开票金额 { get; set; }
+ public decimal? 申请金额 { get; set; }
+ public DateTime? 提交日期 { get; set; }
+ public string 审核人 { get; set; }
+ public DateTime? 审核日期 { get; set; }
+ public string 录入人 { get; set; }
+ public DateTime? 录入日期 { get; set; }
+ public string 对帐编号 { get; set; }
+ public bool? 是否对帐 { get; set; }
+ public int? 旧id { get; set; }
+ public string 旧状态 { get; set; }
+ public int? 顺序 { get; set; }
+ public decimal? 冲抵金额 { get; set; }
+ public bool? 机密 { get; set; }
+ public bool? 是否复核 { get; set; }
+ public bool? 系统费用 { get; set; }
+ public int? 运价编号 { get; set; }
+ public string 所属部门 { get; set; }
+ public DateTime? 应结日期 { get; set; }
+ public bool? 是否打印 { get; set; }
+ public bool? 不开发票 { get; set; }
+ public decimal? 税率 { get; set; }
+ public decimal? 税额 { get; set; }
+ public decimal? 不含税金额 { 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; }
+ public decimal? 拆分汇率 { get; set; }
+ }
}
\ No newline at end of file
diff --git a/DSWeb.Common/DB/DS6DataContext.cs b/DSWeb.Common/DB/DS6DataContext.cs
index 4a174f8a..477bad9c 100644
--- a/DSWeb.Common/DB/DS6DataContext.cs
+++ b/DSWeb.Common/DB/DS6DataContext.cs
@@ -33,7 +33,10 @@ 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; }
+
}
+
}
\ No newline at end of file
diff --git a/DSWeb.DJYMQ/App.config b/DSWeb.DJYMQ/App.config
index 90293735..d1e1c3e6 100644
--- a/DSWeb.DJYMQ/App.config
+++ b/DSWeb.DJYMQ/App.config
@@ -22,7 +22,7 @@
-->
-
+
+
diff --git a/DSWeb.DJYMQ/DS7Service.cs b/DSWeb.DJYMQ/DS7Service.cs
index 59baba4e..0460a766 100644
--- a/DSWeb.DJYMQ/DS7Service.cs
+++ b/DSWeb.DJYMQ/DS7Service.cs
@@ -7,6 +7,7 @@ using log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Quartz.Impl;
+using Quartz.Util;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;
using System;
@@ -23,6 +24,7 @@ using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Topshelf;
+using static DSWeb.Service.Output.DS7.DS7Service;
namespace DSWeb.Service.Output.DS7
{
@@ -39,6 +41,7 @@ namespace DSWeb.Service.Output.DS7
//private const string QueuePrefixBG = "djy.output.baoguan.bg.ds7.";
private const string QueuePrefix_DingCang = "djy.output.dingcang.ds6.";
+ private const string QueuePrefix_Del = "djy.output.dingcang.ds6_delete.";
///
/// 在大简云的公司ID
@@ -48,6 +51,8 @@ namespace DSWeb.Service.Output.DS7
//private static string DS7ConnStr = ConfigurationManager.ConnectionStrings["DongShengDB"].ConnectionString;
private static string DS6ConnStr = ConfigurationManager.ConnectionStrings["DS6DB"].ConnectionString;
private string RecMqUri = ConfigurationManager.AppSettings["ReceiveMQUri"];
+
+
//private string FeeInputUserId = ConfigurationManager.AppSettings["FeeInputUserId"];
private static string UserNameStr = ConfigurationManager.AppSettings["UserNameStr"];
@@ -88,6 +93,13 @@ namespace DSWeb.Service.Output.DS7
factory.Uri = new Uri(RecMqUri);
mqConn = factory.CreateConnection();
+ //测试数据
+ //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"":[]}]";
+ //byte[] byteArray = System.Text.Encoding.Default.GetBytes(testjson);
+ //var strBody = Encoding.UTF8.GetString(byteArray.ToArray());
+ //DingCangToDS6(JArray.Parse(strBody));
+
+
IModel modelDingCang = mqConn.CreateModel();
modelDingCang.ExchangeDeclare(ExchangeName, ExchangeType.Direct);
modelDingCang.QueueDeclare($"{QueuePrefix_DingCang}{CompanyId}", false, false, false, null);
@@ -120,6 +132,41 @@ namespace DSWeb.Service.Output.DS7
//第二个参数控制【是否消费掉队列里的数据】
modelDingCang.BasicConsume($"{QueuePrefix_DingCang}{CompanyId}", true, consumerDingCang);
+
+
+ IModel modelDel = mqConn.CreateModel();
+ modelDel.ExchangeDeclare(ExchangeName, ExchangeType.Direct);
+ modelDel.QueueDeclare($"{QueuePrefix_Del}{CompanyId}", false, false, false, null);
+
+ var consumerDel = new EventingBasicConsumer(modelDel);
+ consumerDel.Received += (ch, ea) =>
+ {
+ var body = ea.Body;
+ var strBody = Encoding.UTF8.GetString(body.ToArray());
+ logger.Debug($"收到大简云删除订舱:{strBody}");
+
+ try
+ {
+ //导出到东胜6
+ DelToDS6(strBody);
+ }
+ catch (Exception ex)
+ {
+ var excep = ex;
+ while (excep != null)
+ {
+ logger.Error(excep.Message);
+ logger.Error(excep.StackTrace);
+
+ excep = excep.InnerException;
+ }
+ }
+
+ };
+ //第二个参数控制【是否消费掉队列里的数据】
+ modelDel.BasicConsume($"{QueuePrefix_Del}{CompanyId}", true, consumerDingCang);
+
+
}
catch (Exception e) {
@@ -1233,7 +1280,7 @@ SELECT @ps_BillNo as N'billno'";
public void DingCangToDS6(JArray jarr)
{
-
+ var itemstr = "";
try
{
DS6DataContext DS6Data = new DS6DataContext();
@@ -1241,7 +1288,7 @@ SELECT @ps_BillNo as N'billno'";
{
var obj = item as JObject;
- var itemstr = item.ToString();
+ itemstr = item.ToString();
var head = JsonConvert.DeserializeObject(itemstr);
@@ -1258,14 +1305,14 @@ SELECT @ps_BillNo as N'billno'";
var headid = updrec.编号;
var newhead = head.GetOpseae();
- //过滤权限
- var cando = 人员是否具备权限(newhead.录入人, "776");
- if (!cando)
- {
- logger.Debug($"录入人无权限:{newhead.录入人}");
- continue;
+ //过滤权限 20230421 正式使用后不做人员限制
+ //var cando = 人员是否具备权限(newhead.录入人, "776");
+ //if (!cando)
+ //{
+ // logger.Debug($"录入人无权限:{newhead.录入人}");
+ // continue;
- }
+ //}
//newhead.ETD = updrec.ETD;
//newhead.开船日期= updrec.开船日期;
@@ -1274,7 +1321,8 @@ SELECT @ps_BillNo as N'billno'";
newhead.业务状态 = updrec.业务状态;
newhead.费用状态 = updrec.费用状态;
-
+
+ newhead.主提单标准 = string.IsNullOrWhiteSpace(head.mblno) ? updrec.编号 : head.mblno ;
newhead.报关标准 = updrec.报关标准;
newhead.报检标准 = updrec.报检标准;
newhead.分提单标准 = updrec.分提单标准;
@@ -1282,14 +1330,58 @@ SELECT @ps_BillNo as N'billno'";
newhead.委托标准 = updrec.委托标准;
newhead.业务编号 = updrec.业务编号;
-
+ Set头表箱封号件重尺(ref newhead, head);
DS6Data.t_op_seae.AddOrUpdate(newhead);
- var ctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList();
- DS6Data.t_op_ctn.RemoveRange(ctnlist);
+ var Currctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList();
+ var ctn_addlist = new List();
+ var ctn_updlist = new List();
+ var ctn_dellist = new List();
+
var newctnList = head.GetCtnList(newhead);
- DS6Data.t_op_ctn.AddRange(newctnList);
+
+ foreach (var ctn in newctnList)
+ {
+ if (Currctnlist.Exists(x => x.DJYCTNID == ctn.DJYCTNID))
+ {
+ var currctn = Currctnlist.First(x => x.DJYCTNID == ctn.DJYCTNID);
+ DingCangHead.GetCtn(ref currctn, ctn);
+
+ ctn_updlist.Add(currctn);
+ }
+ else {
+ ctn_addlist.Add(ctn);
+ }
+ }
+
+ foreach (var oldctn in Currctnlist)
+ {
+ if (newctnList.Exists(x => x.DJYCTNID == oldctn.DJYCTNID))
+ {
+
+ }
+ else
+ {
+ ctn_dellist.Add(oldctn);
+ }
+ }
+ if (ctn_addlist.Count > 0)
+ {
+ DS6Data.t_op_ctn.AddRange(ctn_addlist);
+ }
+ if (ctn_updlist.Count > 0)
+ {
+ foreach (var updctn in ctn_updlist)
+ {
+ DS6Data.t_op_ctn.AddOrUpdate(updctn);
+ }
+ }
+ if (ctn_dellist.Count > 0)
+ {
+ DS6Data.t_op_ctn.RemoveRange(ctn_dellist);
+ }
+
var amslist = DS6Data.t_op_ams.Where(x => x.编号 == headid).ToList();
DS6Data.t_op_ams.RemoveRange(amslist);
@@ -1303,38 +1395,48 @@ SELECT @ps_BillNo as N'billno'";
//DS6Data.t_op_seae_assistant.RemoveRange(amslist);
var newassistantList = head.GetAssistantList(newhead);
- foreach (var newassis in newassistantList) {
- var needinsert = true;
- if (old_assistantList != null && old_assistantList.Count > 0)
+
+ foreach (var assistant in newassistantList)
+ {
+ if (old_assistantList.Exists(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID))
{
- foreach (var oldassis in old_assistantList)
- {
- //if (newassis.BSNO == oldassis.BSNO)
- //{
- // var updassis = newassis;
- // updassis.AS_ID = oldassis.AS_ID;
- // assistantUpdList.Add(updassis);
- // needinsert = false;
- //}
- //else
- //{
- assistantAddList.Add(newassis);
- assistantDelList.Add(oldassis);
- //}
- }
+ var curr = old_assistantList.First(x => x.DJYCHILDRENID == assistant.DJYCHILDRENID);
+ DingCangHead.GetAssistant(ref curr, assistant);
+ assistantUpdList.Add(curr);
+ }
+ else
+ {
+ assistantAddList.Add(assistant);
+ }
+ }
+
+ foreach (var old in newassistantList)
+ {
+ if (newassistantList.Exists(x => x.DJYCHILDRENID == old.DJYCHILDRENID))
+ {
+
+ }
+ else
+ {
+ assistantDelList.Add(old);
}
- //if (needinsert) assistantAddList.Add(newassis);
}
- if (assistantDelList.Count > 0)
- DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList);
- //if (assistantUpdList.Count > 0) {
- // foreach(var upd in assistantUpdList)
- // DS6Data.t_op_seae_assistant.AddOrUpdate(upd);
- //}
-
if (assistantAddList.Count > 0)
+ {
DS6Data.t_op_seae_assistant.AddRange(assistantAddList);
- logger.Debug($"更新数据:{newhead}");
+ }
+ if (assistantUpdList.Count > 0)
+ {
+ foreach (var upd in assistantUpdList)
+ {
+ DS6Data.t_op_seae_assistant.AddOrUpdate(upd);
+ }
+ }
+ if (assistantDelList.Count > 0)
+ {
+ DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList);
+ }
+
DS6Data.SaveChanges();
@@ -1343,8 +1445,8 @@ SELECT @ps_BillNo as N'billno'";
//新增业务
var newhead = head.GetOpseae();
//过滤权限
- var cando = 人员是否具备权限(newhead.录入人, "776");
- if (!cando) continue;
+ //var cando = 人员是否具备权限(newhead.录入人, "776");
+ //if (!cando) continue;
@@ -1353,6 +1455,8 @@ SELECT @ps_BillNo as N'billno'";
var new编号 = (int.Parse(编号) + 1).ToString().PadLeft(10,' ');
newhead.编号 = new编号;
newhead.主编号 = new编号;
+
+ newhead.主提单标准 = string.IsNullOrWhiteSpace(head.mblno) ? new编号 : head.mblno ;
newhead.报关标准 = new编号;
newhead.报检标准 = new编号;
newhead.分提单标准 = new编号;
@@ -1363,7 +1467,9 @@ SELECT @ps_BillNo as N'billno'";
newhead.业务编号 = DS6GetBSNO(业务编号Code);
-
+
+ Set头表箱封号件重尺(ref newhead, head);
+
DS6Data.t_op_seae.Add(newhead);
DS6Data.SaveChanges();
newhead = DS6Data.t_op_seae.First(x => x.业务编号 == newhead.业务编号);
@@ -1371,7 +1477,8 @@ SELECT @ps_BillNo as N'billno'";
var headid = newhead.编号;
var ctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList();
- DS6Data.t_op_ctn.RemoveRange(ctnlist);
+ if(ctnlist!=null && ctnlist.Count>0)
+ DS6Data.t_op_ctn.RemoveRange(ctnlist);
var newctnList = head.GetCtnList(newhead);
DS6Data.t_op_ctn.AddRange(newctnList);
@@ -1381,7 +1488,7 @@ SELECT @ps_BillNo as N'billno'";
DS6Data.t_op_ams.AddRange(newamslist);
var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList();
- var assistantUpdList = new List();
+ //var assistantUpdList = new List();
var assistantAddList = new List();
var assistantDelList = new List();
@@ -1389,33 +1496,31 @@ SELECT @ps_BillNo as N'billno'";
var newassistantList = head.GetAssistantList(newhead);
foreach (var newassis in newassistantList)
{
- var needinsert = true;
+
if (old_assistantList != null && old_assistantList.Count > 0)
{
foreach (var oldassis in old_assistantList)
{
if (newassis.BSNO == oldassis.BSNO)
{
- var updassis = newassis;
- updassis.AS_ID = oldassis.AS_ID;
- assistantUpdList.Add(updassis);
- needinsert = false;
+
+ assistantDelList.Add(oldassis);
}
else
{
- assistantDelList.Add(oldassis);
+
}
}
}
- if (needinsert) assistantAddList.Add(newassis);
+ assistantAddList.Add(newassis);
}
if (assistantDelList.Count > 0)
DS6Data.t_op_seae_assistant.RemoveRange(assistantDelList);
- if (assistantUpdList.Count > 0)
- {
- foreach (var upd in assistantUpdList)
- DS6Data.t_op_seae_assistant.AddOrUpdate(upd);
- }
+ //if (assistantUpdList.Count > 0)
+ //{
+ // foreach (var upd in assistantUpdList)
+ // DS6Data.t_op_seae_assistant.Add(upd);
+ //}
if (assistantAddList.Count > 0)
DS6Data.t_op_seae_assistant.AddRange(assistantAddList);
@@ -1427,7 +1532,42 @@ SELECT @ps_BillNo as N'billno'";
}
catch (Exception e)
{
- logger.Error($"导入订舱信息出错:{e}");
+ logger.Error($"导入订舱信息出错:{e}////"+itemstr);
+ }
+ }
+
+ public void Set头表箱封号件重尺(ref t_op_seae_md newhead, DingCangHead head) {
+ var ctnList = head.GetCtnList(newhead);
+
+ newhead.箱号封号 = "";
+ newhead.件数包装 = "";
+ newhead.货物重量 = "";
+ newhead.货物尺码 = "";
+ foreach (var ctn in ctnList)
+ {
+ if (!string.IsNullOrWhiteSpace(ctn.箱号) || !string.IsNullOrWhiteSpace(ctn.封号))
+ {
+ if (newhead.箱号封号 != "") newhead.箱号封号 += "\r\n";
+ newhead.箱号封号 += (string.IsNullOrWhiteSpace(ctn.箱号) ? "" : ctn.箱号) + (string.IsNullOrWhiteSpace(ctn.封号) ? "" : "/"+ctn.封号);
+ }
+
+ if (ctn.件数!=null && ctn.件数 != 0 && !string.IsNullOrWhiteSpace(ctn.包装)) {
+ if (newhead.件数包装 != "") newhead.件数包装 += "\r\n";
+ newhead.件数包装 += ctn.件数.ToString() + ctn.包装;
+ }
+
+ if (ctn.重量 != null)// && ctn.重量 != 0
+ {
+ if (newhead.货物重量 != "") newhead.货物重量 += "\r\n";
+ newhead.货物重量 += ctn.重量.ToString() + "KGS";
+ }
+
+ if (ctn.尺码 != null)//&& ctn.尺码 != 0
+ {
+ if (newhead.货物尺码 != "") newhead.货物尺码 += "\r\n";
+ newhead.货物尺码 += ctn.尺码.ToString() + "CBM";
+ }
+
}
}
@@ -1454,16 +1594,82 @@ SELECT @ps_BillNo as N'billno'";
}
}
+ public bool CanDelete(t_op_seae_md opseae) {
+ var ds6 = new DS6DataContext();
+ var chfeeList = ds6.t_ch_fee.Where(x => x.编号 == opseae.编号).ToList();
+
+ if (chfeeList == null || chfeeList.Count == 0)
+ {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ public void DelToDS6(string Ids)
+ {
+
+ try
+ {
+ DS6DataContext DS6Data = new DS6DataContext();
+
+ var IdList = Ids.Split(',').ToList();
+
+ foreach (var id in IdList)
+ {
+ long idlong = Convert.ToInt64(id);
+
+ var currentBillList = DS6Data.t_op_seae.Where(x => x.DJYID == idlong).ToList();
+
+ if (currentBillList != null && currentBillList.Count > 0) {
+ var delrec = currentBillList[0];
+ var headid = delrec.编号;
+
+ if (!CanDelete(delrec)) {
+ return;
+ }
+
+ DS6Data.t_op_seae.Remove(delrec);
+
+ var ctnlist = DS6Data.t_op_ctn.Where(x => x.编号 == headid).ToList();
+ if (ctnlist.Count > 0)
+ DS6Data.t_op_ctn.RemoveRange(ctnlist);
+
+ var amslist = DS6Data.t_op_ams.Where(x => x.编号 == headid).ToList();
+ if (amslist.Count > 0)
+ DS6Data.t_op_ams.RemoveRange(amslist);
+
+ var old_assistantList = DS6Data.t_op_seae_assistant.Where(x => x.编号 == headid).ToList();
+ if (old_assistantList.Count > 0) {
+ DS6Data.t_op_seae_assistant.RemoveRange(old_assistantList);
+ }
+
+ DS6Data.SaveChanges();
+ }
+
+
+ }
+ }
+ catch (Exception e)
+ {
+ logger.Error($"删除订舱信息出错:{e}");
+ }
+ }
+
+
#endregion
#region 大简云订舱数据解析类
- public class DingCangHead {
+ public class DingCangHead
+ {
public long Id { get; set; }
public string bsno { get; set; } //"string",
public string bsstatus { get; set; } //"string",
public string bsstatusname { get; set; } //"string",
public DateTime? bsdate { get; set; } //"2023-03-30T03:12:51.033Z",
public string mblno { get; set; } //"string",
+ public string tmblno { get; set; } //"string",
public string hblno { get; set; } //"string",
public string bookingno { get; set; } //"string",
public string contractno { get; set; } //"string",
@@ -1620,28 +1826,37 @@ SELECT @ps_BillNo as N'billno'";
public string czRemark { get; set; } //"string",
public string createdUserName { get; set; } //"string",
+ public string ZhanCangFlag { get; set; } = ""; //"string",
+
+ public string SourceName { get; set; } = ""; //"string",
+
+ public string CtnDayNum { get; set; } = "";//箱使堆存
public List ctnInputs { get; set; }
public DingCangbookingEDIExt bookingEDIExt { get; set; }
public List childrens { get; set; }
public List goodsStatus { get; set; }
- class 箱型箱量item {
-
+ class 箱型箱量item
+ {
+
public t_code_ctn_md 箱型 { get; set; }
public int 箱量 { get; set; } = 0;
- public 箱型箱量item(t_code_ctn_md _箱型, int _箱量) {
+ public 箱型箱量item(t_code_ctn_md _箱型, int _箱量)
+ {
箱型 = _箱型;
箱量 = _箱量;
}
}
- class 箱型箱量 {
+ class 箱型箱量
+ {
public List<箱型箱量item> 箱型箱量信息 { get; set; }
public t_code_ctn_de_md 箱型对应 { get; set; }
- public 箱型箱量() {
+ public 箱型箱量()
+ {
var ds6 = new DS6DataContext();
箱型箱量信息 = new List<箱型箱量item>();
@@ -1649,20 +1864,24 @@ SELECT @ps_BillNo as N'billno'";
}
- public void Add(箱型箱量item newitem) {
+ public void Add(箱型箱量item newitem)
+ {
if (箱型箱量信息.Exists(x => x.箱型 == newitem.箱型))
{
箱型箱量信息.First(x => x.箱型 == newitem.箱型).箱量 += newitem.箱量;
}
- else {
+ else
+ {
箱型箱量信息.Add(newitem);
}
}
- public string get集装箱() {
+ public string get集装箱()
+ {
var result = "";
- foreach (var item in 箱型箱量信息) {
- if(result!="") result+= " ";
+ foreach (var item in 箱型箱量信息)
+ {
+ if (result != "") result += " ";
result += item.箱型.表现形式 + "*" + item.箱量.ToString();
}
return result;
@@ -1677,7 +1896,7 @@ SELECT @ps_BillNo as N'billno'";
- result += NumberToEnglishString(item.箱量).ToUpper()+ " (" +item.箱型.表现形式 + "*" + item.箱量.ToString()+")";
+ result += NumberToEnglishString(item.箱量).ToUpper() + " (" + item.箱型.表现形式 + "*" + item.箱量.ToString() + ")";
}
result += " CONTAINER ONLY. ";
@@ -1685,9 +1904,11 @@ SELECT @ps_BillNo as N'billno'";
}
#region 箱型对应
- public int get箱型1() {
+ public int get箱型1()
+ {
if (string.IsNullOrWhiteSpace(箱型对应.箱型1)) return 0;
- foreach (var item in 箱型箱量信息) {
+ foreach (var item in 箱型箱量信息)
+ {
if (item.箱型.代码 == 箱型对应.箱型1) return item.箱量;
}
return 0;
@@ -1777,9 +1998,11 @@ SELECT @ps_BillNo as N'billno'";
}
#endregion
- public int getTeu() {
+ public int getTeu()
+ {
var result = 0;
- foreach (var item in 箱型箱量信息) {
+ foreach (var item in 箱型箱量信息)
+ {
if (item.箱型.尺寸 == "20")
{
result += 1 * item.箱量;
@@ -1795,18 +2018,20 @@ SELECT @ps_BillNo as N'billno'";
//记录品名
- public t_op_seae_md GetOpseae() {
+ 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 = (int)(Math.Ceiling(days / 7.0));
//20230410 根据箱信息重新计算 集装箱 和 箱数大写
var d6 = new DS6DataContext();
var 箱型箱量 = new 箱型箱量();
- foreach (var ctn in ctnInputs) {
- var 箱型infoList = d6.t_code_ctn.Where(x => (x.尺寸 + x.箱型) == ctn.ctnall).ToList();
+ foreach (var ctn in 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)
{
@@ -1817,7 +2042,7 @@ SELECT @ps_BillNo as N'billno'";
continue;
}
- 箱型箱量.Add(new 箱型箱量item ( 箱型info, ctn.ctnnum==null?1:(int)ctn.ctnnum ));
+ 箱型箱量.Add(new 箱型箱量item(箱型info, ctn.ctnnum == null ? 1 : (int)ctn.ctnnum));
}
var 集装箱 = 箱型箱量.get集装箱();
@@ -1843,17 +2068,19 @@ SELECT @ps_BillNo as N'billno'";
d6.t_code_goods.Add(newrec);
d6.SaveChanges();
}
- else {
+ else
+ {
货物名称 = 当前货名[0].货物名称;
}
var _etd = new DateTime();
var _eta = new DateTime();
- if (etd != null) _etd = new DateTime(((DateTime)etd).Year,((DateTime)etd).Month,((DateTime)etd).Day);
+ if (etd != null) _etd = new DateTime(((DateTime)etd).Year, ((DateTime)etd).Month, ((DateTime)etd).Day);
if (eta != null) _eta = new DateTime(((DateTime)etd).Year, ((DateTime)etd).Month, ((DateTime)etd).Day);
- var result = new t_op_seae_md {
+ var result = new t_op_seae_md
+ {
业务编号 = bsno,
业务状态 = "接受委托",
费用状态 = "录入状态",
@@ -1862,7 +2089,8 @@ SELECT @ps_BillNo as N'billno'";
周次 = weeks,
录入日期 = bsdate,
主提单号 = mblno,
- 主提单标准 = mblno,
+ 真提单号 = tmblno,
+ //主提单标准 = string.IsNullOrWhiteSpace( mblno)?,
分提单号 = hblno,
订舱序列号 = custno,
运费协议号 = contractno,
@@ -1873,8 +2101,8 @@ SELECT @ps_BillNo as N'billno'";
船名 = vessel,
航次 = voynoinner,
开船日期 = SetDayZero(etd),
- ETD= SetDayZero(etd),
- ETA= SetDayZero(eta),
+ ETD = SetDayZero(etd),
+ ETA = SetDayZero(eta),
截港日期 = SetDayZero(closingdate),
装港代码 = portloadid,
@@ -1915,7 +2143,7 @@ SELECT @ps_BillNo as N'billno'";
最低温度 = tempmin,
最高温度 = tempmax,
是否自有箱 = iscontainersoc,
- EDI备注 = soremark,
+ EDI备注 = 设置换行(soremark),
//全称= compname,
合同号 = pono,
合同号备注 = pono,
@@ -1928,22 +2156,29 @@ SELECT @ps_BillNo as N'billno'";
委托单位 = customername,
报关行 = customser,
承运车队 = trucker,
- 货代公司 = agentname,
+ 货代公司 = forwarder,//大简云“订舱代理”,ds6界面的“订舱代理”,ds6数据库的货代
备案号 = lanename,
航线 = lineName,
船代 = shipagency,
- 代理 = forwarder,
+ 代理 = agentname,//大简云“国外代理”,ds6界面的“代理”,ds6数据库的代理
其他备注 = 设置换行(dzRemark),
+ 是否占舱 = ZhanCangFlag == "是" ? "Y" : "N",
占舱备注 = 设置换行(czRemark),
-
+
录入人 = createdUserName,
订舱人说明 = (bookingEDIExt == null) ? "" : 设置换行(bookingEDIExt.orderRemark),
DJYID = Id,
- 通知到港 = false,
- 是否提货 = false,
- 是否提交VGM = false,
- 是否提交舱单 = false,
- 是否装载放行 = false,
+ 通知到港 = null,
+ 是否提货 = null,
+ 是否提交VGM = null,
+ 是否提交舱单 = null,
+ 是否装载放行 = null,
+
+ 业务来源 = SourceName,
+
+ 箱使堆存 = 设置换行(CtnDayNum),
+
+ 总价 = (bookingEDIExt == null) ? "" : bookingEDIExt.kingTareweight == null ? "" : bookingEDIExt.kingTareweight.ToString().Replace(".0", ""),
箱TEU = 箱型箱量.getTeu(),
箱型1 = 箱型箱量.get箱型1(),
@@ -1963,10 +2198,11 @@ SELECT @ps_BillNo as N'billno'";
辅助字段四 = 设置换行(bookingEDIExt.exRemark4),
};
- foreach (var status in goodsStatus) {
- if (status.statusName == "通知到港")
+ foreach (var status in goodsStatus)
+ {
+ if (status.statusName == "通知到港")
{
- if(status.finishTime!=null)
+ if (status.finishTime != null)
result.通知到港 = true;
}
if (status.statusName == "是否提货")
@@ -2111,71 +2347,108 @@ SELECT @ps_BillNo as N'billno'";
{"包装代码",10},
{"发货人编号",10},
{"运输方式",10},
-
{"HS编码",30},
{"船代",20},
{"单证员",10},
+ {"箱使堆存",30},
+
};
- foreach (var item in lengthDic) {
+ foreach (var item in lengthDic)
+ {
try
{
- var value = result.GetType().GetProperty(item.Key).GetValue(result).ToString();
- var newvalue = SetLength(value, item.Value);
- result.GetType().GetProperty(item.Key).SetValue(result, newvalue);
+ var property = result.GetType().GetProperty(item.Key);
+ if (property != null)
+ {
+ var _v = result.GetType().GetProperty(item.Key).GetValue(result);
+ if (_v != null)
+ {
+ var newvalue = SetLength(_v.ToString(), item.Value);
+ result.GetType().GetProperty(item.Key).SetValue(result, newvalue);
+ }
+ }
+ //var value = result.GetType().GetProperty(item.Key).GetValue(result).ToString();
+ //var newvalue = SetLength(value, item.Value);
+ //result.GetType().GetProperty(item.Key).SetValue(result, newvalue);
}
- catch (Exception e) {
+ catch (Exception e)
+ {
continue;
}
}
-
+
#endregion
return result;
}
- public List GetCtnList(t_op_seae_md head) {
- var result = new List ();
+ public List GetCtnList(t_op_seae_md head)
+ {
+ var result = new List();
- foreach (var ctn in ctnInputs) {
+ foreach (var ctn in ctnInputs)
+ {
var d6 = new DS6DataContext();
- var 箱型infoList = d6.t_code_ctn.Where(x => (x.尺寸 + x.箱型) == ctn.ctnall).ToList();
+ 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) {
+ if (箱型infoList != null && 箱型infoList.Count > 0)
+ {
箱型info = 箱型infoList[0];
}
- else {
+ else
+ {
continue;
}
var newctn = new t_op_ctn_md
{
- 代码 = SetLength(箱型info.代码, 4),
- 尺寸 = SetLength(箱型info.尺寸, 2),
- 箱型 = SetLength(箱型info.箱型, 10),
- 编号 = SetLength(head.编号, 12),
- 表现形式 = SetLength(ctn.ctnall, 20),
+ 代码 = 箱型info.代码,
+ 尺寸 = 箱型info.尺寸,
+ 箱型 = 箱型info.箱型,
+ 编号 = head.编号,
+ 表现形式 = ctn.ctnall,
数量 = ctn.ctnnum,
- 箱号 = SetLength(ctn.cntrno, 30),
- 封号 = SetLength(ctn.sealno, 30),
+ 箱号 = ctn.cntrno,
+ 封号 = ctn.sealno,
件数 = ctn.pkgs,
- 包装 = SetLength(ctn.kindpkgs, 60),
+ 包装 = ctn.kindpkgs,
重量 = ctn.kgs,
尺码 = ctn.cbm,
皮重 = ctn.tareweight,
- TEU = (箱型info.尺寸 == "20" ? 1* ctn.ctnnum : 2* ctn.ctnnum),
- 称重重量 =ctn.weighkgs
+ TEU = (箱型info.尺寸 == "20" ? 1 * ctn.ctnnum : 2 * ctn.ctnnum),
+ 称重重量 = ctn.weighkgs,
+ DJYCTNID = ctn.id
};
- result.Add (newctn);
+ result.Add(newctn);
}
return result;
}
+ public static void GetCtn(ref t_op_ctn_md curr, t_op_ctn_md ctn)
+ {
+ curr.代码 = ctn.代码;
+ curr.尺寸 = ctn.尺寸;
+ curr.箱型 = ctn.箱型;
+ //curr.编号 = head.编号,
+ curr.表现形式 = ctn.表现形式;
+ curr.数量 = ctn.数量;
+ curr.箱号 = ctn.箱号;
+ curr.封号 = ctn.封号;
+ curr.件数 = ctn.件数;
+ curr.包装 = ctn.包装;
+ curr.重量 = ctn.重量;
+ curr.尺码 = ctn.尺码;
+ curr.皮重 = ctn.皮重;
+ curr.TEU = ctn.TEU;
+ curr.称重重量 = ctn.称重重量;
+ curr.DJYCTNID = ctn.DJYCTNID;
+ }
public List GetAmsList(t_op_seae_md head)
{
var result = new List();
@@ -2187,18 +2460,18 @@ SELECT @ps_BillNo as N'billno'";
var newrec = new t_op_ams_md
{
编号 = head.编号,
- 发货人代码 = SetLength(item.shipperEdiCode,10),
- 收货人代码 = SetLength(item.consigneeEdiCode,10),
- 销售代码 = SetLength(item.salerCode,10),
- 危险品联系人 = SetLength(item.ediAttn,30),
- 危险品联系方式 = SetLength(item.ediAttnTel,50),
- 欧盟HSCODE = SetLength(item.ckhi,100),
- 南美东NCM = 设置换行(SetLength(item.cncm,600)),
- 巴西木质包装说明 = 设置换行(SetLength(item.wncm,300)),
+ 发货人代码 = SetLength(item.shipperEdiCode, 10),
+ 收货人代码 = SetLength(item.consigneeEdiCode, 10),
+ 销售代码 = SetLength(item.salerCode, 10),
+ 危险品联系人 = SetLength(item.ediAttn, 30),
+ 危险品联系方式 = SetLength(item.ediAttnTel, 50),
+ 欧盟HSCODE = SetLength(item.ckhi, 100),
+ 南美东NCM = 设置换行(SetLength(item.cncm, 600)),
+ 巴西木质包装说明 = 设置换行(SetLength(item.wncm, 300)),
实际开船日期 = head.ETD,
HBL发送方式 = SetLength(item.masterBolIndicator, 1)
- };
- result.Add (newrec);
+ };
+ result.Add(newrec);
//}
return result;
@@ -2236,7 +2509,8 @@ SELECT @ps_BillNo as N'billno'";
{
编号 = head.编号,
主编号 = head.编号,
- BSNO= item.bsno,
+ DJYCHILDRENID = item.Id,
+ BSNO = item.bsno,
录入日期 = item.bsdate,
主提单号 = item.mblno,
分提单号 = item.hblno,
@@ -2244,37 +2518,38 @@ SELECT @ps_BillNo as N'billno'";
发货人代码 = 设置换行(item.shipper),
收货人代码 = 设置换行(item.consignee),
通知人代码 = 设置换行(item.notifyparty),
- 提单份数= item.nobill,
- 签单方式=item.issuetype,
+ 提单份数 = item.nobill,
+ 签单方式 = item.issuetype,
签单日期 = item.issuedate,
- 签单地点=item.issueplace,
- 付费方式=item.blfrt,
- 预付地点=item.prepardat,
- 到付地点=item.payableat,
- 运输条款=item.service,
- 唛头=item.marks,
- 运输方式=item.hscode,
- 货物名称= 货物名称,
+ 签单地点 = item.issueplace,
+ 付费方式 = item.blfrt,
+ 预付地点 = item.prepardat,
+ 到付地点 = item.payableat,
+ 运输条款 = item.service,
+ 唛头 = item.marks,
+ 运输方式 = item.hscode,
+ 货物名称 = 货物名称,
货物描述 = 设置换行(item.description),
- 件数=item.pkgs,
- 包装=item.kindpkgs,
- 重量=item.kgs,
- 尺码= item.cbm,
- 件数大写=item.totalno,
- 集装箱= item.cntrtotal,
+ 件数 = item.pkgs,
+ 包装 = item.kindpkgs,
+ 重量 = item.kgs,
+ 尺码 = item.cbm,
+ 件数大写 = item.totalno,
+ 集装箱 = item.cntrtotal,
船公司 = item.carrier,
货物标识 = item.cargoid,
- 危险品分类=item.dclass,
- 危险品编号= item.dunno,
- 设置温度=item.tempset,
- 冷藏通风量=item.reeferf,
- 最低温度=item.tempmin,
- 最高温度=item.tempmax,
- 是否自有箱=item.iscontainersoc,
- 委托编号=item.pono,
- 操作员=item.op,
+ 危险品分类 = item.dclass,
+ 危险品编号 = item.dunno,
+ 设置温度 = item.tempset,
+ 冷藏通风量 = item.reeferf,
+ 最低温度 = item.tempmin,
+ 最高温度 = item.tempmax,
+ 是否自有箱 = item.iscontainersoc,
+ 委托编号 = item.pono,
+ 操作员 = item.op,
揽货人 = item.sale,
- 客服员=item.custservice,
+ 客服员 = item.custservice,
+ //总价 = (item.bookingEDIExt == null) ? 0M : item.bookingEDIExt.kingTareweight == null ? 0M : item.bookingEDIExt.kingTareweight,
//预付地点= item.prepardatid,
//到付地点= item.payableatid,
};
@@ -2285,7 +2560,7 @@ SELECT @ps_BillNo as N'billno'";
{"分提单号",20},
{"发货人代码",1000},
{"收货人代码",1000},
- {"通知人代码",1000},
+ {"通知人代码",1000},
{"提单份数",10},
{"签单方式",10},
{"签单地点",30},
@@ -2297,7 +2572,7 @@ SELECT @ps_BillNo as N'billno'";
{"运输方式",10},
{"HS编码",30},
{"货物描述",1000},
- {"货物描述",1000},
+ //{"货物描述",1000},
{"包装",60},
{"件数大写",100},
{"集装箱",200},
@@ -2336,7 +2611,54 @@ SELECT @ps_BillNo as N'billno'";
return result;
}
+ public static void GetAssistant(ref t_op_seae_assistant_md curr, t_op_seae_assistant_md item)
+ {
+
+ //curr.编号 = head.编号;
+ //curr.主编号 = item.编号;
+ curr.DJYCHILDRENID = item.DJYCHILDRENID;
+ curr.BSNO = item.BSNO;
+ curr.录入日期 = item.录入日期;
+ curr.主提单号 = item.主提单号;
+ curr.分提单号 = item.分提单号;
+ //订舱序列号 = item.bookingno;
+ curr.发货人代码 = item.发货人代码;
+ curr.收货人代码 = item.收货人代码;
+ curr.通知人代码 = item.通知人代码;
+ curr.提单份数 = item.提单份数;
+ curr.签单方式 = item.签单方式;
+ curr.签单日期 = item.签单日期;
+ curr.签单地点 = item.签单地点;
+ curr.付费方式 = item.付费方式;
+ curr.预付地点 = item.预付地点;
+ curr.到付地点 = item.到付地点;
+ curr.运输条款 = item.运输条款;
+ curr.唛头 = item.唛头;
+ curr.运输方式 = item.运输方式;
+ curr.货物名称 = item.货物名称;
+ curr.货物描述 = item.货物描述;
+ curr.件数 = item.件数;
+ curr.包装 = item.包装;
+ curr.重量 = item.重量;
+ curr.尺码 = item.尺码;
+ curr.件数大写 = item.件数大写;
+ curr.集装箱 = item.集装箱;
+ curr.船公司 = item.船公司;
+ curr.货物标识 = item.货物标识;
+ curr.危险品分类 = item.危险品分类;
+ curr.危险品编号 = item.危险品编号;
+ curr.设置温度 = item.设置温度;
+ curr.冷藏通风量 = item.冷藏通风量;
+ curr.最低温度 = item.最低温度;
+ curr.最高温度 = item.最高温度;
+ curr.是否自有箱 = item.是否自有箱;
+ curr.委托编号 = item.委托编号;
+ curr.操作员 = item.操作员;
+ curr.揽货人 = item.揽货人;
+ curr.客服员 = item.客服员;
+ }
}
+
public class DingCangCtn {
public long? id { get; set; }
public long? billid { get; set; }
@@ -2411,10 +2733,15 @@ SELECT @ps_BillNo as N'billno'";
public decimal? kingTareweight { get; set; } = 0M;
}
+
+
///
/// 提单信息
///
public class DingCangTDXX {
+
+ public long Id { get; set; }
+
public string bsno { get; set; } //"string",
public string bsstatus { get; set; } //"string",
public string bsstatusname { get; set; } //"string",
@@ -2725,7 +3052,7 @@ SELECT @ps_BillNo as N'billno'";
public static string SetLength(string oldstr, int length)
{
- var str = string.IsNullOrWhiteSpace(oldstr) ? "" : (oldstr.Length > length) ? SubString2( oldstr,0, length) : oldstr;
+ var str = string.IsNullOrWhiteSpace(oldstr) ? "" : (len(oldstr) > length) ? SubString2( oldstr,0, length) : oldstr;
return str;
}
diff --git a/DSWeb/Areas/CommMng/DAL/PDFHelper.cs b/DSWeb/Areas/CommMng/DAL/PDFHelper.cs
index 93e43778..681a766c 100644
--- a/DSWeb/Areas/CommMng/DAL/PDFHelper.cs
+++ b/DSWeb/Areas/CommMng/DAL/PDFHelper.cs
@@ -14,6 +14,7 @@ using DSWeb.MvcShipping.DAL.MsOpSeaeDAL;
using NPOI.OpenXmlFormats;
using DSWeb.MvcShipping.Models.MsOpSeae;
using NPOI.SS.Formula.Functions;
+using System.Drawing;
namespace DSWeb.Areas.CommMng.DAL
{
@@ -31,7 +32,7 @@ namespace DSWeb.Areas.CommMng.DAL
public DBResult MakePdf_BillCheckOut(BillCheckOut_md head,string path)
{
var result = new DBResult();
-
+ var errorindex = 0.0;
try
{
@@ -110,12 +111,12 @@ namespace DSWeb.Areas.CommMng.DAL
//内容文字字体 黑色11
iTextSharp.text.Font infos = new iTextSharp.text.Font(bfComic, 11, 0, iTextSharp.text.BaseColor.BLACK);
//抬头地址字体 黑色11 下划线
- iTextSharp.text.Font address = new iTextSharp.text.Font(bfComic, 14, Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK);
+ iTextSharp.text.Font address = new iTextSharp.text.Font(bfComic, 14, iTextSharp.text.Font.UNDERLINE, iTextSharp.text.BaseColor.BLACK);
//红色内容 红色11
iTextSharp.text.Font redinfos = new iTextSharp.text.Font(bfComic, 12, 0, iTextSharp.text.BaseColor.RED);
-
+
#region 条码号
BarCodeDrawing _Code39 = new BarCodeDrawing();
@@ -126,15 +127,27 @@ namespace DSWeb.Areas.CommMng.DAL
var 条码号 = head.CHECKOUTNO;
System.Drawing.Image _codeImage = _Code39.GetCodeImage(条码号, BarCodeDrawing.BarCodeDrawingModel.BarCodeDrawingNormal, true);
+ errorindex = 1;
System.IO.MemoryStream _Stream = new System.IO.MemoryStream();
+
+ errorindex = 1.1;
+ ImageConverter imgconv = new ImageConverter();
_codeImage.Save(_Stream, System.Drawing.Imaging.ImageFormat.Jpeg);
- string markPath = System.Environment.CurrentDirectory + $"\\temp{条码号}.jpg";
- _codeImage.Save(markPath);
-
- iTextSharp.text.Image im = iTextSharp.text.Image.GetInstance(markPath);
+ byte[] bytes = (byte[])imgconv.ConvertTo(_codeImage, typeof(byte[]));
+ Stream stream = new MemoryStream(bytes);
+ errorindex = 1.2;
+ //string markPath = System.Environment.CurrentDirectory + $"\\temp{条码号}.jpg";
+
+ //_codeImage.Save(markPath);
+
+ //_codeImage.Dispose();
+
+ iTextSharp.text.Image im = iTextSharp.text.Image.GetInstance(stream);
+ errorindex = 1.3;
im.SetAbsolutePosition(width - 280, height - 60 - 80);
+ errorindex = 1.4;
im.ScaleAbsolute(260, 40);
-
+ errorindex = 1.5;
//document.Add(im);
#endregion
@@ -168,7 +181,7 @@ namespace DSWeb.Areas.CommMng.DAL
地址.Leading = 22;
document.Add(地址);
-
+ errorindex = 2;
#endregion
@@ -221,6 +234,8 @@ namespace DSWeb.Areas.CommMng.DAL
billlist.Add(rec);
}
+ errorindex = 3;
+
foreach (var item in body)
{
var MBLNO = new iTextSharp.text.Paragraph(item.MBLNO, infos);
@@ -263,6 +278,8 @@ namespace DSWeb.Areas.CommMng.DAL
//document.Add(newinfo);
}
+ errorindex = 4;
+
document.Add(table);
//感谢
@@ -287,7 +304,7 @@ namespace DSWeb.Areas.CommMng.DAL
document.Close();
- File.Delete(markPath);
+ //File.Delete(markPath);
head.MAILPDFURL = SaveUrlName;
@@ -295,10 +312,19 @@ namespace DSWeb.Areas.CommMng.DAL
cdc.SaveChanges();
+ errorindex = 5;
+
result.OK(filename);
}
+
catch (Exception ex) {
- result.SetErrorInfo(ex.Message);
+ var innermsg = "";
+ if (ex.InnerException != null) {
+ if (ex.InnerException.Message != null) {
+ innermsg = ex.InnerException.Message;
+ }
+ }
+ result.SetErrorInfo($"PDFHelper{errorindex}:"+ex.Message+$"[{innermsg}]");
}
return result;