|
|
|
@ -1,6 +1,10 @@
|
|
|
|
|
using DS.Module.Core;
|
|
|
|
|
using DS.Module.Core.Constants;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using DS.Module.SqlSugar;
|
|
|
|
|
using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Map.Dtos;
|
|
|
|
|
using DS.WMS.Core.Map.Interface;
|
|
|
|
|
using DS.WMS.Core.Op.Dtos;
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
|
using DS.WMS.Core.Op.Interface;
|
|
|
|
@ -8,22 +12,10 @@ using Mapster;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using NLog;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using DS.Module.Core.Extensions;
|
|
|
|
|
using Microsoft.Owin.Security.Provider;
|
|
|
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using DS.WMS.Core.Map.Dtos;
|
|
|
|
|
using DS.WMS.Core.Map.Interface;
|
|
|
|
|
using DS.Module.Core.Constants;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
public class BookingContractNoManageService: IBookingContractNoManageService
|
|
|
|
|
public class BookingContractNoManageService : IBookingContractNoManageService
|
|
|
|
|
{
|
|
|
|
|
private readonly IServiceProvider _serviceProvider;
|
|
|
|
|
private readonly ISqlSugarClient db;
|
|
|
|
@ -63,7 +55,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
var cacheRlt = await _mappingCarrierService.GetAllList();
|
|
|
|
|
|
|
|
|
|
if(cacheRlt.Succeeded)
|
|
|
|
|
if (cacheRlt.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
mapCarrierList = cacheRlt.Data;
|
|
|
|
|
|
|
|
|
@ -94,23 +86,23 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
info.UpdateBy = long.Parse(user.UserId);
|
|
|
|
|
info.UpdateUserName = user.UserName;
|
|
|
|
|
|
|
|
|
|
await tenantDb.Updateable<BookingContractNoManage>(info).RemoveDataCache($"{SqlSugarCacheConst.ContractNo}{user.TenantId}").IgnoreColumns(it => new
|
|
|
|
|
{
|
|
|
|
|
it.CreateTime,
|
|
|
|
|
it.CreateBy,
|
|
|
|
|
it.CreateUserName
|
|
|
|
|
}).ExecuteCommandAsync();
|
|
|
|
|
|
|
|
|
|
await tenantDb.UpdateNav(info)
|
|
|
|
|
.Include(it => it.LaneList)
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
info = model.Adapt<BookingContractNoManage>();
|
|
|
|
|
|
|
|
|
|
await tenantDb.Insertable<BookingContractNoManage>(info).RemoveDataCache($"{SqlSugarCacheConst.ContractNo}{user.TenantId}").ExecuteReturnEntityAsync();
|
|
|
|
|
await tenantDb.InsertNav(info)
|
|
|
|
|
.Include(t => t.LaneList)
|
|
|
|
|
.ExecuteCommandAsync();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
DataResult<long>.FailedData(info.Id, ex.Message);
|
|
|
|
|
return DataResult<long>.FailedData(info.Id, ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<long>.Success(info.Id);
|
|
|
|
@ -130,7 +122,9 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
var info = await tenantDb.Queryable<BookingContractNoManage>().FirstAsync(t => t.Id == Id);
|
|
|
|
|
var info = await tenantDb.Queryable<BookingContractNoManage>()
|
|
|
|
|
.Includes(t => t.LaneList)
|
|
|
|
|
.FirstAsync(t => t.Id == Id);
|
|
|
|
|
|
|
|
|
|
//合约数据不存在或已作废
|
|
|
|
|
if (info == null)
|
|
|
|
@ -142,7 +136,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
DataResult<BookingContractNoManageDto>.FailedData(model, ex.Message);
|
|
|
|
|
return DataResult<BookingContractNoManageDto>.FailedData(model, ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<BookingContractNoManageDto>.Success(model);
|
|
|
|
@ -166,6 +160,8 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
var query = tenantDb.Queryable<BookingContractNoManage>();
|
|
|
|
|
|
|
|
|
|
query.Includes(t => t.LaneList);
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(queryItem))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(t =>
|
|
|
|
@ -179,6 +175,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(carrier))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(t => t.CarrierCode.Equals(carrier));
|
|
|
|
@ -186,12 +183,12 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(lane))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(t => string.IsNullOrWhiteSpace(t.LaneCode) || t.LaneCode.Contains(lane));
|
|
|
|
|
query.Where(t => t.LaneList!.Any(z => string.IsNullOrWhiteSpace(z.LaneCode) || (z.LaneCode != null && z.LaneCode.Contains(lane))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(lanecname))
|
|
|
|
|
{
|
|
|
|
|
query = query.Where(t => string.IsNullOrWhiteSpace(t.LaneCName) || t.LaneCName.Contains(lanecname));
|
|
|
|
|
query.Where(t => t.LaneList!.Any(z => string.IsNullOrWhiteSpace(z.LaneCName) || (z.LaneCName != null && z.LaneCName.Contains(lanecname))));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(pod))
|
|
|
|
@ -199,12 +196,13 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
query = query.Where(t => string.IsNullOrWhiteSpace(t.PodCode) || t.PodCode.Contains(pod));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = await query.Select<BookingContractNoManageDto>().OrderBy(a=>a.ContractNo).Take(top).ToListAsync();
|
|
|
|
|
var data = await query.OrderBy(a => a.ContractNo).Take(top).ToListAsync();
|
|
|
|
|
var result = data.Adapt<List<BookingContractNoManageDto>>();
|
|
|
|
|
|
|
|
|
|
if(data.Count == 0)
|
|
|
|
|
return DataResult<List<BookingContractNoManageDto>>.FailedData(data);
|
|
|
|
|
if (result.Count == 0)
|
|
|
|
|
return DataResult<List<BookingContractNoManageDto>>.FailedData(result);
|
|
|
|
|
|
|
|
|
|
return DataResult<List<BookingContractNoManageDto>>.Success(data);
|
|
|
|
|
return DataResult<List<BookingContractNoManageDto>>.Success(result);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
@ -263,7 +261,7 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
{
|
|
|
|
|
//throw Oops.Bah($"作废约号参数异常,{ex.Message}");
|
|
|
|
|
|
|
|
|
|
DataResult<string>.FailedData(string.Empty, ex.Message);
|
|
|
|
|
return DataResult<string>.FailedData(string.Empty, ex.Message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<string>.Success(string.Empty);
|
|
|
|
@ -274,18 +272,23 @@ namespace DS.WMS.Core.Op.Method
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 合约号管理台账
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="QuerySearch">查询条件</param>
|
|
|
|
|
/// <param name="querySearch">查询条件</param>
|
|
|
|
|
/// <returns>返回台账列表</returns>
|
|
|
|
|
public async Task<DataResult<List<BookingContractNoManageDto>>> GetPageAsync(PageRequest QuerySearch)
|
|
|
|
|
public async Task<DataResult<List<BookingContractNoManageDto>>> GetPageAsync(PageRequest<BookingContractNoManageQueryDto> querySearch)
|
|
|
|
|
{
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
//序列化查询条件
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(QuerySearch.QueryCondition);
|
|
|
|
|
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
|
|
|
|
|
|
|
|
|
|
var list = tenantDb.Queryable<BookingContractNoManage>()
|
|
|
|
|
.Includes(x => x.LaneList)
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition?.LaneCode) || querySearch.OtherQueryCondition?.LaneId != null,
|
|
|
|
|
x => x.LaneList!.Any(z => z.LaneCode == querySearch.OtherQueryCondition!.LaneCode || z.LaneId == querySearch.OtherQueryCondition!.LaneId))
|
|
|
|
|
.ToQueryPage(querySearch.PageCondition);
|
|
|
|
|
|
|
|
|
|
var data = tenantDb.Queryable<BookingContractNoManage>()
|
|
|
|
|
.Where(whereList)
|
|
|
|
|
.Select<BookingContractNoManageDto>().ToQueryPage(QuerySearch.PageCondition);
|
|
|
|
|
return data;
|
|
|
|
|
var result = list.Data.Adapt<List<BookingContractNoManageDto>>();
|
|
|
|
|
return DataResult<List<BookingContractNoManageDto>>.PageList(list.Count, result, MultiLanguageConst.DataQuerySuccess);
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|