|
|
|
@ -227,45 +227,139 @@ 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_House>().Where(w => w.PID == master.GID).ExecuteAffrows();
|
|
|
|
|
//DbBus.Get(DbList.AMSCenter).Delete<AMS_Cntrno>().Where(w => w.PID == master.GID).ExecuteAffrows();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Delete<AMS_Cntrno>().Where(w => w.PID == master.GID).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();
|
|
|
|
|
|
|
|
|
|
if (dto.HouseDto != null && dto.HouseDto.Count() > 0)
|
|
|
|
|
foreach (var item in dto.HouseDto)
|
|
|
|
|
{
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
AMS_House house = item.MapTo<AMS_House>();
|
|
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
#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;
|
|
|
|
@ -293,7 +387,8 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
var docContent = "";
|
|
|
|
|
var fin = new FinanceService();
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => (x.IsDel == false || x.IsDel == null) && x.CompID == user.CompId && x.GID == oid).ToOne();
|
|
|
|
|
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")
|
|
|
|
|
{
|
|
|
|
|
#region docContent 新增 重发 修改
|
|
|
|
@ -304,29 +399,6 @@ namespace djy.Service.Ams
|
|
|
|
|
req.Message = "当前状态不能重发!如有疑问,请联系相关客服!";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (docType == "AMSAR" || docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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();
|
|
|
|
@ -351,10 +423,34 @@ namespace djy.Service.Ams
|
|
|
|
|
masterBillInfo.estimatedArrivalTime = Convert.ToDateTime(master.ETD).ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
masterBillInfo.filingType = master.ShippingType;
|
|
|
|
|
dto.masterBillInfo = masterBillInfo;
|
|
|
|
|
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == oid && x.State == "0").ToList<AMS_HouseDto>();
|
|
|
|
|
List<HouseBillInfoListItem> houseBillInfoListItems = new List<HouseBillInfoListItem>();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
if (docType == "AMSAR" || docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
@ -432,7 +528,7 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
AMSDDto aMSDDto = new AMSDDto();
|
|
|
|
|
aMSDDto.fromdea = "n";
|
|
|
|
|
aMSDDto.ids = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && 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).ToList().Select(x => x.GID).ToList();
|
|
|
|
|
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDDto).ToBase64();
|
|
|
|
|
}
|
|
|
|
@ -512,7 +608,7 @@ namespace djy.Service.Ams
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
if (code == "T" && result == "true")
|
|
|
|
|
{
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = oid;
|
|
|
|
@ -544,36 +640,51 @@ namespace djy.Service.Ams
|
|
|
|
|
|
|
|
|
|
if (docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
SENDUSERID = user.GID,
|
|
|
|
|
LURURENID = user.GID,
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
BSTYPE = 15,
|
|
|
|
|
SENDTYPE = 0,
|
|
|
|
|
BSNO = oid.ToString(),
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
CARRIER=master.CARRIER,
|
|
|
|
|
ETD = master.ETA,
|
|
|
|
|
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(),
|
|
|
|
|
}, 1);
|
|
|
|
|
}
|
|
|
|
|
, 1);
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSAR")
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "重发发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
SENDUSERID = user.GID,
|
|
|
|
|
LURURENID = user.GID,
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
BSTYPE = 15,
|
|
|
|
|
SENDTYPE = 0,
|
|
|
|
|
BSNO = oid.ToString(),
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
CARRIER = master.CARRIER,
|
|
|
|
|
ETD = master.ETA,
|
|
|
|
|
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(),
|
|
|
|
|
}, 1);
|
|
|
|
|
}
|
|
|
|
|
, 1);
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "重发发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSM")
|
|
|
|
|
{
|
|
|
|
@ -584,6 +695,7 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "删除发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
@ -615,36 +727,74 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
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();
|
|
|
|
|
if (retdto.status != "W1")
|
|
|
|
|
|
|
|
|
|
if (retdto.status == "W2")
|
|
|
|
|
{
|
|
|
|
|
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 = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + 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 == "删除发送成功")
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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 = "系统管理员";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "海关接收成功";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
if (master.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();
|
|
|
|
|
}
|
|
|
|
|
if (master.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();
|
|
|
|
|
}
|
|
|
|
|
if (master.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_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关接收成功", ReportState = "修改成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
|
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 = "系统管理员";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "船司匹配成功";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
if (master.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_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "船司匹配成功", ReportState = "删单成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.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();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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 == "W1")
|
|
|
|
|
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();
|
|
|
|
@ -657,30 +807,117 @@ namespace djy.Service.Ams
|
|
|
|
|
history.State = "匹配成功";
|
|
|
|
|
history.Type = "匹配成功";
|
|
|
|
|
history.Operator = "系统管理员";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "匹配成功";
|
|
|
|
|
history.Remark = "您的单据于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "ISF匹配成功";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
if (master.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_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "删单成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.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_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "修改成功" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.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_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "ISF匹配成功", ReportState = "接收成功" }).Where(w => w.GID == master.GID).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 == "W1")
|
|
|
|
|
{
|
|
|
|
|
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 = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + 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 == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "海关拒绝", ReportState = "删单失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.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();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else if (retdto.status == "2Z")
|
|
|
|
|
{
|
|
|
|
|
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 = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + 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 == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "箱货信息不匹配", ReportState = "删单失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.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();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
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 = "系统管理员";
|
|
|
|
|
history.Remark = "您的明细单据" + retdto.businessId + "于" + 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 == "删除发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = retdto.status, NewNotice = "匹配失败", ReportState = "删单失败" }).Where(w => w.GID == master.GID).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
if (master.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();
|
|
|
|
|
}
|
|
|
|
|
if (master.NewNotice == "重发发送成功" || master.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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "未收到参数";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|