|
|
|
@ -56,9 +56,6 @@ namespace djy.Service.Ams
|
|
|
|
|
var dto = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>()
|
|
|
|
|
.Where(x => x.IsDel != true && x.CompID == user.CompId)
|
|
|
|
|
.WhereIf(req.MBLNO != null, x => x.MBLNO.Contains(req.MBLNO.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报" || x.ReportState == "接收失败")
|
|
|
|
|
.WhereIf(req.ReportState == "1", x => !(x.ReportState == "未申报" || x.ReportState == "接收失败"))
|
|
|
|
|
.WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState))
|
|
|
|
|
.WhereIf(req.PORTDISCHARGECode != null, x => x.PORTDISCHARGECode == req.PORTDISCHARGECode)
|
|
|
|
|
.WhereIf(req.LoadingPortCode != null, x => x.LoadingPortCode == req.LoadingPortCode)
|
|
|
|
|
.WhereIf(req.UserName != null, x => x.UserName.Contains(req.UserName.Trim()))
|
|
|
|
@ -76,6 +73,9 @@ namespace djy.Service.Ams
|
|
|
|
|
item.HistoryDto = historyDto;
|
|
|
|
|
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == item.GID)
|
|
|
|
|
.WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报" || x.ReportState == "接收失败")
|
|
|
|
|
.WhereIf(req.ReportState == "1", x => !(x.ReportState == "未申报" || x.ReportState == "接收失败"))
|
|
|
|
|
.WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState))
|
|
|
|
|
.ToList<AMS_HouseDto>();
|
|
|
|
|
item.HouseDto = hodto;
|
|
|
|
|
if (hodto != null)
|
|
|
|
@ -136,7 +136,6 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
return "-1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dto.GID.IsNull())
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
@ -149,7 +148,6 @@ namespace djy.Service.Ams
|
|
|
|
|
master.CompID = user.CompId;
|
|
|
|
|
master.CompName = user.COMNAME;
|
|
|
|
|
master.IsDel = false;
|
|
|
|
|
master.ReportState = "未申报";
|
|
|
|
|
master.PORTDISCHARGE = DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.PORTDISCHARGECode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
master.CARRIER = DbBus.Get(DbList.Common).Select<CodeCarrier>().Where(x => x.Code == master.CARRIERID).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
master.LoadingPort = DbBus.Get(DbList.Common).Select<CodePortLoad>().Where(x => x.EdiCode == master.LoadingPortCode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
@ -180,7 +178,7 @@ namespace djy.Service.Ams
|
|
|
|
|
house.PID = master.GID;
|
|
|
|
|
house.IsDel = false;
|
|
|
|
|
house.State = "0";
|
|
|
|
|
|
|
|
|
|
house.ReportState = "未申报";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(house).ExecuteAffrows();
|
|
|
|
|
if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
|
|
|
|
|
{
|
|
|
|
@ -205,7 +203,143 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
|
if (dto.HouseDto[0].ReportState == "未申报")
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
|
{
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(w => w.GID == dto.GID).ToOne();
|
|
|
|
|
master.CARRIERID = dto.CARRIERID;
|
|
|
|
|
master.MBLNO = dto.MBLNO;
|
|
|
|
|
master.VESSEL = dto.VESSEL;
|
|
|
|
|
master.VOYNO = dto.VOYNO;
|
|
|
|
|
master.ShippingType = dto.ShippingType;
|
|
|
|
|
master.SHIPPERADDR = dto.SHIPPERADDR;
|
|
|
|
|
master.ETA = dto.ETA;
|
|
|
|
|
master.ETD = dto.ETD;
|
|
|
|
|
master.LastUpdate = DateTime.Now;
|
|
|
|
|
master.ShippingNo = dto.ShippingNo;
|
|
|
|
|
master.ConsignmentType = dto.ConsignmentType;
|
|
|
|
|
master.LoadingPortCode = dto.LoadingPortCode;
|
|
|
|
|
master.PORTDISCHARGECode = dto.PORTDISCHARGECode;
|
|
|
|
|
master.LastNoUsPortCode = dto.LastNoUsPortCode;
|
|
|
|
|
master.PORTDISCHARGE = DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.PORTDISCHARGECode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
master.CARRIER = DbBus.Get(DbList.Common).Select<CodeCarrier>().Where(x => x.Code == master.CARRIERID).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
master.LoadingPort = DbBus.Get(DbList.Common).Select<CodePortLoad>().Where(x => x.EdiCode == master.LoadingPortCode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
master.LastNoUsPort = DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.LastNoUsPortCode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().SetSource(master).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
List<string> houseid = dto.HouseDto.Select(x => x.GID).ToList();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Delete<AMS_House>().Where(w => w.PID == master.GID && !houseid.Contains(w.GID)).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Delete<AMS_Cntrno>().Where(w => w.PID == master.GID && !houseid.Contains(w.HID)).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
foreach (var item in dto.HouseDto)
|
|
|
|
|
{
|
|
|
|
|
var house = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(w => w.GID == item.GID).ToOne();
|
|
|
|
|
if (house != null)
|
|
|
|
|
{
|
|
|
|
|
house.HBLNo = item.HBLNo;
|
|
|
|
|
house.SHIPPERNAME = item.SHIPPERNAME;
|
|
|
|
|
house.SHIPPERADDR = item.SHIPPERADDR;
|
|
|
|
|
house.SHIPPERTEL = item.SHIPPERTEL;
|
|
|
|
|
house.CONSIGNEEName = item.CONSIGNEEName;
|
|
|
|
|
house.CONSIGNEEDADDR = item.CONSIGNEEDADDR;
|
|
|
|
|
house.CONSIGNEETEL = item.CONSIGNEETEL;
|
|
|
|
|
house.NOTIFYPARTYNAME = item.NOTIFYPARTYNAME;
|
|
|
|
|
house.NOTIFYPARTYADDR = item.NOTIFYPARTYADDR;
|
|
|
|
|
house.NOTIFYPARTYTEL = item.NOTIFYPARTYTEL;
|
|
|
|
|
house.SHIPPERCountry = item.SHIPPERCountry;
|
|
|
|
|
house.SHIPPERCountryCode = item.SHIPPERCountryCode;
|
|
|
|
|
house.SHIPPERCity = item.SHIPPERCity;
|
|
|
|
|
house.CONSIGNEECountry = item.CONSIGNEECountry;
|
|
|
|
|
house.CONSIGNEECountryCode = item.CONSIGNEECountryCode;
|
|
|
|
|
house.CONSIGNEECity = item.CONSIGNEECity;
|
|
|
|
|
house.NOTIFYPARTYCountry = item.NOTIFYPARTYCountry;
|
|
|
|
|
house.NOTIFYPARTYCountryCode = item.NOTIFYPARTYCountryCode;
|
|
|
|
|
house.NOTIFYPARTYCity = item.NOTIFYPARTYCity;
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().SetSource(house).ExecuteAffrows();
|
|
|
|
|
if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in item.CntrnoDto)
|
|
|
|
|
{
|
|
|
|
|
var cntrno = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(w => w.GID == it.GID).ToOne();
|
|
|
|
|
if (cntrno != null)
|
|
|
|
|
{
|
|
|
|
|
cntrno.CNTRNO = it.CNTRNO;
|
|
|
|
|
cntrno.SEALNO = it.SEALNO;
|
|
|
|
|
cntrno.CTNALL = it.CTNALL;
|
|
|
|
|
cntrno.HSCode = it.HSCode;
|
|
|
|
|
cntrno.ProductName = it.ProductName;
|
|
|
|
|
cntrno.MARKS = it.MARKS;
|
|
|
|
|
cntrno.PKGS = it.PKGS;
|
|
|
|
|
cntrno.KINDPKGS = it.KINDPKGS;
|
|
|
|
|
cntrno.KGS = it.KGS;
|
|
|
|
|
cntrno.CBM = it.CBM;
|
|
|
|
|
cntrno.DUNNO = it.DUNNO;
|
|
|
|
|
cntrno.LINKMAN = it.LINKMAN;
|
|
|
|
|
cntrno.KINDPKGSCode = it.KINDPKGSCode;
|
|
|
|
|
cntrno.OriginCountry = it.OriginCountry;
|
|
|
|
|
cntrno.OriginCountryCode = it.OriginCountryCode;
|
|
|
|
|
cntrno.LINKMANTel = it.LINKMANTel;
|
|
|
|
|
cntrno.DangerGrade = it.DangerGrade;
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Cntrno>().SetSource(cntrno).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
cntrno = it.MapTo<AMS_Cntrno>();
|
|
|
|
|
cntrno.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
cntrno.PID = master.GID;
|
|
|
|
|
cntrno.HID = house.GID;
|
|
|
|
|
cntrno.IsDel = false;
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
house = item.MapTo<AMS_House>();
|
|
|
|
|
|
|
|
|
|
house.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
house.PID = master.GID;
|
|
|
|
|
house.IsDel = false;
|
|
|
|
|
house.State = "0";
|
|
|
|
|
house.ReportState = "未申报";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(house).ExecuteAffrows();
|
|
|
|
|
if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in item.CntrnoDto)
|
|
|
|
|
{
|
|
|
|
|
AMS_Cntrno cntrno = it.MapTo<AMS_Cntrno>();
|
|
|
|
|
|
|
|
|
|
cntrno.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
cntrno.PID = master.GID;
|
|
|
|
|
cntrno.HID = house.GID;
|
|
|
|
|
cntrno.IsDel = false;
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "已修改";
|
|
|
|
|
history.Type = "修改";
|
|
|
|
|
history.Operator = user.SHOWNAME;
|
|
|
|
|
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "修改了单据";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
guid = master.GID;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
|
{
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(w => w.GID == dto.GID).ToOne();
|
|
|
|
|
master.CARRIERID = dto.CARRIERID;
|
|
|
|
@ -227,12 +361,9 @@ namespace djy.Service.Ams
|
|
|
|
|
master.LoadingPort = DbBus.Get(DbList.Common).Select<CodePortLoad>().Where(x => x.EdiCode == master.LoadingPortCode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
master.LastNoUsPort = DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.LastNoUsPortCode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().SetSource(master).ExecuteAffrows();
|
|
|
|
|
#region 注释掉原有编辑逻辑
|
|
|
|
|
//DbBus.Get(DbList.AMSCenter).Delete<AMS_House>().Where(w => w.PID == master.GID).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
//DbBus.Get(DbList.AMSCenter).Delete<AMS_Cntrno>().Where(w => w.PID == master.GID).ExecuteAffrows();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<string> houseid = dto.HouseDto.Select(x => x.GID).ToList();
|
|
|
|
|
|
|
|
|
|
foreach (var item in dto.HouseDto)
|
|
|
|
|
{
|
|
|
|
|
var house = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(w => w.GID == item.GID).ToOne();
|
|
|
|
@ -294,35 +425,8 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
|
|
house = item.MapTo<AMS_House>();
|
|
|
|
|
|
|
|
|
|
house.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
house.PID = master.GID;
|
|
|
|
|
house.IsDel = false;
|
|
|
|
|
house.State = "0";
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(house).ExecuteAffrows();
|
|
|
|
|
if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in item.CntrnoDto)
|
|
|
|
|
{
|
|
|
|
|
AMS_Cntrno cntrno = it.MapTo<AMS_Cntrno>();
|
|
|
|
|
|
|
|
|
|
cntrno.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
cntrno.PID = master.GID;
|
|
|
|
|
cntrno.HID = house.GID;
|
|
|
|
|
cntrno.IsDel = false;
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
@ -332,41 +436,16 @@ namespace djy.Service.Ams
|
|
|
|
|
history.Operator = user.SHOWNAME;
|
|
|
|
|
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "修改了单据";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
#region 注释掉原有编辑逻辑
|
|
|
|
|
//if (dto.HouseDto != null && dto.HouseDto.Count() > 0)
|
|
|
|
|
//{
|
|
|
|
|
// foreach (var item in dto.HouseDto)
|
|
|
|
|
// {
|
|
|
|
|
// AMS_House house = item.MapTo<AMS_House>();
|
|
|
|
|
// house.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
// house.PID = master.GID;
|
|
|
|
|
// house.IsDel = false;
|
|
|
|
|
// house.State = "0";
|
|
|
|
|
// DbBus.Get(DbList.AMSCenter).Insert(house).ExecuteAffrows();
|
|
|
|
|
// if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
|
|
|
|
|
// {
|
|
|
|
|
// foreach (var it in item.CntrnoDto)
|
|
|
|
|
// {
|
|
|
|
|
// AMS_Cntrno cntrno = it.MapTo<AMS_Cntrno>();
|
|
|
|
|
// cntrno.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
// cntrno.PID = master.GID;
|
|
|
|
|
// cntrno.HID = house.GID;
|
|
|
|
|
// cntrno.IsDel = false;
|
|
|
|
|
// DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
guid = master.GID;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return guid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 第三方接口
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 发送接口
|
|
|
|
@ -374,29 +453,165 @@ namespace djy.Service.Ams
|
|
|
|
|
/// <param name="Gid"></param>
|
|
|
|
|
/// <param name="userid"></param>
|
|
|
|
|
/// <param name="docType"></param>
|
|
|
|
|
public async Task<Response> SendDE(string Gid, User user , string docType)
|
|
|
|
|
public async Task<Response> SendDE(string Gid, User user , string docType, string hid = null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
Response req = new Response();
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string[] id = Gid.Split(',');
|
|
|
|
|
string[] House = null;
|
|
|
|
|
if (hid != null) {
|
|
|
|
|
House = hid.Split(',');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (string oid in id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oid != "")
|
|
|
|
|
{
|
|
|
|
|
var docContent = "";
|
|
|
|
|
var fin = new FinanceService();
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x =>x.IsDel != true && x.CompID == user.CompId && x.GID == oid).ToOne();
|
|
|
|
|
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && x.State == "0").ToList<AMS_HouseDto>();
|
|
|
|
|
if (docType != "AMSD")
|
|
|
|
|
var hodto = new List<AMS_HouseDto>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
#region docContent 新增 重发 修改
|
|
|
|
|
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && x.State == "0").
|
|
|
|
|
ToList<AMS_HouseDto>();
|
|
|
|
|
#region docContent 新增
|
|
|
|
|
|
|
|
|
|
if (docType == "AMSAR" && !(master.ReportState == "删单成功" || master.MateState == "接收失败"))
|
|
|
|
|
var cARRIERIDList = DbBus.Get(DbList.Common).Select<MappingCarrier>().Where(map => map.Module == "AMS").ToList();
|
|
|
|
|
var portList = DbBus.Get(DbList.Common).Select<CodePort>().ToList();
|
|
|
|
|
var containerTypeList = DbBus.Get(DbList.Common).Select<MappingCtn>().Where(map => map.Module == "AMS").ToList();
|
|
|
|
|
var packageList = DbBus.Get(DbList.Common).Select<MappingPackage>().Where(map => map.Module == "AMS").ToList();
|
|
|
|
|
MasterBillInfoDto dto = new MasterBillInfoDto();
|
|
|
|
|
masterBillInfo masterBillInfo = new masterBillInfo();
|
|
|
|
|
|
|
|
|
|
masterBillInfo.masterBillNo = cARRIERIDList.Where(x => x.Code == master.CARRIERID).Select(x => x.MapCode).FirstOrDefault() + master.MBLNO;
|
|
|
|
|
masterBillInfo.shippingNo = null;
|
|
|
|
|
masterBillInfo.shipCompany = cARRIERIDList.Where(x => x.Code == master.CARRIERID).Select(x => x.MapCode).FirstOrDefault();
|
|
|
|
|
masterBillInfo.vessel = master.VESSEL;
|
|
|
|
|
masterBillInfo.voyage = master.VOYNO;
|
|
|
|
|
masterBillInfo.requesterDea = sysOptionConfig.Webconfig.requesterDea;
|
|
|
|
|
masterBillInfo.consignmentType = master.ConsignmentType;
|
|
|
|
|
masterBillInfo.loadHarbour = master.LoadingPort;
|
|
|
|
|
masterBillInfo.loadHarbourCode = master.LoadingPortCode;
|
|
|
|
|
masterBillInfo.dischargeHarbour = master.PORTDISCHARGE;
|
|
|
|
|
masterBillInfo.dischargeHarbourCode = portList.Where(x => x.Code == master.PORTDISCHARGECode).Select(x => x.EdiCode).FirstOrDefault();
|
|
|
|
|
masterBillInfo.lastForeignHarbour = master.LastNoUsPort;
|
|
|
|
|
masterBillInfo.lastForeignHarbourCode = portList.Where(x => x.Code == master.LastNoUsPortCode).Select(x => x.EdiCode).FirstOrDefault();
|
|
|
|
|
masterBillInfo.loadDate = Convert.ToDateTime(master.ETA).ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
masterBillInfo.estimatedArrivalTime = Convert.ToDateTime(master.ETD).ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
masterBillInfo.filingType = master.ShippingType;
|
|
|
|
|
dto.masterBillInfo = masterBillInfo;
|
|
|
|
|
List<HouseBillInfoListItem> houseBillInfoListItems = new List<HouseBillInfoListItem>();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
ETD = master.ETD,
|
|
|
|
|
VOYNO = master.VOYNO,
|
|
|
|
|
VESSEL = master.VESSEL,
|
|
|
|
|
HBLNO = item.HBLNo,
|
|
|
|
|
SENDUSERID = user.GID,
|
|
|
|
|
LURURENID = user.GID,
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
BSTYPE = 15,
|
|
|
|
|
SENDTYPE = 0,
|
|
|
|
|
BSNO = oid.ToString(),
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
}
|
|
|
|
|
, 0);
|
|
|
|
|
if (!getfinrs.Status)
|
|
|
|
|
{
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = getfinrs.Message;
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
HouseBillInfoListItem houseinfo = new HouseBillInfoListItem();
|
|
|
|
|
houseinfo.businessId = item.GID;
|
|
|
|
|
houseinfo.shippingNo = null;
|
|
|
|
|
houseinfo.houseBillNo = item.HBLNo;
|
|
|
|
|
houseinfo.sendAddress = item.SHIPPERADDR;
|
|
|
|
|
houseinfo.sendName = item.SHIPPERNAME;
|
|
|
|
|
houseinfo.sendCity = item.SHIPPERCity;
|
|
|
|
|
houseinfo.sendCountry = item.SHIPPERCountry;
|
|
|
|
|
houseinfo.sendCountryCode = item.SHIPPERCountryCode;
|
|
|
|
|
houseinfo.receiveAddress = item.CONSIGNEEDADDR;
|
|
|
|
|
houseinfo.receiveName = item.CONSIGNEEName;
|
|
|
|
|
houseinfo.receiveCity = item.CONSIGNEECity;
|
|
|
|
|
houseinfo.receiveCountry = item.CONSIGNEECountry;
|
|
|
|
|
houseinfo.receiveCountryCode = item.CONSIGNEECountryCode;
|
|
|
|
|
houseinfo.notifyAddress = item.NOTIFYPARTYADDR;
|
|
|
|
|
houseinfo.notifyName = item.NOTIFYPARTYNAME;
|
|
|
|
|
houseinfo.notifyCity = item.NOTIFYPARTYCity;
|
|
|
|
|
houseinfo.notifyCountry = item.NOTIFYPARTYCountry;
|
|
|
|
|
houseinfo.notifyCountryCode = item.NOTIFYPARTYCountryCode;
|
|
|
|
|
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => (x.IsDel == false || x.IsDel == null) && x.HID == item.GID).ToList();
|
|
|
|
|
CtnInfo CtnInfo = new CtnInfo();
|
|
|
|
|
List<InsertListItem> list = new List<InsertListItem>();
|
|
|
|
|
foreach (var it in cnt)
|
|
|
|
|
{
|
|
|
|
|
InsertListItem insertList = new InsertListItem();
|
|
|
|
|
insertList.containerMark = null;
|
|
|
|
|
insertList.containerType = containerTypeList.Where(x => x.Code == it.CTNALL).Select(x => x.MapCode).FirstOrDefault();
|
|
|
|
|
insertList.enProductName = it.ProductName;
|
|
|
|
|
insertList.containerNo = it.CNTRNO;
|
|
|
|
|
insertList.sealNo = it.SEALNO;
|
|
|
|
|
insertList.digit = it.PKGS.ToString();
|
|
|
|
|
insertList.grossWeight = it.KGS.ToString();
|
|
|
|
|
insertList.volume = it.CBM.ToString();
|
|
|
|
|
insertList.packing = packageList.Where(x => x.Code == it.KINDPKGSCode).Select(x => x.MapName).FirstOrDefault();
|
|
|
|
|
insertList.packingCode = packageList.Where(x => x.Code == it.KINDPKGSCode).Select(x => x.MapCode).FirstOrDefault();
|
|
|
|
|
insertList.shippingMark = it.MARKS;
|
|
|
|
|
insertList.secondSealNo = null;
|
|
|
|
|
insertList.originCountry = "CHINA";
|
|
|
|
|
insertList.originCountryCode = "CN";
|
|
|
|
|
insertList.unCode = it.DUNNO;
|
|
|
|
|
insertList.dangerGrade = it.DangerGrade;
|
|
|
|
|
insertList.dangerContact = "";
|
|
|
|
|
insertList.dangerContactTel = "";
|
|
|
|
|
insertList.dangerMemo = "";
|
|
|
|
|
insertList.ignite = "";
|
|
|
|
|
list.Add(insertList);
|
|
|
|
|
CtnInfo.insertList = list;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
houseinfo.ctnInfo = CtnInfo;
|
|
|
|
|
houseBillInfoListItems.Add(houseinfo);
|
|
|
|
|
}
|
|
|
|
|
dto.houseBillInfoList = houseBillInfoListItems;
|
|
|
|
|
var data = JsonConvert.SerializeObject(dto);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AMSDocContent aMSDoc = new AMSDocContent();
|
|
|
|
|
aMSDoc.fromdea = "n";
|
|
|
|
|
aMSDoc.todea = "n";
|
|
|
|
|
aMSDoc.editype = "AMSDOC";
|
|
|
|
|
aMSDoc.port = "Ningbo";
|
|
|
|
|
aMSDoc.masterBillInfo = dto;
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDoc);
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDoc).ToBase64();
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSAR" || docType == "AMSM") {
|
|
|
|
|
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && x.State == "1").
|
|
|
|
|
WhereIf(hid != null, x => House.Contains(x.GID)).
|
|
|
|
|
ToList<AMS_HouseDto>();
|
|
|
|
|
|
|
|
|
|
#region docContent 修改 重发
|
|
|
|
|
if (string.IsNullOrEmpty(hid))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "当前状态不能重发!如有疑问,请联系相关客服!";
|
|
|
|
|
req.Message = "没有相关货代提单号id";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
var cARRIERIDList = DbBus.Get(DbList.Common).Select<MappingCarrier>().Where(map => map.Module == "AMS").ToList();
|
|
|
|
@ -426,14 +641,21 @@ namespace djy.Service.Ams
|
|
|
|
|
List<HouseBillInfoListItem> houseBillInfoListItems = new List<HouseBillInfoListItem>();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
if (docType == "AMSAR" || docType == "AMSDOC")
|
|
|
|
|
if (docType == "AMSAR" && !(item.ReportState == "删单成功" || item.MateState == "接收失败"))
|
|
|
|
|
{
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "当前状态不能重发!如有疑问,请联系相关客服!";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (docType == "AMSAR")
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
ETD=master.ETD,
|
|
|
|
|
VOYNO =master.VOYNO,
|
|
|
|
|
VESSEL =master.VESSEL,
|
|
|
|
|
HBLNO=item.HBLNo,
|
|
|
|
|
ETD = master.ETD,
|
|
|
|
|
VOYNO = master.VOYNO,
|
|
|
|
|
VESSEL = master.VESSEL,
|
|
|
|
|
HBLNO = item.HBLNo,
|
|
|
|
|
SENDUSERID = user.GID,
|
|
|
|
|
LURURENID = user.GID,
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
@ -470,7 +692,7 @@ namespace djy.Service.Ams
|
|
|
|
|
houseinfo.notifyCity = item.NOTIFYPARTYCity;
|
|
|
|
|
houseinfo.notifyCountry = item.NOTIFYPARTYCountry;
|
|
|
|
|
houseinfo.notifyCountryCode = item.NOTIFYPARTYCountryCode;
|
|
|
|
|
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => (x.IsDel == false || x.IsDel == null) && x.HID == item.GID).ToList();
|
|
|
|
|
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel!=true && x.HID == item.GID).ToList();
|
|
|
|
|
CtnInfo CtnInfo = new CtnInfo();
|
|
|
|
|
List<InsertListItem> list = new List<InsertListItem>();
|
|
|
|
|
foreach (var it in cnt)
|
|
|
|
@ -517,18 +739,32 @@ namespace djy.Service.Ams
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDoc).ToBase64();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (master.ReportState == "删单成功")
|
|
|
|
|
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && x.State == "1").
|
|
|
|
|
WhereIf(hid != null, x => House.Contains(x.GID)).
|
|
|
|
|
ToList<AMS_HouseDto>();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
if (item.ReportState == "删单成功")
|
|
|
|
|
{
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "已删除单据不可以再次删除";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (string.IsNullOrEmpty(hid))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "已删除单据不可以再次删除";
|
|
|
|
|
req.Message = "没有相关货代提单号id";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
AMSDDto aMSDDto = new AMSDDto();
|
|
|
|
|
aMSDDto.fromdea = "n";
|
|
|
|
|
aMSDDto.ids = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel!=true && x.PID == oid).ToList().Select(x => x.GID).ToList();
|
|
|
|
|
aMSDDto.ids = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && House.Contains(x.GID)).ToList().Select(x => x.GID).ToList();
|
|
|
|
|
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDDto).ToBase64();
|
|
|
|
|
}
|
|
|
|
@ -641,7 +877,7 @@ namespace djy.Service.Ams
|
|
|
|
|
if (docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.PID == oid).ExecuteAffrows();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
@ -665,7 +901,7 @@ namespace djy.Service.Ams
|
|
|
|
|
else if (docType == "AMSAR")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "重发发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { ReportState = "已提交", NewNotice = "重发发送成功" }).Where(w => House.Contains(w.GID)).ExecuteAffrows();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
@ -688,12 +924,12 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSM")
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "修改发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { ReportState = "已提交", NewNotice = "修改发送成功" }).Where(w => House.Contains(w.GID)).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "删除发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { ReportState = "已提交", NewNotice = "删除发送成功" }).Where(w => House.Contains(w.GID)).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -725,134 +961,133 @@ namespace djy.Service.Ams
|
|
|
|
|
_LogsAdd("SaveReceipt", "post", $"AMS接口推送:{msg}");
|
|
|
|
|
if (retdto != null)
|
|
|
|
|
{
|
|
|
|
|
var masterid = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.GID == retdto.businessId).ToList().Select(x => x.PID).FirstOrDefault();
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => x.GID == masterid).ToOne();
|
|
|
|
|
var masterid = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.GID == retdto.businessId).ToList().Select(x => x.PID).FirstOrDefault();
|
|
|
|
|
var house = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.GID == retdto.businessId).ToOne();
|
|
|
|
|
|
|
|
|
|
if (retdto.status == "W2")
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "0" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
var houses = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == master.GID && x.State != "1").ToList();
|
|
|
|
|
if (houses != null && houses.Count == 0)
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "1" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
if (house != null)
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配成功";
|
|
|
|
|
history.Type = "匹配成功";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "海关接收成功";
|
|
|
|
|
history.Remark = "您的单据" + house.HBLNo + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "海关接收成功";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
if (master.NewNotice == "删除发送成功")
|
|
|
|
|
if (house.NewNotice == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "删单成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "删单成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "修改发送成功")
|
|
|
|
|
if (house.NewNotice == "修改发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "修改成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "修改成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
if (house.NewNotice == "重发发送成功" || house.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "接收成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "接收成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
var faillist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == master.GID && x.State == "0").ToList();
|
|
|
|
|
}
|
|
|
|
|
else if (retdto.status == "1Y")
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "0" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
var houses = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == master.GID && x.State != "1").ToList();
|
|
|
|
|
if (houses != null && houses.Count == 0)
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "1" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
if (house != null )
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配成功";
|
|
|
|
|
history.Type = "匹配成功";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "船司匹配成功";
|
|
|
|
|
history.Remark = "您的单据"+house.HBLNo+"于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "船司匹配成功";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
if (master.NewNotice == "删除发送成功")
|
|
|
|
|
if (house.NewNotice == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "删单成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "删单成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "修改发送成功")
|
|
|
|
|
if (house.NewNotice == "修改发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "修改成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "修改成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
if (house.NewNotice == "重发发送成功" || house.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "接收成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "接收成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var faillist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == master.GID && x.State == "0").ToList();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (retdto.status == "3Z")
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "0" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
var houses = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == master.GID && x.State != "1").ToList();
|
|
|
|
|
if (houses != null && houses.Count == 0)
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "1" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
if (house != null )
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配成功";
|
|
|
|
|
history.Type = "匹配成功";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "ISF匹配成功";
|
|
|
|
|
history.Remark = "您的单据"+house.HBLNo+"于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "ISF匹配成功";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
if (master.NewNotice == "删除发送成功")
|
|
|
|
|
if (house.NewNotice == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "删单成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "删单成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "修改发送成功")
|
|
|
|
|
if (house.NewNotice == "修改发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "修改成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "修改成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
if (house.NewNotice == "重发发送成功" || house.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "接收成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "接收成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
var faillist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == master.GID && x.State == "0").ToList();
|
|
|
|
|
var faillist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == masterid && x.State == "0").ToList();
|
|
|
|
|
}
|
|
|
|
|
else if (retdto.status == "W1")
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配失败";
|
|
|
|
|
history.Type = "匹配失败";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "海关拒绝";
|
|
|
|
|
history.Remark = "您的单据"+house.HBLNo+"于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "海关拒绝";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "1" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
if (master.NewNotice == "删除发送成功")
|
|
|
|
|
|
|
|
|
|
if (house.NewNotice == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "删单失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "删单失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "修改发送成功")
|
|
|
|
|
if (house.NewNotice == "修改发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "修改失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "修改失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
if (house.NewNotice == "重发发送成功" || house.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "接收失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "接收失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -860,57 +1095,57 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配失败";
|
|
|
|
|
history.Type = "匹配失败";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "箱货信息不匹配";
|
|
|
|
|
history.Remark = "您的单据" + house.HBLNo+ "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "箱货信息不匹配";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "1" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
if (master.NewNotice == "删除发送成功")
|
|
|
|
|
|
|
|
|
|
if (house.NewNotice == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "删单失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "删单失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "修改发送成功")
|
|
|
|
|
if (house.NewNotice == "修改发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "修改失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "修改失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
if (house.NewNotice == "重发发送成功" || house.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "接收失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "接收失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配失败";
|
|
|
|
|
history.Type = "匹配失败";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "失败";
|
|
|
|
|
history.Remark = "您的单据" + house.HBLNo+ "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "匹配失败";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { State = "1" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
if (master.NewNotice == "删除发送成功")
|
|
|
|
|
|
|
|
|
|
if (house.NewNotice == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "删单失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "删单失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "修改发送成功")
|
|
|
|
|
if (house.NewNotice == "修改发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "修改失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "修改失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
if (house.NewNotice == "重发发送成功" || house.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "接收失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "接收失败" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -1310,5 +1545,28 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#region 删除模板
|
|
|
|
|
public void DeleteTemplate(string ids)
|
|
|
|
|
{
|
|
|
|
|
string[] id = ids.Split(',');
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
|
{
|
|
|
|
|
foreach (string oid in id)
|
|
|
|
|
{
|
|
|
|
|
if (oid != "")
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Delete<AMS_AddrTemplate>().Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|