修改 盘点任务代码
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities.Entity.Constraints
|
||||
{
|
||||
public interface IUpdateEnabledEntity
|
||||
{
|
||||
public int enabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Entities;
|
||||
|
||||
@@ -6,7 +7,7 @@ namespace Tnb.WarehouseMgr.Entities;
|
||||
/// WMS电梯设定主表
|
||||
/// </summary>
|
||||
|
||||
public partial class WmsElevatorH
|
||||
public partial class WmsElevatorH : IUpdateEnabledEntity
|
||||
{
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public int end_floor { get; set; }
|
||||
@@ -64,6 +65,6 @@ public partial class WmsElevatorH
|
||||
/// 状态
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "status")]
|
||||
public int enable_mark { get; set; }
|
||||
public int enabled { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.WarehouseMgr.Interfaces
|
||||
{
|
||||
public interface IWmsBasicDataBaseService
|
||||
{
|
||||
Task<bool> IsEnabledMark(IEnumerable<string> ids, int status);
|
||||
}
|
||||
}
|
||||
@@ -977,9 +977,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enabled == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
@@ -1048,9 +1048,9 @@ namespace Tnb.WarehouseMgr
|
||||
if (curEleDs?.Count > 0)
|
||||
{
|
||||
//当前电梯
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enable_mark == 1);
|
||||
WmsElevatorH curEle = await _db.Queryable<WmsElevatorH>().SingleAsync(it => it.id == curEleDs.First().bill_id && it.enabled == 1);
|
||||
//同电梯组电梯
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enable_mark == 1).ToListAsync();
|
||||
List<WmsElevatorH> sGpEle = await _db.Queryable<WmsElevatorH>().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.enabled == 1).ToListAsync();
|
||||
|
||||
if (curEle == null && sGpEle?.Count > 0)
|
||||
{
|
||||
|
||||
@@ -3,9 +3,12 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Contracts;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities.Entity.Constraints;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
@@ -13,17 +16,13 @@ namespace Tnb.WarehouseMgr
|
||||
/// Wms基础数据基类
|
||||
/// </summary>
|
||||
/// <typeparam name="TEntity"></typeparam>
|
||||
//public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, new()
|
||||
//{
|
||||
// private readonly ISqlSugarClient _db;
|
||||
// public WmsBasicDataBase()
|
||||
// {
|
||||
|
||||
// }
|
||||
// [HttpPost]
|
||||
// public async Task<bool> IsEnabledMark(IEnumerable<string> ids,int status)
|
||||
// {
|
||||
|
||||
// }
|
||||
//}
|
||||
public class WmsBasicDataBase<TEntity> : BaseWareHouseService where TEntity : BaseEntity<string>, IUpdateEnabledEntity, new()
|
||||
{
|
||||
protected ISqlSugarClient DbContext { get; set; }
|
||||
[HttpPost]
|
||||
public async Task<bool> IsEnabledMark(IEnumerable<string> ids, int status)
|
||||
{
|
||||
return await DbContext.Updateable<TEntity>().SetColumns(it => it.enabled == status).ExecuteCommandHasChangeAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EnumCheckType.批次盘点:
|
||||
case EnumCheckType.区域盘点:
|
||||
{
|
||||
if (areaIds?.Length > 0)
|
||||
{
|
||||
@@ -341,6 +341,11 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
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()
|
||||
&& c.is_lock == 0;
|
||||
|
||||
switch (input.CheckType)
|
||||
{
|
||||
case EnumCheckType.全库盘点:
|
||||
@@ -354,10 +359,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (!input.material_id.IsNullOrWhiteSpace())
|
||||
{
|
||||
filterExp = (a, b, c) => a.wh_id == input.warehouse_id
|
||||
&& b.material_id == input.material_id
|
||||
&& a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& c.is_lock == 0;
|
||||
filterExp = defaultFilterExp.And((a, b, c) => b.material_id == input.material_id);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -365,10 +367,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (input.regionIds?.Count > 0)
|
||||
{
|
||||
filterExp = (a, b, c) => a.wh_id == input.warehouse_id
|
||||
&& input.regionIds.Contains(a.region_id)
|
||||
&& a.is_type == ((int)EnumLocationType.存储库位).ToString()
|
||||
&& c.is_lock == 0;
|
||||
filterExp = defaultFilterExp.And((a, b, c) => input.regionIds.Contains(a.region_id));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
21
WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
Normal file
21
WarehouseMgr/Tnb.WarehouseMgr/WmsElevatorService.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
|
||||
namespace Tnb.WarehouseMgr
|
||||
{
|
||||
/// <summary>
|
||||
/// 电梯业务类
|
||||
/// </summary>
|
||||
public class WmsElevatorService : WmsBasicDataBase<WmsElevatorH>
|
||||
{
|
||||
public WmsElevatorService(ISqlSugarRepository<WmsElevatorH> repo)
|
||||
{
|
||||
DbContext = repo.AsSugarClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user