wet 2 years ago
parent a82c61c918
commit ecbe95516e

@ -135,7 +135,7 @@ namespace djy.Model.AmsDto
public string LastNoUsPortCode { get; set; }
public List<AMS_MasterHistory> HistoryDto { get; set; }
public List<AMS_HouseDto> HouseDto { get; set; } = new List<AMS_HouseDto>();
}
@ -284,6 +284,7 @@ namespace djy.Model.AmsDto
/// </summary>
public string NewNotice { get; set; }
public List<AMS_Cntrno> CntrnoDto { get; set; }
public List<AMS_MasterHistory> HistoryDto { get; set; }
}
}

@ -44,7 +44,6 @@ namespace djy.Service.Ams
string[] ReportStates = null;
if (req.ReportState != null)
{
ReportStates = req.ReportState.Split(',');
}
List<string> hou = null;
@ -55,7 +54,7 @@ namespace djy.Service.Ams
}
var dto = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>()
.Where(x => x.IsDel != true)
.WhereIf(aut.CompayId!=null,x=>x.CompID== aut.CompayId.ToString())
.WhereIf(aut.CompayId != null, x => x.CompID == aut.CompayId.ToString())
.WhereIf(aut.UserId != null, x => x.UserID == aut.UserId.ToString())
.WhereIf(req.MBLNO != null, x => x.MBLNO.Contains(req.MBLNO.Trim()))
.WhereIf(req.PORTDISCHARGECode != null, x => x.PORTDISCHARGECode == req.PORTDISCHARGECode)
@ -65,16 +64,13 @@ namespace djy.Service.Ams
.WhereIf(hou != null, x => hou.Contains(x.GID))
.WhereIf(req.BDate != null, x => x.CreateTime >= req.BDate)
.WhereIf(req.EDate != null, x => x.CreateTime <= req.EDate).OrderByDescending(x => x.CreateTime);
var list = dto.Page(req.Page, req.Limit).ToList<AMSDto>();
if (list != null)
{
foreach (var item in list)
{
var historyDto = DbBus.Get(DbList.AMSCenter).Select<AMS_MasterHistory>().Where(x => x.AM_ID == item.GID).OrderByDescending(x => x.SendTime).ToList();
item.HistoryDto = historyDto;
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x =>x.IsDel !=true && x.PID == item.GID)
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && 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 == "接收失败"))
@ -83,26 +79,30 @@ namespace djy.Service.Ams
item.HouseDto = hodto;
if (hodto != null)
{
foreach (var it in hodto)
{
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel != true && x.HID == it.GID).ToList();
it.CntrnoDto = cnt;
var historyDto = DbBus.Get(DbList.AMSCenter).Select<AMS_MasterHistory>().Where(x => x.AM_ID == it.GID).OrderByDescending(x => x.SendTime).ToList();
it.HistoryDto = historyDto;
}
}
count += hodto.Count();
}
}
result.data = list.Where(x=>x.HouseDto!=null && x.HouseDto.Count() > 0).ToList();
result.data = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList();
if (req.ReportState == "0")
{
result.count = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList().Count();
}
else {
else
{
result.count = count;
}
return result;
}
#endregion
@ -144,9 +144,9 @@ namespace djy.Service.Ams
string guid = "";
List<string> hblist = null;
hblist = dto.HouseDto.Select(x => x.HBLNo.Trim()).ToList();
var mlist= DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => x.IsDel != true && x.MBLNO == dto.MBLNO.Trim() && x.GID!=dto.GID&& x.MBLNO!="").ToOne();
var hlist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && hblist.Contains(x.HBLNo)&& x.PID!=dto.GID&&x.HBLNo!="").ToOne();
if (mlist!=null|| hlist!=null)
var mlist = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => x.IsDel != true && x.MBLNO == dto.MBLNO.Trim() && x.GID != dto.GID && x.MBLNO != "").ToOne();
var hlist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && hblist.Contains(x.HBLNo) && x.PID != dto.GID && x.HBLNo != "").ToOne();
if (mlist != null || hlist != null)
{
return "-1";
}
@ -170,24 +170,11 @@ namespace djy.Service.Ams
master.LastUpdate = DateTime.Now;
DbBus.Get(DbList.AMSCenter).Insert(master).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)
{
AMS_House house = item.MapTo<AMS_House>();
house.GID = Guid.NewGuid().ToString("N");
house.PID = master.GID;
house.IsDel = false;
@ -207,7 +194,17 @@ namespace djy.Service.Ams
DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
}
}
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = house.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();
}
}
@ -241,11 +238,11 @@ 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();
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).ExecuteAffrows();
foreach (var item in dto.HouseDto)
{
var house = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(w => w.GID == item.GID).ToOne();
@ -275,22 +272,31 @@ namespace djy.Service.Ams
{
foreach (var it in item.CntrnoDto)
{
var cntrno = new 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();
var cntrno = new 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 = item.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();
}
else
{
house = item.MapTo<AMS_House>();
house.GID = Guid.NewGuid().ToString("N");
house.PID = master.GID;
house.IsDel = false;
@ -311,110 +317,111 @@ namespace djy.Service.Ams
DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
}
}
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = house.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();
}
}
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;
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();
DbBus.Get(DbList.AMSCenter).Delete<AMS_Cntrno>().Where(w => w.PID == master.GID).ExecuteAffrows();
List<string> houseid = dto.HouseDto.Select(x => x.GID).ToList();
foreach (var item in dto.HouseDto)
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
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 = new 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;
});
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();
DbBus.Get(DbList.AMSCenter).Delete<AMS_Cntrno>().Where(w => w.PID == master.GID).ExecuteAffrows();
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();
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 = new 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 = item.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;
});
}
return guid;
}
}
#endregion
#region 第三方接口
/// <summary>
/// 发送接口
@ -422,7 +429,7 @@ 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, string hid = null)
public async Task<Response> SendDE(string Gid, User user, string docType, string hid = null)
{
Response req = new Response();
@ -430,7 +437,8 @@ namespace djy.Service.Ams
{
string[] id = Gid.Split(',');
string[] House = null;
if (hid != null) {
if (hid != null)
{
House = hid.Split(',');
}
var AMSAccount = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSAccount").ToOne();
@ -440,21 +448,18 @@ namespace djy.Service.Ams
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
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 master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => x.IsDel != true && x.CompID == user.CompId && x.GID == oid).ToOne();
var hodto = new List<AMS_HouseDto>();
if (docType == "AMSDOC")
{
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && x.State == "0").
ToList<AMS_HouseDto>();
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid && x.State == "0").
ToList<AMS_HouseDto>();
#region docContent 新增
var cARRIERIDList = DbBus.Get(DbList.Common).Select<MappingCarrier>().Where(map => map.Module == "AMS").ToList();
@ -472,10 +477,11 @@ namespace djy.Service.Ams
{
masterBillInfo.voyage = master.VOYNO.TrimAll().Substring(0, 5);
}
else {
else
{
masterBillInfo.voyage = master.VOYNO;
}
masterBillInfo.requesterDea = sysOptionConfig.Webconfig.requesterDea;
masterBillInfo.consignmentType = master.ConsignmentType;
masterBillInfo.loadHarbour = master.LoadingPort;
@ -491,30 +497,30 @@ namespace djy.Service.Ams
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;
}
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;
@ -581,10 +587,11 @@ namespace djy.Service.Ams
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 ).
WhereIf(hid != null, x => House.Contains(x.GID)).
ToList<AMS_HouseDto>();
else if (docType == "AMSAR" || docType == "AMSM")
{
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid).
WhereIf(hid != null, x => House.Contains(x.GID)).
ToList<AMS_HouseDto>();
#region docContent 修改 重发
if (string.IsNullOrEmpty(hid))
@ -614,7 +621,7 @@ namespace djy.Service.Ams
masterBillInfo.voyage = master.VOYNO;
}
masterBillInfo.requesterDea = sysOptionConfig.Webconfig.requesterDea;
masterBillInfo.consignmentType = master.ConsignmentType;
masterBillInfo.loadHarbour = master.LoadingPort;
@ -707,7 +714,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!=true && 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)
@ -758,35 +765,35 @@ namespace djy.Service.Ams
}
else
{
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid).
WhereIf(hid != null, x => House.Contains(x.GID)).
ToList<AMS_HouseDto>();
hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel != true && x.PID == oid).
WhereIf(hid != null, x => House.Contains(x.GID)).
ToList<AMS_HouseDto>();
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 = 5,
BSNO = oid.ToString(),
MBLNO = master.MBLNO.ToString(),
}
, 0);
if (!getfinrs.Status)
{
req.Code = 201;
req.Message = getfinrs.Message;
return req;
}
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 = 5,
BSNO = oid.ToString(),
MBLNO = master.MBLNO.ToString(),
}
, 0);
if (!getfinrs.Status)
{
req.Code = 201;
req.Message = getfinrs.Message;
return req;
}
if (item.ReportState == "删单成功")
{
req.Code = 201;
@ -807,7 +814,7 @@ namespace djy.Service.Ams
docContent = JsonConvert.SerializeObject(aMSDDto).ToBase64();
}
/////MD5加密
string stringSign = string.Format("{0}{1}{2}", AMSAccount.PARAMVALUE, key.PARAMVALUE, timestamp);
@ -839,7 +846,8 @@ namespace djy.Service.Ams
JObject rlt = JObject.Parse(gethtml);
var code = rlt.GetValue("code").ToString();
var msg = rlt.GetValue("msg").ToString();
if (msg== "验签失败") {
if (msg == "验签失败")
{
req.Code = 200;
req.Message = "验签失败";
@ -848,44 +856,50 @@ namespace djy.Service.Ams
var data = rlt.GetValue("data").ToString();
JObject drlt = JObject.Parse(data);
var result = drlt.GetValue("result").ToString();
if (code == "F" || result == "false")
{
var errorInfo = drlt.GetValue("errorInfo").ToString();
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = oid;
history.SendTime = DateTime.Now;
if (docType == "AMSDOC")
{
history.State = "新增发送失败";
history.Type = "接收失败";
}
else if (docType == "AMSAR")
{
history.State = "重发失败";
history.Type = "接收失败";
}
else if (docType == "AMSM")
{
history.State = "修改发送失败";
history.Type = "修改失败";
}
else
foreach (var item in hodto)
{
history.State = "删除发送失败";
history.Type = "删单失败";
}
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = item.GID;
history.SendTime = DateTime.Now;
if (docType == "AMSDOC")
{
history.State = "新增发送失败";
history.Type = "接收失败";
}
else if (docType == "AMSAR")
{
history.State = "重发失败";
history.Type = "接收失败";
}
else if (docType == "AMSM")
{
history.State = "修改发送失败";
history.Type = "修改失败";
}
else
{
history.State = "删除发送失败";
history.Type = "删单失败";
}
history.Operator = user.SHOWNAME;
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "发送单据失败,失败原因:" + msg;
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
history.Operator = user.SHOWNAME;
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "发送单据失败,失败原因:" + msg;
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
}
req.Code = 201;
req.Message = "操作失败," + msg + errorInfo;
return req;
}
if (code == "T" && result == "true")
{
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = oid;
@ -917,20 +931,20 @@ namespace djy.Service.Ams
if (docType == "AMSDOC")
{
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState="", ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.PID == oid).ExecuteAffrows();
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = "", ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.PID == oid).ExecuteAffrows();
foreach (var item in hodto)
{
var getfinrs = fin.Expend(new CustFee
{
CARRIER=master.CARRIER,
CARRIER = master.CARRIER,
ETD = master.ETA,
VOYNO = master.VOYNO,
VESSEL = master.VESSEL,
HBLNO = item.HBLNo,
SENDUSERID = user.GID,
LURURENID = user.GID,
CtnrCount = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel != true && x.HID == item.GID ).ToList().Count(),
CtnrCount = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel != true && x.HID == item.GID).ToList().Count(),
CtnrInfo = string.Empty,
BSTYPE = 15,
SENDTYPE = 0,
@ -941,7 +955,7 @@ namespace djy.Service.Ams
}
else if (docType == "AMSAR")
{
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = "", ReportState = "已提交", NewNotice = "重发发送成功" }).Where(w => House.Contains(w.GID)).ExecuteAffrows();
foreach (var item in hodto)
{
@ -1010,7 +1024,7 @@ namespace djy.Service.Ams
}
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = "", ReportState = "已提交", NewNotice = "删除发送成功" }).Where(w => House.Contains(w.GID)).ExecuteAffrows();
}
}
}
#endregion
@ -1036,7 +1050,7 @@ namespace djy.Service.Ams
Response req = new Response();
try
{
AMSReturnDto retdto = Json.JsonToObject<AMSReturnDto>(msg);
_LogsAdd("SaveReceipt", "post", $"AMS接口推送{msg}");
if (retdto != null)
@ -1053,7 +1067,7 @@ namespace djy.Service.Ams
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = masterid;
history.AM_ID = retdto.businessId;
history.SendTime = DateTime.Now;
history.State = "海关接收成功";
history.Type = "匹配成功";
@ -1070,10 +1084,11 @@ namespace djy.Service.Ams
if (house.MateState.Contains("3Z"))
{
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = "3Z,"+retdto.status, NewNotice = "海关接收成功", ReportState = "接收成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = "3Z," + retdto.status, NewNotice = "海关接收成功", ReportState = "接收成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
}
else {
else
{
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => new AMS_House { MateState = house.MateState + "," + retdto.status, NewNotice = "海关接收成功", ReportState = "接收成功" }).Where(w => w.GID == retdto.businessId).ExecuteAffrows();
}
@ -1096,7 +1111,7 @@ namespace djy.Service.Ams
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = masterid;
history.AM_ID = retdto.businessId;
history.SendTime = DateTime.Now;
history.State = "船司匹配成功";
history.Type = "匹配成功";
@ -1138,7 +1153,7 @@ namespace djy.Service.Ams
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = masterid;
history.AM_ID = retdto.businessId;
history.SendTime = DateTime.Now;
history.State = "ISF匹配成功";
history.Type = "匹配成功";
@ -1162,7 +1177,7 @@ namespace djy.Service.Ams
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = masterid;
history.AM_ID = retdto.businessId;
history.SendTime = DateTime.Now;
history.State = "海关拒绝";
history.Type = "匹配失败";
@ -1198,7 +1213,7 @@ namespace djy.Service.Ams
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = masterid;
history.AM_ID = retdto.businessId;
history.SendTime = DateTime.Now;
history.State = "箱货信息不匹配";
history.Type = "匹配失败";
@ -1234,7 +1249,7 @@ namespace djy.Service.Ams
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = masterid;
history.AM_ID = retdto.businessId;
history.SendTime = DateTime.Now;
history.State = "匹配失败";
history.Type = "匹配失败";
@ -1443,7 +1458,7 @@ namespace djy.Service.Ams
}
}
public List<CommonCodeValue> GetCodeProvince(string code)
public List<CommonCodeValue> GetCodeProvince(string code)
{
try
{
@ -1457,7 +1472,8 @@ namespace djy.Service.Ams
return List;
}
else {
else
{
var List = DbBus.Get(DbList.Common).Select<CodeProvince>().ToList().Select(x => new CommonCodeValue
{
@ -1467,7 +1483,7 @@ namespace djy.Service.Ams
return List;
}
}
catch (Exception e)
{
@ -1625,8 +1641,8 @@ namespace djy.Service.Ams
{
string guid = "";
var list = DbBus.Get(DbList.AMSCenter).Select<AMS_AddrTemplate>().Where(w => w.UserID == user.GID && w.TemPlateName == dto.TemPlateName&&w.Type==dto.Type&&w.GID!=dto.GID).ToOne();
if (list!=null)
var list = DbBus.Get(DbList.AMSCenter).Select<AMS_AddrTemplate>().Where(w => w.UserID == user.GID && w.TemPlateName == dto.TemPlateName && w.Type == dto.Type && w.GID != dto.GID).ToOne();
if (list != null)
{
return "-1";
}
@ -1657,17 +1673,17 @@ namespace djy.Service.Ams
#region 获取模板
public List<AMS_AddrTemplate> GetTemplate(User user, string type, string TemPlateName)
public List<AMS_AddrTemplate> GetTemplate(User user, string type, string TemPlateName)
{
try
{
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_AddrTemplate>().
Where(x => x.IsDel == false || x.IsDel == null).
Where(x => x.UserID == user.GID).
WhereIf(type != null, x => x.Type == type).
WhereIf(TemPlateName != null, x => TemPlateName.Contains(x.TemPlateName)).
ToList();
return List;
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_AddrTemplate>().
Where(x => x.IsDel == false || x.IsDel == null).
Where(x => x.UserID == user.GID).
WhereIf(type != null, x => x.Type == type).
WhereIf(TemPlateName != null, x => TemPlateName.Contains(x.TemPlateName)).
ToList();
return List;
}
catch (Exception e)
{
@ -1689,7 +1705,7 @@ namespace djy.Service.Ams
{
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
DbBus.Get(DbList.AMSCenter).Delete<AMS_AddrTemplate>().Where(w => w.GID == oid).ExecuteAffrows();
});
}

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
此文件由 Web 项目的发布/打包过程使用。可以通过编辑此 MSBuild 文件
自定义此过程的行为。为了解与此相关的更多内容,请访问 https://go.microsoft.com/fwlink/?LinkID=208121。
-->
<Project>
<PropertyGroup>
<_PublishTargetUrl>C:\Project\DJYAMS\djyweb_ams\web\djy.WebApi\bin\Release\net5.0\publish\</_PublishTargetUrl>
<History>True|2022-08-11T08:30:26.5758718Z;True|2022-08-11T15:57:08.7787498+08:00;True|2022-08-11T15:31:36.9253999+08:00;</History>
</PropertyGroup>
</Project>
Loading…
Cancel
Save