和川大简云订舱数据同步服务,业务函电更新逻辑调整;新增货物名称逻辑调整

DS7_JinGang
dengyu 1 year ago
parent f78af0caac
commit 4e68eb8c43

@ -953,7 +953,6 @@ namespace DSWeb.Common.DB
public decimal? { get; set; }
public string { get; set; }
}
/// <summary>

@ -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);
}

Loading…
Cancel
Save