|
|
|
@ -44,7 +44,6 @@ namespace djy.Service.Ams
|
|
|
|
|
string[] ReportStates = null;
|
|
|
|
|
if (req.ReportState != null)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
ReportStates = req.ReportState.Split(',');
|
|
|
|
|
}
|
|
|
|
|
List<string> hou = null;
|
|
|
|
@ -69,11 +68,8 @@ namespace djy.Service.Ams
|
|
|
|
|
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)
|
|
|
|
|
.WhereIf(req.HBLNo != null, x => x.HBLNo.Contains(req.HBLNo.Trim()))
|
|
|
|
|
.WhereIf(req.ReportState == "0", x => x.ReportState == "未申报" || x.ReportState == "接收失败")
|
|
|
|
@ -83,10 +79,13 @@ 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();
|
|
|
|
@ -99,7 +98,8 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
result.count = list.Where(x => x.HouseDto != null && x.HouseDto.Count() > 0).ToList().Count();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
result.count = count;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -285,12 +282,21 @@ namespace djy.Service.Ams
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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,20 +317,20 @@ 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 = master.GID;
|
|
|
|
|
history.AM_ID = house.GID;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "已修改";
|
|
|
|
|
history.Type = "修改";
|
|
|
|
|
history.State = "已新增";
|
|
|
|
|
history.Type = "新增";
|
|
|
|
|
history.Operator = user.SHOWNAME;
|
|
|
|
|
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "修改了单据";
|
|
|
|
|
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "创建了单据";
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
guid = master.GID;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -353,6 +359,7 @@ namespace djy.Service.Ams
|
|
|
|
|
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)
|
|
|
|
@ -380,7 +387,8 @@ namespace djy.Service.Ams
|
|
|
|
|
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) {
|
|
|
|
|
if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var it in item.CntrnoDto)
|
|
|
|
|
{
|
|
|
|
|
var cntrno = new AMS_Cntrno();
|
|
|
|
@ -393,19 +401,18 @@ namespace djy.Service.Ams
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
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;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -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,9 +448,6 @@ namespace djy.Service.Ams
|
|
|
|
|
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
foreach (string oid in id)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (oid != "")
|
|
|
|
|
{
|
|
|
|
|
var docContent = "";
|
|
|
|
@ -472,7 +477,8 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
masterBillInfo.voyage = master.VOYNO.TrimAll().Substring(0, 5);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
masterBillInfo.voyage = master.VOYNO;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -581,7 +587,8 @@ namespace djy.Service.Ams
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDoc).ToBase64();
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSAR" || docType == "AMSM") {
|
|
|
|
|
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>();
|
|
|
|
@ -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 = "验签失败";
|
|
|
|
@ -852,9 +860,13 @@ namespace djy.Service.Ams
|
|
|
|
|
if (code == "F" || result == "false")
|
|
|
|
|
{
|
|
|
|
|
var errorInfo = drlt.GetValue("errorInfo").ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in hodto)
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = oid;
|
|
|
|
|
history.AM_ID = item.GID;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
if (docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
@ -880,6 +892,8 @@ namespace djy.Service.Ams
|
|
|
|
|
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;
|
|
|
|
@ -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 = "匹配成功";
|
|
|
|
@ -1073,7 +1087,8 @@ namespace djy.Service.Ams
|
|
|
|
|
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 = "匹配失败";
|
|
|
|
@ -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
|
|
|
|
|
{
|
|
|
|
|