master
wet 3 years ago
parent 6d64934a38
commit d889044ac8

File diff suppressed because it is too large Load Diff

@ -529,6 +529,7 @@ namespace Common
using (IDbConnection Conn = GetConn())
{
return Query<T>(sql, param);
}
}
}

@ -8,6 +8,7 @@ using Common;
using Common.Djy;
using djy.Model.AmsDto;
using Common.Utilities;
using djy.Model.Ams;
namespace djy.Paas.IService
{
@ -36,5 +37,13 @@ namespace djy.Paas.IService
List<CommonCodeValue> GetCountry();
}
List<CommonCodeValue> GetCARRIER();
List<CommonCodeValue> GetCTNALL();
List<CommonCodeValue> GetKINDPKGS();
List<AMS_SysDangerousGoods> GetDangerousGoods();
}
}

@ -1,8 +1,11 @@
using Dapper.Contrib.Extensions;
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using System;
namespace djy.Model.Ams
{
[Table("AMS_Cntrno")]
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_Cntrno", DisableSyncStructure = true)]
public class AMS_Cntrno
{
@ -10,12 +13,12 @@ namespace djy.Model.Ams
public AMS_Cntrno()
{
this.IsDel = "0";
this.IsDel = false;
}
/// <summary>
/// 主键
/// </summary>
[ExplicitKey]
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
/// <summary>
@ -96,7 +99,7 @@ namespace djy.Model.Ams
public string LINKMAN { get; set; }
public string IsDel { get; set; }
public bool IsDel { get; set; } = false;
/// <summary>
/// 包装code

@ -1,19 +1,22 @@
using Dapper.Contrib.Extensions;
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using System;
namespace djy.Model.Ams
{
[Table("AMS_House")]
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_House", DisableSyncStructure = true)]
public class AMS_House
{
public AMS_House(){
this.IsDel = "0";
this.IsDel = false;
}
/// <summary>
/// 主键
/// </summary>
[ExplicitKey]
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
/// <summary>
@ -85,13 +88,10 @@ namespace djy.Model.Ams
/// 通知人电话
/// </summary>
public string NOTIFYPARTYTEL { get; set; }
public string IsDel { get; set; }
public bool IsDel { get; set; } = false;
/// <summary>
/// 货代单运编号(选填)
/// </summary>
public string ShippingNo { get; set; }
/// <summary>
/// 发货人国家
/// </summary>
@ -117,7 +117,7 @@ namespace djy.Model.Ams
/// <summary>
/// 收货人国家code
/// </summary>
public string CONSIGNEECode { get; set; }
public string CONSIGNEECountryCode { get; set; }
/// <summary>
/// 收货人城市
/// </summary>
@ -132,7 +132,7 @@ namespace djy.Model.Ams
/// <summary>
/// 通知人国家code
/// </summary>
public string NOTIFYPARTYCode { get; set; }
public string NOTIFYPARTYCountryCode { get; set; }
/// <summary>
/// 通知人城市
/// </summary>

@ -1,21 +1,24 @@
using Dapper.Contrib.Extensions;
using System;

using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using System;
namespace djy.Model.Ams
{
[Table("AMS_Master")]
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_Master", DisableSyncStructure = true)]
public class AMS_Master
{
public AMS_Master() {
this.IsDel = "0";
this.IsDel = false;
this.CreateTime = DateTime.Now;
}
/// <summary>
/// 主键
/// </summary>
[ExplicitKey]
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
/// <summary>
@ -108,7 +111,7 @@ namespace djy.Model.Ams
public DateTime? CreateTime { get; set; }
public DateTime? LastUpdate { get; set; }
public string IsDel { get; set; }
public bool IsDel { get; set; } = false;
/// <summary>
/// 船东单运编号(选填)
/// </summary>

@ -0,0 +1,21 @@
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_SysCARRIER", DisableSyncStructure = true)]
public class AMS_SysCARRIER
{
/// <summary>
/// 主键
/// </summary>
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
public string Code { get; set; }
public string Value { get; set; }
}
}

@ -0,0 +1,22 @@
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_SysCTNALL", DisableSyncStructure = true)]
public class AMS_SysCTNALL
{
/// <summary>
/// 主键
/// </summary>
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
public string Code { get; set; }
public string Value { get; set; }
}
}

@ -0,0 +1,22 @@
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_SysCountry", DisableSyncStructure = true)]
public class AMS_SysCountry
{
/// <summary>
/// 主键
/// </summary>
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
public string Code { get; set; }
public string Value { get; set; }
}
}

@ -0,0 +1,24 @@
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_SysDangerousGoods", DisableSyncStructure = true)]
public class AMS_SysDangerousGoods
{
/// <summary>
/// 主键
/// </summary>
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
public string Code { get; set; }
public string Value { get; set; }
public string Describe { get; set; }
}
}

@ -0,0 +1,22 @@
using FreeSql.DataAnnotations;
using Newtonsoft.Json;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_SysKINDPKGS", DisableSyncStructure = true)]
public class AMS_SysKINDPKGS
{
/// <summary>
/// 主键
/// </summary>
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
public string Code { get; set; }
public string Value { get; set; }
}
}

@ -6,6 +6,10 @@ namespace djy.Model.AmsDto
{
public class AMSDto
{
public AMSDto()
{
this.IsDel = false;
}
/// <summary>
/// 主键
/// </summary>
@ -103,7 +107,7 @@ namespace djy.Model.AmsDto
public DateTime? CreateTime { get; set; }
public DateTime? LastUpdate { get; set; }
public string IsDel { get; set; }
public bool IsDel { get; set; }=false;
/// <summary>
/// 船东单运编号(选填)
/// </summary>
@ -135,6 +139,10 @@ namespace djy.Model.AmsDto
public class AMS_HouseDto {
public AMS_HouseDto()
{
this.IsDel = false;
}
/// <summary>
/// 主键
/// </summary>
@ -209,13 +217,10 @@ namespace djy.Model.AmsDto
/// 通知人电话
/// </summary>
public string NOTIFYPARTYTEL { get; set; }
public string IsDel { get; set; }
public bool IsDel { get; set; } = false;
/// <summary>
/// 货代单运编号(选填)
/// </summary>
public string ShippingNo { get; set; }
/// <summary>
/// 发货人国家
/// </summary>
@ -241,7 +246,7 @@ namespace djy.Model.AmsDto
/// <summary>
/// 收货人国家code
/// </summary>
public string CONSIGNEECode { get; set; }
public string CONSIGNEECountryCode { get; set; }
/// <summary>
/// 收货人城市
/// </summary>
@ -256,7 +261,7 @@ namespace djy.Model.AmsDto
/// <summary>
/// 通知人国家code
/// </summary>
public string NOTIFYPARTYCode { get; set; }
public string NOTIFYPARTYCountryCode { get; set; }
/// <summary>
/// 通知人城市
/// </summary>

@ -16,7 +16,6 @@ using Common.DJYModel;
using System.Transactions;
using Dapper.Contrib.Extensions;
using Common.Utilities;
namespace djy.Service.Ams
{
/// <summary>
@ -24,24 +23,22 @@ namespace djy.Service.Ams
/// </summary>
public class AmsService : ServBase, IAmsService
{
DapperDBBase dapper = new DapperDBBase();
public TableData Load(AMSQuery req, string userid)
{
var result = new TableData();
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
var dto = DbBus.Get(DbList.AMSCenter).Select<AMS_Master>().Where(x => x.IsDel == "0" || x.IsDel == null&&x.CompID==user.CompId).WhereIf(req.MBLNO != null, x => x.MBLNO == req.MBLNO);
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 => x.MBLNO == req.MBLNO);
result.count = dto.ToList().Count();
var list= dto.Page(req.Page,req.Limit).ToList<AMSDto>();
if (list != null) {
foreach (var item in list)
{
var hodto = DbBus.Get(DbList.AMSCenter).Select<AMS_House>().Where(x => x.IsDel == "0" || 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).ToList<AMS_HouseDto>();
item.HouseDto = hodto;
if (hodto!=null) {
foreach (var it in hodto)
{
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel == "0" || x.IsDel == null && x.HID == it.GID).ToList();
var cnt = DbBus.Get(DbList.AMSCenter).Select<AMS_Cntrno>().Where(x => x.IsDel == false || x.IsDel == null && x.HID == it.GID).ToList();
it.CntrnoDto = cnt;
}
}
@ -54,135 +51,95 @@ namespace djy.Service.Ams
public void Delete(string ids)
{
string[] id = ids.Split(',');
using (var transaction = new TransactionScope())
{
using (IDbConnection connection = dapper.GetConn())
DbBus.Get(DbList.AMSCenter).Transaction(() => {
foreach (string oid in id)
{
try {
foreach (string oid in id)
{
if (oid != "")
{
connection.Execute("update AMS_Cntrno set isdel ='1' where pid='" + oid + "'");
connection.Execute("update AMS_House set isdel ='1' where pid='" + oid + "'");
connection.Execute("update AMS_Master set isdel ='1' where gid='" + oid + "'");
}
}
transaction.Complete();
connection.Dispose();
connection.Close();
if (oid != "")
{
DbBus.Get(DbList.AMSCenter).Update<AMS_Master>().Set(w => w.IsDel,true).Where(w => w.GID ==oid).ExecuteAffrows();
DbBus.Get(DbList.AMSCenter).Update<AMS_House>().Set(w => w.IsDel, true).Where(w => w.PID == oid).ExecuteAffrows();
DbBus.Get(DbList.AMSCenter).Update<AMS_Cntrno>().Set(w => w.IsDel, true).Where(w => w.PID == oid).ExecuteAffrows();
}
catch (Exception ex) {
connection.Dispose();
connection.Close();
}
}
}
});
}
public async void SaveInfo(AMSDto dto, string userid)
public void SaveInfo(AMSDto dto, string userid)
{
if (dto.GID.IsNull())
{
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
using (var transaction = new TransactionScope())
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
using (IDbConnection connection = dapper.GetConn())
{
try
{
AMS_Master master = dto.MapTo<AMS_Master>();
master.CreateTime = DateTime.Now;
master.LastUpdate = DateTime.Now;
master.GID = Guid.NewGuid().ToString("N");
master.UserID = user.GID;
master.UserName = user.SHOWNAME;
master.CompID = user.CompId;
master.CompName = user.COMNAME;
connection.Insert<AMS_Master>(master);
if (dto.HouseDto != null && dto.HouseDto.Count() > 0)
{
foreach (var item in dto.HouseDto)
{
AMS_House house = dto.MapTo<AMS_House>();
house.GID = Guid.NewGuid().ToString("N");
house.PID = master.GID;
connection.Insert<AMS_House>(house);
if (item.CntrnoDto!=null&&item.CntrnoDto.Count()>0) {
foreach (var it in item.CntrnoDto)
{
AMS_Cntrno cntrno = dto.MapTo<AMS_Cntrno>();
cntrno.GID = Guid.NewGuid().ToString("N");
cntrno.PID = master.GID;
cntrno.HID = house.GID;
connection.Insert<AMS_Cntrno>(cntrno);
}
}
AMS_Master master = dto.MapTo<AMS_Master>();
master.CreateTime = DateTime.Now;
master.LastUpdate = DateTime.Now;
master.GID = Guid.NewGuid().ToString("N");
master.UserID = user.GID;
master.UserName = user.SHOWNAME;
master.CompID = user.CompId;
master.CompName = user.COMNAME;
master.IsDel = false;
DbBus.Get(DbList.AMSCenter).Insert(master).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;
DbBus.Get(DbList.AMSCenter).Insert(house).ExecuteAffrows();
if (item.CntrnoDto!=null&&item.CntrnoDto.Count()>0) {
foreach (var it in item.CntrnoDto)
{
AMS_Cntrno cntrno = it.MapTo<AMS_Cntrno>();
cntrno.GID = Guid.NewGuid().ToString("N");
cntrno.PID = master.GID;
cntrno.HID = house.GID;
cntrno.IsDel = false;
DbBus.Get(DbList.AMSCenter).Insert(cntrno).ExecuteAffrows();
}
}
transaction.Complete();
connection.Dispose();
connection.Close();
}
catch (Exception ex)
{
connection.Dispose();
connection.Close();
}
}
}
}
}
});
}
}
else
{
using (var transaction = new TransactionScope())
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
using (IDbConnection connection = dapper.GetConn())
AMS_Master master = dto.MapTo<AMS_Master>();
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();
if (dto.HouseDto != null && dto.HouseDto.Count() > 0)
{
try
foreach (var item in dto.HouseDto)
{
AMS_Master master = dto.MapTo<AMS_Master>();
connection.Update<AMS_Master>(master);
connection.Execute("delete AMS_House where pid='"+ master.GID + "'");
connection.Execute("delete AMS_Cntrno where pid='" + master.GID + "'");
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;
DbBus.Get(DbList.AMSCenter).Insert(house).ExecuteAffrows();
if (item.CntrnoDto != null && item.CntrnoDto.Count() > 0)
{
foreach (var it in item.CntrnoDto)
{
AMS_House house = dto.MapTo<AMS_House>();
house.GID = Guid.NewGuid().ToString("N");
house.PID = master.GID;
connection.Insert<AMS_House>(house);
if (item.CntrnoDto!=null&&item.CntrnoDto.Count()>0) {
foreach (var it in item.CntrnoDto)
{
AMS_Cntrno cntrno = dto.MapTo<AMS_Cntrno>();
cntrno.GID = Guid.NewGuid().ToString("N");
cntrno.PID = master.GID;
cntrno.HID = house.GID;
connection.Insert<AMS_Cntrno>(cntrno);
}
}
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();
}
}
transaction.Complete();
connection.Dispose();
connection.Close();
}
catch (Exception ex)
{
connection.Dispose();
connection.Close();
}
}
}
});
}
}
@ -191,15 +148,66 @@ namespace djy.Service.Ams
{
try
{
var List = dapper.Query<CommonCodeValue>("select Code,Value from AMS_SysCARRIER order by value");
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_SysCountry>().ToList<CommonCodeValue>();
return List;
}
catch (Exception e)
{
throw;
}
}
public List<CommonCodeValue> GetCARRIER()
{
try
{
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_SysCARRIER>().ToList<CommonCodeValue>();
return List;
}
catch (Exception e)
{
throw;
}
}
public List<CommonCodeValue> GetCTNALL()
{
try
{
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_SysCTNALL>().ToList<CommonCodeValue>();
return List;
}
catch (Exception e)
{
throw;
}
}
public List<CommonCodeValue> GetKINDPKGS()
{
try
{
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_SysKINDPKGS>().ToList<CommonCodeValue>();
return List;
}
catch (Exception e)
{
throw;
}
}
public List<AMS_SysDangerousGoods> GetDangerousGoods()
{
try
{
var List = DbBus.Get(DbList.AMSCenter).Select<AMS_SysDangerousGoods>().ToList();
return List;
}
catch (Exception e)
{
throw;
}
}
}
}

@ -15,25 +15,22 @@ namespace djy_AmsApi.Controllers
[AllowAnonymous]
public class AmsController : ApiBase
{
AmsService ser =new AmsService();
[HttpPost("AddOrUpdate")]
public Response AddOrUpdate(AMSDto Dto)
{
var result = new Response();
if (GetLoginId == null)
{
result.Code = 401;
result.Message = "登录过期,请重新登录!";
}
//if (GetLoginId == null)
//{
// result.Code = 401;
// result.Message = "登录过期,请重新登录!";
//}
if (Dto == null)
{
result.Code = 500;
result.Message = "无效数据!";
}
ser.SaveInfo(Dto, GetLoginId.ToString());
ser.SaveInfo(Dto, "d85fd590-d9f6-4410-93a1-f6fac77b606e");
return result;
}
@ -42,14 +39,14 @@ namespace djy_AmsApi.Controllers
[HttpGet("Load")]
public object Load([FromQuery] AMSQuery request)
{
if (GetLoginId == null)
{
var result = new Response();
result.Code = 401;
result.Message = "登录过期,请重新登录!";
return result;
}
return ser.Load(request, GetLoginId.ToString());
//if (GetLoginId == null)
//{
// var result = new Response();
// result.Code = 401;
// result.Message = "登录过期,请重新登录!";
// return result;
//}
return ser.Load(request, "d85fd590-d9f6-4410-93a1-f6fac77b606e");
}
@ -94,8 +91,90 @@ namespace djy_AmsApi.Controllers
/// <summary>
/// 下拉获取船公司
/// </summary>
/// <returns></returns>
[HttpGet("GetCARRIER")]
public Response<List<CommonCodeValue>> GetCARRIER()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetCARRIER();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取箱型
/// </summary>
/// <returns></returns>
[HttpGet("GetCTNALL")]
public Response<List<CommonCodeValue>> GetCTNALL()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetCTNALL();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取包装单位
/// </summary>
/// <returns></returns>
[HttpGet("GetKINDPKGS")]
public Response<List<CommonCodeValue>> GetKINDPKGS()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetKINDPKGS();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
/// <summary>
/// 下拉获取危品等级及 CODE
/// </summary>
/// <returns></returns>
[HttpGet("GetDangerousGoods")]
public Response<List<AMS_SysDangerousGoods>> GetDangerousGoods()
{
var result = new Response<List<AMS_SysDangerousGoods>>();
try
{
result.Result = ser.GetDangerousGoods();
}
catch (Exception ex)
{
result.Code = 500;
result.Message = ex.InnerException?.Message ?? ex.Message;
}
return result;
}
}
}

@ -3,7 +3,7 @@
<PropertyGroup>
<Controller_SelectedScaffolderID>MvcControllerEmptyScaffolder</Controller_SelectedScaffolderID>
<Controller_SelectedScaffolderCategoryPath>root/Common/MVC/Controller</Controller_SelectedScaffolderCategoryPath>
<NameOfLastUsedPublishProfile>FolderProfile</NameOfLastUsedPublishProfile>
<NameOfLastUsedPublishProfile>F:\DJY.AMS\ams\djy.WebApi\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile>
<ActiveDebugProfile>IIS Express</ActiveDebugProfile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

Loading…
Cancel
Save