对接进口运踪!!!!

master
zhangxiaofeng 5 months ago
parent a14bf225f3
commit 6d5835c7ae

@ -613,6 +613,67 @@ namespace EntrustSettle.Api.Controllers
}
}
/// <summary>
/// 进口运踪接口推送状态
/// </summary>
[HttpPost]
[ApiUser(ApiCode = "PushBilltrace")]
public async Task<MessageModel> PushBilltrace([FromBody] List<PushBilltraceDto> 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<HydFeedbackDto>()
{
new HydFeedbackDto()
{
orderNo = order.Bsno,
remark = "【集装箱已提取完毕】"
}
};
await App.GetService<IHYDService>().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()
//{

@ -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<OpSeaiBillTrace> billtraceService;
private readonly IBaseServices<OpSeaiBillTraceCtn> 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<OpSeaiBillTrace> billtraceService,
IBaseServices<OpSeaiBillTraceCtn> 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;
}
/// <summary>
/// 获取订单列表
@ -75,6 +85,25 @@ namespace EntrustSettle.Api.Controllers
}
}
// 运踪筛选条件
List<string> 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<string>("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<OrderDto>()
.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<Annex>((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<OpSeaiBillTraceSelectDto>()
.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);
}
/// <summary>
/// 查询箱信息运踪详情
/// </summary>
[HttpGet]
public async Task<MessageModel<List<CtnBilltraceDto>>> 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<IBaseServices<CompanyNew>>();
var taxCode = await custBalanceService.Db.Queryable<CompanyNew>().Where(x => x.CompId == inputDto.CompanyId).Select(x => x.TaxCode).FirstAsync();
var orderList = new List<Order>();
var orderList = new List<Order>(inputDto.MblnoList.Length);
var billtraceList = new List<OpSeaiBillTrace>(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);
}
/// <summary>
/// 补充订阅运踪
/// </summary>
[HttpPost]
public async Task<MessageModel> SubcribeBilltrace([FromBody] long[] ids)
{
var billtraceList = new List<OpSeaiBillTrace>(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();
}
/// <summary>
/// 获取订单附件信息列表
/// </summary>

@ -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">
<variable name="MicrosoftLevel" value="${level:lowercase=true:truncate=4:when=level==LogLevel.Info or level==LogLevel.Warn}${when:when=level==LogLevel.Error:inner=fail}${when:when=level==LogLevel.Fatal:inner=crit}${when:when=level==LogLevel.Debug:inner=dbug}${when:when=level==LogLevel.Trace:inner=trce}" />
<variable name="MicrosoftLayout" value="${MicrosoftLevel}: ${logger}[${event-properties:EventId_Id:whenEmpty=0}]${newline} ${message}${onexception:inner=${newline}${exception:format=tostring}}" />

@ -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": {

@ -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": {

@ -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": {

@ -22,9 +22,11 @@ namespace EntrustSettle.IServices.Base
Task<TEntity> QueryById(object objId, bool blnUseCache = false);
Task<List<TEntity>> QueryByIDs(object[] lstIds);
Task<TEntity> QueryFirst(Expression<Func<TEntity, bool>> whereExpression);
Task<TResult> QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression);
Task<TEntity> QueryFirstInclude<TReturn>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, List<TReturn>>> include);
Task<List<TEntity>> Query();
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression);
Task<List<TResult>> Query<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression);
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true);
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
Task<List<TEntity>> Query(string where, string orderByFields);
@ -35,54 +37,8 @@ namespace EntrustSettle.IServices.Base
Task<PageModel<TEntity>> QueryPageModel(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 20, Expression<Func<TEntity, object>> orderByExpression = null, bool isAsc = true);
Task<PageModel<TEntity>> QueryPageModel(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 20, string orderByFields = null);
Task<PageModel<TEntity>> QueryPageModel(Expression<Func<TEntity, bool>> whereExpression, PaginationModel paginationModel);
Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression);
Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
Task<List<TEntity>> QuerySql(string sql, SugarParameter[] parameters = null);
Task<DataTable> QueryTable(string sql, SugarParameter[] parameters = null);
/// <summary>
/// 两表联查
/// </summary>
Task<List<TResult>> QueryMuch<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereLambda,
Expression<Func<T, T2, TResult>> selectExpression) where T : class, new();
/// <summary>
/// 两表联查-分页
/// </summary>
Task<PageModel<TResult>> QueryMuchPage<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null);
/// <summary>
/// 两表联合查询-分页-分组
/// </summary>
Task<PageModel<TResult>> QueryMuchPageGroup<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
Expression<Func<T, object>> groupExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null);
/// <summary>
/// 三表联查
/// </summary>
Task<List<TResult>> QueryMuch<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereLambda,
Expression<Func<T, T2, T3, TResult>> selectExpression) where T : class, new();
/// <summary>
/// 三表联查-分页
/// </summary>
Task<PageModel<TResult>> QueryMuchPage<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereExpression,
Expression<Func<T, T2, T3, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null);
#endregion
@ -110,7 +66,6 @@ namespace EntrustSettle.IServices.Base
Task<bool> Update(TEntity entity, Expression<Func<TEntity, object>> updateColumns);
Task<bool> Update(List<TEntity> model);
Task<bool> Update(TEntity entity, string where);
Task<bool> Update(object operateAnonymousObjects);
Task<bool> Update(TEntity entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string where = "");
Task<bool> Update(Expression<Func<TEntity, TEntity>> columns, Expression<Func<TEntity, bool>> where);
#endregion

@ -16,5 +16,10 @@
/// 大简云平台数据库标识
/// </summary>
public const string PingTai = "PingTai";
/// <summary>
/// 运踪库
/// </summary>
public const string BillTrace = "BillTrace";
}
}

@ -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; }
}
}

@ -0,0 +1,13 @@
using System;
namespace EntrustSettle.Model.Dtos
{
public class PushBilltraceDto
{
/// <summary>
/// 运踪主键
/// </summary>
public string Gid { get; set; }
public string StaFanKong { get; set; }
}
}

@ -0,0 +1,27 @@
using System;
namespace EntrustSettle.Model.Dtos
{
public class CtnBilltraceDto
{
/// <summary>
/// 箱号
/// </summary>
public string Cntrno { get; set; }
/// <summary>
/// 提箱时间
/// </summary>
public DateTime? TiXiangTime { get; set; }
/// <summary>
/// 返空时间
/// </summary>
public DateTime? FanKongTime { get; set; }
/// <summary>
/// 堆存天数
/// </summary>
public int? StockpilingDays { get; set; }
}
}

@ -70,5 +70,47 @@ namespace EntrustSettle.Model.Dtos
/// 是否有发票附件或快递单号
/// </summary>
public bool IsHasInvoiceAnnex { get; set; }
/// <summary>
/// 是否有舱单状态
/// </summary>
public bool? IsCangdan { get; set; }
/// <summary>
/// 是否有海放状态
/// </summary>
public bool? IsHaifang { get; set; }
/// <summary>
/// 海放时间
/// </summary>
public DateTime? TimeHaiFang { get; set; }
public DateTime? ATA { get; set; }
/// <summary>
/// 提箱状态 Y:全部提箱 P:部分提箱 N:未提箱
/// </summary>
public string StaTiXiang { get; set; }
/// <summary>
/// 返空状态 Y:全部返空 P:部分返空 N:未返空
/// </summary>
public string StaFanKong { get; set; }
/// <summary>
/// 箱子总数量
/// </summary>
public int? CtnNumAll { get; set; }
/// <summary>
/// 提箱数量
/// </summary>
public int? CtnNumTiXiang { get; set; }
/// <summary>
/// 返空数量
/// </summary>
public int? CtnNumFanKong { get; set; }
}
}

@ -42,5 +42,23 @@ namespace EntrustSettle.Model.Dtos
/// 客户备注
/// </summary>
public string Remark { get; set; }
#region 运踪查询条件
/// <summary>
/// 1=舱单申报 2=海关放行 3=全部提箱 4=全部返场
/// </summary>
public int? BillTraceState { get; set; }
/// <summary>
/// 抵港日期-开始时间
/// </summary>
public DateTime? AtaStart { get; set; }
/// <summary>
/// 抵港日期-结束时间
/// </summary>
public DateTime? AtaEnd { get; set; }
#endregion
}
}

@ -28,6 +28,7 @@ namespace EntrustSettle.Model.Dtos
7 => "收到发票",
8 => "收到账单",
9 => "收到往来单据",
10 => "全部返场",
_ => "未知状态"
};

@ -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; }
}
}

@ -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; }
}
}

@ -14,6 +14,10 @@ namespace EntrustSettle.Model.Models
/// </summary>
public long Bsno { get; set; }
/// <summary>
/// 运踪表主键
/// </summary>
public string BilltraceGid { get; set; }
/// <summary>
/// 提单号
/// </summary>
public string Mblno { get; set; }

@ -15,7 +15,7 @@ namespace EntrustSettle.Model.Models
/// </summary>
public long Pid { get; set; }
/// <summary>
/// 业务状态 0:已下单 1:已接单 2:待缴费 3:已缴费 4:已完结 5:申请发票 6:申请账单 7:收到发票 8:收到账单 9:收到往来单据
/// 业务状态 0:已下单 1:已接单 2:待缴费 3:已缴费 4:已完结 5:申请发票 6:申请账单 7:收到发票 8:收到账单 9:收到往来单据 10:收到运踪状态-全部返场
/// </summary>
public int Status { get; set; }
/// <summary>

@ -58,6 +58,10 @@ namespace EntrustSettle.Repository.Base
{
return await _db.Queryable<TEntity>().Where(whereExpression).FirstAsync();
}
public async Task<TResult> QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression)
{
return await _db.Queryable<TEntity>().Where(whereExpression).Select(selectExpression).FirstAsync();
}
public async Task<TEntity> QueryFirstInclude<TReturn>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, List<TReturn>>> include)
{
return await _db.Queryable<TEntity>().Includes(include).Where(whereExpression).FirstAsync();
@ -70,6 +74,10 @@ namespace EntrustSettle.Repository.Base
{
return await _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).ToListAsync();
}
public async Task<List<TResult>> Query<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression)
{
return await _db.Queryable<TEntity>().WhereIF(whereExpression != null, whereExpression).Select(selectExpression).ToListAsync();
}
public async Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true)
{
return await _db.Queryable<TEntity>()
@ -136,18 +144,7 @@ namespace EntrustSettle.Repository.Base
return new PageModel<TEntity>(pageIndex, totalCount, pageSize, list);
}
public async Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression)
{
return await _db.Queryable<TEntity>().Select(expression).ToListAsync();
}
public async Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields)
{
return await _db.Queryable<TEntity>()
.OrderByIF(!string.IsNullOrEmpty(orderByFields), orderByFields)
.WhereIF(whereExpression != null, whereExpression)
.Select(expression)
.ToListAsync();
}
public async Task<List<TEntity>> QuerySql(string sql, SugarParameter[] parameters = null)
{
return await _db.Ado.SqlQueryAsync<TEntity>(sql, parameters);
@ -157,91 +154,6 @@ namespace EntrustSettle.Repository.Base
return await _db.Ado.GetDataTableAsync(sql, parameters);
}
/// <summary>
/// 两表联查
/// </summary>
public async Task<List<TResult>> QueryMuch<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression) where T : class, new()
{
return await _db.Queryable(joinExpression)
.WhereIF(whereExpression != null, whereExpression)
.Select(selectExpression)
.ToListAsync();
}
/// <summary>
/// 两表联合查询-分页
/// </summary>
public async Task<PageModel<TResult>> QueryMuchPage<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null)
{
RefAsync<int> totalCount = 0;
List<TResult> list = await _db.Queryable<T, T2>(joinExpression)
.WhereIF(whereExpression != null, whereExpression)
.OrderByIF(!string.IsNullOrEmpty(strOrderByFileds), strOrderByFileds)
.Select(selectExpression)
.ToPageListAsync(pageIndex, pageSize, totalCount);
return new PageModel<TResult>(pageIndex, totalCount, pageSize, list);
}
/// <summary>
/// 两表联合查询-分页-分组
/// </summary>
public async Task<PageModel<TResult>> QueryMuchPageGroup<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
Expression<Func<T, object>> groupExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null)
{
RefAsync<int> totalCount = 0;
List<TResult> list = await _db.Queryable<T, T2>(joinExpression)
.WhereIF(whereExpression != null, whereExpression)
.GroupBy(groupExpression)
.OrderByIF(!string.IsNullOrEmpty(strOrderByFileds), strOrderByFileds)
.Select(selectExpression)
.ToPageListAsync(pageIndex, pageSize, totalCount);
return new PageModel<TResult>(pageIndex, totalCount, pageSize, list);
}
/// <summary>
/// 三表联查
/// </summary>
public async Task<List<TResult>> QueryMuch<T, T2, T3, TResult>(
Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereLambda,
Expression<Func<T, T2, T3, TResult>> 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();
}
/// <summary>
/// 三表联合查询-分页
/// </summary>
public async Task<PageModel<TResult>> QueryMuchPage<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereExpression,
Expression<Func<T, T2, T3, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null)
{
RefAsync<int> totalCount = 0;
List<TResult> list = await _db.Queryable<T, T2, T3>(joinExpression)
.WhereIF(whereExpression != null, whereExpression)
.OrderByIF(!string.IsNullOrEmpty(strOrderByFileds), strOrderByFileds)
.Select(selectExpression)
.ToPageListAsync(pageIndex, pageSize, totalCount).ConfigureAwait(false);
return new PageModel<TResult>(pageIndex, totalCount, pageSize, list);
}
#endregion
@ -303,10 +215,7 @@ namespace EntrustSettle.Repository.Base
{
return await _db.Updateable(entity).Where(where).ExecuteCommandHasChangeAsync();
}
public async Task<bool> Update(object operateAnonymousObjects)
{
return await _db.Updateable<TEntity>(operateAnonymousObjects).ExecuteCommandAsync() > 0;
}
public async Task<bool> Update(TEntity entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string where = "")
{
IUpdateable<TEntity> up = _db.Updateable(entity);

@ -20,9 +20,11 @@ namespace EntrustSettle.IRepository.Base
Task<TEntity> QueryById(object objId, bool blnUseCache = false);
Task<List<TEntity>> QueryByIDs(object[] lstIds);
Task<TEntity> QueryFirst(Expression<Func<TEntity, bool>> whereExpression);
Task<TResult> QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression);
Task<TEntity> QueryFirstInclude<TReturn>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, List<TReturn>>> include);
Task<List<TEntity>> Query();
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression);
Task<List<TResult>> Query<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression);
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> orderByExpression, bool isAsc = true);
Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
Task<List<TEntity>> Query(string where, string orderByFields);
@ -32,54 +34,8 @@ namespace EntrustSettle.IRepository.Base
Task<List<TEntity>> QueryPage(Expression<Func<TEntity, bool>> whereExpression, int pageIndex, int pageSize, string orderByFields);
Task<PageModel<TEntity>> QueryPageModel(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 20, Expression<Func<TEntity, object>> orderByExpression = null, bool isAsc = true);
Task<PageModel<TEntity>> QueryPageModel(Expression<Func<TEntity, bool>> whereExpression, int pageIndex = 1, int pageSize = 20, string orderByFields = null);
Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression);
Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFields);
Task<List<TEntity>> QuerySql(string sql, SugarParameter[] parameters = null);
Task<DataTable> QueryTable(string sql, SugarParameter[] parameters = null);
/// <summary>
/// 两表联查
/// </summary>
Task<List<TResult>> QueryMuch<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereLambda,
Expression<Func<T, T2, TResult>> selectExpression) where T : class, new();
/// <summary>
/// 两表联查-分页
/// </summary>
Task<PageModel<TResult>> QueryMuchPage<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null);
/// <summary>
/// 两表联合查询-分页-分组
/// </summary>
Task<PageModel<TResult>> QueryMuchPageGroup<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
Expression<Func<T, object>> groupExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null);
/// <summary>
/// 三表联查
/// </summary>
Task<List<TResult>> QueryMuch<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereLambda,
Expression<Func<T, T2, T3, TResult>> selectExpression) where T : class, new();
/// <summary>
/// 三表联查-分页
/// </summary>
Task<PageModel<TResult>> QueryMuchPage<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereExpression,
Expression<Func<T, T2, T3, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null);
#endregion
@ -102,7 +58,6 @@ namespace EntrustSettle.IRepository.Base
Task<bool> Update(TEntity entity, Expression<Func<TEntity, object>> updateColumns);
Task<bool> Update(List<TEntity> model);
Task<bool> Update(TEntity entity, string where);
Task<bool> Update(object operateAnonymousObjects);
Task<bool> Update(TEntity entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string where = "");
Task<bool> Update(Expression<Func<TEntity, TEntity>> columns, Expression<Func<TEntity, bool>> where);
#endregion

@ -25,21 +25,19 @@ namespace EntrustSettle.Repository
/// <returns></returns>
public async Task<List<RoleModulePermission>> RoleModuleMaps()
{
return await QueryMuch<RoleModulePermission, Modules, Role, RoleModulePermission>(
return await Db.Queryable<RoleModulePermission, Modules, Role>(
(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();
}
}

@ -41,6 +41,10 @@ namespace EntrustSettle.Services.Base
{
return await BaseDal.QueryFirst(whereExpression);
}
public async Task<TResult> QueryFirst<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression)
{
return await BaseDal.QueryFirst(whereExpression, selectExpression);
}
public async Task<TEntity> QueryFirstInclude<TReturn>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, List<TReturn>>> include)
{
@ -54,6 +58,10 @@ namespace EntrustSettle.Services.Base
{
return await BaseDal.Query(whereExpression);
}
public async Task<List<TResult>> Query<TResult>(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, TResult>> selectExpression)
{
return await BaseDal.Query(whereExpression, selectExpression);
}
public async Task<List<TEntity>> Query(Expression<Func<TEntity, bool>> whereExpression, Expression<Func<TEntity, object>> 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<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression)
{
return await BaseDal.QueryDto(expression);
}
public async Task<List<TResult>> QueryDto<TResult>(Expression<Func<TEntity, TResult>> expression, Expression<Func<TEntity, bool>> whereExpression, string orderByFileds)
{
return await BaseDal.QueryDto(expression, whereExpression, orderByFileds);
}
public async Task<List<TEntity>> 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<List<TResult>> QueryMuch<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereLambda,
Expression<Func<T, T2, TResult>> selectExpression) where T : class, new()
{
return await BaseDal.QueryMuch(joinExpression, whereLambda, selectExpression);
}
public async Task<PageModel<TResult>> QueryMuchPage<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null)
{
return await BaseDal.QueryMuchPage(joinExpression, whereExpression, selectExpression, pageIndex, pageSize, strOrderByFileds);
}
public async Task<PageModel<TResult>> QueryMuchPageGroup<T, T2, TResult>(Expression<Func<T, T2, object[]>> joinExpression,
Expression<Func<T, T2, bool>> whereExpression,
Expression<Func<T, T2, TResult>> selectExpression,
Expression<Func<T, object>> groupExpression,
int pageIndex = 1,
int pageSize = 20,
string strOrderByFileds = null)
{
return await BaseDal.QueryMuchPageGroup(joinExpression, whereExpression, selectExpression, groupExpression, pageIndex, pageSize, strOrderByFileds);
}
public async Task<List<TResult>> QueryMuch<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereLambda,
Expression<Func<T, T2, T3, TResult>> selectExpression) where T : class, new()
{
return await BaseDal.QueryMuch(joinExpression, whereLambda, selectExpression);
}
public Task<PageModel<TResult>> QueryMuchPage<T, T2, T3, TResult>(Expression<Func<T, T2, T3, object[]>> joinExpression,
Expression<Func<T, T2, T3, bool>> whereExpression,
Expression<Func<T, T2, T3, TResult>> 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<bool> Update(object operateAnonymousObjects)
{
return await BaseDal.Update(operateAnonymousObjects);
}
public async Task<bool> Update(TEntity entity, List<string> lstColumns = null, List<string> lstIgnoreColumns = null, string where = "")
{
return await BaseDal.Update(entity, lstColumns, lstIgnoreColumns, where);

Loading…
Cancel
Save