|
|
|
@ -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)
|
|
|
|
|