|
|
|
@ -117,6 +117,17 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
DingCangToDS6(JArray.Parse(strBody));
|
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
/* 测试时前面增加两个注释号
|
|
|
|
|
///433483922997318
|
|
|
|
|
var testjson = @"{""TenantId"":349708986646597,""BookingId"":433483922997318,""ToName"":"""",""Attn"":"""",""AttnTel"":"""",""AttnMail"":"""",""AttnPhone"":"""",""FromName"":""张艺凡"",""FromTel"":""0532-81609998"",""FromMail"":""op12@hightrans.net"",""FromPhone"":""15165298210"",""Description"":""FRESH YELLOW ONION\nHS CODE:070310\nTEMP:+1'C\nVENT:25CBM/H\nHUMI:65%"",""CloseDocTime"":null,""ClosingTime"":null,""VgmTime"":null,""Remark"":""开港时间(2023-07-19 19:00:00\n截港时间(2023-07-22 07:00:00\n样单截至时间(SI Cutoff):2023-07-21 03:00:00"",""YARDID"":""JIEFENG"",""YARD"":""捷丰场站"",""YARDCONTRACT"":"""",""YARDCONTRACTTEL"":"""",""CreatedTime"":""2023-07-03T18:06:02.463463+08:00"",""UpdatedTime"":null,""CreatedUserId"":356029261668421,""CreatedUserName"":""张艺凡"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":435050743574597}";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
byte[] byteArray = System.Text.Encoding.Default.GetBytes(testjson);
|
|
|
|
|
var strBody = Encoding.UTF8.GetString(byteArray.ToArray());
|
|
|
|
|
|
|
|
|
|
DS6OpLetter_RH(strBody);
|
|
|
|
|
//*/
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
//测试删除
|
|
|
|
@ -212,8 +223,6 @@ namespace DSWeb.Service.Output.DS7
|
|
|
|
|
|
|
|
|
|
#region 业务函电 入货通知
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionFactory factory3 = new ConnectionFactory();
|
|
|
|
|
factory3.Uri = new Uri(RecMqUri);
|
|
|
|
|
mqConn3 = factory3.CreateConnection();
|
|
|
|
@ -2047,6 +2056,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
public string custserviceid { get; set; } //"string",
|
|
|
|
|
public string custservice { get; set; } //"string",
|
|
|
|
|
public string customername { get; set; } //"string",
|
|
|
|
|
public string thirdPay { get; set; } //"第三方 第三方付费",
|
|
|
|
|
public string forwarder { get; set; } //"string",
|
|
|
|
|
public string shipagency { get; set; } //"string",
|
|
|
|
|
public string customser { get; set; } //"string",
|
|
|
|
@ -2358,23 +2368,27 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
var 货物名称 = "";
|
|
|
|
|
|
|
|
|
|
var 当前货名 = d6.t_code_goods.Where(x => x.代码 == goodscode).ToList();
|
|
|
|
|
if (当前货名 == null || 当前货名.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
var newrec = new t_code_goods_md();
|
|
|
|
|
|
|
|
|
|
newrec.代码 = SetLength(goodscode, 10);
|
|
|
|
|
newrec.货物名称 = SetLength(goodsname, 100);
|
|
|
|
|
货物名称 = newrec.货物名称;
|
|
|
|
|
newrec.货物描述 = SetLength(description, 600);
|
|
|
|
|
newrec.商品编码 = SetLength(hscode, 10);
|
|
|
|
|
d6.t_code_goods.Add(newrec);
|
|
|
|
|
d6.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
货物名称 = 当前货名[0].货物名称;
|
|
|
|
|
}
|
|
|
|
|
//var 当前货名 = d6.t_code_goods.Where(x => x.代码 == goodscode).ToList();
|
|
|
|
|
//if (当前货名 == null || 当前货名.Count == 0)
|
|
|
|
|
//{
|
|
|
|
|
// if(!string.IsNullOrWhiteSpace(goodscode)) {
|
|
|
|
|
// var newrec = new t_code_goods_md();
|
|
|
|
|
|
|
|
|
|
// newrec.代码 = SetLength(goodscode, 10);
|
|
|
|
|
// newrec.货物名称 = SetLength(goodsname, 100);
|
|
|
|
|
// 货物名称 = newrec.货物名称;
|
|
|
|
|
// newrec.货物描述 = SetLength(description, 600);
|
|
|
|
|
// newrec.商品编码 = SetLength(hscode, 10);
|
|
|
|
|
// d6.t_code_goods.Add(newrec);
|
|
|
|
|
// d6.SaveChanges();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// 货物名称 = 当前货名[0].货物名称;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
货物名称 = dealGoodsinfo(goodscode, goodsname,description,hscode);
|
|
|
|
|
|
|
|
|
|
var _etd = new DateTime();
|
|
|
|
|
var _eta = new DateTime();
|
|
|
|
@ -2476,6 +2490,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
揽货人 = sale,
|
|
|
|
|
航线操作 = route,
|
|
|
|
|
委托单位 = customername,
|
|
|
|
|
第三方付费 = thirdPay,
|
|
|
|
|
报关行 = customser,
|
|
|
|
|
承运车队 = trucker,
|
|
|
|
|
货代公司 = forwarder,//大简云“订舱代理”,ds6界面的“订舱代理”,ds6数据库的货代
|
|
|
|
@ -2763,7 +2778,31 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string dealGoodsinfo(string goodscode, string goodsname,string description,string hscode) {
|
|
|
|
|
var result = "";
|
|
|
|
|
var d6 = new DS6DataContext();
|
|
|
|
|
var 当前货名 = d6.t_code_goods.Where(x => x.货物名称 == goodsname).ToList();
|
|
|
|
|
if (当前货名 == null || 当前货名.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(goodsname))
|
|
|
|
|
{
|
|
|
|
|
var newrec = new t_code_goods_md();
|
|
|
|
|
|
|
|
|
|
newrec.代码 = SetLength(goodscode, 10);
|
|
|
|
|
newrec.货物名称 = SetLength(goodsname, 100);
|
|
|
|
|
result = newrec.货物名称;
|
|
|
|
|
newrec.货物描述 = SetLength(description, 600);
|
|
|
|
|
newrec.商品编码 = SetLength(hscode, 10);
|
|
|
|
|
d6.t_code_goods.Add(newrec);
|
|
|
|
|
d6.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result = 当前货名[0].货物名称;
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void GetCtn(ref t_op_ctn_md curr, t_op_ctn_md ctn)
|
|
|
|
|
{
|
|
|
|
@ -2896,24 +2935,31 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
var 集装箱 = 箱型箱量.get集装箱();
|
|
|
|
|
var 箱数大写 = 箱型箱量.get箱数大写();
|
|
|
|
|
|
|
|
|
|
//var 当前货名 = new t_code_goods_md();
|
|
|
|
|
|
|
|
|
|
var 当前货名 = d6.t_code_goods.Where(x => x.代码 == item.goodscode).ToList();
|
|
|
|
|
if (当前货名 == null || 当前货名.Count == 0)
|
|
|
|
|
{
|
|
|
|
|
var newcodegoods = new t_code_goods_md();
|
|
|
|
|
|
|
|
|
|
newcodegoods.代码 = SetLength(item.goodscode, 10);
|
|
|
|
|
newcodegoods.货物名称 = SetLength(item.goodsname, 100);
|
|
|
|
|
货物名称 = newcodegoods.货物名称;
|
|
|
|
|
newcodegoods.货物描述 = SetLength(item.description, 600);
|
|
|
|
|
newcodegoods.商品编码 = SetLength(item.hscode, 10);
|
|
|
|
|
d6.t_code_goods.Add(newcodegoods);
|
|
|
|
|
d6.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
货物名称 = 当前货名[0].货物名称;
|
|
|
|
|
}
|
|
|
|
|
货物名称 = dealGoodsinfo(item.goodscode, item.goodsname,item.description,item.hscode);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// var 当前货名 = d6.t_code_goods.Where(x => x.代码 == item.goodscode).ToList();
|
|
|
|
|
//if (当前货名 == null || 当前货名.Count == 0)
|
|
|
|
|
//{
|
|
|
|
|
// if (!string.IsNullOrWhiteSpace(item.goodscode))
|
|
|
|
|
// {
|
|
|
|
|
// var newcodegoods = new t_code_goods_md();
|
|
|
|
|
|
|
|
|
|
// newcodegoods.代码 = SetLength(item.goodscode, 10);
|
|
|
|
|
// newcodegoods.货物名称 = SetLength(item.goodsname, 100);
|
|
|
|
|
// 货物名称 = newcodegoods.货物名称;
|
|
|
|
|
// newcodegoods.货物描述 = SetLength(item.description, 600);
|
|
|
|
|
// newcodegoods.商品编码 = SetLength(item.hscode, 10);
|
|
|
|
|
// d6.t_code_goods.Add(newcodegoods);
|
|
|
|
|
// d6.SaveChanges();
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//else
|
|
|
|
|
//{
|
|
|
|
|
// 货物名称 = 当前货名[0].货物名称;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
var newrec = new t_op_seae_assistant_md
|
|
|
|
|
{
|
|
|
|
@ -2993,6 +3039,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
合同号 = item.pono,
|
|
|
|
|
|
|
|
|
|
委托单位 = item.customername,
|
|
|
|
|
|
|
|
|
|
报关行 = item.customser,
|
|
|
|
|
承运车队 = item.trucker,
|
|
|
|
|
货代公司 = item.forwarder,//大简云“订舱代理”,ds6界面的“订舱代理”,ds6数据库的货代
|
|
|
|
@ -3506,7 +3553,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
public class 大简云业务函电 {
|
|
|
|
|
public t_op_seae_md opseae { get; set; }
|
|
|
|
|
public t_op_letter_md HeadLetter { get; set; }
|
|
|
|
|
public t_op_letter_md HeadLetter { get; set; } = new t_op_letter_md();
|
|
|
|
|
|
|
|
|
|
public OpLetterBase ChildLetter { get; set; }
|
|
|
|
|
|
|
|
|
@ -3557,12 +3604,12 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
var result = new OpLetterBase();
|
|
|
|
|
var ds6 = new DS6DataContext();
|
|
|
|
|
|
|
|
|
|
void SaveHeadLetter() {
|
|
|
|
|
void SaveHeadLetter(string 函电名称) {
|
|
|
|
|
//
|
|
|
|
|
ds6.t_op_letter.Add(HeadLetter);
|
|
|
|
|
ds6.SaveChanges();
|
|
|
|
|
|
|
|
|
|
var letterheads = ds6.t_op_letter.Where(x => x.DJYLETTERID == HeadLetter.DJYLETTERID).ToList();
|
|
|
|
|
var letterheads = ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称 == HeadLetter.函电名称).ToList();
|
|
|
|
|
|
|
|
|
|
if (letterheads != null || letterheads.Count > 0) {
|
|
|
|
|
|
|
|
|
@ -3572,12 +3619,11 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UpdHeadLetter()
|
|
|
|
|
void UpdHeadLetter(string 函电名称)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
var UpdHeadLetterList = ds6.t_op_letter.Where(x => x.DJYLETTERID == HeadLetter.DJYLETTERID).ToList();
|
|
|
|
|
var UpdHeadLetterList = ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称== 函电名称).ToList();
|
|
|
|
|
|
|
|
|
|
if (UpdHeadLetterList != null || UpdHeadLetterList.Count > 0)
|
|
|
|
|
{
|
|
|
|
@ -3591,9 +3637,9 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DelHeadLetter(long DJYLETTERID)
|
|
|
|
|
void DelHeadLetter(string 函电名称)
|
|
|
|
|
{
|
|
|
|
|
var delheadList = ds6.t_op_letter.Where(x => x.DJYLETTERID == DJYLETTERID).ToList();
|
|
|
|
|
var delheadList = ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称 == 函电名称).ToList();
|
|
|
|
|
if (delheadList != null && delheadList.Count > 0) {
|
|
|
|
|
var delhead= delheadList[0];
|
|
|
|
|
ds6.t_op_letter.Remove(delhead);
|
|
|
|
@ -3605,19 +3651,32 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
//var currlist = new List<OpLetterBase>();
|
|
|
|
|
if (HeadLetter.函电名称 == "入货通知") {
|
|
|
|
|
var currlist = ds6.t_op_letter_rh.Where(x => x.DJYLETTERID == ((t_op_letter_rh_md)ChildLetter).DJYLETTERID).ToList();
|
|
|
|
|
|
|
|
|
|
var currHeadLetterList= ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称== HeadLetter.函电名称).ToList();
|
|
|
|
|
|
|
|
|
|
var currlist = new List<t_op_letter_rh_md>();
|
|
|
|
|
|
|
|
|
|
if (currHeadLetterList != null && currHeadLetterList.Count > 0) {
|
|
|
|
|
currlist = ds6.t_op_letter_rh.Where(x => x.LE_ID == currlist[0].LE_ID).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//首先判断是否为删除 如果是 执行删除
|
|
|
|
|
if (IsDeleted)
|
|
|
|
|
{
|
|
|
|
|
//找到具体letter 如有则定位到opletter
|
|
|
|
|
//两个都要删除
|
|
|
|
|
if (currlist != null && currlist.Count > 0)
|
|
|
|
|
|
|
|
|
|
if (currHeadLetterList != null && currHeadLetterList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
var delrec = currlist[0];
|
|
|
|
|
ds6.t_op_letter_rh.Remove(delrec);
|
|
|
|
|
|
|
|
|
|
DelHeadLetter(delrec.DJYLETTERID);
|
|
|
|
|
//ds6.t_op_letter.Remove(currHeadLetterList[0]);
|
|
|
|
|
|
|
|
|
|
if (currlist != null && currlist.Count > 0) {
|
|
|
|
|
var delrec = currlist[0];
|
|
|
|
|
ds6.t_op_letter_rh.Remove(delrec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DelHeadLetter(HeadLetter.函电名称);
|
|
|
|
|
|
|
|
|
|
ds6.SaveChanges();
|
|
|
|
|
return;
|
|
|
|
@ -3626,7 +3685,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
|
|
|
|
|
if (currlist != null && currlist.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
UpdHeadLetter();
|
|
|
|
|
UpdHeadLetter(HeadLetter.函电名称);
|
|
|
|
|
//寻找
|
|
|
|
|
var updrec = currlist[0];
|
|
|
|
|
updrec.getCopy(ChildLetter,typeof(t_op_letter_rh_md));
|
|
|
|
@ -3635,7 +3694,7 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SaveHeadLetter();
|
|
|
|
|
SaveHeadLetter(HeadLetter.函电名称);
|
|
|
|
|
if (HeadLetter.LE_ID == 0) return ;
|
|
|
|
|
ChildLetter.LE_ID = HeadLetter.LE_ID;
|
|
|
|
|
ds6.t_op_letter_rh.Add((t_op_letter_rh_md)ChildLetter);
|
|
|
|
@ -3643,7 +3702,17 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
if (HeadLetter.函电名称 == "派车")
|
|
|
|
|
{
|
|
|
|
|
var currlist = ds6.t_op_letter_pc.Where(x => x.DJYLETTERID == ((t_op_letter_pc_md)ChildLetter).DJYLETTERID).ToList();
|
|
|
|
|
var 派车对象 = (大简云派车)大简云对象;
|
|
|
|
|
|
|
|
|
|
var currHeadLetterList = ds6.t_op_letter.Where(x => x.编号 == opseae.编号 && x.函电名称 == HeadLetter.函电名称).ToList();
|
|
|
|
|
|
|
|
|
|
var currlist = new List<t_op_letter_pc_md>();
|
|
|
|
|
|
|
|
|
|
if (currHeadLetterList != null && currHeadLetterList.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
currlist = ds6.t_op_letter_pc.Where(x => x.LE_ID == currHeadLetterList[0].LE_ID).ToList();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (IsDeleted)
|
|
|
|
|
{
|
|
|
|
@ -3654,16 +3723,18 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
var delrec = currlist[0];
|
|
|
|
|
ds6.t_op_letter_pc.Remove(delrec);
|
|
|
|
|
|
|
|
|
|
DelHeadLetter(delrec.DJYLETTERID);
|
|
|
|
|
DelHeadLetter(HeadLetter.函电名称);
|
|
|
|
|
|
|
|
|
|
ds6.SaveChanges();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
opseae.承运车队 = "";
|
|
|
|
|
opseae.派车日期 = null;
|
|
|
|
|
ds6.t_op_seae.AddOrUpdate(opseae);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
opseae.承运车队 = ((t_op_letter_pc_md)ChildLetter).承运车队;
|
|
|
|
|
opseae.派车日期 = 派车对象.main.truckTime;
|
|
|
|
|
ds6.t_op_seae.AddOrUpdate(opseae);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -3677,13 +3748,13 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
SaveHeadLetter();
|
|
|
|
|
SaveHeadLetter(HeadLetter.函电名称);
|
|
|
|
|
if (HeadLetter.LE_ID == 0) return;
|
|
|
|
|
ChildLetter.LE_ID = HeadLetter.LE_ID;
|
|
|
|
|
ds6.t_op_letter_pc.Add((t_op_letter_pc_md)ChildLetter);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var 派车对象 = (大简云派车)大简云对象;
|
|
|
|
|
|
|
|
|
|
var ctninfo = 派车对象.main.contaList;
|
|
|
|
|
var currctn = ds6.t_op_letter_pc_ctn.Where(x => x.LE_ID == HeadLetter.LE_ID).ToList();
|
|
|
|
|
|
|
|
|
@ -4157,6 +4228,10 @@ SELECT @ps_BillNo as N'billno'";
|
|
|
|
|
public static string SubString2(string str, int startIndex, int length)
|
|
|
|
|
{
|
|
|
|
|
byte[] b = System.Text.Encoding.Default.GetBytes(str);
|
|
|
|
|
if(length> b.Length)
|
|
|
|
|
{
|
|
|
|
|
length = b.Length;
|
|
|
|
|
}
|
|
|
|
|
return System.Text.Encoding.Default.GetString(b, startIndex, length);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|