盘点任务,业务代码调整

This commit is contained in:
yang.lee
2023-11-16 16:21:44 +08:00
parent 9afd85bb89
commit 5333dc96c0
5 changed files with 19 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto
/// <summary> /// <summary>
/// 进出库策略状态修改输入参数s /// 进出库策略状态修改输入参数s
/// </summary> /// </summary>
public class ModifyPoliciesStatusInput public class ModifyEnabledInput
{ {
/// <summary> /// <summary>
/// 1、入库 2我、出库 /// 1、入库 2我、出库

View File

@@ -4,6 +4,7 @@ using System.DirectoryServices.Protocols;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json;
using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Entities.Enums;
namespace Tnb.WarehouseMgr.Entities.Dto.Queries namespace Tnb.WarehouseMgr.Entities.Dto.Queries

View File

@@ -849,9 +849,9 @@ namespace Tnb.WarehouseMgr
/// <param name="input"></param> /// <param name="input"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task ModifyPoliciesStatus(ModifyPoliciesStatusInput input) public async Task ModifyPoliciesStatus(ModifyEnabledInput input)
{ {
async Task _updateStatus<T>(ModifyPoliciesStatusInput input) where T : BaseEntity<string>, IUpdatePoliciesStatus, new() async Task _updateStatus<T>(ModifyEnabledInput input) where T : BaseEntity<string>, IUpdatePoliciesStatus, new()
{ {
T obj = new() { status = input.status }; T obj = new() { status = input.status };
_ = await _db.Updateable(obj).UpdateColumns(it => it.status).Where(it => input.ids.Contains(it.id)).ExecuteCommandAsync(); _ = await _db.Updateable(obj).UpdateColumns(it => it.status).Where(it => input.ids.Contains(it.id)).ExecuteCommandAsync();

View File

@@ -7,6 +7,7 @@ using Aop.Api.Domain;
using JNPF.Common.Contracts; using JNPF.Common.Contracts;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using SqlSugar; using SqlSugar;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Entity.Constraints; using Tnb.WarehouseMgr.Entities.Entity.Constraints;
using Tnb.WarehouseMgr.Interfaces; using Tnb.WarehouseMgr.Interfaces;
@@ -19,10 +20,11 @@ namespace Tnb.WarehouseMgr
public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, IUpdateEnabledEntity, new() public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, IUpdateEnabledEntity, new()
{ {
protected ISqlSugarClient DbContext { get; set; } protected ISqlSugarClient DbContext { get; set; }
[HttpPost] [HttpPost]
public async Task<bool> IsEnabledMark(IEnumerable<string> ids, int status) public async Task<bool> IsEnabledMark(ModifyEnabledInput input)
{ {
return await DbContext.Updateable<TEntity>().SetColumns(it => it.enabled == status).ExecuteCommandHasChangeAsync(); return await DbContext.Updateable<TEntity>().SetColumns(it => it.enabled == input.status).Where(it => input.ids.Contains(it.id)).ExecuteCommandHasChangeAsync();
} }
} }
} }

View File

@@ -332,8 +332,8 @@ namespace Tnb.WarehouseMgr
/// <br/>} /// <br/>}
/// </param> /// </param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpPost]
public async Task<dynamic> GetTaskDetailByCheckType([FromQuery] CheckDetailQuery input) public async Task<dynamic> GetTaskDetailByCheckType(CheckDetailQuery input)
{ {
if (_carryMap.Count == 0) if (_carryMap.Count == 0)
{ {
@@ -342,24 +342,25 @@ namespace Tnb.WarehouseMgr
Expression<Func<BasLocation, WmsCarryCode, WmsCarryH, bool>> filterExp = (a, b, c) => false; Expression<Func<BasLocation, WmsCarryCode, WmsCarryH, bool>> filterExp = (a, b, c) => false;
Expression<Func<BasLocation, WmsCarryCode, WmsCarryH, bool>> defaultFilterExp = (a, b, c) => a.wh_id == input.warehouse_id
&& a.is_type == ((int)EnumLocationType.).ToString() var filerExpable = Expressionable.Create<BasLocation, WmsCarryCode, WmsCarryH>()
&& c.is_lock == 0; .And((a, b, c) => a.wh_id == input.warehouse_id)
.And((a, b, c) => a.is_type == ((int)EnumLocationType.).ToString())
.And((a, b, c) => c.is_lock == 0);
switch (input.CheckType) switch (input.CheckType)
{ {
case EnumCheckType.: case EnumCheckType.:
{ {
filterExp = (a, b, c) => a.wh_id == input.warehouse_id filterExp = filerExpable.ToExpression();
&& a.is_type == ((int)EnumLocationType.).ToString()
&& c.is_lock == 0;
} }
break; break;
case EnumCheckType.: case EnumCheckType.:
{ {
if (!input.material_id.IsNullOrWhiteSpace()) if (!input.material_id.IsNullOrWhiteSpace())
{ {
filterExp = defaultFilterExp.And((a, b, c) => b.material_id == input.material_id); filterExp = filerExpable.And((a, b, c) => b.material_id == input.material_id).ToExpression();
} }
} }
break; break;
@@ -367,7 +368,7 @@ namespace Tnb.WarehouseMgr
{ {
if (input.regionIds?.Count > 0) if (input.regionIds?.Count > 0)
{ {
filterExp = defaultFilterExp.And((a, b, c) => input.regionIds.Contains(a.region_id)); filterExp = filerExpable.And((a, b, c) => input.regionIds.Contains(a.region_id)).ToExpression();
} }
} }
break; break;