diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs index 5d32519b..99c5bcb4 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs @@ -14,5 +14,22 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 生产任务编号 /// public string mo_task_code { get; set; } + /// + /// 开始时间 + /// + public long[] estimated_start_date { get; set; } + /// + /// 结束时间 + /// + public long[] estimated_end_date { get; set; } + + /// + /// 产线 + /// + public string workline { get; set; } + /// + /// 工序 + /// + public string process { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 8d34e4f0..79fe64ea 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1070,8 +1070,7 @@ namespace Tnb.ProductionMgr record.masterial_name = material?.name; record.plan_start_date = taskInfo.estimated_start_date; record.plan_end_date = taskInfo.estimated_end_date; - // record.plan_qty = taskInfo.plan_qty; - record.plan_qty = taskInfo.scheduled_qty; + record.plan_qty = taskInfo.plan_qty; record.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskInfo.eqp_id))?.code; record.mo_task_type = mo?.mo_type; record.status = taskInfo.mo_task_status; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 7b3d309c..0699bd34 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -51,14 +51,35 @@ namespace Tnb.ProductionMgr if (input == null) throw new ArgumentNullException("input"); List trees = new(); var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + var list = await _db.Queryable().Where(it => it.Category == "workline").ToListAsync(); if (_dicWorkLine.Count < 1) { - var list = await _db.Queryable().Where(it => it.Category == "workline").ToListAsync(); + _dicWorkLine = list.ToDictionary(x => x.Id, x => Tuple.Create(x.EnCode, x.FullName)); } + bool start = false; + bool end=false; + DateTime[] startTimes = new DateTime[2]; + DateTime[] endTimes = new DateTime[2]; + if (input.estimated_start_date != null && input.estimated_start_date.Count() == 2) + { + start=true; + startTimes[0] = GetDateTimeMilliseconds(input.estimated_start_date![0]); + startTimes[1] = GetDateTimeMilliseconds(input.estimated_start_date![1]); + } + if (input.estimated_end_date != null && input.estimated_end_date.Count() == 2) + { + end = true; + endTimes[0] = GetDateTimeMilliseconds(input.estimated_end_date![0]); + endTimes[1] = GetDateTimeMilliseconds(input.estimated_end_date![1]); + + } var items = await _db.Queryable().LeftJoin((a, b) => a.process_id == b.id).LeftJoin((a, b, c) => a.mo_id == c.id) .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim()) + .WhereIF(start, a => startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date) + .WhereIF(end, a => endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date) + .WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!)) .Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled") .Select((a, b, c) => new PrdMoTask { @@ -101,6 +122,23 @@ namespace Tnb.ProductionMgr } } var treeList = trees.ToTree(); + if (!string.IsNullOrEmpty(input.process)) + { + foreach (var item in treeList) + { + bool flag = false; + if (item.process_id != null && item.process_id.Contains(input.process)) + flag = true; + if (item.children != null) + { + List childs = (List)(Object)item.children; + if (childs.Where(p => p.process_id.Contains(input.process)).Any()) + flag = true; + } + if (!flag) + treeList.Remove(item); + } + } SqlSugarPagedList pagedList = new() { list = treeList, @@ -113,15 +151,24 @@ namespace Tnb.ProductionMgr }; return PageResult.SqlSugarPageResult(pagedList); } + private static DateTime GetDateTimeMilliseconds(long timestamp) + { + long begtime = timestamp * 10000; + DateTime dt_1970 = new DateTime(1970, 1, 1, 8, 0, 0); + long tricks_1970 = dt_1970.Ticks;//1970年1月1日刻度 + long time_tricks = tricks_1970 + begtime;//日志日期刻度 + DateTime dt = new DateTime(time_tricks);//转化为DateTime + return dt; + } private async Task GetChild(string parentId, List nodes, Dictionary dic) { var items = await _db.Queryable() .LeftJoin((a, b) => a.process_id == b.id) .LeftJoin((a, b, c) => a.mo_id == c.id) - .LeftJoin((a,b,c,d)=>a.mbom_process_id==d.id) + .LeftJoin((a, b, c, d) => a.mbom_process_id == d.id) .Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled") - .OrderBy((a,b,c,d)=>d.ordinal) + .OrderBy((a, b, c, d) => d.ordinal) .Select((a, b, c) => new PrdMoTask { id = a.id, @@ -134,7 +181,7 @@ namespace Tnb.ProductionMgr plan_end_date = a.estimated_end_date, plan_qty = c.scheduled_qty, //complete_qty = SqlFunc.Subqueryable().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty), - complete_qty = a.reported_work_qty+a.scrap_qty, + complete_qty = a.reported_work_qty + a.scrap_qty, mo_task_status = a.mo_task_status, }).ToListAsync(); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs index 1ad7ad01..2bb31058 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs @@ -278,7 +278,6 @@ namespace Tnb.ProductionMgr // reported_qty = a.reported_qty, // prd_qty = a.prd_qty, eqp_code = d.code, - mbom_process_id = a.mbom_process_id, }).FirstAsync(); return prdTask; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs index 75ddcae5..f41c5f38 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs @@ -18,10 +18,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 载具ID /// - public string carryId { get; set; } - /// - /// 服务模块 - /// - public string serviceModule { get; set; } + public string carryId { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs index 94df7398..fcd567dd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs @@ -1,6 +1,7 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; +using SqlSugar.DbConvert; namespace Tnb.WarehouseMgr.Entities; @@ -42,7 +43,9 @@ public partial class WmsCarryH : BaseEntity /// /// 载具状态 /// - public string carry_status { get; set; } + /// + [SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))] + public int carry_status { get; set; } /// /// 载具分类ID diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs index cf9870e0..9bbbc560 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs @@ -13,5 +13,5 @@ public partial class WmsDistaskH /// 载具状态 /// [SugarColumn(IsIgnore = true)] - public string carry_status { get; set; } + public int carry_status { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs index bba6c031..cdc69402 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsFeedingrecordCode.cs @@ -94,9 +94,4 @@ public partial class WmsFeedingrecordCode : BaseEntity /// public DateTime? modify_time { get; set; } - /// - /// 行号 - /// - public int no { get; set; } - } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 9eeb99b1..c8390c52 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -446,11 +446,11 @@ namespace Tnb.WarehouseMgr for (int i = 0; i < multis.Count; i++) { var carryStatus = multis[i].carry_status; - if (multis[i].carry_status == "0") + if (multis[i].carry_status == (int)EnumCarryStatus.空闲) { - carryStatus = "1"; + carryStatus = (int)EnumCarryStatus.空闲; } - await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); + await _db.Updateable().SetColumns(it => new BasLocation { is_use = carryStatus.ToString(), is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync(); } //更新业务主表的单据状态 if (disTasks?.Count > 0) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 377f2f6d..006c31e9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -69,9 +70,9 @@ namespace Tnb.WarehouseMgr var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); if (carry != null && subCarry != null) { - carry.carry_status = "1"; + carry.carry_status = (int)EnumCarryStatus.占用; var row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "1"; + subCarry.carry_status = (int)EnumCarryStatus.占用; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); //更新载具明细表 WmsCarryD wmsCarryD = new() diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index 2596f2f4..8945d77a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -160,7 +160,7 @@ namespace Tnb.WarehouseMgr try { carryObj.status = 0; - carryObj.carry_status = "0"; + carryObj.carry_status = (int)EnumCarryStatus.空闲; carryObj.location_id = null; carryObj.location_code = null; carryObj.out_status = "0"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs index 739d972f..1bdd4499 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -91,9 +92,9 @@ namespace Tnb.WarehouseMgr wmsCarryUnbindCode.create_time = DateTime.Now; row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync(); } - carry.carry_status = "0"; + carry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "0"; + subCarry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs index 94c43365..5066db04 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs @@ -158,7 +158,7 @@ namespace Tnb.WarehouseMgr var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); { //载具加锁,增加库位信息 - await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), + await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code}).Where(it => it.id == input.data[nameof(WmsDelivery.carry_id)].ToString()).ExecuteCommandAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index d6beff87..fe5418ca 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -78,7 +78,7 @@ namespace Tnb.WarehouseMgr var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id) .Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString() - && a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0) + && a.carry_status == (int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0) .ToListAsync(); WmsPointH sPoint = null; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index a216fa8c..52078432 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -81,20 +81,36 @@ namespace Tnb.WarehouseMgr List carryCodes = new(); foreach (var os in outStockDList) { - var carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id) - .Where((a, b) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用) + var carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) + .Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.is_type == ((int)EnumLocationType.存储库位).ToString()) .WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch) .Select() .ToListAsync(); if (carryCodesPart?.Count > 0) { + carryCodes.AddRange(carryCodesPart); var codeQty = carryCodes.Sum(x => x.codeqty); if (codeQty < os.pr_qty) { throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500); } - var partCarryMats = carryCodesPart.Adapt>(); + List curCarryCodes = new(); + for (int i = 0; i < carryCodesPart.Count; i++) + { + if (os.pr_qty > carryCodesPart[i].codeqty) + { + os.pr_qty -= carryCodesPart[i].codeqty; + curCarryCodes.Add(carryCodesPart[i]); + } + else if (os.pr_qty <= carryCodesPart[i].codeqty) + { + carryCodesPart[i].codeqty = os.pr_qty; + curCarryCodes.Add(carryCodesPart[i]); + break; + } + } + var partCarryMats = curCarryCodes.Adapt>(); for (int i = 0; i < partCarryMats.Count; i++) { partCarryMats[i].need_qty = carryCodesPart[i].codeqty; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index eecedd09..657c232a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -83,9 +84,9 @@ namespace Tnb.WarehouseMgr create_time = DateTime.Now }; var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync(); - carry.carry_status = "1"; + carry.carry_status = (int)EnumCarryStatus.占用; row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "1"; + subCarry.carry_status = (int)EnumCarryStatus.占用; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); //更新载具绑定条码表 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs index 37b39ebf..6652b476 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs @@ -22,6 +22,7 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -90,9 +91,9 @@ namespace Tnb.WarehouseMgr wmsCarryUnbindCode.create_time = DateTime.Now; row = await _db.Insertable(wmsCarryUnbindCode).ExecuteCommandAsync(); } - carry.carry_status = "0"; + carry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(carry).ExecuteCommandAsync(); - subCarry.carry_status = "0"; + subCarry.carry_status = (int)EnumCarryStatus.空闲; row = await _db.Updateable(subCarry).ExecuteCommandAsync(); isOk = (row > 0); if (!isOk) throw Oops.Oh(ErrorCode.COM1001); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs index 2ecb1828..3b44dd0b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs @@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr //载具加锁,增加库位信息 await _db.Updateable().SetColumns(it => new WmsCarryH { - carry_status = ((int)EnumCarryStatus.占用).ToString(), + carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsDelivery.startlocation_id)].ToString(), location_code = location.location_code diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index 0f4dbfda..ba1ace87 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -75,7 +75,7 @@ namespace Tnb.WarehouseMgr var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); var carrys = await _db.Queryable().LeftJoin((a, b) => a.location_id == b.id) .Where((a, b) => a.carrystd_id == input.data[nameof(WmsEmptyOutstockH.carrystd_id)].ToString() - && a.carry_status == "0" && a.is_lock == 0 && b.is_lock == 0) + && a.carry_status ==(int)EnumCarryStatus.空闲 && a.is_lock == 0 && b.is_lock == 0) .ToListAsync(); WmsPointH sPoint = null; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs index e424978f..5143677d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs @@ -61,10 +61,9 @@ namespace Tnb.WarehouseMgr /// /// /// + private async Task WmsPDAFeedingRecord(VisualDevModelDataCrInput input) { - - var isOk = false; try { @@ -79,7 +78,7 @@ namespace Tnb.WarehouseMgr var feedBox = await _db.Queryable().SingleAsync(it => it.feedbox_code == feedBoxCode); var carryMaterial = await _db.Queryable().FirstAsync(it => it.carry_id == carryId); var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); - if (carry != null && feedBox != null) + if (carryMaterial != null && feedBox != null && carry != null) { //更新投料箱 feedBox.material_id = carryMaterial.material_id; @@ -97,27 +96,6 @@ namespace Tnb.WarehouseMgr it.modify_id, it.modify_time }).ExecuteCommandAsync(); - //更新投料记录条码表 - if (carryCodes != null) - { - foreach (var carryCode in carryCodes) - { - WmsFeedingrecordCode wmsFeedingrecordCode = new(); - wmsFeedingrecordCode.id = SnowflakeIdHelper.NextId(); - wmsFeedingrecordCode.org_id = _userManager.User.OrganizeId; - wmsFeedingrecordCode.record_id = input.data["ReturnIdentity"]?.ToString()!; - wmsFeedingrecordCode.material_id = carryCode.material_id; - wmsFeedingrecordCode.material_code = carryCode.material_code; - wmsFeedingrecordCode.barcode = carryCode.barcode; - wmsFeedingrecordCode.code_batch = carryCode.code_batch; - wmsFeedingrecordCode.codeqty = carryCode.codeqty; - wmsFeedingrecordCode.unit_id = carryCode.unit_id; - wmsFeedingrecordCode.unit_code = carryCode.unit_code; - wmsFeedingrecordCode.create_id = _userManager.UserId; - wmsFeedingrecordCode.create_time = DateTime.Now; - row = await _db.Insertable(wmsFeedingrecordCode).ExecuteCommandAsync(); - } - } //更新载具 row = await UpdateNullCarry(carry); isOk = (row > 0); @@ -125,7 +103,7 @@ namespace Tnb.WarehouseMgr } else { - if (carry == null) + if (carryMaterial == null) { throw new AppFriendlyException("没有可用的载具", 500); } @@ -139,7 +117,7 @@ namespace Tnb.WarehouseMgr } catch (Exception ex) { - Log.Error("载具更换失败", ex); + Log.Error("投料失败", ex); await _db.Ado.RollbackTranAsync(); throw; } @@ -152,7 +130,7 @@ namespace Tnb.WarehouseMgr try { carryObj.status = 0; - carryObj.carry_status = "0"; + carryObj.carry_status = (int)EnumCarryStatus.空闲; carryObj.location_id = null; carryObj.location_code = null; carryObj.out_status = "0"; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index fa06b6d5..f091e3fe 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -239,7 +239,7 @@ namespace Tnb.WarehouseMgr await _db.Insertable(carryCodes).ExecuteCommandAsync(); await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, - it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, + it => new WmsCarryH { carry_code = input.data[nameof(WmsCarryH.carry_code)].ToString()!, is_lock = 1, carry_status = (int)EnumCarryStatus.占用, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, it => new BasLocation { is_lock = 1, is_use = "1" }); if (instockCOdes?.Count > 0) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs index 54c69b7b..89027139 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs @@ -145,7 +145,7 @@ namespace Tnb.WarehouseMgr var baleNum = input.data[nameof(WmsCarryH.bale_num)]?.ToString(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, - it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = ((int)EnumCarryStatus.寄存).ToString(), bale_num = baleNum }, + it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode, carry_status = (int)EnumCarryStatus.寄存, bale_num = baleNum }, it => new BasLocation { is_lock = 1 }); //((int)EnumCarryStatus.寄存).ToString() } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs index 44c4981a..259fa4e2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs @@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr //载具加锁,增加库位信息 await _db.Updateable().SetColumns(it => new WmsCarryH { - carry_status = ((int)EnumCarryStatus.占用).ToString(), + carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(), location_code = location.location_code diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index bd13a658..7bc941a4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -124,7 +124,7 @@ namespace Tnb.WarehouseMgr GenPreTaskUpInput genPreTaskAfterUpInput = new(); genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); - await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); + await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套分拣 }, it => new BasLocation { is_use = ((int)EnumCarryStatus.齐套分拣).ToString() }); } } @@ -185,5 +185,13 @@ namespace Tnb.WarehouseMgr } } + + public override Task ModifyAsync(WareHouseUpInput input) + { + return Task.CompletedTask; + + } + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index 9242aa8d..43d8af9d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -15,6 +15,7 @@ using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; +using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; @@ -57,29 +58,43 @@ namespace Tnb.WarehouseMgr { _dicBizType = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_BIZTYPE_ID); } - var carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId); - if (carry != null) + try { - var disTask = await _db.Queryable().SingleAsync(it => it.id == input.disTaskId); - if (disTask != null) + await _db.Ado.BeginTranAsync(); + + var carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId); + if (carry != null) { - if (_dicBizType.ContainsKey(disTask.biz_type)) + var disTask = await _db.Queryable().SingleAsync(it => it.id == input.disTaskId); + if (disTask != null) { - switch (_dicBizType[disTask.biz_type]) + if (_dicBizType.ContainsKey(disTask.biz_type)) { - case "空载具出库": - case "寄存出库": - case "齐套出库": - case "一般出库": - await _wareCarryService.UpdateNullCarry(carry); - break; + switch (_dicBizType[disTask.biz_type]) + { + case "空载具出库": + case "寄存出库": + case "齐套出库": + case "一般出库": + await _wareCarryService.UpdateNullCarry(carry); + break; + } } } + var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); + loc.is_use = "0"; + await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); } - var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); - loc.is_use = "0"; - await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); + + await _db.Ado.CommitTranAsync(); + } + catch (Exception) + { + await _db.Ado.RollbackTranAsync(); + throw; } } + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs index 2ce0a3c7..20f2935c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs @@ -122,7 +122,7 @@ namespace Tnb.WarehouseMgr //载具加锁,增加库位信息 await _db.Updateable().SetColumns(it => new WmsCarryH { - carry_status = ((int)EnumCarryStatus.占用).ToString(), + carry_status = (int)EnumCarryStatus.占用, is_lock = 1, location_id = input.data[nameof(WmsTransfer.startlocation_id)].ToString(), location_code = location.location_code diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 439a7bad..3c2e978e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -176,7 +176,7 @@ namespace Tnb.WarehouseMgr var subCarrys = await _db.Queryable().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 { 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 }); + await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = (int)EnumCarryStatus.齐套 }, it => new BasLocation { is_lock = 1 }); } }