diff --git a/PingTai/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs b/PingTai/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs index 044026c..7f74574 100644 --- a/PingTai/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs +++ b/PingTai/DSWeb/Areas/MvcShipping/Controllers/MsOpSeaeEdiController.cs @@ -3959,7 +3959,7 @@ namespace DSWeb.MvcShipping.Controllers var groupList = ctnList.GroupBy(c => c.CTNALL).Select(g => $"{g.Key}*{g.Count()}"); edi.JiZhuangXiang = string.Join(" / ", groupList); - + ediData.Edis.Add(edi); ediData.EdiCtns.AddRange(ctnList); @@ -4708,7 +4708,7 @@ namespace DSWeb.MvcShipping.Controllers edi.INPUTBY = Session["SHOWNAME"].ToString(); edi.INPUTBYID = Session["USERID"].ToString(); edi.CORPID = Session["COMPANYID"].ToString(); - edi.CONSIGNEE = edi.CONSIGNEE==null?"": edi.CONSIGNEE.Replace(" ", " "); + edi.CONSIGNEE = edi.CONSIGNEE == null ? "" : edi.CONSIGNEE.Replace(" ", " "); edi.CONSIGNEENAME = edi.CONSIGNEENAME == null ? "" : edi.CONSIGNEENAME.Replace(" ", " "); edi.NOTIFYPARTYNAME = edi.NOTIFYPARTYNAME == null ? "" : edi.NOTIFYPARTYNAME.Replace(" ", " "); @@ -5076,11 +5076,11 @@ namespace DSWeb.MvcShipping.Controllers edi.ZhiFaText = string.Empty; edi.comname = string.Empty; edi.PORTDISCHARGE = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.PORTDISCHARGE).FirstOrDefault(); - + edi.PORTDISCHARGEID = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.PORTDISCHARGEID).FirstOrDefault(); edi.DESTINATION = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.DESTINATION).FirstOrDefault(); - + edi.DESTINATIONID = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.DESTINATIONID).FirstOrDefault(); @@ -5091,36 +5091,36 @@ namespace DSWeb.MvcShipping.Controllers edi.SHIPPER = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPER).FirstOrDefault(); edi.SHIPPERNAME = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERNAME).FirstOrDefault(); - + edi.SHIPPERADDR1 = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERADDR1).FirstOrDefault(); - + edi.SHIPPERCOUNTRY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERCOUNTRY).FirstOrDefault(); edi.SHIPPERTEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERTEL).FirstOrDefault(); - + edi.CONSIGNEE = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEE).FirstOrDefault(); edi.CONSIGNEENAME = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEENAME).FirstOrDefault(); - + edi.CONSIGNEEADDR1 = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEEADDR1).FirstOrDefault(); - + edi.CONSIGNEECOUNTRY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEECOUNTRY).FirstOrDefault(); edi.CONSIGNEETEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEETEL).FirstOrDefault(); - + edi.NOTIFYPARTY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTY).FirstOrDefault(); edi.NOTIFYPARTYNAME = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYNAME).FirstOrDefault(); - + edi.NOTIFYPARTYADDR1 = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYADDR1).FirstOrDefault(); - + edi.NOTIFYPARTYCOUNTRY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYCOUNTRY).FirstOrDefault(); edi.NOTIFYPARTYTEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYTEL).FirstOrDefault(); - + edi.CARGOID = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CARGOID).FirstOrDefault(); edi.DESCRIPTION = string.Join("\r\n", ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).DistinctBy(x => x.DESCRIPTION).Select(x => x.DESCRIPTION)); - + edi.KINDPKGS = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.KINDPKGS).FirstOrDefault(); edi.SERVICE = "CY-CY"; @@ -5152,6 +5152,8 @@ namespace DSWeb.MvcShipping.Controllers ctn.ctn_id = Guid.NewGuid().ToString(); ctn.MFNO = edi.MFNO; ctn.CNTRNO = it; + ctn.CTN = cclist.Where(x => x.CNTRNO == it).Select(x => x.CTN).FirstOrDefault(); + ctn.SIZE = cclist.Where(x => x.CNTRNO == it).Select(x => x.SIZE).FirstOrDefault(); ctn.SEALNO = cclist.Where(x => x.CNTRNO == it).Select(x => x.SEALNO).FirstOrDefault(); ctn.CTNCODE = i.ToString().PadLeft(2, '0'); ctn.CTNALL = cclist.Where(x => x.CNTRNO == it).Select(x => x.CTNALL).FirstOrDefault(); @@ -5497,7 +5499,7 @@ namespace DSWeb.MvcShipping.Controllers if (merge) { //没有主单的主提单号 - var mmList = ediList.Where(x => x.HBLNO != "" && x.BSNO == ""&&x.HBLNO!=x.MBLNO).Select(x => x.MBLNO).Distinct().ToList(); + var mmList = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.HBLNO != x.MBLNO).Select(x => x.MBLNO).Distinct().ToList(); foreach (var item in mmList) @@ -5532,11 +5534,11 @@ namespace DSWeb.MvcShipping.Controllers edi.ZhiFaText = string.Empty; edi.comname = string.Empty; edi.PORTDISCHARGE = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.PORTDISCHARGE).FirstOrDefault(); - + edi.PORTDISCHARGEID = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.PORTDISCHARGEID).FirstOrDefault(); edi.DESTINATION = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.DESTINATION).FirstOrDefault(); - + edi.DESTINATIONID = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.DESTINATIONID).FirstOrDefault(); edi.VESSEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.VESSEL).FirstOrDefault(); @@ -5546,37 +5548,37 @@ namespace DSWeb.MvcShipping.Controllers edi.SHIPPER = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPER).FirstOrDefault(); edi.SHIPPERNAME = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERNAME).FirstOrDefault(); - + edi.SHIPPERADDR1 = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERADDR1).FirstOrDefault(); - + edi.SHIPPERCOUNTRY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERCOUNTRY).FirstOrDefault(); edi.SHIPPERTEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.SHIPPERTEL).FirstOrDefault(); - + edi.CONSIGNEE = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEE).FirstOrDefault(); edi.CONSIGNEENAME = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEENAME).FirstOrDefault(); - + edi.CONSIGNEEADDR1 = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEEADDR1).FirstOrDefault(); - + edi.CONSIGNEECOUNTRY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEECOUNTRY).FirstOrDefault(); edi.CONSIGNEETEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CONSIGNEETEL).FirstOrDefault(); - + edi.NOTIFYPARTY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTY).FirstOrDefault(); edi.NOTIFYPARTYNAME = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYNAME).FirstOrDefault(); - + edi.NOTIFYPARTYADDR1 = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYADDR1).FirstOrDefault(); - + edi.NOTIFYPARTYCOUNTRY = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYCOUNTRY).FirstOrDefault(); edi.NOTIFYPARTYTEL = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.NOTIFYPARTYTEL).FirstOrDefault(); - + edi.CARGOID = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.CARGOID).FirstOrDefault(); edi.DESCRIPTION = string.Join("\r\n", ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).DistinctBy(x => x.DESCRIPTION).Select(x => x.DESCRIPTION)); - + edi.KINDPKGS = ediList.Where(x => x.HBLNO != "" && x.BSNO == "" && x.MBLNO == item).Select(x => x.KINDPKGS).FirstOrDefault(); edi.SERVICE = "CY-CY"; @@ -5608,6 +5610,8 @@ namespace DSWeb.MvcShipping.Controllers ctn.ctn_id = Guid.NewGuid().ToString(); ctn.MFNO = edi.MFNO; ctn.CNTRNO = it; + ctn.CTN = cclist.Where(x => x.CNTRNO == it).Select(x => x.CTN).FirstOrDefault(); + ctn.SIZE = cclist.Where(x => x.CNTRNO == it).Select(x => x.SIZE).FirstOrDefault(); ctn.SEALNO = cclist.Where(x => x.CNTRNO == it).Select(x => x.SEALNO).FirstOrDefault(); ctn.CTNCODE = i.ToString().PadLeft(2, '0'); ctn.CTNALL = cclist.Where(x => x.CNTRNO == it).Select(x => x.CTNALL).FirstOrDefault(); @@ -5645,7 +5649,7 @@ namespace DSWeb.MvcShipping.Controllers edi.CONSIGNEEADDR1 = edi.CONSIGNEEADDR1.Replace(" ", " "); edi.CONSIGNEETEL = edi.CONSIGNEETEL.Replace(" ", " "); - + edi.NOTIFYPARTYADDR1 = edi.NOTIFYPARTYADDR1.Replace(" ", " "); edi.NOTIFYPARTYTEL = edi.NOTIFYPARTYTEL.Replace(" ", " "); @@ -5793,7 +5797,7 @@ namespace DSWeb.MvcShipping.Controllers { - + if (item.PORTDISCHARGE.Length > 60) { resp.Success = false; @@ -5802,7 +5806,7 @@ namespace DSWeb.MvcShipping.Controllers return Json(resp); } - + if (item.DESTINATION.Length > 60) { resp.Success = false; @@ -5812,7 +5816,7 @@ namespace DSWeb.MvcShipping.Controllers } - + if (item.SHIPPERNAME.Length > 200) { resp.Success = false; @@ -5820,7 +5824,7 @@ namespace DSWeb.MvcShipping.Controllers resp.Data = true; return Json(resp); } - + if (item.SHIPPERADDR1.Length > 200) { resp.Success = false; @@ -5829,7 +5833,7 @@ namespace DSWeb.MvcShipping.Controllers return Json(resp); } - + if (item.SHIPPERTEL.Length > 50) { resp.Success = false; @@ -5839,7 +5843,7 @@ namespace DSWeb.MvcShipping.Controllers } - + if (item.CONSIGNEENAME.Length > 200) { resp.Success = false; @@ -5848,7 +5852,7 @@ namespace DSWeb.MvcShipping.Controllers return Json(resp); } - + if (item.CONSIGNEEADDR1.Length > 200) { resp.Success = false; @@ -5872,21 +5876,21 @@ namespace DSWeb.MvcShipping.Controllers return Json(resp); } - if (item.NOTIFYPARTYADDR1.Length > 200) + if (item.NOTIFYPARTYADDR1.Length > 200) { resp.Success = false; resp.Message = "通知人地址超长"; resp.Data = true; return Json(resp); } - if (item.NOTIFYPARTYTEL.Length > 50) + if (item.NOTIFYPARTYTEL.Length > 50) { resp.Success = false; resp.Message = "通知人电话超长"; resp.Data = true; return Json(resp); } - if (item.DESCRIPTION.Length > 2000) + if (item.DESCRIPTION.Length > 2000) { resp.Success = false; resp.Message = "货物描述超长"; @@ -5894,9 +5898,9 @@ namespace DSWeb.MvcShipping.Controllers return Json(resp); } - - + + } ediData.Edis.AddRange(ediList); ediData.EdiCtns.AddRange(ctnList); diff --git a/PingTai/DSWeb/Helper/AnalyzeNew.cs b/PingTai/DSWeb/Helper/AnalyzeNew.cs index f023942..28a0e62 100644 --- a/PingTai/DSWeb/Helper/AnalyzeNew.cs +++ b/PingTai/DSWeb/Helper/AnalyzeNew.cs @@ -2481,7 +2481,7 @@ namespace DSWeb.Helper flag = false; return false; } - var codeCtn = codeCtnList.FirstOrDefault(cc => cc.EDICODE == item.CTNALL); + var codeCtn = codeCtnList.FirstOrDefault(cc => cc.CTN == item.CTNALL); if (codeCtn == null) { @@ -2491,7 +2491,7 @@ namespace DSWeb.Helper else { - ctn.CTN = codeCtn.CTN; + ctn.CTN = codeCtn.CTN.Replace(codeCtn.CTNSIZE, ""); ctn.SIZE = codeCtn.CTNSIZE; } @@ -2864,7 +2864,7 @@ namespace DSWeb.Helper flag = false; return false; } - var codeCtn = codeCtnList.FirstOrDefault(cc => cc.EDICODE == item.CTNALL); + var codeCtn = codeCtnList.FirstOrDefault(cc => cc.CTN == item.CTNALL); if (codeCtn == null) { @@ -2874,7 +2874,7 @@ namespace DSWeb.Helper else { - ctn.CTN = codeCtn.CTN; + ctn.CTN = codeCtn.CTN.Replace(codeCtn.CTNSIZE, ""); ctn.SIZE = codeCtn.CTNSIZE; }