dengyu 2 months ago
commit 2d6f46e0d4

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Code.Dtos
{
/// <summary>
/// 分配数据权限范围
/// </summary>
public class AssignDataRuleScopeReq
{
/// <summary>
/// 主键Id
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板Id
/// </summary>
public long TemplateId { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
public string RuleType { get; set; } = "visible";
/// <summary>
/// 权限模板范围
/// </summary>
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
public string RuleScopeName { get; set; }
}
}

@ -18,32 +18,24 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板Id
/// </summary>
public long TemplateId { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>
public long PermissionId { get; set; }
/// <summary>
/// 权限实体
/// 权限模板类型
/// </summary>
public string PermissionEntity { get; set; }
public string TemplateName { get; set; }
/// <summary>
/// 中文视图名
/// 权限描述
/// </summary>
public string ColumnView { get; set; }
public string Description { get; set; }
/// <summary>
/// 权限规则
/// 备注
/// </summary>
public string DataRules { get; set; }
public string Note { get; set; }
/// <summary>
/// 用户Id
/// </summary>
@ -54,9 +46,32 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 数据权限描述
/// 可视模板Id
/// </summary>
public string Description { get; set; }
public long VisibleTemplateId { get; set; }
/// <summary>
/// 可视权限模板范围
/// </summary>
public string VisibleRuleScope { get; set; }
/// <summary>
/// 可视权限模板范围名称
/// </summary>
public string VisibleRuleScopeName { get; set; }
/// <summary>
/// 操作模板Id
/// </summary>
public long OperatorTemplateId { get; set; }
/// <summary>
/// 操作权限模板范围
/// </summary>
public string OperatorRuleScope { get; set; }
/// <summary>
/// 操作权限模板范围名称
/// </summary>
public string OperatorRuleScopeName { get; set; }
/// <summary>
/// 状态
/// </summary>

@ -17,31 +17,23 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板Id
/// </summary>
public long TemplateId { get; set; }
/// <summary>
/// 模板名称
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>
public long PermissionId { get; set; }
/// <summary>
/// 权限实体
/// 权限模板类型
/// </summary>
public string PermissionEntity { get; set; }
public string TemplateName { get; set; }
/// <summary>
/// 中文视图名
/// 权限描述
/// </summary>
public string ColumnView { get; set; }
public string Description { get; set; }
/// <summary>
/// 权限规则
/// 备注
/// </summary>
public string DataRules { get; set; }
public string Note { get; set; }
/// <summary>
/// 用户Id
/// </summary>
@ -52,9 +44,32 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public string UserName { get; set; }
/// <summary>
/// 数据权限描述
/// 可视模板Id
/// </summary>
public string Description { get; set; }
public long VisibleTemplateId { get; set; }
/// <summary>
/// 可视权限模板范围
/// </summary>
public string VisibleRuleScope { get; set; }
/// <summary>
/// 可视权限模板范围名称
/// </summary>
public string VisibleRuleScopeName { get; set; }
/// <summary>
/// 操作模板Id
/// </summary>
public long OperateTemplateId { get; set; }
/// <summary>
/// 操作权限模板范围
/// </summary>
public string OperateRuleScope { get; set; }
/// <summary>
/// 操作权限模板范围名称
/// </summary>
public string OperateRuleScopeName { get; set; }
/// <summary>
/// 状态
/// </summary>

@ -18,9 +18,22 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// 权限模板类型
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
public string RuleType { get; set; } = "visible";
/// <summary>
/// 权限模板范围
/// </summary>
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
public string RuleScopeName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>

@ -17,9 +17,22 @@ namespace DS.WMS.Core.Code.Dtos
/// </summary>
public long Id { get; set; }
/// <summary>
/// 模板名称
/// 权限模板类型
/// </summary>
public string TemplateName { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
public string RuleType { get; set; } = "visible";
/// <summary>
/// 权限模板范围
/// </summary>
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
public string RuleScopeName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>

@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DS.WMS.Core.Code.Dtos
{
/// <summary>
/// 数据权限请求
/// </summary>
public class GetOrCreateCodeDataRuleReq
{
/// <summary>
/// 用户Id
/// </summary>
public long UserId { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>
public long PermissionId { get; set; }
}
}

@ -20,6 +20,17 @@ namespace DS.WMS.Core.Code.Entity
/// </summary>
[SugarColumn(ColumnDescription = "资源标识权限ID")]
public long PermissionId { get; set; }
/// <summary>
/// 权限模板类型
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限模板类型", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
/// <summary>
/// 权限描述
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限描述", IsNullable = true, Length = 200)]
public string Description { get; set; }
/// <summary>
/// 用户Id
/// </summary>
@ -32,41 +43,39 @@ namespace DS.WMS.Core.Code.Entity
[SqlSugar.SugarColumn(ColumnDescription = "用户名称", IsNullable = true, Length = 100)]
public string UserName { get; set; }
/// <summary>
/// 模板ID
/// 可视模板Id
/// </summary>
[SugarColumn(ColumnDescription = "模板ID")]
public long TemplateId { get; set; }
/// <summary>
/// 模板名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
[SugarColumn(ColumnDescription = "可视模板Id")]
public long VisibleTemplateId { get; set; }
/// <summary>
/// 权限实体
/// 可视权限模板范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限实体", IsNullable = false, Length = 100)]
public string PermissionEntity { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "可视权限模板范围", IsNullable = false, Length = 200)]
public string VisibleRuleScope { get; set; }
/// <summary>
/// 中文视图名
/// 可视权限模板范围名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "中文视图名", IsNullable = true, Length = 50)]
public string ColumnView { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "可视权限模板范围名称", IsNullable = false, Length = 200)]
public string VisibleRuleScopeName { get; set; }
/// <summary>
/// 权限规则
/// 操作模板Id
/// </summary>
[SugarColumn(ColumnDescription = "权限规则", IsNullable = true, ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string DataRules { get; set; }
[SugarColumn(ColumnDescription = "操作模板Id")]
public long OperateTemplateId { get; set; }
/// <summary>
/// 数据权限描述
/// 操作权限模板范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "数据权限描述", IsNullable = true, Length = 200)]
public string Description { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围", IsNullable = false, Length = 200)]
public string OperateRuleScope { get; set; }
/// <summary>
/// 操作权限模板范围名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "操作权限模板范围名称", IsNullable = false, Length = 200)]
public string OperateRuleScopeName { get; set; }
/// <summary>
/// 状态
/// </summary>

@ -15,16 +15,26 @@ namespace DS.WMS.Core.Code.Entity
[SqlSugar.SugarTable("code_data_rule_template","数据权限模板")]
public class CodeDataRuleTemplate : BaseModel<long>
{
/// <summary>
/// 权限模板类型
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限模板类型", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
/// <summary>
/// 权限类型 visible 可视范围 operate 操作范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限类型", IsNullable = false, Length = 100)]
public string RuleType { get; set; } = "visible";
/// <summary>
/// 模板名称
/// 权限模板范围
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "模板名称", IsNullable = false, Length = 200)]
public string TemplateName { get; set; }
[SqlSugar.SugarColumn(ColumnDescription = "权限模板范围", IsNullable = false, Length = 200)]
public string RuleScope { get; set; }
/// <summary>
/// 权限模板范围名称
/// </summary>
[SqlSugar.SugarColumn(ColumnDescription = "权限模板范围名称", IsNullable = false, Length = 200)]
public string RuleScopeName { get; set; }
/// <summary>
/// 资源标识权限ID
/// </summary>

@ -10,30 +10,35 @@ public interface ICodeDataRuleService
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <param name="req"></param>
/// <returns></returns>
Task<DataResult<List<CodeDataRuleRes>>> GetListByPage(PageRequest request);
Task<DataResult<List<CodeDataRuleRes>>> GetCodeDataRuleList(GetOrCreateCodeDataRuleReq req);
/// <summary>
/// 编辑
/// 数据权限指定范围
/// </summary>
/// <param name="model"></param>
/// <param name="req"></param>
/// <returns></returns>
Task<DataResult> EditCodeDataRule(CodeDataRuleReq model);
public Task<DataResult> AssignDataRuleScope(AssignDataRuleScopeReq req);
///// <summary>
///// 编辑
///// </summary>
///// <param name="model"></param>
///// <returns></returns>
//Task<DataResult> EditCodeDataRule(CodeDataRuleReq model);
/// <summary>
/// 获取详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<DataResult<CodeDataRuleRes>> GetCodeDataRuleInfo(string id);
///// <summary>
///// 获取详情
///// </summary>
///// <param name="id"></param>
///// <returns></returns>
//Task<DataResult<CodeDataRuleRes>> GetCodeDataRuleInfo(string id);
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> BatchDelCodeDataRule(IdModel req);
///// <summary>
///// 批量删除
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//public Task<DataResult> BatchDelCodeDataRule(IdModel req);
}

@ -6,7 +6,10 @@ using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Sys.Dtos;
using DS.WMS.Core.Sys.Entity;
using Mapster;
using Microsoft.AspNet.SignalR.Hubs;
using Microsoft.Extensions.DependencyInjection;
using SqlSugar;
@ -34,49 +37,88 @@ namespace DS.WMS.Core.Code.Method
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult<List<CodeDataRuleRes>>> GetListByPage(PageRequest request)
public async Task<DataResult<List<CodeDataRuleRes>>> GetCodeDataRuleList(GetOrCreateCodeDataRuleReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
//序列化查询条件
var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
if (!tenantDb.Queryable<CodeDataRule>().Where(x=>x.UserId == req.UserId && x.PermissionId == req.PermissionId).Any()) {
var visibleTemp = await tenantDb.Queryable<CodeDataRuleTemplate>().FirstAsync(x => x.PermissionId == req.PermissionId && x.RuleType == "visible" && x.RuleScope == "self");
if (visibleTemp.IsNull())
{
return await Task.FromResult(DataResult<List<CodeDataRuleRes>>.Failed("请维护该权限下的本人可视权限模板!"));
}
var operateTemp = await tenantDb.Queryable<CodeDataRuleTemplate>().FirstAsync(x => x.PermissionId == req.PermissionId && x.RuleType == "operate" && x.RuleScope == "self");
if (operateTemp.IsNull())
{
return await Task.FromResult(DataResult<List<CodeDataRuleRes>>.Failed("请维护该权限下的本人操作权限模板!"));
}
var userInfo = await db.Queryable<SysUser>().FirstAsync(x => x.Id == req.UserId);
var rule = new CodeDataRule() {
UserId = req.UserId,
UserName = userInfo.UserName,
VisibleTemplateId = visibleTemp.Id,
VisibleRuleScope =visibleTemp.RuleScope,
VisibleRuleScopeName = visibleTemp.RuleScopeName,
OperateTemplateId = operateTemp.Id,
OperateRuleScope = operateTemp.RuleScope,
OperateRuleScopeName = operateTemp.RuleScopeName,
PermissionId = req.PermissionId,
TemplateName = visibleTemp.TemplateName,
Description = visibleTemp.Description,
Note = visibleTemp.Note,
};
await tenantDb.Insertable(rule).ExecuteCommandAsync();
}
var data = await tenantDb.Queryable<CodeDataRule>()
.Where(whereList)
.Select<CodeDataRuleRes>().ToQueryPageAsync(request.PageCondition);
return data;
.Where(x => x.UserId == req.UserId && x.PermissionId == req.PermissionId)
.Select<CodeDataRuleRes>().ToListAsync();
return await Task.FromResult(DataResult<List<CodeDataRuleRes>>.Success(data,MultiLanguageConst.DataQuerySuccess));
//序列化查询条件
//var whereList = db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
//var data = await tenantDb.Queryable<CodeDataRule>()
// .Where(whereList)
// .Select<CodeDataRuleRes>().ToQueryPageAsync(request.PageCondition);
//return data;
}
/// <summary>
/// 编辑
/// 数据权限指定范围
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
public async Task<DataResult> EditCodeDataRule(CodeDataRuleReq req)
public async Task<DataResult> AssignDataRuleScope(AssignDataRuleScopeReq req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
if (req.Id == 0)
{
if (tenantDb.Queryable<CodeDataRule>()
.Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any())
{
return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist));
}
var info = await tenantDb.Queryable<CodeDataRule>().FirstAsync(x => x.Id == req.Id);
var data = req.Adapt<CodeDataRule>();
var entity = await tenantDb.Insertable(data).ExecuteReturnEntityAsync();
return await Task.FromResult(DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess));
if (info.IsNull())
{
return await Task.FromResult(DataResult.Failed("数据权限不存在!"));
}
if (req.RuleType == "visible")
{
info.VisibleTemplateId = req.TemplateId;
info.VisibleRuleScope = req.RuleScope;
info.VisibleRuleScopeName = req.RuleScopeName;
}
else
{
var info = await tenantDb.Queryable<CodeDataRule>().Where(x => x.Id == req.Id).FirstAsync();
info.OperateTemplateId = req.TemplateId;
info.OperateRuleScope = req.RuleScope;
info.OperateRuleScopeName = req.RuleScopeName;
info = req.Adapt(info);
await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
await tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return await Task.FromResult(DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess));
}
/// <summary>
@ -84,28 +126,28 @@ namespace DS.WMS.Core.Code.Method
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<DataResult<CodeDataRuleRes>> GetCodeDataRuleInfo(string id)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var data = await tenantDb.Queryable<CodeDataRule>()
.Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable)
.Select<CodeDataRuleRes>()
.FirstAsync();
return await Task.FromResult(DataResult<CodeDataRuleRes>.Success(data, MultiLanguageConst.DataQuerySuccess));
}
//public async Task<DataResult<CodeDataRuleRes>> GetCodeDataRuleInfo(string id)
//{
// var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
// var data = await tenantDb.Queryable<CodeDataRule>()
// .Where(x => x.Id == long.Parse(id) && x.Status == StatusEnum.Enable)
// .Select<CodeDataRuleRes>()
// .FirstAsync();
// return await Task.FromResult(DataResult<CodeDataRuleRes>.Success(data, MultiLanguageConst.DataQuerySuccess));
//}
public async Task<DataResult> BatchDelCodeDataRule(IdModel req)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<CodeDataRule>().Where(x => req.Ids.Contains(x.Id)).ToListAsync();
if (list.Count > 0)
{
tenantDb.Deleteable(list).ExecuteCommand();
}
return await Task.FromResult(DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess));
}
//public async Task<DataResult> BatchDelCodeDataRule(IdModel req)
//{
// var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
// var list = await tenantDb.Queryable<CodeDataRule>().Where(x => req.Ids.Contains(x.Id)).ToListAsync();
// if (list.Count > 0)
// {
// tenantDb.Deleteable(list).ExecuteCommand();
// }
// return await Task.FromResult(DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess));
//}
}
}

@ -63,7 +63,7 @@ namespace DS.WMS.Core.Code.Method
if (req.Id == 0)
{
if (tenantDb.Queryable<CodeDataRuleTemplate>()
.Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName).Any())
.Where(x => x.PermissionId == req.PermissionId && x.TemplateName == req.TemplateName && x.RuleScope == req.RuleScope && x.RuleType == req.RuleType).Any())
{
return await Task.FromResult(DataResult.Failed("数据权限模板已存在!", MultiLanguageConst.DataRuleTemplateExist));
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Flow.Dtos;
using DS.WMS.Core.Flow.Entity;
@ -28,6 +29,7 @@ public class FlowInstanceService : ServiceBase, IFlowInstanceService
/// <param name="serviceProvider"></param>
public FlowInstanceService(IServiceProvider serviceProvider) : base(serviceProvider)
{
Db.QueryFilter.Clear<ITenantId>();
}
/// <summary>

@ -68,10 +68,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService
if (await queryable.AnyAsync(x => (SqlFunc.IsNullOrEmpty(x.Tel) && SqlFunc.IsNullOrEmpty(x.Mobile)) || (SqlFunc.IsNullOrEmpty(x.Email) && SqlFunc.IsNullOrEmpty(x.QQ))))
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ClientInfoIncomplete));
var template = await FindTemplateAsync(INFO_CLIENT_TASK);
if (template == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
if (await taskService.Value.HasAuthorizedAsync())
{
var requests = list.Select(x => new TaskCreationRequest
@ -106,6 +102,10 @@ public class ClientInfoService : ServiceBase, IClientInfoService
}
}
var template = await FindTemplateAsync(INFO_CLIENT_TASK);
if (template == null)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TemplateNotFound));
for (int i = 0; i < idModel.Ids.Length; i++)
{
var id = idModel.Ids[i];
@ -260,16 +260,11 @@ public class ClientInfoService : ServiceBase, IClientInfoService
{
//序列化查询条件
var whereList = request.GetConditionalModels(Db);
foreach (var item in whereList)
{
var condition = (ConditionalModel)item;
condition.FieldName = "c." + condition.FieldName.ToUpperCamelCase();
}
var query = TenantDb.Queryable<InfoClient>()
.LeftJoin<InfoClientContact>((c, c1) => c.Id == c1.ClientId)
.LeftJoin<InfoClientContract>((c, c1, c2) => c.Id == c2.ClientId)
.InnerJoinIF<InfoClientTag>(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId);
.InnerJoinIF<InfoClientTag>(request.OtherQueryCondition?.ClientTag != null, (c, c1, c2, ct) => c.Id == ct.ClientId)
.GroupBy((c, c1, c2) => c.Id);
if (!string.IsNullOrEmpty(request.OtherQueryCondition?.ContactInfo))
query = query.Where((c, c1, c2) => c1.Tel.Contains(request.OtherQueryCondition.ContactInfo) ||
@ -296,7 +291,14 @@ public class ClientInfoService : ServiceBase, IClientInfoService
}
}
var result = await query.Where(whereList).Select<ClientInfoRes>().ToQueryPageAsync(request.PageCondition);
var result = await query.Select((c, c1, c2, ct) => new ClientInfoRes
{
CodeName = c.CodeName,
Name = c.Name,
ShortName = c.ShortName,
EnShortName = c.EnShortName,
EnFullName = c.EnFullName
}, true).MergeTable().Where(whereList).ToQueryPageAsync(request.PageCondition);
if (result.Data?.Count > 0)
{

@ -1605,23 +1605,34 @@ namespace DS.WMS.Core.Op.Method
return DataResult<string>.Failed($"箱型{conta.CtnAll}的映射数据代码未找到");
}
if (string.IsNullOrWhiteSpace(conta.KindPkgs))
//截单时箱的包装必填
if (string.IsNullOrWhiteSpace(conta.KindPkgs) && req.SendType.Equals("E",StringComparison.OrdinalIgnoreCase))
return DataResult<string>.Failed($"集装箱包装不能为空!");
long packageId = long.Parse(conta.KindPkgs);
if (!string.IsNullOrWhiteSpace(conta.KindPkgs))
{
long packageId = long.Parse(conta.KindPkgs);
var mapRlt = GetPackageEDICode(packageId, codePackageList, mapPackageList, order.CarrierId, CONST_MAPPING_MODULE);
var mapRlt = GetPackageEDICode(packageId, codePackageList, mapPackageList, order.CarrierId, CONST_MAPPING_MODULE);
if (codePackageList.Any(b => b.Id == packageId))
contaModel.KINDPKGS = codePackageList.FirstOrDefault(b => b.Id == packageId).PackageName;
if (codePackageList.Any(b => b.Id == packageId))
contaModel.KINDPKGS = codePackageList.FirstOrDefault(b => b.Id == packageId).PackageName;
if (mapRlt.Succeeded)
{
contaModel.KINDPKGS_EDI_CODE = mapRlt.Data;
if (mapRlt.Succeeded)
{
contaModel.KINDPKGS_EDI_CODE = mapRlt.Data;
}
else
{
return DataResult<string>.Failed($"集装箱【{conta.CntrNo}】包装{conta.KindPkgs}的映射数据代码未找到");
}
}
else
{
return DataResult<string>.Failed($"包装{order.KindPkgs}的映射数据代码未找到");
if(req.SendType.Equals("E", StringComparison.OrdinalIgnoreCase))
{
return DataResult<string>.Failed($"集装箱【{conta.CntrNo}】包装{conta.KindPkgs} 不能为空");
}
}
primaryModel.CTNLIST.Add(contaModel);
@ -2606,11 +2617,16 @@ namespace DS.WMS.Core.Op.Method
if (!string.IsNullOrWhiteSpace(mapCtnInfo.MapCode))
return DataResult<string>.Success(mapCtnInfo.MapCode);
return DataResult<string>.FailedData(mapCtnInfo.MapCode);
throw new Exception($"集装箱型 {ctnName}的映射代码未找到");
}
else
{
throw new Exception($"集装箱型 {ctnName}的映射代码未找到");
if (codeCtnInfo != null && !string.IsNullOrWhiteSpace(codeCtnInfo.EdiCode))
{
return DataResult<string>.Success(codeCtnInfo.EdiCode);
}
throw new Exception($"集装箱型 {ctnName}基础代码EDI 错误");
}
}
#endregion
@ -2660,12 +2676,25 @@ namespace DS.WMS.Core.Op.Method
if (!string.IsNullOrWhiteSpace(mapPackageInfo.MapCode))
return DataResult<string>.Success(mapPackageInfo.MapCode);
return DataResult<string>.FailedData(mapPackageInfo.MapCode);
//return DataResult<string>.FailedData(mapPackageInfo.MapCode);
throw new Exception($"包装的映射代码未找到");
}
else
{
throw new Exception($"包装的映射代码未找到");
var codePackage = codePackageList.FirstOrDefault(b => b.Id == packageCodeId);
if(codePackage != null && !string.IsNullOrWhiteSpace(codePackage.EdiCode))
{
return DataResult<string>.Success(codePackage.EdiCode);
}
throw new Exception($"包装的基础信息EDI代码未找到");
}
//else
//{
//
//}
}
#endregion

@ -786,6 +786,7 @@ public partial class SeaExportService : ISeaExportService
//data.IsBusinessLocking = false;
//data.IsFeeLocking = false;
//data.CustomerNo = sequence.Data;
data.CustomerNo = "";
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
@ -801,6 +802,7 @@ public partial class SeaExportService : ISeaExportService
data = info.Adapt(data);
data.Id = 0;
data.ParentId = 0;
data.CustomerNo = "";
//data.IsBusinessLocking = false;
//data.IsFeeLocking = false;
//data.CustomerNo = sequence.Data;
@ -813,7 +815,7 @@ public partial class SeaExportService : ISeaExportService
}
list1.Add("IsBusinessLocking");
list1.Add("IsFeeLocking");
list1.Add("CustomerNo");
//list1.Add("CustomerNo");
var insertColumns = list1.ToArray();
//insertColumns.AddRange(["Id", "ParentId", "IsBusinessLocking", "IsFeeLocking", "CustomerNo"]);
var entity = tenantDb.Insertable(data).InsertColumns(insertColumns).ExecuteReturnEntity();

@ -63,6 +63,19 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
x.Vessel,
x.Voyno,
x.ETD,
x.DischargePortId,
x.DischargePortCode,
x.DischargePort,
x.LoadPortId,
x.LoadPortCode,
x.LoadPort,
x.CarrierId,
x.Carrier,
//x.BookingNo,
//x.HBLNO,
//x.CustomerNum,
}).FirstAsync(x => x.Id == first.BusinessId);
var taskList = new List<BusinessTask>();
@ -100,8 +113,24 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
}
};
info.Main.TaskDesp = info.Main.TaskTitle = $"【{item.TaskType.GetDescription()}】{biz?.CustomerNo} {biz?.Vessel} {biz?.Voyno} ETD:{biz?.ETD?.ToString("yyyy-MM-dd")}";
info.Main.CUSTOMER_NO = biz?.CustomerNo;
info.Main.CustomerNo = biz?.CustomerNo;
info.Main.MBlNo = biz?.MBLNO;
info.Main.ETD = biz?.ETD;
info.Main.PortDischarge = biz?.DischargePort;
info.Main.PortDischargeCode = biz?.DischargePortCode;
info.Main.PortDischargeId = biz?.DischargePortId;
info.Main.PortLoad = biz?.LoadPort;
info.Main.PortLoadId = biz?.LoadPortId;
info.Main.PortLoadCode = biz?.LoadPortCode;
info.Main.CarrierId = biz?.Carrier;
info.Main.CarrierPK = biz?.CarrierId;
//info.Main.HBLNO = biz?.HBLNO;
//info.Main.BookingNo = biz?.BookingNo;
//info.Main.CustomsNum = biz?.CustomerNum;
var result = await ManagerService.InitTaskJob(info);
if (!result.Succeeded)

@ -269,11 +269,40 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
x.Vessel,
x.Voyno,
x.ETD,
x.DischargePortId,
x.DischargePortCode,
x.DischargePort,
x.LoadPortId,
x.LoadPortCode,
x.LoadPort,
x.CarrierId,
x.Carrier,
//x.BookingNo,
//x.HBLNO,
//x.CustomerNum,
}).FirstAsync(x => x.Id == request.BusinessId);
info.Main.TaskTitle = $"【{request.TaskType.GetDescription()}】{biz?.CustomerNo} {biz?.Vessel} {biz?.Voyno} ETD:{biz?.ETD?.ToString("yyyy-MM-dd")}";
info.Main.CustomerNo = biz?.CustomerNo;
info.Main.MBlNo = biz?.MBLNO;
info.Main.CUSTOMER_NO = biz?.CustomerNo;
info.Main.ETD = biz?.ETD;
info.Main.PortDischarge = biz?.DischargePort;
info.Main.PortDischargeCode = biz?.DischargePortCode;
info.Main.PortDischargeId = biz?.DischargePortId;
info.Main.PortLoad = biz?.LoadPort;
info.Main.PortLoadId = biz?.LoadPortId;
info.Main.PortLoadCode = biz?.LoadPortCode;
info.Main.CarrierId = biz?.Carrier;
info.Main.CarrierPK = biz?.CarrierId;
//info.Main.HBLNO = biz?.HBLNO;
//info.Main.BookingNo = biz?.BookingNo;
//info.Main.CustomsNum = biz?.CustomerNum;
}
info.Main.TaskDesp = info.Main.TaskDesp ?? info.Main.TaskTitle;
@ -315,13 +344,16 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
if (updateFlag)
{
await SetTaskStatusAsync(new TaskUpdateRequest
result = await SetTaskStatusAsync(new TaskUpdateRequest
{
BusinessId = request.BusinessId,
BusinessType = request.BusinessType,
TaskTypeName = request.TaskTypeName,
TaskStatus = TaskStatusEnum.Create
}, false);
if (!result.Succeeded)
return result;
}
}
@ -418,8 +450,8 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData));
if (task.TaskStatus == TaskStatusEnum.Complete)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCompleted));
if (task.TaskStatus == TaskStatusEnum.Cancel)
return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCancelled));
//if (task.TaskStatus == TaskStatusEnum.Cancel)
// return DataResult.FailedWithDesc(nameof(MultiLanguageConst.TaskCancelled));
var result = await ManagerService.SetTaskStatusWithBsno(request.BusinessId, request.TaskType, request.TaskStatus, DateTime.Now);
if (!result.Succeeded)
@ -432,10 +464,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
task.RejectReason = request.RejectReason;
//更新当前任务状态
task.TaskStatus = request.TaskStatus;
if (AuditTaskTypes.Contains(task.TaskType))
task.FlowId = null;
await TenantDb.Updateable(task).UpdateColumns(x => new { x.TaskStatus, x.FlowId, x.RejectReason }).ExecuteCommandAsync();
await TenantDb.Updateable(task).UpdateColumns(x => new { x.TaskStatus, x.RejectReason }).ExecuteCommandAsync();
if (task.TaskStatus == TaskStatusEnum.Complete && task.NextType.HasValue && request.AutoCreateNext)
{

@ -12,7 +12,8 @@ public class OrgTree
public long? ParentId { get; set; }
public List<OrgTree> Children { get; set; }
public List<UserSelectRes> UserList { get; set; }
/// <summary>
/// 无参构造函数
/// </summary>

@ -46,7 +46,7 @@ public interface IClientCommonService
/// 获取约号下拉列表-客户端
/// </summary>
/// <returns></returns>
public Task<DataResult<List<BookingContractNoSelectRes>>> GetBookingContractNoList(string queryKey = "");
public Task<DataResult<List<BookingContractNoSelectRes>>> GetBookingContractNoList(string queryKey = "", long carrierId = 0);
/// <summary>
/// 获取商品下拉列表-客户端
/// </summary>

@ -42,4 +42,11 @@ public interface ISysOrgService
/// <param name="req"></param>
/// <returns></returns>
public DataResult BatchDelOrg(IdModel req);
/// <summary>
/// 获取树型机构用户
/// </summary>
/// <returns></returns>
public DataResult<List<OrgTree>> GetOrgUserTree();
}

@ -162,11 +162,12 @@ public class ClientCommonService : IClientCommonService
/// 获取约号下拉列表-客户端
/// </summary>
/// <returns></returns>
public async Task<DataResult<List<BookingContractNoSelectRes>>> GetBookingContractNoList(string queryKey = "")
public async Task<DataResult<List<BookingContractNoSelectRes>>> GetBookingContractNoList(string queryKey = "", long carrierId = 0)
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<BookingContractNoManage>()
.WhereIF(!string.IsNullOrEmpty(queryKey), a => a.ContractNo.Contains(queryKey) || a.ContractName.Contains(queryKey))
.WhereIF(carrierId != 0, a => a.CarrierId == carrierId)
.Select<BookingContractNoSelectRes>()
.Take(20)
.WithCache($"{SqlSugarCacheConst.ContractNo}{user.TenantId}")

@ -164,4 +164,73 @@ public class SysOrgService:ISysOrgService
throw ex;
}
}
/// <summary>
/// 获取树型机构用户
/// </summary>
/// <returns></returns>
public DataResult<List<OrgTree>> GetOrgUserTree()
{
var list = db.Queryable<SysOrg>().Select(a => new OrgTree
{
Title = a.OrgName,
Value = a.Id,
ParentId = a.ParentId
}).ToList();
var orgList = BuildOrgUserTree(list,db);
return DataResult<List<OrgTree>>.Success("获取数据成功!", orgList);
}
/// <summary>
/// 双层循环
/// </summary>
/// <param name="treeNodes"></param>
/// <returns></returns>
public static List<OrgTree> BuildOrgUserTree(List<OrgTree> treeNodes,ISqlSugarClient sugarClient)
{
try
{
List<OrgTree> trees = new List<OrgTree>();
foreach (var treeNode in treeNodes)
{
//var orgUsers = sugarClient.Queryable<SysOrgUser>().Where(x=>x.OrgId == treeNode.Value).Select(x=>x.UserId).ToList();
//if (orgUsers.Count>0)
//{
// var users = sugarClient.Queryable<SysUser>().Where(x => orgUsers.Contains(x.Id)).Select<UserSelectRes>().ToList();
// if (users.Any())
// {
// }
//}
var users = sugarClient.Queryable<SysUser>().Where(x => x.DefaultOrgId == treeNode.Value).Select<UserSelectRes>().ToList();
if (users.Count>0)
{
treeNode.UserList = users;
}
if (0 == (treeNode.ParentId))
{
trees.Add(treeNode);
}
foreach (var it in treeNodes)
{
if (it.ParentId == treeNode.Value)
{
treeNode.Children.Add(it);
}
}
}
return trees;
}
catch (Exception ex)
{
throw ex;
}
}
}

@ -56,7 +56,7 @@ public class SysRoleService : ISysRoleService
{
if (model.Id == 0)
{
var isExist = db.Queryable<SysRole>().Filter(null, true).Where(x => x.RoleCode == model.RoleCode).First();
var isExist = db.Queryable<SysRole>().Where(x => x.RoleCode == model.RoleCode).First();
if (isExist != null)
{
return DataResult.Failed("角色唯一编码已存在!", MultiLanguageConst.UserCodeExist);

@ -6,7 +6,7 @@
public sealed class QueryTaskManageDto
{
/// <summary>
/// 业务编号(提单号或委托编号)
/// 业务编号(委托编号/订舱编号/客户编号/提单号/分单号)
/// </summary>
public string BusinessNo { get; set; }
@ -79,5 +79,19 @@
/// 大简云用户Id
/// </summary>
public string DJYUserId { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
public string? PortLoadCode { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string? PortDischargeCode { get; set; }
}
}

@ -7,10 +7,24 @@
/// </summary>
public string QueryCondition { get; set; } = string.Empty;
public QueryTaskManageDto OtherQueryCondition { get; set; }
/// <summary>
/// 业务编号(提单号或委托编号)
/// </summary>
public string BusinessNo { get; set; }
///// <summary>
///// 业务编号(提单号或委托编号)
///// </summary>
//public string BusinessNo { get; set; }
///// <summary>
///// 装货港代码
///// </summary>
//public string? PortLoadCode { get; set; }
///// <summary>
///// 卸货港代码
///// </summary>
//public string? PortDischargeCode { get; set; }
}
}

@ -1,4 +1,5 @@
using DS.Module.Core;
using SqlSugar;
using System.ComponentModel.DataAnnotations;
namespace DS.WMS.Core.TaskPlat.Dtos
@ -63,7 +64,7 @@ namespace DS.WMS.Core.TaskPlat.Dtos
/// <summary>
/// 委托编号
/// </summary>
public string? CUSTOMER_NO { get; set; }
public string? CustomerNo { get; set; }
/// <summary>
/// 反馈结果
@ -311,9 +312,56 @@ namespace DS.WMS.Core.TaskPlat.Dtos
///// 单票账单的解析
///// </summary>
//public perbill perbillInfo { get; set; }
/// <summary>
/// 任务批次号
/// </summary>
public string TaskBatchNo { get; set; }
///// <summary>
///// 客户编号
///// </summary>
//public string? CustomsNum { get; set; }
///// <summary>
///// 分提单号
///// </summary>
//public string? HBLNO { get; set; }
///// <summary>
///// 订舱编号
///// </summary>
//public string? BookingNo { get; set; }
/// <summary>
/// 装货港主键
/// </summary>
public long? PortLoadId { get; set; }
/// <summary>
/// 装货港代码
/// </summary>
public string? PortLoadCode { get; set; }
/// <summary>
/// 装货港
/// </summary>
public string? PortLoad { get; set; }
/// <summary>
/// 卸货港主键
/// </summary>
public long? PortDischargeId { get; set; }
/// <summary>
/// 卸货港代码
/// </summary>
public string? PortDischargeCode { get; set; }
/// <summary>
/// 卸货港
/// </summary>
public string? PortDischarge { get; set; }
}
}

@ -116,12 +116,30 @@ namespace DS.WMS.Core.TaskPlat.Entity
[SugarColumn(ColumnDescription = "主单号", IsNullable = true, Length = 64)]
public string? MBL_NO { get; set; }
///// <summary>
///// 分单号
///// </summary>
//[SugarColumn(ColumnDescription = "分单号", IsNullable = true, Length = 30)]
//public string? HBL_NO { get; set; }
///// <summary>
///// 订舱编号
///// </summary>
//[SugarColumn(ColumnDescription = "订舱编号", IsNullable = true, Length = 20)]
//public string? BOOKING_NO { get; set; }
/// <summary>
/// 委托编号
/// </summary>
[SugarColumn(ColumnDescription = "委托编号", IsNullable = true, Length = 30)]
public string? CUSTOMER_NO { get; set; }
///// <summary>
///// 客户编号
///// </summary>
//[SugarColumn(ColumnDescription = "客户编号", IsNullable = true, Length = 50)]
//public string? CUSTOMER_NUM { get; set; }
/// <summary>
/// 备注
/// </summary>
@ -290,7 +308,41 @@ namespace DS.WMS.Core.TaskPlat.Entity
//[SugarColumn(ColumnDescription = "大简云userid", IsNullable = true, Length = 50)]
//public string? DJYUserId { get; set; }
///// <summary>
///// 装货港主键
///// </summary>
//[SugarColumn(ColumnDescription = "装货港主键", IsNullable = true)]
//public long? PORTLOAD_ID { get; set; }
///// <summary>
///// 装货港代码
///// </summary>
//[SugarColumn(ColumnDescription = "装货港代码", IsNullable = true, Length = 10)]
//public string? PORTLOAD_CODE { get; set; }
///// <summary>
///// 装货港
///// </summary>
//[SugarColumn(ColumnDescription = "装货港", IsNullable = true, Length = 120)]
//public string? PORTLOAD { get; set; }
///// <summary>
///// 卸货港主键
///// </summary>
//[SugarColumn(ColumnDescription = "卸货港主键", IsNullable = true)]
//public long? PORTDISCHARGE_ID { get; set; }
///// <summary>
///// 卸货港代码
///// </summary>
//[SugarColumn(ColumnDescription = "卸货港代码", IsNullable = true, Length = 10)]
//public string? PORTDISCHARGE_CODE { get; set; }
///// <summary>
///// 卸货港
///// </summary>
//[SugarColumn(ColumnDescription = "卸货港", IsNullable = true, Length = 120)]
//public string? PORTDISCHARGE { get; set; }
}
}

@ -9,6 +9,7 @@ using DS.Module.DjyServiceStatus;
using DS.Module.SqlSugar;
using DS.Module.UserModule;
using DS.WMS.Core.Code.Dtos;
using DS.WMS.Core.Code.Entity;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Map.Dtos;
using DS.WMS.Core.Map.Interface;
@ -37,6 +38,7 @@ namespace DS.WMS.Core.TaskPlat.Method
private readonly ICodePortService codePortService;
private readonly IMappingPortService mappingPortService;
private readonly IMappingCarrierService mappingCarrierService;
private readonly ICodeCarrierService codeCarrierService;
// 按需构建
//private readonly Lazy<ISeaExportCommonService> seaExportCommonService;
@ -46,6 +48,11 @@ namespace DS.WMS.Core.TaskPlat.Method
/// </summary>
public static DateTime LastMatchTaskTime = DateTime.Now;
/// <summary>
/// 需要查海运出口表的小写字段名
/// </summary>
static string[] seaExportFields = ["customerid", "saleid", "customerservice", "operatorid"]; //, "portload_code", "portdischarge_code"
public TaskManageService(IUser user,
ILogger<TaskManageService> logger,
ISaasDbService saasDbService,
@ -54,12 +61,14 @@ namespace DS.WMS.Core.TaskPlat.Method
ICodeCtnService codeCtnService,
ICodePortService codePortService,
IMappingPortService mappingPortService,
IMappingCarrierService mappingCarrierService) : base(user, logger, saasDbService, serviceProvider, environment)
IMappingCarrierService mappingCarrierService,
ICodeCarrierService codeCarrierService) : base(user, logger, saasDbService, serviceProvider, environment)
{
this.codeCtnService = codeCtnService;
this.codePortService = codePortService;
this.mappingPortService = mappingPortService;
this.mappingCarrierService = mappingCarrierService;
this.codeCarrierService = codeCarrierService;
//seaExportCommonService = new Lazy<ISeaExportCommonService>(serviceProvider.GetRequiredService<ISeaExportCommonService>);
}
@ -325,7 +334,22 @@ namespace DS.WMS.Core.TaskPlat.Method
BATCH_STATIC = info.Main.BatchStatic,
//DJYUserId = info.Head.DJYUserId,
OUT_BS_NO = info.Head.BSNO,
CUSTOMER_NO = info.Main.CUSTOMER_NO,
CUSTOMER_NO = info.Main.CustomerNo,
//CUSTOMER_NUM = info.Main.CustomsNum,
//HBL_NO = info.Main.HBLNO,
//BOOKING_NO = info.Main.BookingNo,
//PORTDISCHARGE = info.Main.PortDischarge,
//PORTDISCHARGE_CODE = info.Main.PortDischargeCode,
//PORTDISCHARGE_ID = info.Main.PortDischargeId,
//PORTLOAD = info.Main.PortLoad,
//PORTLOAD_ID = info.Main.PortLoadId,
//PORTLOAD_CODE = info.Main.PortLoadCode,
CARRIER_ID = info.Main.CarrierPK,
CARRIER_CODE = info.Main.CarrierId,
CARRIER_NAME = info.Main.CarrierName,
CreateTime = DateTime.Now,
};
if (Enum.TryParse(typeof(TaskBaseTypeEnum), taskInfo.TASK_TYPE, out object? taskTypeTemp))
@ -333,24 +357,29 @@ namespace DS.WMS.Core.TaskPlat.Method
taskInfo.TASK_TYPE_NAME = ((TaskBaseTypeEnum)taskTypeTemp).EnumDescription();
}
// 如果船公司主键不为空则直接保存船公司主键、Code、Name等信息
if (info.Main.CarrierPK != null)
// 如果船公司主键不为空则直接保存船公司主键、Code、Name等信息如果Name为空查询一下再赋值
if (taskInfo.CARRIER_ID != null)
{
taskInfo.CARRIER_ID = info.Main.CarrierPK;
taskInfo.CARRIER_CODE = info.Main.CarrierId;
taskInfo.CARRIER_NAME = info.Main.CarrierName;
if (string.IsNullOrEmpty(taskInfo.CARRIER_NAME))
{
var carrierShortName = await tenantDb.Queryable<CodeCarrier>().Where(x => x.Id == taskInfo.CARRIER_ID).Select(x => x.CnShortName).FirstAsync();
taskInfo.CARRIER_NAME = carrierShortName;
}
}
// 如果船公司主键为空但是Code不为空则通过映射查出船公司信息并保存
else if (!string.IsNullOrEmpty(info.Main.CarrierId))
else
{
// 船公司转换
var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List<MappingCarrierRes>();
MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(info.Main.CarrierId, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault();
if (carrierInfo != null)
// 如果船公司主键为空但是Code不为空则通过映射查出船公司信息并保存
if (!string.IsNullOrEmpty(taskInfo.CARRIER_CODE))
{
taskInfo.CARRIER_ID = carrierInfo.LinkId;
taskInfo.CARRIER_CODE = carrierInfo.MapCode;
taskInfo.CARRIER_NAME = carrierInfo.MapName;
// 船公司转换
var allMapCarrierList = (await mappingCarrierService.GetAllList())?.Data ?? new List<MappingCarrierRes>();
MappingCarrierRes? carrierInfo = allMapCarrierList.Where(t => t.MapCode.Equals(taskInfo.CARRIER_CODE, StringComparison.OrdinalIgnoreCase) && t.Module == MappingModuleConst.CONST_MAPPING_CARRIER_MODULE).FirstOrDefault();
if (carrierInfo != null)
{
taskInfo.CARRIER_ID = carrierInfo.LinkId;
taskInfo.CARRIER_CODE = carrierInfo.MapCode;
taskInfo.CARRIER_NAME = carrierInfo.MapName;
}
}
}
@ -1703,7 +1732,12 @@ namespace DS.WMS.Core.TaskPlat.Method
{
if (item is ConditionalModel model)
{
if (!model.FieldName.StartsWith("t."))
string lowerFieldName = model.FieldName.ToLower();
if (seaExportFields.Contains(lowerFieldName))
{
model.FieldName = "s." + model.FieldName;
}
else
{
model.FieldName = "t." + model.FieldName;
}
@ -1735,17 +1769,41 @@ namespace DS.WMS.Core.TaskPlat.Method
{
switch (taskType)
{
case TaskBaseTypeEnum.BC:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>()
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskBCInfo>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
// POL、POD关联查询
queryable.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition.PortLoadCode), (t, a, bc, s) => querySearch.OtherQueryCondition.PortLoadCode == bc.PORTLOAD_CODE || querySearch.OtherQueryCondition.PortLoadCode == bc.PORTLOAD_CODE);
queryable.WhereIF(!string.IsNullOrEmpty(querySearch.OtherQueryCondition.PortDischargeCode), (t, a, bc, s) => querySearch.OtherQueryCondition.PortDischargeCode == bc.PORTDISCHARGE_CODE || querySearch.OtherQueryCondition.PortDischargeCode == bc.PORTDISCHARGE_CODE);
result = await queryable.Select<dynamic>((t, a, bc) => new
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
{
Id = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.BUSI_TYPE,
bc.SHIPPER,
bc.CONSIGNEE,
@ -1820,22 +1878,41 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.PROCESS_RESULT,
bc.PROCESS_DATE,
bc.PRICE_CALCULATION_DATE
})
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
}).Distinct();
var sql = queryableTemp.ToSqlString();
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
//var sql = queryable.ToSqlString();
return result;
}
case TaskBaseTypeEnum.SI_FEEDBACK:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskSiSubmitted>((t, a, bc) => t.Id == bc.TASK_ID);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
.LeftJoin<TaskSiSubmitted>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.CARRIER,
//bc.MBL_NO,
bc.TAKE_ISSUETYPE_NAME,
@ -1876,20 +1953,41 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.DIFF_NUM,
bc.IS_UPDATE_BOOKING,
bc.UPDATE_BOOKING_DATE
})
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
}).Distinct();
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.INVOICE_BILL_MAIL:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskPerBillBase>((t, a, bc) => t.Id == bc.TASK_PKID);
.LeftJoin<TaskPerBillBase>((t, a, bc) => t.Id == bc.TASK_PKID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_PKID,
//bc.MBL_NO,
bc.INVOICE_NO,
@ -1900,20 +1998,38 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.DONGSH_RECV_TIME,
bc.DONGSH_RESULT_TIME,
bc.DONGSH_RECV_REASON
})
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
}).Distinct();
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.TRUCK_DISPATCH:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskTruck>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskTruck>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
var queryableTemp = queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
//s.CntrTotal,
bc.TASK_ID,
bc.BookingTruckId,
bc.BookingId,
@ -1965,20 +2081,38 @@ namespace DS.WMS.Core.TaskPlat.Method
bc.MBLNo,
bc.CntrTotal,
bc.FactoryAddr
})
.Distinct().ToQueryPageAsync(querySearch.PageCondition);
}).Distinct();
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
case TaskBaseTypeEnum.CUT_MODIFY:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskCutDateChangeInfo>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskCutDateChangeInfo>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
result = await queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_ID,
bc.CARRIER,
bc.VESSEL,
@ -1992,13 +2126,31 @@ namespace DS.WMS.Core.TaskPlat.Method
case TaskBaseTypeEnum.TRANSFER_NOMINATION:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskRollingNomination>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskRollingNomination>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
result = await queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_ID,
bc.PLAN_TYPE,
bc.BATCH_NO,
@ -2017,13 +2169,31 @@ namespace DS.WMS.Core.TaskPlat.Method
case TaskBaseTypeEnum.DRAFT:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskDraftInfo>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskDraftInfo>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
result = await queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_ID,
bc.CARRIER,
//bc.MBL_NO,
@ -2039,13 +2209,31 @@ namespace DS.WMS.Core.TaskPlat.Method
case TaskBaseTypeEnum.POD_GATEOUT_FULL:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskPodDischargeGateoutFull>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskPodDischargeGateoutFull>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
result = await queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_ID,
bc.CARRIER,
bc.NOTICE_TYPE,
@ -2058,13 +2246,32 @@ namespace DS.WMS.Core.TaskPlat.Method
case TaskBaseTypeEnum.CAUTION_NOTICE:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskCautionNotice>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskCautionNotice>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
result = await queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_ID,
bc.SOURCE_SYSTEM,
bc.SOURCE_BUSI_TYPE,
@ -2089,13 +2296,31 @@ namespace DS.WMS.Core.TaskPlat.Method
case TaskBaseTypeEnum.ROUTE_CUT_CHANGE:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<TaskRouteChangeAdvisory>((t, a, bc) => t.Id == bc.TASK_ID);
.LeftJoin<TaskRouteChangeAdvisory>((t, a, bc) => t.Id == bc.TASK_ID)
.LeftJoin<SeaExport>((t, a, bc, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a, bc) => new
result = await queryable.Select<dynamic>((t, a, bc, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
bc.TASK_ID,
bc.VESSEL,
bc.VOYNO,
@ -2118,19 +2343,43 @@ namespace DS.WMS.Core.TaskPlat.Method
}).Distinct().ToQueryPageAsync(querySearch.PageCondition);
return result;
}
default:
{
var queryable = tenantDb.Queryable<TaskBaseInfo>().LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId);
var queryable = tenantDb.Queryable<TaskBaseInfo>()
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<SeaExport>((t, a, s) => t.OUT_BS_NO == s.Id);
SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
await SetCondition(queryable, whereList, taskType, taskStatLevel, querySearch.OtherQueryCondition, userId);
result = await queryable.Select<dynamic>((t, a) => new
var queryableTemp = queryable.Select<dynamic>((t, a, s) => new
{
PK_ID = t.Id.SelectAll(),
s.CustomerNo,
s.CustomerNum,
s.BookingNo,
s.HBLNO,
s.CustomerName,
s.Sale,
s.CustomerServiceName,
s.OperatorName,
s.LoadPortCode,
s.LoadPort,
s.DischargePortCode,
s.DischargePort,
s.CntrTotal,
//TASK_USER_STATUS = a.Status,
//TASK_USER_STATUS_NAME = a.StatusName,
//TASK_USER_STATUS_TIME = a.StatusTime
}).Distinct().ToQueryPageAsync(querySearch.PageCondition);
}).Distinct();
var sql = queryableTemp.ToSqlString();
result = await queryableTemp.ToQueryPageAsync(querySearch.PageCondition);
return result;
}
@ -2140,6 +2389,7 @@ namespace DS.WMS.Core.TaskPlat.Method
{
if (result.Data?.Count > 0)
{
// 查询任务接收人列表
var taskIdList = result.Data.Select(x => (long)x.Id).ToList();
var allRecvUserList = await tenantDb.Queryable<TaskBaseAllocation>()
@ -2181,11 +2431,89 @@ namespace DS.WMS.Core.TaskPlat.Method
}
}
}
/// <summary>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
private static async Task SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T, SeaExport> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum? taskStatLevel,
QueryTaskManageDto queryDto,
long userId)
{
queryable.ClearFilter(typeof(IOrgId));
var taskTypeStr = taskType.ToString();
long? parentId = null;
if (!string.IsNullOrEmpty(queryDto.BusinessNo))
{
var parentIdTemp = await queryable.Context.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync();
parentId = parentIdTemp == 0 ? null : parentIdTemp;
}
queryable.Where(whereList)
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
.WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, bc, s) => queryDto.BusinessNo == t.MBL_NO
|| queryDto.BusinessNo == s.MBLNO
|| queryDto.BusinessNo == s.CustomerNo
|| queryDto.BusinessNo == s.BookingNo
|| queryDto.BusinessNo == s.CustomerNum
|| (parentId != null && s.Id == parentId))
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryDto.Status)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务自己创建的任务不显示所以去掉t.CreateBy == userId ||
&& a.Status == queryDto.Status)
.OrderByDescending(t => t.Id);
var sql = queryable.ToSqlString();
}
/// <summary>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
private static async Task SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, SeaExport> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum? taskStatLevel,
QueryTaskManageDto queryDto,
long userId)
{
queryable.ClearFilter(typeof(IOrgId));
long? parentId = null;
if (!string.IsNullOrEmpty(queryDto.BusinessNo))
{
var parentIdTemp = await queryable.Context.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.BusinessNo).Select(x => x.ParentId).FirstAsync();
parentId = parentIdTemp == 0 ? null : parentIdTemp;
}
queryable.Where(whereList)
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
.WhereIF(!string.IsNullOrEmpty(queryDto.BusinessNo), (t, a, s) => queryDto.BusinessNo == t.MBL_NO
|| queryDto.BusinessNo == s.MBLNO
|| queryDto.BusinessNo == s.CustomerNo
|| queryDto.BusinessNo == s.CustomerNum
|| queryDto.BusinessNo == s.BookingNo
|| (parentId != null && s.Id == parentId))
.WhereIF(!string.IsNullOrEmpty(queryDto.PortLoadCode), (t, a, s) => queryDto.PortLoadCode == s.LoadPortCode)
.WhereIF(!string.IsNullOrEmpty(queryDto.PortDischargeCode), (t, a, s) => queryDto.PortDischargeCode == s.DischargePortCode)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryDto.Status)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务自己创建的任务不显示所以去掉t.CreateBy == userId ||
&& a.Status == queryDto.Status)
.OrderByDescending(t => t.Id);
}
/// <summary>
/// 获取登陆人相关的任务统计信息
/// </summary>
/// <returns>返回回执</returns>
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto querySearch)
public async Task<DataResult<TaskUserStatResultInfo>> GetCurrentTotalStat(GetCurrentTotalStatQueryDto queryDto)
{
TaskUserStatResultInfo resultInfo = new TaskUserStatResultInfo
@ -2214,9 +2542,9 @@ namespace DS.WMS.Core.TaskPlat.Method
//序列化查询条件
List<IConditionalModel>? whereList = null;
if (!string.IsNullOrEmpty(querySearch.QueryCondition))
if (!string.IsNullOrEmpty(queryDto.QueryCondition))
{
whereList = tenantDb.Utilities.JsonToConditionalModels(querySearch.QueryCondition);
whereList = tenantDb.Utilities.JsonToConditionalModels(queryDto.QueryCondition);
if (whereList != null)
{
@ -2224,7 +2552,12 @@ namespace DS.WMS.Core.TaskPlat.Method
{
if (item is ConditionalModel model)
{
if (!model.FieldName.StartsWith("t."))
string lowerFieldName = model.FieldName.ToLower();
if (seaExportFields.Contains(lowerFieldName))
{
model.FieldName = "s." + model.FieldName;
}
else
{
model.FieldName = "t." + model.FieldName;
}
@ -2234,14 +2567,53 @@ namespace DS.WMS.Core.TaskPlat.Method
}
var userId = long.Parse(user.UserId);
var cancelStr = TaskStatusEnum.Cancel.ToString();
long? parentId = null;
if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo))
{
var parentIdTemp = await tenantDb.Queryable<SeaExport>().ClearFilter(typeof(IOrgId)).Where(x => x.HBLNO == queryDto.OtherQueryCondition.BusinessNo).Select(x => x.ParentId).FirstAsync();
parentId = parentIdTemp == 0 ? null : parentIdTemp;
}
long[]? portLoadTaskIdList = [];
if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode))
{
var q1 = tenantDb.Queryable<TaskBCInfo>().Where(x => x.PORTLOAD_CODE == queryDto.OtherQueryCondition.PortLoadCode).Select(x => new { x.TASK_ID });
var temp = await q1.ToListAsync();
if (temp.Count > 0)
{
portLoadTaskIdList = temp.Select(x => x.TASK_ID).ToArray();
}
}
long[]? portDischargeTaskIdList = [];
if (!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode))
{
var q1 = tenantDb.Queryable<TaskBCInfo>().Where(x => x.PORTDISCHARGE_CODE == queryDto.OtherQueryCondition.PortDischargeCode).Select(x => new { x.TASK_ID });
var temp = await q1.ToListAsync();
if (temp.Count > 0)
{
portLoadTaskIdList = temp.Select(x => x.TASK_ID).ToArray();
}
}
//任务列表分组统计
var groupList = await tenantDb.Queryable<TaskBaseInfo>()
var queryable = tenantDb.Queryable<TaskBaseInfo>()
.ClearFilter(typeof(IOrgId))
.LeftJoin<TaskBaseAllocation>((t, a) => t.Id == a.TaskId)
.LeftJoin<SeaExport>((t, a, s) => t.OUT_BS_NO == s.Id)
.Where(whereList)
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
.Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (a.UserId == userId))) // 2024-8-14 只显示自己需要审批的任务自己创建的任务不显示所以去掉t.CreateBy == userId ||
.WhereIF(!string.IsNullOrEmpty(querySearch.BusinessNo), (t, a) => t.MBL_NO == querySearch.BusinessNo || t.CUSTOMER_NO == querySearch.BusinessNo)
.Where((t, a) => t.STATUS != cancelStr)
.Where((t, a) => t.IS_PUBLIC == 1 || (t.IS_PUBLIC == 0 && a.Status != null && (a.UserId == userId))) // 2024-8-14 只显示自己需要审批的任务自己创建的任务不显示所以去掉t.CreateBy == userId ||
.WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.BusinessNo), (t, a, s) => queryDto.OtherQueryCondition.BusinessNo == t.MBL_NO
|| queryDto.OtherQueryCondition.BusinessNo == s.MBLNO
|| queryDto.OtherQueryCondition.BusinessNo == s.CustomerNo
|| queryDto.OtherQueryCondition.BusinessNo == s.BookingNo
|| queryDto.OtherQueryCondition.BusinessNo == s.CustomerNum
|| (parentId != null && s.Id == parentId))
.WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortLoadCode), (t, a, s) => queryDto.OtherQueryCondition.PortLoadCode == s.LoadPortCode || portLoadTaskIdList.Contains(t.Id))
.WhereIF(!string.IsNullOrEmpty(queryDto.OtherQueryCondition.PortDischargeCode), (t, a, s) => queryDto.OtherQueryCondition.PortDischargeCode == s.DischargePortCode || portDischargeTaskIdList.Contains(t.Id))
.GroupBy((t, a) => new { t.TASK_TYPE, t.STATUS, a.Status, t.IS_PUBLIC })
.Select((t, a) => new
{
@ -2251,7 +2623,10 @@ namespace DS.WMS.Core.TaskPlat.Method
AStatus = a.Status,
//IsExcept = t.IS_EXCEPT,
IsPublic = t.IS_PUBLIC
}).ToListAsync();
});
var sql = queryable.ToSqlString();
var groupList = await queryable.ToListAsync();
//var exceptList = groupList
@ -2696,49 +3071,6 @@ namespace DS.WMS.Core.TaskPlat.Method
return DataResult<TaskManageOrderResultDto>.Success(result);
}
/// <summary>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
private void SetCondition<T>(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation, T> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum? taskStatLevel,
QueryTaskManageDto queryTaskManageDto,
long userId)
{
queryable.ClearFilter(typeof(IOrgId))
.Where(whereList)
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
.WhereIF(!string.IsNullOrEmpty(queryTaskManageDto.BusinessNo), (t, a) => t.MBL_NO == queryTaskManageDto.BusinessNo || t.CUSTOMER_NO == queryTaskManageDto.BusinessNo)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryTaskManageDto.Status)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务自己创建的任务不显示所以去掉t.CreateBy == userId ||
&& a.Status == queryTaskManageDto.Status)
.OrderByDescending(t => t.Id);
}
/// <summary>
/// 设置条件的方法,用于<see cref="GetPageAsync(PageRequest{QueryTaskManageDto})"/>
/// </summary>
private void SetCondition(ISugarQueryable<TaskBaseInfo, TaskBaseAllocation> queryable,
List<IConditionalModel>? whereList,
TaskBaseTypeEnum? taskType,
TaskStatLevelEnum? taskStatLevel,
QueryTaskManageDto queryTaskManageDto,
long userId)
{
queryable.ClearFilter(typeof(IOrgId))
.Where(whereList)
.Where((t, a) => t.STATUS != TaskStatusEnum.Cancel.ToString())
.WhereIF(taskType != null, (t, a) => t.TASK_TYPE == taskType.ToString())
.WhereIF(!string.IsNullOrEmpty(queryTaskManageDto.BusinessNo), (t, a) => t.MBL_NO == queryTaskManageDto.BusinessNo || t.CUSTOMER_NO == queryTaskManageDto.BusinessNo)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PUBLIC, (t, a) => t.IS_PUBLIC == 1 && t.STATUS == queryTaskManageDto.Status)
.WhereIF(taskStatLevel == TaskStatLevelEnum.PERSON, (t, a) => t.IS_PUBLIC == 0
&& (a.UserId == userId) // 2024-8-14 只显示自己需要审批的任务自己创建的任务不显示所以去掉t.CreateBy == userId ||
&& a.Status == queryTaskManageDto.Status)
.OrderByDescending(t => t.Id);
}

@ -103,13 +103,13 @@ public class ClientCommonController : ApiController
/// <summary>
/// 获取合约号下拉列表-客户端
/// </summary>
/// <param name="queryKey">商品代码</param>
/// <param name="queryKey">合约号</param>
/// <returns></returns>
[HttpGet]
[Route("GetBookingContractNoList")]
public async Task<DataResult<List<BookingContractNoSelectRes>>> GetBookingContractNoList([FromQuery] string queryKey)
public async Task<DataResult<List<BookingContractNoSelectRes>>> GetBookingContractNoList([FromQuery] string queryKey, long carrierId = 0)
{
var res = await _invokeService.GetBookingContractNoList(queryKey);
var res = await _invokeService.GetBookingContractNoList(queryKey, carrierId);
return res;
}
/// <summary>

@ -27,52 +27,63 @@ public class CodeDataRuleController : ApiController
/// <summary>
/// 列表
/// </summary>
/// <param name="request"></param>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("GetCodeDataRuleList")]
public async Task<DataResult<List<CodeDataRuleRes>>> GetCodeDataRuleList([FromBody] PageRequest request)
public async Task<DataResult<List<CodeDataRuleRes>>> GetCodeDataRuleList([FromBody] GetOrCreateCodeDataRuleReq req)
{
var res =await _invokeService.GetListByPage(request);
var res =await _invokeService.GetCodeDataRuleList(req);
return res;
}
/// <summary>
/// 编辑
/// 数据权限指定范围
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpPost]
[Route("EditCodeDataRule")]
public async Task<DataResult> EditCodeDataRule([FromBody] CodeDataRuleReq req)
[Route("AssignDataRuleScope")]
public async Task<DataResult> AssignDataRuleScope([FromBody] AssignDataRuleScopeReq req)
{
var res = await _invokeService.EditCodeDataRule(req);
var res = await _invokeService.AssignDataRuleScope(req);
return res;
}
///// <summary>
///// 编辑
///// </summary>
///// <param name="req"></param>
///// <returns></returns>
//[HttpPost]
//[Route("EditCodeDataRule")]
//public async Task<DataResult> EditCodeDataRule([FromBody] CodeDataRuleReq req)
//{
// var res = await _invokeService.EditCodeDataRule(req);
// return res;
//}
/// <summary>
/// 详情
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpGet]
[Route("GetCodeDataRuleInfo")]
public async Task<DataResult<CodeDataRuleRes>> GetCodeDataRuleInfo([FromQuery] string id)
{
var res = await _invokeService.GetCodeDataRuleInfo(id);
return res;
}
///// <summary>
///// 详情
///// </summary>
///// <param name="id"></param>
///// <returns></returns>
//[HttpGet]
//[Route("GetCodeDataRuleInfo")]
//public async Task<DataResult<CodeDataRuleRes>> GetCodeDataRuleInfo([FromQuery] string id)
//{
// var res = await _invokeService.GetCodeDataRuleInfo(id);
// return res;
//}
/// <summary>
/// 批量删除
/// </summary>
/// <param name="req">req</param>
/// <returns></returns>
[HttpPost]
[Route("BatchDelCodeDataRule")]
public async Task<DataResult> BatchDelCodeDataRule([FromBody] IdModel req)
{
var res =await _invokeService.BatchDelCodeDataRule(req);
return res;
}
///// <summary>
///// 批量删除
///// </summary>
///// <param name="req">req</param>
///// <returns></returns>
//[HttpPost]
//[Route("BatchDelCodeDataRule")]
//public async Task<DataResult> BatchDelCodeDataRule([FromBody] IdModel req)
//{
// var res =await _invokeService.BatchDelCodeDataRule(req);
// return res;
//}
}

@ -84,4 +84,17 @@ public class OrgController : ApiController
var res = _invokeService.BatchDelOrg(req);
return res;
}
/// <summary>
/// 获取树型机构用户
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("GetOrgUserTree")]
public DataResult<List<OrgTree>> GetOrgUserTree()
{
var res = _invokeService.GetOrgUserTree();
return res;
}
}

@ -2,16 +2,19 @@ using System.IO;
using System.Reflection;
using DS.Module.Core;
using DS.Module.Core.Extensions;
using DS.Module.Core.Helpers;
using DS.Module.SqlSugar;
using DS.WMS.Core.Code.Interface;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Op.Interface;
using DS.WMS.Core.Sys.Entity;
using DS.WMS.Core.Sys.Interface;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using NPOI.HPSF;
using Org.BouncyCastle.Ocsp;
using SharpCompress.Common;
using SqlSugar;
using SqlSugar.IOC;
@ -47,13 +50,16 @@ public class OpTest
Assert.True(true);
}
/// <summary>
/// 租户用户授权数
/// </summary>
[Fact]
public void OpTest2()
{
//var tenantDb = saasService.GetBizDbScopeById("1750335377144680448");
//var data = _commonSetService.GetSequenceNext<SeaExport>();
var str = EncrypteHelper.EncryptData("300", "ba31a8758af1c6b7");
Assert.True(true);
}

@ -61,7 +61,7 @@ public class SaasDBUpdateTest
var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew();
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci"; //较高版本支持
//tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体
tenantDb.CodeFirst.InitTables(typeof(BusinessYard));//指定更新特定实体
tenantDb.CodeFirst.InitTables(typeof(CodeDataRule));//指定更新特定实体
}
Assert.True(true);
@ -81,8 +81,22 @@ public class SaasDBUpdateTest
{
var tenantDb = saasService.GetBizDbScopeById(item.TenantId).CopyNew();
StaticConfig.CodeFirst_MySqlCollate = "utf8mb4_0900_ai_ci"; //较高版本支持
//tenantDb.CodeFirst.InitTables(types); //指定表空间下的实体
tenantDb.CodeFirst.InitTables(typeof(BookingContractNoManageLane));//指定更新特定实体
// 多表更新
//tenantDb.CodeFirst.InitTables(types);
// 单表更新
//tenantDb.CodeFirst.InitTables(typeof(TaskBaseInfo));
// SQL更新
string sql = @"ALTER TABLE `task_base`
DROP COLUMN `PORTLOAD_ID`,
DROP COLUMN `PORTLOAD_CODE`,
DROP COLUMN `PORTLOAD`,
DROP COLUMN `PORTDISCHARGE_ID`,
DROP COLUMN `PORTDISCHARGE_CODE`,
DROP COLUMN `PORTDISCHARGE`;";
tenantDb.Ado.ExecuteCommand(sql);
}
Assert.True(true);

Loading…
Cancel
Save