|
|
|
@ -48,23 +48,27 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
var dto = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>()
|
|
|
|
|
.Where(x => (x.IsDel == false || x.IsDel == null) && x.CompID == user.CompId)
|
|
|
|
|
.WhereIf(req.MBLNO != null, x => req.MBLNO.Contains(x.MBLNO))
|
|
|
|
|
.WhereIf(req.ReportState != null, x =>ReportStates.Contains(x.ReportState))
|
|
|
|
|
.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=> req.UserName.Contains(x.UserName) )
|
|
|
|
|
.WhereIf(req.UserName!=null,x=> x.UserName.Contains(req.UserName) )
|
|
|
|
|
.WhereIf(req.CARRIERID != null, x =>req.CARRIERID==x.CARRIERID)
|
|
|
|
|
.WhereIf(req.BDate!=null,x=>x.CreateTime>=req.BDate)
|
|
|
|
|
.WhereIf(req.EDate!=null,x=>x.CreateTime<=req.EDate);
|
|
|
|
|
.WhereIf(req.EDate!=null,x=>x.CreateTime<=req.EDate).OrderByDescending(x=>x.CreateTime);
|
|
|
|
|
result.count = dto.ToList().Count();
|
|
|
|
|
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).ToList();
|
|
|
|
|
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 == false || x.IsDel == null) && x.PID == item.GID).ToList<AMS_HouseDto>();
|
|
|
|
|
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))
|
|
|
|
|
.ToList<AMS_HouseDto>();
|
|
|
|
|
item.HouseDto = hodto;
|
|
|
|
|
if (hodto != null)
|
|
|
|
|
{
|
|
|
|
@ -132,11 +136,16 @@ namespace djy.Service.Ams
|
|
|
|
|
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();
|
|
|
|
|
master.LastNoUsPort = DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.LastNoUsPortCode).ToList().Select(x => x.EnName).FirstOrDefault();
|
|
|
|
|
|
|
|
|
|
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.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "已新增";
|
|
|
|
|
history.Type = "新增";
|
|
|
|
|
history.Operator = user.SHOWNAME;
|
|
|
|
@ -175,10 +184,31 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Transaction(() =>
|
|
|
|
|
{
|
|
|
|
|
AMS_Master master = dto.MapTo<AMS_Master>();
|
|
|
|
|
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_House>().Where(w => w.PID == master.GID).ExecuteAffrows();
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
@ -188,6 +218,7 @@ 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();
|
|
|
|
|
|
|
|
|
|
if (dto.HouseDto != null && dto.HouseDto.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
foreach (var item in dto.HouseDto)
|
|
|
|
@ -245,34 +276,34 @@ namespace djy.Service.Ams
|
|
|
|
|
{
|
|
|
|
|
#region docContent 新增 重发 修改
|
|
|
|
|
|
|
|
|
|
if (docType == "AMSAR" && !(master.ReportState == "已删除" || master.MateState == "匹配失败"))
|
|
|
|
|
if (docType == "AMSAR" && !(master.ReportState == "删单成功" || master.MateState == "接收失败"))
|
|
|
|
|
{
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "当前状态不能重发!如有疑问,请联系相关客服!";
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if (docType == "AMSAR" || docType == "AMSDOC")
|
|
|
|
|
//{
|
|
|
|
|
// var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
// {
|
|
|
|
|
// SENDUSERID = userid,
|
|
|
|
|
// LURURENID = userid,
|
|
|
|
|
// CtnrCount = 1,
|
|
|
|
|
// CtnrInfo = string.Empty,
|
|
|
|
|
// BSTYPE = 15,
|
|
|
|
|
// SENDTYPE = 0,
|
|
|
|
|
// BSNO = oid.ToString(),
|
|
|
|
|
// MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
// }
|
|
|
|
|
// , 0);
|
|
|
|
|
// if (!getfinrs.Status)
|
|
|
|
|
// {
|
|
|
|
|
// req.Code = 200;
|
|
|
|
|
// req.Message = getfinrs.Message;
|
|
|
|
|
// return req;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
if (docType == "AMSAR" || docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
var getfinrs = fin.Expend(new CustFee
|
|
|
|
|
{
|
|
|
|
|
SENDUSERID = userid,
|
|
|
|
|
LURURENID = userid,
|
|
|
|
|
CtnrCount = 1,
|
|
|
|
|
CtnrInfo = string.Empty,
|
|
|
|
|
BSTYPE = 15,
|
|
|
|
|
SENDTYPE = 0,
|
|
|
|
|
BSNO = oid.ToString(),
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
}
|
|
|
|
|
, 0);
|
|
|
|
|
if (!getfinrs.Status)
|
|
|
|
|
{
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
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();
|
|
|
|
@ -294,11 +325,11 @@ namespace djy.Service.Ams
|
|
|
|
|
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 = master.ETA.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
masterBillInfo.estimatedArrivalTime = master.ETD.ToString("yyyy-MM-dd hh:mm:ss");
|
|
|
|
|
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;
|
|
|
|
|
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>();
|
|
|
|
|
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)
|
|
|
|
|
{
|
|
|
|
@ -349,9 +380,10 @@ namespace djy.Service.Ams
|
|
|
|
|
insertList.ignite = "";
|
|
|
|
|
list.Add(insertList);
|
|
|
|
|
CtnInfo.insertList = list;
|
|
|
|
|
houseinfo.ctnInfo = CtnInfo;
|
|
|
|
|
houseBillInfoListItems.Add(houseinfo);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
houseinfo.ctnInfo = CtnInfo;
|
|
|
|
|
houseBillInfoListItems.Add(houseinfo);
|
|
|
|
|
}
|
|
|
|
|
dto.houseBillInfoList = houseBillInfoListItems;
|
|
|
|
|
var data = JsonConvert.SerializeObject(dto);
|
|
|
|
@ -363,13 +395,14 @@ namespace djy.Service.Ams
|
|
|
|
|
aMSDoc.editype = "AMSDOC";
|
|
|
|
|
aMSDoc.port = "Ningbo";
|
|
|
|
|
aMSDoc.masterBillInfo = dto;
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDoc);
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDoc).ToBase64();
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (master.ReportState == "已删除")
|
|
|
|
|
if (master.ReportState == "删单成功")
|
|
|
|
|
{
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
req.Message = "已删除单据不可以再次删除";
|
|
|
|
@ -378,6 +411,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();
|
|
|
|
|
|
|
|
|
|
docContent = JsonConvert.SerializeObject(aMSDDto).ToBase64();
|
|
|
|
|
}
|
|
|
|
|
var AMSAccount = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSAccount").ToOne();
|
|
|
|
@ -387,8 +421,7 @@ namespace djy.Service.Ams
|
|
|
|
|
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
|
|
|
|
|
|
|
|
/////MD5加密
|
|
|
|
|
string stringSign = string.Format("{0}{1}{2}",
|
|
|
|
|
AMSAccount.PARAMVALUE, key.PARAMVALUE, timestamp);
|
|
|
|
|
string stringSign = string.Format("{0}{1}{2}",AMSAccount.PARAMVALUE, key.PARAMVALUE, timestamp);
|
|
|
|
|
string sign = stringSign.ToMd5();
|
|
|
|
|
///post参数
|
|
|
|
|
Dictionary<string, string> dic = new Dictionary<string, string>();
|
|
|
|
@ -417,7 +450,11 @@ namespace djy.Service.Ams
|
|
|
|
|
JObject rlt = JObject.Parse(gethtml);
|
|
|
|
|
var code = rlt.GetValue("code").ToString();
|
|
|
|
|
var msg = rlt.GetValue("msg").ToString();
|
|
|
|
|
if (code == "F")
|
|
|
|
|
var data= rlt.GetValue("data").ToString();
|
|
|
|
|
JObject drlt = JObject.Parse(data);
|
|
|
|
|
var result = drlt.GetValue("result").ToString();
|
|
|
|
|
var errorInfo = drlt.GetValue("errorInfo").ToString();
|
|
|
|
|
if (code == "F"|| result=="false")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
@ -427,32 +464,32 @@ namespace djy.Service.Ams
|
|
|
|
|
if (docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
history.State = "新增发送失败";
|
|
|
|
|
history.Type = "新增发送";
|
|
|
|
|
history.Type = "接收失败";
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSAR")
|
|
|
|
|
{
|
|
|
|
|
history.State = "重发失败";
|
|
|
|
|
history.Type = "重发";
|
|
|
|
|
history.Type = "接收失败";
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSM")
|
|
|
|
|
{
|
|
|
|
|
history.State = "修改发送失败";
|
|
|
|
|
history.Type = "修改发送";
|
|
|
|
|
history.Type = "修改失败";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
history.State = "删除发送失败";
|
|
|
|
|
history.Type = "删除发送";
|
|
|
|
|
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();
|
|
|
|
|
req.Code = 200;
|
|
|
|
|
req.Message = "操作失败,"+ msg;
|
|
|
|
|
req.Code = 201;
|
|
|
|
|
req.Message = "操作失败,"+ msg+ errorInfo;
|
|
|
|
|
return req;
|
|
|
|
|
}
|
|
|
|
|
if (code == "T")
|
|
|
|
|
if (code == "T"&& result=="true")
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
@ -461,22 +498,22 @@ namespace djy.Service.Ams
|
|
|
|
|
if (docType == "AMSDOC")
|
|
|
|
|
{
|
|
|
|
|
history.State = "新增发送成功";
|
|
|
|
|
history.Type = "新增发送";
|
|
|
|
|
history.Type = "接收成功";
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSAR")
|
|
|
|
|
{
|
|
|
|
|
history.State = "重发成功";
|
|
|
|
|
history.Type = "重发";
|
|
|
|
|
history.Type = "接收成功";
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSM")
|
|
|
|
|
{
|
|
|
|
|
history.State = "修改发送成功";
|
|
|
|
|
history.Type = "修改发送";
|
|
|
|
|
history.Type = "修改成功";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
history.State = "删除发送成功";
|
|
|
|
|
history.Type = "删除发送";
|
|
|
|
|
history.Type = "删单成功";
|
|
|
|
|
}
|
|
|
|
|
history.Operator = user.SHOWNAME;
|
|
|
|
|
history.Remark = user.SHOWNAME + "于" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "发送了单据";
|
|
|
|
@ -497,7 +534,7 @@ namespace djy.Service.Ams
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
}
|
|
|
|
|
, 1);
|
|
|
|
|
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_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
else if (docType == "AMSAR")
|
|
|
|
|
{
|
|
|
|
@ -511,19 +548,19 @@ namespace djy.Service.Ams
|
|
|
|
|
SENDTYPE = 0,
|
|
|
|
|
BSNO = oid.ToString(),
|
|
|
|
|
MBLNO = master.MBLNO.ToString(),
|
|
|
|
|
}
|
|
|
|
|
, 1);
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { ReportState = "已申报", NewNotice = "重发成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
, 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")
|
|
|
|
|
{
|
|
|
|
|
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_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "修改发送成功" }).Where(w => w.GID == oid).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_Master>().Set(w => new AMS_Master { ReportState = "已提交", NewNotice = "删除发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -555,12 +592,12 @@ namespace djy.Service.Ams
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
if (retdto.status == "W2")
|
|
|
|
|
var master = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => x.GID == masterid).ToOne();
|
|
|
|
|
if (retdto.status != "W1")
|
|
|
|
|
{
|
|
|
|
|
AMS_MasterHistory history = new AMS_MasterHistory();
|
|
|
|
|
history.GID = Guid.NewGuid().ToString("N");
|
|
|
|
|
history.AM_ID = masterid;
|
|
|
|
|
history.AM_ID = master.GID;
|
|
|
|
|
history.SendTime = DateTime.Now;
|
|
|
|
|
history.State = "匹配失败";
|
|
|
|
|
history.Type = "匹配失败";
|
|
|
|
@ -568,34 +605,55 @@ namespace djy.Service.Ams
|
|
|
|
|
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 == "W1")
|
|
|
|
|
{
|
|
|
|
|
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 == "重发发送成功" || master.NewNotice == "新增发送成功")
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
var houses = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == masterid && 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 = masterid;
|
|
|
|
|
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();
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = "匹配成功", NewNotice = "匹配成功" }).Where(w => w.GID == masterid).ExecuteAffrows();
|
|
|
|
|
}
|
|
|
|
|
var faillist = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => (x.IsDel == false || x.IsDel == null) && x.PID == masterid && x.State == "0").ToList();
|
|
|
|
|
if (faillist != null && faillist.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => new AMS_Master { MateState = "匹配失败", NewNotice = "匹配失败" }).Where(w => w.GID == masterid).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();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
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
|
|
|
|
|
{
|
|
|
|
@ -631,14 +689,15 @@ namespace djy.Service.Ams
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 下拉接口
|
|
|
|
|
public List<CommonCodeValue> GetCountry()
|
|
|
|
|
public List<CommonCNEN> GetCountry()
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var List = DbBus.Get(DbList.Common).Select<CodeCountry>().ToList().Select(x => new CommonCodeValue
|
|
|
|
|
var List = DbBus.Get(DbList.Common).Select<CodeCountry>().ToList().Select(x => new CommonCNEN
|
|
|
|
|
{
|
|
|
|
|
Code = x.Code,
|
|
|
|
|
Value = x.EnName+"-"+x.Code,
|
|
|
|
|
ENName = x.EnName,
|
|
|
|
|
CNName = x.CnName,
|
|
|
|
|
}).Distinct().ToList();
|
|
|
|
|
return List;
|
|
|
|
|
}
|
|
|
|
@ -955,20 +1014,20 @@ namespace djy.Service.Ams
|
|
|
|
|
}
|
|
|
|
|
return guid;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
#region 获取模板
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public List<AMS_AddrTemplate> GetTemplate(string companyid, string type, string TemPlateName)
|
|
|
|
|
public List<AMS_AddrTemplate> GetTemplate(string userid, string type, string TemPlateName)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
|
|
|
|
|
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_AddrTemplate>().
|
|
|
|
|
Where(x => x.IsDel == false || x.IsDel == null).
|
|
|
|
|
WhereIf(companyid != null, x => x.CompID == companyid).
|
|
|
|
|
Where(x => x.CompID == user.CompId).
|
|
|
|
|
WhereIf(type != null, x => x.Type == type).
|
|
|
|
|
WhereIf(TemPlateName != null, x => TemPlateName.Contains(x.TemPlateName)).
|
|
|
|
|
ToList();
|
|
|
|
|