From 1e21885da5a3257a4e22e69f591fce20380d90ed Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Tue, 1 Aug 2023 17:04:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AEid=E8=8E=B7=E5=8F=96=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E6=89=A9=E5=B1=95=E5=B1=9E=E6=80=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 34 +++++------ .../Permission/DepartmentService.cs | 59 ++++++++++++++++++- 2 files changed, 75 insertions(+), 18 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index ab218734..a1bdb730 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1041,23 +1041,23 @@ namespace Tnb.ProductionMgr var list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync(); if (behavior == PrdTaskBehavior.Compled) { - if (list?.Count > 0) - { - // var schedQtySum = list.Sum(x => x.scheduled_qty); - // var planQtySum = list.Sum(x => x.plan_qty); - // if (schedQtySum < planQtySum) - // { - // throw new AppFriendlyException("任务数量必须大于等于生产计划数量,才可完成", 500); - // } - - int reportedWorkQty = list.Sum(x => x.reported_work_qty) ?? 0; - int scrapQty = list.Sum(x => x.scrap_qty) ?? 0; - int scheduledQty = list.Sum(x => x.scheduled_qty) ?? 0; - if (scheduledQty >= reportedWorkQty+scrapQty) - { - throw new AppFriendlyException("已完成数量大于等于任务单数量,才可完成", 500); - } - } + // if (list?.Count > 0) + // { + // // var schedQtySum = list.Sum(x => x.scheduled_qty); + // // var planQtySum = list.Sum(x => x.plan_qty); + // // if (schedQtySum < planQtySum) + // // { + // // throw new AppFriendlyException("任务数量必须大于等于生产计划数量,才可完成", 500); + // // } + // + // int reportedWorkQty = list.Sum(x => x.last_process_complete_qty) ?? 0; + // int scrapQty = list.Sum(x => x.scrap_qty) ?? 0; + // int scheduledQty = list.Sum(x => x.scheduled_qty) ?? 0; + // if (scheduledQty >= reportedWorkQty+scrapQty) + // { + // throw new AppFriendlyException("已完成数量大于等于任务单数量,才可完成", 500); + // } + // } } var taskReportLogs = new List(); diff --git a/system/Tnb.Systems/Permission/DepartmentService.cs b/system/Tnb.Systems/Permission/DepartmentService.cs index 17b56670..86abdfd4 100644 --- a/system/Tnb.Systems/Permission/DepartmentService.cs +++ b/system/Tnb.Systems/Permission/DepartmentService.cs @@ -1,10 +1,12 @@ -using Aop.Api.Domain; +using System.Collections; +using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; +using JNPF.Extras.CollectiveOAuth.Models; using JNPF.FriendlyException; using JNPF.Logging; using JNPF.Systems.Entitys.Dto.Department; @@ -609,6 +611,61 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra if (!(isOk > 0)) throw Oops.Oh(ErrorCode.D2016); } + /// + /// 根据id获取组织扩展属性 + /// + /// + /// + /// + [HttpPost] + public async Task GetFpropertyjsonById(Dictionary dic) + { + string id = dic["id"]; + string type = dic["type"]; + var organizeEntity = await _repository.GetSingleAsync(x => x.Id == id); + if (organizeEntity != null && !string.IsNullOrEmpty(organizeEntity.PropertyJson)) + { + Dictionary dictionary = + JsonConvert.DeserializeObject>(organizeEntity.PropertyJson); + if (type == "1") + { + if (dictionary.TryGetValue("roweqp", out var value)) + { + List eqpEquipments = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(value)); + return new AuthResponse(200, "", new Dictionary() + { + ["list"] = eqpEquipments.Select(x=>new + { + id = x.id, + code = x.code, + name = x.name + }).ToList(), + }); + } + } + else + { + if (dictionary.TryGetValue("rowprocess", out var value)) + { + List eqpEquipments = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(value)); + return new AuthResponse(200, "", new Dictionary() + { + ["list"] = eqpEquipments.Select(x=>new + { + id = x.id, + code = x.process_code, + name = x.process_name + }).ToList(), + }); + } + } + } + return new AuthResponse(200, "", new Dictionary() + { + ["list"] = Enumerable.Empty() + }); + } + #endregion #region PublicMethod