Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -12,6 +12,7 @@ using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.JsonSerialization;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
@@ -45,32 +46,6 @@ namespace Tnb.QcMgr
|
||||
public async Task<dynamic> GetTaskItems(string id)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
|
||||
string planid = "26813180898837";
|
||||
var lists= await db.Queryable<QcCheckExecD>().Where(p => p.mainid == id).ToListAsync();
|
||||
if (lists.Count == 0)
|
||||
{
|
||||
var QcCheckPlanDs = await db.Queryable<QcCheckPlanD>().Where(p => p.mainid == planid).ToListAsync();
|
||||
List<QcCheckExecD> NewQcCheckExecDs = new List<QcCheckExecD>();
|
||||
foreach (var QcCheckPlanD in QcCheckPlanDs)
|
||||
{
|
||||
QcCheckExecD QcCheckExecD = new QcCheckExecD();
|
||||
QcCheckExecD.mainid = id;
|
||||
QcCheckExecD.extype = QcCheckPlanD.extype;
|
||||
QcCheckExecD.excontent = QcCheckPlanD.excontent;
|
||||
QcCheckExecD.check = QcCheckPlanD.check;
|
||||
QcCheckExecD.errorcause = QcCheckPlanD.errorcause;
|
||||
QcCheckExecD.errorlevel = QcCheckPlanD.errorlevel;
|
||||
QcCheckExecD.remark = QcCheckPlanD.remark;
|
||||
QcCheckExecD.attachment = QcCheckPlanD.attachment;
|
||||
QcCheckExecD.isexec = QcCheckPlanD.isexec;
|
||||
QcCheckExecD.custom = QcCheckPlanD.custom;
|
||||
QcCheckExecD.typeid = QcCheckPlanD.typeid;
|
||||
QcCheckExecD.itemid = QcCheckPlanD.itemid;
|
||||
NewQcCheckExecDs.Add(QcCheckExecD);
|
||||
}
|
||||
await db.Insertable<QcCheckExecD>(NewQcCheckExecDs).ExecuteCommandAsync();
|
||||
}
|
||||
var QcCheckExecH = await db.Queryable<QcCheckExecH>().Where(p => p.id == id).FirstAsync();
|
||||
var QcCheckExecDs = await db.Queryable<QcCheckExecD>().Where(p => p.mainid == id).ToListAsync();
|
||||
var QcCheckItems = await db.Queryable<QcCheckItem>().ToListAsync();
|
||||
@@ -155,8 +130,10 @@ namespace Tnb.QcMgr
|
||||
try
|
||||
{
|
||||
var QcCheckExecH = await db.Queryable<QcCheckExecH>().Where(p => p.id == CheckTaskInput.mainid).FirstAsync();
|
||||
var DictionaryType = await db.Queryable<DictionaryTypeEntity>().Where(p=>p.FullName== "质检状态").FirstAsync();
|
||||
var DictionaryData = await db.Queryable< DictionaryDataEntity >().Where(p => p.DictionaryTypeId==DictionaryType.Id&&p.FullName== "已完成").FirstAsync();
|
||||
QcCheckExecH.checknum = CheckTaskInput.checknum;
|
||||
QcCheckExecH.status = "26745885292053";
|
||||
QcCheckExecH.status = DictionaryData.Id;
|
||||
QcCheckExecH.result = CheckTaskInput.result;
|
||||
QcCheckExecH.execuser = _userManager.UserId;
|
||||
QcCheckExecH.exectime = DateTime.Now.ToString();
|
||||
|
||||
@@ -8,14 +8,14 @@
|
||||
/// <summary>
|
||||
/// 组织ID
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
public string org_id { get; set; }
|
||||
/// <summary>
|
||||
/// 载具Id
|
||||
/// </summary>
|
||||
public string? carry_code { get; set;}
|
||||
public string carry_code { get; set;}
|
||||
/// <summary>
|
||||
/// 创建热Id
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
public string create_id { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -14,22 +14,22 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 组织ID
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
public string org_id { get; set; }
|
||||
/// <summary>
|
||||
/// 库位编号
|
||||
/// </summary>
|
||||
public string? location_code { get; set; }
|
||||
public string location_code { get; set; }
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
public string carry_code { get; set; }
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
public string create_id { get; set; }
|
||||
/// <summary>
|
||||
/// 入库仓库
|
||||
/// </summary>
|
||||
public string? warehouse_id { get; set; }
|
||||
public string warehouse_id { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,20 +25,20 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
public string create_id { get; set; }
|
||||
/// <summary>
|
||||
/// 入库仓库
|
||||
/// </summary>
|
||||
public string? warehouse_id { get; set; }
|
||||
public string warehouse_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具规格编号
|
||||
/// </summary>
|
||||
public string? carrystd_id { get; set; }
|
||||
public string carrystd_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public int? qty { get; set; }
|
||||
public int qty { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 所属组织ID
|
||||
/// </summary>
|
||||
public string? org_id { get; set; }
|
||||
public string org_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 出库单创建日期
|
||||
@@ -34,37 +34,37 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 库位ID
|
||||
/// </summary>
|
||||
public string? location_id { get; set; }
|
||||
public string location_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 库位编号
|
||||
/// </summary>
|
||||
public string? location_code { get; set; }
|
||||
public string location_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具ID
|
||||
/// </summary>
|
||||
public string? carry_id { get; set; }
|
||||
public string carry_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string? carry_code { get; set; }
|
||||
public string carry_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
public string material_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品编号
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
public string material_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 齐套搭配方案ID
|
||||
/// </summary>
|
||||
public string? collocation_scheme_id { get; set; }
|
||||
public string collocation_scheme_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 齐套搭配方案编号
|
||||
@@ -74,7 +74,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
/// </summary>
|
||||
public string? source_id { get; set; }
|
||||
public string source_id { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -85,12 +85,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 创建用户ID
|
||||
/// </summary>
|
||||
public string? create_id { get; set; }
|
||||
public string create_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// MES齐套出库明细表输入
|
||||
/// </summary>
|
||||
public List<MESKittingOutStkDInput>? wmsKittingoutDs { get; set; }
|
||||
public List<MESKittingOutStkDInput> wmsKittingoutDs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -108,33 +108,33 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// <summary>
|
||||
/// 单位编号
|
||||
/// </summary>
|
||||
public string? unit_code { get; set; }
|
||||
public string unit_code { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 产品ID
|
||||
/// </summary>
|
||||
public string? material_id { get; set; }
|
||||
public string material_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 产品编号
|
||||
/// </summary>
|
||||
public string? material_code { get; set; }
|
||||
public string material_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
/// </summary>
|
||||
public string? code_batch { get; set; }
|
||||
public string code_batch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数量(件数)
|
||||
/// </summary>
|
||||
public decimal? pr_qty { get; set; }
|
||||
public decimal pr_qty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 箱数
|
||||
/// </summary>
|
||||
public int? box { get; set; }
|
||||
public int box { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task<dynamic> MESCarryQuery(MESCarryQueryInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
var results = new List<CarryQueryOutput>();
|
||||
var data = new List<CarryQueryOutput>();
|
||||
try
|
||||
{
|
||||
var carrys = await _db.Queryable<WmsCarryH>()
|
||||
@@ -44,7 +44,7 @@ namespace Tnb.WarehouseMgr
|
||||
.Where((a, b) => a.carry_code.Contains(input.carry_code) || b.bill_name.Contains(input.collocation_scheme_name))
|
||||
.ToListAsync();
|
||||
|
||||
results = carrys.Adapt<List<CarryQueryOutput>>();
|
||||
data = carrys.Adapt<List<CarryQueryOutput>>();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -52,7 +52,7 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
return ToApiResult(results);
|
||||
return ToApiResult(data);
|
||||
}
|
||||
/// <summary>
|
||||
/// 载具查询返回接口
|
||||
@@ -64,13 +64,13 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task<dynamic> MESCarryQueryResult(MESCarryQueryResultInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
var result = new CarryQueryOutput();
|
||||
var data = new CarryQueryOutput();
|
||||
try
|
||||
{
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.carry_code == input.carry_code);
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carry.id).ToListAsync();
|
||||
result = carry.Adapt<CarryQueryOutput>();
|
||||
result.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||
data = carry.Adapt<CarryQueryOutput>();
|
||||
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -78,7 +78,7 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
return ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, result);
|
||||
return ToApiResult(JNPF.Common.Enums.HttpStatusCode.OK, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,10 +92,10 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task<dynamic> MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input)
|
||||
{
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
var results = new List<CollocationSchemeOutput>();
|
||||
var data = new List<CollocationSchemeOutput>();
|
||||
try
|
||||
{
|
||||
results = await _db.Queryable<WmsCollocationSchemeH>()
|
||||
data = await _db.Queryable<WmsCollocationSchemeH>()
|
||||
.Where(a => a.material_id == input.material_id)
|
||||
.Select(a => new CollocationSchemeOutput
|
||||
{
|
||||
@@ -108,7 +108,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message);
|
||||
}
|
||||
return await ToApiResult(results);
|
||||
return await ToApiResult(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,10 +87,10 @@ namespace Tnb.WarehouseMgr
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
else
|
||||
{
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
@@ -153,6 +153,10 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("起始库位不可用或无可用的目标库位",500);
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
|
||||
@@ -89,25 +89,23 @@ namespace Tnb.WarehouseMgr
|
||||
WmsPointH? ePoint = null;
|
||||
if (input.data.ContainsKey(nameof(WmsPointH.location_id)))
|
||||
{
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString());
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString() && it.is_lock == 0);
|
||||
}
|
||||
int i = 0;
|
||||
|
||||
|
||||
//根据每个载具的起始库位做路径运算
|
||||
for (i = 0; i < setQty.qty; i++)
|
||||
for (int i = 0; i < setQty.qty; i++)
|
||||
{
|
||||
|
||||
if (carrys?.Count > 0)
|
||||
{
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carrys[i].location_id);
|
||||
}
|
||||
var isOk = false;
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
//根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序)
|
||||
if (points?.Count > 0)
|
||||
else
|
||||
{
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
@@ -142,7 +140,6 @@ namespace Tnb.WarehouseMgr
|
||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||
}
|
||||
isOk = await _wareHouseService.GenPreTask(preTasks, null!);
|
||||
|
||||
}
|
||||
if (isOk)
|
||||
{
|
||||
@@ -174,6 +171,10 @@ namespace Tnb.WarehouseMgr
|
||||
it => new BasLocation { is_lock = 1 });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("无可出库的空载具或目标库位不存在或者目标库位被锁", 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -226,24 +227,24 @@ namespace Tnb.WarehouseMgr
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
try
|
||||
{
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
|
||||
var dic = new Dictionary<string, object>();
|
||||
dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId();
|
||||
dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id;
|
||||
dic[nameof(WmsEmptyOutstockH.location_id)] = location.id;
|
||||
dic[nameof(WmsEmptyOutstockH.carrystd_id)] = input.carrystd_id;
|
||||
dic[nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult();
|
||||
dic[nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
dic[nameof(WmsEmptyOutstockH.qty)] = input.qty;
|
||||
dic[nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
dic[nameof(WmsEmptyOutstockH.create_id)] = input.create_id;
|
||||
dic[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now;
|
||||
var location = await _db.Queryable<BasLocation>().SingleAsync(it => it.location_code == input.location_code);
|
||||
var dic = new Dictionary<string, object>();
|
||||
dic[nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId();
|
||||
dic[nameof(WmsEmptyOutstockH.org_id)] = input.org_id;
|
||||
dic[nameof(WmsEmptyOutstockH.location_id)] = location.id;
|
||||
dic[nameof(WmsEmptyOutstockH.carrystd_id)] = input.carrystd_id;
|
||||
dic[nameof(WmsEmptyOutstockH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYOUTSTK_ENCODE).GetAwaiter().GetResult();
|
||||
dic[nameof(WmsEmptyOutstockH.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID;
|
||||
dic[nameof(WmsEmptyOutstockH.qty)] = input.qty;
|
||||
dic[nameof(WmsEmptyOutstockH.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEPTYOUTSTK_ID;
|
||||
dic[nameof(WmsEmptyOutstockH.create_id)] = input.create_id;
|
||||
dic[nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now;
|
||||
|
||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput
|
||||
{
|
||||
data = dic,
|
||||
};
|
||||
await PDAWmsEmptyOut(visualDevModelDataCrInput);
|
||||
VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput
|
||||
{
|
||||
data = dic,
|
||||
};
|
||||
await PDAWmsEmptyOut(visualDevModelDataCrInput);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -132,71 +132,85 @@ namespace Tnb.WarehouseMgr
|
||||
public async Task KittingOutByIsToBeShipped()
|
||||
{
|
||||
|
||||
var kittingOuts = await _db.Queryable<WmsKittingoutH>()
|
||||
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
||||
.OrderBy(a => a.seq)
|
||||
.ToListAsync();
|
||||
if (kittingOuts?.Count > 0)
|
||||
try
|
||||
{
|
||||
var grpList = kittingOuts.GroupBy(g => g.location_id).ToList();
|
||||
foreach (var koGrp in grpList)
|
||||
var kittingOuts = await _db.Queryable<WmsKittingoutH>()
|
||||
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID)
|
||||
.OrderBy(a => a.seq)
|
||||
.ToListAsync();
|
||||
if (kittingOuts?.Count > 0)
|
||||
{
|
||||
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync();
|
||||
if (locs?.Count > 0)
|
||||
var grpList = kittingOuts.GroupBy(g => g.location_id).ToList();
|
||||
foreach (var koGrp in grpList)
|
||||
{
|
||||
|
||||
var arr = koGrp.ToArray();
|
||||
var ko = arr[^arr.Length];
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||
if (carry != null)
|
||||
var locs = await _db.Queryable<BasLocation>().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync();
|
||||
if (locs?.Count > 0)
|
||||
{
|
||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
||||
if (sPoint != null && ePoint != null)
|
||||
var arr = koGrp.ToArray();
|
||||
var ko = arr[^arr.Length];
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||
if (carry != null)
|
||||
{
|
||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points?.Count > 0)
|
||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
if (points?.Count > 0)
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it =>
|
||||
{
|
||||
var sPoint = it.FirstOrDefault();
|
||||
var ePoint = it.LastOrDefault();
|
||||
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id!;
|
||||
preTask.startlocation_code = sPoint?.location_code!;
|
||||
preTask.endlocation_id = ePoint?.location_id!;
|
||||
preTask.endlocation_code = ePoint?.location_code!;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = ko.biz_type;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
preTask.carry_id = ko!.carry_id!;
|
||||
preTask.carry_code = ko!.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = ko.id;
|
||||
preTask.require_code = ko.bill_code;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
await _warehouseService.GenPreTask(preTasks, null!);
|
||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
||||
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
||||
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds!, LocationIds = new List<string> { carry.location_id!, ko.location_id! } };
|
||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
||||
WmsPretaskH preTask = new();
|
||||
preTask.org_id = _userManager.User.OrganizeId;
|
||||
preTask.startlocation_id = sPoint?.location_id!;
|
||||
preTask.startlocation_code = sPoint?.location_code!;
|
||||
preTask.endlocation_id = ePoint?.location_id!;
|
||||
preTask.endlocation_code = ePoint?.location_code!;
|
||||
preTask.start_floor = sPoint?.floor.ToString();
|
||||
preTask.end_floor = ePoint?.floor.ToString();
|
||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||
preTask.biz_type = ko.biz_type;
|
||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||
preTask.carry_id = ko!.carry_id!;
|
||||
preTask.carry_code = ko!.carry_code!;
|
||||
preTask.area_id = sPoint?.area_id!;
|
||||
preTask.area_code = it.Key;
|
||||
preTask.require_id = ko.id;
|
||||
preTask.require_code = ko.bill_code;
|
||||
preTask.create_id = _userManager.UserId;
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
await _warehouseService.GenPreTask(preTasks, null!);
|
||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
||||
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
||||
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds!, LocationIds = new List<string> { carry.location_id!, ko.location_id! } };
|
||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("无可用的载具", 500);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException("无可用的库位", 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
|
||||
64
taskschedule/Tnb.TaskScheduler/Listener/QcTaskTimeWorker.cs
Normal file
64
taskschedule/Tnb.TaskScheduler/Listener/QcTaskTimeWorker.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using JNPF.TaskScheduler.Entitys;
|
||||
using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Entities.Entity;
|
||||
using TimeTaskEntity = JNPF.TaskScheduler.Entitys.TimeTaskEntity;
|
||||
|
||||
namespace Tnb.TaskScheduler.Listener
|
||||
{
|
||||
/// <summary>
|
||||
/// 生成质检任务
|
||||
/// </summary>
|
||||
public class QcTaskTimeWorker : ISpareTimeWorker
|
||||
{
|
||||
private ISqlSugarRepository<QcCheckPlanH> repository => App.GetService<ISqlSugarRepository<QcCheckPlanH>>();
|
||||
[SpareTime("0 0 0 * * ?", "生成质检任务", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)]
|
||||
public async void CreateTask(SpareTimer timer, long count)
|
||||
{
|
||||
var timeTaskEntity = await repository.AsSugarClient().Queryable<TimeTaskEntity>().Where(p => p.Id == timer.WorkerName).FirstAsync();
|
||||
if (timeTaskEntity == null)
|
||||
return;
|
||||
var PlanH = await repository.AsQueryable().Where(p => p.id == timeTaskEntity.Description).FirstAsync();
|
||||
var PlanDs = await repository.AsSugarClient().Queryable<QcCheckPlanD>().Where(p => p.mainid == timeTaskEntity.Description).ToListAsync();
|
||||
if (PlanH == null || PlanDs.Count == 0)
|
||||
return;
|
||||
var DictionaryType = await repository.AsSugarClient().Queryable<DictionaryTypeEntity>().Where(p => p.FullName == "质检状态").FirstAsync();
|
||||
var DictionaryData = await repository.AsSugarClient().Queryable<DictionaryDataEntity>().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync();
|
||||
QcCheckExecH qcCheckExecH = new QcCheckExecH();
|
||||
qcCheckExecH.id = SnowflakeIdHelper.NextId();
|
||||
qcCheckExecH.checktype = PlanH.checktype;
|
||||
qcCheckExecH.status = DictionaryData.Id;
|
||||
qcCheckExecH.tasktime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
var ExecDs = new List<QcCheckExecD>();
|
||||
foreach (var PlanD in PlanDs)
|
||||
{
|
||||
QcCheckExecD QcCheckExecD = new QcCheckExecD();
|
||||
QcCheckExecD.mainid = qcCheckExecH.id;
|
||||
QcCheckExecD.extype = PlanD.extype;
|
||||
QcCheckExecD.excontent = PlanD.excontent;
|
||||
QcCheckExecD.check = PlanD.check;
|
||||
QcCheckExecD.errorcause = PlanD.errorcause;
|
||||
QcCheckExecD.errorlevel = PlanD.errorlevel;
|
||||
QcCheckExecD.remark = PlanD.remark;
|
||||
QcCheckExecD.attachment = PlanD.attachment;
|
||||
QcCheckExecD.isexec = PlanD.isexec;
|
||||
QcCheckExecD.custom = PlanD.custom;
|
||||
QcCheckExecD.typeid = PlanD.typeid;
|
||||
QcCheckExecD.itemid = PlanD.itemid;
|
||||
ExecDs.Add(QcCheckExecD);
|
||||
}
|
||||
await repository.AsSugarClient().Insertable(qcCheckExecH).ExecuteCommandAsync();
|
||||
await repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
<ProjectReference Include="..\..\common\Tnb.Common.Core\Tnb.Common.Core.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Entities\Tnb.EquipMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message\Tnb.Message.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr.Entities\Tnb.QcMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\system\Tnb.Systems.Interfaces\Tnb.Systems.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\Tnb.TaskScheduler.Interfaces\Tnb.TaskScheduler.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user