cjy 3 months ago
commit 602ff7a527

@ -283,7 +283,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
var props = Array.FindAll(request.OtherQueryCondition.ClientTag.GetType().GetProperties(), x => x.Name.StartsWith("Is") && x.PropertyType == typeof(bool)); var props = Array.FindAll(request.OtherQueryCondition.ClientTag.GetType().GetProperties(), x => x.Name.StartsWith("Is") && x.PropertyType == typeof(bool));
foreach (var prop in props) foreach (var prop in props)
{ {
object val = PropertyInfoExtensions.Get(prop, request.OtherQueryCondition.ClientTag); object val = prop.Get(request.OtherQueryCondition.ClientTag);
if (val != null && val is bool value && value) if (val != null && val is bool value && value)
{ {
whereList.Add(new ConditionalModel whereList.Add(new ConditionalModel
@ -338,7 +338,11 @@ public class ClientInfoService : ServiceBase, IClientInfoService
Name = c.ShortName, Name = c.ShortName,
IsUsed = SqlFunc.Subqueryable<SeaExport>().Where(s => c.Id == s.CustomerId || c.Id == s.ForwarderId || IsUsed = SqlFunc.Subqueryable<SeaExport>().Where(s => c.Id == s.CustomerId || c.Id == s.ForwarderId ||
c.Id == s.YardId || c.Id == s.ShipperCnId || c.Id == s.ContractClientId || c.Id == s.TruckerId || c.Id == s.YardId || c.Id == s.ShipperCnId || c.Id == s.ContractClientId || c.Id == s.TruckerId ||
c.Id == s.AgentId || c.Id == s.ShipAgencyId || c.Id == s.CustomserId).Any() c.Id == s.AgentId || c.Id == s.ShipAgencyId || c.Id == s.CustomserId || c.Id == s.WareHouseId).Any() &&
SqlFunc.Subqueryable<FeeRecord>().Where(f => c.Id == f.CustomerId).Any() &&
SqlFunc.Subqueryable<CheckBill>().Where(f => c.Id == f.CustomerId).Any() &&
SqlFunc.Subqueryable<CheckBillAuto>().Where(f => c.Id == f.CustomerId).Any()
}).ToListAsync(); }).ToListAsync();
var result = DataResult<List<ClientUsage>>.Success(list); var result = DataResult<List<ClientUsage>>.Success(list);
@ -358,6 +362,9 @@ public class ClientInfoService : ServiceBase, IClientInfoService
data.AuditStatus = AuditStatusEnum.NoAudit; data.AuditStatus = AuditStatusEnum.NoAudit;
data.OrgId = User.OrgId; data.OrgId = User.OrgId;
if (string.IsNullOrEmpty(data.CodeName))
data.CodeName = PinYinUtil.GetFristLetter(data.ShortName); //助记码
if (req.ServiceItemCodes?.Length > 0) if (req.ServiceItemCodes?.Length > 0)
data.ServiceItem = string.Join(",", req.ServiceItemCodes); data.ServiceItem = string.Join(",", req.ServiceItemCodes);
@ -367,8 +374,6 @@ public class ClientInfoService : ServiceBase, IClientInfoService
return DataResult.Failed("客户信息已存在,请检查客户全称、简称或社会信用代码是否重复!", MultiLanguageConst.ClientInfoExist); return DataResult.Failed("客户信息已存在,请检查客户全称、简称或社会信用代码是否重复!", MultiLanguageConst.ClientInfoExist);
var tag = req.ClientTag.Adapt<InfoClientTag>(); var tag = req.ClientTag.Adapt<InfoClientTag>();
//助记码
data.CodeName = PinYinUtil.GetFristLetter(req.ShortName);
var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync(); var entity = await TenantDb.Insertable(data).ExecuteReturnEntityAsync();
tag.ClientId = entity.Id; tag.ClientId = entity.Id;
await TenantDb.Insertable(tag).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommandAsync(); await TenantDb.Insertable(tag).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}").ExecuteCommandAsync();
@ -388,17 +393,18 @@ public class ClientInfoService : ServiceBase, IClientInfoService
if (TenantDb.Queryable<InfoClient>().Where(x => x.Id != data.Id && (x.ShortName == req.ShortName.Trim() || x.Description == req.Description.Trim() || x.TaxNo == req.TaxNo.Trim())).Any()) if (TenantDb.Queryable<InfoClient>().Where(x => x.Id != data.Id && (x.ShortName == req.ShortName.Trim() || x.Description == req.Description.Trim() || x.TaxNo == req.TaxNo.Trim())).Any())
return DataResult.Failed("请检查客户全称、简称或社会信用代码是否重复!", MultiLanguageConst.ClientInfoExist); return DataResult.Failed("请检查客户全称、简称或社会信用代码是否重复!", MultiLanguageConst.ClientInfoExist);
var list = (await GetUsageAsync(req.Id))?.Data;
if (list != null && list.Any(x => x.Id == req.Id && x.IsUsed))
return DataResult.FailedWithDesc(MultiLanguageConst.ClientIsUsed);
tag = req.ClientTag.Adapt(tag); tag = req.ClientTag.Adapt(tag);
data.ServiceItem = data.ServiceItem ?? string.Empty; data.ServiceItem = data.ServiceItem ?? string.Empty;
TenantDb.Updateable(data).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}") var updateable = TenantDb.Updateable(data).RemoveDataCache($"{SqlSugarCacheConst.InfoClient}{User.TenantId}")
.IgnoreColumns(ignoreAllNullColumns: true) .IgnoreColumns(ignoreAllNullColumns: true)
.IgnoreColumns(x => new { x.Status, x.AuditStatus }) .IgnoreColumns(x => new { x.Status, x.AuditStatus, x.AuditNote, x.AuditTime });
.ExecuteCommand();
TenantDb.Updateable(tag).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand(); var list = (await GetUsageAsync(req.Id))?.Data;
if (list != null && list.Exists(x => x.Id == req.Id && x.IsUsed))
updateable = updateable.IgnoreColumns(x => x.ShortName);
await updateable.ExecuteCommandAsync();
await TenantDb.Updateable(tag).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess); return DataResult.Successed("更新成功!", MultiLanguageConst.DataUpdateSuccess);
} }
@ -450,39 +456,9 @@ public class ClientInfoService : ServiceBase, IClientInfoService
await TenantDb.Ado.BeginTranAsync(); await TenantDb.Ado.BeginTranAsync();
try try
{ {
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.ShipperId)).Any()) var result = await GetUsageAsync(req.Ids);
return DataResult.Failed("存在海运出口使用的发货人信息!"); if (result.Data != null && result.Data.Exists(x => x.IsUsed))
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.ConsigneeId)).Any()) return DataResult.FailedWithDesc(MultiLanguageConst.ClientIsUsed);
return DataResult.Failed("存在海运出口使用的收货人信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains((long)x.NotifyPartyId)).Any())
return DataResult.Failed("存在海运出口使用的通知人信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.AgentId)).Any())
return DataResult.Failed("存在海运出口使用的国外代理人信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.ShipAgencyId)).Any())
return DataResult.Failed("存在海运出口使用的船代I信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.CustomerId)).Any())
return DataResult.Failed("存在海运出口使用的委托单位信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.YardId)).Any())
return DataResult.Failed("存在海运出口使用的场站信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.CarrierId)).Any())
return DataResult.Failed("存在海运出口使用的船公司信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.ForwarderId)).Any())
return DataResult.Failed("存在海运出口使用的货代公司信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.CustomserId)).Any())
return DataResult.Failed("存在海运出口使用的报关行信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.TruckerId)).Any())
return DataResult.Failed("存在海运出口使用的承运车队信息!");
if (TenantDb.Queryable<SeaExport>().Where(x => req.Ids.Contains(x.WareHouseId)).Any())
return DataResult.Failed("存在海运出口使用的仓库信息!");
if (TenantDb.Queryable<FeeRecord>().Where(x => req.Ids.Contains(x.CustomerId)).Any())
return DataResult.Failed("存在费用记录使用的费用对象信息!");
if (TenantDb.Queryable<CheckBill>().Where(x => req.Ids.Contains(x.CustomerId)).Any())
return DataResult.Failed("存在客户对账使用的对账客户信息!");
if (TenantDb.Queryable<CheckBillAuto>().Where(x => req.Ids.Contains(x.CustomerId)).Any())
return DataResult.Failed("存在自动对账使用的对账客户信息!");
//银行信息 //银行信息
await TenantDb.Deleteable<InfoClientBank>().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync(); await TenantDb.Deleteable<InfoClientBank>().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync();

@ -46,7 +46,7 @@ namespace DS.WMS.Core.Op.Dtos.TaskInteraction
/// <returns></returns> /// <returns></returns>
public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext) public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{ {
if (BusinessId == 0 || Ids == null || Ids.Length == 0) if (BusinessId == 0 && (Ids == null || Ids.Length == 0))
{ {
yield return new ValidationResult($"参数 {nameof(BusinessId)} 与 {nameof(Ids)} 至少指定一项"); yield return new ValidationResult($"参数 {nameof(BusinessId)} 与 {nameof(Ids)} 至少指定一项");
} }

@ -118,7 +118,7 @@ namespace DS.WMS.Core.Op.Method.TaskInteraction
EnName = x.UserEnName, EnName = x.UserEnName,
Name = x.UserEnName, Name = x.UserEnName,
Mobile = x.Phone, Mobile = x.Phone,
//QQ = x QQ = x.QQ
}).ToListAsync(); }).ToListAsync();
long saleId = list.Find(x => x.Item2 == "sale")!.Item1; long saleId = list.Find(x => x.Item2 == "sale")!.Item1;

Loading…
Cancel
Save