master
wet 2 years ago
parent 753bcd5fad
commit 88431e8b3d

@ -1566,21 +1566,6 @@
获取登录Id
</summary>
</member>
<member name="P:Common.DjyService.ApiBase.GetLoginName">
<summary>
获取登录名称
</summary>
</member>
<member name="P:Common.DjyService.ApiBase.GetLoginComptName">
<summary>
获取登录公司名称
</summary>
</member>
<member name="P:Common.DjyService.ApiBase.GetLoginCompId">
<summary>
获取登录公司id
</summary>
</member>
<member name="P:Common.DjyService.ApiBase.GetLoginType">
<summary>
获取登录类型

@ -61,12 +61,12 @@ namespace Common.DjyService
/// 获取登录详情信息
/// </summary>
/// <param name="UserGid"></param>
protected User GetUserInfo(Guid? UserGid=null)
protected User GetUserInfo(Guid? UserGid = null)
{
var _suser=IOC.AddServer<IDjyUserService>();
var _suser = IOC.AddServer<IDjyUserService>();
if (UserGid == null)
{ UserGid = GetLoginId; }
var rs= _suser.GetUserInfo(UserGid.ToString());
var rs = _suser.GetUserInfo(UserGid.ToString());
if (rs.Status)
{
return rs.Data;
@ -172,22 +172,6 @@ namespace Common.DjyService
/// </summary>
protected Guid? GetLoginId { get { return Guid.Parse(GetClaimsValue("loginid")); } }
/// <summary>
/// 获取登录名称
/// </summary>
protected string GetLoginName { get { return GetClaimsValue("showname"); } }
/// <summary>
/// 获取登录公司名称
/// </summary>
protected string GetLoginComptName { get { return GetClaimsValue("comname"); } }
/// <summary>
/// 获取登录公司id
/// </summary>
protected string GetLoginCompId { get { return GetClaimsValue("compayid"); } }
/// <summary>
/// 获取登录类型
/// </summary>

@ -24,7 +24,7 @@ namespace djy.Paas.IService
void Delete(string ids,string userid);
List<CommonCodeValue> GetCountry();
List<CommonCNEN> GetCountry();
List<CommonCodeValue> GetCodePortLoad();
@ -57,7 +57,7 @@ namespace djy.Paas.IService
string SaveTemplate(AMS_AddrTemplate dto, string userid);
List<AMS_AddrTemplate> GetTemplate(string companyid, string type,string TemPlateName);
List<AMS_AddrTemplate> GetTemplate(string userid, string type,string TemPlateName);
byte[] PDF(string GID);
}

@ -43,7 +43,7 @@ namespace djy.IService.Isf
/// 获取模板
/// </summary>
/// <returns></returns>
List<ISF_CompanyTemplate> GetTemplate(string companyid, string CompanyType, string InFoType,string TemPlateName);
List<ISF_CompanyTemplate> GetTemplate(string userid, string CompanyType, string InFoType,string TemPlateName);
/// <summary>

@ -37,6 +37,9 @@ namespace djy.Model.AmsDto
/// </summary>
public string UserName { get; set; }
public string HBLNo { get; set; }
public DateTime? BDate { get; set; }
public DateTime? EDate { get; set; }
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace djy.Model.AmsDto
{
public class CommonCNEN
{
public string Code { get; set; }
public string ENName { get; set; }
public string CNName { get; set; }
}
}

@ -6,13 +6,11 @@ using System.Threading.Tasks;
namespace djy.Model.AmsDto
{
public class CommonMappiCode
public class CommonCodeValue
{
public string Code { get; set; }
public string Value { get; set; }
public string MapCode { get; set; }
}
}

@ -6,11 +6,13 @@ using System.Threading.Tasks;
namespace djy.Model.AmsDto
{
public class CommonCodeValue
public class CommonMappiCode
{
public string Code { get; set; }
public string Value { get; set; }
public string MapCode { get; set; }
}
}

@ -68,10 +68,10 @@ namespace djy.Model.Isf
/// </summary>
[MaxLength(50)]
public string HstCode { get; set; }
/// <summary>
/// 进出口类型(1.进口2.出口)
/// </summary>
[MaxLength(50)]
///// <summary>
///// 进出口类型(1.进口2.出口)
///// </summary>
//[MaxLength(50)]
public string IeType { get; set; }

@ -34,10 +34,10 @@ namespace djy.Model.IsfDto
/// 提单号
/// </summary>
public string masterBillNo { get; set; }
/// <summary>
/// 备注
/// </summary>
public string memo { get; set; }
///// <summary>
///// 备注
///// </summary>
//public string memo { get; set; }
/// <summary>
/// 业务id
/// </summary>
@ -60,10 +60,10 @@ namespace djy.Model.IsfDto
/// </summary>
public string city { get; set; }
/// <summary>
/// 公司ID
/// </summary>
public string companyId { get; set; }
///// <summary>
///// 公司ID
///// </summary>
//public string companyId { get; set; }
/// <summary>
/// 公司名称
@ -86,10 +86,10 @@ namespace djy.Model.IsfDto
/// </summary>
public string idTypeCode { get; set; }
/// <summary>
/// 进出口类型(1.进口2.出口)
/// </summary>
public string ieType { get; set; }
///// <summary>
///// 进出口类型(1.进口2.出口)
///// </summary>
//public string ieType { get; set; }
/// <summary>
/// 邮编
/// </summary>
@ -132,7 +132,7 @@ namespace djy.Model.IsfDto
/// <summary>
/// 时间戳
/// </summary>
public DateTime timestamp { get; set; }
public string timestamp { get; set; }
/// <summary>
/// 用户id
/// </summary>

@ -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")
{
@ -512,18 +549,18 @@ namespace djy.Service.Ams
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();

@ -1,12 +1,14 @@
using Common.DJYModel;
using Common.DjyService;
using Common.Extensions;
using Common.Tools;
using Common.Utilities;
using djy.IService.Isf;
using djy.Model.Ams;
using djy.Model.Isf;
using djy.Model.IsfDto;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
@ -31,9 +33,11 @@ namespace djy.Service.ISF
}
var dto = DbBus.Get(DbList.AMSCenter).Select<ISF_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.MBLNO != null,x=> x.MBLNO.Contains(req.MBLNO)).
WhereIf(req.InFoType != null, x => x.InFoType==req.InFoType).
WhereIf(req.ReportState != null, x => ReportStates.Contains(x.ReportState)); ;
WhereIf(req.ReportState != null && req.ReportState != "0" && req.ReportState != "1", x => ReportStates.Contains(x.ReportState)).
WhereIf(req.ReportState == "0", x => x.ReportState == "未申报" || x.ReportState == "删单成功" || x.ReportState == "接收失败").
WhereIf(req.ReportState == "1", x => !(x.ReportState == "未申报" || x.ReportState == "删单成功" || x.ReportState == "接收失败"));
result.count = dto.ToList().Count();
var list = dto.Page(req.Page, req.Limit).ToList<ISFDto>();
if (list != null)
@ -71,6 +75,8 @@ namespace djy.Service.ISF
master.CompName = user.COMNAME;
master.IsDel = false;
master.ReportState = "未申报";
//master.DischargeHarbourName=DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.DischargeHarbourCode).ToList().Select(x => x.EnName).FirstOrDefault();
//master.DeliveryHarbourName = DbBus.Get(DbList.Common).Select<CodePort>().Where(x => x.Code == master.DeliveryHarbourCode).ToList().Select(x => x.EnName).FirstOrDefault();
DbBus.Get(DbList.AMSCenter).Insert(master).ExecuteAffrows();
ISF_MasterHistory history = new ISF_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
@ -105,9 +111,9 @@ namespace djy.Service.ISF
ISF_Master master = dto.MapTo<ISF_Master>();
DbBus.Get(DbList.AMSCenter).Update<ISF_Master>().SetSource(master).ExecuteAffrows();
DbBus.Get(DbList.AMSCenter).Delete<ISF_Company>().Where(w => w.PID == master.GID).ExecuteAffrows();
AMS_MasterHistory history = new AMS_MasterHistory();
ISF_MasterHistory history = new ISF_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = master.GID;
history.ISF_ID = master.GID;
history.SendTime = DateTime.Now;
history.State = "已修改";
history.Type = "修改";
@ -149,9 +155,9 @@ namespace djy.Service.ISF
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
AMS_MasterHistory history = new AMS_MasterHistory();
ISF_MasterHistory history = new ISF_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID = oid;
history.ISF_ID = oid;
history.SendTime = DateTime.Now;///此处为删除时间
history.State = "已删除";
history.Type = "删除";
@ -170,13 +176,14 @@ namespace djy.Service.ISF
#region 获取模板
public List<ISF_CompanyTemplate> GetTemplate(string companyid, string CompanyType, string InFoType,string TemPlateName)
public List<ISF_CompanyTemplate> GetTemplate(string userid, string CompanyType, string InFoType,string TemPlateName)
{
try
{
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
var List = DbBus.Get(DbList.AMSCenter).Select<ISF_CompanyTemplate>().
Where(x=> x.IsDel == false || x.IsDel == null).
WhereIf(companyid !=null, x => x.CompID==companyid).
Where(x => x.CompID== user.CompId).
WhereIf(CompanyType != null, x => x.CompanyType == CompanyType).
WhereIf(InFoType != null, x => x.InFoType == InFoType).
WhereIf(TemPlateName != null, x => TemPlateName.Contains(x.TemPlateName)).
@ -271,11 +278,11 @@ namespace djy.Service.ISF
Info info = new Info();
info.masterBillNo = master.MBLNO;
info.infoType = master.InFoType;
info.dischargeHarbourCode = portList.Where(x => x.Code == master.DischargeHarbourCode).Select(x => x.EdiCode).FirstOrDefault();
info.deliveryHarbourCode = portList.Where(x => x.Code == master.DeliveryHarbourCode).Select(x => x.EdiCode).FirstOrDefault();
info.dischargeHarbourCode = portList.Where(x => x.Code == master.DischargeHarbourCode).Select(x => x.EdiCode).FirstOrDefault();
info.deliveryHarbourCode = portList.Where(x => x.Code == master.DeliveryHarbourCode).Select(x => x.EdiCode).FirstOrDefault();
info.shipmentTypeCode = master.ShipmentTypeCode;
info.hstCode = master.HstCode;
info.memo = null;
info.blTypeCode = master.BlTypeCode;
info.refId = master.GID;
List<CompanyList> companyList = new List<CompanyList>();
@ -285,7 +292,6 @@ namespace djy.Service.ISF
{
companyType = item.CompanyType,
companyName = item.CompanyName,
companyId = null,
idTypeCode=item.IdTypeCode,
address=item.Address,
city=item.City,
@ -294,17 +300,149 @@ namespace djy.Service.ISF
countryCode=item.ProvinceCode,
postcode=item.PostCode,
hstCode=item.HstCode,
ieType=item.IeType
});
}
var timestamp = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
var AMSAccount = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSAccount").ToOne();
var key = DbBus.Get(DbList.djydb).Select<ParamSet>().Where(x => x.PARAMNAME == "AMSKEY").ToOne();
/////MD5加密
string stringSign = string.Format("companyList={0}&format=json&info={1}&method=eportyun.manifest.isf.sendBill&msgType={2}&timestamp={3}&user_id=nbforwarder&version=2.0&key=2dde55e422d2461b913f510e95da73b3",
JsonConvert.SerializeObject(companyList), JsonConvert.SerializeObject(info), Convert.ToInt32(msgType),timestamp);
string sign = stringSign.ToMd5().ToUpper();
///post参数
IsfInfo isfinfo = new IsfInfo();
isfinfo.companyList = companyList;
isfinfo.format = "json";
isfinfo.info = info;
isfinfo.method = "1";
var str = JsonConvert.SerializeObject(isfinfo);
isfinfo.method = "eportyun.manifest.isf.sendBill";
isfinfo.msgType = Convert.ToInt32(msgType);
isfinfo.user_id = AMSAccount.PARAMVALUE;
isfinfo.sign = sign;
isfinfo.timestamp = timestamp;
isfinfo.version = "2.0";
isfinfo.format = "json";
string json = JsonConvert.SerializeObject(isfinfo);
_LogsAdd("SendDE", "post", $"ISF接口调用发送{oid}{json}");
string gethtml = await HttpHelp.Post(isfinfo, "http://api.trainer.nbeport.com/router/rest", PsotType.Json);
_LogsAdd("SendDE", "post", $"ISF接口调用返回{oid}{gethtml}");
if (gethtml != null)
{
JObject rlt = JObject.Parse(gethtml);
var code = rlt.GetValue("code").ToString();
var msg = rlt.GetValue("msg").ToString();
if (code == "F")
{
ISF_MasterHistory history = new ISF_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.ISF_ID = oid;
history.SendTime = DateTime.Now;
if (msgType == "1")
{
history.State = "新增发送失败";
history.Type = "接收失败";
}
else if (msgType == "4")
{
history.State = "重发失败";
history.Type = "接收失败";
}
else if (msgType == "2")
{
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();
req.Code = 200;
req.Message = "操作失败," + msg;
return req;
}
if (code == "T")
{
ISF_MasterHistory history = new ISF_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.ISF_ID = oid;
history.SendTime = DateTime.Now;
if (msgType == "1")
{
history.State = "新增发送成功";
history.Type = "接收成功";
}
else if (msgType == "4")
{
history.State = "重发成功";
history.Type = "接收成功";
}
else if (msgType == "2")
{
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") + "发送了单据";
DbBus.Get(DbList.AMSCenter).Insert(history).ExecuteAffrows();
if (msgType == "1")
{
// var getfinrs = fin.Expend(new CustFee
// {
// SENDUSERID = userid,
// LURURENID = userid,
// CtnrCount = 1,
// CtnrInfo = string.Empty,
// BSTYPE = 16,
// SENDTYPE = 0,
// BSNO = oid.ToString(),
// MBLNO = master.MBLNO.ToString(),
// }
//, 1);
DbBus.Get(DbList.AMSCenter).Update<ISF_Master>().Set(w => new ISF_Master { ReportState = "已提交", NewNotice = "新增发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
}
else if (msgType == "4")
{
// var getfinrs = fin.Expend(new CustFee
// {
// SENDUSERID = userid,
// LURURENID = userid,
// CtnrCount = 1,
// CtnrInfo = string.Empty,
// BSTYPE = 16,
// SENDTYPE = 0,
// BSNO = oid.ToString(),
// MBLNO = master.MBLNO.ToString(),
// }
//, 1);
DbBus.Get(DbList.AMSCenter).Update<ISF_Master>().Set(w => new ISF_Master { ReportState = "已提交", NewNotice = "重发发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
}
else if (msgType == "2")
{
DbBus.Get(DbList.AMSCenter).Update<ISF_Master>().Set(w => new ISF_Master { ReportState = "已提交", NewNotice = "修改发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
}
else
{
DbBus.Get(DbList.AMSCenter).Update<ISF_Master>().Set(w => new ISF_Master { ReportState = "已提交", NewNotice = "删除发送成功" }).Where(w => w.GID == oid).ExecuteAffrows();
}
}
}

@ -58,7 +58,6 @@ namespace djy_AmsApi.Controllers
}
result.data = ser.SaveInfo(Dto, GetLoginId.ToString());
return result;
}
#endregion
@ -126,9 +125,9 @@ namespace djy_AmsApi.Controllers
/// </summary>
/// <returns></returns>
[HttpGet("GetCountry")]
public Response<List<CommonCodeValue>> GetCountry()
public Response<List<CommonCNEN>> GetCountry()
{
var result = new Response<List<CommonCodeValue>>();
var result = new Response<List<CommonCNEN>>();
try
{
result.Result = ser.GetCountry();
@ -350,13 +349,13 @@ namespace djy_AmsApi.Controllers
var result = new Response<List<AMS_AddrTemplate>>();
try
{
if (GetLoginCompId == null)
if (GetLoginId == null)
{
result.Code = 401;
result.Message = "登录过期,请重新登录!";
return result;
}
result.Result = ser.GetTemplate(GetLoginCompId, type, TemPlateName);
result.Result = ser.GetTemplate(GetLoginId.ToString(), type, TemPlateName);
}
catch (Exception ex)
{

@ -93,20 +93,19 @@ namespace djy_AmsApi.Controllers.ISF
var result = new Response<List<ISF_CompanyTemplate>>();
try
{
if (GetLoginCompId == null)
if (GetLoginId == null)
{
result.Code = 401;
result.Message = "登录过期,请重新登录!";
return result;
}
result.Result = ser.GetTemplate(GetLoginCompId, CompanyType, InFoType, TemPlateName);
result.Result = ser.GetTemplate(GetLoginId.ToString(), CompanyType, InFoType, TemPlateName);
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save