AMS历史记录

master
wet 3 years ago
parent be499e7907
commit ed3d5b3791

@ -33,7 +33,7 @@ namespace djy.Paas.IService
void Delete(string ids);
void Delete(string ids,string userid);
List<CommonCodeValue> GetCountry();

@ -6,11 +6,12 @@ using System;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_Master", DisableSyncStructure = true)]
public class AMS_Master
{
public AMS_Master() {
{
public AMS_Master()
{
this.IsDel = false;
this.CreateTime = DateTime.Now;
}
@ -137,5 +138,22 @@ namespace djy.Model.Ams
/// 最后一个非美港/中转港Code
/// </summary>
public string LastNoUsPortCode { get; set; }
/// <summary>
/// 申报状态
/// </summary>
public string ReportState { get; set; }
/// <summary>
/// 匹配状态
/// </summary>
public string MateState { get; set; }
/// <summary>
/// 最新通知
/// </summary>
public string NewNotice { get; set; }
}
}

@ -0,0 +1,56 @@

using FreeSql.DataAnnotations;
using Newtonsoft.Json;
using System;
namespace djy.Model.Ams
{
[JsonObject(MemberSerialization.OptIn), Table(Name = "AMS_MasterHistory", DisableSyncStructure = true)]
public class AMS_MasterHistory
{
/// <summary>
/// 主键
/// </summary>
[JsonProperty, Column(IsPrimary = true, IsNullable = false)]
public string GID { get; set; }
/// <summary>
/// 业务id
/// </summary>
public string AM_ID { get; set; }
/// <summary>
/// 发送时间
/// </summary>
public DateTime? SendTime { get; set; }
/// <summary>
/// 类型
/// </summary>
public string Type { get; set; }
/// <summary>
/// 状态
/// </summary>
public string State { get; set; }
/// <summary>
/// 备注说明
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 操作人
/// </summary>
public string Operator { get; set; }
}
}

@ -133,6 +133,22 @@ namespace djy.Model.AmsDto
/// 最后一个非美港/中转港Code
/// </summary>
public string LastNoUsPortCode { get; set; }
/// <summary>
/// 申报状态
/// </summary>
public string ReportState { get; set; }
/// <summary>
/// 匹配状态
/// </summary>
public string MateState { get; set; }
/// <summary>
/// 最新通知
/// </summary>
public string NewNotice { get; set; }
public List<AMS_MasterHistory> HistoryDto { get; set; }
public List<AMS_HouseDto> HouseDto { get; set; } = new List<AMS_HouseDto>();
}

@ -5,8 +5,17 @@ namespace djy.Model.AmsDto
{
public class AMSQuery : PageEntity
{
/// <summary>
/// 提单号
/// </summary>
public string MBLNO { get; set; }
/// <summary>
/// 申报状态
/// </summary>
public string ReportState { get; set; }
}
}
}

@ -33,13 +33,16 @@ namespace djy.Service.Ams
{
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 == false || 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).WhereIf(req.ReportState != null, x => x.ReportState == req.ReportState);
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();
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>();
item.HouseDto = hodto;
if (hodto != null)
@ -56,8 +59,9 @@ namespace djy.Service.Ams
return result;
}
public void Delete(string ids)
public void Delete(string ids,string userid)
{
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
string[] id = ids.Split(',');
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
@ -65,9 +69,21 @@ namespace djy.Service.Ams
{
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();
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
AMS_MasterHistory history = new AMS_MasterHistory();
history.GID = Guid.NewGuid().ToString("N");
history.AM_ID=oid;
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();
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();
});
}
}
});
@ -75,9 +91,10 @@ namespace djy.Service.Ams
public void SaveInfo(AMSDto dto, string userid)
{
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
if (dto.GID.IsNull())
{
var user = DbBus.Get(DbList.djydb).Select<User>().Where(w => w.GID == userid).ToOne();
DbBus.Get(DbList.AMSCenter).Transaction(() =>
{
@ -90,8 +107,17 @@ namespace djy.Service.Ams
master.CompID = user.CompId;
master.CompName = user.COMNAME;
master.IsDel = false;
master.ReportState = "未申报";
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)
@ -125,7 +151,15 @@ namespace djy.Service.Ams
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;
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)

@ -56,7 +56,14 @@ namespace djy_AmsApi.Controllers
var result = new Response();
try
{
ser.Delete(ids);
//if (GetLoginId == null)
//{
// var result = new Response();
// result.Code = 401;
// result.Message = "登录过期,请重新登录!";
// return result;
//}
ser.Delete(ids, "d85fd590-d9f6-4410-93a1-f6fac77b606e");
}
catch (Exception ex)

Loading…
Cancel
Save