From 6d5835c7ae70c60b447d6430eb478f6ddb905bbe Mon Sep 17 00:00:00 2001 From: zhangxiaofeng <1939543722@qq.com> Date: Wed, 26 Jun 2024 15:51:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E8=BF=9B=E5=8F=A3=E8=BF=90?= =?UTF-8?q?=E8=B8=AA=EF=BC=81=EF=BC=81=EF=BC=81=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/OpenController.cs | 61 ++++++ .../Controllers/OrderController.cs | 176 +++++++++++++++++- EntrustSettle.Api/NLog.config | 4 +- EntrustSettle.Api/appsettings.Production.json | 6 + EntrustSettle.Api/appsettings.Staging.json | 7 + EntrustSettle.Api/appsettings.json | 17 +- EntrustSettle.IServices/BASE/IBaseServices.cs | 49 +---- EntrustSettle.Model/Const/DBConst.cs | 5 + .../BillTrace/OpSeaiBillTraceSelectDto.cs | 23 +++ .../Dtos/BillTrace/PushBilltraceDto.cs | 13 ++ .../Dtos/Order/CtnBilltraceDto.cs | 27 +++ EntrustSettle.Model/Dtos/Order/OrderDto.cs | 42 +++++ .../Dtos/Order/OrderListInputDto.cs | 18 ++ .../Dtos/OrderHistory/OrderHistoryDto.cs | 1 + .../Models/BillTrace/OpSeaiBillTrace.cs | 38 ++++ .../Models/BillTrace/OpSeaiBillTraceCtn.cs | 24 +++ EntrustSettle.Model/Models/Order.cs | 4 + EntrustSettle.Model/Models/OrderHistory.cs | 2 +- .../BASE/BaseRepository.cs | 111 +---------- .../BASE/IBaseRepository.cs | 49 +---- .../RoleModulePermissionRepository.cs | 16 +- EntrustSettle.Services/BASE/BaseServices.cs | 64 +------ 22 files changed, 487 insertions(+), 270 deletions(-) create mode 100644 EntrustSettle.Model/Dtos/BillTrace/OpSeaiBillTraceSelectDto.cs create mode 100644 EntrustSettle.Model/Dtos/BillTrace/PushBilltraceDto.cs create mode 100644 EntrustSettle.Model/Dtos/Order/CtnBilltraceDto.cs create mode 100644 EntrustSettle.Model/Models/BillTrace/OpSeaiBillTrace.cs create mode 100644 EntrustSettle.Model/Models/BillTrace/OpSeaiBillTraceCtn.cs diff --git a/EntrustSettle.Api/Controllers/OpenController.cs b/EntrustSettle.Api/Controllers/OpenController.cs index 8abdcb6..5399d67 100644 --- a/EntrustSettle.Api/Controllers/OpenController.cs +++ b/EntrustSettle.Api/Controllers/OpenController.cs @@ -613,6 +613,67 @@ namespace EntrustSettle.Api.Controllers } } + + /// + /// 进口运踪接口推送状态 + /// + [HttpPost] + [ApiUser(ApiCode = "PushBilltrace")] + public async Task PushBilltrace([FromBody] List input) + { + var gidList = input.Select(x => x.Gid); + var orderList = await orderService.AsQueryable().Where(x => gidList.Contains(x.BilltraceGid)).ToListAsync(x => new + { + x.Id, + x.Bsno, + x.BilltraceGid + }); + + foreach (var item in input) + { + var order = orderList.FirstOrDefault(x => x.BilltraceGid == item.Gid); + if (order == null) + { + string msg = $"进口运踪接口推送状态时未找到订单,Gid:{item.Gid}"; + logger.LogInformation(msg); + continue; + } + + // 记录订单状态历史(不在页面显示) + await orderHistoryService.Add(new OrderHistory() + { + Pid = order.Id, + StatusTime = DateTime.Now, + Status = 10, + IsDeleted = true, + Remark = "(状态接收)", + }); + + // 反馈陆海 + var feedbackList = new List() + { + new HydFeedbackDto() + { + orderNo = order.Bsno, + remark = "【集装箱已提取完毕】" + } + }; + await App.GetService().FeedBack(feedbackList); + + // 记录反馈信息 + var id = await annexService.Add(new Annex() + { + Remark = "【集装箱已提取完毕】", + Type = 2 + }); + await orderAnnexService.Add(new OrderAnnex() + { + AnnexId = id, + OrderId = order.Id + }); + } + return SuccessMsg(); + } //[HttpGet] //public string TestTime() //{ diff --git a/EntrustSettle.Api/Controllers/OrderController.cs b/EntrustSettle.Api/Controllers/OrderController.cs index aa677e2..7fe061a 100644 --- a/EntrustSettle.Api/Controllers/OrderController.cs +++ b/EntrustSettle.Api/Controllers/OrderController.cs @@ -8,6 +8,7 @@ using EntrustSettle.IServices.Base; using EntrustSettle.Model; using EntrustSettle.Model.Dtos; using EntrustSettle.Model.Models; +using EntrustSettle.Model.Models.BillTrace; using EntrustSettle.Model.Models.DJY; using EntrustSettle.Model.Validator; using EntrustSettle.Repository.UnitOfWorks; @@ -15,7 +16,9 @@ using FluentValidation; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Microsoft.IdentityModel.Tokens; using Newtonsoft.Json; +using SqlSugar; using System.Text; namespace EntrustSettle.Api.Controllers @@ -38,6 +41,9 @@ namespace EntrustSettle.Api.Controllers private readonly IQueueService queueService; private readonly IInvoiceApplyService invoiceApplyService; + private readonly IBaseServices billtraceService; + private readonly IBaseServices billtraceCtnService; + public OrderController(IOrderService orderService, IOrderAnnexService orderFileService, @@ -48,7 +54,9 @@ namespace EntrustSettle.Api.Controllers IAnnexService annexService, IOrderFeeService orderFeeService, IQueueService queueService, - IInvoiceApplyService invoiceApplyService) + IInvoiceApplyService invoiceApplyService, + IBaseServices billtraceService, + IBaseServices billtraceCtnService) { this.orderService = orderService; this.orderAnnexService = orderFileService; @@ -60,6 +68,8 @@ namespace EntrustSettle.Api.Controllers this.orderFeeService = orderFeeService; this.queueService = queueService; this.invoiceApplyService = invoiceApplyService; + this.billtraceService = billtraceService; + this.billtraceCtnService = billtraceCtnService; } /// /// 获取订单列表 @@ -75,6 +85,25 @@ namespace EntrustSettle.Api.Controllers } } + // 运踪筛选条件 + List queryBilltraceGidList = null; + if (input.BillTraceState != null || input.AtaStart != null || input.AtaEnd != null) + { + var billtraceGidPageList = await billtraceService.AsQueryable() + .Where(x => x.IsOuter == true && x.CompID == App.User.CompanyId) + .WhereIF(input.BillTraceState == 1, x => x.StaCangDan == "Y") + .WhereIF(input.BillTraceState == 2, x => x.StaHaiGuan == "Y") + .WhereIF(input.BillTraceState == 3, x => x.StaTiHuo == "Y") + .WhereIF(input.BillTraceState == 4, x => x.StaFanKong == "Y") + .WhereIF(input.AtaStart != null, x => x.ATA >= input.AtaStart) + .WhereIF(input.AtaEnd != null, x => x.ATA <= input.AtaEnd.Value.AddDays(1)) + .OrderByDescending(x => x.CreateTime) + .Select(x => x.GID) + .ToPageListAsyncExtension(input.pageIndex, input.pageSize); + + queryBilltraceGidList = billtraceGidPageList.data; + } + // 可以查看所有数据的用户Gid列表 var seeAllDataUserGids = AppSettings.app("Startup", "SeeAllDataUserGids"); @@ -87,16 +116,18 @@ namespace EntrustSettle.Api.Controllers .WhereIF(input.Status != null, x => x.Status == (int)input.Status) .WhereIF(input.CreateTimeStart != null, x => x.CreateTime >= input.CreateTimeStart) .WhereIF(input.CreateTimeEnd != null, x => x.CreateTime <= input.CreateTimeEnd) + .WhereIF(queryBilltraceGidList != null, x => queryBilltraceGidList.Contains(x.BilltraceGid)) .Select() .OrderBy("id desc") .ToPageListAsyncExtension(input.pageIndex, input.pageSize); //var sql = orderService.AsQueryable() - //.WhereIF(!seeAllDataUserGids.Contains(App.User.ID) && input.QueryType != 2, x => x.CompanyId == App.User.CompanyId).ToSqlString(); + //.WhereIF(!seeAllDataUserGids.Contains(App.User.ID) && input.QueryType != 2, x => x.CompanyId == App.User.CompanyId).ToSqlString(); var orderIdList = result.data.Select(x => x.Id).ToList(); if (orderIdList.Count > 0) { + // 为订单列表绑定发票及账单状态 var orderWithTypeList = await orderAnnexService.AsQueryable() .LeftJoin((o, a) => o.AnnexId == a.Id) .Where((o, a) => orderIdList.Contains(o.OrderId) && (a.Type == 3 || a.Type == 4)) @@ -116,17 +147,88 @@ namespace EntrustSettle.Api.Controllers order.IsHasInvoiceAnnex = true; } } + + // 查询运踪信息 + var billtraceGidList = result.data.Where(x => !string.IsNullOrEmpty(x.BilltraceGid)).Select(x => x.BilltraceGid).ToList(); + var billtraceList = await billtraceService.AsQueryable() + .Where(x => billtraceGidList.Contains(x.GID)) + .Select() + .ToListAsync(); + + var ctnBilltraceList = await billtraceCtnService.AsQueryable() + .Where(x => billtraceGidList.Contains(x.PID)) + .GroupBy(x => x.PID) + .Select(x => new + { + x.PID, + numAll = SqlFunc.AggregateCount(x.GID), + numTiXiang = SqlFunc.AggregateSum(SqlFunc.IIF(x.StaTiHuo == "Y", 1, 0)), + numFanKong = SqlFunc.AggregateSum(SqlFunc.IIF(x.StaFanKong == "Y", 1, 0)) + }).ToListAsync(); + result.data.ForEach(x => { if (!string.IsNullOrWhiteSpace(x.MailBillNo)) { x.IsHasInvoiceAnnex = true; } + + // 绑定主要运踪 + var billtrace = billtraceList.FirstOrDefault(b => b.GID == x.BilltraceGid); + if (billtrace != null) + { + x.IsCangdan = billtrace.StaCangDan == "Y"; + x.IsHaifang = billtrace.StaHaiGuan == "Y"; + x.TimeHaiFang = billtrace.TimeHaiGuan; + + x.StaTiXiang = billtrace.StaTiHuo; + x.StaFanKong = billtrace.StaFanKong; + + x.ATA = billtrace.ATA; + } + + // 绑定箱信息运踪 + var ctnBilltrace = ctnBilltraceList.FirstOrDefault(c => c.PID == x.BilltraceGid); + if (ctnBilltrace != null) + { + x.CtnNumAll = ctnBilltrace.numAll; + x.CtnNumTiXiang = ctnBilltrace.numTiXiang; + x.CtnNumFanKong = ctnBilltrace.numFanKong; + } }); } return SuccessPage(result); } + + + /// + /// 查询箱信息运踪详情 + /// + [HttpGet] + public async Task>> GetCtnBilltraceList(long id) + { + var order = await orderService.QueryFirst(x => x.Id == id, x => new + { + x.BilltraceGid + }); + + if (string.IsNullOrEmpty(order.BilltraceGid)) + { + throw new Exception("运踪未订阅"); + } + + var ctnList = await billtraceCtnService.Query(x => x.PID == order.BilltraceGid, x => new CtnBilltraceDto() + { + Cntrno = x.CNTRNO, + FanKongTime = x.TimeFanKong, + StockpilingDays = x.StoreDays, + TiXiangTime = x.TimeTiHuo, + }); + + return Success(ctnList); + } + [HttpGet] [AllowAnonymous] //[ApiUser(ApiCode = "OrderSubmit")] @@ -175,12 +277,31 @@ namespace EntrustSettle.Api.Controllers var custBalanceService = App.GetService>(); var taxCode = await custBalanceService.Db.Queryable().Where(x => x.CompId == inputDto.CompanyId).Select(x => x.TaxCode).FirstAsync(); - var orderList = new List(); + var orderList = new List(inputDto.MblnoList.Length); + var billtraceList = new List(inputDto.MblnoList.Length); foreach (var item in inputDto.MblnoList) { + var billtrace = new OpSeaiBillTrace + { + GID = Guid.NewGuid().ToString(), + UserID = App.User.ID, + UserName = App.User.Name, + CompID = inputDto.CompanyId, + CompName = inputDto.CompanyName, + MBLNO = item, + StaCangDan = "N", + StaHaiGuan = "N", + StaTiHuo = "N", + StaFanKong = "N", + IsOuter = true, + CreateTime = DateTime.Now + }; + billtraceList.Add(billtrace); + var order = new Order { Mblno = item, + BilltraceGid = billtrace.GID, CompanyId = inputDto.CompanyId, CompanyName = inputDto.CompanyName, TaxCode = taxCode, @@ -238,6 +359,9 @@ namespace EntrustSettle.Api.Controllers unitOfWorkManage.CommitTran(); + // 保存到运踪表中 + await billtraceService.Add(billtraceList); + // 查询所有待处理订单列表 var pendingOrderList = await orderService.Query(x => x.IsSend == false && orderIdList.Contains(x.Id)); @@ -326,6 +450,52 @@ namespace EntrustSettle.Api.Controllers return Success(result); } + + /// + /// 补充订阅运踪 + /// + [HttpPost] + public async Task SubcribeBilltrace([FromBody] long[] ids) + { + var billtraceList = new List(ids.Length); + + var orderList = await orderService.Query(x => ids.Contains(x.Id)); + foreach (var item in orderList) + { + if (!string.IsNullOrEmpty(item.BilltraceGid) && await billtraceService.AsQueryable().AnyAsync(x => x.GID == item.BilltraceGid)) + { + continue; + } + + var billtrace = new OpSeaiBillTrace + { + GID = Guid.NewGuid().ToString(), + UserID = item.CreateId, + UserName = item.CreateBy, + CompID = item.CompanyId, + CompName = item.CompanyName, + MBLNO = item.Mblno, + StaCangDan = "N", + StaHaiGuan = "N", + StaTiHuo = "N", + StaFanKong = "N", + IsOuter = true, + CreateTime = DateTime.Now + }; + billtraceList.Add(billtrace); + + if (await billtraceService.AsInsertable(billtrace).ExecuteCommandAsync() > 0) + { + await orderService.Update(x => new Order + { + BilltraceGid = billtrace.GID + }, x => x.Id == item.Id); + } + } + + return SuccessMsg(); + } + /// /// 获取订单附件信息列表 /// diff --git a/EntrustSettle.Api/NLog.config b/EntrustSettle.Api/NLog.config index ab2aaaa..d1b9bb8 100644 --- a/EntrustSettle.Api/NLog.config +++ b/EntrustSettle.Api/NLog.config @@ -3,7 +3,9 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" autoReload="true" throwExceptions="false" - internalLogLevel="off" internalLogFile="${basedir}/Logs/nlog-internal.log"> + internalLogLevel="off" internalLogFile="${basedir}/Logs/nlog-internal.log" + maxArchiveDays="7" + maxArchiveFiles="50"> diff --git a/EntrustSettle.Api/appsettings.Production.json b/EntrustSettle.Api/appsettings.Production.json index 88190f1..aee969d 100644 --- a/EntrustSettle.Api/appsettings.Production.json +++ b/EntrustSettle.Api/appsettings.Production.json @@ -184,6 +184,12 @@ "DBType": 1, "Enabled": true, "Connection": "Server=172.31.85.154,1433;Database=DsPingTai;User=sa;Password=QDdjy#2020*;MultipleActiveResultSets=True;" + }, + { + "ConnId": "BillTrace", + "DBType": 1, + "Enabled": true, + "Connection": "172.31.85.161,1433;Database=BillTrace;User=sa;Password=QDdjy#2020*;MultipleActiveResultSets=True;" } ], "Mongo": { diff --git a/EntrustSettle.Api/appsettings.Staging.json b/EntrustSettle.Api/appsettings.Staging.json index 24c6a91..5ba3f8e 100644 --- a/EntrustSettle.Api/appsettings.Staging.json +++ b/EntrustSettle.Api/appsettings.Staging.json @@ -184,6 +184,13 @@ "DBType": 1, "Enabled": true, "Connection": "Data Source =192.168.1.86,6333; Initial Catalog=TestDsPingTai; Persist Security Info=True; User ID =sa; Password=Djy@Sql2022.test;pooling=true" + }, + { + "ConnId": "BillTrace", + "DBType": 1, + "Enabled": true, + "Connection": "Data Source =60.209.125.238,32009; Initial Catalog=TestBillTrace; Persist Security Info=True; User ID =sa; Password=Djy@Sql2022.test;pooling=true" + //"Connection": "Data Source =47.104.73.97,6762; Initial Catalog=BillTrace; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true" } ], "Mongo": { diff --git a/EntrustSettle.Api/appsettings.json b/EntrustSettle.Api/appsettings.json index a2d9a06..7fb1a22 100644 --- a/EntrustSettle.Api/appsettings.json +++ b/EntrustSettle.Api/appsettings.json @@ -153,8 +153,8 @@ "ConnId": "Main", "DBType": 0, "Enabled": true, - "Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=EntrustSettle;Uid=rulesengine_admin;Pwd=Rule1qaz2wsx!QAZ;Port=3306;Allow User Variables=True;Charset=utf8;TreatTinyAsBoolean=false;", - //"Connection": "server=60.209.125.238;Database=entrustsettle_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;Allow User Variables=True;Charset=utf8;TreatTinyAsBoolean=false;", + //"Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=EntrustSettle;Uid=rulesengine_admin;Pwd=Rule1qaz2wsx!QAZ;Port=3306;Allow User Variables=True;Charset=utf8;TreatTinyAsBoolean=false;", + "Connection": "server=60.209.125.238;Database=entrustsettle_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;Allow User Variables=True;Charset=utf8;TreatTinyAsBoolean=false;", "Slaves": [ { "HitRate": 0, // 值越大,优先级越高 0不使用 @@ -179,15 +179,22 @@ "DBType": 0, "Enabled": false, "HitRate": 50, - "Connection": "60.209.125.238;Database=entrustsettlelog_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;Allow User Variables=True;", + "Connection": "60.209.125.238;Database=entrustsettlelog_dev;User ID=root;Password=Djy@Mysql.test;pooling=true;port=32006;Allow User Variables=True;" //"Connection": "server=rm-m5e06xxqpa68a68ry5o.mysql.rds.aliyuncs.com;Database=EntrustSettleLog;Uid=rulesengine_admin;Pwd=Rule1qaz2wsx!QAZ;Port=3306;Allow User Variables=True;" }, { "ConnId": "PingTai", "DBType": 1, "Enabled": true, - //"Connection": "Data Source =60.209.125.238,32009; Initial Catalog=TestDsPingTai; Persist Security Info=True; User ID =sa; Password=Djy@Sql2022.test;pooling=true", - "Connection": "Data Source =47.104.73.97,6761; Initial Catalog=DsPingTai; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true" + "Connection": "Data Source =60.209.125.238,32009; Initial Catalog=TestDsPingTai; Persist Security Info=True; User ID =sa; Password=Djy@Sql2022.test;pooling=true" + //"Connection": "Data Source =47.104.73.97,6761; Initial Catalog=DsPingTai; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true" + }, + { + "ConnId": "BillTrace", + "DBType": 1, + "Enabled": true, + "Connection": "Data Source =60.209.125.238,32009; Initial Catalog=TestBillTrace; Persist Security Info=True; User ID =sa; Password=Djy@Sql2022.test;pooling=true" + //"Connection": "Data Source =47.104.73.97,6762; Initial Catalog=BillTrace; Persist Security Info=True; User ID =sa; Password=QDdjy#2020*;pooling=true" } ], "Mongo": { diff --git a/EntrustSettle.IServices/BASE/IBaseServices.cs b/EntrustSettle.IServices/BASE/IBaseServices.cs index e561d0e..a32a017 100644 --- a/EntrustSettle.IServices/BASE/IBaseServices.cs +++ b/EntrustSettle.IServices/BASE/IBaseServices.cs @@ -22,9 +22,11 @@ namespace EntrustSettle.IServices.Base Task QueryById(object objId, bool blnUseCache = false); Task> QueryByIDs(object[] lstIds); Task QueryFirst(Expression> whereExpression); + Task QueryFirst(Expression> whereExpression, Expression> selectExpression); Task QueryFirstInclude(Expression> whereExpression, Expression>> include); Task> Query(); Task> Query(Expression> whereExpression); + Task> Query(Expression> whereExpression, Expression> selectExpression); Task> Query(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true); Task> Query(Expression> whereExpression, string orderByFields); Task> Query(string where, string orderByFields); @@ -35,54 +37,8 @@ namespace EntrustSettle.IServices.Base Task> QueryPageModel(Expression> whereExpression, int pageIndex = 1, int pageSize = 20, Expression> orderByExpression = null, bool isAsc = true); Task> QueryPageModel(Expression> whereExpression, int pageIndex = 1, int pageSize = 20, string orderByFields = null); Task> QueryPageModel(Expression> whereExpression, PaginationModel paginationModel); - Task> QueryDto(Expression> expression); - Task> QueryDto(Expression> expression, Expression> whereExpression, string orderByFields); Task> QuerySql(string sql, SugarParameter[] parameters = null); Task QueryTable(string sql, SugarParameter[] parameters = null); - - /// - /// 两表联查 - /// - Task> QueryMuch(Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new(); - - /// - /// 两表联查-分页 - /// - Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null); - /// - /// 两表联合查询-分页-分组 - /// - Task> QueryMuchPageGroup(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - Expression> groupExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null); - - /// - /// 三表联查 - /// - Task> QueryMuch(Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new(); - - /// - /// 三表联查-分页 - /// - Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null); #endregion @@ -110,7 +66,6 @@ namespace EntrustSettle.IServices.Base Task Update(TEntity entity, Expression> updateColumns); Task Update(List model); Task Update(TEntity entity, string where); - Task Update(object operateAnonymousObjects); Task Update(TEntity entity, List lstColumns = null, List lstIgnoreColumns = null, string where = ""); Task Update(Expression> columns, Expression> where); #endregion diff --git a/EntrustSettle.Model/Const/DBConst.cs b/EntrustSettle.Model/Const/DBConst.cs index 8ebb464..fe58ba6 100644 --- a/EntrustSettle.Model/Const/DBConst.cs +++ b/EntrustSettle.Model/Const/DBConst.cs @@ -16,5 +16,10 @@ /// 大简云平台数据库标识 /// public const string PingTai = "PingTai"; + + /// + /// 运踪库 + /// + public const string BillTrace = "BillTrace"; } } diff --git a/EntrustSettle.Model/Dtos/BillTrace/OpSeaiBillTraceSelectDto.cs b/EntrustSettle.Model/Dtos/BillTrace/OpSeaiBillTraceSelectDto.cs new file mode 100644 index 0000000..14a3451 --- /dev/null +++ b/EntrustSettle.Model/Dtos/BillTrace/OpSeaiBillTraceSelectDto.cs @@ -0,0 +1,23 @@ +using System; + +namespace EntrustSettle.Model.Dtos +{ + public class OpSeaiBillTraceSelectDto + { + public string GID { get; set; } + public string MBLNO { get; set; } + + public string StaCangDan { get; set; } + public string StaHaiGuan { get; set; } + public string StaTiHuo { get; set; } + public string StaFanKong { get; set; } + + public DateTime? TimeHaiGuan { get; set; } + + //public DateTime? TimeCangDan { get; set; } + //public DateTime? TimeTiHuo { get; set; } + //public DateTime? TimeFanKong { get; set; } + + public DateTime? ATA { get; set; } + } +} \ No newline at end of file diff --git a/EntrustSettle.Model/Dtos/BillTrace/PushBilltraceDto.cs b/EntrustSettle.Model/Dtos/BillTrace/PushBilltraceDto.cs new file mode 100644 index 0000000..0d9bad7 --- /dev/null +++ b/EntrustSettle.Model/Dtos/BillTrace/PushBilltraceDto.cs @@ -0,0 +1,13 @@ +using System; + +namespace EntrustSettle.Model.Dtos +{ + public class PushBilltraceDto + { + /// + /// 运踪主键 + /// + public string Gid { get; set; } + public string StaFanKong { get; set; } + } +} diff --git a/EntrustSettle.Model/Dtos/Order/CtnBilltraceDto.cs b/EntrustSettle.Model/Dtos/Order/CtnBilltraceDto.cs new file mode 100644 index 0000000..7f656ec --- /dev/null +++ b/EntrustSettle.Model/Dtos/Order/CtnBilltraceDto.cs @@ -0,0 +1,27 @@ +using System; + +namespace EntrustSettle.Model.Dtos +{ + public class CtnBilltraceDto + { + /// + /// 箱号 + /// + public string Cntrno { get; set; } + + /// + /// 提箱时间 + /// + public DateTime? TiXiangTime { get; set; } + + /// + /// 返空时间 + /// + public DateTime? FanKongTime { get; set; } + + /// + /// 堆存天数 + /// + public int? StockpilingDays { get; set; } + } +} diff --git a/EntrustSettle.Model/Dtos/Order/OrderDto.cs b/EntrustSettle.Model/Dtos/Order/OrderDto.cs index d636092..2dadf42 100644 --- a/EntrustSettle.Model/Dtos/Order/OrderDto.cs +++ b/EntrustSettle.Model/Dtos/Order/OrderDto.cs @@ -70,5 +70,47 @@ namespace EntrustSettle.Model.Dtos /// 是否有发票附件或快递单号 /// public bool IsHasInvoiceAnnex { get; set; } + + /// + /// 是否有舱单状态 + /// + public bool? IsCangdan { get; set; } + + /// + /// 是否有海放状态 + /// + public bool? IsHaifang { get; set; } + + /// + /// 海放时间 + /// + public DateTime? TimeHaiFang { get; set; } + + public DateTime? ATA { get; set; } + + /// + /// 提箱状态 Y:全部提箱 P:部分提箱 N:未提箱 + /// + public string StaTiXiang { get; set; } + + /// + /// 返空状态 Y:全部返空 P:部分返空 N:未返空 + /// + public string StaFanKong { get; set; } + + /// + /// 箱子总数量 + /// + public int? CtnNumAll { get; set; } + + /// + /// 提箱数量 + /// + public int? CtnNumTiXiang { get; set; } + + /// + /// 返空数量 + /// + public int? CtnNumFanKong { get; set; } } } diff --git a/EntrustSettle.Model/Dtos/Order/OrderListInputDto.cs b/EntrustSettle.Model/Dtos/Order/OrderListInputDto.cs index 1bf07ca..9f4fef9 100644 --- a/EntrustSettle.Model/Dtos/Order/OrderListInputDto.cs +++ b/EntrustSettle.Model/Dtos/Order/OrderListInputDto.cs @@ -42,5 +42,23 @@ namespace EntrustSettle.Model.Dtos /// 客户备注 /// public string Remark { get; set; } + + + #region 运踪查询条件 + /// + /// 1=舱单申报 2=海关放行 3=全部提箱 4=全部返场 + /// + public int? BillTraceState { get; set; } + + /// + /// 抵港日期-开始时间 + /// + public DateTime? AtaStart { get; set; } + + /// + /// 抵港日期-结束时间 + /// + public DateTime? AtaEnd { get; set; } + #endregion } } diff --git a/EntrustSettle.Model/Dtos/OrderHistory/OrderHistoryDto.cs b/EntrustSettle.Model/Dtos/OrderHistory/OrderHistoryDto.cs index 4340bed..85fafc3 100644 --- a/EntrustSettle.Model/Dtos/OrderHistory/OrderHistoryDto.cs +++ b/EntrustSettle.Model/Dtos/OrderHistory/OrderHistoryDto.cs @@ -28,6 +28,7 @@ namespace EntrustSettle.Model.Dtos 7 => "收到发票", 8 => "收到账单", 9 => "收到往来单据", + 10 => "全部返场", _ => "未知状态" }; diff --git a/EntrustSettle.Model/Models/BillTrace/OpSeaiBillTrace.cs b/EntrustSettle.Model/Models/BillTrace/OpSeaiBillTrace.cs new file mode 100644 index 0000000..4c445ef --- /dev/null +++ b/EntrustSettle.Model/Models/BillTrace/OpSeaiBillTrace.cs @@ -0,0 +1,38 @@ +using SqlSugar; +using System; + +namespace EntrustSettle.Model.Models.BillTrace +{ + [Tenant(DBConst.BillTrace)] + [SugarTable("op_seai_billtrace")] + public class OpSeaiBillTrace + { + [SugarColumn(IsPrimaryKey = true)] + public string GID { get; set; } + public string UserID { get; set; } + public string UserName { get; set; } + public string CompID { get; set; } + public string CompName { get; set; } + public string MBLNO { get; set; } + + public string StaCangDan { get; set; } + public string StaHaiGuan { get; set; } + public string StaTiHuo { get; set; } + public string StaFanKong { get; set; } + + public DateTime? TimeHaiGuan { get; set; } + + //public DateTime? TimeCangDan { get; set; } + //public DateTime? TimeTiHuo { get; set; } + //public DateTime? TimeFanKong { get; set; } + + public DateTime? ATA { get; set; } + + public bool NotifyWeChat { get; set; } + public bool NotifyEmail { get; set; } + public bool IsBook { get; set; } + public bool IsOuter { get; set; } + + public DateTime CreateTime { get; set; } + } +} diff --git a/EntrustSettle.Model/Models/BillTrace/OpSeaiBillTraceCtn.cs b/EntrustSettle.Model/Models/BillTrace/OpSeaiBillTraceCtn.cs new file mode 100644 index 0000000..3d5a252 --- /dev/null +++ b/EntrustSettle.Model/Models/BillTrace/OpSeaiBillTraceCtn.cs @@ -0,0 +1,24 @@ +using SqlSugar; +using System; + +namespace EntrustSettle.Model.Models.BillTrace +{ + [Tenant(DBConst.BillTrace)] + [SugarTable("op_seai_billtrace_ctn")] + public class OpSeaiBillTraceCtn + { + [SugarColumn(IsPrimaryKey = true)] + public string GID { get; set; } + public string PID { get; set; } + public string MBLNO { get; set; } + public string CNTRNO { get; set; } + + public string StaCangDan { get; set; } + public string StaTiHuo { get; set; } + public string StaFanKong { get; set; } + + public DateTime? TimeTiHuo { get; set; } + public DateTime? TimeFanKong { get; set; } + public int? StoreDays { get; set; } + } +} diff --git a/EntrustSettle.Model/Models/Order.cs b/EntrustSettle.Model/Models/Order.cs index a8953b7..0b9acdb 100644 --- a/EntrustSettle.Model/Models/Order.cs +++ b/EntrustSettle.Model/Models/Order.cs @@ -14,6 +14,10 @@ namespace EntrustSettle.Model.Models /// public long Bsno { get; set; } /// + /// 运踪表主键 + /// + public string BilltraceGid { get; set; } + /// /// 提单号 /// public string Mblno { get; set; } diff --git a/EntrustSettle.Model/Models/OrderHistory.cs b/EntrustSettle.Model/Models/OrderHistory.cs index 32896c5..3d524d7 100644 --- a/EntrustSettle.Model/Models/OrderHistory.cs +++ b/EntrustSettle.Model/Models/OrderHistory.cs @@ -15,7 +15,7 @@ namespace EntrustSettle.Model.Models /// public long Pid { get; set; } /// - /// 业务状态 0:已下单 1:已接单 2:待缴费 3:已缴费 4:已完结 5:申请发票 6:申请账单 7:收到发票 8:收到账单 9:收到往来单据 + /// 业务状态 0:已下单 1:已接单 2:待缴费 3:已缴费 4:已完结 5:申请发票 6:申请账单 7:收到发票 8:收到账单 9:收到往来单据 10:收到运踪状态-全部返场 /// public int Status { get; set; } /// diff --git a/EntrustSettle.Repository/BASE/BaseRepository.cs b/EntrustSettle.Repository/BASE/BaseRepository.cs index e173c98..9010e09 100644 --- a/EntrustSettle.Repository/BASE/BaseRepository.cs +++ b/EntrustSettle.Repository/BASE/BaseRepository.cs @@ -58,6 +58,10 @@ namespace EntrustSettle.Repository.Base { return await _db.Queryable().Where(whereExpression).FirstAsync(); } + public async Task QueryFirst(Expression> whereExpression, Expression> selectExpression) + { + return await _db.Queryable().Where(whereExpression).Select(selectExpression).FirstAsync(); + } public async Task QueryFirstInclude(Expression> whereExpression, Expression>> include) { return await _db.Queryable().Includes(include).Where(whereExpression).FirstAsync(); @@ -70,6 +74,10 @@ namespace EntrustSettle.Repository.Base { return await _db.Queryable().WhereIF(whereExpression != null, whereExpression).ToListAsync(); } + public async Task> Query(Expression> whereExpression, Expression> selectExpression) + { + return await _db.Queryable().WhereIF(whereExpression != null, whereExpression).Select(selectExpression).ToListAsync(); + } public async Task> Query(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true) { return await _db.Queryable() @@ -136,18 +144,7 @@ namespace EntrustSettle.Repository.Base return new PageModel(pageIndex, totalCount, pageSize, list); } - public async Task> QueryDto(Expression> expression) - { - return await _db.Queryable().Select(expression).ToListAsync(); - } - public async Task> QueryDto(Expression> expression, Expression> whereExpression, string orderByFields) - { - return await _db.Queryable() - .OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields) - .WhereIF(whereExpression != null, whereExpression) - .Select(expression) - .ToListAsync(); - } + public async Task> QuerySql(string sql, SugarParameter[] parameters = null) { return await _db.Ado.SqlQueryAsync(sql, parameters); @@ -157,91 +154,6 @@ namespace EntrustSettle.Repository.Base return await _db.Ado.GetDataTableAsync(sql, parameters); } - /// - /// 两表联查 - /// - public async Task> QueryMuch(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression) where T : class, new() - { - return await _db.Queryable(joinExpression) - .WhereIF(whereExpression != null, whereExpression) - .Select(selectExpression) - .ToListAsync(); - } - /// - /// 两表联合查询-分页 - /// - public async Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null) - { - RefAsync totalCount = 0; - List list = await _db.Queryable(joinExpression) - .WhereIF(whereExpression != null, whereExpression) - .OrderByIF(!string.IsNullOrEmpty(strOrderByFileds), strOrderByFileds) - .Select(selectExpression) - .ToPageListAsync(pageIndex, pageSize, totalCount); - return new PageModel(pageIndex, totalCount, pageSize, list); - } - /// - /// 两表联合查询-分页-分组 - /// - public async Task> QueryMuchPageGroup(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - Expression> groupExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null) - { - - RefAsync totalCount = 0; - List list = await _db.Queryable(joinExpression) - .WhereIF(whereExpression != null, whereExpression) - .GroupBy(groupExpression) - .OrderByIF(!string.IsNullOrEmpty(strOrderByFileds), strOrderByFileds) - .Select(selectExpression) - .ToPageListAsync(pageIndex, pageSize, totalCount); - return new PageModel(pageIndex, totalCount, pageSize, list); - } - /// - /// 三表联查 - /// - public async Task> QueryMuch( - Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new() - { - if (whereLambda == null) - { - return await _db.Queryable(joinExpression).Select(selectExpression).ToListAsync(); - } - - return await _db.Queryable(joinExpression).Where(whereLambda).Select(selectExpression).ToListAsync(); - } - - /// - /// 三表联合查询-分页 - /// - public async Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null) - { - RefAsync totalCount = 0; - List list = await _db.Queryable(joinExpression) - .WhereIF(whereExpression != null, whereExpression) - .OrderByIF(!string.IsNullOrEmpty(strOrderByFileds), strOrderByFileds) - .Select(selectExpression) - .ToPageListAsync(pageIndex, pageSize, totalCount).ConfigureAwait(false); - return new PageModel(pageIndex, totalCount, pageSize, list); - } #endregion @@ -303,10 +215,7 @@ namespace EntrustSettle.Repository.Base { return await _db.Updateable(entity).Where(where).ExecuteCommandHasChangeAsync(); } - public async Task Update(object operateAnonymousObjects) - { - return await _db.Updateable(operateAnonymousObjects).ExecuteCommandAsync() > 0; - } + public async Task Update(TEntity entity, List lstColumns = null, List lstIgnoreColumns = null, string where = "") { IUpdateable up = _db.Updateable(entity); diff --git a/EntrustSettle.Repository/BASE/IBaseRepository.cs b/EntrustSettle.Repository/BASE/IBaseRepository.cs index 014aa47..74fc309 100644 --- a/EntrustSettle.Repository/BASE/IBaseRepository.cs +++ b/EntrustSettle.Repository/BASE/IBaseRepository.cs @@ -20,9 +20,11 @@ namespace EntrustSettle.IRepository.Base Task QueryById(object objId, bool blnUseCache = false); Task> QueryByIDs(object[] lstIds); Task QueryFirst(Expression> whereExpression); + Task QueryFirst(Expression> whereExpression, Expression> selectExpression); Task QueryFirstInclude(Expression> whereExpression, Expression>> include); Task> Query(); Task> Query(Expression> whereExpression); + Task> Query(Expression> whereExpression, Expression> selectExpression); Task> Query(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true); Task> Query(Expression> whereExpression, string orderByFields); Task> Query(string where, string orderByFields); @@ -32,54 +34,8 @@ namespace EntrustSettle.IRepository.Base Task> QueryPage(Expression> whereExpression, int pageIndex, int pageSize, string orderByFields); Task> QueryPageModel(Expression> whereExpression, int pageIndex = 1, int pageSize = 20, Expression> orderByExpression = null, bool isAsc = true); Task> QueryPageModel(Expression> whereExpression, int pageIndex = 1, int pageSize = 20, string orderByFields = null); - Task> QueryDto(Expression> expression); - Task> QueryDto(Expression> expression, Expression> whereExpression, string orderByFields); Task> QuerySql(string sql, SugarParameter[] parameters = null); Task QueryTable(string sql, SugarParameter[] parameters = null); - - /// - /// 两表联查 - /// - Task> QueryMuch(Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new(); - - /// - /// 两表联查-分页 - /// - Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null); - /// - /// 两表联合查询-分页-分组 - /// - Task> QueryMuchPageGroup(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - Expression> groupExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null); - - /// - /// 三表联查 - /// - Task> QueryMuch(Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new(); - - /// - /// 三表联查-分页 - /// - Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null); #endregion @@ -102,7 +58,6 @@ namespace EntrustSettle.IRepository.Base Task Update(TEntity entity, Expression> updateColumns); Task Update(List model); Task Update(TEntity entity, string where); - Task Update(object operateAnonymousObjects); Task Update(TEntity entity, List lstColumns = null, List lstIgnoreColumns = null, string where = ""); Task Update(Expression> columns, Expression> where); #endregion diff --git a/EntrustSettle.Repository/RoleModulePermissionRepository.cs b/EntrustSettle.Repository/RoleModulePermissionRepository.cs index 6aa655b..24c6edb 100644 --- a/EntrustSettle.Repository/RoleModulePermissionRepository.cs +++ b/EntrustSettle.Repository/RoleModulePermissionRepository.cs @@ -25,21 +25,19 @@ namespace EntrustSettle.Repository /// public async Task> RoleModuleMaps() { - return await QueryMuch( + return await Db.Queryable( (rmp, m, r) => new object[] { JoinType.Left, rmp.ModuleId == m.Id, - JoinType.Left, rmp.RoleId == r.Id - }, - - (rmp, m, r) => rmp.IsDeleted == false && m.IsDeleted == false && r.IsDeleted == false -, - - (rmp, m, r) => new RoleModulePermission() + JoinType.Left, rmp.RoleId == r.Id + }) + .Where((rmp, m, r) => rmp.IsDeleted == false && m.IsDeleted == false && r.IsDeleted == false) + .Select((rmp, m, r) => new RoleModulePermission() { Role = r, Module = m, IsDeleted = rmp.IsDeleted - }); + }) + .ToListAsync(); } } diff --git a/EntrustSettle.Services/BASE/BaseServices.cs b/EntrustSettle.Services/BASE/BaseServices.cs index f78b6c2..700aa37 100644 --- a/EntrustSettle.Services/BASE/BaseServices.cs +++ b/EntrustSettle.Services/BASE/BaseServices.cs @@ -41,6 +41,10 @@ namespace EntrustSettle.Services.Base { return await BaseDal.QueryFirst(whereExpression); } + public async Task QueryFirst(Expression> whereExpression, Expression> selectExpression) + { + return await BaseDal.QueryFirst(whereExpression, selectExpression); + } public async Task QueryFirstInclude(Expression> whereExpression, Expression>> include) { @@ -54,6 +58,10 @@ namespace EntrustSettle.Services.Base { return await BaseDal.Query(whereExpression); } + public async Task> Query(Expression> whereExpression, Expression> selectExpression) + { + return await BaseDal.Query(whereExpression, selectExpression); + } public async Task> Query(Expression> whereExpression, Expression> orderByExpression, bool isAsc = true) { return await BaseDal.Query(whereExpression, orderByExpression, isAsc); @@ -95,14 +103,6 @@ namespace EntrustSettle.Services.Base return await BaseDal.QueryPageModel(whereExpression, pagination.pageIndex, pagination.pageSize, pagination.orderByFileds); } - public async Task> QueryDto(Expression> expression) - { - return await BaseDal.QueryDto(expression); - } - public async Task> QueryDto(Expression> expression, Expression> whereExpression, string orderByFileds) - { - return await BaseDal.QueryDto(expression, whereExpression, orderByFileds); - } public async Task> QuerySql(string sql, SugarParameter[] parameters = null) { return await BaseDal.QuerySql(sql, parameters); @@ -112,50 +112,6 @@ namespace EntrustSettle.Services.Base { return await BaseDal.QueryTable(sql, parameters); } - public async Task> QueryMuch(Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new() - { - return await BaseDal.QueryMuch(joinExpression, whereLambda, selectExpression); - } - - public async Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null) - { - return await BaseDal.QueryMuchPage(joinExpression, whereExpression, selectExpression, pageIndex, pageSize, strOrderByFileds); - } - - public async Task> QueryMuchPageGroup(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - Expression> groupExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null) - { - return await BaseDal.QueryMuchPageGroup(joinExpression, whereExpression, selectExpression, groupExpression, pageIndex, pageSize, strOrderByFileds); - } - - public async Task> QueryMuch(Expression> joinExpression, - Expression> whereLambda, - Expression> selectExpression) where T : class, new() - { - return await BaseDal.QueryMuch(joinExpression, whereLambda, selectExpression); - } - - public Task> QueryMuchPage(Expression> joinExpression, - Expression> whereExpression, - Expression> selectExpression, - int pageIndex = 1, - int pageSize = 20, - string strOrderByFileds = null) - { - return BaseDal.QueryMuchPage(joinExpression, whereExpression, selectExpression, pageIndex, pageSize, strOrderByFileds); - } #endregion @@ -204,10 +160,6 @@ namespace EntrustSettle.Services.Base { return await BaseDal.Update(entity, where); } - public async Task Update(object operateAnonymousObjects) - { - return await BaseDal.Update(operateAnonymousObjects); - } public async Task Update(TEntity entity, List lstColumns = null, List lstIgnoreColumns = null, string where = "") { return await BaseDal.Update(entity, lstColumns, lstIgnoreColumns, where);