修改INTTRA

usertest
jianghaiqing 4 months ago
parent a972025ce1
commit a0fa232517

@ -328,8 +328,14 @@ namespace DS.WMS.Core.Op.EDI
if (string.IsNullOrEmpty(headData.OpEmail)) if (string.IsNullOrEmpty(headData.OpEmail))
{ error = error + "<br />操作的邮箱不能为空"; } { error = error + "<br />操作的邮箱不能为空"; }
} }
//截单时必需校验提单号订舱时CMA可以不校验提单号必填
if (InttrEdi.filetype == "E" || (InttrEdi.filetype == "B" && (headData.CARRIEREDICODE != "HLCU" && headData.CARRIEREDICODE != "CMDU" && headData.CARRIEREDICODE != "CHNL")))
{
if (string.IsNullOrEmpty(headData.MBLNO)) if (string.IsNullOrEmpty(headData.MBLNO))
{ error = error + "<br />主提单号不能为空"; } { error = error + "<br />主提单号不能为空"; }
}
if (string.IsNullOrEmpty(headData.BLFRT)) if (string.IsNullOrEmpty(headData.BLFRT))
{ error = error + "<br />提单号:" + headData.MBLNO + " 付费方式不能为空"; } { error = error + "<br />提单号:" + headData.MBLNO + " 付费方式不能为空"; }
@ -359,12 +365,14 @@ namespace DS.WMS.Core.Op.EDI
} }
if (InttrEdi.filetype == "E")
{
if (string.IsNullOrEmpty(headData.VESSEL)) if (string.IsNullOrEmpty(headData.VESSEL))
{ error = error + "<br />提单号:" + headData.MBLNO + " 船名不能为空"; } { error = error + "<br />提单号:" + headData.MBLNO + " 船名不能为空"; }
if (string.IsNullOrEmpty(headData.VOYNO)) if (string.IsNullOrEmpty(headData.VOYNO))
{ error = error + "<br />提单号:" + headData.MBLNO + " 航次不能为空"; } { error = error + "<br />提单号:" + headData.MBLNO + " 航次不能为空"; }
}
if (InttrEdi.filetype == "E") if (InttrEdi.filetype == "E")
{ {
if (headData.SIREMARK.IndexOf("PLEASE BOOK OCEAN CARRIER") > -1 || headData.SIREMARK.ToString().Trim() == "") if (headData.SIREMARK.IndexOf("PLEASE BOOK OCEAN CARRIER") > -1 || headData.SIREMARK.ToString().Trim() == "")
@ -417,6 +425,30 @@ namespace DS.WMS.Core.Op.EDI
{ error = error + "<br />提单号:" + headData.MBLNO + " 船公司EDI代码不能为空"; } { error = error + "<br />提单号:" + headData.MBLNO + " 船公司EDI代码不能为空"; }
//CMA 订舱时,发货人可以不填
if (InttrEdi.filetype.Equals("B", StringComparison.OrdinalIgnoreCase) && headData.CARRIEREDICODE.Equals("CMDU", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrWhiteSpace(headData.SHIPPER))
{
if (StringIsChinese(headData.SHIPPER))
{
error = error + "<br />提单号:" + headData.MBLNO + " 发货人含有中文或双字节字符";
}
else
{
if (headData.CARRIEREDICODE == "HLCU")
{
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "-", false);
}
else
{
error += formatlengthError("txt", headData.SHIPPER, 35, headData.MBLNO, "发货人", 6, "*", false);
}
}
}
}
else
{
if (string.IsNullOrEmpty(headData.SHIPPER)) if (string.IsNullOrEmpty(headData.SHIPPER))
{ {
error = error + "<br />提单号:" + headData.MBLNO + " 发货人不能为空"; error = error + "<br />提单号:" + headData.MBLNO + " 发货人不能为空";
@ -439,10 +471,33 @@ namespace DS.WMS.Core.Op.EDI
} }
} }
} }
}
//} //}
//改为截单时校验 //CMA 订舱时,收货人可以不填
if (InttrEdi.filetype == "E") if (InttrEdi.filetype.Equals("B", StringComparison.OrdinalIgnoreCase) && headData.CARRIEREDICODE.Equals("CMDU", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrWhiteSpace(headData.CONSIGNEE))
{
if (StringIsChinese(headData.CONSIGNEE))
{
error = error + "<br />提单号:" + headData.MBLNO + " 收货人含有中文或双字节字符";
}
else
{
if (headData.CARRIEREDICODE == "HLCU")
{
error += formatlengthError("txt", headData.CONSIGNEE, 35, headData.MBLNO, "收货人", 6, "--", false);
}
else
{
error += formatlengthError("txt", headData.CONSIGNEE, 35, headData.MBLNO, "收货人", 6, "**", false);
}
}
}
}
else
{ {
if (string.IsNullOrEmpty(headData.CONSIGNEE)) if (string.IsNullOrEmpty(headData.CONSIGNEE))
{ {
@ -498,8 +553,29 @@ namespace DS.WMS.Core.Op.EDI
} }
} }
//改为截单时校验 //CMA 订舱时,通知人可以不填
if (InttrEdi.filetype == "E") if (InttrEdi.filetype.Equals("B", StringComparison.OrdinalIgnoreCase) && headData.CARRIEREDICODE.Equals("CMDU", StringComparison.OrdinalIgnoreCase))
{
if (!string.IsNullOrWhiteSpace(headData.NOTIFYPARTY))
{
if (StringIsChinese(headData.NOTIFYPARTY))
{
error = error + "<br />提单号:" + headData.MBLNO + " 通知人含有中文或双字节字符";
}
else
{
if (headData.CARRIEREDICODE == "HLCU")
{
error += formatlengthError("txt", headData.NOTIFYPARTY, 35, headData.MBLNO, "通知人", 6, "---", false);
}
else
{
error += formatlengthError("txt", headData.NOTIFYPARTY, 35, headData.MBLNO, "通知人", 6, "***", false);
}
}
}
}
else
{ {
if (string.IsNullOrEmpty(headData.NOTIFYPARTY)) if (string.IsNullOrEmpty(headData.NOTIFYPARTY))
{ {
@ -527,6 +603,7 @@ namespace DS.WMS.Core.Op.EDI
} }
} }
} }
}
if (!string.IsNullOrEmpty(headData.NOTIFYPARTY2)) if (!string.IsNullOrEmpty(headData.NOTIFYPARTY2))
{ {
@ -548,7 +625,6 @@ namespace DS.WMS.Core.Op.EDI
error += formatlengthError("txt", headData.MARKS, 35, headData.MBLNO, "唛头", 0, "", false); error += formatlengthError("txt", headData.MARKS, 35, headData.MBLNO, "唛头", 0, "", false);
} }
} }
}
if (string.IsNullOrEmpty(headData.DESCRIPTION)) if (string.IsNullOrEmpty(headData.DESCRIPTION))
{ {
@ -770,7 +846,7 @@ namespace DS.WMS.Core.Op.EDI
#region 订舱 #region 订舱
public static EdiDataResult CreateEdiINTTR(EDIBaseModel InttrEdi) public static EdiDataResult CreateEdiINTTR(EDIBaseModel InttrEdi)
{ {
EdiDataResult result = new EdiDataResult { Succeeded = false }; var result = new EdiDataResult { Succeeded = false };
string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt"; string filename = InttrEdi.filerpath + "\\" + InttrEdi.BSLIST[0].MBLNO + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".txt";
@ -790,10 +866,10 @@ namespace DS.WMS.Core.Op.EDI
{ {
bsno = bill.ORDERNO; bsno = bill.ORDERNO;
r.WriteLine("UNB+UNOC:2+" + InttrEdi.SENDCODE + "SO:ZZZ+" + InttrEdi.RECEIVECODE + ":ZZZ+" + DateTime.Now.ToString("yyMMdd:HHmm") + "+" + bill.ORDERNO + "'"); r.WriteLine("UNB+UNOC:2+" + InttrEdi.SENDCODE + "SO:ZZZ+" + InttrEdi.RECEIVECODE + ":ZZZ+" + DateTime.Now.ToString("yyMMdd:HHmm") + "+" + bill.ORDERNO + "'");
r.WriteLine("UNH+" + bill.ORDERNO + "+IFTMBF:D:99B:UN'"); r.WriteLine("UNH+" + bill.ORDERNO + "+IFTMIN:D:99B:UN'");
icount = icount + 2; icount = icount + 2;
if (bill.CARRIEREDICODE == "HLCU") if (bill.CARRIEREDICODE == "HLCU" || bill.CARRIEREDICODE == "CMDU" || bill.CARRIEREDICODE == "CHNL")
{ {
if (InttrEdi.filerole == "9") if (InttrEdi.filerole == "9")
r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+9'"); r.WriteLine("BGM+335+" + bill.ORDERNO + "SO+9'");
@ -834,6 +910,9 @@ namespace DS.WMS.Core.Op.EDI
r.WriteLine("TSR+30+2'"); r.WriteLine("TSR+30+2'");
} }
//2024-05-22 少了一行计数追加上 JHQ
//icount = icount + 1;
var str_pay = ""; var str_pay = "";
if (bill.BLFRT.IndexOf("PREPAID") >= 0) if (bill.BLFRT.IndexOf("PREPAID") >= 0)
str_pay = bill.PREPARDAT; str_pay = bill.PREPARDAT;
@ -937,7 +1016,7 @@ namespace DS.WMS.Core.Op.EDI
} }
} }
if (bill.CARRIEREDICODE != "COSU") if (bill.CARRIEREDICODE != "COSU" && !string.IsNullOrWhiteSpace(bill.MBLNO))
{ {
if (bill.CARRIEREDICODE == "HLCU") if (bill.CARRIEREDICODE == "HLCU")
{ {
@ -951,6 +1030,7 @@ namespace DS.WMS.Core.Op.EDI
} }
icount = icount + 2; icount = icount + 2;
} }
r.WriteLine("RFF+CT:" + bill.CONTRACTNO + "'"); r.WriteLine("RFF+CT:" + bill.CONTRACTNO + "'");
if (bill.BLFRT.IndexOf("PREPAID") >= 0) if (bill.BLFRT.IndexOf("PREPAID") >= 0)
@ -1271,6 +1351,7 @@ namespace DS.WMS.Core.Op.EDI
else else
r.WriteLine("NAD+FW+++" + formatEdiStr("txt", bill.WEITUO) + "'"); r.WriteLine("NAD+FW+++" + formatEdiStr("txt", bill.WEITUO) + "'");
icount = icount + 1;
} }
else else
{ {
@ -1278,7 +1359,7 @@ namespace DS.WMS.Core.Op.EDI
if (InttrEdi.UseForWarderCode) if (InttrEdi.UseForWarderCode)
{ {
r.WriteLine("NAD+FW+" + InttrEdi.ForWarderCode + ":160:86++" + InttrEdi.ForWarderName + "'"); r.WriteLine("NAD+FW+" + InttrEdi.ForWarderCode + ":160:86++" + InttrEdi.ForWarderName + "'");
icount++; icount = icount + 1;
} }
else else
{ {
@ -1286,6 +1367,8 @@ namespace DS.WMS.Core.Op.EDI
r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME.Substring(0, 35) + "+" + InttrEdi.SENDNAME.Substring(35) + "'"); r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME.Substring(0, 35) + "+" + InttrEdi.SENDNAME.Substring(35) + "'");
else else
r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME + "'"); r.WriteLine("NAD+FW+" + InttrEdi.SENDCODE + ":160:86++" + InttrEdi.SENDNAME + "'");
icount = icount + 1;
} }
} }
@ -1456,9 +1539,6 @@ namespace DS.WMS.Core.Op.EDI
r.Close(); r.Close();
f.Close(); f.Close();
//result.succ = true;
//result.extra = filename;
//return result;
result.Succeeded = true; result.Succeeded = true;
result.ExtraData1 = filename; result.ExtraData1 = filename;
return result; return result;

@ -1202,11 +1202,18 @@ namespace DS.WMS.Core.Op.Method
} }
#endregion #endregion
string needMappingModule = string.Empty;
if (ediRouteEnum == EDIRouteEnum.INTTRA)
{
needMappingModule = "INTTRA_EDI";
}
#region 卸货港 #region 卸货港
//卸货港 //卸货港
if (order.DischargePortId > 0) if (order.DischargePortId > 0)
{ {
var portRlt = GetPortEDICode(order.DischargePortId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DischargePort, "卸货港"); var portRlt = GetPortEDICode(order.DischargePortId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DischargePort, "卸货港", needMappingModule);
if (portRlt.Succeeded) if (portRlt.Succeeded)
primaryModel.PORTDISCHARGEID = portRlt.Data; primaryModel.PORTDISCHARGEID = portRlt.Data;
@ -1217,7 +1224,7 @@ namespace DS.WMS.Core.Op.Method
//中转港 //中转港
if (order.TransPortId > 0) if (order.TransPortId > 0)
{ {
var portRlt = GetPortEDICode(order.TransPortId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.TransPort, "中转港"); var portRlt = GetPortEDICode(order.TransPortId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.TransPort, "中转港", needMappingModule);
if (portRlt.Succeeded) if (portRlt.Succeeded)
primaryModel.TRANSPORTID = portRlt.Data; primaryModel.TRANSPORTID = portRlt.Data;
@ -1228,7 +1235,7 @@ namespace DS.WMS.Core.Op.Method
//交货地 //交货地
if (order.DeliveryPlaceId > 0) if (order.DeliveryPlaceId > 0)
{ {
var portRlt = GetPortEDICode(order.DeliveryPlaceId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DeliveryPlace, "交货地"); var portRlt = GetPortEDICode(order.DeliveryPlaceId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DeliveryPlace, "交货地", needMappingModule);
if (portRlt.Succeeded) if (portRlt.Succeeded)
primaryModel.PLACEDELIVERYID = portRlt.Data; primaryModel.PLACEDELIVERYID = portRlt.Data;
@ -1242,7 +1249,7 @@ namespace DS.WMS.Core.Op.Method
//目的地 //目的地
if (order.DeliveryPlaceId > 0) if (order.DeliveryPlaceId > 0)
{ {
var portRlt = GetPortEDICode(order.DeliveryPlaceId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DischargePort, "目的地"); var portRlt = GetPortEDICode(order.DeliveryPlaceId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DischargePort, "交货地", needMappingModule);
if (portRlt.Succeeded) if (portRlt.Succeeded)
primaryModel.DESTINATIONID = portRlt.Data; primaryModel.DESTINATIONID = portRlt.Data;
@ -1255,7 +1262,7 @@ namespace DS.WMS.Core.Op.Method
//目的地 //目的地
if (order.DestinationId > 0) if (order.DestinationId > 0)
{ {
var portRlt = GetPortEDICode(order.DestinationId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DischargePort, "目的地"); var portRlt = GetPortEDICode(order.DestinationId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.DischargePort, "目的地", needMappingModule);
if (portRlt.Succeeded) if (portRlt.Succeeded)
primaryModel.DESTINATIONID = portRlt.Data; primaryModel.DESTINATIONID = portRlt.Data;
@ -1268,7 +1275,7 @@ namespace DS.WMS.Core.Op.Method
//到付地点 //到付地点
if (order.PayableAtId > 0) if (order.PayableAtId > 0)
{ {
var portRlt = GetPortEDICode(order.PayableAtId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.PayableAt, "到付地点"); var portRlt = GetPortEDICode(order.PayableAtId, portList, mapPortList, order.CarrierId, CONST_MAPPING_MODULE, order.PayableAt, "到付地点", needMappingModule);
if (portRlt.Succeeded) if (portRlt.Succeeded)
primaryModel.PAYABLEATID = portRlt.Data; primaryModel.PAYABLEATID = portRlt.Data;
@ -2413,9 +2420,11 @@ namespace DS.WMS.Core.Op.Method
/// <param name="moduleName">模块代码</param> /// <param name="moduleName">模块代码</param>
/// <param name="portName">港口名称</param> /// <param name="portName">港口名称</param>
/// <param name="portCategory">港口分类(装货港、卸货港、交货地等)</param> /// <param name="portCategory">港口分类(装货港、卸货港、交货地等)</param>
/// <param name="isNeedMapping">是否必需用映射</param>
/// <returns></returns> /// <returns></returns>
/// <exception cref="Exception"></exception> /// <exception cref="Exception"></exception>
private DataResult<string> GetPortEDICode(long portId,List<CodePort> codePortList,List<MappingPort> mapPortList, long carrierId, string moduleName,string portName,string portCategory) private DataResult<string> GetPortEDICode(long portId,List<CodePort> codePortList,List<MappingPort> mapPortList, long carrierId, string moduleName,
string portName,string portCategory,string needMappingModule = "")
{ {
//如果历史港口映射有记录直接返回 //如果历史港口映射有记录直接返回
if (mapPortList.Any(a => a.LinkId == portId)) if (mapPortList.Any(a => a.LinkId == portId))
@ -2430,8 +2439,15 @@ namespace DS.WMS.Core.Op.Method
var tenantDb = saasService.GetBizDbScopeById(user.TenantId); var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
string MappingModule = CONST_MAPPING_MODULE;
if (!string.IsNullOrWhiteSpace(needMappingModule))
{
MappingModule = needMappingModule;
}
var mapPortInfo = tenantDb.Queryable<MappingPort>() var mapPortInfo = tenantDb.Queryable<MappingPort>()
.First(a => a.Module.Equals(CONST_MAPPING_MODULE, StringComparison.OrdinalIgnoreCase) && a.CarrierId == carrierId && a.LinkId == portId); .First(a => a.Module.Equals(MappingModule, StringComparison.OrdinalIgnoreCase) && a.CarrierId == carrierId && a.LinkId == portId);
if (mapPortInfo != null) if (mapPortInfo != null)
{ {
@ -2442,6 +2458,11 @@ namespace DS.WMS.Core.Op.Method
return DataResult<string>.FailedData(mapPortInfo.MapCode); return DataResult<string>.FailedData(mapPortInfo.MapCode);
} }
else
{
if (!string.IsNullOrWhiteSpace(needMappingModule))
throw new Exception($"{portCategory} {portName} 未配置模块{needMappingModule} 映射");
}
if (codePortList.Any(a => a.Id == portId)) if (codePortList.Any(a => a.Id == portId))
{ {

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<NameOfLastUsedPublishProfile>D:\Code\ds8-solution-pro\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> <NameOfLastUsedPublishProfile>E:\MyCode\Dongsheng8\ds-wms-service\DS.WMS.OpApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID> <Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath> <Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
</PropertyGroup> </PropertyGroup>

Loading…
Cancel
Save