From aad4888c14dadaa24d4810e1e9e4333ff7ca0689 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 6 Nov 2023 10:08:32 +0800 Subject: [PATCH 01/10] =?UTF-8?q?=E4=B8=80=E8=88=AC=E5=87=BA=E5=BA=93?= =?UTF-8?q?=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/DictConst.cs | 10 ++ .../Dto/PrdManage/GeneralOutstockInput.cs | 29 +++++ .../Entity/PrdOutstockD.cs | 2 +- .../IPrdOutstockService.cs | 8 +- .../Tnb.ProductionMgr/PrdOutstockService.cs | 122 +++++++++++++++++- 5 files changed, 168 insertions(+), 3 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs index da84b4d4..69611399 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs @@ -169,6 +169,16 @@ public static class DictConst /// public const string CHANCHENGPINRUKUDAN = "40"; + /// + /// 生产领料单 + /// + public const string SHENGCHANLINGLIAO = "23"; + + /// + /// 生产补料单 + /// + public const string SHENGCHANBULIAO = "24"; + #endregion diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs new file mode 100644 index 00000000..79368c6f --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs @@ -0,0 +1,29 @@ +namespace Tnb.ProductionMgr.Entities.Dto +{ + public class GeneralOutstockInput + { + /// + /// 目标库位编号 + /// + public string location_code { get; set; } = string.Empty; + + /// 所属工位 + /// + public string? workstation_id { get; set; } + + /// + /// 任务单 + /// + public string? mo_task_id { get; set; } + + public List details { get; set; } = new List(); + } + + public class GeneralOutstockDInput + { + public string material_id { get; set; } + public string material_code { get; set; } + public string material_name { get; set; } + public decimal num { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockD.cs index 960834c6..86c1328a 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockD.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOutstockD.cs @@ -32,7 +32,7 @@ public partial class PrdOutstockD : BaseEntity /// /// 出库需求数量 /// - public string? pr_qty { get; set; } + public decimal? pr_qty { get; set; } /// /// 来源单据id diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdOutstockService.cs index 3d8bed0f..0a669e72 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdOutstockService.cs @@ -1,3 +1,5 @@ +using Tnb.ProductionMgr.Entities.Dto; + namespace Tnb.ProductionMgr.Interfaces { /// @@ -5,6 +7,10 @@ namespace Tnb.ProductionMgr.Interfaces /// public interface IPrdOutstockService { - + /// + /// 一般出库申请 + /// + /// + public Task GeneralOutstock(GeneralOutstockInput input); } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index fef2d924..da415616 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -7,6 +7,9 @@ using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; using JNPF.FriendlyException; using JNPF.Logging; +using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; @@ -14,10 +17,12 @@ using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using Spire.Pdf.Exporting.XPS.Schema; using SqlSugar; using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.ProductionMgr.Entities; +using Tnb.ProductionMgr.Entities.Dto; using Tnb.ProductionMgr.Interfaces; using Tnb.WarehouseMgr.Entities.Dto.Inputs; @@ -37,10 +42,11 @@ namespace Tnb.ProductionMgr private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; private readonly IDictionaryDataService _dictionaryDataService; + private readonly IOrganizeService _organizeService; private readonly IUserManager _userManager; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - public PrdOutstockService(ISqlSugarRepository repository, IRunService runService, IUserManager userManager,IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService) + public PrdOutstockService(ISqlSugarRepository repository, IOrganizeService organizeService,IRunService runService, IUserManager userManager,IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService) { _db = repository.AsSugarClient(); _runService = runService; @@ -48,6 +54,7 @@ namespace Tnb.ProductionMgr _dictionaryDataService = dictionaryDataService; _repository = repository; _userManager = userManager; + _organizeService = organizeService; OverideFuncs.CreateAsync = Create; } @@ -114,5 +121,118 @@ namespace Tnb.ProductionMgr } } + + public async Task GeneralOutstock(GeneralOutstockInput generalOutstockInput) + { + try + { + var db = _repository.AsSugarClient(); + string warehouse_id = "26103348825381";//二楼缓存仓 + + MESCreateOutstockInput input = new MESCreateOutstockInput(); + input.outstock = new MESWmsOutstockHInput(); + input.outstockDs = new List(); + + PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x=>x.id==generalOutstockInput.mo_task_id); + BasLocation location = await db.Queryable().Where(x=>x.location_code==generalOutstockInput.location_code).FirstAsync(); + if (location == null) throw Oops.Bah("未找到库位"); + string locationId = location.id; + + input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO; + // input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now; + input.outstock.bill_date = DateTime.Now; + input.outstock.org_id = _userManager.GetUserInfo().Result.organizeId; + input.outstock.warehouse_id = warehouse_id; + input.outstock.create_id = _userManager.UserId; + input.outstock.location_code = location?.location_code ?? ""; + OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); + + List materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList(); + Dictionary unitIdDic = await db.Queryable() + .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit) + .LeftJoin((a, b, c) => b.Id == c.DictionaryTypeId && a.unit_id == c.EnCode) + .Where((a,b,c)=>materialIds.Contains(a.id)) + .Select((a, b, c) => new + { + key = a.id, + value = c.Id + }) + .ToDictionaryAsync(x => x.key, x => x.value); + + foreach (var item in generalOutstockInput.details) + { + input.outstockDs.Add(new MESWmsOutstockDInput() + { + material_id = item.material_id, + material_code = item.material_code, + pr_qty = item.num, + unit_id = unitIdDic[item.material_id].ToString() + }); + } + + string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + Dictionary header = new Dictionary() + { + ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] + }; + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK,JsonConvert.SerializeObject(input),header); + Log.Information(sendResult); + + AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); + if (authResponse.code != 200) + { + throw Oops.Bah(authResponse.msg); + } + else + { + PrdOutstockH prdOutstockH = new PrdOutstockH(); + prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO; + prdOutstockH.warehouse_id = warehouse_id; + prdOutstockH.location_code = generalOutstockInput.location_code; + prdOutstockH.create_id = _userManager.UserId; + prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId; + prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + prdOutstockH.workstation = generalOutstockInput.workstation_id; + prdOutstockH.workline = workline?.Id ?? ""; + + List prdOutstockDs = new List(); + foreach (var item in generalOutstockInput.details) + { + prdOutstockDs.Add(new PrdOutstockD() + { + material_id = item.material_id, + material_code = item.material_code, + material_name = item.material_name, + pr_qty = item.num, + unit_id = unitIdDic[item.material_id].ToString(), + outstock_id = prdOutstockH.id, + source_id = prdMoTask.mo_task_code + }); + } + + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + { + await _repository.InsertAsync(prdOutstockH); + if (prdOutstockDs.Count > 0) + { + await db.Insertable(prdOutstockDs).ExecuteCommandAsync(); + } + }); + + if (!result.IsSuccess) + { + throw Oops.Bah(result.ErrorMessage); + } + + } + return await Task.FromResult(true); + } + catch (Exception e) + { + Console.WriteLine(e); + Log.Error(e.Message); + throw Oops.Bah(e.Message); + } + } } } \ No newline at end of file From 8c8284a72d66c4a4cf3613d04f5ef52cad91a5f8 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 6 Nov 2023 10:27:22 +0800 Subject: [PATCH 02/10] 1 --- ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index da415616..cdd4c2b0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -148,6 +148,7 @@ namespace Tnb.ProductionMgr OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); List materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList(); + List basMaterials = await db.Queryable().Where(x=>materialIds.Contains(x.id)).ToListAsync(); Dictionary unitIdDic = await db.Queryable() .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit) .LeftJoin((a, b, c) => b.Id == c.DictionaryTypeId && a.unit_id == c.EnCode) @@ -164,7 +165,7 @@ namespace Tnb.ProductionMgr input.outstockDs.Add(new MESWmsOutstockDInput() { material_id = item.material_id, - material_code = item.material_code, + material_code = basMaterials.First(x=>x.id==item.material_id).code, pr_qty = item.num, unit_id = unitIdDic[item.material_id].ToString() }); @@ -201,8 +202,8 @@ namespace Tnb.ProductionMgr prdOutstockDs.Add(new PrdOutstockD() { material_id = item.material_id, - material_code = item.material_code, - material_name = item.material_name, + material_code = basMaterials.First(x=>x.id==item.material_id).code, + material_name = basMaterials.First(x=>x.id==item.material_id).name, pr_qty = item.num, unit_id = unitIdDic[item.material_id].ToString(), outstock_id = prdOutstockH.id, From a055ac33ef6810f5f1ab94656121e06a20af17c0 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 6 Nov 2023 15:30:31 +0800 Subject: [PATCH 03/10] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=B7=A5=E4=BD=8Did?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=BD=93=E5=89=8D=E8=BF=9B=E8=A1=8C=E4=B8=AD?= =?UTF-8?q?=E7=9A=84=E4=BB=BB=E5=8A=A1=E5=8D=95=20=E7=94=9F=E4=BA=A7?= =?UTF-8?q?=E6=8A=95=E6=96=99=E6=96=B0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IPrdMoTaskService.cs | 9 +- .../Tnb.ProductionMgr/PrdFeedingService.cs | 126 ++++++++++++++++++ .../Tnb.ProductionMgr/PrdMoTaskService.cs | 21 ++- 3 files changed, 154 insertions(+), 2 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs index 29f0b0aa..ba1668ad 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs @@ -25,6 +25,13 @@ namespace Tnb.ProductionMgr.Interfaces /// /// Task GetMaterialPreparationPlan(); - + + /// + /// 根据工位获取进行中的任务单信息 + /// + /// + /// + Task GetPrdMoTaskInfoByStationId(Dictionary dic); + } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 183953d8..61872a53 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -36,6 +36,7 @@ namespace Tnb.ProductionMgr { private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; + private readonly IPrdMoTaskService _prdMoTaskService; private readonly IBillRullService _billRullService; // private readonly WmsSignForDeliveryService _wmsSignForDeliveryService; @@ -44,12 +45,14 @@ namespace Tnb.ProductionMgr public PrdFeedingService( ISqlSugarRepository repository, IBillRullService billRullService, + IPrdMoTaskService prdMoTaskService, // WmsSignForDeliveryService wmsSignForDeliveryService, IUserManager userManager ) { _repository = repository; _userManager = userManager; + _prdMoTaskService = prdMoTaskService; // _wmsSignForDeliveryService = _wmsSignForDeliveryService; _billRullService = billRullService; } @@ -331,6 +334,129 @@ namespace Tnb.ProductionMgr if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "签收成功" : result.ErrorMessage; } + + + /// + /// 生产投料 + /// + /// + /// + /// + /// + [HttpPost] + public async Task Feeding(MaterialReceiptNewInput input) + { + var db = _repository.AsSugarClient(); + var moTask = await _prdMoTaskService.GetPrdMoTaskInfoByStationId(new Dictionary() + { + {"station_id",input.station_id} + }); + + if (moTask == null) throw Oops.Bah("找不到任务单"); + PrdFeedingH prdFeedingH = null; + List list = new List(); + DbResult result2 = new DbResult(); + DbResult result = await db.Ado.UseTranAsync(async () => + { + var parentMoTask = await db.Queryable().FirstAsync(x => x.id == moTask.parent_id); + string worklineId = moTask.workline_id; + if (parentMoTask != null && !string.IsNullOrEmpty(parentMoTask.workline_id)) + { + worklineId = parentMoTask.workline_id; + } + var carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); + var workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); + var workshop = await db.Queryable().SingleAsync(x=>x.Id==workline.ParentId); + var inputMaterials = await db.Queryable() + .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id) + .Select(x=>x.material_id) + .ToListAsync(); + + + string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE); + prdFeedingH = new PrdFeedingH() + { + code = code, + station_id = input.station_id, + mo_task_id = moTask.id, + process_id = moTask.process_id, + equip_id = input.equip_id, + workshop_id = workshop?.Id, + carry_id = carry.id, + workline_id = moTask.workline_id, + carry_code = input.carry_code, + // remark = input.remark, + mbom_process_id = moTask.mbom_process_id, + create_id = _userManager.UserId, + create_time = DateTime.Now, + org_id = _userManager.GetUserInfo().Result.organizeId + }; + + if (input.details != null && input.details.Count > 0) + { + foreach (var item in input.details) + { + if(!inputMaterials.Contains(item["material_id"])) + throw new Exception("该物料不是生产bom投入物料,不能签收"); + + var detail = await db.Queryable() + .Where(x => x.member_carry_code == input.carry_code && x.is_all_feeding == 0).FirstAsync(); + decimal num = Convert.ToDecimal(item["num"]); + list.Add(new PrdFeedingD + { + feeding_id = prdFeedingH.id, + material_receipt_detail_id = detail?.id, + material_id = item["material_id"], + num = num, + batch = item["batch"], + unit_id = item["unit_id"], + carry_id = carry.id, + status = "0", + use_num = 0, + }); + + if (detail != null) + { + if(detail.feeding_num + num > detail.num) + { + throw new Exception("投料数量不能大于签收数量"); + }else if (detail.feeding_num + num == detail.num) + { + await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .SetColumns(x => x.is_all_feeding == 1) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync(); + } + else + { + await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync(); + } + } + else + { + throw new Exception("没有签收单,无法投料"); + } + } + } + else + { + throw new Exception("没有签收物料"); + } + + + await db.Insertable(prdFeedingH).ExecuteCommandAsync(); + await db.Insertable(list).ExecuteCommandAsync(); + + }); + + + if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + return result.IsSuccess ? "签收成功" : result.ErrorMessage; + } [HttpPost] public async Task GetFeedingRecordTree() diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 7f2dea96..0a34213d 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1447,6 +1447,7 @@ namespace Tnb.ProductionMgr var row = -1; var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + var equip = await db.Queryable().SingleAsync(x=>x.id==prdMoTask.eqp_id); var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); var mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); @@ -1724,6 +1725,11 @@ namespace Tnb.ProductionMgr // } // } + if (equip.tube == "1") + { + + } + }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); @@ -2627,6 +2633,7 @@ namespace Tnb.ProductionMgr rate_num = SqlFunc.Subqueryable().Where(o => o.id == a.bom_id) .OrderByDesc(o => o.create_time).Select(o => o.num), parent_id = b.parent_id, + workstation_id = b.workstation_id, material_id = b.material_id, material_code = c.code, children = SqlFunc.Subqueryable() @@ -2643,7 +2650,7 @@ namespace Tnb.ProductionMgr var prdMoTaskList = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now) + .Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now && (a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ToBeScheduledEncode || a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode)) .Select((a,b)=>new MaterialPreparationPlanOutput() { mo_task_id = a.id, @@ -2672,6 +2679,18 @@ namespace Tnb.ProductionMgr return prdMoTaskList; } + /// + /// 根据工位获取进行中的任务单信息 + /// + /// + /// + public async Task GetPrdMoTaskInfoByStationId(Dictionary dic) + { + string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : ""; + if (string.IsNullOrEmpty(station_id)) throw Oops.Bah("工位错误"); + + return await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id!=null && x.mo_task_status==DictConst.InProgressEnCode).FirstAsync(); + } } From bab70ddd518f684fac5a1185833931d888bc0ed5 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 6 Nov 2023 15:41:25 +0800 Subject: [PATCH 04/10] 1 --- ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 0a34213d..5d9d1af0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2619,6 +2619,7 @@ namespace Tnb.ProductionMgr /// 获取备料计划 /// /// + [HttpPost] public async Task GetMaterialPreparationPlan() { string now = DateTime.Now.ToString("yyyy-MM-dd"); @@ -2684,6 +2685,7 @@ namespace Tnb.ProductionMgr /// /// /// + [HttpPost] public async Task GetPrdMoTaskInfoByStationId(Dictionary dic) { string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : ""; From 9ee80fe00f1a7c13d4a3810234b64fbbb6506012 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 6 Nov 2023 16:20:10 +0800 Subject: [PATCH 05/10] =?UTF-8?q?=E7=9F=AD=E7=AE=A1=E6=8C=A4=E5=87=BA?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=94=B3=E8=AF=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../IPrdInstockService.cs | 8 ++ .../Tnb.ProductionMgr/PrdInstockService.cs | 110 ++++++++++++++++++ .../Tnb.ProductionMgr/PrdMoTaskService.cs | 24 ++-- 3 files changed, 135 insertions(+), 7 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs index 5cca73d3..9f0cb544 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs @@ -1,3 +1,4 @@ +using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; namespace Tnb.ProductionMgr.Interfaces @@ -28,5 +29,12 @@ namespace Tnb.ProductionMgr.Interfaces /// /// public Task InstockTypeOne(InstockInput inut); + + /// + /// 短管挤出入库申请 + /// + /// + /// + public Task InstockTubeOne(PrdReport prdReport); } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs index a854e8d2..0ae748de 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -389,5 +389,115 @@ namespace Tnb.ProductionMgr if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result2.IsSuccess ? "申请成功" : result2.ErrorMessage; } + + [HttpPost] + public async Task InstockTubeOne(PrdReport prdReport) + { + var db = _repository.AsSugarClient(); + string location_code = "JMXHC-01"; + string warehouse_id = "26103348825381"; + + PrdInstockH prdInstockH = null; + List prdInstockDs = new List() { }; + DbResult result2 = new DbResult(); + BasMaterial basMaterial = await db.Queryable().SingleAsync(x=>x.id==prdReport.material_id); + DbResult result = await db.Ado.UseTranAsync(async () => + { + OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode); + OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode); + + prdInstockH = new PrdInstockH() + { + bill_type = DictConst.CHANCHENGPINRUKUDAN, + bill_date = DateTime.Now, + create_id = _userManager.UserId, + location_code = location_code, + carry_code = prdReport.material_box_code, + is_check = 1, + station_id = prdReport.station, + workline_id = workline?.Id ?? "", + workshop_id = workshop?.Id ?? "", + org_id = _userManager.GetUserInfo().Result.organizeId, + warehouse_id = warehouse_id, + status = 0, + }; + + prdInstockDs.Add(new PrdInstockD() + { + instock_id = prdInstockH.id, + report_id = prdReport.create_id, + material_id = prdReport.material_id, + material_code = basMaterial.code, + unit_id = prdReport.unit_id, + barcode = prdReport.barcode, + code_batch = prdReport.barcode+"0001", + quantity = (int)prdReport.reported_qty, + }); + }); + + if (result.IsSuccess) + { + MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput(); + mesCreateInstockInput.instock = new MESWmsInstockHInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + bill_type = DictConst.CHANCHENGPINRUKUDAN, + warehouse_id = warehouse_id, + source_id = prdInstockH.id, + create_id = _userManager.UserId, + carry_code = prdReport.material_box_code, + location_code = location_code, + is_check = 1, + }; + mesCreateInstockInput.instockds = new List(); + mesCreateInstockInput.instockcodes = new List(); + mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput() + { + material_id = prdReport.material_id, + material_code = basMaterial.code, + unit_id = prdReport.unit_id, + code_batch = prdReport.barcode, + pr_qty = (int)prdReport.reported_qty, + }); + + mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput() + { + material_id = prdReport.material_id, + material_code = basMaterial.code, + unit_id = prdReport.unit_id, + barcode = prdReport.barcode, + code_batch = prdReport.barcode+"0001", + codeqty = (int)prdReport.reported_qty, + }); + string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + Dictionary header = new Dictionary() + { + ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] + }; + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header); + Log.Information(sendResult); + AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); + if (authResponse.code != 200 || !authResponse.data.ObjToBool()) + { + throw Oops.Bah(authResponse.msg); + } + else + { + result2 = await db.Ado.UseTranAsync(async () => + { + await _repository.InsertAsync(prdInstockH); + + if (prdInstockDs.Count > 0) + { + await db.Insertable(prdInstockDs).ExecuteCommandAsync(); + } + }); + + } + } + + return result2.IsSuccess ? "true" : "false"; + } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 5d9d1af0..1a02c437 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -70,6 +70,7 @@ namespace Tnb.ProductionMgr private static Dictionary _dicProcess = new Dictionary(); private readonly ISqlSugarClient _db; private readonly IBillRullService _billRuleService; + private readonly IPrdInstockService _prdInstockService; private readonly IQcCheckPlanService _qcCheckPlanService; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); @@ -79,6 +80,7 @@ namespace Tnb.ProductionMgr IDictionaryDataService dictionaryDataService, IRunService runService, IBillRullService billRullService, + IPrdInstockService prdInstockService, IVisualDevService visualDevService, IQcCheckPlanService qcCheckPlanService ) @@ -92,6 +94,7 @@ namespace Tnb.ProductionMgr OverideFuncs.DeleteAsync = Delete; OverideFuncs.GetListAsync = GetList; _billRuleService = billRullService; + _prdInstockService = prdInstockService; _qcCheckPlanService=qcCheckPlanService; } @@ -1442,12 +1445,12 @@ namespace Tnb.ProductionMgr public async Task PrdReport(PrdReportCrInput input) { var db = _repository.AsSugarClient(); + var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + var equip = await db.Queryable().SingleAsync(x=>x.id==prdMoTask.eqp_id); + var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { var row = -1; - var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); - var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); - var equip = await db.Queryable().SingleAsync(x=>x.id==prdMoTask.eqp_id); var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); var mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); @@ -1725,13 +1728,20 @@ namespace Tnb.ProductionMgr // } // } - if (equip.tube == "1") - { - - } + }); + if (result.IsSuccess) + { + if (equip.tube == "1") + { + string resultMsg = await _prdInstockService.InstockTubeOne(report); + if (resultMsg == "true") return true; + throw Oops.Bah(resultMsg); + } + } + if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess; } From e0972cb1b9ad909c0c55f589da9f57b420de1085 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Mon, 6 Nov 2023 16:38:23 +0800 Subject: [PATCH 06/10] bug --- .../Dto/PrdManage/MaterialPreparationPlanOutput.cs | 1 + ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs index f8c367bd..c8f0b087 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs @@ -18,6 +18,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string parent_id { get; set; } public string material_id { get; set; } public string material_code { get; set; } + public string workstation_id { get; set; } public List children { get; set; } = new List(); } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 1a02c437..cda260c3 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2700,8 +2700,14 @@ namespace Tnb.ProductionMgr { string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : ""; if (string.IsNullOrEmpty(station_id)) throw Oops.Bah("工位错误"); - - return await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id!=null && x.mo_task_status==DictConst.InProgressEnCode).FirstAsync(); + var prdMoTask = await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id!=null && x.mo_task_status==DictConst.InProgressEnCode).FirstAsync(); + if (prdMoTask != null) + { + BasMaterial basMaterial = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); + prdMoTask.material_name = basMaterial.name; + } + + return prdMoTask; } } From 55eba2d422745df0e314288772a952843fe3cabf Mon Sep 17 00:00:00 2001 From: qianjiawei <1184704771@qq.com> Date: Mon, 6 Nov 2023 17:52:20 +0800 Subject: [PATCH 07/10] REDIS --- .../Enums/Eagvmode.cs | 17 ++++ .../Tnb.ProductionMgr/RedisBackGround.cs | 97 ++++++++++++++----- .../Tnb.ProductionMgr/RedisDataService.cs | 17 ++-- 3 files changed, 100 insertions(+), 31 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs new file mode 100644 index 00000000..16320af9 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.ProductionMgr.Entities.Enums +{ + public enum Eagvmode + { + 无请求=0, + 空框请求=1, + 满框请求=2, + 空满框请求=3, + 收到请求=4 + } +} diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 2a2150c6..0d5cb241 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -10,6 +10,8 @@ using Newtonsoft.Json; using UAParser; using Tnb.ProductionMgr.Interfaces; using Tnb.ProductionMgr.Entities.Dto; +using JNPF.ClayObject.Extensions; +using Tnb.ProductionMgr.Entities.Enums; namespace Tnb.ProductionMgr { @@ -25,37 +27,84 @@ namespace Tnb.ProductionMgr _redisCache = redisCache; _prdInstockService = prdInstockService; } - //获取装箱状态 - private void GetPackStatus(object state) + //获取注塑装箱状态 + private void GetZSPackStatus(object state) { - Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}"); - Console.WriteLine($"获取装箱状态"); - /* - var data = _redisCache.GetHash("TY4C-JICHU", "weight_4").Result; - var res = JsonConvert.DeserializeObject(data); - if (res != null && res["Value"] != null) + // Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}"); + // Console.WriteLine($"获取注塑装箱状态"); + string[] strs = new string[1] { "TY4C-ZHUSU1" }; + string sign = "agvMode"; + foreach (string s in strs) { - InstockInput instockInput = new InstockInput(); - instockInput.equip_code = res["Value"]!.ToString(); - _prdInstockService.InstockTypeOne(instockInput); - Console.WriteLine(decimal.Parse(res["Value"]!.ToString())); - }*/ + var dic = _redisCache.HGetAll(s).Result; + foreach (var kv in dic) + { + if (!kv.Key.Contains(sign)) + continue; + var res = JsonConvert.DeserializeObject(kv.Value); + if (res != null && res["Value"] != null) + { + if (int.Parse(res["Value"]!.ToString()) != (int)Eagvmode.无请求 || int.Parse(res["Value"]!.ToString()) != (int)Eagvmode.收到请求) + { + InstockInput instockInput = new InstockInput(); + instockInput.equip_code = res["TagName"]!.ToString(); + _prdInstockService.InstockTypeOne(instockInput); + } + } + } + } + } + //获取挤出装箱状态 + private void GetJCPackStatus(object state) + { + // Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}"); + // Console.WriteLine($"获取挤出装箱状态"); + string[] strs = new string[1] { "TY4C-SHUSONG-JC" }; + string sign = "AGVFullCall"; + foreach (string s in strs) + { + var dic = _redisCache.HGetAll(s).Result; + foreach (var kv in dic) + { + if (!kv.Key.Contains(sign)) + continue; + var res = JsonConvert.DeserializeObject(kv.Value); + if (res != null && res["Value"] != null) + { + if (res.Value("Value")) + { + InstockInput instockInput = new InstockInput(); + instockInput.equip_code = res["TagName"]!.ToString(); + _prdInstockService.InstockTypeOne(instockInput); + } + } + } + } } //获取限位状态 private void GetLimitStatus(object state) { - Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}"); - Console.WriteLine($"获取限位状态"); - /* - var data = _redisCache.GetHash("TY4C-JICHU", "weight_4").Result; - var res = JsonConvert.DeserializeObject(data); - if (res != null && res["Value"] != null) + // Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}"); + // Console.WriteLine($"获取限位状态"); + string[] strs = new string[1] { "TY4C-WAIBAO" }; + string sign = "AGVCall"; + foreach (string s in strs) { - InstockInput instockInput = new InstockInput(); - instockInput.equip_code = res["Value"]!.ToString(); - _prdInstockService.InstockTypeOne(instockInput); - Console.WriteLine(decimal.Parse(res["Value"]!.ToString())); - }*/ + var dic = _redisCache.HGetAll(s).Result; + foreach (var kv in dic) + { + if (!kv.Key.Contains(sign)) + continue; + var res = JsonConvert.DeserializeObject(kv.Value); + if (res != null && res["Value"] != null) + { + if (res.Value("Value")) + { + // + } + } + } + } } public void Dispose() { diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs index d9ea93f4..8f4836f5 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs @@ -33,20 +33,23 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetWeight(string device, string jihao) { - /* - var dic = _redisCache.HGetAll("TY4C-ZHUSU1"); - string a= "weighCall_7&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_7\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_4&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_4\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_6&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_6\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_2&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_2\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_5&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_5\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_11&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_11\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_1&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_1\",\"StatusCode\":0,\"Value\":1.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:31:03\"}$weight_12&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_12\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_11&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_11\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_9&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_9\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_4&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_4\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_7&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_7\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_14&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_14\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_7&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_7\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_10&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_10\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_1&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_1\",\"StatusCode\":0,\"Value\":true,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:10:51\"}$weighDone_12&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_12\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_14&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_14\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_14&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_14\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_11&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_11\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_5&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_5\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_9&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_9\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_13&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_13\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_8&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_8\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_2&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_2\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_2&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_2\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_8&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_8\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_3&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_3\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_14&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_14\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_9&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_9\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_7&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_7\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_3&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_3\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_8&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_8\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_1&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_1\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_12&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_12\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_4&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_4\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_1&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_1\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_6&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_6\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_2&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_2\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_3&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_3\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_10&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_10\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_10&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_10\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_13&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_13\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$State&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"State\",\"StatusCode\":0,\"Value\":\"OK\",\"TagValueType\":\"Unkown\",\"TimeStamp\":\"2023-11-02 11:14:28\"}$weighCall_12&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_12\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_6&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_6\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_13&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_13\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_10&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_10\",\"StatusCode\":0,\"Value\":33.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 10:19:44\"}$weighDone_11&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_11\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_9&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_9\",\"StatusCode\":0,\"Value\":11.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 10:15:26\"}$weight_8&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_8\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_4&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_4\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighCall_6&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighCall_6\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_5&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_5\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weighDone_5&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weighDone_5\",\"StatusCode\":0,\"Value\":false,\"TagValueType\":\"Bit\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weightSum_13&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weightSum_13\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$weight_3&{\"DevName\":\"TY4C-ZHUSU1\",\"TagName\":\"weight_3\",\"StatusCode\":0,\"Value\":0.0,\"TagValueType\":\"Float\",\"TimeStamp\":\"2023-11-03 09:09:02\"}$"; + /* + var dic =await _redisCache.HGetAll("TY4C-JICHU"); + string a = ""; foreach (var kvp in dic) { a += kvp.Key + "&" + kvp.Value + "$"; } - var ss= a.Split('$', StringSplitOptions.RemoveEmptyEntries); + + + string aa = ""; + var ss= aa.Split('$', StringSplitOptions.RemoveEmptyEntries); foreach (var s in ss) { var b = s.Split('&'); - _redisCache.HSet("TY4C-ZHUSU1", b[0], b[1]); - } - */ + await _redisCache.HSet("TY4C-JICHU", b[0], b[1]); + }*/ + decimal result = 0; bool flag = await _redisCache.HashExist(device, jihao); if (!flag) From 6a2154edd9e0b3b95e911e46d93cf7724493eaef Mon Sep 17 00:00:00 2001 From: "fei.pan" Date: Mon, 6 Nov 2023 18:08:22 +0800 Subject: [PATCH 08/10] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=A4=9A=E4=B8=AA=E5=AD=97=E5=85=B8=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E6=95=B0=E6=8D=AE=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Directory.Build.props | 8 ++ Tnb.Server.sln | 9 +-- clear_bin_obj.cmd | 76 ------------------- common/Tnb.Common/Tnb.Common.csproj | 2 +- .../System/IDictionaryTypeService.cs | 6 ++ .../System/DictionaryDataService.cs | 20 +++++ .../System/DictionaryTypeService.cs | 11 ++- .../{OutputParser.cs => VmQueryParser.cs} | 20 +++-- visualdev/Tnb.Vengine/Domain/Vmodel.cs | 3 + 9 files changed, 66 insertions(+), 89 deletions(-) delete mode 100644 clear_bin_obj.cmd rename visualdev/Tnb.Vengine/Domain/{OutputParser.cs => VmQueryParser.cs} (86%) diff --git a/Directory.Build.props b/Directory.Build.props index 8e0a6337..d59ff165 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,5 +1,13 @@ $(MSBuildThisFileDirectory) + latest + $(NoWarn);CS1591; + + + none + false + + \ No newline at end of file diff --git a/Tnb.Server.sln b/Tnb.Server.sln index 42180ae7..1b62b7aa 100644 --- a/Tnb.Server.sln +++ b/Tnb.Server.sln @@ -22,7 +22,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{7876D0A1-7141-4904-8A3B-88DF61BEE7EE}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - clear_bin_obj.cmd = clear_bin_obj.cmd common.props = common.props Directory.Build.props = Directory.Build.props dotnet.ruleset = dotnet.ruleset @@ -295,14 +294,14 @@ Global {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Debug|Any CPU.Build.0 = Debug|Any CPU {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Release|Any CPU.Build.0 = Release|Any CPU - {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.ActiveCfg = tianyi|Any CPU - {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.Build.0 = tianyi|Any CPU + {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.ActiveCfg = Debug|Any CPU + {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.Build.0 = Debug|Any CPU {0282541C-4295-4A2A-A826-54E9C69718D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0282541C-4295-4A2A-A826-54E9C69718D9}.Debug|Any CPU.Build.0 = Debug|Any CPU {0282541C-4295-4A2A-A826-54E9C69718D9}.Release|Any CPU.ActiveCfg = Release|Any CPU {0282541C-4295-4A2A-A826-54E9C69718D9}.Release|Any CPU.Build.0 = Release|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.ActiveCfg = tianyi|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.Build.0 = tianyi|Any CPU + {0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.ActiveCfg = Debug|Any CPU + {0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.Build.0 = Debug|Any CPU {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Debug|Any CPU.Build.0 = Debug|Any CPU {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Release|Any CPU.ActiveCfg = Release|Any CPU diff --git a/clear_bin_obj.cmd b/clear_bin_obj.cmd deleted file mode 100644 index 242e75da..00000000 --- a/clear_bin_obj.cmd +++ /dev/null @@ -1,76 +0,0 @@ -@echo off&chcp 936>nul&setlocal enabledelayedexpansion -title ɾbinobjļС -echo; -if [%1] equ [] (set fp=%~dp0) else (set fp=%1) -set fp="%fp%" & set fp=%fp:"=% -if "%fp%" neq "" if "%fp:~-1%" neq "\" set fp=%fp%\ -set nowPath="%fp%" - -set /a findFileCount=0 -set /a findFolderCount=0 -set /a findAllCount=0 -set /a delFileCount=0 -set /a delFolderCount=0 -set /a fileSize=0 -set delFileOrFolder=*.vshost.*,bin,obj,.vs - - -echo; &echo Ŀ¼%nowPath% -echo; &echo ɾָĿ¼µģ -set delType=%delFileOrFolder% -:loop -for /f "tokens=1* delims=," %%a in ("%delType%") do echo %%a &set delType=%%b -if defined delType goto :loop -:: echo; &echo ˳رմڡ &pause>nul -:: echo; &echo -------------------------------------------------- -echo ɾб - -rem search delete specify file or folder(such as:*.pdb,*.vshost.*) -::for /r %nowPath% %%i in (*.pdb,*.vshost.*) do (echo del "%%i") -for /r %nowPath% %%i in (%delFileOrFolder%) do (IF EXIST "%%i" (echo "%%i"&IF EXIST "%%i\.\" (set /a findFolderCount+=1) else set /a findFileCount+=1 - set fs=0&(for /f "tokens=3* delims= " %%a in ('dir "%%i" /a-d /s /-c ^| find /i "ļ"') do set fs=%%a)&call :bigNumAdd !fileSize! !fs! fileSize -)) -set /a findAllCount=%findFolderCount%+%findFileCount% -echo;&if %findAllCount% equ 0 echo [file or folder not found] &goto end -call :numToThousand %fileSize% fileSize -echo ҵ%findAllCount%ɾļ%findFileCount%ļУ%findFolderCount%ܹС%fileSize% bytes -echo -------------------------------------------------- -set /p var=ǷȷɾļļУ[Y/N]: -if /i "%var%"=="Y" (goto DelFileAndFolder) else goto cancelDel - -:DelFileAndFolder -rem delete specify file or folder(such as:obj,bin,*.pdb,*.vshost.*) -::for /r %nowPath% %%i in (%delFileOrFolder%) do (IF EXIST "%%i" IF EXIST "%%i\.\" (echo "%%i\.\") ELSE echo "%%i") -for /r %nowPath% %%i in (%delFileOrFolder%) do (IF EXIST "%%i" (echo Deleting file "%%i"&IF EXIST "%%i\.\" (RD /s /q "%%i" &set /a delFolderCount+=1) else del "%%i" &set /a delFileCount+=1)) -echo; &echo [Delete completed] delete %delFileCount% files, delete %delFolderCount% folders, total size %fileSize% bytes &echo; -goto end - -:cancelDel -echo; &echo [Cancel deletion] &echo; - -:end -Pause -goto :eof - - -::ӷ call _ADD <> <> [ر] -::ֱ֧ʮƵ64λֺ64λС,һμ0.01 -:bigNumAdd <> <> [ر] // by jack on 2021-09-03 -(setlocal enabledelayedexpansion -set L=&for /l %%a in (1,1,8) do set L=!L!00000000 -for /f "tokens=1-3 delims=." %%a in ("!L!%1.!L!") do set at=%%a&set aw=%%b%%c -for /f "tokens=1-3 delims=." %%a in ("!L!%2.!L!") do set bt=%%a&set bw=%%b%%c -set a=!at:~-64!!aw:~,64!&set b=!bt:~-64!!bw:~,64!&set e=&set v=200000000 -for /l %%a in (8,8,128)do set/a v=1!b:~-%%a,8!+1!a:~-%%a,8!+!v:~-9,-8!-2&set e=!v:~-8!!e! -set e=!e:0= !&for /f "tokens=*" %%a in ("!e:~,-64!_.!e:~64!") do set e=%%~nxa -set e=!e:_=!&for %%a in ("!e: =0!") do endlocal&(if %3.==. (echo %%~a) else set %3=%%~a) -exit/b) - -::ַתǧַʾ -:numToThousand <ֲ> [ر] -(setlocal enabledelayedexpansion&set n=%~1 -set len=0&for /l %%i in (0,1,1000) do if "!n:~%%i,1!."=="." set len=%%i&goto :breakFor -:breakFor -set nv=&for /l %%a in (1,1,%len%)do (set nv=!n:~-%%a,1!!nv!&set/a m=%%a%%3&if !m!==0 if not %%a==%len% set nv=,!nv!) -endlocal&(if %2.==. (echo %nv%) else set %2=%nv%) -exit/b) \ No newline at end of file diff --git a/common/Tnb.Common/Tnb.Common.csproj b/common/Tnb.Common/Tnb.Common.csproj index b8426126..21b2e243 100644 --- a/common/Tnb.Common/Tnb.Common.csproj +++ b/common/Tnb.Common/Tnb.Common.csproj @@ -1,5 +1,5 @@  - + net6.0 diff --git a/system/Tnb.Systems.Interfaces/System/IDictionaryTypeService.cs b/system/Tnb.Systems.Interfaces/System/IDictionaryTypeService.cs index d4599d1c..29b9a2cf 100644 --- a/system/Tnb.Systems.Interfaces/System/IDictionaryTypeService.cs +++ b/system/Tnb.Systems.Interfaces/System/IDictionaryTypeService.cs @@ -16,6 +16,12 @@ public interface IDictionaryTypeService /// Task> GetList(); + /// + /// 获取部分列表. + /// + /// + Task> GetListMany(string[] ids); + /// /// 信息. /// diff --git a/system/Tnb.Systems/System/DictionaryDataService.cs b/system/Tnb.Systems/System/DictionaryDataService.cs index 3a42488d..e4171e29 100644 --- a/system/Tnb.Systems/System/DictionaryDataService.cs +++ b/system/Tnb.Systems/System/DictionaryDataService.cs @@ -95,6 +95,26 @@ public class DictionaryDataService : IDictionaryDataService, IDynamicApiControll } } + /// + /// 获取部分数据字典列表(多个分类). + /// + [HttpGet("Many")] + public async Task GetListMany(string[] dictionaryTypeIds) + { + var dictionaryData = await _repository.AsQueryable().Where(d => d.DeleteMark == null && d.EnabledMark == 1 && dictionaryTypeIds.Contains(d.DictionaryTypeId)) + .OrderBy(o => o.SortCode).OrderBy(o => o.CreatorTime, OrderByType.Desc).OrderBy(o => o.LastModifyTime, OrderByType.Desc).ToListAsync(); + var dictionaryType = await _dictionaryTypeService.GetListMany(dictionaryTypeIds); + var data = dictionaryType.Adapt>(); + data.ForEach(dataall => + { + if (dataall.isTree == 1) + dataall.dictionaryList = dictionaryData.FindAll(d => d.DictionaryTypeId == dataall.id).Adapt>().ToTree(); + else + dataall.dictionaryList = dictionaryData.FindAll(d => d.DictionaryTypeId == dataall.id).Adapt>(); + }); + return new { list = data }; + } + /// /// 获取所有数据字典列表(分类+内容). /// diff --git a/system/Tnb.Systems/System/DictionaryTypeService.cs b/system/Tnb.Systems/System/DictionaryTypeService.cs index d02b1089..2498f0cb 100644 --- a/system/Tnb.Systems/System/DictionaryTypeService.cs +++ b/system/Tnb.Systems/System/DictionaryTypeService.cs @@ -165,13 +165,22 @@ public class DictionaryTypeService : IDictionaryTypeService, IDynamicApiControll /// /// 列表. /// - /// [NonAction] public async Task> GetList() { return await _repository.AsQueryable().Where(x => x.DeleteMark == null).OrderBy(x => x.SortCode).OrderBy(x => x.CreatorTime, OrderByType.Desc).ToListAsync(); } + /// + /// 列表. + /// + [NonAction] + public async Task> GetListMany(string[] ids) + { + return await _repository.AsQueryable().Where(x => x.DeleteMark == null && ids.Contains(x.Id)).OrderBy(x => x.SortCode).OrderBy(x => x.CreatorTime, OrderByType.Desc).ToListAsync(); + } + + /// /// 递归获取所有分类. /// diff --git a/visualdev/Tnb.Vengine/Domain/OutputParser.cs b/visualdev/Tnb.Vengine/Domain/VmQueryParser.cs similarity index 86% rename from visualdev/Tnb.Vengine/Domain/OutputParser.cs rename to visualdev/Tnb.Vengine/Domain/VmQueryParser.cs index 2a90c0b9..68763d1f 100644 --- a/visualdev/Tnb.Vengine/Domain/OutputParser.cs +++ b/visualdev/Tnb.Vengine/Domain/VmQueryParser.cs @@ -8,14 +8,14 @@ using Tnb.Vengine.DataAccess; namespace Tnb.Vengine.Domain { - public class OutputParser + public class VmQueryParser { private readonly IDataAccess _dataAccess; private readonly Vmodel _root; private List _outputs; private Dictionary _selectProps = new Dictionary(); private Dictionary _navModels = new Dictionary(); - public OutputParser(IDataAccess dataAccess, Vmodel rootModel, string output) + public VmQueryParser(IDataAccess dataAccess, Vmodel rootModel, string output) { _dataAccess = dataAccess; _root = rootModel; @@ -54,6 +54,10 @@ namespace Tnb.Vengine.Domain private async Task LoadNavModel() { + foreach (var selVm in _selectProps.Values) + { + //if(selVm.navModel != null) + } var navProps = _root.navProps.Where(a => _selectProps.Values.Any(b => b.vmPath.StartsWith(a.code + "."))).ToList(); await LoadVmodelNavigateAsync(navProps); } @@ -74,8 +78,8 @@ namespace Tnb.Vengine.Domain internal class OutputSelect { - public string vmId { get; set; } = string.Empty; - public string vmCode { get; set; } = string.Empty; + public Vmodel? navModel { get; set; } + public string navPath { get; set; } = string.Empty; public string vmPath { get; set; } = string.Empty; public eNavigateType navType { get; set; } = eNavigateType.None; public List navPaths { get; set; } = new List(); @@ -89,9 +93,13 @@ namespace Tnb.Vengine.Domain } public OutputSelect(Vmodel model) { - vmId = model.id; - vmCode = model.vmCode; vmPath = Vmodel.MAIN_ALIES; } } + + internal class NavigateVmodel + { + public Vmodel? navModel { get; set; } + public string navPath { get; set; } + } } diff --git a/visualdev/Tnb.Vengine/Domain/Vmodel.cs b/visualdev/Tnb.Vengine/Domain/Vmodel.cs index 89b0d03f..070ce510 100644 --- a/visualdev/Tnb.Vengine/Domain/Vmodel.cs +++ b/visualdev/Tnb.Vengine/Domain/Vmodel.cs @@ -139,6 +139,9 @@ public partial class Vmodel : Entity public string fullCode { get { return areaCode + "/" + vmCode; } } + [SugarColumn(IsIgnore = true)] + public Vmodel? parent { get; set; } + /// /// 主键 /// From c6b8dfc8618e5f4d6e5a318391f697bbfc5dacd8 Mon Sep 17 00:00:00 2001 From: "fei.pan" Date: Mon, 6 Nov 2023 19:35:59 +0800 Subject: [PATCH 09/10] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E5=BC=95=E7=94=A8commo?= =?UTF-8?q?n.props?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/CodeTemplateConst.cs | 10 +- .../Consts/DbTimeFormat.cs | 2 +- .../Consts/DictConst.cs | 12 +- .../Consts/FactoryConfigConst.cs | 2 +- .../Consts/ModuleConst.cs | 8 +- .../Consts/WebApiConst.cs | 16 +- .../Dto/BasCalendar/CalendarInput.cs | 12 +- .../Dto/BasCalendar/CalendarOut.cs | 8 +- .../Dto/BasESop/EsopHistoryListQueryInput.cs | 4 +- .../Dto/BasESop/UploadNewVersionInput.cs | 4 +- .../Dto/BasEbom/EbomTreeOutput.cs | 28 +- .../Dto/BasEbom/EbomTreeQueryInput.cs | 6 +- .../Dto/BasMaterial/MaterialQueryInput.cs | 2 +- .../Dto/BasMaterial/MaterialSelectOutput.cs | 12 +- .../BasMaterial/MaterialSelectQueryInput.cs | 2 +- .../Dto/BasMbom/MbomDataOutput.cs | 42 +- .../Dto/BasMbom/MbomSaveDataInput.cs | 44 +- .../Dto/BasProcess/ProcessListOutput.cs | 12 +- .../Dto/BasProcess/ProcessStationInput.cs | 2 +- .../Dto/BasRoute/VaildRouteOutput.cs | 6 +- .../Dto/ElementSelectDto.cs | 4 +- .../Dto/ProcessManage/RouteLineTreeOutput.cs | 7 +- .../Dto/SubBomListOutput.cs | 12 +- .../Entity/BasCalendar.cs | 7 +- .../Entity/BasLocation.cs | 3 +- .../Entity/BasMaterial.cs | 2 +- .../Entity/BasMbomInput.cs | 2 +- .../Entity/BasMbomOutput.cs | 2 +- .../Entity/BasMbomProcess.cs | 4 +- .../Entity/BasRouteD.cs | 2 +- .../Entity/BasShiftWorkgroup.cs | 7 +- .../Enums/EnumCalendarType.cs | 8 +- .../Enums/EnumLocationType.cs | 8 +- .../Tnb.BasicData.Entities/Mapper/Mapper.cs | 1 - .../Model/RouteModel.cs | 14 +- .../Tnb.BasicData.Entities.csproj | 1 - .../IBasCalendarService.cs | 7 +- .../IBasESopService.cs | 8 +- .../IBasLocationService.cs | 7 +- .../IBasMaterialService.cs | 6 +- .../IBasProcessService.cs | 6 +- .../IBasQrcodeService.cs | 6 +- .../IBasRouteService.cs | 3 +- .../Tnb.BasicData.Interfaces.csproj | 1 - BasicData/Tnb.BasicData/BasCalendarService.cs | 280 ++++---- BasicData/Tnb.BasicData/BasDefectService.cs | 19 +- BasicData/Tnb.BasicData/BasESopService.cs | 80 ++- BasicData/Tnb.BasicData/BasEbomService.cs | 84 ++- BasicData/Tnb.BasicData/BasLocationService.cs | 29 +- BasicData/Tnb.BasicData/BasMaterialService.cs | 108 ++-- BasicData/Tnb.BasicData/BasMbomService.cs | 88 +-- BasicData/Tnb.BasicData/BasProcessService.cs | 36 +- .../Tnb.BasicData/BasPushRuleLogService.cs | 4 +- BasicData/Tnb.BasicData/BasQrcodeService.cs | 52 +- BasicData/Tnb.BasicData/BasRouteService.cs | 43 +- BasicData/Tnb.BasicData/Tnb.BasicData.csproj | 1 - .../Consts/MoldPlanMaintainStatus.cs | 8 +- .../Consts/MoldUseStatus.cs | 8 +- .../Consts/SpotInsRecordExecutionStatus.cs | 4 +- .../Dto/BaseMoldMaintainInput.cs | 8 +- .../Dto/CheckItemOutput.cs | 8 +- .../Dto/CheckItemQueryinput.cs | 8 +- .../Dto/ClosedownEndListOutput.cs | 8 +- .../Dto/EqpMaintainRecordListOutput.cs | 6 +- .../Dto/EqpSpotInsRecordListOutput.cs | 4 +- .../Dto/EquipDaqQueryOutput.cs | 2 +- .../Dto/EquipFileQueryOutput.cs | 2 +- .../Dto/EquipQueryInput.cs | 4 +- .../Dto/EquipRepairRefuseInput.cs | 2 +- .../Dto/EquipSparePartsInput.cs | 2 +- .../Dto/EquipSparePartsQueryOutput.cs | 2 +- .../Dto/EquipmentListOutput.cs | 8 +- .../Dto/MaintainInfoQueryinput.cs | 8 +- .../Dto/MaintainPlanCrInput.cs | 8 +- .../Dto/MaintainPlanMoldLstOutput.cs | 9 +- .../Dto/MaintainRecordRepeatInput.cs | 6 +- .../Dto/MaintainRecordRepeatOutput.cs | 2 +- .../Dto/MaintainRuleMoldListOutput.cs | 8 +- .../Dto/MaintainStatusUpInput.cs | 10 +- .../Dto/MaterialListOutput.cs | 8 +- .../Dto/MoldListOutput.cs | 8 +- .../Dto/MoldMaintainDelInput.cs | 8 +- .../Dto/MoldMaintainGroupItemRelationInput.cs | 10 +- .../Dto/MoldMaintainItemInput.cs | 8 +- .../Dto/MoldMaintainItemListOutput.cs | 8 +- .../Dto/MoldMaintainPlanRunQueryOutput.cs | 8 +- .../Dto/MoldMaintainRunUpInput.cs | 10 +- .../Dto/MoldMaintainUpInput.cs | 10 +- .../Dto/MoldRuleSelectorListOutput.cs | 8 +- .../Dto/PadMainListOutput.cs | 9 +- .../Dto/PadRepairListInput.cs | 6 +- .../Dto/PadRepairListOutput.cs | 4 +- .../Dto/PdaMaintainInput.cs | 7 +- .../Dto/PdaRepairApplyListOutput.cs | 4 +- .../Dto/RelevanceMoldFromPlanInput.cs | 8 +- .../Dto/RelevanceMoldInput.cs | 10 +- .../Dto/RepairApplyOutRegisterInput.cs | 12 +- .../Dto/RepairApplyRegisterInput.cs | 16 +- .../Dto/RepairDelayInput.cs | 10 +- .../Dto/RepairOutApplyInput.cs | 2 +- .../Dto/SpotInsRecordExecuteInput.cs | 10 +- .../Dto/SpotInsRecordRepeatInput.cs | 4 +- .../Dto/SpotInsRecordRepeatOutput.cs | 2 +- .../Dto/SpotInsTemPublishInput.cs | 2 +- .../Tnb.EquipMgr.Entities/Dto/ToolInput.cs | 8 +- .../Dto/ToolMoldInput.cs | 10 +- .../Dto/WorklineAndEquipTreeOutput.cs | 2 +- .../Entity/EqpEquipment.cs | 10 +- .../Entity/EqpMaintainTemEquipH.cs | 2 +- .../Entity/EqpMaintainTemH.cs | 2 +- .../Entity/EqpRepairAnalysisRecord.cs | 3 +- .../Entity/EqpRepairApply.cs | 4 +- .../Entity/EqpRepairCompletionRecord.cs | 3 +- .../Entity/EqpRepairDelay.cs | 3 - .../Entity/EqpRepairOutApply.cs | 8 +- .../Entity/EqpSpEquipCheckRecord.cs | 2 +- .../Entity/EqpSpotInsRecordD.cs | 2 +- .../Entity/MoldMaintenance.cs | 5 +- .../Entity/ToolModelCheckItem.cs | 1 - .../Entity/ToolModelCheckPeriod.cs | 1 - .../Entity/ToolMoldMaintainPlan.cs | 7 +- .../Entity/ToolMolds.part.cs | 6 +- .../Enums/MaintainStatus.cs | 14 +- .../Tnb.EquipMgr.Entities/Mapper/Mapper.cs | 3 +- .../Tnb.EquipMgr.Entities.csproj | 1 - .../IEqpEquipFileService.cs | 1 - .../IEqpEquipSparePartsService.cs | 2 +- .../IEqpMaintainRecordService.cs | 5 +- .../IEqpMaintainTemEquipService.cs | 2 +- .../IEqpRepairApplyService.cs | 30 +- .../IEqpRepairDelayService.cs | 2 +- .../IEqpRepairOutApplyService.cs | 10 +- .../IEqpSpEquipCheckRecordService.cs | 2 +- .../IEqpSparePartsRequisitionHService.cs | 2 +- .../IEqpWorkshopChangeLogService.cs | 2 +- .../IEquSpotInsRecordService.cs | 5 +- .../IEquipmentService.cs | 6 +- .../IToolMoldHouseService.cs | 8 +- .../IToolMoldLocationService.cs | 8 +- .../IToolMoldMaintainGroupService.cs | 8 +- .../IToolMoldMaintainPlanRunService.cs | 8 +- .../IToolMoldMaintainPlanService.cs | 8 +- .../IToolMoldMaintainRuleService.cs | 8 +- .../IToolMoldMaintainTaskService.cs | 7 +- .../IToolMoldMaterialService.cs | 8 +- .../IToolMoldRequisitionService.cs | 2 +- .../IToolMoldsService.cs | 8 +- .../Tnb.EquipMgr.Interfaces.csproj | 1 - .../App/AppEqpRepairApplyService.cs | 36 +- .../Tnb.EquipMgr/BaseMoldMaintainService.cs | 17 +- EquipMgr/Tnb.EquipMgr/EqpDaqService.cs | 22 +- EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs | 31 +- EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs | 10 +- .../Tnb.EquipMgr/EqpEquipSparePartsService.cs | 13 +- .../EqpMaintainTemEquipService.cs | 13 +- .../Tnb.EquipMgr/EqpMaintainTemService.cs | 20 +- .../Tnb.EquipMgr/EqpRepairApplyService.cs | 133 ++-- .../Tnb.EquipMgr/EqpRepairDelayService.cs | 4 +- .../Tnb.EquipMgr/EqpRepairOutApplyService.cs | 31 +- .../Tnb.EquipMgr/EqpRepairRefuseService.cs | 1 - .../EqpSpEquipCheckRecordService.cs | 5 +- .../EqpSparePartsRequisitionHService.cs | 24 +- EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs | 21 +- EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs | 22 +- .../EqpTechnologyParameterService.cs | 8 +- .../EqpWorkshopChangeLogService.cs | 17 +- .../Tnb.EquipMgr/EquMaintainRecordService.cs | 130 ++-- .../Tnb.EquipMgr/EquSpotInsRecordService.cs | 114 ++-- .../Tnb.EquipMgr/EquSpotInsTemEquipService.cs | 13 +- EquipMgr/Tnb.EquipMgr/EquipmentService.cs | 55 +- .../Tnb.EquipMgr/MoldMaintainBaseService.cs | 8 +- EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj | 1 - EquipMgr/Tnb.EquipMgr/ToolMoldHouseService.cs | 9 +- .../Tnb.EquipMgr/ToolMoldLocationService.cs | 22 +- .../ToolMoldMaintainGroupService.cs | 17 +- .../ToolMoldMaintainPlanService.cs | 9 +- .../ToolMoldMaintainRuleService.cs | 23 +- .../ToolMoldMaintainRunService.cs | 48 +- .../ToolMoldMaintainTaskService.cs | 15 +- .../Tnb.EquipMgr/ToolMoldMaterialService.cs | 101 ++- .../ToolMoldRequisitionService.cs | 38 +- .../Tnb.EquipMgr/ToolMoldReturnService.cs | 8 +- EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs | 14 +- .../Dto/ProcessParamOutput.cs | 4 +- .../Dto/ProcessParamTypeChildrenOutput.cs | 2 +- .../Entity/PerProcessStandardsD.cs | 4 +- .../Entity/PerProcessStandardsH.cs | 2 +- .../IPerProcessParamService.cs | 3 +- .../IPerProcessParamTypeService.cs | 4 +- .../IPerProcessStandardsService.cs | 6 +- PerMgr/Tnb.PerMgr/PerProcessParamService.cs | 9 +- .../Tnb.PerMgr/PerProcessParamTypeService.cs | 80 +-- .../Tnb.PerMgr/PerProcessStandardsService.cs | 83 ++- PerMgr/Tnb.PerMgr/Tnb.PerMgr.csproj | 4 +- .../Consts/DictionaryConstants.cs | 12 +- .../Consts/ModuleConst.cs | 8 +- .../Dto/DictionaryTreeOutput.cs | 8 +- .../Dto/PrdManage/AddAndonInput.cs | 4 +- .../Dto/PrdManage/AndonPadListInput.cs | 4 +- .../Dto/PrdManage/AndonPadListOutput.cs | 20 +- .../Dto/PrdManage/AndonRecordInput.cs | 8 +- .../Dto/PrdManage/CloseDownStartInput.cs | 8 +- .../Dto/PrdManage/ClosedownHistoryOutput.cs | 8 +- .../Dto/PrdManage/ClosedownHistoryQuery.cs | 7 +- .../PrdManage/CountEstimatedEndTimeInput.cs | 12 +- .../Dto/PrdManage/EquipmentListOutput.cs | 8 +- .../Dto/PrdManage/FeedingRecordTreeOutput.cs | 6 +- .../Dto/PrdManage/GanntSaveInput.cs | 4 +- .../Dto/PrdManage/GenSubMoCrInput.cs | 10 +- .../Dto/PrdManage/GeneralOutstockInput.cs | 4 +- .../Dto/PrdManage/IcmoUpInput.cs | 10 +- .../Dto/PrdManage/KittingOutInput.cs | 34 +- .../Dto/PrdManage/KittingOutNewInput.cs | 12 +- .../MaterialPreparationPlanOutput.cs | 2 +- .../Dto/PrdManage/MaterialReceiptInput.cs | 24 +- .../Dto/PrdManage/MaterialReceiptNewInput.cs | 10 +- .../Dto/PrdManage/MoCrInput.cs | 8 +- .../Dto/PrdManage/MoldListOutput.cs | 11 +- .../Dto/PrdManage/PADPackageTaskPageOutput.cs | 36 +- .../Dto/PrdManage/PackPrdTaskUpInput.cs | 8 +- .../Dto/PrdManage/PackReportTreeOutput.cs | 7 +- .../Dto/PrdManage/PackSchedlingCrInput.cs | 10 +- .../PrdManage/PackScheldToBeIssueListInput.cs | 8 +- .../PackSechelToBeIssueListOutput.cs | 11 +- .../PrdManage/PackingSchedulingListOutput.cs | 8 +- .../Dto/PrdManage/PrdInstockInput.cs | 14 +- .../Dto/PrdManage/PrdMoFromOneListOutput.cs | 100 +-- .../Dto/PrdManage/PrdMoFromQueryInput.cs | 18 +- .../Dto/PrdManage/PrdMoListOuput.cs | 4 +- .../Dto/PrdManage/PrdMoListTreeOutput.cs | 11 +- .../Dto/PrdManage/PrdMoTaskDefectOutput.cs | 12 +- .../Dto/PrdManage/PrdMoTaskFromEqpIdInput.cs | 8 +- .../Dto/PrdManage/PrdMoTaskIssueListOutput.cs | 4 +- .../Dto/PrdManage/PrdMoTaskOutput.cs | 19 +- .../Dto/PrdManage/PrdMotreeOutput.cs | 7 +- .../Dto/PrdManage/PrdPackReportQueryInput.cs | 8 +- .../Dto/PrdManage/PrdReportCrInput.cs | 12 +- .../Dto/PrdManage/PrdReportOutput.cs | 10 +- .../Dto/PrdManage/PrdTaskOperInput.cs | 10 +- .../Dto/PrdManage/PrdTaskOperOutput.cs | 11 +- .../Dto/PrdManage/PrdTaskReleaseUpInput.cs | 8 +- .../Dto/PrdManage/PrdTaskSortOutput.cs | 13 +- .../PrdManage/ProductionSchedulingCrInput.cs | 16 +- .../Dto/PrdManage/ReportRecordListOutput.cs | 6 +- .../Dto/PrdManage/SelfTestScrappedInput.cs | 10 +- .../Dto/PrdManage/SwapMoldUpInput.cs | 8 +- .../Dto/PrdManage/TaskOperRecordOutput.cs | 9 +- .../Dto/PrdManage/TransferPlatformUpInput.cs | 9 +- .../Dto/PrdManage/UnPackSchedlingInput.cs | 8 +- .../Entity/AndonBreakDown.cs | 7 +- .../Entity/AndonInfo.cs | 11 +- .../Entity/AndonRecords.cs | 15 +- .../Entity/AndonTypecs.cs | 11 +- .../Entity/AppPrdMoTaskLogListOutput.cs | 6 +- .../Entity/AppPrdMoTaskOneListOutput.cs | 6 +- .../Entity/CheckMoldInput.cs | 2 +- .../Entity/MoldsEntity.cs | 5 +- .../Entity/PrdFeedingD.cs | 4 +- .../Entity/PrdInstockD.cs | 2 +- .../Entity/PrdInstockH.cs | 4 +- .../Entity/PrdMaterialReceiptD.cs | 6 +- .../Entity/PrdMaterialReceiptH.cs | 4 +- .../Entity/PrdMo.cs | 6 +- .../Entity/PrdMoTask.cs | 10 +- .../Entity/PrdMoTask.part.cs | 4 - .../Entity/PrdMoTaskLog.cs | 2 +- .../Entity/PrdOnwipTool.cs | 3 +- .../Entity/PrdReport.cs | 12 +- .../Entity/PrdScrapped.cs | 5 +- .../Entity/PrdTask.cs | 7 +- .../Entity/PrdTaskLog.cs | 5 +- .../Enums/Eagvmode.cs | 18 +- .../Enums/MoBehavior.cs | 13 +- .../Mapper/Mapper.cs | 2 - .../Tnb.ProductionMgr.Entities.csproj | 1 - .../IAndonRecordService.cs | 16 +- .../IAndonService.cs | 7 +- .../IPrdCancelCloseDownService.cs | 8 +- .../IPrdFeedingService.cs | 2 +- .../IPrdInstockService.cs | 6 +- .../IPrdKittingOutService.cs | 2 +- .../IPrdMoTaskIssueService.cs | 8 +- .../IPrdMoTaskService.cs | 8 +- .../IPrdPackReportService.cs | 8 +- .../IPrdTaskManageService.cs | 8 +- .../IProductionReportRecordService.cs | 8 +- .../IRedisDataService.cs | 9 +- .../IWorklineCommService.cs | 4 +- .../Tnb.ProductionMgr.Interfaces.csproj | 1 - .../APP/AppPrdMoTaskLogService.cs | 23 +- .../APP/AppPrdMoTaskOneService.cs | 15 +- .../APP/AppPrdMoTaskTwoService.cs | 19 +- .../Tnb.ProductionMgr/AndonRecordService.cs | 192 +++--- .../Tnb.ProductionMgr/AndonService.cs | 26 +- .../Tnb.ProductionMgr/AndonTypeService.cs | 11 +- .../PrdCancelCloseDownService.cs | 50 +- .../Tnb.ProductionMgr/PrdFeedingService.cs | 84 ++- .../Tnb.ProductionMgr/PrdInstockService.cs | 108 ++-- .../Tnb.ProductionMgr/PrdKittingOutService.cs | 71 +-- .../PrdMaterialReceiptService.cs | 42 +- .../Tnb.ProductionMgr/PrdMoService.cs | 309 ++++----- .../PrdMoTaskIssueService.cs | 46 +- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 602 +++++++++--------- .../Tnb.ProductionMgr/PrdOutstockService.cs | 48 +- .../Tnb.ProductionMgr/PrdPackReportService.cs | 126 ++-- .../Tnb.ProductionMgr/PrdTaskManageService.cs | 105 ++- .../ProductionReportRecordService.cs | 72 +-- .../Tnb.ProductionMgr/RedisBackGround.cs | 19 +- .../Tnb.ProductionMgr/RedisDataService.cs | 41 +- .../Tnb.ProductionMgr.csproj | 1 - .../WorkOrderSchedulingService.cs | 11 +- QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs | 8 +- QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs | 16 +- QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs | 8 +- QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs | 14 +- QcMgr/Tnb.QcMgr.Entities/Dto/CheckTaskData.cs | 10 +- QcMgr/Tnb.QcMgr.Entities/Dto/SpcData.cs | 9 +- QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs | 10 +- .../Entity/QcAqlSampleCode.cs | 7 +- .../Entity/QcAqlSamplePlan.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcCheckExecD.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcCheckExecH.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcCheckItem.cs | 7 +- .../Entity/QcCheckItemsD.cs | 7 +- .../Entity/QcCheckItemsH.cs | 7 +- .../Entity/QcCheckItemsR.cs | 7 +- .../Entity/QcCheckPlanAdd.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs | 9 +- .../Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs | 7 +- .../Entity/QcCheckPlanMaterial.cs | 7 +- .../Entity/QcCheckPlanProcess.cs | 7 +- .../Entity/QcCheckPlanWork.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcCheckType.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcErrorCause.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcErrorLevel.cs | 7 +- .../Tnb.QcMgr.Entities/Entity/QcSpcConfig.cs | 7 +- QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcD.cs | 7 +- QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcH.cs | 7 +- .../Entity/QcTriggerEvent.cs | 7 +- .../Entity/QcTriggerPlan.cs | 7 +- .../Enums/EnumTriggerType.cs | 8 +- .../Tnb.QcMgr.Entities.csproj | 1 - .../IQcCheckItemService.cs | 7 +- .../IQcCheckPlanService.cs | 9 +- .../IQcCheckTaskService.cs | 7 +- .../IQcCheckTypeService.cs | 9 +- QcMgr/Tnb.QcMgr.Interfaces/IQcSpcService.cs | 7 +- .../Tnb.QcMgr.Interfaces.csproj | 1 - QcMgr/Tnb.QcMgr/QcCheckItemService.cs | 21 +- QcMgr/Tnb.QcMgr/QcCheckPlanService.cs | 23 +- QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs | 21 +- QcMgr/Tnb.QcMgr/QcCheckTaskService.cs | 39 +- QcMgr/Tnb.QcMgr/QcCheckTypeService.cs | 16 +- QcMgr/Tnb.QcMgr/QcSpcService.cs | 30 +- QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj | 1 - Tnb.Server.sln | 30 - .../Attributes/CallerAttribute.cs | 8 +- .../Attributes/RelationalFieldAttribute.cs | 8 +- .../Attributes/ServiceModuleAttribute.cs | 8 +- .../Attributes/TimedAttribute.cs | 8 +- .../Configs/AgvRequestConfig.cs | 8 +- .../Configs/ElevatorControlConfiguration.cs | 8 +- .../Consts/ElevatorConsts.cs | 8 +- .../Consts/GenericEnumDicionary.cs | 9 +- .../Consts/WmsCarryConst.cs | 12 +- .../Consts/WmsWareHouseConst.cs | 14 +- .../Dto/Inputs/BarCodePrintInput.cs | 8 +- .../Dto/Inputs/ChainStatusReportingUpInput.cs | 8 +- .../Dto/Inputs/ConfirmInput.cs | 4 +- .../Dto/Inputs/ExChangeCarryInput.cs | 8 +- .../Dto/Inputs/GenPreTaskUpInput.cs | 12 +- .../Dto/Inputs/InOutStockApplyforUpInput.cs | 7 +- .../Dto/Inputs/MESCarryQueryInput.cs | 8 +- .../Dto/Inputs/MESCarryQueryResultInput.cs | 8 +- .../Dto/Inputs/MESCarrySignInput.cs | 2 +- .../Inputs/MESCollocationSchemeQueryInput.cs | 7 +- .../Dto/Inputs/MESCreateInstockInput.cs | 24 +- .../Dto/Inputs/MESCreateOutstockInput.cs | 16 +- .../Dto/Inputs/MESEmptyCarryInStockInput.cs | 18 +- .../Dto/Inputs/MESEmptyCarryOutStkInput.cs | 16 +- .../Dto/Inputs/MESKittingOutStkInput.cs | 36 +- .../Dto/Inputs/ModifyPoliciesStatusInput.cs | 7 +- .../Dto/Inputs/NotifyMessage.cs | 8 +- .../Dto/Inputs/RobotCallBackInput.cs | 8 +- .../Dto/Inputs/SacnBarCodeInStockInput.cs | 8 +- .../Dto/Inputs/SignForDeliveryInput.cs | 12 +- .../Dto/Inputs/TaskCallBackInput.cs | 6 +- .../Dto/Inputs/TaskChainCallBackInput.cs | 4 +- .../Dto/Inputs/TaskCompleUpInput.cs | 8 +- .../Dto/Inputs/TaskExecuteAfterUpInput.cs | 8 +- .../Dto/Inputs/TaskExecuteUpInput.cs | 8 +- .../Dto/Inputs/TimedtaskInput.cs | 8 +- .../Dto/Inputs/WareHouseUpInput.cs | 8 +- .../Dto/Outputs/CarryCodeDetailOutput.cs | 8 +- .../Dto/Outputs/CarryInfoOutput.cs | 10 +- .../Dto/Outputs/CarryQueryOutput.cs | 14 +- .../Dto/Outputs/CollocationSchemeOutput.cs | 11 +- .../Dto/Outputs/InStockDetailOutput.cs | 8 +- .../Dto/Outputs/MaterailLabelOutput.cs | 10 +- .../Dto/Outputs/OutStockDetailOutput.cs | 8 +- .../Dto/Outputs/Result.cs | 9 +- .../Dto/Queries/InOutStockDetailQuery.cs | 7 +- .../Dto/Queries/InStockStrategyQuery.cs | 8 +- .../Dto/Queries/MaterialLabelQuery.cs | 8 +- .../Dto/Queries/OutStockStrategyQuery.cs | 8 +- .../Entity/Constraints/IInOutStockCode.cs | 10 +- .../Entity/Constraints/IInOutStockDetail.cs | 7 +- .../Entity/Constraints/ITaskManagerDel.cs | 10 +- .../Constraints/IUpdatePoliciesStatus.cs | 8 +- .../Entity/Constraints/IWmsCarryEntity.cs | 8 +- .../Entity/Constraints/IWmsRoadEntity.cs | 8 +- .../Entity/WmsCarryCode.part.cs | 2 - .../Entity/WmsCarryH.cs | 1 - .../Entity/WmsCarryH.part.cs | 2 - .../Entity/WmsCheckstockD.part.cs | 2 - .../Entity/WmsDistaskH.part.cs | 2 - .../Entity/WmsElevatorH.cs | 3 +- .../Entity/WmsElevatorH.part.cs | 5 +- .../Entity/WmsInstockCode.cs | 3 - .../Entity/WmsInstockCode.part.cs | 6 - .../Entity/WmsInstockD.part.cs | 2 - .../Entity/WmsInstockPolicies.part.cs | 3 - .../Entity/WmsOutstockCode.part.cs | 4 - .../Entity/WmsOutstockPolicies.part.cs | 3 - .../Entity/WmsPretaskH.part.cs | 2 - .../Entity/WmsSetsortingH.part.cs | 2 - .../Entity/WmsStockReportH.part.cs | 8 +- .../Enums/EnumAgvControl.cs | 8 +- .../Enums/EnumAgvStatus.cs | 8 +- .../Enums/EnumCarryStatus.cs | 8 +- .../Enums/EnumCheckConclusion.cs | 7 +- .../Enums/EnumCheckStatus.cs | 8 +- .../Enums/EnumCheckType.cs | 8 +- .../Enums/EnumDoorStatus.cs | 8 +- .../Enums/EnumInOutStockType.cs | 12 +- .../Enums/EnumLocationType.cs | 8 +- .../Enums/EnumOutStatus.cs | 8 +- .../Enums/EnumRunStatus.cs | 8 +- .../Enums/EnumSysStatus.cs | 8 +- .../Enums/EnumTaskChainType.cs | 8 +- .../Enums/EnumWareHouseModule.cs | 12 +- .../Enums/TimeSpanUnit.cs | 8 +- .../Exceptions/TimedTaskException.cs | 7 +- .../Mapper/Mapper.cs | 6 +- .../Tnb.WarehouseMgr.Entities.csproj | 1 - .../IBasRegionUserService.cs | 8 +- .../IElevatorControlService.cs | 8 +- .../IPdaStroage.cs | 8 +- .../ITaskMessageNotify.cs | 7 +- .../IWHStorageService.cs | 7 +- .../IWareHouseService.cs | 9 +- .../IWmsCarryBindService.cs | 7 +- .../IWmsCarryLedgerService.cs | 8 +- .../IWmsCarryMoveInStockService.cs | 7 +- .../IWmsCarryQueryService.cs | 7 +- .../IWmsCarryService.cs | 3 +- .../IWmsCollocationSchemeSevice.cs | 7 +- .../IWmsDeliveryService.cs | 8 +- .../IWmsEmptyInstockService.cs | 7 +- .../IWmsEmptyOutstockService.cs | 9 +- .../IWmsFeedingService.cs | 8 +- .../IWmsInStockService.cs | 8 +- .../IWmsKittingInStkService.cs | 7 +- .../IWmsOutStockService.cs | 7 +- .../IWmsPDATransferSignService.cs | 8 +- .../IWmsPdaWHService.cs | 8 +- .../IWmsRouteMgrService.cs | 8 +- .../IWmsSetSortingService.cs | 8 +- .../IWmsSignForDeliveryService.cs | 8 +- .../IWmskittingOutService.cs | 7 +- .../Tnb.WarehouseMgr.Interfaces/Interface1.cs | 8 +- .../Tnb.WarehouseMgr.Interfaces.csproj | 1 - .../Tnb.WarehouseMgr/BasRegionUserService.cs | 9 +- .../Tnb.WarehouseMgr/BaseWareHouseService.cs | 30 +- .../BaseWareHouseService`1.cs | 8 +- .../Tnb.WarehouseMgr/DeviceProviderService.cs | 13 +- .../ElevatorControlService.cs | 12 +- .../TaskStatusChangeSubscriber.cs | 12 +- .../Extensions/BackgroundServiceExtensions.cs | 8 +- .../WareHouseBasedControllerActivator.cs | 17 +- .../Filters/NotifyFilterAttribute.cs | 7 +- .../LocationDefinitionService.cs | 33 +- .../PDATransferSignService.cs | 25 +- .../Tnb.WarehouseMgr/PcStroageService.cs | 11 +- .../Tnb.WarehouseMgr/PdaStroageService.cs | 9 +- .../Tnb.WarehouseMgr/Print/PPLBUtility.cs | 8 +- .../Tnb.WarehouseMgr/TaskManagerDelBase.cs | 8 +- .../Tnb.WarehouseMgr/TaskMesageNotify.cs | 7 +- .../TimedTaskBackgroundService.cs | 26 +- .../Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj | 1 - .../Tnb.WarehouseMgr/WareHouseService.cs | 8 +- .../Tnb.WarehouseMgr/WmsCarryBindService.cs | 15 +- .../Tnb.WarehouseMgr/WmsCarryLedgerService.cs | 31 +- .../WmsCarryMoveInStockService.cs | 15 +- .../WmsCarryMoveOutStockService.cs | 10 +- .../Tnb.WarehouseMgr/WmsCarryQueryService.cs | 13 +- .../Tnb.WarehouseMgr/WmsCarryService.cs | 8 +- .../Tnb.WarehouseMgr/WmsCarryUnbindService.cs | 16 +- .../Tnb.WarehouseMgr/WmsCheckTaskService.cs | 10 +- .../WmsCollocationSchemeSevice.cs | 12 +- .../Tnb.WarehouseMgr/WmsDeliveryService.cs | 11 +- .../Tnb.WarehouseMgr/WmsDistaskService.cs | 8 +- .../WmsEmptyInstockService.cs | 12 +- .../WmsEmptyOutstockService .cs | 12 +- .../Tnb.WarehouseMgr/WmsFeedingService.cs | 10 +- .../WmsInStockPoliciesService.cs | 7 +- .../Tnb.WarehouseMgr/WmsInStockService.cs | 16 +- .../WmsKittingInStkService.cs | 9 +- .../Tnb.WarehouseMgr/WmsOutBaleService.cs | 10 +- .../Tnb.WarehouseMgr/WmsOutStockService.cs | 19 +- .../Tnb.WarehouseMgr/WmsPDABindService.cs | 17 +- .../WmsPDACarryBindService.cs | 15 +- .../WmsPDACarryMoveInStockService.cs | 13 +- .../WmsPDACarryMoveOutStockService.cs | 10 +- .../WmsPDACarryReplaceService.cs | 27 +- .../WmsPDACarryUnbindService .cs | 18 +- .../Tnb.WarehouseMgr/WmsPDADeliveryService.cs | 12 +- .../WmsPDAEmptyInstockService.cs | 10 +- .../WmsPDAEmptyOutstockService .cs | 11 +- .../WmsPDAExceptionCancelService.cs | 22 +- .../WmsPDAExceptionCompleteService.cs | 21 +- .../WmsPDAExceptionReexcuteService.cs | 19 +- .../Tnb.WarehouseMgr/WmsPDAFeedingService.cs | 12 +- .../Tnb.WarehouseMgr/WmsPDAInStockService.cs | 17 +- .../Tnb.WarehouseMgr/WmsPDAInbaleService.cs | 14 +- .../WmsPDAKittingInStkService.cs | 20 +- .../WmsPDAOutBaleServiceService.cs | 16 +- .../WmsPDAScanInStockService.cs | 11 +- .../Tnb.WarehouseMgr/WmsPDATransferService.cs | 13 +- .../Tnb.WarehouseMgr/WmsPointService.cs | 14 +- .../Tnb.WarehouseMgr/WmsPretaskService.cs | 10 +- .../WmsRobotCallbackService.cs | 13 +- .../Tnb.WarehouseMgr/WmsRouteMgrService.cs | 18 +- .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 16 +- .../WmsSignForDeliveryService.cs | 12 +- .../Tnb.WarehouseMgr/WmsStockReportService.cs | 12 +- .../Tnb.WarehouseMgr/WmsTransferService.cs | 18 +- .../Tnb.WarehouseMgr/WmskittingOutService.cs | 21 +- .../Extensions/ConfigureEventBusExtensions.cs | 18 +- .../Extensions/ConfigureLoggingExtensions.cs | 123 ++-- .../ConfigureMvcControllerExtensions.cs | 31 +- .../Extensions/ConfigureSqlSugarExtensions.cs | 6 +- apihost/Tnb.API.Entry/Handlers/JwtHandler.cs | 1 - apihost/Tnb.API.Entry/Program.cs | 36 +- apihost/Tnb.API.Entry/Startup.cs | 14 +- apihost/Tnb.API.Entry/Tnb.API.Entry.csproj | 1 - app/Tnb.Apps.Entitys/Tnb.Apps.Entitys.csproj | 1 - .../Tnb.Apps.Interfaces.csproj | 1 - app/Tnb.Apps/AppMenuService.cs | 2 +- app/Tnb.Apps/Tnb.Apps.csproj | 1 - .../AuthRequests/AlipayMpAuthRequest.cs | 10 +- .../Request/AuthRequests/CodingAuthRequest.cs | 4 +- .../AuthRequests/DingTalkScanAuthRequest.cs | 9 +- .../Request/AuthRequests/DouYinAuthRequest.cs | 2 +- .../Request/AuthRequests/ElemeAuthRequest.cs | 8 +- .../Request/AuthRequests/FeiShuAuthRequest.cs | 4 +- .../Request/AuthRequests/GithubAuthRequest.cs | 2 +- .../Request/AuthRequests/GitlabAuthRequest.cs | 2 +- .../Request/AuthRequests/GoogleAuthRequest.cs | 2 +- .../Request/AuthRequests/HuaweiAuthRequest.cs | 4 +- .../AuthRequests/KujialeAuthRequest.cs | 2 +- .../AuthRequests/LinkedinAuthRequest.cs | 2 +- .../AuthRequests/MeituanAuthRequest.cs | 2 +- .../AuthRequests/MicrosoftAuthRequest.cs | 4 +- .../AuthRequests/PinterestAuthRequest.cs | 2 +- .../Request/AuthRequests/QQAuthRequest.cs | 2 +- .../Request/AuthRequests/RenrenAuthRequest.cs | 2 +- .../AuthRequests/StackOverflowAuthRequest.cs | 2 +- .../AuthRequests/TeambitionAuthRequest.cs | 4 +- .../AuthRequests/ToutiaoAuthRequest.cs | 2 +- .../WeChatEnterpriseAuthRequest.cs | 2 +- .../WeChatEnterpriseScanAuthRequest.cs | 2 +- .../AuthRequests/WeChatMpAuthRequest.cs | 6 +- .../AuthRequests/WeChatOpenAuthRequest.cs | 8 +- .../Request/AuthRequests/WeiboAuthRequest.cs | 4 +- .../Tnb.CollectiveOAuth.csproj | 2 - .../Utils/ConfigurationManager.cs | 4 +- .../Utils/GlobalAuthUtil.cs | 6 +- .../Constants/EventSubscribeEventConsts.cs | 8 +- .../Sources/TaskStatusChangeSource.cs | 8 +- .../Storers/RabbitMQEventSourceStorer.cs | 6 +- .../Filter/LogExceptionHandler.cs | 6 +- .../Filter/RequestActionFilter.cs | 12 +- .../Manager/DataBase/DataBaseManager.cs | 82 +-- .../Manager/DataBase/IDataBaseManager.cs | 2 +- .../Manager/Files/FileManager.cs | 6 +- .../Manager/User/UserManager.cs | 4 +- .../Manager/User/UserManager.part.cs | 20 +- common/Tnb.Common.Core/Tnb.Common.Core.csproj | 1 - common/Tnb.Common/Cache/MemoryCache.cs | 4 +- common/Tnb.Common/Cache/RedisCache.cs | 4 +- .../Captcha/General/GeneralCaptcha.cs | 6 +- common/Tnb.Common/Contracts/BaseEntity`1.cs | 10 +- common/Tnb.Common/Contracts/CEntityBase.cs | 1 - common/Tnb.Common/DataValidation/Check.cs | 11 +- .../VisualDev/VisualDevModelDataCrInput.cs | 2 +- common/Tnb.Common/Enums/AccountType.cs | 4 +- common/Tnb.Common/Enums/FileLocation.cs | 4 +- common/Tnb.Common/Enums/Gender.cs | 4 +- common/Tnb.Common/Enums/HttpStatusCode.cs | 4 +- common/Tnb.Common/Enums/LoginMethod.cs | 4 +- common/Tnb.Common/Enums/NoticeStatus.cs | 4 +- common/Tnb.Common/Enums/NoticeUserStatus.cs | 4 +- common/Tnb.Common/Enums/PreviewType.cs | 4 +- common/Tnb.Common/Enums/QueryType.cs | 4 +- common/Tnb.Common/Enums/RequestType.cs | 2 +- .../ConcurrentDictionaryExtensions.cs | 4 +- .../Extension/ConfigurationExtensions.cs | 7 +- .../Extension/DictionaryExtensions.cs | 3 +- common/Tnb.Common/Extension/EnumExtensions.cs | 6 +- .../Extension/EnumerableExtensions.cs | 7 +- .../Extension/LambdaExpressionExtensions.cs | 9 +- .../Tnb.Common/Extension/StreamExtensions.cs | 4 +- .../Extension/StringBuilderExtensions.cs | 4 +- .../Tnb.Common/Extension/StringExtensions.cs | 8 +- common/Tnb.Common/Extension/TaskExtensions.cs | 12 +- .../Extension/TnbStringExtensions.cs | 3 +- .../Models/NPOI/ExcelColumnModel.cs | 4 +- .../Models/SocialsLoginConfigModel.cs | 4 +- common/Tnb.Common/Net/IUserAgent.cs | 5 +- .../Options/ConfigureSwaggerUIOptions.cs | 7 +- common/Tnb.Common/Options/OauthOptions.cs | 5 +- common/Tnb.Common/Options/SocialsOptions.cs | 3 +- .../Security/CodeGenExportDataHelper.cs | 1 - .../Tnb.Common/Security/ExcelImportHelper.cs | 10 +- common/Tnb.Common/Security/FileHelper.cs | 10 +- common/Tnb.Common/Security/NetHelper.cs | 1 - common/Tnb.Common/Security/PinyinHelper.cs | 28 +- common/Tnb.Common/Security/QueryTreeHelper.cs | 4 +- .../Tnb.Common/Security/SnowflakeIdHelper.cs | 90 ++- .../Tnb.Common/Utils/DateTimeJsonConverter.cs | 6 +- common/Tnb.Common/Utils/DeepCopyHelper.cs | 7 +- common/Tnb.Common/Utils/Dijkstra.cs | 10 +- common/Tnb.Common/Utils/HttpClientHelper.cs | 12 +- .../Tnb.Common/Utils/ParameterCheckHelper.cs | 9 +- .../Utils/SkipNormalizationAttribute.cs | 8 +- ...alizationAttributeConventionalRegistrar.cs | 11 +- common/Tnb.Common/Utils/ThrowIf.cs | 196 +++--- .../Extensions/TenantLinkExtensions.cs | 1 - .../Internal/SqlSugarPagedList.cs | 2 +- .../Repositories/ISqlSugarRepository.cs | 2 - .../Repositories/SqlSugarRepository.cs | 1 - common/Tnb.SqlSugar/Tnb.SqlSugar.csproj | 1 - common/Tnb.Thirdparty/Email/MailUtil.cs | 2 +- common/Tnb.Thirdparty/Tnb.Thirdparty.csproj | 1 - .../Middlewares/WebSocketMiddleware.cs | 3 +- common/Tnb.WebSockets/Tnb.WebSockets.csproj | 1 - .../Dto/MessageAccount/EmailSendTestQuery.cs | 4 +- message/Tnb.Message.Entitys/Mapper/Mapper.cs | 1 - .../Tnb.Message.Entitys.csproj | 1 - .../Tnb.Message.Interfaces.csproj | 1 - message/Tnb.Message/Service/ImReplyService.cs | 4 +- .../Service/MessageDataTypeService.cs | 11 +- .../Service/MessageMonitorService.cs | 2 - message/Tnb.Message/Service/MessageService.cs | 4 +- .../Service/MessageTemplateService.cs | 2 +- .../Tnb.Message/Service/SendMessageService.cs | 8 +- .../Tnb.Message/Service/ShortLinkService.cs | 4 +- .../Tnb.Message/Service/WechatOpenService.cs | 6 +- message/Tnb.Message/Tnb.Message.csproj | 1 - system/Tnb.OAuth/Dto/CurrentUserOutput.cs | 1 - system/Tnb.OAuth/Dto/LockScreenInput.cs | 4 +- system/Tnb.OAuth/Dto/LoginInput.cs | 4 +- system/Tnb.OAuth/OAuthService.cs | 38 +- system/Tnb.OAuth/Tnb.OAuth.csproj | 1 - .../Department/DepartmentCrInput.cs | 1 - .../OrganizeAdminIsTratorCrInput.cs | 2 +- .../Socials/SocialsUserListOutput.cs | 5 +- .../User/GetDefaultCurrentValueInput.cs | 3 +- .../Dto/Permission/User/UserListAllOutput.cs | 1 - .../UsersCurrent/UsersCurrentInfoUpInput.cs | 1 - .../UsersCurrentSystemLogOutput.cs | 4 +- .../Dto/System/ComFields/ComFieldsUpInput.cs | 4 +- .../DataBase/DatabaseTableDataCleanInput.cs | 9 +- .../DataSync/DbSyncActionsExecuteInput.cs | 2 +- .../Dto/System/DataSync/DbSyncOutput.cs | 2 +- .../InterfaceOauth/InterfaceOauthInput.cs | 4 +- .../InterfaceOauth/InterfaceOauthOutput.cs | 7 +- .../Dto/System/PrintDev/PrintDevListOutput.cs | 3 +- .../Dto/System/SysConfig/SetAdminInput.cs | 4 +- .../Dto/System/SysLog/LogExceptionOutput.cs | 3 +- .../Entity/Permission/OrganizeEntity.part.cs | 5 +- .../Entity/Permission/SignImgEntity.cs | 3 +- .../Entity/Permission/TenantSocialsEntity.cs | 3 +- .../Entity/Permission/UserEntity.cs | 3 +- .../Entity/Permission/UserEntity.part.cs | 4 +- .../Entity/Permission/UserRelationEntity.cs | 3 +- .../Entity/System/SmsTemplateEntity.cs | 3 +- .../Entity/System/SynThirdInfoEntity.cs | 3 +- .../Entity/System/SysConfigEntity.cs | 3 +- .../Entity/System/TimeTaskEntity.cs | 3 +- .../Entity/System/TimeTaskLogEntity.cs | 3 +- system/Tnb.Systems.Entitys/Enum/AreaType.cs | 4 +- .../Tnb.Systems.Entitys/Enum/ErrorStrategy.cs | 4 +- .../Tnb.Systems.Entitys/Enum/MenuCategory.cs | 4 +- system/Tnb.Systems.Entitys/Enum/MenuType.cs | 4 +- system/Tnb.Systems.Entitys/Enum/SysConfig.cs | 4 +- .../Mapper/ConnectionMapper.cs | 7 +- .../SocialsUser/SocialsUserModel.cs | 2 +- .../Model/System/DataBase/DbEntityInfo.cs | 2 - .../System/DataBase/DynamicDbTableModel.cs | 4 +- .../Tnb.Systems.Entitys.csproj | 1 - .../Common/IFileService.cs | 5 +- .../Permission/IOrganizeService.cs | 2 +- .../Permission/ISocialsUserService.cs | 2 +- .../Permission/IUserRelationService.cs | 3 +- .../Permission/IUsersService.cs | 4 +- .../System/IDataInterfaceService.cs | 4 +- .../System/IModuleColumnService.cs | 3 +- .../Tnb.Systems.Interfaces.csproj | 1 - system/Tnb.Systems/Common/HeartbeatService.cs | 27 +- system/Tnb.Systems/Common/SampleService.cs | 20 +- system/Tnb.Systems/Common/TestService.cs | 20 +- .../Permission/AuthorizeService.cs | 4 +- .../Permission/DepartmentService.cs | 30 +- system/Tnb.Systems/Permission/GroupService.cs | 2 +- .../OrganizeAdministratorService.cs | 16 +- .../Tnb.Systems/Permission/OrganizeService.cs | 35 +- .../Tnb.Systems/Permission/PositionService.cs | 1 - .../Permission/SocialsUserService.cs | 3 +- .../Permission/UserRelationService.cs | 2 +- .../Permission/UsersCurrentService.cs | 18 +- system/Tnb.Systems/Permission/UsersService.cs | 25 +- system/Tnb.Systems/System/BillRuleService.cs | 2 +- .../System/DataInterfaceService.cs | 18 +- system/Tnb.Systems/System/DataSyncService.cs | 2 +- .../System/DictionaryDataService.cs | 3 +- .../System/InterfaceOauthService.cs | 2 +- .../Tnb.Systems/System/ModuleColumnService.cs | 9 +- .../System/ModuleDataAuthorizeService.cs | 1 - .../Tnb.Systems/System/ModuleFormService.cs | 1 - system/Tnb.Systems/System/MonitorService.cs | 5 +- system/Tnb.Systems/System/PrintDevService.cs | 10 +- system/Tnb.Systems/System/PrintLogService.cs | 4 +- system/Tnb.Systems/System/ProvinceService.cs | 1 - system/Tnb.Systems/System/SysLogService.cs | 4 +- system/Tnb.Systems/System/SystemService.cs | 4 +- system/Tnb.Systems/Tnb.Systems.csproj | 1 - .../Dto/TaskScheduler/TimeTaskUpInput.cs | 2 +- .../Entity/SnowId.cs | 4 +- .../Entity/TimeTaskEntity.cs | 3 +- .../Mapper/Mapper.cs | 1 - .../Tnb.TaskScheduler.Entitys.csproj | 1 - .../Tnb.TaskScheduler.Interfaces.csproj | 1 - .../GenerateMaintainPlanTimeWorker.cs | 29 +- .../GenerateSpEquipCheckPlanTimeWorker.cs | 35 +- .../GenerateSpotInspectionPlanTimeWorker.cs | 31 +- .../Listener/MoldMaintainTask.cs | 21 +- .../Listener/PushMsgTimeWorker.cs | 50 +- .../Listener/QcTaskTimeWorker.cs | 16 +- .../Tnb.TaskScheduler/TimeTaskService.cs | 18 +- .../Tnb.TaskScheduler.csproj | 1 - .../Tnb.Vengine/AppService/BaseAppService.cs | 5 - .../AppService/VengineAppService.cs | 2 +- .../AppService/VengineAppServiceT.cs | 1 - .../AppService/VmodelAppService.cs | 3 +- .../CodeGenerator/TemplateContext.cs | 1 - .../Tnb.Vengine/DataAccess/DataAccess.cs | 2 - visualdev/Tnb.Vengine/Domain/VmQueryParser.cs | 9 +- .../Core/FormDataParsing.cs | 9 +- .../Model/IndexSearchFieldModel.cs | 1 - .../IOverideVisualDevService.cs | 55 +- .../OverideVisualDevAttribute.cs | 26 +- .../OverideVisualDev/OverideVisualDevFunc.cs | 39 +- .../OverideVisualDevManager.cs | 48 +- ...ideVisualDevServiceCollectionExtensions.cs | 38 +- .../BackEnd/CodeGenControlsAttributeHelper.cs | 3 +- .../BackEnd/GetCodeGenIndexButtonHelper.cs | 4 +- .../Tnb.VisualDev.Engine.csproj | 1 - .../Dto/Dashboard/EmailHomeOutput.cs | 22 + .../Dto/Screen/ScreenInfoOutput.cs | 4 +- .../VisualDevModelListQueryInput.cs | 2 +- .../Entity/EmailReceiveEntity.cs | 93 +++ .../Entity/VisualCategoryEntity.cs | 3 +- .../Entity/VisualEntity.cs | 3 +- .../Tnb.VisualDev.Entitys.csproj | 1 - .../Tnb.VisualDev.Interfaces.csproj | 1 - .../CodeGen/DataParsing/ControlParsing.cs | 12 +- visualdev/Tnb.VisualDev/CodeGenService.cs | 34 +- visualdev/Tnb.VisualDev/DashboardService.cs | 3 +- visualdev/Tnb.VisualDev/HmiService.cs | 8 +- visualdev/Tnb.VisualDev/PortalService.cs | 4 +- visualdev/Tnb.VisualDev/RunService.cs | 4 +- visualdev/Tnb.VisualDev/Tnb.VisualDev.csproj | 1 - visualdev/Tnb.VisualDev/VisualDevService.cs | 10 +- .../Dto/FlowBefore/FlowBeforeInfoOutput.cs | 2 +- .../Dto/FlowMonitor/FlowMonitorListOutput.cs | 2 +- .../LeaveApply/LeaveApplyInput.cs | 3 +- .../WorkFlowForm/SalesOrderEntryEntity.cs | 4 +- .../Tnb.WorkFlow.Entitys/Mapper/Mapper.cs | 1 - .../Model/Conifg/FuncConfig.cs | 1 - .../Model/Conifg/MsgConfig.cs | 1 - .../Tnb.WorkFlow.Entitys.csproj | 1 - .../Service/IFlowTaskService.cs | 7 +- .../Service/IFlowTemplateService.cs | 3 +- .../Service/ILeaveApplyService.cs | 4 +- .../Tnb.WorkFlow.Interfaces.csproj | 1 - .../Tnb.WorkFlow/Manager/FlowTaskMsgUtil.cs | 8 +- .../Tnb.WorkFlow/Manager/FlowTaskOtherUtil.cs | 8 +- .../Repository/FlowTaskRepository.cs | 9 +- .../Tnb.WorkFlow/Service/FlowBeforeService.cs | 6 +- .../Service/FlowDelegateService.cs | 2 +- .../Tnb.WorkFlow/Service/FlowEngineService.cs | 4 +- .../Tnb.WorkFlow/Service/FlowFormService.cs | 3 - .../Tnb.WorkFlow/Service/FlowLaunchService.cs | 2 +- .../Tnb.WorkFlow/Service/FlowTaskService.cs | 1 - .../Service/FlowTemplateService.cs | 2 - workflow/Tnb.WorkFlow/Tnb.WorkFlow.csproj | 1 - .../WorkFlowForm/LeaveApplyService.cs | 1 - .../WorkFlowForm/SalesOrderService.cs | 1 - 810 files changed, 3910 insertions(+), 6695 deletions(-) create mode 100644 visualdev/Tnb.VisualDev.Entitys/Dto/Dashboard/EmailHomeOutput.cs create mode 100644 visualdev/Tnb.VisualDev.Entitys/Entity/EmailReceiveEntity.cs diff --git a/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs index 494db034..171f491c 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/CodeTemplateConst.cs @@ -9,7 +9,7 @@ namespace Tnb.BasicData /// 物料签收编码 /// public const string MATERIAL_RECEIPT_CODE = "MaterialReceipt"; - + /// /// 生产投料编码 /// @@ -24,17 +24,17 @@ namespace Tnb.BasicData /// 备件领用 /// public const string SPAREPARTSREQUISITION_CODE = "SparePartsRequisition"; - + /// /// 生产齐套领料 /// public const string PRDKITTINGOUTSTOCK_CODE = "PrdKittingOutStocK"; - + /// /// 设备维修单 /// public const string EQPREPAIR_CODE = "EqpRepair"; - - + + } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DbTimeFormat.cs b/BasicData/Tnb.BasicData.Entities/Consts/DbTimeFormat.cs index 640564f5..a9ec1d59 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/DbTimeFormat.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/DbTimeFormat.cs @@ -6,7 +6,7 @@ namespace Tnb.BasicData /// 2024-10-27 10:10 /// public const string MM = "yyyy-MM-dd HH:mi"; - + /// /// 2024-10-27 10:10:10 /// diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs index 69611399..ab3fad04 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs @@ -76,7 +76,7 @@ public static class DictConst /// 工单状态-code /// public const string MoTaskStatusCode = "OrderStatus"; - + /// /// 工单状态 已下发字典Id /// @@ -137,12 +137,12 @@ public static class DictConst /// 任务单状态key /// public const string TaskStatus = "TaskStatus"; - + /// /// andon状态key /// public const string AndonStatus = "AndonStatus"; - + /// /// andon状态呼叫中 /// @@ -168,17 +168,17 @@ public static class DictConst /// 产成品入库单 /// public const string CHANCHENGPINRUKUDAN = "40"; - + /// /// 生产领料单 /// public const string SHENGCHANLINGLIAO = "23"; - + /// /// 生产补料单 /// public const string SHENGCHANBULIAO = "24"; - + #endregion diff --git a/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs index 9b46621b..1b16c47f 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/FactoryConfigConst.cs @@ -9,7 +9,7 @@ namespace Tnb.BasicData /// 报工是否允许超过工单计划数 是:1 否 :0 /// public const string IS_SURPASS = "is_surpass"; - + /// /// 报工允许超过工单计划数百分比 例:填写10就是10% /// diff --git a/BasicData/Tnb.BasicData.Entities/Consts/ModuleConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/ModuleConst.cs index 20eb49d8..3f0bbdf7 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/ModuleConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/ModuleConst.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData; +namespace Tnb.BasicData; public class ModuleConst { diff --git a/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs index e29717ed..59f584f4 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs @@ -5,17 +5,17 @@ namespace Tnb.BasicData #region wms //mes生产入库接口 - public const string MES_CREATE_INSTOCK = "/api/wms/wms-in-stock/mes-create-instock"; - + public const string MES_CREATE_INSTOCK = "/api/wms/wms-in-stock/mes-create-instock"; + //载具签收接口 - public const string MES_CARRY_SIGN = "/api/wms/wms-sign-for-delivery/mes-carry-sign"; - + public const string MES_CARRY_SIGN = "/api/wms/wms-sign-for-delivery/mes-carry-sign"; + //生产出库接口 - public const string MES_CREATE_OUTSTOCK = "/api/wms/wms-out-stock/mes-create-outstock"; - + public const string MES_CREATE_OUTSTOCK = "/api/wms/wms-out-stock/mes-create-outstock"; + //齐套出库接口 - public const string MES_KITTING_OUT_STK = "/api/wms/wmskitting-out/mes-kitting-out-stk"; - + public const string MES_KITTING_OUT_STK = "/api/wms/wmskitting-out/mes-kitting-out-stk"; + //物料标签查询接口 public const string MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE = "/api/wms/wms-in-stock/mes-fetch-in-out-stock-info-by-bar-code"; diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarInput.cs index c2faa9be..4cf8c782 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entities.Dto +namespace Tnb.BasicData.Entities.Dto { public class CalendarInput { @@ -12,9 +6,9 @@ namespace Tnb.BasicData.Entities.Dto public string? datetype { get; set; } public string? workhour { get; set; } public string? worktype { get; set; } - public int? calendartype { get; set;} + public int? calendartype { get; set; } - public string? content { get; set;} + public string? content { get; set; } } public class CalendarBatchInput { diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarOut.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarOut.cs index 70c527c3..da4b6bee 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarOut.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasCalendar/CalendarOut.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entities.Dto.BasCalendar +namespace Tnb.BasicData.Entities.Dto.BasCalendar { public class CalendarOut { diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs index 33d28b4d..7e03704a 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/EsopHistoryListQueryInput.cs @@ -4,7 +4,7 @@ namespace Tnb.BasicData.Entities.Dto { public string mbom_id { get; set; } = string.Empty; public string mbom_process_id { get; set; } = string.Empty; - + /// /// 当前页码:pageIndex. /// @@ -14,7 +14,7 @@ namespace Tnb.BasicData.Entities.Dto /// 每页行数. /// public virtual int pageSize { get; set; } = 50; - + public string? queryJson { get; set; } } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs index 7a36813c..0f9b2daf 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasESop/UploadNewVersionInput.cs @@ -25,9 +25,9 @@ namespace Tnb.BasicData.Entities.Dto /// 附件对象. /// public string attachment { get; set; } = string.Empty; - + public string version { get; set; } = string.Empty; - + /// /// 备注 /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs index 15303f02..fc446c5c 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeOutput.cs @@ -30,54 +30,54 @@ namespace Tnb.BasicData.Entities.Dto /// 是否有下级 /// public bool hasChildren { get; set; } - + /// /// Desc:投料管控 /// Default:NULL::character varying /// Nullable:True /// - public string? feeding_control {get;set;} - + public string? feeding_control { get; set; } + /// /// Desc:损耗率 /// Default:NULL::character varying /// Nullable:True /// - public string? loss_rate {get;set;} - + public string? loss_rate { get; set; } + /// /// /// 数量 /// public decimal quantity { get; set; } - + /// /// Desc:需要称量 /// Default:NULL::character varying /// Nullable:True /// - public string? require_weight {get;set;} - + public string? require_weight { get; set; } + /// /// Desc:替代物料 /// Default:NULL::character varying /// Nullable:True /// - public string? substitute_material_id {get;set;} - + public string? substitute_material_id { get; set; } + /// /// Desc:工艺路线 /// Default:NULL::character varying /// Nullable:True /// - public string? route_name {get;set;} - + public string? route_name { get; set; } + /// /// Desc:版本号 /// Default:NULL::character varying /// Nullable:True /// - public string? version {get;set;} - + public string? version { get; set; } + } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeQueryInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeQueryInput.cs index 7bfe858f..0e29e017 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeQueryInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasEbom/EbomTreeQueryInput.cs @@ -10,8 +10,8 @@ namespace Tnb.BasicData.Entities.Dto /// 物料id /// public string? materialId { get; set; } - - - + + + } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialQueryInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialQueryInput.cs index 7e5fd547..82b6ecf3 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialQueryInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialQueryInput.cs @@ -12,7 +12,7 @@ namespace Tnb.BasicData.Entities.Dto /// 物料类型 /// public string types { get; set; } = string.Empty; - + /// /// 当前页码:pageIndex. /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectOutput.cs index 4838899a..bdfdf94e 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectOutput.cs @@ -9,27 +9,27 @@ namespace Tnb.BasicData.Entities.Dto /// 物料id /// public string? id { get; set; } - + /// /// 编码 /// public string? code { get; set; } - + /// /// 名称 /// - public string? name { get; set; } - + public string? name { get; set; } + /// /// 描述 /// public string? descrip { get; set; } - + /// /// 主单位id /// public string? unit_id { get; set; } - + /// /// 主单位名称 /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectQueryInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectQueryInput.cs index 45394189..e5a3a034 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectQueryInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMaterial/MaterialSelectQueryInput.cs @@ -11,7 +11,7 @@ namespace Tnb.BasicData.Entities.Dto /// 物料编码名称查询 /// public string material_info { get; set; } = string.Empty; - + /// /// 当前页码:pageIndex. /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs index 1698923a..6862e074 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomDataOutput.cs @@ -1,5 +1,3 @@ -using Tnb.BasicData.Entities; - namespace Tnb.BasicData.Entities.Dto { public class MbomDataOutput @@ -8,57 +6,57 @@ namespace Tnb.BasicData.Entities.Dto /// 生产bomid /// public string? id { get; set; } - + /// /// 物料id /// public string? material_id { get; set; } - + /// /// 数量 /// public int num { get; set; } - + /// /// 单位id /// public string? unit_id { get; set; } - + /// /// 版本号 /// public string? version { get; set; } - + /// /// 有效开始时间 /// public DateTime? start_time { get; set; } - + /// /// 有效结束时间 /// public DateTime? end_time { get; set; } - + /// /// 物料清单id /// public string? ebom_id { get; set; } - + /// /// 工艺路线id /// public string? route_id { get; set; } - + /// /// 物料均再首道工序投产 /// public int? is_first { get; set; } - + /// /// 备注 /// public string? remark { get; set; } - + /// /// 工序 /// @@ -68,24 +66,24 @@ namespace Tnb.BasicData.Entities.Dto public class MbomProcessOutDto { public string id { get; set; } = string.Empty; - + /// /// Desc:生产bomid /// Default: /// Nullable:False /// public string? mbom_id { get; set; } - + /// /// 工序编号 /// public string? no { get; set; } - + /// /// 上道工序编号 /// public string? last_process_no { get; set; } - + /// /// 下道工序编号 /// @@ -111,26 +109,26 @@ namespace Tnb.BasicData.Entities.Dto /// Nullable:True /// public string? station { get; set; } - + /// /// Desc:副产出管控 0 不启用 1 启用 /// Default: /// Nullable:False /// public int byproduct_status { get; set; } - + /// /// Desc:投产方式 /// Default:NULL::character varying /// Nullable:True /// - public string? production_method {get;set;} - + public string? production_method { get; set; } + /// /// 投入物料 /// public List? inputs { get; set; } - + /// /// 产出物料 /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs index 4c6552a8..aa3bd507 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasMbom/MbomSaveDataInput.cs @@ -1,5 +1,3 @@ -using Tnb.BasicData.Entities; - namespace Tnb.BasicData.Entities.Dto { public class MbomSaveDataInput @@ -8,57 +6,57 @@ namespace Tnb.BasicData.Entities.Dto /// 生产bomid /// public string id { get; set; } = string.Empty; - + /// /// 物料id /// public string material_id { get; set; } = string.Empty; - + /// /// 数量 /// public int num { get; set; } - + /// /// 单位id /// public string unit_id { get; set; } = string.Empty; - + /// /// 版本号 /// public string version { get; set; } = string.Empty; - + /// /// 有效开始时间 /// public DateTime? start_time { get; set; } - + /// /// 有效结束时间 /// public DateTime? end_time { get; set; } - + /// /// 物料清单id /// public string ebom_id { get; set; } = string.Empty; - + /// /// 工艺路线id /// public string route_id { get; set; } = string.Empty; - + /// /// 物料均再首道工序投产 /// public int is_first { get; set; } - + /// /// 备注 /// public string remark { get; set; } = string.Empty; - + /// /// 工序 /// @@ -68,7 +66,7 @@ namespace Tnb.BasicData.Entities.Dto public class MbomProcessDto { public string id { get; set; } = string.Empty; - + /// /// Desc:生产bomid /// Default: @@ -82,17 +80,17 @@ namespace Tnb.BasicData.Entities.Dto /// Nullable:False /// public string? process_id { get; set; } - + /// /// 工序编号 /// public string? no { get; set; } - + /// /// 上道工序编号 /// public string? last_process_no { get; set; } - + /// /// 下道工序编号 /// @@ -111,31 +109,31 @@ namespace Tnb.BasicData.Entities.Dto /// Nullable:True /// public string? station { get; set; } - + /// /// Desc:副产出管控 0 不启用 1 启用 /// Default: /// Nullable:False /// public int byproduct_status { get; set; } - + /// /// 工艺路线子表id /// public string route_detail_id { get; set; } = string.Empty; - + /// /// Desc:投产方式 /// Default:NULL::character varying /// Nullable:True /// - public string? production_method {get;set;} - + public string? production_method { get; set; } + /// /// 投入物料 /// public List? inputs { get; set; } - + /// /// 产出物料 /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessListOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessListOutput.cs index 390f2f02..22000b8e 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessListOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entitys.Dto.BasProcess +namespace Tnb.BasicData.Entitys.Dto.BasProcess { /// /// 工序列表输出类 @@ -14,7 +8,7 @@ namespace Tnb.BasicData.Entitys.Dto.BasProcess public string id { get; set; } public string process_code { get; set; } public string process_name { get; set; } - public string process_collection { get; set;} + public string process_collection { get; set; } public string status { get; set; } public string station { get; set; } public string must_pass { get; set; } @@ -27,6 +21,6 @@ namespace Tnb.BasicData.Entitys.Dto.BasProcess public string org_id { get; set; } public string create_id { get; set; } public string modify_id { get; set; } - public DateTime? modify_time { get; set;} + public DateTime? modify_time { get; set; } } } diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessStationInput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessStationInput.cs index ea21a076..010b0d57 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessStationInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasProcess/ProcessStationInput.cs @@ -6,7 +6,7 @@ namespace Tnb.BasicData.Entities.Dto /// 工序id /// public string? process_id { get; set; } - + /// /// 工位id集合 /// diff --git a/BasicData/Tnb.BasicData.Entities/Dto/BasRoute/VaildRouteOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/BasRoute/VaildRouteOutput.cs index 040ab357..622d4515 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/BasRoute/VaildRouteOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/BasRoute/VaildRouteOutput.cs @@ -3,13 +3,13 @@ namespace Tnb.BasicData.Entities.Dto public class VaildRouteOutput { public string? id { get; set; } - + public string? code { get; set; } - + public string? name { get; set; } public string start_time { get; set; } = string.Empty; - + public string end_time { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entities/Dto/ElementSelectDto.cs b/BasicData/Tnb.BasicData.Entities/Dto/ElementSelectDto.cs index bfeaa24d..2f6d23c5 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/ElementSelectDto.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/ElementSelectDto.cs @@ -2,8 +2,8 @@ namespace Tnb.BasicData.Entitys { public class ElementSelectDto { - public string?label { get; set; } - + public string? label { get; set; } + public string? value { get; set; } } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Entities/Dto/ProcessManage/RouteLineTreeOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/ProcessManage/RouteLineTreeOutput.cs index aab0daec..0cdeeee1 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/ProcessManage/RouteLineTreeOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/ProcessManage/RouteLineTreeOutput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Security; +using JNPF.Common.Security; namespace Tnb.BasicData.Entities.Dto { diff --git a/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs b/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs index 27de3443..f2f1d541 100644 --- a/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Dto/SubBomListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entities.Dto +namespace Tnb.BasicData.Entities.Dto { /// /// 子工单列表 @@ -34,7 +28,7 @@ namespace Tnb.BasicData.Entities.Dto /// /// 数量 /// - public string num { get; set;} + public string num { get; set; } /// /// 单位id /// @@ -64,7 +58,7 @@ namespace Tnb.BasicData.Entities.Dto /// 工序排序序号 /// public long? ordinal { get; set; } - + /// /// 生产bom工序id /// diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasCalendar.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasCalendar.cs index 06066055..4050fdc2 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasCalendar.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasCalendar.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs index 42fff12b..375db58b 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasLocation.cs @@ -1,7 +1,6 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; -using SqlSugar.DbConvert; namespace Tnb.BasicData.Entities; @@ -44,7 +43,7 @@ public partial class BasLocation : BaseEntity /// 是否使用 /// //[SugarColumn(ColumnDataType = "varchar(32)", SqlParameterDbType = typeof(CommonPropertyConvert))] - public string is_use { get; set; } + public string is_use { get; set; } /// /// 是否最小 diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs index b9147f91..847f2e4d 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMaterial.cs @@ -248,7 +248,7 @@ public partial class BasMaterial : BaseEntity /// 是否包含入库数 /// public int? is_contain_into_num { get; set; } - + /// /// 是否创建子工单 /// diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomInput.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomInput.cs index ba4adbed..6769d48a 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomInput.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomInput.cs @@ -43,7 +43,7 @@ public partial class BasMbomInput : BaseEntity /// 数量 /// public decimal num { get; set; } - + /// /// 单位id /// diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomOutput.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomOutput.cs index 8dfa838f..8ade2a09 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomOutput.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomOutput.cs @@ -43,7 +43,7 @@ public partial class BasMbomOutput : BaseEntity /// 产出数量(可小数分数) /// public string num { get; set; } = string.Empty; - + /// /// 单位id /// diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs index 8ee30b99..c2078542 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasMbomProcess.cs @@ -53,7 +53,7 @@ public partial class BasMbomProcess : BaseEntity /// 工艺路线子表id /// public string route_detail_id { get; set; } = string.Empty; - + /// /// 是否时最后一道工序 /// @@ -63,7 +63,7 @@ public partial class BasMbomProcess : BaseEntity /// 排序 /// public int ordinal { get; set; } - + /// /// 工序编号 /// diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasRouteD.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasRouteD.cs index ea695f32..111fb9cf 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasRouteD.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasRouteD.cs @@ -113,7 +113,7 @@ public partial class BasRouteD : BaseEntity /// 产出比 /// public decimal? output_ratio { get; set; } - + /// /// 工序编号 /// diff --git a/BasicData/Tnb.BasicData.Entities/Entity/BasShiftWorkgroup.cs b/BasicData/Tnb.BasicData.Entities/Entity/BasShiftWorkgroup.cs index deb24b43..378b141b 100644 --- a/BasicData/Tnb.BasicData.Entities/Entity/BasShiftWorkgroup.cs +++ b/BasicData/Tnb.BasicData.Entities/Entity/BasShiftWorkgroup.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/BasicData/Tnb.BasicData.Entities/Enums/EnumCalendarType.cs b/BasicData/Tnb.BasicData.Entities/Enums/EnumCalendarType.cs index 03afed7b..f1d512fb 100644 --- a/BasicData/Tnb.BasicData.Entities/Enums/EnumCalendarType.cs +++ b/BasicData/Tnb.BasicData.Entities/Enums/EnumCalendarType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entities.Enums +namespace Tnb.BasicData.Entities.Enums { public enum EnumCalendarType { diff --git a/BasicData/Tnb.BasicData.Entities/Enums/EnumLocationType.cs b/BasicData/Tnb.BasicData.Entities/Enums/EnumLocationType.cs index 8e021211..27dc426f 100644 --- a/BasicData/Tnb.BasicData.Entities/Enums/EnumLocationType.cs +++ b/BasicData/Tnb.BasicData.Entities/Enums/EnumLocationType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entities.Enums +namespace Tnb.BasicData.Entities.Enums { /// /// 库位类型 diff --git a/BasicData/Tnb.BasicData.Entities/Mapper/Mapper.cs b/BasicData/Tnb.BasicData.Entities/Mapper/Mapper.cs index 12c508bc..3200bb9d 100644 --- a/BasicData/Tnb.BasicData.Entities/Mapper/Mapper.cs +++ b/BasicData/Tnb.BasicData.Entities/Mapper/Mapper.cs @@ -1,5 +1,4 @@ using Mapster; -using SqlSugar; using Tnb.BasicData.Entities.Dto; namespace Tnb.BasicData.Entities diff --git a/BasicData/Tnb.BasicData.Entities/Model/RouteModel.cs b/BasicData/Tnb.BasicData.Entities/Model/RouteModel.cs index 83c5553a..91c2ded3 100644 --- a/BasicData/Tnb.BasicData.Entities/Model/RouteModel.cs +++ b/BasicData/Tnb.BasicData.Entities/Model/RouteModel.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.BasicData.Entitys.Model +namespace Tnb.BasicData.Entitys.Model { - public class RouteTree + public class RouteTree { /// /// 工艺路线类型 @@ -19,7 +13,7 @@ namespace Tnb.BasicData.Entitys.Model } - public class RouteName + public class RouteName { public string Tag { get; set; } /// @@ -29,5 +23,5 @@ namespace Tnb.BasicData.Entitys.Model } - + } diff --git a/BasicData/Tnb.BasicData.Entities/Tnb.BasicData.Entities.csproj b/BasicData/Tnb.BasicData.Entities/Tnb.BasicData.Entities.csproj index bc02f09d..57e42217 100644 --- a/BasicData/Tnb.BasicData.Entities/Tnb.BasicData.Entities.csproj +++ b/BasicData/Tnb.BasicData.Entities/Tnb.BasicData.Entities.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasCalendarService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasCalendarService.cs index 4eaf8a89..8610f687 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasCalendarService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasCalendarService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.BasicData.Entities.Dto; +using Tnb.BasicData.Entities.Dto; namespace Tnb.BasicData.Interfaces { diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs index 1e4e57ed..086e6a6c 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasESopService.cs @@ -10,20 +10,20 @@ namespace Tnb.BasicData.Interfaces /// /// public Task UploadNewVersion(UploadNewVersionInput input); - + /// /// 获取历史记录 /// /// /// public Task GetHistoryList(EsopHistoryListQueryInput input); - + /// /// 根据生产bom工序id获取实体 /// /// mbomProcessId /// - public Task GetEntityByMbomProcessId(Dictionary dic); - + public Task GetEntityByMbomProcessId(Dictionary dic); + } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasLocationService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasLocationService.cs index f3ddd99c..c967411c 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasLocationService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasLocationService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.BasicData.Entities; +using Tnb.BasicData.Entities; namespace Tnb.BasicData.Interfaces { diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs index 1da4bc94..ddfc341b 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasMaterialService.cs @@ -10,8 +10,8 @@ namespace Tnb.BasicData.Interfaces /// /// public Task GetMaterialSelectInfo(MaterialSelectQueryInput queryInput); - - + + /// /// 获取可创建子工单的物料 /// @@ -25,7 +25,7 @@ namespace Tnb.BasicData.Interfaces /// /// public Task GetMaterialByType(Dictionary dic); - + /// /// 根据物料类型获取物料列表 /// diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasProcessService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasProcessService.cs index 594f103b..8664ea95 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasProcessService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasProcessService.cs @@ -1,10 +1,6 @@ -using JNPF.Common.Dtos.VisualDev; -using JNPF.VisualDev; -using Tnb.BasicData.Entities.Dto; - namespace Tnb.BasicData.Interfaces { public interface IBasProcessService - { + { } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs index cf09636b..c7f7387d 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasQrcodeService.cs @@ -1,6 +1,6 @@ namespace Tnb.BasicData.Interfaces { - + /// /// 二维码 /// @@ -12,14 +12,14 @@ namespace Tnb.BasicData.Interfaces /// /// public Task GetQrcodeByCode(Dictionary dic); - + /// /// 根据code获取工位信息 /// /// /// public Task GetWorkStationByCode(Dictionary dic); - + /// /// 获取工位信息 /// diff --git a/BasicData/Tnb.BasicData.Interfaces/IBasRouteService.cs b/BasicData/Tnb.BasicData.Interfaces/IBasRouteService.cs index 0fbaa1c1..c884639d 100644 --- a/BasicData/Tnb.BasicData.Interfaces/IBasRouteService.cs +++ b/BasicData/Tnb.BasicData.Interfaces/IBasRouteService.cs @@ -1,5 +1,4 @@ using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Filter; namespace Tnb.BasicData.Interfaces { @@ -16,7 +15,7 @@ namespace Tnb.BasicData.Interfaces /// /// 工艺路线id id public Task Copy(Dictionary parameters); - + /// /// 获取有效的已发布的工艺路线 /// diff --git a/BasicData/Tnb.BasicData.Interfaces/Tnb.BasicData.Interfaces.csproj b/BasicData/Tnb.BasicData.Interfaces/Tnb.BasicData.Interfaces.csproj index 40c23903..862aac48 100644 --- a/BasicData/Tnb.BasicData.Interfaces/Tnb.BasicData.Interfaces.csproj +++ b/BasicData/Tnb.BasicData.Interfaces/Tnb.BasicData.Interfaces.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/BasicData/Tnb.BasicData/BasCalendarService.cs b/BasicData/Tnb.BasicData/BasCalendarService.cs index 61d2e75c..b6a5dc14 100644 --- a/BasicData/Tnb.BasicData/BasCalendarService.cs +++ b/BasicData/Tnb.BasicData/BasCalendarService.cs @@ -1,19 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; -using JNPF.Common.Models.VisualDev; +using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.JsonSerialization; -using JNPF.Systems.Interfaces.System; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula.Functions; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.BasicData.Entities.Dto; @@ -28,7 +17,7 @@ namespace Tnb.BasicData /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)] [Route("api/[area]/[controller]/[action]")] - public class BasCalendarService: IBasCalendarService, IDynamicApiController, ITransient + public class BasCalendarService : IBasCalendarService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; @@ -38,6 +27,7 @@ namespace Tnb.BasicData _repository = repository; _userManager = userManager; } + /// /// 保存工作日历 /// @@ -46,17 +36,20 @@ namespace Tnb.BasicData [HttpPost] public async Task SaveData(CalendarInput CalendarInput) { - var db = _repository.AsSugarClient(); - await db.Deleteable(p=>p.datetext== CalendarInput.datetext).ExecuteCommandAsync(); - BasCalendar BasCalendar = new BasCalendar(); - BasCalendar.datetext = CalendarInput.datetext; - BasCalendar.datetype = CalendarInput.datetype; - BasCalendar.workhour = CalendarInput.workhour; - BasCalendar.worktype = CalendarInput.worktype; - BasCalendar.create_id = _userManager.UserId; - BasCalendar.create_time = DateTime.Now; - await db.Insertable(BasCalendar).ExecuteCommandAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + _ = await db.Deleteable(p => p.datetext == CalendarInput.datetext).ExecuteCommandAsync(); + BasCalendar BasCalendar = new() + { + datetext = CalendarInput.datetext, + datetype = CalendarInput.datetype, + workhour = CalendarInput.workhour, + worktype = CalendarInput.worktype, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; + _ = await db.Insertable(BasCalendar).ExecuteCommandAsync(); } + /// /// 获取工作日历 /// @@ -64,95 +57,31 @@ namespace Tnb.BasicData [HttpPost] public async Task GetWorkData(CalendarInput CalendarInput) { - List CalendarOuts = new List(); + List CalendarOuts = new(); if (CalendarInput.calendartype == (int)EnumCalendarType.分类) { - var db = _repository.AsSugarClient(); - var lists = await db.Queryable().Where(p => p.worktype == CalendarInput.content).ToListAsync(); - - foreach (var list in lists) + ISqlSugarClient db = _repository.AsSugarClient(); + List lists = await db.Queryable().Where(p => p.worktype == CalendarInput.content).ToListAsync(); + + foreach (BasCalendar list in lists) { - CalendarOut CalendarOut = new CalendarOut(); - CalendarOut.datetext = list.datetext; - CalendarOut.datetype = list.datetype; - CalendarOut.workhour = JSON.Deserialize>(list.workhour); - CalendarOut.worktype = list.worktype; + CalendarOut CalendarOut = new() + { + datetext = list.datetext, + datetype = list.datetype, + workhour = JSON.Deserialize>(list.workhour), + worktype = list.worktype + }; CalendarOuts.Add(CalendarOut); } } else if (CalendarInput.calendartype == (int)EnumCalendarType.班组) { - var db = _repository.AsSugarClient(); - var Shifts = await db.Queryable().Where(p => p.workgroup_id == CalendarInput.content).Select(p=>p.shift_id).ToListAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + List Shifts = await db.Queryable().Where(p => p.workgroup_id == CalendarInput.content).Select(p => p.shift_id).ToListAsync(); if (Shifts != null && Shifts.Count > 0) { - var BasTimePeriods = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shifttype_id == b.id }) - .Where((a,b) => Shifts.Contains(a.shifttype_id!)) - .Select((a, b) => - new Shift - { - startday = b.shiftb_time, - endday = b.shifte_time, - workhour = new WorkHour { start=a.tpb_time,end=a.tpe_time }, - } - ).ToListAsync(); - - - var BasTimePeriodRests = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shift_type_id == b.id }) - .Where((a, b) => Shifts.Contains(a.shift_type_id!)) - .Select((a, b) => - new Shift - { - startday = b.shiftb_time, - endday = b.shifte_time, - workhour = new WorkHour { start = a.tp_b_time, end = a.tp_e_time }, - }).ToListAsync(); - foreach (var BasTimePeriod in BasTimePeriods) - { - var start = DateTime.Parse(BasTimePeriod.startday!); - var end = DateTime.Parse(BasTimePeriod.endday!); - for (DateTime date = start; date <= end; date = date.AddDays(1)) - { - if (CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) - CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First().workhour!.Add(BasTimePeriod.workhour!); - else - { - CalendarOut CalendarOut = new CalendarOut(); - CalendarOut.datetext = date.ToString("yyyy-MM-dd"); - CalendarOut.datetype = "workDay"; - CalendarOut.workhour = new List { BasTimePeriod.workhour! }; - CalendarOuts.Add(CalendarOut); - } - } - } - foreach (var BasTimePeriodRest in BasTimePeriodRests) - { - var start = DateTime.Parse(BasTimePeriodRest.startday!); - var end = DateTime.Parse(BasTimePeriodRest.endday!); - for (DateTime date = start; date <= end; date = date.AddDays(1)) - { - if (CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) - CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First().workhour!.Add(BasTimePeriodRest.workhour!); - else - { - CalendarOut CalendarOut = new CalendarOut(); - CalendarOut.datetext = date.ToString("yyyy-MM-dd"); - CalendarOut.datetype = "dayOff"; - CalendarOut.workhour = new List { BasTimePeriodRest.workhour! }; - CalendarOuts.Add(CalendarOut); - } - } - } - } - } - else if (CalendarInput.calendartype == (int)EnumCalendarType.个人) - { - var db = _repository.AsSugarClient(); - var groups = await db.Queryable().Where(p => p.employee_id == CalendarInput.content).Select(p => p.group_id).ToListAsync(); - var Shifts = await db.Queryable().Where(p => groups.Contains(p.workgroup_id)).Select(p => p.shift_id).ToListAsync(); - if (Shifts != null && Shifts.Count > 0) - { - var BasTimePeriods = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shifttype_id == b.id }) + List BasTimePeriods = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shifttype_id == b.id }) .Where((a, b) => Shifts.Contains(a.shifttype_id!)) .Select((a, b) => new Shift @@ -163,8 +92,7 @@ namespace Tnb.BasicData } ).ToListAsync(); - - var BasTimePeriodRests = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shift_type_id == b.id }) + List BasTimePeriodRests = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shift_type_id == b.id }) .Where((a, b) => Shifts.Contains(a.shift_type_id!)) .Select((a, b) => new Shift @@ -173,38 +101,119 @@ namespace Tnb.BasicData endday = b.shifte_time, workhour = new WorkHour { start = a.tp_b_time, end = a.tp_e_time }, }).ToListAsync(); - foreach (var BasTimePeriod in BasTimePeriods) + foreach (Shift? BasTimePeriod in BasTimePeriods) { - var start = DateTime.Parse(BasTimePeriod.startday!); - var end = DateTime.Parse(BasTimePeriod.endday!); + DateTime start = DateTime.Parse(BasTimePeriod.startday!); + DateTime end = DateTime.Parse(BasTimePeriod.endday!); for (DateTime date = start; date <= end; date = date.AddDays(1)) { if (CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) + { CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First().workhour!.Add(BasTimePeriod.workhour!); + } else { - CalendarOut CalendarOut = new CalendarOut(); - CalendarOut.datetext = date.ToString("yyyy-MM-dd"); - CalendarOut.datetype = "workDay"; - CalendarOut.workhour = new List { BasTimePeriod.workhour! }; + CalendarOut CalendarOut = new() + { + datetext = date.ToString("yyyy-MM-dd"), + datetype = "workDay", + workhour = new List { BasTimePeriod.workhour! } + }; CalendarOuts.Add(CalendarOut); } } } - foreach (var BasTimePeriodRest in BasTimePeriodRests) + foreach (Shift? BasTimePeriodRest in BasTimePeriodRests) { - var start = DateTime.Parse(BasTimePeriodRest.startday!); - var end = DateTime.Parse(BasTimePeriodRest.endday!); + DateTime start = DateTime.Parse(BasTimePeriodRest.startday!); + DateTime end = DateTime.Parse(BasTimePeriodRest.endday!); for (DateTime date = start; date <= end; date = date.AddDays(1)) { if (CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) + { CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First().workhour!.Add(BasTimePeriodRest.workhour!); + } else { - CalendarOut CalendarOut = new CalendarOut(); - CalendarOut.datetext = date.ToString("yyyy-MM-dd"); - CalendarOut.datetype = "dayOff"; - CalendarOut.workhour = new List { BasTimePeriodRest.workhour! }; + CalendarOut CalendarOut = new() + { + datetext = date.ToString("yyyy-MM-dd"), + datetype = "dayOff", + workhour = new List { BasTimePeriodRest.workhour! } + }; + CalendarOuts.Add(CalendarOut); + } + } + } + } + } + else if (CalendarInput.calendartype == (int)EnumCalendarType.个人) + { + ISqlSugarClient db = _repository.AsSugarClient(); + List groups = await db.Queryable().Where(p => p.employee_id == CalendarInput.content).Select(p => p.group_id).ToListAsync(); + List Shifts = await db.Queryable().Where(p => groups.Contains(p.workgroup_id)).Select(p => p.shift_id).ToListAsync(); + if (Shifts != null && Shifts.Count > 0) + { + List BasTimePeriods = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shifttype_id == b.id }) + .Where((a, b) => Shifts.Contains(a.shifttype_id!)) + .Select((a, b) => + new Shift + { + startday = b.shiftb_time, + endday = b.shifte_time, + workhour = new WorkHour { start = a.tpb_time, end = a.tpe_time }, + } + ).ToListAsync(); + + List BasTimePeriodRests = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.shift_type_id == b.id }) + .Where((a, b) => Shifts.Contains(a.shift_type_id!)) + .Select((a, b) => + new Shift + { + startday = b.shiftb_time, + endday = b.shifte_time, + workhour = new WorkHour { start = a.tp_b_time, end = a.tp_e_time }, + }).ToListAsync(); + foreach (Shift? BasTimePeriod in BasTimePeriods) + { + DateTime start = DateTime.Parse(BasTimePeriod.startday!); + DateTime end = DateTime.Parse(BasTimePeriod.endday!); + for (DateTime date = start; date <= end; date = date.AddDays(1)) + { + if (CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) + { + CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First().workhour!.Add(BasTimePeriod.workhour!); + } + else + { + CalendarOut CalendarOut = new() + { + datetext = date.ToString("yyyy-MM-dd"), + datetype = "workDay", + workhour = new List { BasTimePeriod.workhour! } + }; + CalendarOuts.Add(CalendarOut); + } + } + } + foreach (Shift? BasTimePeriodRest in BasTimePeriodRests) + { + DateTime start = DateTime.Parse(BasTimePeriodRest.startday!); + DateTime end = DateTime.Parse(BasTimePeriodRest.endday!); + for (DateTime date = start; date <= end; date = date.AddDays(1)) + { + if (CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) + { + CalendarOuts.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First().workhour!.Add(BasTimePeriodRest.workhour!); + } + else + { + CalendarOut CalendarOut = new() + { + datetext = date.ToString("yyyy-MM-dd"), + datetype = "dayOff", + workhour = new List { BasTimePeriodRest.workhour! } + }; CalendarOuts.Add(CalendarOut); } } @@ -213,6 +222,7 @@ namespace Tnb.BasicData } return CalendarOuts; } + /// /// 批量保存工作日历 /// @@ -220,37 +230,39 @@ namespace Tnb.BasicData /// public async Task SaveBatchData(CalendarBatchInput CalendarBatchInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DateTime start = DateTime.Parse(CalendarBatchInput.startenday![0]); DateTime end = DateTime.Parse(CalendarBatchInput.startenday![1]); - List BasCalendars = new List(); - var lists=await db.Queryable().Where(p=>start<=DateTime.Parse(p.datetext!)&&end>= DateTime.Parse(p.datetext!)&& p.worktype== CalendarBatchInput.worktype).ToListAsync(); - var updatelist=new List(); + List BasCalendars = new(); + List lists = await db.Queryable().Where(p => start <= DateTime.Parse(p.datetext!) && end >= DateTime.Parse(p.datetext!) && p.worktype == CalendarBatchInput.worktype).ToListAsync(); + List updatelist = new(); for (DateTime date = start; date <= end; date = date.AddDays(1)) { if (CalendarBatchInput.weekday!.Contains((int)date.DayOfWeek)) { if (lists.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).Any()) { - var BasCalendar = lists.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First(); + BasCalendar BasCalendar = lists.Where(p => p.datetext == date.ToString("yyyy-MM-dd")).First(); BasCalendar.datetype = CalendarBatchInput.datetype; - updatelist.Add(BasCalendar); + updatelist.Add(BasCalendar); } else { - BasCalendar BasCalendar = new BasCalendar(); - BasCalendar.datetext = date.ToString("yyyy-MM-dd"); - BasCalendar.datetype = CalendarBatchInput.datetype; - BasCalendar.workhour = CalendarBatchInput.workhour; - BasCalendar.worktype = CalendarBatchInput.worktype; - BasCalendar.create_id = _userManager.UserId; - BasCalendar.create_time = DateTime.Now; + BasCalendar BasCalendar = new() + { + datetext = date.ToString("yyyy-MM-dd"), + datetype = CalendarBatchInput.datetype, + workhour = CalendarBatchInput.workhour, + worktype = CalendarBatchInput.worktype, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; BasCalendars.Add(BasCalendar); } } } - await db.Updateable(updatelist).ExecuteCommandAsync(); - await db.Insertable(BasCalendars).ExecuteCommandAsync(); + _ = await db.Updateable(updatelist).ExecuteCommandAsync(); + _ = await db.Insertable(BasCalendars).ExecuteCommandAsync(); } } -} +} \ No newline at end of file diff --git a/BasicData/Tnb.BasicData/BasDefectService.cs b/BasicData/Tnb.BasicData/BasDefectService.cs index f75e0f46..6b1accb3 100644 --- a/BasicData/Tnb.BasicData/BasDefectService.cs +++ b/BasicData/Tnb.BasicData/BasDefectService.cs @@ -2,11 +2,10 @@ using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.BasicData.Entities.Dto; using Tnb.BasicData.Entities; +using Tnb.BasicData.Entities.Dto; using Tnb.BasicData.Interfaces; namespace Tnb.BasicData @@ -16,14 +15,14 @@ namespace Tnb.BasicData /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)] [Route("api/[area]/[controller]/[action]")] - public class BasDefectService: IBasDefectService,IDynamicApiController, ITransient + public class BasDefectService : IBasDefectService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly DataBaseManager _dbManager; private readonly IDictionaryDataService _dictionaryDataService; - + public BasDefectService( - ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService) + ISqlSugarRepository repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService) { _repository = repository; _dbManager = dbManager; @@ -34,16 +33,16 @@ namespace Tnb.BasicData public async Task GetDefectListByProcessId(Dictionary dic) { string processId = dic["processId"]; - var db = _repository.AsSugarClient(); - List defectIds = await db.Queryable().Where(x=>x.process_id==processId).Select(x=>x.defective_id).ToListAsync(); - List defectTypeIds = await db.Queryable().Where(x=>defectIds.Contains(x.id) && x.enabled==1).Select(x=>x.defect_type_id).ToListAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + List defectIds = await db.Queryable().Where(x => x.process_id == processId).Select(x => x.defective_id).ToListAsync(); + List defectTypeIds = await db.Queryable().Where(x => defectIds.Contains(x.id) && x.enabled == 1).Select(x => x.defect_type_id).ToListAsync(); return await _repository.AsSugarClient().Queryable() .Where((a) => defectTypeIds.Contains(a.id)) .Select(a => new { defect_type_id = a.id, - defect_type_name = a.defect_type_name, - children = SqlFunc.Subqueryable().Where(x=>x.defect_type_id==a.id && defectIds.Contains(x.id)).ToList(x=>new DefectOutput() + a.defect_type_name, + children = SqlFunc.Subqueryable().Where(x => x.defect_type_id == a.id && defectIds.Contains(x.id)).ToList(x => new DefectOutput() { id = x.id, defect_code = x.defect_code, diff --git a/BasicData/Tnb.BasicData/BasESopService.cs b/BasicData/Tnb.BasicData/BasESopService.cs index b52fc9d4..ee9bc836 100644 --- a/BasicData/Tnb.BasicData/BasESopService.cs +++ b/BasicData/Tnb.BasicData/BasESopService.cs @@ -6,7 +6,6 @@ using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Microsoft.AspNetCore.Mvc; @@ -24,13 +23,13 @@ namespace Tnb.BasicData [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModelId)] - public class BasESopService : IBasESopService,IOverideVisualDevService,IDynamicApiController, ITransient + public class BasESopService : IBasESopService, IOverideVisualDevService, IDynamicApiController, ITransient { public const string ModelId = "26919620992277"; private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - + public BasESopService( IUserManager userManager, ISqlSugarRepository repository) @@ -39,7 +38,7 @@ namespace Tnb.BasicData _userManager = userManager; OverideFuncs.GetListAsync = GetList; } - + /// /// ESOP列表 /// @@ -48,12 +47,12 @@ namespace Tnb.BasicData [HttpPost] public async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); Dictionary? queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject>(); - string? code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; - string? name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; - string? version = queryJson!=null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : ""; - var list = await db.Queryable((a, b, c, d,e) => new object[] + string? code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; + string? name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; + string? version = queryJson != null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : ""; + SqlSugarPagedList list = await db.Queryable((a, b, c, d, e) => new object[] { JoinType.Left, a.mbom_id == b.id, JoinType.Left, a.mbom_process_id == c.id, @@ -63,8 +62,8 @@ namespace Tnb.BasicData .WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code!)) .WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d) => a.name.Contains(name!)) .WhereIF(!string.IsNullOrEmpty(version), (a, b, c, d) => a.version.Contains(version!)) - .Where((a,b,c)=>a.enabled==1) - .Select((a, b, c, d,e) => new ESopListOutput + .Where((a, b, c) => a.enabled == 1) + .Select((a, b, c, d, e) => new ESopListOutput { id = a.id, code = a.code, @@ -72,31 +71,31 @@ namespace Tnb.BasicData mbom_id = b.version!, mbom_process_id = e.process_name!, version = a.version, - enabled = a.enabled==1 ? "是" : "否", + enabled = a.enabled == 1 ? "是" : "否", attachment = a.attachment, remark = a.remark, create_id = d.RealName, - create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"), mbom_id_id = a.mbom_id, mbom_process_id_id = a.mbom_process_id - }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(list); } - + [HttpPost] public async Task GetHistoryList(EsopHistoryListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); - if (input!=null && !string.IsNullOrEmpty(input.queryJson)) + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); + if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); } - string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; - string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; - string version = queryJson!=null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : ""; - var list = await db.Queryable((a, b, c, d,e) => new object[] + string code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; + string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; + string version = queryJson != null && queryJson.ContainsKey("version") ? queryJson["version"].ToString() : ""; + SqlSugarPagedList list = await db.Queryable((a, b, c, d, e) => new object[] { JoinType.Left, a.mbom_id == b.id, JoinType.Left, a.mbom_process_id == c.id, @@ -106,8 +105,8 @@ namespace Tnb.BasicData .WhereIF(!string.IsNullOrEmpty(code), (a, b, c, d) => a.code.Contains(code)) .WhereIF(!string.IsNullOrEmpty(name), (a, b, c, d) => a.name.Contains(name)) .WhereIF(!string.IsNullOrEmpty(version), (a, b, c, d) => a.version.Contains(version)) - .Where((a,b,c)=>a.mbom_id==input!.mbom_id && a.mbom_process_id==input!.mbom_process_id) - .Select((a, b, c, d,e) => new ESopListOutput + .Where((a, b, c) => a.mbom_id == input!.mbom_id && a.mbom_process_id == input!.mbom_process_id) + .Select((a, b, c, d, e) => new ESopListOutput { id = a.id, code = a.code, @@ -115,27 +114,24 @@ namespace Tnb.BasicData mbom_id = b.version!, mbom_process_id = e.process_name!, version = a.version, - enabled = a.enabled==1 ? "是" : "否", + enabled = a.enabled == 1 ? "是" : "否", attachment = a.attachment, remark = a.remark, create_id = d.RealName, - create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString("yyyy-MM-dd"), mbom_id_id = a.mbom_id - }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(list); } [HttpPost] - public async Task GetEntityByMbomProcessId(Dictionary dic) + public async Task GetEntityByMbomProcessId(Dictionary dic) { string mbomProcessId = dic["mbomProcessId"]; - if (!string.IsNullOrEmpty(mbomProcessId)) - { - return await _repository.GetFirstAsync(x => x.mbom_process_id == mbomProcessId && x.enabled == 1); - } - - return null!; + return !string.IsNullOrEmpty(mbomProcessId) + ? await _repository.GetFirstAsync(x => x.mbom_process_id == mbomProcessId && x.enabled == 1) + : (dynamic)null; } [HttpPost] @@ -146,15 +142,15 @@ namespace Tnb.BasicData throw Oops.Bah("已存在该版本"); } - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - await _repository.UpdateAsync(x => new BasESop() + _ = await _repository.UpdateAsync(x => new BasESop() { enabled = 0, }, x => x.mbom_id == input.mbom_id && x.mbom_process_id == input.mbom_process_id); - - BasESop basESop = new BasESop() + + BasESop basESop = new() { code = input.code, name = input.name, @@ -169,13 +165,9 @@ namespace Tnb.BasicData enabled = 1, }; - await _repository.InsertAsync(basESop); - + _ = await _repository.InsertAsync(basESop); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - - return result.IsSuccess ? "上传成功" : result.ErrorMessage; - + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "上传成功" : result.ErrorMessage); } } } \ No newline at end of file diff --git a/BasicData/Tnb.BasicData/BasEbomService.cs b/BasicData/Tnb.BasicData/BasEbomService.cs index 01679ee6..9cedf8a3 100644 --- a/BasicData/Tnb.BasicData/BasEbomService.cs +++ b/BasicData/Tnb.BasicData/BasEbomService.cs @@ -3,7 +3,6 @@ using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; @@ -11,7 +10,6 @@ using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.BasicData.Entities.Dto; -using Tnb.BasicData.Entitys.Dto.BasProcess; using Tnb.BasicData.Interfaces; namespace Tnb.BasicData @@ -22,23 +20,22 @@ namespace Tnb.BasicData [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModelId)] - public class BasEbomService : IBasEbomService,IOverideVisualDevService,IDynamicApiController, ITransient + public class BasEbomService : IBasEbomService, IOverideVisualDevService, IDynamicApiController, ITransient { public const string ModelId = "25487105536805"; private readonly ISqlSugarRepository _repository; private readonly DataBaseManager _dbManager; private readonly IDictionaryDataService _dictionaryDataService; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - + public BasEbomService( - ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService) + ISqlSugarRepository repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService) { _repository = repository; _dbManager = dbManager; _dictionaryDataService = dictionaryDataService; OverideFuncs.GetListAsync = GetList; } - /// /// 物料清单列表 @@ -47,15 +44,15 @@ namespace Tnb.BasicData /// public async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? null : input.queryJson.ToObject>(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? null : input.queryJson.ToObject>(); string materialInfo = queryJson?["query_info"]?.ToString() ?? ""; - var list = await db.Queryable((a, b, c) => new object[] + SqlSugarPagedList list = await db.Queryable((a, b, c) => new object[] { JoinType.Left, a.material_id == b.id, JoinType.Left, a.route_id == c.id, }) - .WhereIF(!string.IsNullOrEmpty(materialInfo),(a,b,c)=>b.code.Contains(materialInfo) || b.name.Contains(materialInfo)) + .WhereIF(!string.IsNullOrEmpty(materialInfo), (a, b, c) => b.code.Contains(materialInfo) || b.name.Contains(materialInfo)) .Select((a, b, c) => new EbomListOutput { id = a.id, @@ -67,12 +64,11 @@ namespace Tnb.BasicData version = a.version, route_id = c.name, route_id_id = c.id, + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); - }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); - - return PageResult.SqlSugarPageResult(list); + return PageResult.SqlSugarPageResult(list); } - + /// /// 获取物料清单树. /// @@ -80,9 +76,9 @@ namespace Tnb.BasicData [HttpPost] public async Task GetTree(EbomTreeQueryInput queryInput) { - var db = _repository.AsSugarClient(); - var dic = await _dictionaryDataService.GetDicByKey(DictConst.MeasurementUnit); - + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary dic = await _dictionaryDataService.GetDicByKey(DictConst.MeasurementUnit); + // var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == DbName.TNBMON); // if (momDbLink != null) // { @@ -91,14 +87,14 @@ namespace Tnb.BasicData if (string.IsNullOrEmpty(queryInput.materialId)) { - var data = await db.Queryable() - .LeftJoin((a,b)=>a.ebom_id==b.id) - .LeftJoin((a,b,c)=>a.material_id==c.id) - .LeftJoin((a,b,c,d)=>a.material_id==d.material_id) - .LeftJoin((a,b,c,d,e)=>d.route_id==e.id) - .LeftJoin((a,b,c,d,e,f)=>a.substitute_material_id==f.id) - .Where((a,b,c)=>a.ebom_id==queryInput.ebomId) - .Select((a,b,c,d,e,f)=>new EbomTreeOutput + List data = await db.Queryable() + .LeftJoin((a, b) => a.ebom_id == b.id) + .LeftJoin((a, b, c) => a.material_id == c.id) + .LeftJoin((a, b, c, d) => a.material_id == d.material_id) + .LeftJoin((a, b, c, d, e) => d.route_id == e.id) + .LeftJoin((a, b, c, d, e, f) => a.substitute_material_id == f.id) + .Where((a, b, c) => a.ebom_id == queryInput.ebomId) + .Select((a, b, c, d, e, f) => new EbomTreeOutput { material_id = c.name, material_id_descrip = c.descrip, @@ -112,7 +108,7 @@ namespace Tnb.BasicData route_name = e.name, version = d.version, substitute_material_id = f.name, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.material_id==a.material_id).Any(), + hasChildren = SqlFunc.Subqueryable().Where(x => x.material_id == a.material_id).Any(), }).Mapper(it => { it.material_id_unit_id = !string.IsNullOrEmpty(it.material_id_unit_id) ? dic[it.material_id_unit_id].ToString() : ""; @@ -121,14 +117,14 @@ namespace Tnb.BasicData } else { - var data = await db.Queryable() - .LeftJoin((a,b)=>a.ebom_id==b.id) - .LeftJoin((a,b,c)=>a.material_id==c.id) - .LeftJoin((a,b,c,d)=>a.material_id==d.material_id) - .LeftJoin((a,b,c,d,e)=>d.route_id==e.id) - .LeftJoin((a,b,c,d,e,f)=>a.substitute_material_id==f.id) - .Where((a,b,c)=>b.material_id==queryInput.materialId && a.ebom_id==b.id) - .Select((a,b,c,d,e,f)=>new EbomTreeOutput + List data = await db.Queryable() + .LeftJoin((a, b) => a.ebom_id == b.id) + .LeftJoin((a, b, c) => a.material_id == c.id) + .LeftJoin((a, b, c, d) => a.material_id == d.material_id) + .LeftJoin((a, b, c, d, e) => d.route_id == e.id) + .LeftJoin((a, b, c, d, e, f) => a.substitute_material_id == f.id) + .Where((a, b, c) => b.material_id == queryInput.materialId && a.ebom_id == b.id) + .Select((a, b, c, d, e, f) => new EbomTreeOutput { material_id = c.name, material_id_descrip = c.descrip, @@ -142,15 +138,13 @@ namespace Tnb.BasicData route_name = e.name, version = d.version, substitute_material_id = f.name, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.material_id==a.material_id).Any(), + hasChildren = SqlFunc.Subqueryable().Where(x => x.material_id == a.material_id).Any(), }).Mapper(it => { it.material_id_unit_id = !string.IsNullOrEmpty(it.material_id_unit_id) ? dic[it.material_id_unit_id].ToString() : ""; }).ToListAsync(); return data; } - - } /// @@ -159,11 +153,11 @@ namespace Tnb.BasicData /// 物料id materialId /// [HttpPost] - public async Task> GetEbomVersionAndRouteName(Dictionary parameters) + public async Task> GetEbomVersionAndRouteName(Dictionary parameters) { string materialId = parameters["materialId"]; - var db = _repository.AsSugarClient(); - + ISqlSugarClient db = _repository.AsSugarClient(); + // var momDbLink = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.FullName == DbName.TNBMON); // if (momDbLink != null) // { @@ -171,16 +165,16 @@ namespace Tnb.BasicData // } var ebom = await db.Queryable() - .LeftJoin((a,b)=>a.route_id==b.id) - .OrderByDescending((a,b)=>a.create_time) - .Where((a,b) => a.material_id == materialId) - .Select((a,b)=>new + .LeftJoin((a, b) => a.route_id == b.id) + .OrderByDescending((a, b) => a.create_time) + .Where((a, b) => a.material_id == materialId) + .Select((a, b) => new { a.id, a.version, b.name, }).FirstAsync(); - return new Dictionary() + return new Dictionary() { ["version"] = ebom?.version ?? "", ["routeName"] = ebom?.name ?? "", diff --git a/BasicData/Tnb.BasicData/BasLocationService.cs b/BasicData/Tnb.BasicData/BasLocationService.cs index 4f9dc202..af13f6d3 100644 --- a/BasicData/Tnb.BasicData/BasLocationService.cs +++ b/BasicData/Tnb.BasicData/BasLocationService.cs @@ -1,15 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; using JNPF.DynamicApiController; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.BasicData.Entities.Enums; using Tnb.BasicData.Interfaces; using Tnb.WarehouseMgr.Entities.Enums; @@ -32,19 +25,27 @@ namespace Tnb.BasicData /// /// [HttpGet] - public async Task GetUnStoreLocationListByCarryId([FromRoute]string carryId) + public async Task GetUnStoreLocationListByCarryId([FromRoute] string carryId) { - - var items = await _db.Queryable().Where(it => !string.IsNullOrEmpty(it.is_type) && Convert.ToInt32(it.is_type) != (int)EnumLocationType.存储库位).ToListAsync(); + + List items = await _db.Queryable().Where(it => !string.IsNullOrEmpty(it.is_type) && Convert.ToInt32(it.is_type) != (int)EnumLocationType.存储库位).ToListAsync(); return items; } public async Task> GetLocationInfobyIds(IEnumerable locIds) { - if (locIds == null) throw new ArgumentNullException(nameof(locIds)); - if (!locIds.Any()) throw new ArithmeticException($"parameter locIds.Count is not be empty"); - var items = await _db.Queryable().Where(it => locIds.Contains(it.id)).ToListAsync(); + if (locIds == null) + { + throw new ArgumentNullException(nameof(locIds)); + } + + if (!locIds.Any()) + { + throw new ArithmeticException($"parameter locIds.Count is not be empty"); + } + + List items = await _db.Queryable().Where(it => locIds.Contains(it.id)).ToListAsync(); return items; } } diff --git a/BasicData/Tnb.BasicData/BasMaterialService.cs b/BasicData/Tnb.BasicData/BasMaterialService.cs index 7f2bceaa..fb4df1df 100644 --- a/BasicData/Tnb.BasicData/BasMaterialService.cs +++ b/BasicData/Tnb.BasicData/BasMaterialService.cs @@ -21,20 +21,20 @@ namespace Tnb.BasicData /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)] [Route("api/[area]/[controller]/[action]")] - public class BasMaterialService : IBasMaterialService,IDynamicApiController, ITransient + public class BasMaterialService : IBasMaterialService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly DataBaseManager _dbManager; private readonly IDictionaryDataService _dictionaryDataService; - + public BasMaterialService( - ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService) + ISqlSugarRepository repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService) { _repository = repository; _dbManager = dbManager; _dictionaryDataService = dictionaryDataService; } - + /// /// 复制物料 /// @@ -44,7 +44,7 @@ namespace Tnb.BasicData { string id = parameters["id"]; BasMaterial basMaterial = await _repository.GetByIdAsync(id); - + List materialUnits = await _repository.AsSugarClient().Queryable().Where(x => x.material_id == id).ToListAsync(); List materialIntoFactorySpecifications = await _repository.AsSugarClient().Queryable().Where(x => x.material_id == id).ToListAsync(); @@ -53,27 +53,26 @@ namespace Tnb.BasicData basMaterial.code += "_复制的请修改"; basMaterial.name += "_复制的请修改"; - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.InsertAsync(basMaterial); + _ = await _repository.InsertAsync(basMaterial); foreach (BasMaterialUnit basMaterialUnit in materialUnits) { basMaterialUnit.id = SnowflakeIdHelper.NextId(); basMaterialUnit.material_id = newId; } - + foreach (BasMaterialIntoFactorySpecifications basMaterialIntoFactorySpecification in materialIntoFactorySpecifications) { basMaterialIntoFactorySpecification.id = SnowflakeIdHelper.NextId(); basMaterialIntoFactorySpecification.material_id = newId; } - await _repository.AsSugarClient().Insertable(materialUnits).ExecuteCommandAsync(); - await _repository.AsSugarClient().Insertable(materialIntoFactorySpecifications).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(materialUnits).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(materialIntoFactorySpecifications).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "复制成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复制成功" : result.ErrorMessage; } /// @@ -84,14 +83,17 @@ namespace Tnb.BasicData [HttpPost] public async Task GetMaterialSelectInfo(MaterialSelectQueryInput queryInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); if (!string.IsNullOrEmpty(queryInput.ebom_id)) { - List ids = await GetAllChildrenMaterialId(queryInput.ebom_id,0); + List ids = await GetAllChildrenMaterialId(queryInput.ebom_id, 0); BasEbomH ebom = await db.Queryable().Where(x => x.id == queryInput.ebom_id).SingleAsync(); - if(ebom!=null && !string.IsNullOrEmpty(ebom.material_id)) + if (ebom != null && !string.IsNullOrEmpty(ebom.material_id)) + { ids.Add(ebom.material_id); - var result = await db.Queryable() + } + + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null) .LeftJoin((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode) .WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info)) @@ -107,11 +109,11 @@ namespace Tnb.BasicData }).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize); return PageResult.SqlSugarPageResult(result); - + } else { - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null) .LeftJoin((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode) .WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info)) @@ -132,16 +134,16 @@ namespace Tnb.BasicData [HttpPost] public async Task GetCanCreateSubWorkOrderMaterial(MaterialSelectQueryInput queryInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); if (!string.IsNullOrEmpty(queryInput.ebom_id)) { - List ids = await GetAllChildrenMaterialId(queryInput.ebom_id,0); - var result = await db.Queryable() + List ids = await GetAllChildrenMaterialId(queryInput.ebom_id, 0); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit && b.DeleteMark == null) .LeftJoin((a, b, c) => c.DictionaryTypeId == b.Id && a.unit_id == c.EnCode) .WhereIF(!string.IsNullOrEmpty(queryInput.material_info), (a, b, c) => a.code.Contains(queryInput.material_info) || a.name.Contains(queryInput.material_info)) .WhereIF(!string.IsNullOrEmpty(queryInput.ebom_id), (a, b, c) => ids.Contains(a.id)) - .Where((a,b,c)=>a.is_create_sub_work_order=="1") + .Where((a, b, c) => a.is_create_sub_work_order == "1") .Select((a, b, c) => new MaterialSelectOutput() { id = a.id, @@ -153,7 +155,7 @@ namespace Tnb.BasicData }).ToPagedListAsync(queryInput.currentPage, queryInput.pageSize); return PageResult.SqlSugarPageResult(result); - + } else { @@ -166,32 +168,32 @@ namespace Tnb.BasicData { string types = dic["types"]; string[] typeArr = types.Split(","); - List list = await _repository.AsSugarClient().Queryable().Where(x => x.state=="1").ToListAsync(); - List result = new List(); - foreach (var type in typeArr) + List list = await _repository.AsSugarClient().Queryable().Where(x => x.state == "1").ToListAsync(); + List result = new(); + foreach (string type in typeArr) { - result.AddRange(list.Where(x=>x.category_id.Contains(type))); + result.AddRange(list.Where(x => x.category_id.Contains(type))); } return result; } - + [HttpPost] public async Task GetMaterialByQueryJson(MaterialQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); - if (input!=null && !string.IsNullOrEmpty(input.queryJson)) + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); + if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); } - List typeList = new List(); - if(!string.IsNullOrEmpty(input!.types)) + List typeList = new(); + if (!string.IsNullOrEmpty(input!.types)) { - typeList = JsonConvert.DeserializeObject>((input?.types??"")) ?? new List(); + typeList = JsonConvert.DeserializeObject>(input?.types ?? "") ?? new List(); } - var query = db.Queryable() + ISugarQueryable query = db.Queryable() .Where(x => x.state == "1") .WhereIF(queryJson != null && queryJson.ContainsKey("name"), x => x.name.Contains(queryJson!["name"])) .WhereIF(queryJson != null && queryJson.ContainsKey("code"), x => x.code.Contains(queryJson!["code"])) @@ -199,43 +201,51 @@ namespace Tnb.BasicData x => x.material_standard!.Contains(queryJson!["material_standard"])) .Select(x => x); - var list = new List>(); - foreach (var type in typeList) + List> list = new(); + foreach (string type in typeList) { - list.Add(query.Clone().Where(x=>x.category_id.Contains(type))); + list.Add(query.Clone().Where(x => x.category_id.Contains(type))); } if (list.Count <= 0) { - var result = await query.ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + SqlSugarPagedList result = await query.ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } else { - var result = await db.UnionAll(list).Select().ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + SqlSugarPagedList result = await db.UnionAll(list).Select().ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } - + } /// /// 获取物料清单下所子集物料id /// /// - private async Task> GetAllChildrenMaterialId(string ebomId,int index) + private async Task> GetAllChildrenMaterialId(string ebomId, int index) { - if (string.IsNullOrEmpty(ebomId)) return new List(); - List ids = new List(); - if (index++ > 10) return ids; - var list = await _repository.AsSugarClient().Queryable().Where(x => x.ebom_id == ebomId) + if (string.IsNullOrEmpty(ebomId)) + { + return new List(); + } + + List ids = new(); + if (index++ > 10) + { + return ids; + } + + List list = await _repository.AsSugarClient().Queryable().Where(x => x.ebom_id == ebomId) .Select(x => x.material_id).ToListAsync(); if (list != null && list.Count > 0) { - foreach (var id in list) + foreach (string id in list) { //获取最新创建的物料清单 - var ebom = await _repository.AsSugarClient().Queryable().Where(x=>x.material_id==id).OrderByDescending(x=>x.create_time).FirstAsync(); - ids.AddRange(await GetAllChildrenMaterialId(ebom?.id ?? "",index)); + BasEbomH ebom = await _repository.AsSugarClient().Queryable().Where(x => x.material_id == id).OrderByDescending(x => x.create_time).FirstAsync(); + ids.AddRange(await GetAllChildrenMaterialId(ebom?.id ?? "", index)); } ids.AddRange(list); } diff --git a/BasicData/Tnb.BasicData/BasMbomService.cs b/BasicData/Tnb.BasicData/BasMbomService.cs index ace5e263..6736f838 100644 --- a/BasicData/Tnb.BasicData/BasMbomService.cs +++ b/BasicData/Tnb.BasicData/BasMbomService.cs @@ -1,5 +1,6 @@ using JNPF.Common.Core.Manager; using JNPF.Common.Enums; +using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; @@ -11,10 +12,8 @@ using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.BasicData.Interfaces; using Tnb.BasicData.Entities.Dto; -using NPOI.OpenXmlFormats.Dml; -using JNPF.Common.Extension; +using Tnb.BasicData.Interfaces; namespace Tnb.BasicData { @@ -56,10 +55,10 @@ namespace Tnb.BasicData /// public async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); Dictionary? queryJson = string.IsNullOrEmpty(input.queryJson) ? null : input.queryJson.ToObject>(); string materialInfo = queryJson?["query_info"]?.ToString() ?? ""; - var list = await db.Queryable((a, b, c, d) => new object[] + SqlSugarPagedList list = await db.Queryable((a, b, c, d) => new object[] { JoinType.Left, a.material_id == b.id, JoinType.Left, a.ebom_id == c.id, @@ -75,8 +74,8 @@ namespace Tnb.BasicData ebom_id = c.version, route_id = d.name, route_id_id = c.id, - start_time = a.start_time==null ? "" : a.start_time.Value.ToString("yyyy-MM-dd"), - end_time = a.end_time==null ? "" : a.end_time.Value.ToString("yyyy-MM-dd"), + start_time = a.start_time == null ? "" : a.start_time.Value.ToString("yyyy-MM-dd"), + end_time = a.end_time == null ? "" : a.end_time.Value.ToString("yyyy-MM-dd"), is_first = SqlFunc.IIF(a.is_first == 0, "否", "是"), }).ToPagedListAsync(input.currentPage, input.pageSize); @@ -90,13 +89,13 @@ namespace Tnb.BasicData /// public async Task GetInfo(string id) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); BasMbom mbom = await _repository.GetSingleAsync(x => x.id == id); - List processes = await db.Queryable().Where(x => x.mbom_id == id).OrderBy(x=>x.ordinal).ToListAsync(); + List processes = await db.Queryable().Where(x => x.mbom_id == id).OrderBy(x => x.ordinal).ToListAsync(); List inputs = await db.Queryable().Where(x => x.mbom_id == id).ToListAsync(); List outputs = await db.Queryable().Where(x => x.mbom_id == id).ToListAsync(); - MbomDataOutput mbomDataOutput = new MbomDataOutput(); - List mbomProcessOutDtos = new List(); + MbomDataOutput mbomDataOutput = new(); + List mbomProcessOutDtos = new(); mbomDataOutput.id = mbom.id; mbomDataOutput.ebom_id = mbom.ebom_id; @@ -158,9 +157,12 @@ namespace Tnb.BasicData public async Task GetSubMoListByBomId([FromRoute] string bomId) { - if (string.IsNullOrEmpty(bomId)) throw new ArgumentException($"parameter {nameof(bomId)} not be null or empty"); + if (string.IsNullOrEmpty(bomId)) + { + throw new ArgumentException($"parameter {nameof(bomId)} not be null or empty"); + } - var result = await _db.Queryable() + List result = await _db.Queryable() .LeftJoin((a, b) => a.id == b.mbom_id) .LeftJoin((a, b, c) => a.route_id == c.id) // .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id) @@ -182,7 +184,7 @@ namespace Tnb.BasicData }) .Mapper(it => it.output_qty = it.num.ParseToInt()) .ToListAsync(); - + return result; } @@ -194,7 +196,7 @@ namespace Tnb.BasicData .Where(x => x.mbom_process_id == id) .Select(x => new { - material_id = x.material_id, + x.material_id, }).ToListAsync(); return result; @@ -231,13 +233,13 @@ namespace Tnb.BasicData material_name = b.name, start_time = a.start_time.HasValue ? a.start_time.Value.ToString(DbTimeFormat.SS) : null, end_time = a.end_time.HasValue ? a.end_time.Value.ToString(DbTimeFormat.SS) : null, - version = a.version, + a.version, route_id = c.id, route_name = c.name, }) .ToListAsync(); } - + // /// // /// 保存生产bom // /// @@ -512,7 +514,7 @@ namespace Tnb.BasicData // } // return result.IsSuccess ? "保存成功" : result.ErrorMessage; // } - + /// /// 保存生产bom /// @@ -529,7 +531,7 @@ namespace Tnb.BasicData { string mbomId = SnowflakeIdHelper.NextId(); string orgId = _userManager.GetUserInfo().Result.organizeId; - BasMbom mbom = new BasMbom() + BasMbom mbom = new() { id = mbomId, org_id = orgId, @@ -554,15 +556,15 @@ namespace Tnb.BasicData errorCode = ErrorCode.COM1004; throw Oops.Oh(ErrorCode.COM1004); } - await _repository.InsertAsync(mbom); - List processes = new List(); - List inputs = new List(); - List outputs = new List(); + _ = await _repository.InsertAsync(mbom); + List processes = new(); + List inputs = new(); + List outputs = new(); if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null) { - int index = 0; - foreach (var process in mbomSaveDataInput.processes) + int index = 0; + foreach (MbomProcessDto? process in mbomSaveDataInput.processes) { string mbomProcessId = SnowflakeIdHelper.NextId(); processes.Add(new BasMbomProcess() @@ -586,7 +588,7 @@ namespace Tnb.BasicData if (process.inputs != null) { - foreach (var input in process.inputs) + foreach (BasMbomInput input in process.inputs) { string inputId = SnowflakeIdHelper.NextId(); inputs.Add(new BasMbomInput() @@ -605,7 +607,7 @@ namespace Tnb.BasicData if (process.outputs != null) { - foreach (var output in process.outputs) + foreach (BasMbomOutput output in process.outputs) { string outputId = SnowflakeIdHelper.NextId(); outputs.Add(new BasMbomOutput() @@ -626,17 +628,17 @@ namespace Tnb.BasicData if (processes.Count > 0) { - await _repository.AsSugarClient().Insertable(processes).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(processes).ExecuteCommandAsync(); } if (inputs.Count > 0) { - await _repository.AsSugarClient().Insertable(inputs).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(inputs).ExecuteCommandAsync(); } if (outputs.Count > 0) { - await _repository.AsSugarClient().Insertable(outputs).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(outputs).ExecuteCommandAsync(); } } else//修改 @@ -651,7 +653,7 @@ namespace Tnb.BasicData string orgId = _userManager.GetUserInfo().Result.organizeId; if (mbomSaveDataInput != null) { - await _repository.UpdateAsync(x => new BasMbom() + _ = await _repository.UpdateAsync(x => new BasMbom() { // org_id = orgId, material_id = mbomSaveDataInput.material_id, @@ -670,12 +672,12 @@ namespace Tnb.BasicData }, x => x.id == mbomSaveDataInput.id); } // List processes = new List(); - List inputs = new List(); - List outputs = new List(); + List inputs = new(); + List outputs = new(); if (mbomSaveDataInput != null && mbomSaveDataInput.processes != null) { - foreach (var process in mbomSaveDataInput.processes) + foreach (MbomProcessDto? process in mbomSaveDataInput.processes) { string mbomProcessId = process.id; // string mbomProcessId = SnowflakeIdHelper.NextId(); @@ -692,9 +694,9 @@ namespace Tnb.BasicData // route_detail_id = process.route_detail_id, // // }); - + decimal preparation_time = process?.preparation_time ?? 0; - await _repository.AsSugarClient().Updateable() + _ = await _repository.AsSugarClient().Updateable() .SetColumns(x => x.preparation_time == preparation_time) .SetColumns(x => x.station == process!.station) .SetColumns(x => x.byproduct_status == process!.byproduct_status) @@ -703,7 +705,7 @@ namespace Tnb.BasicData if (process!.inputs != null) { - foreach (var input in process.inputs) + foreach (BasMbomInput input in process.inputs) { string inputId = SnowflakeIdHelper.NextId(); inputs.Add(new BasMbomInput() @@ -722,7 +724,7 @@ namespace Tnb.BasicData if (process.outputs != null) { - foreach (var output in process.outputs) + foreach (BasMbomOutput output in process.outputs) { string outputId = SnowflakeIdHelper.NextId(); outputs.Add(new BasMbomOutput() @@ -744,9 +746,9 @@ namespace Tnb.BasicData if (mbomSaveDataInput != null && !string.IsNullOrEmpty(mbomSaveDataInput.id)) { - // await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync(); - await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync(); - await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync(); + // await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Deleteable().Where(x => x.mbom_id == mbomSaveDataInput.id).ExecuteCommandAsync(); } // if (processes.Count > 0) // { @@ -755,12 +757,12 @@ namespace Tnb.BasicData if (inputs.Count > 0) { - await _repository.AsSugarClient().Insertable(inputs).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(inputs).ExecuteCommandAsync(); } if (outputs.Count > 0) { - await _repository.AsSugarClient().Insertable(outputs).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(outputs).ExecuteCommandAsync(); } } diff --git a/BasicData/Tnb.BasicData/BasProcessService.cs b/BasicData/Tnb.BasicData/BasProcessService.cs index df785b20..d36819ee 100644 --- a/BasicData/Tnb.BasicData/BasProcessService.cs +++ b/BasicData/Tnb.BasicData/BasProcessService.cs @@ -1,4 +1,3 @@ -using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; @@ -7,20 +6,15 @@ using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; using SqlSugar; -using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.BasicData.Entitys.Dto.BasProcess; -using Tnb.BasicData.Interfaces; namespace Tnb.BasicData { @@ -64,21 +58,16 @@ namespace Tnb.BasicData /// private async Task GetList(VisualDevModelListQueryInput input) { - var result = new SqlSugarPagedList(); - var db = _repository.AsSugarClient(); - var organize = await db.Queryable().FirstAsync(it => it.EnCode == input.station_code && it.Category == DictConst.RegionCategoryStationCode); + SqlSugarPagedList result = new(); + ISqlSugarClient db = _repository.AsSugarClient(); + OrganizeEntity organize = await db.Queryable().FirstAsync(it => it.EnCode == input.station_code && it.Category == DictConst.RegionCategoryStationCode); if (organize != null) { - var whereExpr = Expressionable.Create(); - var curProcessIds = await db.Queryable().Where(it => it.station_id == organize.Id).Select(it => it.process_id).Distinct().ToListAsync(); - if (curProcessIds?.Count > 0) - { - whereExpr = whereExpr.And((a, b) => curProcessIds.Contains(a.id)).Or((a, b) => string.IsNullOrEmpty(b.process_id)); - } - else - { - whereExpr = whereExpr.And((a, b) => string.IsNullOrEmpty(b.process_id)); - } + Expressionable whereExpr = Expressionable.Create(); + List curProcessIds = await db.Queryable().Where(it => it.station_id == organize.Id).Select(it => it.process_id).Distinct().ToListAsync(); + whereExpr = curProcessIds?.Count > 0 + ? whereExpr.And((a, b) => curProcessIds.Contains(a.id)).Or((a, b) => string.IsNullOrEmpty(b.process_id)) + : whereExpr.And((a, b) => string.IsNullOrEmpty(b.process_id)); result = await db.Queryable().LeftJoin((a, b) => a.id == b.process_id).Where(whereExpr.ToExpression()).Select(a => new ProcessListOutput { id = a.id, @@ -118,8 +107,8 @@ namespace Tnb.BasicData string processId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? ""; - List list = new List(); - foreach (var item in (JArray)visualDevModelDataCrInput.data["station"]) + List list = new(); + foreach (JToken item in (JArray)visualDevModelDataCrInput.data["station"]) { string processStationId = SnowflakeIdHelper.NextId(); @@ -134,11 +123,10 @@ namespace Tnb.BasicData }); } - await _repository.AsSugarClient().Insertable(list).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(list).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); } diff --git a/BasicData/Tnb.BasicData/BasPushRuleLogService.cs b/BasicData/Tnb.BasicData/BasPushRuleLogService.cs index 9f164ef4..f08ecbc5 100644 --- a/BasicData/Tnb.BasicData/BasPushRuleLogService.cs +++ b/BasicData/Tnb.BasicData/BasPushRuleLogService.cs @@ -1,7 +1,5 @@ -using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -28,7 +26,7 @@ namespace Tnb.BasicData public async Task Stop(Dictionary dic) { string id = dic["id"]; - await _repository.UpdateAsync(x => new BasPushRuleLog() + _ = await _repository.UpdateAsync(x => new BasPushRuleLog() { is_push = 0, }, x => x.biz_id == id); diff --git a/BasicData/Tnb.BasicData/BasQrcodeService.cs b/BasicData/Tnb.BasicData/BasQrcodeService.cs index c3875673..c79ac873 100644 --- a/BasicData/Tnb.BasicData/BasQrcodeService.cs +++ b/BasicData/Tnb.BasicData/BasQrcodeService.cs @@ -6,8 +6,6 @@ using JNPF.Systems.Interfaces.System; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.BasicData.Entities.Dto; -using Tnb.BasicData.Entitys.Dto.BasProcess; using Tnb.BasicData.Interfaces; using Tnb.EquipMgr.Entities; using Tnb.WarehouseMgr.Entities; @@ -19,14 +17,14 @@ namespace Tnb.BasicData /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 1102)] [Route("api/[area]/[controller]/[action]")] - public class BasQrcodeService : IBasQrcodeService,IDynamicApiController, ITransient + public class BasQrcodeService : IBasQrcodeService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; private readonly DataBaseManager _dbManager; private readonly IDictionaryDataService _dictionaryDataService; - + public BasQrcodeService( - ISqlSugarRepository repository,DataBaseManager dbManager,IDictionaryDataService dictionaryDataService) + ISqlSugarRepository repository, DataBaseManager dbManager, IDictionaryDataService dictionaryDataService) { _repository = repository; _dbManager = dbManager; @@ -34,22 +32,26 @@ namespace Tnb.BasicData } [HttpPost] - public async Task GetQrcodeByCode(Dictionary dic) + public async Task GetQrcodeByCode(Dictionary dic) { string code = dic.ContainsKey("code") ? dic["code"] : ""; - if (string.IsNullOrEmpty(code)) return null; + if (string.IsNullOrEmpty(code)) + { + return null; + } + var result = await _repository.AsSugarClient().Queryable() .LeftJoin((a, b) => a.source_id == b.Id) .LeftJoin((a, b, c) => a.source_id == c.id) .LeftJoin((a, b, c, d) => a.source_id == d.id) - .LeftJoin((a,b,c,d,e)=>a.source_id==e.id) - .LeftJoin((a,b,c,d,e,f)=>a.source_id==f.id) + .LeftJoin((a, b, c, d, e) => a.source_id == e.id) + .LeftJoin((a, b, c, d, e, f) => a.source_id == f.id) .Where((a, b, c, d) => a.code == code) - .Select((a, b, c, d,e,f) => new + .Select((a, b, c, d, e, f) => new { - id = a.id, - source_id = a.source_id, - source_name = a.source_name, + a.id, + a.source_id, + a.source_name, org_code = b.EnCode, org_name = b.FullName, equip_code = a.code, @@ -57,27 +59,31 @@ namespace Tnb.BasicData tool_location_code = d.location_code, bas_location_name = e.location_name, bas_location_code = e.location_code, - carry_name = f.carry_name, - carry_code = f.carry_code, + f.carry_name, + f.carry_code, }).FirstAsync(); return result; } [HttpPost] - public async Task GetWorkStationByCode(Dictionary dic) + public async Task GetWorkStationByCode(Dictionary dic) { string code = dic.ContainsKey("code") ? dic["code"] : ""; - if (string.IsNullOrEmpty(code)) return null; + if (string.IsNullOrEmpty(code)) + { + return null; + } + var result = await _repository.AsSugarClient().Queryable() .LeftJoin((a, b) => a.source_id == b.Id) - .LeftJoin((a,b,c)=>a.source_id==c.ObjectId && c.ObjectType=="Eqp") - .LeftJoin((a,b,c,d)=>c.OrganizeId==d.Id) + .LeftJoin((a, b, c) => a.source_id == c.ObjectId && c.ObjectType == "Eqp") + .LeftJoin((a, b, c, d) => c.OrganizeId == d.Id) .Where((a, b, c) => a.code == code) - .Select((a, b, c,d) => new + .Select((a, b, c, d) => new { - id = a.id, - source_id = a.source_id, - source_name = a.source_name, + a.id, + a.source_id, + a.source_name, org_id = b.Id, org_code = b.EnCode, org_name = b.FullName, diff --git a/BasicData/Tnb.BasicData/BasRouteService.cs b/BasicData/Tnb.BasicData/BasRouteService.cs index 741f9f54..1bb37321 100644 --- a/BasicData/Tnb.BasicData/BasRouteService.cs +++ b/BasicData/Tnb.BasicData/BasRouteService.cs @@ -9,8 +9,8 @@ using JNPF.FriendlyException; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.BasicData.Interfaces; using Tnb.BasicData.Entities.Dto; +using Tnb.BasicData.Interfaces; namespace Tnb.BasicData { @@ -19,11 +19,11 @@ namespace Tnb.BasicData /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 701)] [Route("api/[area]/[controller]/[action]")] - public class BasRouteService : IBasRouteService,IDynamicApiController, ITransient + public class BasRouteService : IBasRouteService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; - - + + public BasRouteService( UserManager userManager, ISqlSugarRepository repository) @@ -40,12 +40,12 @@ namespace Tnb.BasicData { string id = parameters["id"]; - await _repository.UpdateAsync(x => new BasRouteH() + _ = await _repository.UpdateAsync(x => new BasRouteH() { status = "1", }, x => x.id == id); } - + /// /// 复制工艺路线 /// @@ -55,7 +55,7 @@ namespace Tnb.BasicData { string id = parameters["id"]; BasRouteH basRouteH = await _repository.GetByIdAsync(id); - + List basRouteDs = await _repository.AsSugarClient().Queryable().Where(x => x.route_id == id).ToListAsync(); string newId = SnowflakeIdHelper.NextId(); @@ -64,42 +64,41 @@ namespace Tnb.BasicData basRouteH.name += "_复制的请修改"; basRouteH.status = "0"; - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.InsertAsync(basRouteH); + _ = await _repository.InsertAsync(basRouteH); foreach (BasRouteD basRouteD in basRouteDs) { basRouteD.id = SnowflakeIdHelper.NextId(); basRouteD.route_id = newId; } - await _repository.AsSugarClient().Insertable(basRouteDs).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(basRouteDs).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "复制成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复制成功" : result.ErrorMessage; } /// /// 获取有效的已发布的工艺路线 /// [HttpPost] - public async Task GetValidRouteList([FromBody]VisualDevDataFieldDataListInput pageInput) + public async Task GetValidRouteList([FromBody] VisualDevDataFieldDataListInput pageInput) { - var db = _repository.AsSugarClient(); - var result = await db.Queryable() - .Where(x => x.status == "1" - && ((x.start_time != null && x.start_time.Value <= DateTime.Now && x.end_time != null && x.end_time.Value>=DateTime.Now) - || (x.start_time==null && x.end_time>=DateTime.Now) - || (x.end_time==null && x.start_time<=DateTime.Now) + ISqlSugarClient db = _repository.AsSugarClient(); + SqlSugarPagedList result = await db.Queryable() + .Where(x => x.status == "1" + && ((x.start_time != null && x.start_time.Value <= DateTime.Now && x.end_time != null && x.end_time.Value >= DateTime.Now) + || (x.start_time == null && x.end_time >= DateTime.Now) + || (x.end_time == null && x.start_time <= DateTime.Now) || (x.start_time == null && x.end_time == null) - )).Select(x=>new VaildRouteOutput() + )).Select(x => new VaildRouteOutput() { id = x.id, code = x.code, name = x.name, - start_time = x.start_time==null ? "" : x.start_time.Value.ToString("yyyy-MM-dd"), - end_time = x.end_time==null ? "" : x.end_time.Value.ToString("yyyy-MM-dd"), + start_time = x.start_time == null ? "" : x.start_time.Value.ToString("yyyy-MM-dd"), + end_time = x.end_time == null ? "" : x.end_time.Value.ToString("yyyy-MM-dd"), }).ToPagedListAsync(pageInput.currentPage, pageInput.pageSize); return PageResult.SqlSugarPageResult(result); } diff --git a/BasicData/Tnb.BasicData/Tnb.BasicData.csproj b/BasicData/Tnb.BasicData/Tnb.BasicData.csproj index 9de471f3..349cdb7c 100644 --- a/BasicData/Tnb.BasicData/Tnb.BasicData.csproj +++ b/BasicData/Tnb.BasicData/Tnb.BasicData.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs index f013c856..6334795a 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldPlanMaintainStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Consts +namespace Tnb.EquipMgr.Entities.Consts { public class MoldPlanMaintainStatus { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs index a27c20bf..3ab5e008 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/MoldUseStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Consts +namespace Tnb.EquipMgr.Entities.Consts { public class MoldUseStatus { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs index d774afae..bf2e824d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Consts/SpotInsRecordExecutionStatus.cs @@ -9,12 +9,12 @@ namespace Tnb.EquipMgr /// 待执行 /// public const string TOBEEXECUTED = "1"; - + /// /// 待复核 /// public const string TOBECHECK = "2"; - + /// /// 已完成 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseMoldMaintainInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseMoldMaintainInput.cs index 8ec274d1..7a0be017 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseMoldMaintainInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/BaseMoldMaintainInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class BaseMoldMaintainInput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemOutput.cs index c0e04187..7ef4853c 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class CheckItemOutput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemQueryinput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemQueryinput.cs index 4f286ad7..caedb658 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemQueryinput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/CheckItemQueryinput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 根据模具ID、计划ID获取,保养组及项目信息 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ClosedownEndListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ClosedownEndListOutput.cs index 7d9bd6a9..6bb1d0b5 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ClosedownEndListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ClosedownEndListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class ClosedownEndListOutput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpMaintainRecordListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpMaintainRecordListOutput.cs index 807b00eb..91e980a7 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpMaintainRecordListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpMaintainRecordListOutput.cs @@ -14,11 +14,11 @@ namespace Tnb.EquipMgr.Entities.Dto public string execute_time { get; set; } public string repeat_user_id { get; set; } public string repeat_user_id_id { get; set; } - public string execute_user_id{ get; set; } + public string execute_user_id { get; set; } public string execute_user_id_id { get; set; } public string repeat_time { get; set; } - public string last_execute_time { get; set; } - + public string last_execute_time { get; set; } + public DateTime? date_repeat_time { get; set; } public DateTime? date_create_time { get; set; } public DateTime? date_execute_time { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotInsRecordListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotInsRecordListOutput.cs index 97af0a07..b4b48d22 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotInsRecordListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EqpSpotInsRecordListOutput.cs @@ -12,10 +12,10 @@ namespace Tnb.EquipMgr.Entities.Dto public string spot_record_date_time { get; set; } public string repeat_user_id { get; set; } public string repeat_user_id_id { get; set; } - public string spot_record_user_id{ get; set; } + public string spot_record_user_id { get; set; } public string spot_record_user_id_id { get; set; } public string repeat_time { get; set; } - + public DateTime? date_repeat_time { get; set; } public DateTime? date_create_time { get; set; } public DateTime? date_spot_record_date_time { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs index 9f61c3c5..1f466b7d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipDaqQueryOutput.cs @@ -5,7 +5,7 @@ namespace Tnb.EquipMgr.Entities.Dto public string? id { get; set; } public string? data_source { get; set; } public string create_id { get; set; } = string.Empty; - public string? create_time { get; set; } + public string? create_time { get; set; } public string? data_type { get; set; } public string? enabled { get; set; } public string? equip_id { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipFileQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipFileQueryOutput.cs index 894388aa..01f09767 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipFileQueryOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipFileQueryOutput.cs @@ -6,7 +6,7 @@ namespace Tnb.EquipMgr.Entities.Dto public string? attachment { get; set; } public string? create_id { get; set; } public string? create_id_id { get; set; } - public string? create_time { get; set; } + public string? create_time { get; set; } public string? equip_id { get; set; } public string? equip_id_id { get; set; } public string? file_name { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipQueryInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipQueryInput.cs index c067c21d..623edaa7 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipQueryInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipQueryInput.cs @@ -3,7 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto public class EquipQueryInput { public string equip_id { get; set; } = string.Empty; - + /// /// 当前页码:pageIndex. /// @@ -13,7 +13,7 @@ namespace Tnb.EquipMgr.Entities.Dto /// 每页行数. /// public virtual int pageSize { get; set; } = 50; - + public string? queryJson { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs index 798b7056..63ace2f3 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipRepairRefuseInput.cs @@ -4,6 +4,6 @@ namespace Tnb.EquipMgr.Entities.Dto { public string id { get; set; } = string.Empty; public string reason { get; set; } = string.Empty; - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsInput.cs index 8d7ae4a6..d4687248 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsInput.cs @@ -3,7 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto public class EquipSparePartsInput { public string equip_id { get; set; } = string.Empty; - + public List? spare_parts_ids { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsQueryOutput.cs index 460cf8e4..33f096ac 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsQueryOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipSparePartsQueryOutput.cs @@ -8,6 +8,6 @@ namespace Tnb.EquipMgr.Entities.Dto public string? code { get; set; } public string? name { get; set; } public string? specification { get; set; } - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipmentListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipmentListOutput.cs index 570e8faa..66e73fdf 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipmentListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/EquipmentListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 设备列表输出类 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainInfoQueryinput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainInfoQueryinput.cs index 55b6bc50..0e9eb63e 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainInfoQueryinput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainInfoQueryinput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class MaintainInfoQueryinput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanCrInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanCrInput.cs index da654111..7650aacb 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanCrInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanCrInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 生成保养计划输入参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanMoldLstOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanMoldLstOutput.cs index 78acb766..173e8168 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanMoldLstOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainPlanMoldLstOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using NPOI.HSSF.Record.Chart; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 保养计划模具列表输出参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs index a923ef71..ff09b958 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatInput.cs @@ -5,9 +5,9 @@ namespace Tnb.EquipMgr.Entities.Dto public string id { get; set; } = string.Empty; public string repeat_result { get; set; } = string.Empty; - + public string? repeat_remark { get; set; } - - public List>? details { get; set; } + + public List>? details { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs index c8a415c0..ac814c67 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRecordRepeatOutput.cs @@ -3,7 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto public class MaintainRecordRepeatOutput { public EqpMaintainRecordH? model { get; set; } - + public List? details { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRuleMoldListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRuleMoldListOutput.cs index 4d5917c6..59639353 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRuleMoldListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainRuleMoldListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 保养规则关联模具列表输出参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainStatusUpInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainStatusUpInput.cs index 4fdf5b08..4bcddb12 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainStatusUpInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaintainStatusUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 修改维修单任务状态输入参数 @@ -18,6 +12,6 @@ namespace Tnb.EquipMgr.Entities.Dto /// /// 维修单状态 DWX(待维修)、WXZ(维修中)、YWC(已维修) /// - public string status { get; set; } + public string status { get; set; } } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs index bf1d1328..62cdf0a7 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MaterialListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 物料列表输出类 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs index 72a9bc91..399f9172 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class RelevanceMoldListOutput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs index 4bedda98..856c68ba 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具保养删除参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs index 0618d131..42b7b8e2 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainGroupItemRelationInput.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 关联保养组与模具输入参数 /// - public class MoldMaintainGroupItemRelationInput :BaseMoldMaintainInput + public class MoldMaintainGroupItemRelationInput : BaseMoldMaintainInput { } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs index 8820e89a..ada61572 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具保养项输入参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs index c45b8ad4..c17e70fa 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainItemListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具保养项列表输出 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs index 5a80c60a..2c23acef 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainPlanRunQueryOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具保养计划执行查询输出参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs index d66bd684..e9a2cf48 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具保养执行输入参数 @@ -34,7 +28,7 @@ namespace Tnb.EquipMgr.Entities.Dto public string starttime { get; set; } } - public class MaintainItemInfo + public class MaintainItemInfo { public string item_group_id { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainUpInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainUpInput.cs index 01b9fb77..16b50dd8 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainUpInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class MoldMaintainUpInput { @@ -15,6 +9,6 @@ namespace Tnb.EquipMgr.Entities.Dto /// /// 维修状态 /// - public string status{ get; set; } + public string status { get; set; } } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldRuleSelectorListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldRuleSelectorListOutput.cs index 0ac562ab..690a8cd4 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldRuleSelectorListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldRuleSelectorListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具规则选择列表输出类 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs index 054a8d4f..30431bcc 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Numerics; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class PadMainListOutput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListInput.cs index daf60528..eae3b27d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListInput.cs @@ -5,11 +5,11 @@ namespace Tnb.EquipMgr.Entities.Dto public class PadRepairListInput : PageInputBase { public string status { get; set; } - + public string equip_info { get; set; } - + public DateTime? start_time { get; set; } public DateTime? end_time { get; set; } - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs index ef577df0..228f6286 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs @@ -3,9 +3,9 @@ namespace Tnb.EquipMgr.Entities.Dto public class PadRepairListOutput { public string id { get; set; } - + public string code { get; set; } - + public string name { get; set; } public string equip_id { get; set; } public string equip_id_id { get; set; } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaMaintainInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaMaintainInput.cs index dfeffb72..68a3a35a 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaMaintainInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaMaintainInput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Filter; +using JNPF.Common.Filter; namespace Tnb.EquipMgr.Entities.Dto { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaRepairApplyListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaRepairApplyListOutput.cs index c2455cec..5436846c 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaRepairApplyListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PdaRepairApplyListOutput.cs @@ -13,9 +13,9 @@ namespace Tnb.EquipMgr.Entities.Dto public string status { get; set; } public string repairer_id { get; set; } public string? repairer_id_id { get; set; } - + public string apply_user_id { get; set; } public string apply_user_id_id { get; set; } - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldFromPlanInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldFromPlanInput.cs index 59a4b291..180b2efe 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldFromPlanInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldFromPlanInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具保养计划制定-计划关联模具输入参数 diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldInput.cs index 74cc333c..273199cb 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RelevanceMoldInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { /// /// 模具规则定义,关键模具输入参数 @@ -27,7 +21,7 @@ namespace Tnb.EquipMgr.Entities.Dto } - public class RowIdItem + public class RowIdItem { /// /// 模具id diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs index 628e9f43..7196bae9 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyOutRegisterInput.cs @@ -3,22 +3,22 @@ namespace Tnb.EquipMgr.Entities.Dto public class RepairApplyOutRegisterInput { public string? id { get; set; } - + /// /// 实际维修供应商id /// public string? real_supplier_id { get; set; } - + /// /// 附件 /// public string? attachment { get; set; } - + /// /// 费用 /// public decimal? cost { get; set; } - + /// /// 修复时间 /// @@ -28,12 +28,12 @@ namespace Tnb.EquipMgr.Entities.Dto /// 维修耗时 /// public decimal? repair_take_time { get; set; } - + /// /// 维修备注 /// public string? repair_remark { get; set; } - + /// /// 报修申请id /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs index 38cabadf..43954af6 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairApplyRegisterInput.cs @@ -3,27 +3,27 @@ namespace Tnb.EquipMgr.Entities.Dto public class RepairApplyRegisterInput { public string? id { get; set; } - + /// /// 故障ID /// public string? fault_id { get; set; } - + /// /// 是否完成 /// public string? is_complete { get; set; } - + /// /// 完成时间 /// public DateTime? complete_time { get; set; } - + /// /// 维修耗时 /// public int? repair_take_time { get; set; } - + /// /// 是否停机 /// @@ -33,17 +33,17 @@ namespace Tnb.EquipMgr.Entities.Dto /// 停机时长 /// public int? halt_take_time { get; set; } - + /// /// 维修描述 /// public string? repair_description { get; set; } - + /// /// 维修图片 /// public string? repair_img { get; set; } - + /// /// 是否外修 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs index 439a2bef..0db194c2 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairDelayInput.cs @@ -3,15 +3,15 @@ namespace Tnb.EquipMgr.Entities.Dto public class RepairDelayInput { public string? repair_apply_id { get; set; } - + public string? equip_id { get; set; } - + public string? repair_request_sender_id { get; set; } - + public string? repair_sender_id { get; set; } - + public DateTime expected_time { get; set; } - + public string? delay_reason { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs index ae5c6e37..e6cd8e02 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/RepairOutApplyInput.cs @@ -10,6 +10,6 @@ namespace Tnb.EquipMgr.Entities.Dto public string? construction_period_requirement { get; set; } public string? out_apply_reason { get; set; } public string? remark { get; set; } - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordExecuteInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordExecuteInput.cs index 6823a5dd..78844b0d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordExecuteInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordExecuteInput.cs @@ -3,13 +3,13 @@ namespace Tnb.EquipMgr.Entities.Dto public class SpotInsRecordExecuteInput { public string? id { get; set; } - + public string? attachment { get; set; } - + public string? result { get; set; } - + public string? result_remark { get; set; } - - public List>? details { get; set; } + + public List>? details { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatInput.cs index 2b45861b..35cc5b6d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatInput.cs @@ -3,9 +3,9 @@ namespace Tnb.EquipMgr.Entities.Dto public class SpotInsRecordRepeatInput { public string? id { get; set; } - + public string? repeat_result { get; set; } - + public string? repeat_remark { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatOutput.cs index 37db7bc2..a2af14b9 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsRecordRepeatOutput.cs @@ -3,7 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto public class SpotInsRecordRepeatOutput { public EqpSpotInsRecordH? model { get; set; } - + public List? details { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs index 3e27dd1b..ecb39a49 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/SpotInsTemPublishInput.cs @@ -3,7 +3,7 @@ namespace Tnb.EquipMgr.Entities.Dto public class SpotInsTemPublishInput { public string? id { get; set; } - + public string[]? equipIds { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolInput.cs index cae96d36..40f971e4 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities +namespace Tnb.EquipMgr.Entities { public class ToolInput { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs index 64a6e2f7..2f137c97 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/ToolMoldInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Dto +namespace Tnb.EquipMgr.Entities.Dto { public class ToolMoldInput { @@ -16,5 +10,5 @@ namespace Tnb.EquipMgr.Entities.Dto public string[] molds { get; set; } } - + } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/WorklineAndEquipTreeOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/WorklineAndEquipTreeOutput.cs index dcfee410..6423ef14 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/WorklineAndEquipTreeOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/WorklineAndEquipTreeOutput.cs @@ -7,7 +7,7 @@ namespace Tnb.EquipMgr.Entities.Dto /// /// public string id { get; set; } - + /// /// 标题 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs index 70b020ae..1a5d0b6c 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpEquipment.cs @@ -187,12 +187,12 @@ public partial class EqpEquipment : BaseEntity /// 工位编码 /// public string? station_code { get; set; } - + /// /// 质保开始时间 /// public DateTime? warranty_start_time { get; set; } - + /// /// 质保结束时间 /// @@ -207,17 +207,17 @@ public partial class EqpEquipment : BaseEntity /// 二维码 /// public string? qrcode { get; set; } - + /// /// 挤出件类型 /// public string? tube { get; set; } - + /// /// 入库库位id /// public string? as_location_id { get; set; } - + /// /// 第三方平台设备编号 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs index 3724956c..41edadb4 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemEquipH.cs @@ -128,7 +128,7 @@ public partial class EqpMaintainTemEquipH : BaseEntity /// 责任岗位id /// public string send_post_info_user_id { get; set; } = string.Empty; - + /// /// 所属组织 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs index 971809e6..4fd84f75 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpMaintainTemH.cs @@ -123,7 +123,7 @@ public partial class EqpMaintainTemH : BaseEntity /// 责任岗位id /// public string send_post_info_user_id { get; set; } = string.Empty; - + /// /// 所属组织 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairAnalysisRecord.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairAnalysisRecord.cs index 49e56317..f3df2c56 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairAnalysisRecord.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairAnalysisRecord.cs @@ -1,5 +1,4 @@ using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.EquipMgr.Entities; @@ -12,7 +11,7 @@ public partial class EqpRepairAnalysisRecord : BaseEntity { public EqpRepairAnalysisRecord() { - + } /// /// TODO diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs index 727ee5a9..36e4ba59 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairApply.cs @@ -148,12 +148,12 @@ public partial class EqpRepairApply : BaseEntity /// 附件 /// public string? attachment { get; set; } - + /// /// 维修图片 /// public string? repair_img { get; set; } - + /// /// 生产任务单id /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairCompletionRecord.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairCompletionRecord.cs index 5b195fcd..3df8957e 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairCompletionRecord.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairCompletionRecord.cs @@ -1,5 +1,4 @@ using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.EquipMgr.Entities; @@ -12,7 +11,7 @@ public partial class EqpRepairCompletionRecord : BaseEntity { public EqpRepairCompletionRecord() { - + } /// /// TODO diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs index e62cce1a..728e69e1 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairDelay.cs @@ -1,6 +1,3 @@ -using System; -using System.Linq; -using System.Text; using JNPF.Common.Security; using SqlSugar; diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs index adc2cfe6..cbdd6502 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairOutApply.cs @@ -113,23 +113,23 @@ public partial class EqpRepairOutApply : BaseEntity /// 所属组织 /// public string? org_id { get; set; } - + /// /// 附件 /// public string? attachment { get; set; } - + /// /// 实际维修供应商 /// public string? real_supplier_id { get; set; } - + /// /// 流程id /// [SugarColumn(ColumnName = "f_flowid")] public string? flow_id { get; set; } - + /// /// 流程任务id /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpEquipCheckRecord.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpEquipCheckRecord.cs index a72ad608..3cbf3c65 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpEquipCheckRecord.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpEquipCheckRecord.cs @@ -118,7 +118,7 @@ public partial class EqpSpEquipCheckRecord : BaseEntity /// 流程引擎Id /// public string? f_flowid { get; set; } - + /// /// 所属组织 /// diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs index 076469c0..6654de79 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpSpotInsRecordD.cs @@ -108,5 +108,5 @@ public partial class EqpSpotInsRecordD : BaseEntity /// 是否通过 /// public string? is_pass { get; set; } - + } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs index f34d8433..d525f962 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/MoldMaintenance.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using SqlSugar; namespace Tnb.EquipMgr.Entities { diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckItem.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckItem.cs index 1797a714..2ac4a713 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckItem.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckItem.cs @@ -1,5 +1,4 @@ using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; using Yitter.IdGenerator; diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckPeriod.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckPeriod.cs index 1898e13b..07794d7d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckPeriod.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolModelCheckPeriod.cs @@ -1,5 +1,4 @@ using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.EquipMgr.Entities; diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainPlan.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainPlan.cs index af26dbc9..65929f93 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainPlan.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainPlan.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.part.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.part.cs index d6d167ba..540e98a2 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.part.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMolds.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.EquipMgr.Entities; @@ -7,7 +5,7 @@ namespace Tnb.EquipMgr.Entities; /// /// 模具信息表 /// -public partial class ToolMolds +public partial class ToolMolds { /// /// 库房编码 @@ -17,6 +15,6 @@ public partial class ToolMolds /// /// 库位编码 /// - [SugarColumn(IsIgnore =true)] + [SugarColumn(IsIgnore = true)] public string location_code { get; set; } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Enums/MaintainStatus.cs b/EquipMgr/Tnb.EquipMgr.Entities/Enums/MaintainStatus.cs index d17d7d50..0f658171 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Enums/MaintainStatus.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Enums/MaintainStatus.cs @@ -1,24 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Entities.Enums +namespace Tnb.EquipMgr.Entities.Enums { public enum MaintainStatus { /// /// 待维修 /// - DWX=1, + DWX = 1, /// /// 维修中 /// - WXZ=2, + WXZ = 2, /// /// 已完成 /// - YWC=4, + YWC = 4, } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs b/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs index 475faac8..580e82d5 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Mapper/Mapper.cs @@ -1,6 +1,5 @@ using Mapster; using Tnb.EquipMgr.Entities.Dto; -using Tnb.EquipMgr.Entities; namespace Tnb.EquipMgr.Entities.Mapper { @@ -14,7 +13,7 @@ namespace Tnb.EquipMgr.Entities.Mapper .Map(dest => dest.mold_id, src => src.id); config.ForType() .Map(dest => dest.mold_id, src => src.id); - //.Map(dest=>dest.mold_name,src=>src.mold_name); + //.Map(dest=>dest.mold_name,src=>src.mold_name); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Tnb.EquipMgr.Entities.csproj b/EquipMgr/Tnb.EquipMgr.Entities/Tnb.EquipMgr.Entities.csproj index edabb960..bd191439 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Tnb.EquipMgr.Entities.csproj +++ b/EquipMgr/Tnb.EquipMgr.Entities/Tnb.EquipMgr.Entities.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs index 3d47193f..96645005 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipFileService.cs @@ -1,4 +1,3 @@ -using Microsoft.AspNetCore.Http; using Tnb.EquipMgr.Entities.Dto; namespace Tnb.EquipMgr.Interfaces diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipSparePartsService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipSparePartsService.cs index 38a1bcb0..922fd3bd 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipSparePartsService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpEquipSparePartsService.cs @@ -10,7 +10,7 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task AddEquipSpareParts(EquipSparePartsInput input); - + /// /// 根据设备id获取备品备件 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs index 3ca7ee5a..abe34335 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainRecordService.cs @@ -1,4 +1,3 @@ -using JNPF.Common.Dtos.VisualDev; using Tnb.EquipMgr.Entities.Dto; namespace Tnb.EquipMgr.Interfaces @@ -18,14 +17,14 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task GetMaintainRecordRepeatInfo(Dictionary dic); - + /// /// 复核备保养计划 /// /// /// public Task RepeatMaintain(MaintainRecordRepeatInput input); - + /// /// 根据设备id获取设备保养记录 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs index 1b6496a5..fdfaf79d 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpMaintainTemEquipService.cs @@ -2,7 +2,7 @@ namespace Tnb.EquipMgr.Interfaces { public interface IEqpMaintainTemEquipService { - + /// /// 停止计划 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs index 00a88135..a5665019 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairApplyService.cs @@ -5,43 +5,43 @@ namespace Tnb.EquipMgr.Interfaces { public interface IEqpRepairApplyService { - + /// /// 维修作废 /// /// - public Task Repeal(Dictionary dic); - + public Task Repeal(Dictionary dic); + /// /// 维修关闭 /// /// - public Task Close(Dictionary dic); - + public Task Close(Dictionary dic); + /// /// 维修指派 /// /// - public Task Assign(Dictionary dic); - + public Task Assign(Dictionary dic); + /// /// 维修接收 /// /// - public Task Receive(Dictionary dic); - + public Task Receive(Dictionary dic); + /// /// 维修拒绝 /// /// - public Task Refuse(Dictionary dic); - + public Task Refuse(Dictionary dic); + /// /// 维修信息 /// /// - public Task GetInfo(Dictionary dic); - + public Task GetInfo(Dictionary dic); + /// /// 维修登记 /// @@ -53,13 +53,13 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task GetRepairApplyDetail(Dictionary dic); - + /// /// 根据设备id获取维修记录 /// /// public Task GetRepairRecordList(EquipQueryInput input); - + /// /// 看板端设备报修维修列表接口 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs index 2864d32d..ab9f3e20 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairDelayService.cs @@ -9,6 +9,6 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task Delay(RepairDelayInput input); - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs index 5e3b57dd..777ce6e5 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairOutApplyService.cs @@ -5,24 +5,24 @@ namespace Tnb.EquipMgr.Interfaces { public interface IEqpRepairOutApplyService { - + /// /// 获取外修申请信息 /// /// - public Task GetInfo(Dictionary dic); - + public Task GetInfo(Dictionary dic); + /// /// 外修申请 /// /// public Task OutApply(RepairOutApplyInput input); - + /// /// 外修登记 /// /// public Task Register(RepairApplyOutRegisterInput input); - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpEquipCheckRecordService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpEquipCheckRecordService.cs index 2028c41f..694e98b1 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpEquipCheckRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSpEquipCheckRecordService.cs @@ -1,5 +1,5 @@ using Tnb.EquipMgr.Entities; - + namespace Tnb.EquipMgr.Interfaces { public interface IEqpSpEquipCheckRecordService diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSparePartsRequisitionHService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSparePartsRequisitionHService.cs index 85b1bb7a..36893a0e 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSparePartsRequisitionHService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpSparePartsRequisitionHService.cs @@ -5,6 +5,6 @@ namespace Tnb.EquipMgr.Interfaces /// public interface IEqpSparePartsRequisitionHService { - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs index f4cdd287..fcef53ff 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEqpWorkshopChangeLogService.cs @@ -12,7 +12,7 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task GetEquipWorkshopChangeList(EquipQueryInput input); - + /// /// 设备迁移 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs index 43c849fc..1ebbfd60 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquSpotInsRecordService.cs @@ -1,4 +1,3 @@ -using JNPF.Common.Dtos.VisualDev; using Tnb.EquipMgr.Entities.Dto; namespace Tnb.EquipMgr.Interfaces @@ -18,14 +17,14 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task GetSpotInsRecordRepeatInfo(Dictionary dic); - + /// /// 复核点巡检 /// /// /// public Task RepeatSpotIns(SpotInsRecordRepeatInput input); - + /// /// 根据设备id获取点巡检记录 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs index 803272f5..7584ef96 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IEquipmentService.cs @@ -10,7 +10,7 @@ namespace Tnb.EquipMgr.Interfaces /// /// public Task GetEntityById(Dictionary dic); - + /// /// 根据设备类型获取设备列表 /// @@ -22,8 +22,8 @@ namespace Tnb.EquipMgr.Interfaces /// 获取产线和注塑挤出设备树 /// /// - public Task GetWorklineAndEquipTree(Dictionary dic); - + public Task GetWorklineAndEquipTree(Dictionary dic); + /// /// 根据二维码查设备 /// diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldHouseService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldHouseService.cs index 221f05ea..971f3efd 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldHouseService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldHouseService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Interfaces +namespace Tnb.EquipMgr.Interfaces { /// /// 目录库房服务接口 diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldLocationService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldLocationService.cs index d788daca..2459072e 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldLocationService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldLocationService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Interfaces +namespace Tnb.EquipMgr.Interfaces { /// /// 模具库位服务接口 diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs index e3a9aa6d..3272eb39 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainGroupService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Interfaces +namespace Tnb.EquipMgr.Interfaces { /// /// 模具保养项目组接口 diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanRunService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanRunService.cs index 0c482f04..cc3ce025 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanRunService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanRunService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Interfaces +namespace Tnb.EquipMgr.Interfaces { public interface IToolMoldMaintainPlanRunService { diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanService.cs index 808506b2..22c84880 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainPlanService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Interfaces +namespace Tnb.EquipMgr.Interfaces { public interface IToolMoldMaintainPlanService { diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainRuleService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainRuleService.cs index a066341d..74440623 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainRuleService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainRuleService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr.Interfaces +namespace Tnb.EquipMgr.Interfaces { /// /// 设备保养规则定义 diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainTaskService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainTaskService.cs index fa2181d5..814e3897 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainTaskService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaintainTaskService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Entities; namespace Tnb.EquipMgr.Interfaces { diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs index be6af180..8240edbc 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldMaterialService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Tnb.EquipMgr.Entities.Dto; +using Tnb.EquipMgr.Entities.Dto; namespace Tnb.EquipMgr.Interfaces { diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldRequisitionService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldRequisitionService.cs index 15fbd54c..5a8eea4d 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldRequisitionService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldRequisitionService.cs @@ -5,6 +5,6 @@ namespace Tnb.EquipMgr.Interfaces /// public interface IToolMoldRequisitionService { - + } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs index e1e1f8d9..238af7fc 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/IToolMoldsService.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; -using Tnb.ProductionMgr.Entities.Dto; namespace Tnb.EquipMgr.Interfaces { diff --git a/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj b/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj index 83209e17..ab92314f 100644 --- a/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj +++ b/EquipMgr/Tnb.EquipMgr.Interfaces/Tnb.EquipMgr.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs index 2c188cd1..531d2e4d 100644 --- a/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs @@ -1,10 +1,7 @@ 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.FriendlyException; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.VisualDev; @@ -16,7 +13,6 @@ using SqlSugar; using Tnb.BasicData; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; -using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr { @@ -26,7 +22,7 @@ namespace Tnb.EquipMgr [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleId)] - public class AppEqpRepairApplyService : IOverideVisualDevService,IDynamicApiController, ITransient + public class AppEqpRepairApplyService : IOverideVisualDevService, IDynamicApiController, ITransient { private const string ModuleId = "28621611210261"; private readonly ISqlSugarRepository _repository; @@ -46,43 +42,43 @@ namespace Tnb.EquipMgr _visualDevService = visualDevService; OverideFuncs.GetListAsync = GetList; } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); - string code = queryJson!=null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; - string name = queryJson!=null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; + string code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; + string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; string userId = _userManager.UserId; var result = await db.Queryable() .LeftJoin((a, b) => a.equip_id == b.id) .LeftJoin((a, b, c) => a.apply_user_id == c.Id) - .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.RepairStatus) - .LeftJoin((a,b,c,d,e)=>a.status==e.EnCode && d.Id==e.DictionaryTypeId) + .LeftJoin((a, b, c, d) => d.EnCode == DictConst.RepairStatus) + .LeftJoin((a, b, c, d, e) => a.status == e.EnCode && d.Id == e.DictionaryTypeId) .WhereIF(!string.IsNullOrEmpty("code"), (a, b, c) => a.code.Contains(code)) .WhereIF(!string.IsNullOrEmpty("name"), (a, b, c) => a.name.Contains(name)) .Where((a, b, c) => a.repairer_id == userId) - .Where((a, b, c) => a.status == "2" || a.status=="3") - .Select((a, b, c,d,e) => new PdaRepairApplyListOutput + .Where((a, b, c) => a.status == "2" || a.status == "3") + .Select((a, b, c, d, e) => new PdaRepairApplyListOutput { id = a.id, code = a.code, name = a.name, - equip_id = b.code+"/"+b.name, + equip_id = b.code + "/" + b.name, equip_id_id = a.equip_id, - expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"), - is_ugent = a.is_ugent==null ? "" : a.is_ugent==0 ? "否" : "是", + expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"), + is_ugent = a.is_ugent == null ? "" : a.is_ugent == 0 ? "否" : "是", description = a.description, status = e.FullName, - apply_user_id = SqlFunc.IsNull(c.RealName,"异常停机"), + apply_user_id = SqlFunc.IsNull(c.RealName, "异常停机"), apply_user_id_id = a.create_id, // repairer_id = c.RealName, // repairer_id_id = a.repairer_id, - }).ToPagedListAsync(input.currentPage,input.pageSize); + }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } - + /// /// 根据id获取维修相关信息 @@ -90,7 +86,7 @@ namespace Tnb.EquipMgr /// /// [HttpPost] - public async Task GetRepairInfoById(Dictionary dic) + public async Task GetRepairInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; if (string.IsNullOrEmpty(id)) return null; @@ -106,7 +102,7 @@ namespace Tnb.EquipMgr equip_id = a.equip_id, equip_code = b.code, equip_name = b.name, - expect_complete_time = a.expect_complete_time==null?"":a.expect_complete_time.Value.ToString("yyyy-MM-dd"), + expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"), is_ugent = a.is_ugent, description = a.description, status = a.status, diff --git a/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs b/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs index ce2313b9..4d51e102 100644 --- a/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs +++ b/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs @@ -1,18 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; +using System.Linq.Expressions; +using JNPF.Common.Contracts; using JNPF.Common.Enums; -using JNPF.Common.Security; +using JNPF.Common.Extension; using JNPF.FriendlyException; +using Mapster; using SqlSugar; using Tnb.EquipMgr.Entities.Dto; -using Tnb.EquipMgr.Entities; -using Mapster; -using JNPF.Common.Contracts; -using JNPF.Common.Extension; namespace Tnb.EquipMgr { @@ -75,7 +68,7 @@ namespace Tnb.EquipMgr var itemIds = await _db.Queryable().Where(masterFilterExp).Select(masterSelector).ToListAsync(); if (itemIds?.Count > 0) { - var items = await _db.Queryable().Where(it=>itemIds.Contains(it.id)).ToListAsync(); + var items = await _db.Queryable().Where(it => itemIds.Contains(it.id)).ToListAsync(); list = items.Adapt>(); } return list; diff --git a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs index 39e605a2..dc8be317 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs @@ -6,10 +6,10 @@ using JNPF.Systems.Entitys.Permission; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; +using Tnb.BasicData; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; -using Tnb.BasicData; namespace Tnb.EquipMgr { @@ -34,29 +34,29 @@ namespace Tnb.EquipMgr { var db = _repository.AsSugarClient(); Dictionary? queryJson = new Dictionary(); - if (input!=null && !string.IsNullOrEmpty(input.queryJson)) + if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a,b)=>a.create_id==b.Id) - .WhereIF(input!=null,a=>a.equip_id==input!.equip_id) - .WhereIF(queryJson!=null && queryJson.ContainsKey("data_source"),a=>a.data_source==queryJson!["data_source"]) - .WhereIF(queryJson!=null && queryJson.ContainsKey("label_name"),a=>a.label_name.Contains(queryJson!["label_name"])) - .WhereIF(queryJson!=null && queryJson.ContainsKey("label_point"),a=>a.label_point.Contains(queryJson!["label_point"])) - .Select((a,b) => new EquipDaqQueryOutput + .LeftJoin((a, b) => a.create_id == b.Id) + .WhereIF(input != null, a => a.equip_id == input!.equip_id) + .WhereIF(queryJson != null && queryJson.ContainsKey("data_source"), a => a.data_source == queryJson!["data_source"]) + .WhereIF(queryJson != null && queryJson.ContainsKey("label_name"), a => a.label_name.Contains(queryJson!["label_name"])) + .WhereIF(queryJson != null && queryJson.ContainsKey("label_point"), a => a.label_point.Contains(queryJson!["label_point"])) + .Select((a, b) => new EquipDaqQueryOutput { id = a.id, data_source = a.data_source, create_id = b.RealName, - create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM), + create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM), data_type = a.data_type, - enabled = a.enabled==1 ? "是" : "否", + enabled = a.enabled == 1 ? "是" : "否", equip_id = a.equip_id, label_name = a.label_name, label_point = a.label_point, remark = a.remark - }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); return PageResult.SqlSugarPageResult(result); } diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs index 97f48c1a..33e7a176 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs @@ -1,5 +1,4 @@ using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Filter; using JNPF.Common.Models; @@ -9,12 +8,6 @@ using JNPF.FriendlyException; using JNPF.Logging; using JNPF.Systems.Common; using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Interfaces.Common; -using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Components.Forms; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; @@ -45,13 +38,13 @@ namespace Tnb.EquipMgr } [HttpPost] - public async Task Upload([FromForm]string equip_id,[FromForm] ChunkModel input) + public async Task Upload([FromForm] string equip_id, [FromForm] ChunkModel input) { string msg = ""; try { var attachment = await _fileService.Uploader("annexpic", input); - + EqpEquipFile eqpEquipFile = new EqpEquipFile() { file_name = input.file.FileName, @@ -85,21 +78,21 @@ namespace Tnb.EquipMgr queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a, b) => a.create_id == b.Id) - .LeftJoin((a, b,c) => a.modify_id == c.Id) - .LeftJoin((a, b,c,d) => a.equip_id == d.id) - .Where((a,b,c,d)=>a.equip_id==input.equip_id) - .WhereIF(queryJson!=null && queryJson.ContainsKey("file_name"),(a,b,c,d)=>a.file_name.Contains(queryJson!["file_name"])) - .Select((a, b, c,d) => new EquipFileQueryOutput + .LeftJoin((a, b) => a.create_id == b.Id) + .LeftJoin((a, b, c) => a.modify_id == c.Id) + .LeftJoin((a, b, c, d) => a.equip_id == d.id) + .Where((a, b, c, d) => a.equip_id == input.equip_id) + .WhereIF(queryJson != null && queryJson.ContainsKey("file_name"), (a, b, c, d) => a.file_name.Contains(queryJson!["file_name"])) + .Select((a, b, c, d) => new EquipFileQueryOutput { id = a.id, attachment = a.attachment, create_id = b.RealName, create_id_id = a.create_id, - create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), - equip_id=d.name, - equip_id_id= a.equip_id, - file_name=a.file_name, + create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), + equip_id = d.name, + equip_id_id = a.equip_id, + file_name = a.file_name, }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs index 6df470f2..b06ff48e 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs @@ -1,18 +1,12 @@ using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr @@ -51,10 +45,10 @@ namespace Tnb.EquipMgr await db.Updateable().SetColumns(x => x.life == EquipmentLife.SCRAP) .Where(x => x.id == eqpEquipScrap.equip_id).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "报废成功" : result.ErrorMessage; - + } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs index 351b7f60..6c751f92 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs @@ -3,7 +3,6 @@ using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; @@ -67,13 +66,13 @@ namespace Tnb.EquipMgr queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a,b)=>a.spare_parts_id==b.id) + .LeftJoin((a, b) => a.spare_parts_id == b.id) .LeftJoin((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null) - .LeftJoin((a, b,c,d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode) - .Where((a,b,c,d)=>a.equip_id==input.equip_id) - .WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>b.code.Contains(queryJson!["code"])) - .WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>b.name.Contains(queryJson!["name"])) - .Select((a, b, c,d) => new EquipSparePartsQueryOutput + .LeftJoin((a, b, c, d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode) + .Where((a, b, c, d) => a.equip_id == input.equip_id) + .WhereIF(queryJson != null && queryJson.ContainsKey("code"), (a, b, c, d) => b.code.Contains(queryJson!["code"])) + .WhereIF(queryJson != null && queryJson.ContainsKey("name"), (a, b, c, d) => b.name.Contains(queryJson!["name"])) + .Select((a, b, c, d) => new EquipSparePartsQueryOutput { id = a.id, type_code = d.EnCode, diff --git a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs index fc9f254a..d0b07c26 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs @@ -1,12 +1,11 @@ using JNPF.Common.Enums; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.EquipMgr.Interfaces; using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr { @@ -15,7 +14,7 @@ namespace Tnb.EquipMgr /// [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] - public class EqpMaintainTemEquipService : IEqpMaintainTemEquipService, IDynamicApiController, ITransient + public class EqpMaintainTemEquipService : IEqpMaintainTemEquipService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; @@ -29,7 +28,7 @@ namespace Tnb.EquipMgr public async Task Stop(Dictionary parameters) { string id = parameters["id"]; - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { await _repository.UpdateAsync(x => new EqpMaintainTemEquipH() { @@ -40,13 +39,13 @@ namespace Tnb.EquipMgr .Select(x => x.id).ToListAsync(); await _repository.AsSugarClient().Deleteable() .Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync(); - + await _repository.AsSugarClient().Deleteable() .Where(x => ids.Contains(x.maintain_record_id)).ExecuteCommandAsync(); }); - - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs index 9fd92c46..aecb9304 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs @@ -29,7 +29,7 @@ namespace Tnb.EquipMgr _repository = repository; _userManager = userManager; } - + /// /// 根据模板id发布到设备 /// @@ -37,10 +37,10 @@ namespace Tnb.EquipMgr public async Task Publish(SpotInsTemPublishInput input) { var db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { EqpMaintainTemH eqpMaintainTemH = await _repository.GetSingleAsync(x => x.id == input.id); - List eqpMaintainTemDs = await db.Queryable().Where(x=>x.maintain_tem_id==input.id).ToListAsync(); + List eqpMaintainTemDs = await db.Queryable().Where(x => x.maintain_tem_id == input.id).ToListAsync(); if (input.equipIds != null && input.equipIds.Length > 0) { @@ -54,7 +54,7 @@ namespace Tnb.EquipMgr { id = id, code = code, - name = eqpMaintainTemH.name+equipId, + name = eqpMaintainTemH.name + equipId, plan_cycle = eqpMaintainTemH.plan_cycle, plan_cycle_unit = eqpMaintainTemH.plan_cycle_unit, plan_run_notice = eqpMaintainTemH.plan_run_notice, @@ -92,26 +92,26 @@ namespace Tnb.EquipMgr } EqpMaintainTemEquipH oldMaintainTemEquipH = await db.Queryable().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).FirstAsync(); - await db.Deleteable().Where(x => x.maintain_tem_id == input.id && x.equip_id==equipId).ExecuteCommandAsync(); - if(oldMaintainTemEquipH!=null) - await db.Deleteable().Where(x => x.maintain_tem_equip_id==oldMaintainTemEquipH.id).ExecuteCommandAsync(); + await db.Deleteable().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync(); + if (oldMaintainTemEquipH != null) + await db.Deleteable().Where(x => x.maintain_tem_equip_id == oldMaintainTemEquipH.id).ExecuteCommandAsync(); } if (insertEqpMaintainTemEquipHs != null && insertEqpMaintainTemEquipHs.Count > 0) { await db.Insertable(insertEqpMaintainTemEquipHs).ExecuteCommandAsync(); } - + if (insertEqpMaintainTemEquipDs != null && insertEqpMaintainTemEquipDs.Count > 0) { await db.Insertable(insertEqpMaintainTemEquipDs).ExecuteCommandAsync(); } - + } }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "发布成功" : result.ErrorMessage; } } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs index e4a04049..f1093657 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -1,8 +1,6 @@ using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; using JNPF.Common.Filter; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; @@ -10,9 +8,7 @@ using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; @@ -37,7 +33,7 @@ namespace Tnb.EquipMgr private readonly IRunService _runService; private readonly IBillRullService _billRuleService; private readonly IUserManager _userManager; - + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); public EqpRepairApplyService(ISqlSugarRepository repository, @@ -53,45 +49,50 @@ namespace Tnb.EquipMgr _billRuleService = billRullService; OverideFuncs.CreateAsync = Create; } - + private async Task Create(VisualDevModelDataCrInput input) { if (!input.data.ContainsKey("create_time")) { - input.data.Add("create_time",DateTime.Now); - }else if ( string.IsNullOrEmpty((string)input.data["create_time"])) + input.data.Add("create_time", DateTime.Now); + } + else if (string.IsNullOrEmpty((string)input.data["create_time"])) { input.data["create_time"] = DateTime.Now; } - + if (!input.data.ContainsKey("create_id")) { - input.data.Add("create_id",_userManager.UserId); - }else if ( string.IsNullOrEmpty((string)input.data["create_id"])) + input.data.Add("create_id", _userManager.UserId); + } + else if (string.IsNullOrEmpty((string)input.data["create_id"])) { input.data["create_id"] = _userManager.UserId; } - + if (!input.data.ContainsKey("apply_user_id")) { - input.data.Add("apply_user_id",_userManager.UserId); - }else if ( string.IsNullOrEmpty((string)input.data["apply_user_id"])) + input.data.Add("apply_user_id", _userManager.UserId); + } + else if (string.IsNullOrEmpty((string)input.data["apply_user_id"])) { input.data["apply_user_id"] = _userManager.UserId; } - + if (!input.data.ContainsKey("org_id")) { - input.data.Add("org_id",_userManager.GetUserInfo().Result.organizeId); - }else if ( string.IsNullOrEmpty((string)input.data["org_id"])) + input.data.Add("org_id", _userManager.GetUserInfo().Result.organizeId); + } + else if (string.IsNullOrEmpty((string)input.data["org_id"])) { input.data["org_id"] = _userManager.GetUserInfo().Result.organizeId; } - + if (!input.data.ContainsKey("code")) { - input.data.Add("code",await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE)); - }else if (string.IsNullOrEmpty((string)input.data["code"])) + input.data.Add("code", await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE)); + } + else if (string.IsNullOrEmpty((string)input.data["code"])) { input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE); } @@ -100,7 +101,7 @@ namespace Tnb.EquipMgr eqpRepairApply.code = (string)input.data["code"]; eqpRepairApply.name = (string)input.data["name"]; eqpRepairApply.equip_id = (string)input.data["equip_id"]; - eqpRepairApply.expect_complete_time = input.data["expect_complete_time"]!=null && input.data["expect_complete_time"].ToString()!="" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null; + eqpRepairApply.expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null; eqpRepairApply.is_ugent = (int?)(long)input.data["is_ugent"]; eqpRepairApply.attachment = input.data.ContainsKey("attachment") ? (string)input.data["attachment"] : null; eqpRepairApply.apply_user_id = (string)input.data["apply_user_id"]; @@ -111,7 +112,7 @@ namespace Tnb.EquipMgr eqpRepairApply.description = (string)input.data["description"]; eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED; await _repository.InsertAsync(eqpRepairApply); - + // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); // await _runService.Create(templateEntity, input); return await Task.FromResult(true); @@ -144,7 +145,7 @@ namespace Tnb.EquipMgr { string id = dic["id"]; string repairerId = dic["repairerId"]; - EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id); + EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); if (eqpRepairApply.status == RepairApplyStatus.TOBEEXECUTED || eqpRepairApply.status == RepairApplyStatus.REFUSE) { @@ -159,14 +160,14 @@ namespace Tnb.EquipMgr { throw Oops.Bah("状态错误"); } - + } [HttpPost] public async Task Receive(Dictionary dic) { string id = dic["id"]; - EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id); + EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED) { if (_userManager.UserId == eqpRepairApply.repairer_id) @@ -196,7 +197,7 @@ namespace Tnb.EquipMgr var db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id); + EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED) { if (_userManager.UserId == eqpRepairApply.repairer_id) @@ -224,9 +225,9 @@ namespace Tnb.EquipMgr { throw Oops.Bah("状态错误"); } - + }); - if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); + if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); return "拒绝成功"; } @@ -236,17 +237,17 @@ namespace Tnb.EquipMgr string id = dic["id"]; return await _repository.GetSingleAsync(x => x.id == id); } - + [HttpPost] public async Task Register(RepairApplyRegisterInput input) { - - EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==input.id); + + EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == input.id); if (eqpRepairApply.status == RepairApplyStatus.RECEIVED) { if (_userManager.UserId == eqpRepairApply.repairer_id) { - string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED; + string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED; await _repository.UpdateAsync(x => new EqpRepairApply() { fault_id = input.fault_id, @@ -272,7 +273,7 @@ namespace Tnb.EquipMgr throw Oops.Bah("状态错误"); } - + } [HttpPost] @@ -281,7 +282,7 @@ namespace Tnb.EquipMgr string id = dic["id"]; EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); - EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable().FirstAsync(x=>x.repair_apply_id==id); + EqpRepairOutApply eqpRepairOutApply = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.repair_apply_id == id); return new RepairApplyDetailOutput() { @@ -300,21 +301,21 @@ namespace Tnb.EquipMgr queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a,b)=>a.apply_user_id==b.Id) - .LeftJoin((a,b,c)=>a.repairer_id==c.Id) - .Where(a=>a.equip_id==input.equip_id) - .OrderByDescending(a=>a.create_time) - .Select((a,b,c) => new EquipRepairRecordQueryOutput + .LeftJoin((a, b) => a.apply_user_id == b.Id) + .LeftJoin((a, b, c) => a.repairer_id == c.Id) + .Where(a => a.equip_id == input.equip_id) + .OrderByDescending(a => a.create_time) + .Select((a, b, c) => new EquipRepairRecordQueryOutput { id = a.id, equip_id = a.equip_id, code = a.code, name = a.name, - apply_user_id =b.RealName, - is_ugent = a.is_ugent==1 ? "是" : "否", + apply_user_id = b.RealName, + is_ugent = a.is_ugent == 1 ? "是" : "否", description = a.description, repair_description = a.repair_description, - complete_time = a.complete_time==null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM), + complete_time = a.complete_time == null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM), repairer_id = c.RealName }).ToPagedListAsync(input.currentPage, input.pageSize); @@ -332,11 +333,11 @@ namespace Tnb.EquipMgr { switch (input.status) { - case "1" : + case "1": statusList.Add(RepairApplyStatus.TOBEEXECUTED); statusList.Add(RepairApplyStatus.REFUSE); break; - case "2" : + case "2": statusList.Add(RepairApplyStatus.TOBERECEIVED); statusList.Add(RepairApplyStatus.RECEIVED); statusList.Add(RepairApplyStatus.OUTAPPLYAPPROVE); @@ -344,14 +345,14 @@ namespace Tnb.EquipMgr statusList.Add(RepairApplyStatus.APPROVENOTPASS); statusList.Add(RepairApplyStatus.TOBEOUTAPPLY); break; - case "3" : + case "3": statusList.Add(RepairApplyStatus.COMPLETED); statusList.Add(RepairApplyStatus.CLOSE); statusList.Add(RepairApplyStatus.REPEAL); break; } } - + if (string.IsNullOrEmpty(input.sidx)) { input.sidx = "a.create_time"; @@ -361,40 +362,40 @@ namespace Tnb.EquipMgr { input.sidx = "a." + input.sidx; } - + var db = _repository.AsSugarClient(); var result = await db.Queryable() - .LeftJoin((a,b)=>a.apply_user_id==b.Id) - .LeftJoin((a,b,c)=>a.repairer_id==c.Id) - .LeftJoin((a,b,c,d)=>a.equip_id==d.id) - .LeftJoin((a,b,c,d,e)=>e.EnCode==DictConst.RepairStatus) - .LeftJoin((a,b,c,d,e,f)=>e.Id==f.DictionaryTypeId && a.status==f.EnCode) - .WhereIF(!string.IsNullOrEmpty(input.equip_info),(a,b,c,d)=>d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info)) - .WhereIF(!string.IsNullOrEmpty(input.status),(a,b,c,d)=>statusList.Contains(a.status)) - .WhereIF(input.status=="3" && start_time!=null,a=>a.complete_time!=null && a.complete_time>=start_time) - .WhereIF(input.status=="3" && end_time!=null,a=>a.complete_time!=null && a.complete_time<=end_time) + .LeftJoin((a, b) => a.apply_user_id == b.Id) + .LeftJoin((a, b, c) => a.repairer_id == c.Id) + .LeftJoin((a, b, c, d) => a.equip_id == d.id) + .LeftJoin((a, b, c, d, e) => e.EnCode == DictConst.RepairStatus) + .LeftJoin((a, b, c, d, e, f) => e.Id == f.DictionaryTypeId && a.status == f.EnCode) + .WhereIF(!string.IsNullOrEmpty(input.equip_info), (a, b, c, d) => d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info)) + .WhereIF(!string.IsNullOrEmpty(input.status), (a, b, c, d) => statusList.Contains(a.status)) + .WhereIF(input.status == "3" && start_time != null, a => a.complete_time != null && a.complete_time >= start_time) + .WhereIF(input.status == "3" && end_time != null, a => a.complete_time != null && a.complete_time <= end_time) .OrderBy($"{input.sidx} {input.sort}") - .Select((a,b,c,d,e,f) => new PadRepairListOutput + .Select((a, b, c, d, e, f) => new PadRepairListOutput { id = a.id, - equip_id = d.code+"/"+d.name, + equip_id = d.code + "/" + d.name, equip_id_id = a.equip_id, code = a.code, name = a.name, - apply_user_id =b.RealName, - apply_user_id_id =b.Id, - is_ugent = a.is_ugent==1 ? "是" : "否", + apply_user_id = b.RealName, + apply_user_id_id = b.Id, + is_ugent = a.is_ugent == 1 ? "是" : "否", description = a.description, - create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - complete_time = a.complete_time==null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS), - expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + complete_time = a.complete_time == null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS), + expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS), repairer_id = c.RealName, repairer_id_id = c.Id, remark = a.remark, status = f.FullName }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); - - return PageResult.SqlSugarPageResult(result); + + return PageResult.SqlSugarPageResult(result); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs index d83763cb..58a7e909 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs @@ -36,7 +36,7 @@ namespace Tnb.EquipMgr [HttpPost] public async Task Delay(RepairDelayInput input) { - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == input.repair_apply_id); EqpRepairDelay repairDelay = new EqpRepairDelay() @@ -59,7 +59,7 @@ namespace Tnb.EquipMgr .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "延期成功" : result.ErrorMessage; } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs index a4fd2432..ced5c394 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs @@ -5,7 +5,6 @@ using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using JNPF.WorkFlow.Interfaces.Service; using JNPF.WorkFlow.Service; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; @@ -45,19 +44,19 @@ namespace Tnb.EquipMgr { string id = dic["id"]; EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == id); - return await _repository.GetSingleAsync(x => x.repair_apply_id==eqpRepairApply.id); + return await _repository.GetSingleAsync(x => x.repair_apply_id == eqpRepairApply.id); } [HttpPost] public async Task OutApply(RepairOutApplyInput input) { - EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x=>x.id==input.repair_apply_id); + EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == input.repair_apply_id); if (eqpRepairApply.status == RepairApplyStatus.TOBEOUTAPPLY || eqpRepairApply.status == RepairApplyStatus.APPROVENOTPASS) { var db = _repository.AsSugarClient(); string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id; - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { if (string.IsNullOrEmpty(input.id)) { @@ -94,14 +93,14 @@ namespace Tnb.EquipMgr } await db.Updateable() - .SetColumns(x=>x.status == RepairApplyStatus.OUTAPPLYAPPROVE) - .Where(x=>x.id==input.repair_apply_id).ExecuteCommandAsync(); + .SetColumns(x => x.status == RepairApplyStatus.OUTAPPLYAPPROVE) + .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); if (result.IsSuccess) { @@ -125,20 +124,20 @@ namespace Tnb.EquipMgr {"remark",input.remark}, {"approve_status",RepairOutApplyStatus.TOBEAPPROVE}, } - + }); } else { - var entity = await _repository.GetSingleAsync(x=>x.id==input.id); + var entity = await _repository.GetSingleAsync(x => x.id == input.id); if (entity != null) { - - await _flowTaskService.Update("",new FlowTaskSubmitModel() + + await _flowTaskService.Update("", new FlowTaskSubmitModel() { flowId = flowId, parentId = "0", - id = entity?.flow_task_id??"", + id = entity?.flow_task_id ?? "", formData = new JObject() { {"id",id}, @@ -153,7 +152,7 @@ namespace Tnb.EquipMgr {"remark",input.remark}, {"approve_status",RepairOutApplyStatus.TOBEAPPROVE}, } - + }); } } @@ -164,13 +163,13 @@ namespace Tnb.EquipMgr { throw Oops.Bah("状态错误"); } - + } [HttpPost] public async Task Register(RepairApplyOutRegisterInput input) { - + var db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { @@ -187,7 +186,7 @@ namespace Tnb.EquipMgr await db.Updateable().SetColumns(x => x.status == RepairApplyStatus.COMPLETED) .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "登记成功" : result.ErrorMessage; } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs index ffa74714..a07d90ed 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs @@ -4,7 +4,6 @@ using JNPF.DynamicApiController; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr diff --git a/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs b/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs index ab5eac67..8cd6c648 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs @@ -1,5 +1,4 @@ using JNPF.Common.Core.Manager; -using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -7,7 +6,6 @@ using JNPF.FriendlyException; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr @@ -42,7 +40,8 @@ namespace Tnb.EquipMgr if (entity.warn_unit == "1")//月 { entity.next_check_time = entity.end_time?.AddMonths(-entity.warm_time.Value); - }else if (entity.warn_unit == "2")//天 + } + else if (entity.warn_unit == "2")//天 { entity.next_check_time = entity.end_time?.AddDays(-entity.warm_time.Value); } diff --git a/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs b/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs index 66a40260..bcda549b 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs @@ -1,19 +1,15 @@ using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; -using Microsoft.ClearScript.Util.Web; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr @@ -24,7 +20,7 @@ namespace Tnb.EquipMgr [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleId)] - public class EqpSparePartsRequisitionHService : IEqpSparePartsRequisitionHService, IOverideVisualDevService,IDynamicApiController, ITransient + public class EqpSparePartsRequisitionHService : IEqpSparePartsRequisitionHService, IOverideVisualDevService, IDynamicApiController, ITransient { private const string ModuleId = "27338205223957"; private readonly ISqlSugarRepository _repository; @@ -32,7 +28,7 @@ namespace Tnb.EquipMgr private readonly IRunService _runService; private readonly IUserManager _userManager; private readonly IBillRullService _billRuleService; - + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); public EqpSparePartsRequisitionHService(ISqlSugarRepository repository, @@ -43,12 +39,12 @@ namespace Tnb.EquipMgr { _repository = repository; _visualDevService = visualDevService; - _runService = runService; + _runService = runService; _userManager = userManager; _billRuleService = billRuleService; OverideFuncs.CreateAsync = Create; } - + private async Task Create(VisualDevModelDataCrInput input) { var db = _repository.AsSugarClient(); @@ -73,15 +69,15 @@ namespace Tnb.EquipMgr if (input.data.TryGetValue("tablefield120", out var value)) { - var details = value.ToObject>>(); + var details = value.ToObject>>(); List eqpSparePartsList = new List(); - List eqpSparePartsRequisitionDs = new List(){}; + List eqpSparePartsRequisitionDs = new List() { }; foreach (var detail in details) { string instockDetailId = detail.ContainsKey("instock_detail_id") ? detail["instock_detail_id"] : ""; string sparePartsId = detail.ContainsKey("spare_parts_id") ? detail["spare_parts_id"] : ""; int quantity = Convert.ToInt32(detail.ContainsKey("quantity") ? detail["quantity"] : ""); - + eqpSparePartsRequisitionDs.Add(new EqpSparePartsRequisitionD { instock_detail_id = instockDetailId, @@ -90,7 +86,7 @@ namespace Tnb.EquipMgr equip_id = eqpSparePartsRequisitionH.equip_id, spare_parts_requisition_id = eqpSparePartsRequisitionH.id, }); - + if (await db.Queryable() .AnyAsync(x => x.id == instockDetailId && (x.quantity - x.use_quantity - quantity) >= 0)) { @@ -111,7 +107,7 @@ namespace Tnb.EquipMgr { throw new Exception("库存不够"); } - + } if (eqpSparePartsRequisitionDs.Count > 0) @@ -124,7 +120,7 @@ namespace Tnb.EquipMgr await db.Insertable(eqpSparePartsList).ExecuteCommandAsync(); } } - + }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); diff --git a/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs b/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs index f3036cb7..50fa264a 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs @@ -4,12 +4,11 @@ using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.EquipMgr.Interfaces; using Tnb.EquipMgr.Entities.Dto; +using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr { @@ -38,10 +37,10 @@ namespace Tnb.EquipMgr public async Task Publish(SpotInsTemPublishInput input) { var db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { EqpSpotInsTemH eqpSpotInsTemH = await _repository.GetSingleAsync(x => x.id == input.id); - List eqpSpotInsTemDs = await db.Queryable().Where(x=>x.spot_ins_tem_id==input.id).ToListAsync(); + List eqpSpotInsTemDs = await db.Queryable().Where(x => x.spot_ins_tem_id == input.id).ToListAsync(); if (input.equipIds != null && input.equipIds.Length > 0) { @@ -55,7 +54,7 @@ namespace Tnb.EquipMgr { id = id, code = code, - name = eqpSpotInsTemH.name+equipId, + name = eqpSpotInsTemH.name + equipId, plan_cycle = eqpSpotInsTemH.plan_cycle, plan_cycle_unit = eqpSpotInsTemH.plan_cycle_unit, plan_run_notice = eqpSpotInsTemH.plan_run_notice, @@ -93,26 +92,26 @@ namespace Tnb.EquipMgr } EqpSpotInsTemEquipH oldSpotInsTemEquipH = await db.Queryable().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).FirstAsync(); - await db.Deleteable().Where(x => x.spot_ins_tem_id == input.id && x.equip_id==equipId).ExecuteCommandAsync(); - if(oldSpotInsTemEquipH!=null) - await db.Deleteable().Where(x => x.spot_ins_tem_equip_id==oldSpotInsTemEquipH.id).ExecuteCommandAsync(); + await db.Deleteable().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync(); + if (oldSpotInsTemEquipH != null) + await db.Deleteable().Where(x => x.spot_ins_tem_equip_id == oldSpotInsTemEquipH.id).ExecuteCommandAsync(); } if (insertEqpSpotInsTemEquipHs != null && insertEqpSpotInsTemEquipHs.Count > 0) { await db.Insertable(insertEqpSpotInsTemEquipHs).ExecuteCommandAsync(); } - + if (insertEqpSpotInsTemEquipDs != null && insertEqpSpotInsTemEquipDs.Count > 0) { await db.Insertable(insertEqpSpotInsTemEquipDs).ExecuteCommandAsync(); } - + } }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "发布成功" : result.ErrorMessage; } } diff --git a/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs b/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs index 276ab5a1..7c278cd1 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs @@ -39,23 +39,23 @@ namespace Tnb.EquipMgr queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a, b) => a.create_id == b.Id) - .LeftJoin((a, b,c) => a.modify_id == c.Id) - .LeftJoin((a, b,c,d) => a.equip_id == d.id) - .Where((a,b,c,d)=>a.equip_id==input.equip_id) - .WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>a.code.Contains(queryJson!["code"])) - .WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>a.name.Contains(queryJson!["name"])) - .Select((a, b, c,d) => new SubEquipQueryOutput + .LeftJoin((a, b) => a.create_id == b.Id) + .LeftJoin((a, b, c) => a.modify_id == c.Id) + .LeftJoin((a, b, c, d) => a.equip_id == d.id) + .Where((a, b, c, d) => a.equip_id == input.equip_id) + .WhereIF(queryJson != null && queryJson.ContainsKey("code"), (a, b, c, d) => a.code.Contains(queryJson!["code"])) + .WhereIF(queryJson != null && queryJson.ContainsKey("name"), (a, b, c, d) => a.name.Contains(queryJson!["name"])) + .Select((a, b, c, d) => new SubEquipQueryOutput { id = a.id, create_id = b.RealName, create_id_id = a.create_id, - create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), - equip_id=d.name, - equip_id_id= a.equip_id, + create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), + equip_id = d.name, + equip_id_id = a.equip_id, code = a.code, modify_id = c.RealName, - modify_time = a.modify_time==null ? null : a.modify_time.Value.ToString("yyyy-MM-dd"), + modify_time = a.modify_time == null ? null : a.modify_time.Value.ToString("yyyy-MM-dd"), name = a.name, org_id = a.org_id, specification = a.specification, diff --git a/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs b/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs index 22035383..115999e8 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs @@ -32,20 +32,20 @@ namespace Tnb.EquipMgr { var db = _repository.AsSugarClient(); Dictionary? queryJson = new Dictionary(); - if (input!=null && !string.IsNullOrEmpty(input.queryJson)) + if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); } var result = await db.Queryable() - .WhereIF(input!=null,a=>a.equip_id==input!.equip_id) - .WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson!["name"])) + .WhereIF(input != null, a => a.equip_id == input!.equip_id) + .WhereIF(queryJson != null && queryJson.ContainsKey("name"), a => a.name.Contains(queryJson!["name"])) .Select(a => new EquipTechnologyParameterQueryOutput { id = a.id, name = a.name, definition = a.definition, remark = a.remark - }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); return PageResult.SqlSugarPageResult(result); } diff --git a/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs b/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs index 75ac0af0..750197da 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs @@ -6,7 +6,6 @@ using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using SqlSugar; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; @@ -40,11 +39,11 @@ namespace Tnb.EquipMgr // queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); // } var result = await db.Queryable() - .LeftJoin((a,b)=>a.old_workshop_id==b.Id) - .LeftJoin((a,b,c)=>a.new_workshop_id==c.Id) - .WhereIF(input!=null,a=>a.equip_id==input!.equip_id) + .LeftJoin((a, b) => a.old_workshop_id == b.Id) + .LeftJoin((a, b, c) => a.new_workshop_id == c.Id) + .WhereIF(input != null, a => a.equip_id == input!.equip_id) //.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson["name"])) - .Select((a,b,c) => new EquipWorkshopChangeQueryOutput + .Select((a, b, c) => new EquipWorkshopChangeQueryOutput { id = a.id, old_workshop_id = b.FullName, @@ -52,8 +51,8 @@ namespace Tnb.EquipMgr old_installation_location = a.old_installation_location, new_installation_location = a.new_installation_location, remark = a.remark, - create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), - }).ToPagedListAsync((input?.currentPage??1), (input?.pageSize??50)); + create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), + }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); return PageResult.SqlSugarPageResult(result); } @@ -62,7 +61,7 @@ namespace Tnb.EquipMgr public async Task WorkshopChange(EquipWorkshopChangeInput input) { var db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { EqpEquipment eqpEquipment = await db.Queryable().SingleAsync(x => x.id == input.equip_id); @@ -88,7 +87,7 @@ namespace Tnb.EquipMgr }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "迁移成功" : result.ErrorMessage; } } diff --git a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs index b5ed35e9..dd80af65 100644 --- a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs @@ -1,5 +1,4 @@ using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Filter; using JNPF.Common.Security; @@ -9,7 +8,6 @@ using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; @@ -49,44 +47,45 @@ namespace Tnb.EquipMgr OverideFuncs.GetListAsync = GetList; // OverideFuncs.UpdateAsync = ExecuteSpotIns; } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); - Dictionary? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary() : input.queryJson.ToObject>(); + Dictionary? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary() : input.queryJson.ToObject>(); string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : ""; string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : ""; - DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; - DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; - + DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; + DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; + if (string.IsNullOrEmpty(input.sidx)) { input.sidx = "a.create_time"; input.sort = "desc"; - }else + } + else { input.sidx = "a." + input.sidx; } - - var list = await db.Queryable((a, b, c,d) => new object[] + + var list = await db.Queryable((a, b, c, d) => new object[] { JoinType.Left, a.equip_id == b.id, JoinType.Left, a.execute_user_id == c.Id, JoinType.Left, a.repeat_user_id == d.Id, }) - .WhereIF(!string.IsNullOrEmpty(status),(a,b,c)=>a.status==status) - .WhereIF(!string.IsNullOrEmpty(equioInfo),(a,b,c)=>b.code.Contains(equioInfo)|| b.name.Contains(equioInfo)) - .WhereIF(status=="3" && start_time!=null,a=>a.execute_time>=start_time) - .WhereIF(status=="3" && end_time!=null,a=>a.execute_time<=end_time) + .WhereIF(!string.IsNullOrEmpty(status), (a, b, c) => a.status == status) + .WhereIF(!string.IsNullOrEmpty(equioInfo), (a, b, c) => b.code.Contains(equioInfo) || b.name.Contains(equioInfo)) + .WhereIF(status == "3" && start_time != null, a => a.execute_time >= start_time) + .WhereIF(status == "3" && end_time != null, a => a.execute_time <= end_time) .OrderBy($"{input.sidx} {input.sort}") - .Select((a, b, c,d) => new EqpMaintainRecordListOutput + .Select((a, b, c, d) => new EqpMaintainRecordListOutput { id = a.id, - equip_id = b.code+"/"+b.name, + equip_id = b.code + "/" + b.name, equip_id_id = a.equip_id, status = a.status, - result = a.result=="1" ? "合格" : "不合格", - repeat_result = a.repeat_result=="1" ? "合格" : "不合格", + result = a.result == "1" ? "合格" : "不合格", + repeat_result = a.repeat_result == "1" ? "合格" : "不合格", date_create_time = a.create_time, date_execute_time = a.execute_time, date_repeat_time = a.repeat_time, @@ -96,19 +95,19 @@ namespace Tnb.EquipMgr repeat_user_id_id = a.repeat_user_id, result_remark = a.result_remark, repeat_remark = a.repeat_remark, - date_last_execute_time = SqlFunc.Subqueryable().Where(x=>a.equip_id==x.equip_id && a.execute_time!=null).OrderByDesc(x=>x.execute_time).Select(x=>x.execute_time) + date_last_execute_time = SqlFunc.Subqueryable().Where(x => a.equip_id == x.equip_id && a.execute_time != null).OrderByDesc(x => x.execute_time).Select(x => x.execute_time) }) .Mapper(a => { - a.status = a.status=="1" ? "待执行" : a.status=="2" ? "待复核" : "已完成"; + a.status = a.status == "1" ? "待执行" : a.status == "2" ? "待复核" : "已完成"; a.create_time = a.date_create_time == null ? "" : a.date_create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.execute_time = a.date_execute_time == null ? "" : a.date_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.last_execute_time = a.date_last_execute_time == null ? "" : a.date_last_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); }) .ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); - - return PageResult.SqlSugarPageResult(list); + + return PageResult.SqlSugarPageResult(list); } /// @@ -118,9 +117,9 @@ namespace Tnb.EquipMgr [HttpPost] public async Task ExecuteMaintain(SpotInsRecordExecuteInput input) { - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - EqpMaintainRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.id); + EqpMaintainRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id); string status = ""; if (eqpSpotInsRecordH.is_repeat == "1") { @@ -130,32 +129,32 @@ namespace Tnb.EquipMgr { status = SpotInsRecordExecutionStatus.COMPLETED; } - await _repository.UpdateAsync(x => new EqpMaintainRecordH() - { - result = input.result, - attachment = input.attachment, - result_remark = input.result_remark, - status = status, - execute_time = DateTime.Now, - execute_user_id = _userManager.UserId - }, x => x.id == input.id); + await _repository.UpdateAsync(x => new EqpMaintainRecordH() + { + result = input.result, + attachment = input.attachment, + result_remark = input.result_remark, + status = status, + execute_time = DateTime.Now, + execute_user_id = _userManager.UserId + }, x => x.id == input.id); + + if (input != null && input.details != null) + { + foreach (var item in input.details) + { + await _repository.AsSugarClient().Updateable() + .SetColumns(x => x.result == item["result"]) + .SetColumnsIF(item.ContainsKey("maintain_descrip"), x => x.maintain_descrip == item["maintain_descrip"]) + .Where(x => x.id == item["id"]) + .ExecuteCommandAsync(); + } + } - if (input != null && input.details != null) - { - foreach (var item in input.details) - { - await _repository.AsSugarClient().Updateable() - .SetColumns(x=>x.result==item["result"]) - .SetColumnsIF(item.ContainsKey("maintain_descrip"),x=>x.maintain_descrip==item["maintain_descrip"]) - .Where(x=>x.id==item["id"]) - .ExecuteCommandAsync(); - } - } - }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "执行成功" : result.ErrorMessage; } @@ -176,13 +175,14 @@ namespace Tnb.EquipMgr .Where((a, b) => a.EnCode == DictConst.EqpMaintainType) .Select((a, b) => new { - b.EnCode, b.FullName + b.EnCode, + b.FullName }) .MergeTable() .ToDictionaryAsync(it => it.EnCode, it => it.FullName); eqpSpotInsRecordDs.ForEach(x => { - x.maintain_type = typeDic.ContainsKey(x.maintain_type) ? typeDic[x.maintain_type]+"" : x.maintain_type; + x.maintain_type = typeDic.ContainsKey(x.maintain_type) ? typeDic[x.maintain_type] + "" : x.maintain_type; }); MaintainRecordRepeatOutput output = new MaintainRecordRepeatOutput() { @@ -213,7 +213,7 @@ namespace Tnb.EquipMgr foreach (var item in input.details) { await db.Updateable() - .SetColumnsIF(item.ContainsKey("repeat_descrip"),x => x.repeat_descrip == item["repeat_descrip"]) + .SetColumnsIF(item.ContainsKey("repeat_descrip"), x => x.repeat_descrip == item["repeat_descrip"]) .SetColumns(x => x.repeat_result == item["repeat_result"]) .Where(x => x.id == item["id"]).ExecuteCommandAsync(); } @@ -231,8 +231,8 @@ namespace Tnb.EquipMgr }, x => x.id == input.id); } }); - - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "复核成功" : result.ErrorMessage; } @@ -246,44 +246,44 @@ namespace Tnb.EquipMgr queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a,b)=>a.equip_id==b.id) - .LeftJoin((a,b,c)=>a.execute_user_id==c.Id) - .LeftJoin((a,b,c,d)=>a.repeat_user_id==d.Id) - .Where(a=>a.equip_id==input.equip_id) - .Select((a,b,c,d) => new EquipMaintainRecordQueryOutput + .LeftJoin((a, b) => a.equip_id == b.id) + .LeftJoin((a, b, c) => a.execute_user_id == c.Id) + .LeftJoin((a, b, c, d) => a.repeat_user_id == d.Id) + .Where(a => a.equip_id == input.equip_id) + .Select((a, b, c, d) => new EquipMaintainRecordQueryOutput { id = a.id, attachment = a.attachment, - create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM), + create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM), equip_id = b.code, equip_id_id = a.equip_id, repeat_remark = a.repeat_remark, - repeat_result = a.repeat_result=="1"?"合格":"不合格", - repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM), + repeat_result = a.repeat_result == "1" ? "合格" : "不合格", + repeat_time = a.repeat_time == null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM), repeat_user_id = d.RealName, - result = a.result=="1"?"合格":"不合格", + result = a.result == "1" ? "合格" : "不合格", result_remark = a.result_remark, maintain_tem_equip_id = a.maintain_tem_equip_id, - execute_time = a.execute_time==null ? null : a.execute_time.Value.ToString(DbTimeFormat.MM), + execute_time = a.execute_time == null ? null : a.execute_time.Value.ToString(DbTimeFormat.MM), execute_user_id = c.RealName, status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("") }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } - + /// /// 根据id获取保养相关信息 /// /// [HttpPost] - public async Task GetEqpMaintainRecordInfoById(Dictionary dic) + public async Task GetEqpMaintainRecordInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; if (string.IsNullOrEmpty(id)) return null; var db = _repository.AsSugarClient(); return await db.Queryable() - .LeftJoin((a, b) => a.equip_id==b.id) + .LeftJoin((a, b) => a.equip_id == b.id) .Where((a, b) => a.id == id) .Select((a, b) => new { @@ -291,7 +291,7 @@ namespace Tnb.EquipMgr equip_id = a.equip_id, equip_code = b.code, equip_name = b.name, - create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), result_remark = a.result_remark, result = a.result, status = a.status, diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs index ec2b381f..3b0ffce9 100644 --- a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs @@ -1,5 +1,4 @@ using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Filter; using JNPF.Common.Security; @@ -8,18 +7,15 @@ using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; -using Tnb.BasicData.Entities; -using Tnb.BasicData.Entities.Dto; +using Tnb.BasicData; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; -using Tnb.BasicData; namespace Tnb.EquipMgr { @@ -54,11 +50,11 @@ namespace Tnb.EquipMgr private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); - Dictionary? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary() : input.queryJson.ToObject>(); + Dictionary? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary() : input.queryJson.ToObject>(); string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : ""; string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : ""; - DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; - DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; + DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; + DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; string now = DateTime.Now.ToString("yyyy-MM-dd"); if (string.IsNullOrEmpty(input.sidx)) { @@ -69,27 +65,27 @@ namespace Tnb.EquipMgr { input.sidx = "a." + input.sidx; } - - var list = await db.Queryable((a, b, c,d) => new object[] + + var list = await db.Queryable((a, b, c, d) => new object[] { JoinType.Left, a.equip_id == b.id, JoinType.Left, a.spot_record_user_id == c.Id, JoinType.Left, a.repeat_user_id == d.Id, }) - .WhereIF(!string.IsNullOrEmpty(status),(a,b,c)=>a.status==status) - .WhereIF(!string.IsNullOrEmpty(equioInfo),(a,b,c)=>b.code.Contains(equioInfo)|| b.name.Contains(equioInfo)) - .WhereIF(status=="3" && start_time!=null,a=>a.spot_record_date_time>=start_time) - .WhereIF(status=="3" && end_time!=null,a=>a.spot_record_date_time<=end_time) - .Where(a=>a.create_time.Value.ToString("yyyy-MM-dd")==now) + .WhereIF(!string.IsNullOrEmpty(status), (a, b, c) => a.status == status) + .WhereIF(!string.IsNullOrEmpty(equioInfo), (a, b, c) => b.code.Contains(equioInfo) || b.name.Contains(equioInfo)) + .WhereIF(status == "3" && start_time != null, a => a.spot_record_date_time >= start_time) + .WhereIF(status == "3" && end_time != null, a => a.spot_record_date_time <= end_time) + .Where(a => a.create_time.Value.ToString("yyyy-MM-dd") == now) .OrderBy($"{input.sidx} {input.sort}") - .Select((a, b, c,d) => new EqpSpotInsRecordListOutput + .Select((a, b, c, d) => new EqpSpotInsRecordListOutput { id = a.id, - equip_id = b.code+"/"+b.name, + equip_id = b.code + "/" + b.name, equip_id_id = a.equip_id, status = a.status, - result = a.result=="1" ? "合格" : "不合格", - repeat_result = a.repeat_result=="1" ? "合格" : "不合格", + result = a.result == "1" ? "合格" : "不合格", + repeat_result = a.repeat_result == "1" ? "合格" : "不合格", date_create_time = a.create_time, date_spot_record_date_time = a.spot_record_date_time, date_repeat_time = a.repeat_time, @@ -100,14 +96,14 @@ namespace Tnb.EquipMgr }) .Mapper(a => { - a.status = a.status=="1" ? "待执行" : a.status=="2" ? "待复核" : "已完成"; + a.status = a.status == "1" ? "待执行" : a.status == "2" ? "待复核" : "已完成"; a.create_time = a.date_create_time == null ? "" : a.date_create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.spot_record_date_time = a.date_spot_record_date_time == null ? "" : a.date_spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); }) .ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); - - return PageResult.SqlSugarPageResult(list); + + return PageResult.SqlSugarPageResult(list); } /// @@ -117,10 +113,10 @@ namespace Tnb.EquipMgr [HttpPost] public async Task ExecuteSpotIns(SpotInsRecordExecuteInput input) { - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x=>x.id==input.id); - + EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id); + string status = ""; if (eqpSpotInsRecordH.is_repeat == "1") { @@ -130,32 +126,32 @@ namespace Tnb.EquipMgr { status = SpotInsRecordExecutionStatus.COMPLETED; } - await _repository.UpdateAsync(x => new EqpSpotInsRecordH() - { - result = input.result, - attachment = input.attachment, - result_remark = input.result_remark, - status = status, - spot_record_date_time = DateTime.Now, - spot_record_user_id = _userManager.UserId - }, x => x.id == input.id); + await _repository.UpdateAsync(x => new EqpSpotInsRecordH() + { + result = input.result, + attachment = input.attachment, + result_remark = input.result_remark, + status = status, + spot_record_date_time = DateTime.Now, + spot_record_user_id = _userManager.UserId + }, x => x.id == input.id); + + if (input != null && input.details != null) + { + foreach (var item in input.details) + { + await _repository.AsSugarClient().Updateable(). + SetColumns(x => x.result == item["result"]) + .SetColumnsIF(item["judge_type"] == "1", x => x.real_value == Convert.ToDouble(item["real_value"])) + .Where(x => x.id == item["id"]) + .ExecuteCommandAsync(); + } + } - if(input!=null && input.details!=null) - { - foreach (var item in input.details) - { - await _repository.AsSugarClient().Updateable(). - SetColumns(x=>x.result==item["result"]) - .SetColumnsIF(item["judge_type"]=="1",x=>x.real_value==Convert.ToDouble(item["real_value"])) - .Where(x=>x.id==item["id"]) - .ExecuteCommandAsync(); - } - } - }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "执行成功" : result.ErrorMessage; } @@ -211,41 +207,41 @@ namespace Tnb.EquipMgr queryJson = JsonConvert.DeserializeObject>(input.queryJson); } var result = await db.Queryable() - .LeftJoin((a,b)=>a.repeat_user_id==b.Id) - .Where(a=>a.equip_id==input.equip_id) - .Select((a,b) => new EquipSpotInsRecordQueryOutput + .LeftJoin((a, b) => a.repeat_user_id == b.Id) + .Where(a => a.equip_id == input.equip_id) + .Select((a, b) => new EquipSpotInsRecordQueryOutput { id = a.id, attachment = a.attachment, - create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM), + create_time = a.create_time == null ? null : a.create_time.Value.ToString(DbTimeFormat.MM), equip_id = a.equip_id, repeat_remark = a.repeat_remark, - repeat_result = a.repeat_result=="1"?"合格":"不合格", - repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM), + repeat_result = a.repeat_result == "1" ? "合格" : "不合格", + repeat_time = a.repeat_time == null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM), repeat_user_id = b.RealName, - result = a.result=="1"?"合格":"不合格", + result = a.result == "1" ? "合格" : "不合格", result_remark = a.result_remark, spot_ins_tem_equip_id = a.spot_ins_tem_equip_id, - spot_record_date_time = a.spot_record_date_time==null ? null :a.spot_record_date_time.Value.ToString(DbTimeFormat.MM), + spot_record_date_time = a.spot_record_date_time == null ? null : a.spot_record_date_time.Value.ToString(DbTimeFormat.MM), spot_record_user_id = a.spot_record_user_id, status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("") }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } - + /// /// 根据id获取点巡检相关信息 /// /// [HttpPost] - public async Task GetEqpSpotInsRecordInfoById(Dictionary dic) + public async Task GetEqpSpotInsRecordInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; if (string.IsNullOrEmpty(id)) return null; var db = _repository.AsSugarClient(); return await db.Queryable() - .LeftJoin((a, b) => a.equip_id==b.id) + .LeftJoin((a, b) => a.equip_id == b.id) .Where((a, b) => a.id == id) .Select((a, b) => new { @@ -253,7 +249,7 @@ namespace Tnb.EquipMgr equip_id = a.equip_id, equip_code = b.code, equip_name = b.name, - create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), result_remark = a.result_remark, result = a.result, status = a.status, diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs index b4ff4caa..edc3b02b 100644 --- a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs @@ -1,12 +1,11 @@ using JNPF.Common.Enums; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.EquipMgr.Interfaces; using Tnb.EquipMgr.Entities; +using Tnb.EquipMgr.Interfaces; namespace Tnb.EquipMgr { @@ -15,7 +14,7 @@ namespace Tnb.EquipMgr /// [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] - public class EquSpotInsTemEquipService : IEquSpotInsTemEquipService, IDynamicApiController, ITransient + public class EquSpotInsTemEquipService : IEquSpotInsTemEquipService, IDynamicApiController, ITransient { private readonly ISqlSugarRepository _repository; @@ -28,7 +27,7 @@ namespace Tnb.EquipMgr public async Task Stop(Dictionary parameters) { string id = parameters["id"]; - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { await _repository.UpdateAsync(x => new EqpSpotInsTemEquipH() { @@ -39,13 +38,13 @@ namespace Tnb.EquipMgr .Select(x => x.id).ToListAsync(); await _repository.AsSugarClient().Deleteable() .Where(x => x.spot_ins_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync(); - + await _repository.AsSugarClient().Deleteable() .Where(x => ids.Contains(x.spot_ins_record_id)).ExecuteCommandAsync(); }); - - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs index 3ca12c85..c8392d9c 100644 --- a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs @@ -1,28 +1,21 @@ -using Aop.Api.Domain; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -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.Permission; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; -using Senparc.NeuChar.ApiHandlers; using SqlSugar; using Tnb.BasicData; +using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; -using Tnb.BasicData.Entities; namespace Tnb.EquipMgr { @@ -75,7 +68,7 @@ namespace Tnb.EquipMgr id = it.id, eqp_code = it.code, eqp_name = it.name, - eqp_type_code = SqlFunc.Subqueryable().Where(x=>x.id == it.equip_type_id).Select(x=>x.code), + eqp_type_code = SqlFunc.Subqueryable().Where(x => x.id == it.equip_type_id).Select(x => x.code), //accept_status = it.accept_status, //supplier_code = it.supplier_code, install_date = it.install_date, @@ -86,7 +79,7 @@ namespace Tnb.EquipMgr .ToPagedListAsync(input.currentPage, input.pageSize); return pagedList; } - + private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) { string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"]?.ToString() : ""; @@ -98,7 +91,7 @@ namespace Tnb.EquipMgr { VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); await _runService.Create(templateEntity, visualDevModelDataCrInput); - + string equipId = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? ""; if (!string.IsNullOrEmpty(qrcode)) @@ -117,18 +110,18 @@ namespace Tnb.EquipMgr } return await Task.FromResult(true); } - - private async Task Update(string id,VisualDevModelDataUpInput visualDevModelDataUpInput) + + private async Task Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput) { string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"]?.ToString() : ""; - if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id!=id)) + if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id)) { throw Oops.Bah("二维码总表中已存在该二维码"); } else { VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); - await _runService.Update(id,templateEntity, visualDevModelDataUpInput); + await _runService.Update(id, templateEntity, visualDevModelDataUpInput); if (!string.IsNullOrEmpty(qrcode)) { @@ -157,7 +150,7 @@ namespace Tnb.EquipMgr } [HttpPost] - public async Task GetEntityById(Dictionary dic) + public async Task GetEntityById(Dictionary dic) { string id = dic["id"]; return await _repository.GetSingleAsync(x => x.id == id); @@ -173,24 +166,24 @@ namespace Tnb.EquipMgr } [HttpPost] - public async Task GetWorklineAndEquipTree(Dictionary dic) + public async Task GetWorklineAndEquipTree(Dictionary dic) { string equipTypes = dic.ContainsKey("equipTypes") ? dic["equipTypes"] : ""; var db = _repository.AsSugarClient(); var queryable1 = db.Queryable() - .Where((a) => a.DeleteMark == null && a.Category==DictConst.RegionCategoryWorkshopCode) + .Where((a) => a.DeleteMark == null && a.Category == DictConst.RegionCategoryWorkshopCode) .Select((a) => new WorklineAndEquipTreeOutput() { id = a.Id, - title = a.EnCode+"/"+a.FullName, + title = a.EnCode + "/" + a.FullName, parentId = "0", - hasChildren = SqlFunc.Subqueryable().Where(b=>b.ParentId==a.Id && b.DeleteMark==null && b.Category==DictConst.RegionCategoryWorklineCode).Any(), - num = SqlFunc.Subqueryable().Where(b=>b.ParentId==a.Id && b.DeleteMark==null && b.Category==DictConst.RegionCategoryWorklineCode).Count(), + hasChildren = SqlFunc.Subqueryable().Where(b => b.ParentId == a.Id && b.DeleteMark == null && b.Category == DictConst.RegionCategoryWorklineCode).Any(), + num = SqlFunc.Subqueryable().Where(b => b.ParentId == a.Id && b.DeleteMark == null && b.Category == DictConst.RegionCategoryWorklineCode).Count(), isLeaf = false, - children = SqlFunc.Subqueryable().Where(b=>b.ParentId==a.Id && b.DeleteMark==null && b.Category==DictConst.RegionCategoryWorklineCode).ToList(b=>new WorklineAndEquipTreeOutput() + children = SqlFunc.Subqueryable().Where(b => b.ParentId == a.Id && b.DeleteMark == null && b.Category == DictConst.RegionCategoryWorklineCode).ToList(b => new WorklineAndEquipTreeOutput() { id = b.Id, - title = b.EnCode+"/"+b.FullName, + title = b.EnCode + "/" + b.FullName, parentId = b.ParentId, hasChildren = false, num = 0, @@ -209,31 +202,31 @@ namespace Tnb.EquipMgr id = a.id, title = a.name, parentId = "0", - hasChildren = SqlFunc.Subqueryable().Where(b=>b.equip_type_id==a.id).Any(), - num = SqlFunc.Subqueryable().Where(b=>b.equip_type_id==a.id).Count(), + hasChildren = SqlFunc.Subqueryable().Where(b => b.equip_type_id == a.id).Any(), + num = SqlFunc.Subqueryable().Where(b => b.equip_type_id == a.id).Count(), isLeaf = false, - children = SqlFunc.Subqueryable().Where(b=>b.equip_type_id==a.id).ToList(b=>new WorklineAndEquipTreeOutput() + children = SqlFunc.Subqueryable().Where(b => b.equip_type_id == a.id).ToList(b => new WorklineAndEquipTreeOutput() { id = b.id, - title = b.code+"/"+b.name, + title = b.code + "/" + b.name, parentId = b.equip_type_id, hasChildren = false, num = 0, isLeaf = true, }) }).ToListAsync(); - + } // var list = await db.UnionAll(queryable1, queryable2).ToListAsync(); var list1 = await queryable1.ToListAsync(); list1.AddRange(list2); - return new AuthResponse(200, "", new Dictionary() + return new AuthResponse(200, "", new Dictionary() { ["list"] = list1, }); } - + [HttpPost] public async Task GetEntityByQrcode(Dictionary dic) { diff --git a/EquipMgr/Tnb.EquipMgr/MoldMaintainBaseService.cs b/EquipMgr/Tnb.EquipMgr/MoldMaintainBaseService.cs index 9fdee9cf..41082ee5 100644 --- a/EquipMgr/Tnb.EquipMgr/MoldMaintainBaseService.cs +++ b/EquipMgr/Tnb.EquipMgr/MoldMaintainBaseService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.EquipMgr +namespace Tnb.EquipMgr { public class MoldMaintainBaseService { diff --git a/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj b/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj index bc0feb94..b5cf8e54 100644 --- a/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj +++ b/EquipMgr/Tnb.EquipMgr/Tnb.EquipMgr.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldHouseService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldHouseService.cs index f4c33e23..ccdbb9ca 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldHouseService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldHouseService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.ClayObject.Extensions; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; using JNPF.DynamicApiController; using Microsoft.AspNetCore.Mvc; using SqlSugar; diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs index 465f1a23..8c68f022 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -26,7 +20,7 @@ namespace Tnb.EquipMgr [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleId)] - public class ToolMoldLocationService : IToolMoldLocationService,IOverideVisualDevService, IDynamicApiController, ITransient + public class ToolMoldLocationService : IToolMoldLocationService, IOverideVisualDevService, IDynamicApiController, ITransient { public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); private const string ModuleId = "27207685649173"; @@ -50,7 +44,7 @@ namespace Tnb.EquipMgr { return await _db.Queryable().ToDictionaryAsync(x => x.id, x => x.location_code); } - + private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) { string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : ""; @@ -62,7 +56,7 @@ namespace Tnb.EquipMgr { VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); await _runService.Create(templateEntity, visualDevModelDataCrInput); - + string id = visualDevModelDataCrInput.data["ReturnIdentity"].ToString() ?? ""; if (!string.IsNullOrEmpty(qrcode)) @@ -81,18 +75,18 @@ namespace Tnb.EquipMgr } return await Task.FromResult(true); } - - private async Task Update(string id,VisualDevModelDataUpInput visualDevModelDataUpInput) + + private async Task Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput) { string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : ""; - if (!string.IsNullOrEmpty(qrcode) && await _db.Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id!=id)) + if (!string.IsNullOrEmpty(qrcode) && await _db.Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id)) { throw Oops.Bah("二维码总表中已存在该二维码"); } else { VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); - await _runService.Update(id,templateEntity, visualDevModelDataUpInput); + await _runService.Update(id, templateEntity, visualDevModelDataUpInput); if (!string.IsNullOrEmpty(qrcode)) { diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs index efb856da..dfe67409 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs @@ -1,26 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; -using JNPF.Common.Enums; -using JNPF.Common.Security; +using System.Linq.Expressions; +using JNPF.Common.Contracts; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.FriendlyException; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using JNPF.Common.Contracts; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; -using Senparc.Weixin.MP.AdvancedAPIs.GroupMessage; -using Aop.Api.Domain; namespace Tnb.EquipMgr { diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs index 016c0aca..5f137ba9 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -14,7 +8,6 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; -using Spire.Pdf.Widget; using SqlSugar; using Tnb.BasicData; using Tnb.EquipMgr.Entities; diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs index 1df9f805..a1be51ba 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs @@ -1,14 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Reactive; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Security; @@ -21,15 +11,10 @@ using JNPF.TaskScheduler; using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; using JNPF.TaskScheduler.Entitys.Model; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using Microsoft.CodeAnalysis.CSharp.Syntax; using SqlSugar; using Tnb.BasicData; -using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; @@ -44,7 +29,7 @@ namespace Tnb.EquipMgr [OverideVisualDev(ModuleId)] public class ToolMoldMaintainRuleService : IOverideVisualDevService, IToolMoldMaintainRuleService, IDynamicApiController, ITransient { - + private const string ModuleId = "26164864904981"; private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; @@ -74,13 +59,13 @@ namespace Tnb.EquipMgr toolMoldMaintainRule.cycle = cycle; toolMoldMaintainRule.startandend_date = startTime.ToString("yyyy-MM-dd HH:mm:ss"); toolMoldMaintainRule.create_id = _userManager.UserId; - toolMoldMaintainRule.create_time=DateTime.Now; + toolMoldMaintainRule.create_time = DateTime.Now; await _db.Insertable(toolMoldMaintainRule).ExecuteCommandAsync(); if (toolMoldMaintainRule.mode == "27118635748885") { string id = toolMoldMaintainRule.id; var comtentModel = new ContentModel(); - comtentModel.cron = "0 0 9 "+ startTime.Day + "/"+ toolMoldMaintainRule.cycle + " * ?"; + comtentModel.cron = "0 0 9 " + startTime.Day + "/" + toolMoldMaintainRule.cycle + " * ?"; comtentModel.interfaceId = ""; comtentModel.interfaceName = ""; comtentModel.parameter = new List(); diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs index 0bb50b4c..f7de66d7 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs @@ -1,18 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Numerics; -using System.Reactive.Joins; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using Aspose.Cells.Drawing; -using Aspose.Words; -using DingTalk.Api.Request; +using System.Dynamic; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; -using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -21,9 +9,7 @@ using JNPF.Logging; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using SqlSugar; using StackExchange.Profiling.Internal; using Tnb.BasicData; @@ -65,13 +51,13 @@ namespace Tnb.EquipMgr var planMoldRelations = await _db.Queryable() .LeftJoin((a, b) => a.maintain_plan_id == b.id)//ToolMoldMaintainPlan .LeftJoin((a, b, c) => a.mold_id == c.id) - .LeftJoin((a, b, c,d) => d.plan_code == b.plan_code&&d.mold_code==c.mold_code) + .LeftJoin((a, b, c, d) => d.plan_code == b.plan_code && d.mold_code == c.mold_code) .Where(a => a.maintain_plan_id == planId) - .Select((a, b, c,d) => new + .Select((a, b, c, d) => new { mold_id = a.mold_id, plan_start_time = d.plan_start_time, - designer=d.designer + designer = d.designer }) .ToListAsync(); var moldids = planMoldRelations.Select(x => x.mold_id).ToList(); @@ -117,7 +103,7 @@ namespace Tnb.EquipMgr var dic = await _db.Queryable().Where(p => p.DictionaryTypeId == "26149299883285").ToListAsync(); var users = await _db.Queryable().ToListAsync(); var records = _db.Queryable().ToList(); - var runrecords = _db.Queryable().ToList(); + var runrecords = _db.Queryable().ToList(); foreach (var plan in plans) { var planMoldRelations = await _db.Queryable() @@ -154,14 +140,14 @@ namespace Tnb.EquipMgr info.maintain_qty = mold.maintain_qty; info.plan_start_time = plan.plan_start_date == null ? "" : ((DateTime)plan.plan_start_date!).ToString("yyyy-MM-dd"); info.createtime = plan.create_time == null ? "" : ((DateTime)plan.create_time).ToString("yyyy-MM-dd"); - info.status = records.Where(p=>p.mold_id== mold.id&&p.plan_id== plan.id).Any()? "已完成" : "待保养";//plan.status == "UnMaintain" ? "待保养" : "已完成"; + info.status = records.Where(p => p.mold_id == mold.id && p.plan_id == plan.id).Any() ? "已完成" : "待保养";//plan.status == "UnMaintain" ? "待保养" : "已完成"; info.createuser = string.IsNullOrEmpty(plan.create_id) ? "" : users.Where(p => p.Id == plan.create_id).First().RealName; info.plan_id = plan.id; info.starttime = ""; if (runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).Any()) { var run = runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).First(); - info.starttime = run.plan_start_time!=null? ((DateTime)run.plan_start_time).ToString("yyyy-MM-dd") : ""; + info.starttime = run.plan_start_time != null ? ((DateTime)run.plan_start_time).ToString("yyyy-MM-dd") : ""; } var moldEqpRelation = ToolMoldsEquipments.Where(it => it.mold_id == mold.id).FirstOrDefault(); if (moldEqpRelation != null) @@ -203,13 +189,13 @@ namespace Tnb.EquipMgr input.sidx = "b." + input.sidx; } var records = await _db.Queryable().Select(p => p.plan_id + p.mold_id).ToListAsync(); - var result= await _db.Queryable() + var result = await _db.Queryable() .LeftJoin((a, b) => a.maintain_plan_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => b.plan_code == d.plan_code && c.mold_code == d.mold_code) .LeftJoin((a, b, c, d, e) => e.plan_id == b.id && e.mold_id == c.id) .LeftJoin((a, b, c, d, e, f) => b.create_id == f.Id) - .LeftJoin((a, b, c, d, e, f,g) => c.mold_status == g.Id) + .LeftJoin((a, b, c, d, e, f, g) => c.mold_status == g.Id) .Where((a, b, c, d, e, f) => b.create_time != null) .WhereIF(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f, g) => c.mold_code!.Contains(input.maintain_info) || c.mold_name!.Contains(input.maintain_info)) .WhereIF(start_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time >= start_time) @@ -222,7 +208,7 @@ namespace Tnb.EquipMgr mold_id = c.id, mold_code = c.mold_code!, mold_name = c.mold_name!, - mold_status=g.FullName!, + mold_status = g.FullName!, status = input.status, createuser = f.RealName, createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS), @@ -276,7 +262,7 @@ namespace Tnb.EquipMgr }) .ToListAsync(); //新增功能 - var ToolMoldMaintainPlanRelation= _db.Queryable().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id&& !string.IsNullOrEmpty(a.group_id)).First(); + var ToolMoldMaintainPlanRelation = _db.Queryable().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id && !string.IsNullOrEmpty(a.group_id)).First(); if (ToolMoldMaintainPlanRelation != null) items = items.Where(a => a.item_group_id == ToolMoldMaintainPlanRelation.group_id).ToList(); var checkItems = await _db.Queryable().Where(it => it.plan_id == input.plan_id && it.mold_id == input.mold_id).Select(it => new @@ -315,10 +301,10 @@ namespace Tnb.EquipMgr public async Task MaintainStart(MoldMaintainRunUpInput input) { if (input == null) throw new ArgumentNullException("input"); - var flag= _db.Queryable() + var flag = _db.Queryable() .LeftJoin((a, b) => a.plan_code == b.plan_code) - .LeftJoin((a,b,c)=>a.mold_code==c.mold_code) - .Where((a,b,c)=>b.id== input.plan_id&&c.id==input.mold_id).Any(); + .LeftJoin((a, b, c) => a.mold_code == c.mold_code) + .Where((a, b, c) => b.id == input.plan_id && c.id == input.mold_id).Any(); if (flag) { return; @@ -348,13 +334,13 @@ namespace Tnb.EquipMgr record.designer_time = DateTime.Now; record.mold_code = mold.mold_code; record.mold_name = mold.mold_name; - record.plan_start_time = string.IsNullOrEmpty(input.starttime) ? DateTime.Now :DateTime.Parse(input.starttime); + record.plan_start_time = string.IsNullOrEmpty(input.starttime) ? DateTime.Now : DateTime.Parse(input.starttime); var row = await _db.Insertable(record).ExecuteCommandAsync(); if (row < 1) throw Oops.Oh(ErrorCode.COM1001); var groupids = _db.Queryable().Where(a => !string.IsNullOrEmpty(a.group_id) && a.mold_id == input.mold_id && a.maintain_plan_id == input.plan_id).ToList().Select(p => p.group_id); - + /* var maintainInfos = await _db.Queryable() .LeftJoin((a, b) => a.item_group_id == b.id) @@ -500,7 +486,7 @@ namespace Tnb.EquipMgr }).ToListAsync(); var dicCheckItems = checkItems.GroupBy(g => $"{g.plan_id}{g.mold_id}{g.item_group_id}{g.item_id}").ToDictionary(x => x.Key, x => x.FirstOrDefault()); var maintainedItems = items.Where(it => dicCheckItems.ContainsKey($"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}") && dicCheckItems[$"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}"] != null).ToList(); - if ((items?.Count > 0 && maintainedItems?.Count > 0 )|| (maintainedItems == null || maintainedItems.Count < 1)) + if ((items?.Count > 0 && maintainedItems?.Count > 0) || (maintainedItems == null || maintainedItems.Count < 1)) { if (maintainedItems.Count < items.Count || (maintainedItems == null || maintainedItems.Count < 1)) { diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs index ad70afc4..a1a20167 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; +using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -15,9 +8,7 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Logging.Abstractions; using SqlSugar; -using Tnb.BasicData; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Entities.Enums; @@ -69,11 +60,11 @@ namespace Tnb.EquipMgr var pair = row[nameof(ToolMoldMaintainTask.mold_id)]; if (pair.IsNotEmptyOrNull()) { - if(_dicMold.TryGetValue(pair.ToString(),out var multi)) + if (_dicMold.TryGetValue(pair.ToString(), out var multi)) { row[nameof(ToolMoldMaintainTask.mold_id)] = $"{multi.code}/{multi.name}"; } - + } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs index 5020a9ee..c74f2413 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaterialService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.DependencyInjection; @@ -33,13 +27,12 @@ namespace Tnb.EquipMgr /// /// 根据模具id获取物料集合 /// - /// /// [HttpPost] public async Task> GetMaterialLists(ToolMoldInput ToolMoldInput) { - var db = _repository.AsSugarClient(); - var list = await db.Queryable((a, b) => new object[] + ISqlSugarClient db = _repository.AsSugarClient(); + List list = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.id == b.material_id, }) @@ -49,7 +42,7 @@ namespace Tnb.EquipMgr id = a.id, code = a.code, name = a.name, - material_group=b.material_group, + material_group = b.material_group, real_cavity_qty = b.real_cavity_qty.HasValue ? b.real_cavity_qty.Value : 0 }).ToListAsync(); return list; @@ -57,105 +50,93 @@ namespace Tnb.EquipMgr /// /// 增加模具物料绑定 /// - /// - /// - /// + /// /// [HttpPost] public async Task SaveData(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var ToolMoldsProduct= await _repository.AsSugarClient().Queryable().Where(p=>p.mold_id== ToolMoldInput.mold&&p.material_id== ToolMoldInput.materialid).FirstAsync(); + ToolMoldsMaterial ToolMoldsProduct = await _repository.AsSugarClient().Queryable().Where(p => p.mold_id == ToolMoldInput.mold && p.material_id == ToolMoldInput.materialid).FirstAsync(); if (ToolMoldsProduct == null) { - var entity = new ToolMoldsMaterial(); - entity.id = SnowflakeIdHelper.NextId(); - entity.mold_id = ToolMoldInput.mold; - entity.material_id = ToolMoldInput.materialid; - entity.real_cavity_qty = ToolMoldInput.real_cavity_qty; - entity.create_time = DateTime.Now; - entity.create_id = _userManager.UserId; - await _repository.AsSugarClient().Insertable(entity).ExecuteCommandAsync(); + ToolMoldsMaterial entity = new() + { + id = SnowflakeIdHelper.NextId(), + mold_id = ToolMoldInput.mold, + material_id = ToolMoldInput.materialid, + real_cavity_qty = ToolMoldInput.real_cavity_qty, + create_time = DateTime.Now, + create_id = _userManager.UserId + }; + _ = await _repository.AsSugarClient().Insertable(entity).ExecuteCommandAsync(); } - else { - ToolMoldsProduct.real_cavity_qty= ToolMoldInput.real_cavity_qty; - await _repository.AsSugarClient().Updateable(ToolMoldsProduct).ExecuteCommandAsync(); + else + { + ToolMoldsProduct.real_cavity_qty = ToolMoldInput.real_cavity_qty; + _ = await _repository.AsSugarClient().Updateable(ToolMoldsProduct).ExecuteCommandAsync(); } - - + + }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; - - + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); } /// /// 批量删除模具物料绑定 /// - /// - /// /// [HttpPost] public async Task DetachMoldData(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList(); - await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync(); + List arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList(); + _ = await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "操作成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage); } /// /// 物料同组 /// - /// - /// /// [HttpPost] public async Task SaveMaterialGroup(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList(); - var sign = SnowflakeIdHelper.NextId(); + List arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList(); + string sign = SnowflakeIdHelper.NextId(); arr.ForEach(p => { p.material_group = sign; }); - await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "操作成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage); } /// /// 取消物料同组 /// - /// - /// /// - public async Task CancelMaterialGroup(ToolMoldInput ToolMoldInput) + public async Task CancelMaterialGroup(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList(); + List arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.materialids.Contains(x.material_id)).ToList(); arr.ForEach(p => { p.material_group = string.Empty; }); - await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Updateable(arr).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "操作成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage); } /// /// 根据物料id获取模具集合 /// - /// /// [HttpPost] public async Task> GetMoldLists(ToolMoldInput ToolMoldInput) { - var db = _repository.AsSugarClient(); - var list = await db.Queryable((a, b) => new object[] + ISqlSugarClient db = _repository.AsSugarClient(); + List list = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.id == b.mold_id, }) @@ -173,19 +154,17 @@ namespace Tnb.EquipMgr /// /// 批量删除物料模具绑定 /// - /// - /// + /// /// [HttpPost] public async Task DetachMaterialData(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var arr = _repository.AsSugarClient().Queryable().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.material_id == ToolMoldInput.materialid).ToList(); - await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync(); + List arr = _repository.AsSugarClient().Queryable().Where(x => ToolMoldInput.molds.Contains(x.mold_id) && x.material_id == ToolMoldInput.materialid).ToList(); + _ = await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "操作成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage); } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs index e7cbfec5..a129d430 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs @@ -1,7 +1,6 @@ using System.Dynamic; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; -using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; @@ -15,7 +14,6 @@ using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; -using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; @@ -57,42 +55,42 @@ namespace Tnb.EquipMgr string? requisitionCode = ""; DateTime[] requisitionTimeArr = null; DateTime[] estimatedReturnArr = null; - if (input!=null && !string.IsNullOrEmpty(input.queryJson)) + if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); } - + if (queryJson!.TryGetValue("requisition_code", out var value)) { requisitionCode = value.ToString(); } if (queryJson!.TryGetValue("requisition_time", out var value1)) { - requisitionTimeArr = value1.ToObject().Select(x=>DateTimeOffset.FromUnixTimeSeconds(x/1000).ToLocalTime().DateTime).ToArray(); + requisitionTimeArr = value1.ToObject().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray(); } if (queryJson!.TryGetValue("estimated_return_time", out var value2)) { - estimatedReturnArr = value2.ToObject().Select(x=>DateTimeOffset.FromUnixTimeSeconds(x/1000).ToLocalTime().DateTime).ToArray(); + estimatedReturnArr = value2.ToObject().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray(); } var result = await _db.Queryable() .LeftJoin((a, b) => a.mo_task_id == b.id) .LeftJoin((a, b, c) => a.equip_id == c.id) .LeftJoin((a, b, c, d) => a.recipient_id == d.Id) - .LeftJoin((a,b,c,d,e)=>a.mold_id==e.id) + .LeftJoin((a, b, c, d, e) => a.mold_id == e.id) .WhereIF(!string.IsNullOrEmpty(requisitionCode), (a, b, c, d) => a.code.Contains(requisitionCode)) - .WhereIF(requisitionTimeArr!=null, (a, b, c, d) => a.requisition_time>=requisitionTimeArr[0] && a.requisition_time<=requisitionTimeArr[1]) - .WhereIF(estimatedReturnArr!=null, (a, b, c, d) => a.estimated_return_time>=estimatedReturnArr[0] && a.estimated_return_time<=estimatedReturnArr[1]) - .Select((a, b, c, d,e) => new ToolMoldRequisitionListOutput + .WhereIF(requisitionTimeArr != null, (a, b, c, d) => a.requisition_time >= requisitionTimeArr[0] && a.requisition_time <= requisitionTimeArr[1]) + .WhereIF(estimatedReturnArr != null, (a, b, c, d) => a.estimated_return_time >= estimatedReturnArr[0] && a.estimated_return_time <= estimatedReturnArr[1]) + .Select((a, b, c, d, e) => new ToolMoldRequisitionListOutput { id = a.id, code = a.code, mold_id = e.mold_code, mo_task_id = b.mo_task_code, - equip_id = c.code+"/"+c.name, + equip_id = c.code + "/" + c.name, recipient_id = d.RealName, - estimated_return_time = a.estimated_return_time==null ? "" : a.estimated_return_time.Value.ToString("yyyy-MM-dd"), - requisition_time = a.requisition_time==null ? "" : a.requisition_time.Value.ToString("yyyy-MM-dd"), + estimated_return_time = a.estimated_return_time == null ? "" : a.estimated_return_time.Value.ToString("yyyy-MM-dd"), + requisition_time = a.requisition_time == null ? "" : a.requisition_time.Value.ToString("yyyy-MM-dd"), remark = a.remark }).ToPagedListAsync(input.currentPage, input.pageSize); @@ -127,8 +125,8 @@ namespace Tnb.EquipMgr List result = new(); var BasLocations = await _db.Queryable().ToListAsync(); var ToolMolds = await _db.Queryable() - .WhereIF(!string.IsNullOrEmpty(toolinput.keyword),p=>p.mold_code!.Contains(toolinput.keyword!)|| p.mold_name!.Contains(toolinput.keyword!)) - .WhereIF(!string.IsNullOrEmpty(toolinput.status), p => p.mold_status== dic.Where(p=>p.Value== toolinput.status).First().Key) + .WhereIF(!string.IsNullOrEmpty(toolinput.keyword), p => p.mold_code!.Contains(toolinput.keyword!) || p.mold_name!.Contains(toolinput.keyword!)) + .WhereIF(!string.IsNullOrEmpty(toolinput.status), p => p.mold_status == dic.Where(p => p.Value == toolinput.status).First().Key) .ToListAsync(); if (string.IsNullOrEmpty(toolinput.sort)) { @@ -138,12 +136,12 @@ namespace Tnb.EquipMgr foreach (var tool in ToolMolds) { dynamic info = new ExpandoObject(); - info.id=tool.id; - info.mold_code=tool.mold_code; + info.id = tool.id; + info.mold_code = tool.mold_code; info.mold_name = tool.mold_name; - info.mold_status= dic.Where(p=>p.Key==tool.mold_status).Any()? dic.Where(p => p.Key == tool.mold_status).First().Value:""; - info.warehosue_id=tool.warehosue_id; - info.location_id= BasLocations.Where(p => p.id == tool.location_id).Any() ? BasLocations.Where(p => p.id == tool.location_id).First().location_code : ""; + info.mold_status = dic.Where(p => p.Key == tool.mold_status).Any() ? dic.Where(p => p.Key == tool.mold_status).First().Value : ""; + info.warehosue_id = tool.warehosue_id; + info.location_id = BasLocations.Where(p => p.id == tool.location_id).Any() ? BasLocations.Where(p => p.id == tool.location_id).First().location_code : ""; result.Add(info); } return result; diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs index 79e9a012..cbf274e4 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs @@ -9,9 +9,7 @@ using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; -using Tnb.ProductionMgr.Entities; namespace Tnb.EquipMgr { @@ -21,7 +19,7 @@ namespace Tnb.EquipMgr [ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleId)] - public class ToolMoldReturnService : IOverideVisualDevService, IToolMoldReturnService,IDynamicApiController, ITransient + public class ToolMoldReturnService : IOverideVisualDevService, IToolMoldReturnService, IDynamicApiController, ITransient { private const string ModuleId = "27275901607701"; private readonly ISqlSugarClient _db; @@ -40,7 +38,7 @@ namespace Tnb.EquipMgr _visualDevService = visualDevService; OverideFuncs.CreateAsync = Create; } - + private async Task Create(VisualDevModelDataCrInput input) { DbResult result = await _db.Ado.UseTranAsync(async () => @@ -60,7 +58,7 @@ namespace Tnb.EquipMgr { await _db.Updateable() .SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.ZKTypeId) - .SetColumnsIF(!string.IsNullOrEmpty(locationId),x=>x.location_id==locationId) + .SetColumnsIF(!string.IsNullOrEmpty(locationId), x => x.location_id == locationId) .Where(X => X.id == moldId).ExecuteCommandAsync(); } }); diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs index 6b010062..871b8345 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs @@ -1,15 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; -using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -17,15 +8,12 @@ using JNPF.FriendlyException; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula.Functions; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; -using Tnb.ProductionMgr.Entities.Dto; namespace Tnb.EquipMgr { /// diff --git a/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamOutput.cs b/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamOutput.cs index 9b35fff1..96538916 100644 --- a/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamOutput.cs +++ b/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamOutput.cs @@ -3,9 +3,9 @@ namespace Tnb.PerMgr.Entities.Dto public class ProcessParamOutput { public string? name { get; set; } - + public decimal upper_value { get; set; } - + public decimal lower_value { get; set; } } } \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamTypeChildrenOutput.cs b/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamTypeChildrenOutput.cs index d437adc9..6d8cc3f9 100644 --- a/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamTypeChildrenOutput.cs +++ b/PerMgr/Tnb.PerMgr.Entities/Dto/ProcessParamTypeChildrenOutput.cs @@ -14,7 +14,7 @@ namespace Tnb.PerMgr.Entities.Dto public decimal? value { get; set; } public decimal upper_value { get; set; } public decimal lower_value { get; set; } - + public string? daq_id { get; set; } } } \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsD.cs b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsD.cs index d49222ac..0dd10a74 100644 --- a/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsD.cs +++ b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsD.cs @@ -18,7 +18,7 @@ public partial class PerProcessStandardsD : BaseEntity /// 工艺标准主表id /// public string process_standards_id { get; set; } = string.Empty; - + /// /// 工艺参数类型id /// @@ -43,7 +43,7 @@ public partial class PerProcessStandardsD : BaseEntity /// 下限 /// public decimal? lower_value { get; set; } - + /// /// 数据采集id /// diff --git a/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs index 2c3cf474..7a33f8f7 100644 --- a/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs +++ b/PerMgr/Tnb.PerMgr.Entities/Entity/PerProcessStandardsH.cs @@ -103,7 +103,7 @@ public partial class PerProcessStandardsH : BaseEntity /// 流程引擎Id /// public string? f_flowid { get; set; } - + /// /// 成型周期 /// diff --git a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs index a4d98d0b..355c68c0 100644 --- a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs +++ b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamService.cs @@ -1,4 +1,3 @@ -using Microsoft.AspNetCore.Mvc; using Tnb.PerMgr.Entities.Dto; namespace Tnb.PerMgr.Interfaces @@ -10,7 +9,7 @@ namespace Tnb.PerMgr.Interfaces /// /// /// - public Task GetProcessParamInfo(Dictionary dic); + public Task GetProcessParamInfo(Dictionary dic); } } \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamTypeService.cs b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamTypeService.cs index 1b334363..ae5cc894 100644 --- a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamTypeService.cs +++ b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessParamTypeService.cs @@ -16,8 +16,8 @@ namespace Tnb.PerMgr.Interfaces /// /// public Task SaveData(List input); - - + + /// /// 根据id获取修改信息 /// diff --git a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs index c3208c25..3076cc57 100644 --- a/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs +++ b/PerMgr/Tnb.PerMgr.Interfaces/IPerProcessStandardsService.cs @@ -10,12 +10,12 @@ namespace Tnb.PerMgr.Interfaces /// /// public Task ExportTemplate(); - - + + /// /// 导入 /// /// - public Task> Import(string id,ChunkModel input); + public Task> Import(string id, ChunkModel input); } } \ No newline at end of file diff --git a/PerMgr/Tnb.PerMgr/PerProcessParamService.cs b/PerMgr/Tnb.PerMgr/PerProcessParamService.cs index c0959d67..ab3f4b73 100644 --- a/PerMgr/Tnb.PerMgr/PerProcessParamService.cs +++ b/PerMgr/Tnb.PerMgr/PerProcessParamService.cs @@ -1,12 +1,7 @@ using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.FriendlyException; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using NPOI.SS.UserModel; -using NPOI.SS.Util; -using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.PerMgr.Entities; using Tnb.PerMgr.Entities.Dto; @@ -23,13 +18,13 @@ namespace Tnb.PerMgr { private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; - + public PerProcessParamService(ISqlSugarRepository repository, IUserManager userManager) { _userManager = userManager; _repository = repository; } - + [HttpPost] public async Task GetProcessParamInfo(Dictionary dic) { diff --git a/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs b/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs index 92d612f2..39b798ad 100644 --- a/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs +++ b/PerMgr/Tnb.PerMgr/PerProcessParamTypeService.cs @@ -22,7 +22,7 @@ namespace Tnb.PerMgr { private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; - + public PerProcessParamTypeService(ISqlSugarRepository repository, IUserManager userManager) { _userManager = userManager; @@ -40,27 +40,27 @@ namespace Tnb.PerMgr //List perProcessParamTypes = await _repository.GetListAsync(x => x.equip_type_id == equipTypeId); var result = await db.Queryable() .Where(x => x.equip_type_id == equipTypeId) - .OrderBy(x=>x.ordinal) + .OrderBy(x => x.ordinal) .Select(x => new { tab_id = x.id, tab_name = x.name, - daq_list = SqlFunc.Subqueryable().Where(a=>a.equip_id==equipId).ToList(a=>new ProcessParamTypeDaqListOutput + daq_list = SqlFunc.Subqueryable().Where(a => a.equip_id == equipId).ToList(a => new ProcessParamTypeDaqListOutput { id = a.id, label_name = a.label_name, }), children = SqlFunc.Subqueryable() - .LeftJoin((y,z)=>y.tolerance_category_id==z.id) - .Where(y=>y.process_param_type_id==x.id) - .OrderBy((y,z)=>y.ordinal) - .ToList((y,z)=>new ProcessParamTypeChildrenOutput - { - process_param_id = y.id, - name = y.name, - upper_value = z.upper_value, - lower_value = z.lower_value - }), + .LeftJoin((y, z) => y.tolerance_category_id == z.id) + .Where(y => y.process_param_type_id == x.id) + .OrderBy((y, z) => y.ordinal) + .ToList((y, z) => new ProcessParamTypeChildrenOutput + { + process_param_id = y.id, + name = y.name, + upper_value = z.upper_value, + lower_value = z.lower_value + }), }).ToListAsync(); @@ -105,10 +105,10 @@ namespace Tnb.PerMgr }; await db.Insertable(record).ExecuteCommandAsync(); } - + } - - if (item==null || string.IsNullOrEmpty(item.id)) + + if (item == null || string.IsNullOrEmpty(item.id)) { PerProcessStandardsD insertObj = new PerProcessStandardsD() { @@ -116,20 +116,20 @@ namespace Tnb.PerMgr process_param_id = item?.process_param_id ?? "", process_standards_id = item?.process_standards_id ?? "", process_param_type_id = item?.process_param_type_id ?? "", - daq_id = item?.daq_id??"", + daq_id = item?.daq_id ?? "", }; - + insertIds.Add(insertObj.id); await db.Insertable(insertObj).ExecuteCommandAsync(); } else { await db.Updateable() - .SetColumns(x=>x.value==item.value) - .SetColumns(x=>x.daq_id==item.daq_id) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.value == item.value) + .SetColumns(x => x.daq_id == item.daq_id) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } - + } List notDeleteIds = input.Select(x => x.id).ToList(); @@ -138,9 +138,9 @@ namespace Tnb.PerMgr } - + }); - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "保存成功" : result.ErrorMessage; } @@ -156,31 +156,31 @@ namespace Tnb.PerMgr var result = await db.Queryable() .Where(a => a.equip_type_id == equipTypeId) - .OrderBy(a=>a.ordinal) + .OrderBy(a => a.ordinal) .Select(a => new { tab_id = a.id, tab_name = a.name, - daq_list = SqlFunc.Subqueryable().Where(e=>e.equip_id==perProcessStandardsH.equip_id).ToList(e=>new ProcessParamTypeDaqListOutput + daq_list = SqlFunc.Subqueryable().Where(e => e.equip_id == perProcessStandardsH.equip_id).ToList(e => new ProcessParamTypeDaqListOutput { id = e.id, label_name = e.label_name, }), children = SqlFunc.Subqueryable() - .LeftJoin((b,c)=>b.process_param_id==c.id) - .LeftJoin((b,c,d)=>c.tolerance_category_id==d.id) - .Where((b,c,d)=>c.process_param_type_id==a.id && b.process_standards_id==id) - .OrderBy((b,c,d)=>c.ordinal) - .ToList((b,c,d)=>new ProcessParamTypeChildrenOutput - { - id = b.id, - process_param_id = c.id, - name = c.name, - value = b.value, - upper_value = d.upper_value, - lower_value = d.lower_value, - daq_id = b.daq_id - }), + .LeftJoin((b, c) => b.process_param_id == c.id) + .LeftJoin((b, c, d) => c.tolerance_category_id == d.id) + .Where((b, c, d) => c.process_param_type_id == a.id && b.process_standards_id == id) + .OrderBy((b, c, d) => c.ordinal) + .ToList((b, c, d) => new ProcessParamTypeChildrenOutput + { + id = b.id, + process_param_id = c.id, + name = c.name, + value = b.value, + upper_value = d.upper_value, + lower_value = d.lower_value, + daq_id = b.daq_id + }), }).ToListAsync(); diff --git a/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs b/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs index 29220237..4ba4afdc 100644 --- a/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs +++ b/PerMgr/Tnb.PerMgr/PerProcessStandardsService.cs @@ -1,18 +1,12 @@ -using System.Data; -using JNPF; using JNPF.Common.Configuration; using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager.Files; -using JNPF.Common.Enums; -using JNPF.Common.Helper; using JNPF.Common.Models; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Common; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; @@ -20,7 +14,6 @@ using NPOI.SS.Util; using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.PerMgr.Entities; -using Tnb.PerMgr.Entities.Dto; using Tnb.PerMgr.Interfaces; namespace Tnb.PerMgr @@ -36,8 +29,8 @@ namespace Tnb.PerMgr private readonly IUserManager _userManager; private readonly FileManager _fileManager; private readonly FileService _fileService; - - public PerProcessStandardsService(ISqlSugarRepository repository, + + public PerProcessStandardsService(ISqlSugarRepository repository, FileService fileService, FileManager fileManager, IUserManager userManager) @@ -47,7 +40,7 @@ namespace Tnb.PerMgr _fileManager = fileManager; _fileService = fileService; } - + [AllowAnonymous] [HttpGet] public async Task ExportTemplate() @@ -55,13 +48,13 @@ namespace Tnb.PerMgr try { var db = _repository.AsSugarClient(); - string[] perProcessParamTypes = await db.Queryable().OrderBy(x => x.ordinal).Select(x=>x.name).ToArrayAsync(); - string[] perProcessParams = await db.Queryable().OrderBy(x => x.ordinal).Select(x=>x.name).ToArrayAsync(); - - + string[] perProcessParamTypes = await db.Queryable().OrderBy(x => x.ordinal).Select(x => x.name).ToArrayAsync(); + string[] perProcessParams = await db.Queryable().OrderBy(x => x.ordinal).Select(x => x.name).ToArrayAsync(); + + XSSFWorkbook workbook = new XSSFWorkbook(); NPOI.SS.UserModel.ISheet sheet = workbook.CreateSheet("BOM详情"); - + IRow row1 = sheet.CreateRow(0); string[] titles = new[] { "工艺参数类型", "工艺参数", "设定值" }; @@ -69,11 +62,11 @@ namespace Tnb.PerMgr { ICell cell1 = row1.CreateCell(i); cell1.SetCellValue(titles[i]); - sheet.SetColumnWidth(i,15 * 256); + sheet.SetColumnWidth(i, 15 * 256); } // int rowIndex = 1; - + // var column = sheet.GetColumn(0); // 设置下拉项 var validationHelper = sheet.GetDataValidationHelper(); @@ -81,15 +74,15 @@ namespace Tnb.PerMgr var region = new CellRangeAddressList(1, 1000, 0, 0); var validation = validationHelper.CreateValidation(constraint, region); sheet.AddValidationData(validation); - + var constraint2 = validationHelper.CreateExplicitListConstraint(perProcessParams); var region2 = new CellRangeAddressList(1, 1000, 1, 1); var validation2 = validationHelper.CreateValidation(constraint2, region2); sheet.AddValidationData(validation2); - + MemoryStream ms = new MemoryStream(); - + workbook.Write(ms); MemoryStream ms2 = new MemoryStream(ms.ToArray()); ms2.Position = 0; @@ -101,11 +94,11 @@ namespace Tnb.PerMgr Console.WriteLine(e); throw Oops.Bah("导出失败"); } - + } [HttpPost] - public async Task> Import([FromForm]string id, [FromForm]ChunkModel input) + public async Task> Import([FromForm] string id, [FromForm] ChunkModel input) { int rowIndex = 1; bool flag = false; @@ -114,16 +107,16 @@ namespace Tnb.PerMgr { using (Stream stream = input.file.OpenReadStream()) { - + // 2007版本 if (input.fileName.IndexOf(".xlsx") > 0) workbook = new XSSFWorkbook(stream); else if (input.fileName.IndexOf(".xls") > 0) workbook = new HSSFWorkbook(stream); - + ISheet? sheet = workbook?.GetSheetAt(0); - - if(workbook==null || sheet==null) + + if (workbook == null || sheet == null) throw Oops.Bah("无导入数据"); if (sheet?.LastRowNum <= 1) @@ -133,12 +126,12 @@ namespace Tnb.PerMgr List perProcessParamTypes = await db.Queryable().ToListAsync(); List perProcessParams = await db.Queryable().ToListAsync(); int errorColumnIndex = 5; - + ICellStyle style = workbook.CreateCellStyle(); - IFont font = workbook.CreateFont(); + IFont font = workbook.CreateFont(); font.Color = IndexedColors.Red.Index; // 将字体颜色设置为红色 style.SetFont(font); - + List list = new List() { }; for (rowIndex = 1; rowIndex <= sheet?.LastRowNum; rowIndex++) { @@ -170,14 +163,14 @@ namespace Tnb.PerMgr else { ICell errorCell = row.GetCell(errorColumnIndex) ?? row.CreateCell(errorColumnIndex); - errorCell.SetCellValue(errorCell.StringCellValue+",无该工艺参数"); + errorCell.SetCellValue(errorCell.StringCellValue + ",无该工艺参数"); errorCell.CellStyle = style; flag = true; } if (!TrySetNumberCellValue(cell2, ref item)) { ICell errorCell = row.GetCell(errorColumnIndex) ?? row.CreateCell(errorColumnIndex); - errorCell.SetCellValue(errorCell.StringCellValue+",设定值不是数字"); + errorCell.SetCellValue(errorCell.StringCellValue + ",设定值不是数字"); errorCell.CellStyle = style; flag = true; } @@ -186,7 +179,7 @@ namespace Tnb.PerMgr list.Add(item); } - + if (row.GetCell(errorColumnIndex) != null) { row.GetCell(errorColumnIndex).SetCellValue(row.GetCell(errorColumnIndex).StringCellValue.Substring(1)); @@ -199,18 +192,18 @@ namespace Tnb.PerMgr .FirstAsync(x => x.process_param_id == item.process_param_id && x.process_param_type_id == item.process_param_type_id && x.process_standards_id == id); - if (oldData!=null) + if (oldData != null) { if (oldData.value != item.value) { - + PerProcessStandardsH perProcessStandardsH = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == oldData.process_standards_id); PerProcessParam processParam = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == oldData.process_param_id); - + await _repository.AsSugarClient().Updateable() - .SetColumns(x=>x.value==item.value) - .Where(x=>x.id==oldData.id).ExecuteCommandAsync(); - + .SetColumns(x => x.value == item.value) + .Where(x => x.id == oldData.id).ExecuteCommandAsync(); + PerProcessParamEditRecord record = new PerProcessParamEditRecord { process_param_id = item.process_param_id, @@ -234,14 +227,14 @@ namespace Tnb.PerMgr if (flag) { MemoryStream ms = new MemoryStream(); - + workbook?.Write(ms); string fileName = $"工艺标准导入报错{DateTime.Now.Ticks}.xlsx"; using (MemoryStream ms2 = new MemoryStream(ms.ToArray())) { ms2.Position = 0; await _fileManager.UploadFileByType(ms2, FileVariable.TemporaryFilePath, fileName); - + } return new Dictionary() { @@ -258,21 +251,21 @@ namespace Tnb.PerMgr ["msg"] = "导入成功", }; } - + } } catch (Exception e) - { + { Console.WriteLine(e.Message); JNPF.Logging.Log.Error("工艺标准导入失败", e); throw Oops.Bah("导入失败"); } - - + + } - private bool TrySetNumberCellValue(ICell cell,ref PerProcessStandardsD item) + private bool TrySetNumberCellValue(ICell cell, ref PerProcessStandardsD item) { try { diff --git a/PerMgr/Tnb.PerMgr/Tnb.PerMgr.csproj b/PerMgr/Tnb.PerMgr/Tnb.PerMgr.csproj index e09a63c1..f61d2bcb 100644 --- a/PerMgr/Tnb.PerMgr/Tnb.PerMgr.csproj +++ b/PerMgr/Tnb.PerMgr/Tnb.PerMgr.csproj @@ -1,6 +1,6 @@ - - + + net6.0 enable enable diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs index cd925157..9b424570 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/DictionaryConstants.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Consts +namespace Tnb.ProductionMgr.Entities.Consts { /// /// 工单状态 @@ -19,8 +13,8 @@ namespace Tnb.ProductionMgr.Entities.Consts /// 待排产 /// public const string WaitProductId = "25019244276501"; - + } - + } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/ModuleConst.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/ModuleConst.cs index 409f2184..3ab16a70 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/ModuleConst.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Consts/ModuleConst.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr; +namespace Tnb.ProductionMgr; public class ModuleConst { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs index a5aaca03..cc9d4e1c 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/DictionaryTreeOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { public class DictionaryTreeOutput { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AddAndonInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AddAndonInput.cs index b4fc2c9d..cbaa2a7b 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AddAndonInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AddAndonInput.cs @@ -3,9 +3,9 @@ namespace Tnb.ProductionMgr.Entities.Dto public class AddAndonInput { public string andon_type_id { get; set; } - + public string andon_info_id { get; set; } - + public string andon_breakdown_id { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListInput.cs index 929989e5..fcd563ea 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListInput.cs @@ -3,9 +3,9 @@ namespace Tnb.ProductionMgr.Entities.Dto public class AndonPadListInput { public string andon_type_id { get; set; } - + public string status { get; set; } - + /// /// 页码. /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs index 0566d0ed..c522a234 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPadListOutput.cs @@ -2,15 +2,15 @@ namespace Tnb.ProductionMgr.Entities.Dto { public class AndonPadListOutput { - public string id { get; set; } - public string andon_info_name { get; set; } - public string promoter_name { get; set; } - public string repair_name { get; set; } - public string? promoter_time { get; set; } - public string? response_time { get; set; } - public string? start_repair_time { get; set; } - public string? end_repair_time { get; set; } - public string? confirm_time { get; set; } - public string status { get; set; } + public string id { get; set; } + public string andon_info_name { get; set; } + public string promoter_name { get; set; } + public string repair_name { get; set; } + public string? promoter_time { get; set; } + public string? response_time { get; set; } + public string? start_repair_time { get; set; } + public string? end_repair_time { get; set; } + public string? confirm_time { get; set; } + public string status { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonRecordInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonRecordInput.cs index c9100230..a108f835 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonRecordInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonRecordInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { public class AndonRecordInput { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CloseDownStartInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CloseDownStartInput.cs index 52975ea2..e7743275 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CloseDownStartInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CloseDownStartInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 停机开始输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryOutput.cs index 3f1a6658..51fb9b33 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { public class ClosedownHistoryOutput { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryQuery.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryQuery.cs index 86087362..53719464 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryQuery.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ClosedownHistoryQuery.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Filter; +using JNPF.Common.Filter; namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CountEstimatedEndTimeInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CountEstimatedEndTimeInput.cs index 4f74f496..a7e8c411 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CountEstimatedEndTimeInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/CountEstimatedEndTimeInput.cs @@ -6,17 +6,17 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public class CountEstimatedEndTimeInput { public DateTime estimated_start_date { get; set; } - + public int scheduled_qty { get; set; } - + public string? equip_id { get; set; } - + public string? molds_id { get; set; } - + public string? material_id { get; set; } - + public string? mbom_id { get; set; } - + /// /// 1 注塑挤出排产 2 组装包装排产 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/EquipmentListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/EquipmentListOutput.cs index 124992f5..e9f73f0f 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/EquipmentListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/EquipmentListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 设备列表输出参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/FeedingRecordTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/FeedingRecordTreeOutput.cs index f8cae0d2..d2175b07 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/FeedingRecordTreeOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/FeedingRecordTreeOutput.cs @@ -11,16 +11,16 @@ namespace Tnb.ProductionMgr.Entities.Dto { public string id { get; set; } public string code { get; set; } - + public string mo_task_id { get; set; } public List children { get; set; } = new List(); } - + public class FeedingRecordMaterialChildren { public string material_code { get; set; } - + public string material_name { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GanntSaveInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GanntSaveInput.cs index 393c24fd..0d8fbe37 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GanntSaveInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GanntSaveInput.cs @@ -6,13 +6,13 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string row_id { get; set; } public GanntTime time { get; set; } } - + public class GanntTime { public DateTime? start { get; set; } public DateTime? end { get; set; } } - + public class GanntTimeTips { public string mo_task_code { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs index 049cf59f..eb2f2dcf 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GenSubMoCrInput.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { public class GenSubMoCrInput { public string bom_id { get; set; } - + /// /// 父工单id /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs index 79368c6f..c97a1e60 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/GeneralOutstockInput.cs @@ -6,11 +6,11 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 目标库位编号 /// public string location_code { get; set; } = string.Empty; - + /// 所属工位 /// public string? workstation_id { get; set; } - + /// /// 任务单 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/IcmoUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/IcmoUpInput.cs index b6648b96..a2e868a6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/IcmoUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/IcmoUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产任务单更新输入参数 @@ -35,5 +29,5 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 生产任务单数量 /// //public int scheduled_qty { get; set; } - } + } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutInput.cs index bbbfda0b..41264525 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutInput.cs @@ -7,82 +7,82 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 出库仓库ID /// public string warehouse_id { get; set; } = string.Empty; - + /// /// 目标库位编号 /// public string location_code { get; set; } = string.Empty; - + /// /// 产品ID /// public string material_id { get; set; } = string.Empty; - + /// /// 产品编号 /// public string? material_code { get; set; } - + /// /// 齐套搭配方案ID /// public string collocation_scheme_id { get; set; } = string.Empty; - + /// /// 齐套搭配方案编号 /// public string? collocation_scheme_code { get; set; } - + /// /// 顺序号 /// public string? seq { get; set; } - + /// /// 创建用户 /// public string? create_id { get; set; } - + /// /// 创建时间 /// public DateTime? create_time { get; set; } - + /// /// 所属组织 /// public string? org_id { get; set; } - + /// /// 流程任务Id /// public string? f_flowtaskid { get; set; } - + /// /// 流程引擎Id /// public string? f_flowid { get; set; } - + /// /// 单据号 /// public string code { get; set; } = string.Empty; - + /// /// 所属工位 /// public string? workstation_id { get; set; } - + /// /// 所属产线 /// public string? workline_id { get; set; } - + /// /// 任务单 /// public string? mo_task_id { get; set; } - - public List> tableField115 { get; set; } + + public List> tableField115 { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutNewInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutNewInput.cs index bf98ca2b..58783612 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutNewInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/KittingOutNewInput.cs @@ -2,26 +2,26 @@ namespace Tnb.ProductionMgr.Entities.Dto { public class KittingOutNewInput { - + /// /// 目标库位编号 /// public string location_code { get; set; } = string.Empty; - - + + /// /// 齐套搭配方案ID /// public string collocation_scheme_id { get; set; } = string.Empty; - + /// 所属工位 /// public string? workstation_id { get; set; } - + /// /// 任务单 /// public string? mo_task_id { get; set; } - + } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs index c8f0b087..4f09160e 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialPreparationPlanOutput.cs @@ -21,7 +21,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string workstation_id { get; set; } public List children { get; set; } = new List(); } - + public class MaterialPreparationPlanDDOutput { public string material_id { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptInput.cs index 94e5d2ed..a89af914 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptInput.cs @@ -3,52 +3,52 @@ namespace Tnb.ProductionMgr.Entities.Dto public class MaterialReceiptInput { public string? id { get; set; } - + /// /// 签收单号 /// public string code { get; set; } = string.Empty; - + /// /// 工位id /// public string station_id { get; set; } = string.Empty; - + /// /// 任务单id /// public string? mo_task_id { get; set; } - + /// /// 工序id /// public string? process_id { get; set; } - + /// /// 设备id /// public string? equip_id { get; set; } - + /// /// 车间id /// public string? workshop_id { get; set; } - + /// /// 载具id /// public string? carry_id { get; set; } - + /// /// 产线id /// public string? workline_id { get; set; } - + /// /// 二维码信息 /// public string? carry_code { get; set; } - + /// /// 备注 /// @@ -58,7 +58,7 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 生产bom工序id /// public string? mbom_process_id { get; set; } - - public List>? details { get; set; } + + public List>? details { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptNewInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptNewInput.cs index 452fc14a..909e107f 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptNewInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MaterialReceiptNewInput.cs @@ -6,22 +6,22 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 工位id /// public string station_id { get; set; } = string.Empty; - + /// /// 任务单id /// public string? mo_task_id { get; set; } - + /// /// 设备id /// public string? equip_id { get; set; } - + /// /// 二维码信息 /// public string? carry_code { get; set; } - - public List>? details { get; set; } + + public List>? details { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs index 6521a6e3..7d318873 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoCrInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产工单下发输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs index 34be5b6d..913a85d8 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/MoldListOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.ProductionMgr.Entities; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 模具列表输出参数 @@ -36,6 +29,6 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 可用台数 /// public int available_stations { get; set; } - public string mold_id { get; set;} + public string mold_id { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs index f332da09..ddf21a33 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PADPackageTaskPageOutput.cs @@ -3,12 +3,12 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public class PADPackageTaskPageOutput { public string id { get; set; } - + /// /// 工单号号 /// public string? mo_code { get; set; } - + /// /// 生产任务编号 /// @@ -23,15 +23,15 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 物料Id /// public string material_id { get; set; } - + public string material_code { get; set; } public string material_name { get; set; } - + /// /// 产线id /// public string? workline_id { get; set; } - + public string? workline_name { get; set; } /// @@ -43,7 +43,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 任务单状态 /// public string? mo_task_status { get; set; } - + /// @@ -65,7 +65,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 排产类型:1、注塑、挤出2、组装、包装 /// public int? schedule_type { get; set; } - + public int? reported_work_qty { get; set; } /// @@ -81,14 +81,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 父任务Id /// public string? parent_id { get; set; } - + /// /// 工序id /// public string process_id { get; set; } - + public string process_name { get; set; } - + public string mbom_process_id { get; set; } public string equip_id { get; set; } public string equip_code { get; set; } @@ -97,7 +97,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string mold_code { get; set; } public string mold_name { get; set; } public DateTime? create_time { get; set; } - + /// /// 成型周期 /// @@ -107,17 +107,17 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 模穴数 /// public int? mold_cavity { get; set; } - + /// /// 标准工时 /// public string? standard_time { get; set; } - + /// /// 实际开工日期 /// public string? act_start_date { get; set; } - + /// /// 预计结束时间 /// @@ -134,22 +134,22 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 最小包装 /// public decimal? minpacking { get; set; } - + /// /// 主单位数量 /// public string? main_num { get; set; } - + /// /// 副单位数量(kg) /// public string? deputy_num { get; set; } - + /// /// 第三方平台设备编号 /// public string? third_equip_code { get; set; } - + /// /// 称重点位名称 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackPrdTaskUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackPrdTaskUpInput.cs index f766406b..6e3d7765 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackPrdTaskUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackPrdTaskUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 组装、包装,生产任务修改输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs index 0cd3de9f..64f79cdf 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackReportTreeOutput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Security; +using JNPF.Common.Security; namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs index fe5d7e06..25fbf278 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSchedlingCrInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 组装、包装排产输入参数 @@ -27,7 +21,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 物料Id /// public string material_id { get; set; } - + /// /// 排产数量 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackScheldToBeIssueListInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackScheldToBeIssueListInput.cs index f5d8e7aa..a195b384 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackScheldToBeIssueListInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackScheldToBeIssueListInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 组装、包装待下发列表输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs index 12e0029e..c12a37b2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.DirectoryServices.Protocols; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 组装、包装生产任务待下发输出参数列表 @@ -80,7 +73,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 预计结束时间 /// public string? estimated_end_date { get; set; } - + /// /// 工序名称 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackingSchedulingListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackingSchedulingListOutput.cs index 581be5f6..8b38037e 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackingSchedulingListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackingSchedulingListOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 组装、包装排产列表输出类 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockInput.cs index 6ad6e514..2dea4e06 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdInstockInput.cs @@ -7,7 +7,7 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 单据类型 /// public string bill_type { get; set; } = string.Empty; - + /// /// 载具编号 @@ -18,22 +18,22 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 起始库位编号 /// public string location_code { get; set; } = string.Empty; - + /// /// 检验(0-未检 1-已检) /// public int is_check { get; set; } - + public string? station_id { get; set; } public string? workline_id { get; set; } public string? workshop_id { get; set; } - - + + /// /// 子表明细 /// - public List> details { get; set; } - + public List> details { get; set; } + } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs index dd579252..b76cd738 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs @@ -9,28 +9,28 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 工单id /// public string id { get; set; } - + public string mo_code { get; set; } - + public string material_id { get; set; } - + public string material_code { get; set; } - + public string material_name { get; set; } - + public string? material_standard { get; set; } - + public string? act_start_date { get; set; } - + public string? act_end_date { get; set; } - + /// /// 类型 1注塑挤出 2 组装包装 /// public int type { get; set; } - + } - + /// /// 工单追溯二级列表输出类 /// @@ -40,33 +40,33 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 任务单id /// public string id { get; set; } - + public string mo_task_code { get; set; } - + public string material_id { get; set; } - + public string material_code { get; set; } - + public string material_name { get; set; } - + public string? material_standard { get; set; } - + public string? act_start_date { get; set; } - + public string? act_end_date { get; set; } - + public string? workline_name { get; set; } - + public string? workshop_name { get; set; } - + public string? mbom_version { get; set; } - + public string station_name { get; set; } - + public string equip_code { get; set; } - + } - + /// /// 工单追溯三级列表输出类 /// @@ -76,25 +76,25 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 任务单id /// public string id { get; set; } - + public string mo_task_code { get; set; } - + public string material_id { get; set; } - + public string material_code { get; set; } - + public string material_name { get; set; } - + public string? workline_id { get; set; } - + public string? batch { get; set; } - + public string process_id { get; set; } public string process_name { get; set; } - + public string station_name { get; set; } } - + /// /// 工单追溯人输出类 /// @@ -106,16 +106,16 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage // public string id { get; set; } // // public string workgroup_name { get; set; } - + public string employee_name { get; set; } public string work_time { get; set; } - + public DateTime? start_time { get; set; } public DateTime? end_time { get; set; } - - + + } - + /// /// 工单追溯机输出类 /// @@ -123,9 +123,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { public string equip_code { get; set; } public string mold_code { get; set; } - + } - + /// /// 工单追溯料输出类 /// @@ -138,8 +138,8 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string instock_time { get; set; } public string feeding_time { get; set; } public string check_conclusion { get; set; } - - + + } public class PrdMoReverseFromMaterialoutput @@ -163,7 +163,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// /// 批次 /// - public string code_batch { get; set;} + public string code_batch { get; set; } /// /// 采购单号 /// @@ -223,7 +223,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string supplier_name { get; set; } public string unit_name { get; set; } } - + /// /// 物料反向追溯投料信息输出父类 /// @@ -236,9 +236,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string material_name { get; set; } public string material_standard { get; set; } public List children { get; set; } = new List(); - + } - + /// /// 物料反向追溯投料信息输出字类 /// @@ -255,9 +255,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string feeding_name { get; set; } public string station_name { get; set; } public string process_name { get; set; } - + } - + public class PrdMoReverseFromOutput { /// @@ -278,7 +278,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// /// 批次 /// - public string code_batch { get; set;} + public string code_batch { get; set; } /// /// 单位ID /// @@ -332,5 +332,5 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// public string delivery_time { get; set; } } - + } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromQueryInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromQueryInput.cs index d284f723..d9188cd6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromQueryInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromQueryInput.cs @@ -11,11 +11,11 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 每页行数. /// public int pageSize { get; set; } = 50; - + public string? mo_code { get; set; } - + public string? mo_task_code { get; set; } - + public string? barcode { get; set; } } @@ -25,25 +25,25 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string mo_task_code { get; set; } public string barcode { get; set; } } - + public class PrdMoFromThreeQueryInput { public string mo_task_id { get; set; } public string mo_task_code { get; set; } public string barcode { get; set; } - } - + } + public class PrdMoFromTabQueryInput { public string mo_task_id { get; set; } public string barcode { get; set; } - } - + } + public class PrdMoReverseFromQueryInput { public string barcode { get; set; } } - + public class PrdMoReverseFromOutInfoQueryInput { public string feeding_detail_id { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs index 82f7295c..0f733963 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListOuput.cs @@ -3,9 +3,9 @@ namespace Tnb.ProductionMgr.Entities.Dto public class PrdMoListOuput { public string id { get; set; } - + public string mo_type { get; set; } - + public string mo_source { get; set; } public string mo_code { get; set; } public string plan_start_date { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs index bb1c96ca..5e2f9f03 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Security; - namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { - public class PrdMoListTreeOutput + public class PrdMoListTreeOutput { //public Dictionary row { get; set; } @@ -136,7 +129,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 父工单id /// public string parent_id { get; set; } = string.Empty; - + /// /// 获取节点id. /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskDefectOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskDefectOutput.cs index e345f950..f8c8cc00 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskDefectOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskDefectOutput.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using DbModels; -using Tnb.ProductionMgr.Entities; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 提报记录统计明细 @@ -27,7 +19,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string? batch { get; set; } public string? create_time { get; set; } - + public string? create_name { get; set; } /// /// 报废数量 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskFromEqpIdInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskFromEqpIdInput.cs index 207b3cc7..eddca47b 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskFromEqpIdInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskFromEqpIdInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 根据设备id 获取生产任务列表,输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs index c648d5f0..7a935ce2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs @@ -5,8 +5,8 @@ namespace Tnb.ProductionMgr.Entities.Dto public string id { get; set; } public string mo_task_code { get; set; } public string material_id { get; set; } - public string mold_id { get; set; } - public string eqp_id { get; set; } + public string mold_id { get; set; } + public string eqp_id { get; set; } public string mo_task_status { get; set; } public int? plan_qty { get; set; } public int? scheduled_qty { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs index e3e66deb..f6e660e3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.DirectoryServices.Protocols; -using System.Linq; -using System.Security.Principal; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Security; +using JNPF.Common.Security; namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { @@ -76,7 +69,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// /// 预计完工时间 /// - public string estimated_end_date { get; set; }= string.Empty; + public string estimated_end_date { get; set; } = string.Empty; /// /// 工序编码 /// @@ -84,8 +77,8 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// /// 工序名称 /// - public string process_name { get; set;} - + public string process_name { get; set; } + public string create_time { get; set; } } public class PrdMoTaskTreeOutput : TreeModel @@ -97,7 +90,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string? material_id { get; set; } public string? mold_id { get; set; } public string? eqp_id { get; set; } - + /// /// 物料 /// @@ -122,7 +115,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 预计结束时间 /// public string? estimated_end_date { get; set; } - + /// /// 创建时间 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs index 141c0095..8a5af562 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMotreeOutput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Security; +using JNPF.Common.Security; namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs index 736f3fe4..bfb504c6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdPackReportQueryInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Filter; -using Microsoft.AspNetCore.Mvc.RazorPages; +using JNPF.Common.Filter; namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs index 1009a132..f1e0e6e0 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportCrInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 生产提报输入参数 @@ -98,12 +92,12 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// Nullable:True /// public int icmo_qty { get; set; } - + /// /// 工位 /// public string? station { get; set; } - + /// /// 料箱二维码 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs index 779e1b82..56f87519 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdReportOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { public class PrdReportOutput { @@ -47,6 +41,6 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// public string material_property { get; set; } - + } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperInput.cs index 8b3386e3..efce8c83 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产操作记录查询参数 @@ -30,7 +24,7 @@ namespace Tnb.ProductionMgr.Entities.Dto /// /// 计划生产开始日期 /// - public DateTime? plan_start_date{ get; set; } + public DateTime? plan_start_date { get; set; } /// /// 计划生产结束日期 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs index 365d18c9..188a4ef9 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskOperOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.ProductionMgr.Entities; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产操作记录输出类 @@ -16,7 +9,7 @@ namespace Tnb.ProductionMgr.Entities.Dto ///任务单操作状态 /// public string statusName { get; set; } - + /// /// 排产类型:1、注塑、挤出2、组装、包装 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs index 37d943f1..7c02ae35 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskReleaseUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产任务单下发输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskSortOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskSortOutput.cs index a7d4f906..c0c5085d 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskSortOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdTaskSortOutput.cs @@ -1,16 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.ProductionMgr.Entities; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产任务重新排序输出参数 /// - public class PrdTaskSortOutput + public class PrdTaskSortOutput { /// /// 序号 @@ -24,7 +17,7 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 生产任务状态 /// 生产任务状态 /// - public string status { get; set;} + public string status { get; set; } /// /// 是否同组标识 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs index 9d9ba5ae..b5a0b541 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ProductionSchedulingCrInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 生产工单排产输入参数 @@ -15,7 +9,7 @@ namespace Tnb.ProductionMgr.Entities.Dto /// /// public string id { get; set; } - + /// /// Desc:排产类型 1、注塑/挤出工单 2、组装/包装工单 /// Default: @@ -43,14 +37,14 @@ namespace Tnb.ProductionMgr.Entities.Dto /// Nullable:True /// public DateTime? estimated_start_date { get; set; } - + /// /// Desc:预计结束时间 /// Default: /// Nullable:True /// public DateTime? estimated_end_date { get; set; } - + // /// // /// Desc:预计开始时间 // /// Default: @@ -126,5 +120,5 @@ namespace Tnb.ProductionMgr.Entities.Dto /// public string bom_id { get; set; } } - + } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ReportRecordListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ReportRecordListOutput.cs index b060203a..09f3aeb3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ReportRecordListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/ReportRecordListOutput.cs @@ -10,10 +10,10 @@ namespace Tnb.ProductionMgr.Entities.Dto public string? mo_task_id_id { get; set; } = string.Empty; public string? mo_task_type { get; set; } = string.Empty; public string? plan_end_date { get; set; } = string.Empty; - public int? plan_qty { get; set; } + public int? plan_qty { get; set; } public int? completed_qty { get; set; } public string? plan_start_date { get; set; } = string.Empty; - public int? reported_work_qty { get; set; } + public int? reported_work_qty { get; set; } public string? status { get; set; } = string.Empty; public List? tablefield107 { get; set; } = new List(); @@ -27,7 +27,7 @@ namespace Tnb.ProductionMgr.Entities.Dto public string? create_id { get; set; } = string.Empty; public string? create_id_id { get; set; } = string.Empty; public string? create_time { get; set; } = string.Empty; - + public string? batch { get; set; } = string.Empty; } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs index 08ff439a..aaf1fafd 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SelfTestScrappedInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 自检报废输入类 @@ -57,7 +51,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public List items { get; set; } } - public class defectItem + public class defectItem { /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SwapMoldUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SwapMoldUpInput.cs index b33ac539..3a36cc83 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SwapMoldUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/SwapMoldUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 模具更换输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TaskOperRecordOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TaskOperRecordOutput.cs index 2b091c6f..d16d37b7 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TaskOperRecordOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TaskOperRecordOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.ProductionMgr.Entities; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { public class TaskOperRecordOutput { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TransferPlatformUpInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TransferPlatformUpInput.cs index 8d6226bd..7f7473b3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TransferPlatformUpInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/TransferPlatformUpInput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Principal; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto +namespace Tnb.ProductionMgr.Entities.Dto { /// /// 转移机台输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/UnPackSchedlingInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/UnPackSchedlingInput.cs index ba31a885..3f7c1679 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/UnPackSchedlingInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/UnPackSchedlingInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Dto.PrdManage +namespace Tnb.ProductionMgr.Entities.Dto.PrdManage { /// /// 拆解组装包装排产输入参数 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonBreakDown.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonBreakDown.cs index 38142fc2..3e7e9619 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonBreakDown.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonBreakDown.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonInfo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonInfo.cs index 99adab74..29ad83bb 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonInfo.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonInfo.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; @@ -17,16 +12,16 @@ namespace Tnb.ProductionMgr.Entities.Entity id = SnowflakeIdHelper.NextId(); } public string? region_name { get; set; } - + public string? name { get; set; } - + public string? push_rule_id { get; set; } /// /// 故障类别 /// public string? andon_type { get; set; } - + /// /// 故障 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonRecords.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonRecords.cs index c813fadc..54eb2dd2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonRecords.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonRecords.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; @@ -38,14 +33,14 @@ namespace Tnb.ProductionMgr.Entities public string? remark { get; set; } public string? andon_type_id { get; set; } public string? andon_info_id { get; set; } - public string? repair_id { get; set; } - + public string? repair_id { get; set; } + public DateTime? response_time { get; set; } public DateTime? start_repair_time { get; set; } public DateTime? end_repair_time { get; set; } public DateTime? confirm_time { get; set; } - + public string status { get; set; } - + } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonTypecs.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonTypecs.cs index 0507aec2..d7a540d1 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonTypecs.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AndonTypecs.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; @@ -20,7 +15,7 @@ namespace Tnb.ProductionMgr.Entities /// 名称 /// public string? name { get; set; } - + public string? remark { get; set; } public string? create_id { get; set; } @@ -31,6 +26,6 @@ namespace Tnb.ProductionMgr.Entities /// 所属组织 /// public string? org_id { get; set; } - + } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs index 52ad5685..4fd2680a 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskLogListOutput.cs @@ -15,7 +15,7 @@ namespace Tnb.ProductionMgr.Entities.Entity public string eqp_id { get; set; } public string eqp_id_id { get; set; } public string equip_code { get; set; } - + public string process_id { get; set; } public string process_id_id { get; set; } public string process_code { get; set; } @@ -23,9 +23,9 @@ namespace Tnb.ProductionMgr.Entities.Entity public int? scheduled_qty { get; set; } public int? reported_work_qty { get; set; } public int? scrap_qty { get; set; } - + public string plan_start_date { get; set; } - + public string plan_end_date { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs index e5bd8bee..2e8bcb34 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs @@ -15,7 +15,7 @@ namespace Tnb.ProductionMgr.Entities public string eqp_id { get; set; } public string eqp_id_id { get; set; } public string equip_code { get; set; } - + public string process_id { get; set; } public string process_id_id { get; set; } public string process_code { get; set; } @@ -23,9 +23,9 @@ namespace Tnb.ProductionMgr.Entities public int? scheduled_qty { get; set; } public int? reported_work_qty { get; set; } public int? scrap_qty { get; set; } - + public string plan_start_date { get; set; } - + public string plan_end_date { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/CheckMoldInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/CheckMoldInput.cs index eac56daa..13edc502 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/CheckMoldInput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/CheckMoldInput.cs @@ -3,7 +3,7 @@ namespace Tnb.ProductionMgr.Entities.Entity public class CheckMoldInput { public string mo_task_id { get; set; } - + public string mold_qrcode { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/MoldsEntity.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/MoldsEntity.cs index beec7c50..917af756 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/MoldsEntity.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/MoldsEntity.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using JNPF.Common.Contracts; using SqlSugar; -using JNPF.Common.Contracts; namespace Tnb.ProductionMgr.Entities { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdFeedingD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdFeedingD.cs index 58f50b8d..41e311b2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdFeedingD.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdFeedingD.cs @@ -53,7 +53,7 @@ public partial class PrdFeedingD : BaseEntity /// 物料签收单子表id /// public string? material_receipt_detail_id { get; set; } - + /// /// 创建用户 /// @@ -63,7 +63,7 @@ public partial class PrdFeedingD : BaseEntity /// 创建时间 /// public DateTime? create_time { get; set; } - + /// /// 状态 0 未消耗 1 部分消耗 2 消耗完 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs index dcbe0c55..7c04e3a2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockD.cs @@ -53,7 +53,7 @@ public partial class PrdInstockD : BaseEntity /// 生产提报id /// public string report_id { get; set; } = string.Empty; - + /// /// 生产任务单号 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs index 2802f17e..720f5d24 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdInstockH.cs @@ -38,7 +38,7 @@ public partial class PrdInstockH : BaseEntity /// 起始库位编号 /// public string location_code { get; set; } = string.Empty; - + /// /// 工位id /// @@ -54,7 +54,7 @@ public partial class PrdInstockH : BaseEntity /// public string? workshop_id { get; set; } - + /// /// 检验(0-未检 1-已检) diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptD.cs index d2d2c3ff..27cadcf2 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptD.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptD.cs @@ -38,7 +38,7 @@ public partial class PrdMaterialReceiptD : BaseEntity /// 单位id /// public string? unit_id { get; set; } - + /// /// 条码编号 /// @@ -48,7 +48,7 @@ public partial class PrdMaterialReceiptD : BaseEntity /// 载具id /// public string carry_id { get; set; } = string.Empty; - + /// /// 子载具id /// @@ -69,7 +69,7 @@ public partial class PrdMaterialReceiptD : BaseEntity /// 已投料数量 /// public decimal feeding_num { get; set; } - + /// /// 供应商 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptH.cs index 94958bc2..56783a0a 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptH.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMaterialReceiptH.cs @@ -14,12 +14,12 @@ public partial class PrdMaterialReceiptH : BaseEntity { id = SnowflakeIdHelper.NextId(); } - + /// /// 签收单号 /// public string code { get; set; } = string.Empty; - + /// /// 工位id /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs index 97ec51d8..0d445a16 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMo.cs @@ -53,7 +53,7 @@ public partial class PrdMo : BaseEntity /// 已完工数量 /// public int? complete_qty { get; set; } - + /// /// 已报工数量 /// @@ -227,12 +227,12 @@ public partial class PrdMo : BaseEntity /// 父工单id /// public string parent_id { get; set; } - + /// /// 物料单位 /// public string? unit_id { get; set; } - + /// /// 工单来源 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs index be888dc5..cdeb3123 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.cs @@ -78,7 +78,7 @@ public partial class PrdMoTask : BaseEntity /// 已完工数量 /// public int? complete_qty { get; set; } - + /// /// 已报工数量 /// @@ -177,22 +177,22 @@ public partial class PrdMoTask : BaseEntity /// 工序id /// public string process_id { get; set; } - + /// /// 生产bom工序id /// public string? mbom_process_id { get; set; } - + /// /// 最后一道工序完成数量 /// public int? last_process_complete_qty { get; set; } - + /// /// 物料单位 /// public string? unit_id { get; set; } - + /// /// 物料清单id /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs index 44fc1766..d09742a6 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTask.part.cs @@ -1,7 +1,3 @@ -using System; -using System.Linq; -using System.Text; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.ProductionMgr.Entities diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs index f10ade62..eadcd903 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdMoTaskLog.cs @@ -73,7 +73,7 @@ public partial class PrdMoTaskLog : BaseEntity /// 任务单编号 /// public string? mo_task_code { get; set; } - + /// /// 工位编号 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOnwipTool.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOnwipTool.cs index bd3d4f33..0e75f49b 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOnwipTool.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdOnwipTool.cs @@ -1,5 +1,4 @@ using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.ProductionMgr.Entities; @@ -12,7 +11,7 @@ public partial class PrdOnwipTool : BaseEntity { public PrdOnwipTool() { - + } /// /// TODO diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs index e24a66f2..f19f3a84 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdReport.cs @@ -78,18 +78,18 @@ public partial class PrdReport : BaseEntity /// 生产任务量 /// public int? icmo_qty { get; set; } - + /// /// 批次 /// public string? batch { get; set; } - + /// /// 条码 /// public string? barcode { get; set; } - + /// /// 设备id /// @@ -109,7 +109,7 @@ public partial class PrdReport : BaseEntity /// 状态 0 未入库 1 已入库 /// public int status { get; set; } - + /// /// 物料id /// @@ -119,12 +119,12 @@ public partial class PrdReport : BaseEntity /// 物料单位 /// public string? unit_id { get; set; } - + /// /// 工序id /// public string? process_id { get; set; } - + /// /// 料箱编号 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs index c7896ac7..b6459a04 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdScrapped.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using SqlSugar; namespace DbModels { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs index d3c75d4b..eeb48bf7 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTask.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using SqlSugar; namespace Tnb.ProductionMgr.Entities { @@ -138,7 +135,7 @@ namespace Tnb.ProductionMgr.Entities /// /// 工单数(生产任务数) /// - public int mo_qty{ get; set; } + public int mo_qty { get; set; } /// /// Desc:模具Id /// Default:NULL::character varying diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs index f9785a42..c5d13b56 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdTaskLog.cs @@ -1,7 +1,4 @@ -using System; -using System.Linq; -using System.Text; -using SqlSugar; +using SqlSugar; namespace Tnb.ProductionMgr.Entities { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs index 16320af9..b54d99be 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/Eagvmode.cs @@ -1,17 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Entities.Enums +namespace Tnb.ProductionMgr.Entities.Enums { public enum Eagvmode { - 无请求=0, - 空框请求=1, - 满框请求=2, - 空满框请求=3, - 收到请求=4 + 无请求 = 0, + 空框请求 = 1, + 满框请求 = 2, + 空满框请求 = 3, + 收到请求 = 4 } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs index 7c58d8d1..1171f2f8 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Enums/MoBehavior.cs @@ -1,21 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Spire.License; - -namespace Tnb.ProductionMgr.Entities.Enums +namespace Tnb.ProductionMgr.Entities.Enums { public enum MoBehavior { /// /// 下发 /// - Release=1, + Release = 1, /// /// 强制结单 /// - Closed=2, + Closed = 2, } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Mapper/Mapper.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Mapper/Mapper.cs index e178d8ac..173f50fd 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Mapper/Mapper.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Mapper/Mapper.cs @@ -1,6 +1,4 @@ using Mapster; -using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Entities; namespace Tnb.ProductionMgr.Entities.Mapper { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Tnb.ProductionMgr.Entities.csproj b/ProductionMgr/Tnb.ProductionMgr.Entities/Tnb.ProductionMgr.Entities.csproj index ce732dd2..4adc18f3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Tnb.ProductionMgr.Entities.csproj +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Tnb.ProductionMgr.Entities.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonRecordService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonRecordService.cs index 340f595f..ef4dcd26 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonRecordService.cs @@ -20,29 +20,29 @@ namespace Tnb.ProductionMgr.Interfaces /// /// public Task AddAndon(AddAndonInput input); - + /// /// 响应andon /// /// - public Task ResponseAndon(Dictionary dic); - + public Task ResponseAndon(Dictionary dic); + /// /// 开始处理andon /// /// - public Task StartAndon(Dictionary dic); - + public Task StartAndon(Dictionary dic); + /// /// 结束处理andon /// /// - public Task EndAndon(Dictionary dic); - + public Task EndAndon(Dictionary dic); + /// /// 确认andon /// /// - public Task ConfirmAndon(Dictionary dic); + public Task ConfirmAndon(Dictionary dic); } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs index c7b815cc..892db2e3 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.ProductionMgr.Entities.Dto.PrdManage; +using Tnb.ProductionMgr.Entities.Dto.PrdManage; namespace Tnb.ProductionMgr.Interfaces { diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdCancelCloseDownService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdCancelCloseDownService.cs index 3821ca14..86831f3d 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdCancelCloseDownService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdCancelCloseDownService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { /// /// 异常停机服务接口 diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs index 7f9ea3db..9b0d03da 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs @@ -14,7 +14,7 @@ namespace Tnb.ProductionMgr.Interfaces /// /// public Task SaveData(MaterialReceiptInput input); - + /// /// 保存数据 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs index 9f0cb544..9fdbb4e9 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdInstockService.cs @@ -15,21 +15,21 @@ namespace Tnb.ProductionMgr.Interfaces /// /// public Task SaveData(PrdInstockInput input); - + /// /// 入库申请同步 /// /// source_id /// public Task SyncInstock(Dictionary dic); - + /// /// 注塑满箱到位后入库申请 /// /// /// public Task InstockTypeOne(InstockInput inut); - + /// /// 短管挤出入库申请 /// diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs index b86a0354..a9e6babd 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs @@ -5,6 +5,6 @@ namespace Tnb.ProductionMgr.Interfaces /// public interface IPrdKittingOutService { - + } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskIssueService.cs index 2f1bfc5e..1abe6165 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskIssueService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskIssueService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { /// /// 生产任务单下发接口 diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs index ba1668ad..e20aeba7 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdMoTaskService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Entities.Dto.PrdManage; +using Tnb.ProductionMgr.Entities; namespace Tnb.ProductionMgr.Interfaces { diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs index c901ed4b..c2b906de 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdPackReportService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { /// /// 组装、包装 生产提报接口 diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdTaskManageService.cs index 8d5fbe98..285165ed 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdTaskManageService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdTaskManageService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { public interface IPrdTaskManageService { diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs index b02102ed..40c507a9 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IProductionReportRecordService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { public interface IProductionReportRecordService { diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IRedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IRedisDataService.cs index 35ff9417..cd144734 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IRedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IRedisDataService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { public interface IRedisDataService { diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs index a32b2420..cf222cf5 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IWorklineCommService.cs @@ -1,6 +1,4 @@ -using Tnb.ProductionMgr.Entities.Dto; - -namespace Tnb.ProductionMgr.Interfaces +namespace Tnb.ProductionMgr.Interfaces { /// /// 工单生成 diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/Tnb.ProductionMgr.Interfaces.csproj b/ProductionMgr/Tnb.ProductionMgr.Interfaces/Tnb.ProductionMgr.Interfaces.csproj index 9b137e20..34f5f41f 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/Tnb.ProductionMgr.Interfaces.csproj +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/Tnb.ProductionMgr.Interfaces.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs index 14186d66..3ed4c7df 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs @@ -1,4 +1,3 @@ -using COSXML.Model.Tag; using JNPF.Common.Core.Manager; using JNPF.Common.Filter; using JNPF.DependencyInjection; @@ -10,10 +9,10 @@ using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.ProductionMgr.Entities; +using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; -using Tnb.BasicData; +using Tnb.ProductionMgr.Entities; namespace Tnb.ProductionMgr.APP { @@ -53,7 +52,7 @@ namespace Tnb.ProductionMgr.APP _dictionaryDataService = dictionaryDataService; _billRuleService = billRullService; } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); @@ -66,18 +65,18 @@ namespace Tnb.ProductionMgr.APP .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) .LeftJoin((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId) - .LeftJoin((a,b,c,d,e,f)=>a.process_id==f.id) + .LeftJoin((a, b, c, d, e, f) => a.process_id == f.id) .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code)) .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) .OrderByDescending(a => a.create_time) - .Select((a, b, c, d, e,f) => new AppPrdMoTaskOneListOutput + .Select((a, b, c, d, e, f) => new AppPrdMoTaskOneListOutput { id = a.id, mo_task_code = a.mo_task_code, mo_task_status = e.FullName, material_id_id = a.material_id, - material_id = b.code+"/"+b.name, + material_id = b.code + "/" + b.name, material_code = b.code, material_name = b.name, mold_id_id = a.mold_id, @@ -93,8 +92,8 @@ namespace Tnb.ProductionMgr.APP scheduled_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, scrap_qty = a.scrap_qty, - plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), + plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } @@ -109,9 +108,9 @@ namespace Tnb.ProductionMgr.APP { string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : ""; if (string.IsNullOrEmpty(mo_task_id)) return Array.Empty(); - Dictionary statsDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); - return await _db.Queryable().Where(x=>x.mo_task_id==mo_task_id) - .OrderBy(x=>x.create_time) + Dictionary statsDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + return await _db.Queryable().Where(x => x.mo_task_id == mo_task_id) + .OrderBy(x => x.create_time) .Mapper(x => { if (statsDic.ContainsKey(x.status)) diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs index 82f0bedd..e11e33e9 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs @@ -1,4 +1,3 @@ -using COSXML.Model.Tag; using JNPF.Common.Core.Manager; using JNPF.Common.Filter; using JNPF.DependencyInjection; @@ -10,10 +9,10 @@ using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.ProductionMgr.Entities; +using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; -using Tnb.BasicData; +using Tnb.ProductionMgr.Entities; namespace Tnb.ProductionMgr.APP { @@ -50,7 +49,7 @@ namespace Tnb.ProductionMgr.APP OverideFuncs.GetListAsync = GetList; _billRuleService = billRullService; } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); @@ -67,7 +66,7 @@ namespace Tnb.ProductionMgr.APP .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) .Where(a => a.schedule_type == 1) - .Where(a => (a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode || a.mo_task_status==DictConst.MoStatusExceptionCode || a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ComplatedEnCode)) + .Where(a => (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)) .OrderByDescending(a => a.create_time) .Select((a, b, c, d, e) => new AppPrdMoTaskOneListOutput { @@ -75,7 +74,7 @@ namespace Tnb.ProductionMgr.APP mo_task_code = a.mo_task_code, mo_task_status = e.FullName, material_id_id = a.material_id, - material_id = b.code+"/"+b.name, + material_id = b.code + "/" + b.name, material_code = b.code, material_name = b.name, mold_id_id = a.mold_id, @@ -87,8 +86,8 @@ namespace Tnb.ProductionMgr.APP scheduled_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, scrap_qty = a.scrap_qty, - plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), + plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs index 9499db64..8af2de3a 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs @@ -1,4 +1,3 @@ -using COSXML.Model.Tag; using JNPF.Common.Core.Manager; using JNPF.Common.Filter; using JNPF.DependencyInjection; @@ -10,10 +9,10 @@ using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.ProductionMgr.Entities; +using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; -using Tnb.BasicData; +using Tnb.ProductionMgr.Entities; namespace Tnb.ProductionMgr.APP { @@ -50,7 +49,7 @@ namespace Tnb.ProductionMgr.APP OverideFuncs.GetListAsync = GetList; _billRuleService = billRullService; } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); @@ -63,20 +62,20 @@ namespace Tnb.ProductionMgr.APP .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) .LeftJoin((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId) - .LeftJoin((a,b,c,d,e,f)=>a.process_id==f.id) + .LeftJoin((a, b, c, d, e, f) => a.process_id == f.id) .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code)) .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) .Where(a => a.schedule_type == 2) - .Where(a => (a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode || a.mo_task_status==DictConst.MoStatusExceptionCode || a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ComplatedEnCode)) + .Where(a => (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)) .OrderByDescending(a => a.create_time) - .Select((a, b, c, d, e,f) => new AppPrdMoTaskOneListOutput + .Select((a, b, c, d, e, f) => new AppPrdMoTaskOneListOutput { id = a.id, mo_task_code = a.mo_task_code, mo_task_status = e.FullName, material_id_id = a.material_id, - material_id = b.code+"/"+b.name, + material_id = b.code + "/" + b.name, material_code = b.code, material_name = b.name, mold_id_id = a.mold_id, @@ -92,8 +91,8 @@ namespace Tnb.ProductionMgr.APP scheduled_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, scrap_qty = a.scrap_qty, - plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), + plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs index 975b302a..6214667e 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs @@ -9,6 +9,7 @@ using JNPF.FriendlyException; using JNPF.Message.Entitys.Entity; using JNPF.Message.Service; using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; using JNPF.TaskScheduler; using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; using JNPF.TaskScheduler.Entitys.Model; @@ -16,30 +17,27 @@ using Mapster; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; +using Tnb.BasicData; +using Tnb.BasicData.Entities; +using Tnb.BasicData.Interfaces; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.ProductionMgr.Entities.Entity; using Tnb.ProductionMgr.Interfaces; -using Tnb.BasicData.Entities; -using JNPF.Systems.Entitys.System; -using JNPF.Message.Entitys.Entity; -using Tnb.BasicData; -using Tnb.BasicData.Interfaces; using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity; namespace Tnb.ProductionMgr { [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] - public class AndonRecordService: IAndonRecordService, IDynamicApiController, ITransient + public class AndonRecordService : IAndonRecordService, IDynamicApiController, ITransient { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; private SendMessageService _sendMessageService; private readonly IBasPushRuleLogService _basPushRuleLogService; private readonly TimeTaskService _timeTaskService; - + public AndonRecordService(ISqlSugarRepository repository, SendMessageService sendMessageService, TimeTaskService timeTaskService, @@ -60,11 +58,11 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b) => a.andon_info_id == b.id) .LeftJoin((a, b, c) => a.repair_id == c.Id) .LeftJoin((a, b, c, d) => a.create_id == d.Id) - .LeftJoin((a,b,c,d,e)=>e.EnCode==DictConst.AndonStatus) - .LeftJoin((a,b,c,d,e,f)=>a.status==f.EnCode && e.Id==f.DictionaryTypeId) + .LeftJoin((a, b, c, d, e) => e.EnCode == DictConst.AndonStatus) + .LeftJoin((a, b, c, d, e, f) => a.status == f.EnCode && e.Id == f.DictionaryTypeId) .Where((a, b, c, d) => a.andon_type_id == input.andon_type_id) - .WhereIF(!string.IsNullOrEmpty(input.status),(a, b, c, d)=>a.status==input.status) - .Select((a, b, c, d,e,f) => new AndonPadListOutput + .WhereIF(!string.IsNullOrEmpty(input.status), (a, b, c, d) => a.status == input.status) + .Select((a, b, c, d, e, f) => new AndonPadListOutput { id = a.id, andon_info_name = b.name, @@ -87,30 +85,30 @@ namespace Tnb.ProductionMgr { AndonInfo andonInfo = await _db.Queryable().SingleAsync(x => x.id == input.andon_info_id); AndonRecords andonRecords = input.Adapt(); - DbResult result = await _db.Ado.UseTranAsync(async () => + DbResult result = await _db.Ado.UseTranAsync(async () => { - + andonRecords.create_time = DateTime.Now; andonRecords.create_id = _userManager.UserId; andonRecords.status = DictConst.AndonStatusHJZ; - + List toUsers = new List(); if (!string.IsNullOrEmpty(andonInfo.personnel)) { toUsers.AddRange(JsonConvert.DeserializeObject>(andonInfo.personnel)); } - + if (!string.IsNullOrEmpty(andonInfo.position)) { - + toUsers.AddRange(_db.Queryable().Where(x => andonInfo.position.Contains(x.Id)).Select(s => s.UserId).ToList()); } - + if (!string.IsNullOrEmpty(andonInfo.role)) { - + toUsers.AddRange(_db.Queryable().Where(x => andonInfo.role.Contains(x.Id)).Select(s => s.UserId).ToList()); } @@ -132,76 +130,76 @@ namespace Tnb.ProductionMgr await _db.Insertable(andonRecords).ExecuteCommandAsync(); }); - + if (result.IsSuccess) + { + BasPushRuleH basPushRuleH = await _db.Queryable().SingleAsync(x => x.id == andonInfo.push_rule_id); + BasPushRuleD basPushRuleD = await _db.Queryable().FirstAsync(x => x.push_rule_id == andonInfo.push_rule_id && x.ordinal == 1); + if (basPushRuleH?.enabled == 1) { - BasPushRuleH basPushRuleH = await _db.Queryable().SingleAsync(x=>x.id==andonInfo.push_rule_id); - BasPushRuleD basPushRuleD = await _db.Queryable().FirstAsync(x => x.push_rule_id == andonInfo.push_rule_id && x.ordinal == 1); - if (basPushRuleH?.enabled == 1) + string sendConfigId = basPushRuleD?.send_config_id ?? ""; + List sendModels = await GetSendParamJson(sendConfigId); + + if (sendModels != null && sendModels.Count > 0) { - string sendConfigId = basPushRuleD?.send_config_id ?? ""; - List sendModels = await GetSendParamJson(sendConfigId); - - if (sendModels != null && sendModels.Count > 0) + DateTime executeTime = DateTime.Now.AddMinutes(basPushRuleD.interval); + // string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}"; + string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?"; + + var comtentModel = new ContentModel(); + // comtentModel.cron = (2 * 60).ToString(); + comtentModel.cron = cron; + comtentModel.interfaceId = ""; + comtentModel.interfaceName = ""; + comtentModel.parameter = new List(); + comtentModel.localHostTaskId = "PushMsgTimeWorker/PushMsg"; + comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); + // comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString(); + comtentModel.TenantId = _userManager?.TenantId; + comtentModel.TenantDbName = _userManager?.TenantDbName; + comtentModel.ConnectionConfig = _userManager?.ConnectionConfig; + comtentModel.Token = _userManager?.ToKen; + + // foreach (var item in sendModels) + // { + // } + // + TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() { - DateTime executeTime = DateTime.Now.AddMinutes(basPushRuleD.interval); - // string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}"; - string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?"; - - var comtentModel = new ContentModel(); - // comtentModel.cron = (2 * 60).ToString(); - comtentModel.cron = cron; - comtentModel.interfaceId = ""; - comtentModel.interfaceName = ""; - comtentModel.parameter = new List(); - comtentModel.localHostTaskId = "PushMsgTimeWorker/PushMsg"; - comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - // comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString(); - comtentModel.TenantId = _userManager?.TenantId; - comtentModel.TenantDbName = _userManager?.TenantDbName; - comtentModel.ConnectionConfig = _userManager?.ConnectionConfig; - comtentModel.Token = _userManager?.ToKen; - - // foreach (var item in sendModels) - // { - // } - // - TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() - { - enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), - fullName = "andon推送消息" + DateTime.Now.ToString("yyyyMMddHHmmss"), - executeType = "3", - executeContent = comtentModel.ToJsonString(), - description = JsonConvert.SerializeObject(sendModels[0].paramJson), - sortCode = 9999, - enabledMark = 1, - }; + enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), + fullName = "andon推送消息" + DateTime.Now.ToString("yyyyMMddHHmmss"), + executeType = "3", + executeContent = comtentModel.ToJsonString(), + description = JsonConvert.SerializeObject(sendModels[0].paramJson), + sortCode = 9999, + enabledMark = 1, + }; - await _timeTaskService.Create(timeTaskCrInput,false); + await _timeTaskService.Create(timeTaskCrInput, false); - TimeTaskEntity timeTaskEntity = await _db.Queryable().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync(); - - BasPushRuleLog basPushRuleLog = new BasPushRuleLog() - { - push_rule_id = andonInfo.push_rule_id, - timetask_id = timeTaskEntity?.Id, - biz_id = andonRecords.id, - ordinal = 1, - is_push = 1, - }; + TimeTaskEntity timeTaskEntity = await _db.Queryable().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync(); - await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); - } + BasPushRuleLog basPushRuleLog = new BasPushRuleLog() + { + push_rule_id = andonInfo.push_rule_id, + timetask_id = timeTaskEntity?.Id, + biz_id = andonRecords.id, + ordinal = 1, + is_push = 1, + }; + + await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); } - } - - if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + + } + + if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result.IsSuccess ? "发起成功" : result.ErrorMessage; } [HttpPost] - public async Task ResponseAndon(Dictionary dic) + public async Task ResponseAndon(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; AndonRecords andonRecords = await _db.Queryable().SingleAsync(x => x.id == id); @@ -216,13 +214,13 @@ namespace Tnb.ProductionMgr { if (andonRecords.status != DictConst.AndonStatusHJZ) { - throw Oops.Bah($"状态错误"); + throw Oops.Bah($"状态错误"); } else { await _db.Updateable() .SetColumns(x => x.repair_id == _userManager.UserId) - .SetColumns(x=>x.response_time==DateTime.Now) + .SetColumns(x => x.response_time == DateTime.Now) .ExecuteCommandAsync(); Dictionary postData = new Dictionary() { @@ -231,13 +229,13 @@ namespace Tnb.ProductionMgr await _basPushRuleLogService.Stop(postData); return true; } - - + + } } else { - throw Oops.Bah($"无该andon记录"); + throw Oops.Bah($"无该andon记录"); } } @@ -250,21 +248,21 @@ namespace Tnb.ProductionMgr { if (andonRecords.status != DictConst.AndonStatusYXY) { - throw Oops.Bah($"状态错误"); + throw Oops.Bah($"状态错误"); } else { await _db.Updateable() - .SetColumns(x=>x.start_repair_time==DateTime.Now) - .Where(x=>x.id==id) + .SetColumns(x => x.start_repair_time == DateTime.Now) + .Where(x => x.id == id) .ExecuteCommandAsync(); return true; } - + } else { - throw Oops.Bah($"无该andon记录"); + throw Oops.Bah($"无该andon记录"); } } @@ -277,24 +275,24 @@ namespace Tnb.ProductionMgr { if (andonRecords.status != DictConst.AndonStatusCLZ) { - throw Oops.Bah($"状态错误"); + throw Oops.Bah($"状态错误"); } else { await _db.Updateable() - .SetColumns(x=>x.end_repair_time==DateTime.Now) - .Where(x=>x.id==id) + .SetColumns(x => x.end_repair_time == DateTime.Now) + .Where(x => x.id == id) .ExecuteCommandAsync(); return true; } - + } else { - throw Oops.Bah($"无该andon记录"); + throw Oops.Bah($"无该andon记录"); } } - + [HttpPost] public async Task ConfirmAndon(Dictionary dic) { @@ -304,21 +302,21 @@ namespace Tnb.ProductionMgr { if (andonRecords.status != DictConst.AndonStatusYWC) { - throw Oops.Bah($"状态错误"); + throw Oops.Bah($"状态错误"); } else { await _db.Updateable() - .SetColumns(x=>x.confirm_time==DateTime.Now) - .Where(x=>x.id==id) + .SetColumns(x => x.confirm_time == DateTime.Now) + .Where(x => x.id == id) .ExecuteCommandAsync(); return true; } - + } else { - throw Oops.Bah($"无该andon记录"); + throw Oops.Bah($"无该andon记录"); } } diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonService.cs index e8ca5a9e..f583a39e 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonService.cs @@ -1,25 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Numerics; -using System.Reactive.Joins; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using Aspose.Cells.Drawing; +using System.Dynamic; using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Message.Service; -using JNPF.Systems.Interfaces.System; -using JNPF.TaskScheduler; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.EquipMgr.Interfaces; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.ProductionMgr.Entities.Entity; @@ -33,7 +19,7 @@ namespace Tnb.ProductionMgr { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - public AndonService(ISqlSugarRepository repository,IUserManager userManager) + public AndonService(ISqlSugarRepository repository, IUserManager userManager) { _userManager = userManager; _db = repository.AsSugarClient(); @@ -99,11 +85,11 @@ namespace Tnb.ProductionMgr { label = andonType.name, value = andonType.id, - children = andonInfos.Where(x=>x.andon_type==andonType.id).Select(x=>new AndonCascaderOptionsOuput() + children = andonInfos.Where(x => x.andon_type == andonType.id).Select(x => new AndonCascaderOptionsOuput() { label = x.name, value = x.id, - children = andonBreakDowns.Where(y=>x.breakdown_id.Contains(y.id)).Select(y=>new AndonCascaderOptionsOuput() + children = andonBreakDowns.Where(y => x.breakdown_id.Contains(y.id)).Select(y => new AndonCascaderOptionsOuput() { label = y.name, value = y.id @@ -119,8 +105,8 @@ namespace Tnb.ProductionMgr defaultValue = breakdownIdArr[0]; } - result.Add("options",options); - result.Add("defaultValue",defaultValue); + result.Add("options", options); + result.Add("defaultValue", defaultValue); return result; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs index 51ed758a..8ab70c4e 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonTypeService.cs @@ -1,17 +1,10 @@ using JNPF.Common.Core.Manager; -using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Systems.Entitys.Permission; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData; -using Tnb.BasicData.Entities; -using Tnb.EquipMgr.Interfaces; using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Entities.Dto.PrdManage; -using Tnb.ProductionMgr.Entities.Entity; using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr @@ -22,7 +15,7 @@ namespace Tnb.ProductionMgr { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - public AndonTypeService(ISqlSugarRepository repository,IUserManager userManager) + public AndonTypeService(ISqlSugarRepository repository, IUserManager userManager) { _userManager = userManager; _db = repository.AsSugarClient(); @@ -37,7 +30,7 @@ namespace Tnb.ProductionMgr { andon_type_id = a.id, andon_type_name = a.name, - record_count = SqlFunc.Subqueryable().Where(x=>x.andon_type_id==a.id && x.status==DictConst.AndonStatusHJZ).Count(), + record_count = SqlFunc.Subqueryable().Where(x => x.andon_type_id == a.id && x.status == DictConst.AndonStatusHJZ).Count(), }).ToListAsync(); return result; } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs index d2d3806c..cbbe0e7b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; +using System.Dynamic; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.Message; using JNPF.Common.Enums; @@ -15,6 +9,7 @@ using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Logging; using JNPF.Message.Entitys.Entity; +using JNPF.Message.Service; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; @@ -26,15 +21,14 @@ using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData; +using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; using Tnb.EquipMgr.Interfaces; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto.PrdManage; using Tnb.ProductionMgr.Interfaces; -using Tnb.BasicData.Entities; using MessageTemplateEntity = JNPF.Message.Entitys.Entity.MessageTemplateEntity; -using JNPF.Message.Service; namespace Tnb.ProductionMgr { @@ -54,7 +48,7 @@ namespace Tnb.ProductionMgr private readonly IBillRullService _billRullService; private readonly TimeTaskService _timeTaskService; private SendMessageService _sendMessageService; - + private static Dictionary _dicWorkStationAndShopRelacion = new Dictionary(); private static Dictionary _dicWorkShop = new Dictionary(); @@ -218,14 +212,14 @@ namespace Tnb.ProductionMgr BasPushRuleD basPushRuleD = await _db.Queryable().FirstAsync(x => x.push_rule_id == PUSHRULEID && x.ordinal == 1); try { - - DbResult result = await _db.Ado.UseTranAsync(async () => + + DbResult result = await _db.Ado.UseTranAsync(async () => { var moTaskList = await _prdMoTaskService.GetListByEqpId(input.eqp_id); if (moTaskList?.Count > 1) throw new AppFriendlyException($"设备{input.eqp_id},目前有两条进行中的生产任务", 500); if (moTaskList?.Count > 0) { - + cancelCloseDown.id = SnowflakeIdHelper.NextId(); cancelCloseDown.eqp_id = input.eqp_id; cancelCloseDown.create_id = _userManager.UserId; @@ -233,7 +227,7 @@ namespace Tnb.ProductionMgr cancelCloseDown.closedown_start_time = DateTime.Now; await _db.Insertable(cancelCloseDown).ExecuteCommandAsync(); - + var record = cancelCloseDown.Adapt(); record.eqp_code = eqp?.code; record.eqp_name = eqp?.name; @@ -281,12 +275,12 @@ namespace Tnb.ProductionMgr { List list = await _sendMessageService.SendTest(basPushRuleD.send_config_id); List toUsers = JsonConvert.DeserializeObject>(eqp.responsibler_id); - + foreach (var item in list) { foreach (var param in item.paramJson) { - if (param.field=="equip_code") + if (param.field == "equip_code") { param.value = eqp.code; } @@ -299,25 +293,25 @@ namespace Tnb.ProductionMgr await _sendMessageService.SendMessage(item, new Dictionary()); } } - + } else throw Oops.Oh(ErrorCode.COM1001); }); if (result.IsSuccess) { - BasPushRuleH basPushRuleH = await _db.Queryable().SingleAsync(x=>x.id==PUSHRULEID); + BasPushRuleH basPushRuleH = await _db.Queryable().SingleAsync(x => x.id == PUSHRULEID); if (basPushRuleH?.enabled == 1) { string sendConfigId = basPushRuleD?.send_config_id ?? ""; List sendModels = await GetSendParamJson(sendConfigId); - + if (sendModels != null && sendModels.Count > 0) { DateTime executeTime = DateTime.Now.AddMinutes(basPushRuleD.interval); // string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}"; string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?"; - + var comtentModel = new ContentModel(); // comtentModel.cron = (2 * 60).ToString(); comtentModel.cron = cron; @@ -331,7 +325,7 @@ namespace Tnb.ProductionMgr comtentModel.TenantDbName = _userManager?.TenantDbName; comtentModel.ConnectionConfig = _userManager?.ConnectionConfig; comtentModel.Token = _userManager?.ToKen; - + foreach (var item in sendModels) { foreach (var param in item.paramJson) @@ -342,7 +336,7 @@ namespace Tnb.ProductionMgr } } } - + TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() { enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), @@ -354,10 +348,10 @@ namespace Tnb.ProductionMgr enabledMark = 1, }; - await _timeTaskService.Create(timeTaskCrInput,false); + await _timeTaskService.Create(timeTaskCrInput, false); TimeTaskEntity timeTaskEntity = await _db.Queryable().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync(); - + BasPushRuleLog basPushRuleLog = new BasPushRuleLog() { push_rule_id = PUSHRULEID, @@ -370,9 +364,9 @@ namespace Tnb.ProductionMgr await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); } } - + } - + } catch (Exception ex) { @@ -380,7 +374,7 @@ namespace Tnb.ProductionMgr // await _db.Ado.RollbackTranAsync(); throw; } - + } /// /// 停机结束 @@ -420,7 +414,7 @@ namespace Tnb.ProductionMgr throw; } } - + private async Task> GetSendParamJson(string id) { var list = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 61872a53..285e7e76 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -1,29 +1,18 @@ -using JNPF; using JNPF.Common.Core.Manager; -using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Extras.CollectiveOAuth.Models; -using JNPF.Extras.CollectiveOAuth.Utils; using JNPF.FriendlyException; -using JNPF.Logging; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev.Entitys; using Microsoft.AspNetCore.Mvc; -using Microsoft.ClearScript.Util.Web; -using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData.Entities; +using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; using Tnb.ProductionMgr.Interfaces; -using Tnb.ProductionMgr.Entities.Consts; -using Tnb.WarehouseMgr; using Tnb.WarehouseMgr.Entities; -using Tnb.BasicData; -using Tnb.EquipMgr.Entities; namespace Tnb.ProductionMgr { @@ -39,7 +28,7 @@ namespace Tnb.ProductionMgr private readonly IPrdMoTaskService _prdMoTaskService; private readonly IBillRullService _billRullService; // private readonly WmsSignForDeliveryService _wmsSignForDeliveryService; - + public PrdFeedingService( @@ -57,7 +46,7 @@ namespace Tnb.ProductionMgr _billRullService = billRullService; } - + [HttpPost] public async Task SaveData(MaterialReceiptInput input) { @@ -67,7 +56,7 @@ namespace Tnb.ProductionMgr var moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); var inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == input.mbom_process_id) - .Select(x=>x.material_id) + .Select(x => x.material_id) .ToListAsync(); string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE); @@ -94,7 +83,7 @@ namespace Tnb.ProductionMgr { foreach (var item in input.details) { - if(!inputMaterials.Contains(item["material_id"])) + if (!inputMaterials.Contains(item["material_id"])) throw new Exception("该物料不是生产bom投入物料,不能签收"); var detail = await db.Queryable() @@ -115,10 +104,11 @@ namespace Tnb.ProductionMgr if (detail != null) { - if(detail.feeding_num + num > detail.num) + if (detail.feeding_num + num > detail.num) { throw new Exception("投料数量不能大于签收数量"); - }else if (detail.feeding_num + num == detail.num) + } + else if (detail.feeding_num + num == detail.num) { await db.Updateable() .SetColumns(x => x.feeding_num == x.feeding_num + num) @@ -164,7 +154,7 @@ namespace Tnb.ProductionMgr taskLog.mo_task_code = moTask.mo_task_code; taskLog.station_code = station?.EnCode; taskLog.process_code = process.code; - + await db.Insertable(prdFeedingH).ExecuteCommandAsync(); await db.Insertable(list).ExecuteCommandAsync(); await db.Insertable(taskLog).ExecuteCommandAsync(); @@ -181,8 +171,8 @@ namespace Tnb.ProductionMgr // carry_code = input.carry_code ?? "", // }); } - - if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); + + if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); return result.IsSuccess ? "投料成功" : result.ErrorMessage; } @@ -204,13 +194,13 @@ namespace Tnb.ProductionMgr } var carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); var workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); - var workshop = await db.Queryable().SingleAsync(x=>x.Id==workline.ParentId); + var workshop = await db.Queryable().SingleAsync(x => x.Id == workline.ParentId); var inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id) - .Select(x=>x.material_id) + .Select(x => x.material_id) .ToListAsync(); - + string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE); prdFeedingH = new PrdFeedingH() { @@ -229,12 +219,12 @@ namespace Tnb.ProductionMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId }; - + if (input.details != null && input.details.Count > 0) { foreach (var item in input.details) { - if(!inputMaterials.Contains(item["material_id"])) + if (!inputMaterials.Contains(item["material_id"])) throw new Exception("该物料不是生产bom投入物料,不能签收"); var detail = await db.Queryable() @@ -255,10 +245,11 @@ namespace Tnb.ProductionMgr if (detail != null) { - if(detail.feeding_num + num > detail.num) + if (detail.feeding_num + num > detail.num) { throw new Exception("投料数量不能大于签收数量"); - }else if (detail.feeding_num + num == detail.num) + } + else if (detail.feeding_num + num == detail.num) { await db.Updateable() .SetColumns(x => x.feeding_num == x.feeding_num + num) @@ -285,7 +276,7 @@ namespace Tnb.ProductionMgr throw new Exception("没有签收物料"); } - + await db.Insertable(prdFeedingH).ExecuteCommandAsync(); await db.Insertable(list).ExecuteCommandAsync(); @@ -330,12 +321,12 @@ namespace Tnb.ProductionMgr // // } } - - if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + + if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "签收成功" : result.ErrorMessage; } - - + + /// /// 生产投料 /// @@ -366,13 +357,13 @@ namespace Tnb.ProductionMgr } var carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); var workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); - var workshop = await db.Queryable().SingleAsync(x=>x.Id==workline.ParentId); + var workshop = await db.Queryable().SingleAsync(x => x.Id == workline.ParentId); var inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id) - .Select(x=>x.material_id) + .Select(x => x.material_id) .ToListAsync(); - + string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE); prdFeedingH = new PrdFeedingH() { @@ -391,12 +382,12 @@ namespace Tnb.ProductionMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId }; - + if (input.details != null && input.details.Count > 0) { foreach (var item in input.details) { - if(!inputMaterials.Contains(item["material_id"])) + if (!inputMaterials.Contains(item["material_id"])) throw new Exception("该物料不是生产bom投入物料,不能签收"); var detail = await db.Queryable() @@ -417,10 +408,11 @@ namespace Tnb.ProductionMgr if (detail != null) { - if(detail.feeding_num + num > detail.num) + if (detail.feeding_num + num > detail.num) { throw new Exception("投料数量不能大于签收数量"); - }else if (detail.feeding_num + num == detail.num) + } + else if (detail.feeding_num + num == detail.num) { await db.Updateable() .SetColumns(x => x.feeding_num == x.feeding_num + num) @@ -447,14 +439,14 @@ namespace Tnb.ProductionMgr throw new Exception("没有签收物料"); } - + await db.Insertable(prdFeedingH).ExecuteCommandAsync(); await db.Insertable(list).ExecuteCommandAsync(); }); - - if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + + if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "签收成功" : result.ErrorMessage; } @@ -463,11 +455,11 @@ namespace Tnb.ProductionMgr { var db = _repository.AsSugarClient(); var result = await db.Queryable() - .Where(a => a.schedule_type == 2 && a.parent_id!=null) + .Where(a => a.schedule_type == 2 && a.parent_id != null) .Select(a => new FeedingRecordTreeOutput() { mo_task_code = a.mo_task_code, - children = SqlFunc.Subqueryable().Where(b=>a.id==b.mo_task_id).ToList(b=>new FeedingRecordChildren() + children = SqlFunc.Subqueryable().Where(b => a.id == b.mo_task_id).ToList(b => new FeedingRecordChildren() { id = b.id, code = b.code, @@ -491,7 +483,7 @@ namespace Tnb.ProductionMgr { item.children = db.Queryable() .LeftJoin((c, d) => c.material_id == d.id) - .Where((c, d) => item.id == c.feeding_id).Select((c,d) => new FeedingRecordMaterialChildren() + .Where((c, d) => item.id == c.feeding_id).Select((c, d) => new FeedingRecordMaterialChildren() { material_code = d.code, material_name = d.name, diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs index 0ae748de..7a168a59 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -1,37 +1,31 @@ using JNPF; 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.Extras.CollectiveOAuth.Utils; using JNPF.FriendlyException; using JNPF.Logging; -using JNPF.RemoteRequest; -using JNPF.Systems.Interfaces.System; -using Mapster; -using Microsoft.AspNetCore.Http; +using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Interfaces.Permission; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; +using SqlSugar.Extensions; +using Tnb.BasicData; using Tnb.BasicData.Entities; +using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Interfaces; -using Tnb.WarehouseMgr; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; -using Tnb.BasicData; -using JNPF.VisualDev; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities.Dto.PrdManage; -using JNPF.Common.Filter; -using JNPF.Common.Security; -using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Interfaces.Permission; -using Microsoft.AspNetCore.Authorization; -using SQLitePCL; -using SqlSugar.Extensions; +using Tnb.ProductionMgr.Interfaces; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.ProductionMgr { @@ -41,7 +35,7 @@ namespace Tnb.ProductionMgr [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] [OverideVisualDev(ModuleId)] - public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService + public class PrdInstockService : IPrdInstockService, IDynamicApiController, ITransient, IOverideVisualDevService { private readonly ISqlSugarRepository _repository; private readonly IUserManager _userManager; @@ -86,7 +80,7 @@ namespace Tnb.ProductionMgr create_time = a.create_time.ToString() }).ToListAsync(); var treeList = list.ToTree(); - treeList= treeList.Skip((input.currentPage-1)* input.pageSize).Take(input.pageSize).ToList(); + treeList = treeList.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList(); SqlSugarPagedList pagedList = new() { list = treeList, @@ -113,13 +107,13 @@ namespace Tnb.ProductionMgr { throw Oops.Bah("请先选择工位"); } - + DbResult result = await db.Ado.UseTranAsync(async () => { OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorklineCode); OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorkshopCode); - - + + prdInstockH = new PrdInstockH() { bill_type = input.bill_type, @@ -148,7 +142,7 @@ namespace Tnb.ProductionMgr // code_batch = item.ContainsKey("batch") ? item["batch"] : "", // barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "", barcode = item.ContainsKey("barcode") ? item["barcode"] : "", - code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "", + code_batch = item.ContainsKey("barcode") ? item["barcode"] + "0001" : "", quantity = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"), }); } @@ -186,10 +180,10 @@ namespace Tnb.ProductionMgr material_id = item.ContainsKey("material_id") ? item["material_id"] : "", material_code = item.ContainsKey("material_code") ? item["material_code"] : "", unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "", - code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "", + code_batch = item.ContainsKey("barcode") ? item["barcode"] + "0001" : "", pr_qty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"), }); - + mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput() { material_id = item.ContainsKey("material_id") ? item["material_id"] : "", @@ -198,7 +192,7 @@ namespace Tnb.ProductionMgr // code_batch = item.ContainsKey("batch") ? item["batch"] : "", // barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "", barcode = item.ContainsKey("barcode") ? item["barcode"] : "", - code_batch = item.ContainsKey("barcode") ? item["barcode"]+"0001" : "", + code_batch = item.ContainsKey("barcode") ? item["barcode"] + "0001" : "", codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"), }); } @@ -207,7 +201,7 @@ namespace Tnb.ProductionMgr { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); if (authResponse.code != 200 || !authResponse.data.ObjToBool()) @@ -219,17 +213,17 @@ namespace Tnb.ProductionMgr result2 = await db.Ado.UseTranAsync(async () => { await _repository.InsertAsync(prdInstockH); - + if (prdInstockDs.Count > 0) { await db.Insertable(prdInstockDs).ExecuteCommandAsync(); } }); - + } } - - if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + + if (!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result2.IsSuccess ? "保存成功" : result2.ErrorMessage; } @@ -277,24 +271,24 @@ namespace Tnb.ProductionMgr if (!string.IsNullOrEmpty(equip_code)) throw Oops.Bah("请传机台号"); var db = _repository.AsSugarClient(); EqpEquipment equipment = await db.Queryable().Where(x => x.code == equip_code).FirstAsync(); - if(equipment==null ) throw Oops.Bah("未找到机台"); - if(string.IsNullOrEmpty(equipment.as_location_id)) throw Oops.Bah("未找到入库库位"); - BasLocation basLocation = await db.Queryable().SingleAsync(x=>x.id==equipment.as_location_id); - if(basLocation==null) throw Oops.Bah("未找到入库库位"); + if (equipment == null) throw Oops.Bah("未找到机台"); + if (string.IsNullOrEmpty(equipment.as_location_id)) throw Oops.Bah("未找到入库库位"); + BasLocation basLocation = await db.Queryable().SingleAsync(x => x.id == equipment.as_location_id); + if (basLocation == null) throw Oops.Bah("未找到入库库位"); PrdReport prdReport = await db.Queryable() .Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time) .FirstAsync(); - if(prdReport==null) throw Oops.Bah("未找到提报记录"); + if (prdReport == null) throw Oops.Bah("未找到提报记录"); PrdInstockH prdInstockH = null; List prdInstockDs = new List() { }; DbResult result2 = new DbResult(); - BasMaterial basMaterial = await db.Queryable().SingleAsync(x=>x.id==prdReport.material_id); + BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdReport.material_id); DbResult result = await db.Ado.UseTranAsync(async () => { OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode); OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode); - + prdInstockH = new PrdInstockH() { bill_type = DictConst.CHANCHENGPINRUKUDAN, @@ -319,11 +313,11 @@ namespace Tnb.ProductionMgr material_code = basMaterial.code, unit_id = prdReport.unit_id, barcode = prdReport.barcode, - code_batch = prdReport.barcode+"0001", + code_batch = prdReport.barcode + "0001", quantity = (int)prdReport.reported_qty, }); }); - + if (result.IsSuccess) { MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput(); @@ -349,14 +343,14 @@ namespace Tnb.ProductionMgr code_batch = prdReport.barcode, pr_qty = (int)prdReport.reported_qty, }); - + mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput() { material_id = prdReport.material_id, material_code = basMaterial.code, unit_id = prdReport.unit_id, barcode = prdReport.barcode, - code_batch = prdReport.barcode+"0001", + code_batch = prdReport.barcode + "0001", codeqty = (int)prdReport.reported_qty, }); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; @@ -364,7 +358,7 @@ namespace Tnb.ProductionMgr { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); if (authResponse.code != 200 || !authResponse.data.ObjToBool()) @@ -376,17 +370,17 @@ namespace Tnb.ProductionMgr result2 = await db.Ado.UseTranAsync(async () => { await _repository.InsertAsync(prdInstockH); - + if (prdInstockDs.Count > 0) { await db.Insertable(prdInstockDs).ExecuteCommandAsync(); } }); - + } } - - if(!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + + if (!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); return result2.IsSuccess ? "申请成功" : result2.ErrorMessage; } @@ -400,12 +394,12 @@ namespace Tnb.ProductionMgr PrdInstockH prdInstockH = null; List prdInstockDs = new List() { }; DbResult result2 = new DbResult(); - BasMaterial basMaterial = await db.Queryable().SingleAsync(x=>x.id==prdReport.material_id); + BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdReport.material_id); DbResult result = await db.Ado.UseTranAsync(async () => { OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorklineCode); OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(prdReport.station, DictConst.RegionCategoryWorkshopCode); - + prdInstockH = new PrdInstockH() { bill_type = DictConst.CHANCHENGPINRUKUDAN, @@ -430,11 +424,11 @@ namespace Tnb.ProductionMgr material_code = basMaterial.code, unit_id = prdReport.unit_id, barcode = prdReport.barcode, - code_batch = prdReport.barcode+"0001", + code_batch = prdReport.barcode + "0001", quantity = (int)prdReport.reported_qty, }); }); - + if (result.IsSuccess) { MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput(); @@ -460,14 +454,14 @@ namespace Tnb.ProductionMgr code_batch = prdReport.barcode, pr_qty = (int)prdReport.reported_qty, }); - + mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput() { material_id = prdReport.material_id, material_code = basMaterial.code, unit_id = prdReport.unit_id, barcode = prdReport.barcode, - code_batch = prdReport.barcode+"0001", + code_batch = prdReport.barcode + "0001", codeqty = (int)prdReport.reported_qty, }); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; @@ -475,7 +469,7 @@ namespace Tnb.ProductionMgr { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); if (authResponse.code != 200 || !authResponse.data.ObjToBool()) @@ -487,13 +481,13 @@ namespace Tnb.ProductionMgr result2 = await db.Ado.UseTranAsync(async () => { await _repository.InsertAsync(prdInstockH); - + if (prdInstockDs.Count > 0) { await db.Insertable(prdInstockDs).ExecuteCommandAsync(); } }); - + } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs index fd81e5b3..caa07277 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs @@ -1,6 +1,5 @@ using JNPF; using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Extras.CollectiveOAuth.Models; @@ -12,19 +11,17 @@ using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; using SqlSugar; using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Interfaces; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Interfaces; using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.ProductionMgr { @@ -44,8 +41,8 @@ namespace Tnb.ProductionMgr private readonly IOrganizeService _organizeService; private readonly IBillRullService _billRullService; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - - public PrdKittingOutService(ISqlSugarRepository repository, IRunService runService, + + public PrdKittingOutService(ISqlSugarRepository repository, IRunService runService, IBillRullService billRullService, IUserManager userManager, IOrganizeService organizeService, @@ -59,7 +56,7 @@ namespace Tnb.ProductionMgr _billRullService = billRullService; // OverideFuncs.CreateAsync = Create; } - + // private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) // { // PrdKittingOutH prdKittingOutH = new PrdKittingOutH(); @@ -157,7 +154,7 @@ namespace Tnb.ProductionMgr // } // // } - + /// /// 齐套出库申请 /// @@ -165,7 +162,7 @@ namespace Tnb.ProductionMgr /// /// [HttpPost] - public async Task KittingOut(KittingOutInput kittingOutInput) + public async Task KittingOut(KittingOutInput kittingOutInput) { PrdKittingOutH prdKittingOutH = new PrdKittingOutH(); try @@ -173,7 +170,7 @@ namespace Tnb.ProductionMgr var db = _repository.AsSugarClient(); OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode); kittingOutInput.workline_id = workline?.Id ?? ""; - + List input = new List(); input.Add(new MESKittingOutStkInput() { @@ -189,14 +186,14 @@ namespace Tnb.ProductionMgr create_id = _userManager.UserId, wmsKittingoutDs = new List(), }); - + input[0].wmsKittingoutDs = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(kittingOutInput.tableField115)); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; Dictionary header = new Dictionary() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK,JsonConvert.SerializeObject(input),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -235,11 +232,11 @@ namespace Tnb.ProductionMgr kitting_out_id = prdKittingOutH.id, }); } - + // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); // await _runService.Create(templateEntity, visualDevModelDataCrInput); - - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { await _repository.InsertAsync(prdKittingOutH); if (prdKittingOutDs.Count > 0) @@ -261,10 +258,10 @@ namespace Tnb.ProductionMgr Log.Error(e.Message); throw Oops.Bah(e.Message); } - + } - - + + /// /// 齐套出库申请 /// @@ -272,32 +269,32 @@ namespace Tnb.ProductionMgr /// /// [HttpPost] - public async Task KittingOutNew(KittingOutNewInput kittingOutInput) + public async Task KittingOutNew(KittingOutNewInput kittingOutInput) { PrdKittingOutH prdKittingOutH = new PrdKittingOutH(); string warehouse_id = "26103348825381";//二楼缓存仓 try { var db = _repository.AsSugarClient(); - PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x=>x.id==kittingOutInput.mo_task_id); - BasMaterial basMaterial = await db.Queryable().SingleAsync(x=>x.id==prdMoTask.material_id); - WmsCollocationSchemeH wmsCollocationSchemeH = await db.Queryable().SingleAsync(x=>x.id==kittingOutInput.collocation_scheme_id); - List wmsCollocationSchemeDs = await db.Queryable().Where(x=>x.bill_id==kittingOutInput.collocation_scheme_id).ToListAsync(); + PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == kittingOutInput.mo_task_id); + BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); + WmsCollocationSchemeH wmsCollocationSchemeH = await db.Queryable().SingleAsync(x => x.id == kittingOutInput.collocation_scheme_id); + List wmsCollocationSchemeDs = await db.Queryable().Where(x => x.bill_id == kittingOutInput.collocation_scheme_id).ToListAsync(); List materialIds = wmsCollocationSchemeDs.Select(x => x.material_id).ToList(); - List basMaterials = await db.Queryable().Where(x=>materialIds.Contains(x.id)).ToListAsync(); - Dictionary unitIdDic = await db.Queryable() + List basMaterials = await db.Queryable().Where(x => materialIds.Contains(x.id)).ToListAsync(); + Dictionary unitIdDic = await db.Queryable() .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit) .LeftJoin((a, b, c) => b.Id == c.DictionaryTypeId && a.unit_id == c.EnCode) - .Where((a,b,c)=>materialIds.Contains(a.id)) - .Select((a, b, c) => new + .Where((a, b, c) => materialIds.Contains(a.id)) + .Select((a, b, c) => new { key = a.id, - value = c.Id + value = c.Id }) .ToDictionaryAsync(x => x.key, x => x.value); Dictionary unitCodeDic = basMaterials.ToDictionary(x => x.id, x => x.unit_id); OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode); - + List input = new List(); input.Add(new MESKittingOutStkInput() { @@ -313,7 +310,7 @@ namespace Tnb.ProductionMgr create_id = _userManager.UserId, wmsKittingoutDs = new List(), }); - + foreach (var item in wmsCollocationSchemeDs) { input[0].wmsKittingoutDs.Add(new MESKittingOutStkDInput() @@ -327,13 +324,13 @@ namespace Tnb.ProductionMgr box = item.box, }); } - + string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; Dictionary header = new Dictionary() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK,JsonConvert.SerializeObject(input),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -372,11 +369,11 @@ namespace Tnb.ProductionMgr kitting_out_id = prdKittingOutH.id, }); } - + // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); // await _runService.Create(templateEntity, visualDevModelDataCrInput); - - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { await _repository.InsertAsync(prdKittingOutH); if (prdKittingOutDs.Count > 0) @@ -398,7 +395,7 @@ namespace Tnb.ProductionMgr Log.Error(e.Message); throw Oops.Bah(e.Message); } - + } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index ed200e3d..ace01ef4 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -1,7 +1,5 @@ using JNPF; using JNPF.Common.Core.Manager; -using JNPF.Common.Enums; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Extras.CollectiveOAuth.Models; @@ -14,20 +12,14 @@ using JNPF.Systems.Interfaces.System; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; +using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; using Tnb.ProductionMgr.Interfaces; -using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.ProductionMgr.Entities.Consts; -using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Interfaces; -using Tnb.ProductionMgr.Entities.Consts; using Tnb.WarehouseMgr; using Tnb.WarehouseMgr.Entities; -using Tnb.BasicData; +using Tnb.WarehouseMgr.Entities.Dto; namespace Tnb.ProductionMgr { @@ -57,7 +49,7 @@ namespace Tnb.ProductionMgr _billRullService = billRullService; } - + [HttpPost] public async Task GetInfoByQrCode(string qrCode) { @@ -120,7 +112,7 @@ namespace Tnb.ProductionMgr carry_name = b.carry_name, children = SqlFunc.Subqueryable() .LeftJoin((c, d) => c.material_id == d.id) - .Where((c, d) => a.id == c.material_receipt_id && c.is_all_feeding==0).ToList((c, d) => new CarryCodeDetailOutput() + .Where((c, d) => a.id == c.material_receipt_id && c.is_all_feeding == 0).ToList((c, d) => new CarryCodeDetailOutput() { unit_id = d.unit_id, // barcode = c.barcode, @@ -148,14 +140,14 @@ namespace Tnb.ProductionMgr var moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); var inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id) - .WhereIF(!string.IsNullOrEmpty(input.mbom_process_id),x=>x.mbom_process_id==input.mbom_process_id) - .Select(x=>x.material_id) + .WhereIF(!string.IsNullOrEmpty(input.mbom_process_id), x => x.mbom_process_id == input.mbom_process_id) + .Select(x => x.material_id) .ToListAsync(); string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE); OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorklineCode); OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(input.station_id, DictConst.RegionCategoryWorkshopCode); - + prdMaterialReceiptH = new PrdMaterialReceiptH() { code = code, @@ -178,9 +170,9 @@ namespace Tnb.ProductionMgr { foreach (var item in input.details) { - if(!inputMaterials.Contains(item["material_id"])) + if (!inputMaterials.Contains(item["material_id"])) throw new Exception("该物料不是生产bom投入物料,不能签收"); - + list.Add(new PrdMaterialReceiptD { material_receipt_id = prdMaterialReceiptH.id, @@ -205,13 +197,13 @@ namespace Tnb.ProductionMgr throw new Exception("没有签收物料"); } - + // await db.Insertable(prdMaterialReceiptH).ExecuteCommandAsync(); // await db.Insertable(list).ExecuteCommandAsync(); }); - - + + if (result.IsSuccess) { //签收后调用载具签收接口 @@ -228,13 +220,13 @@ namespace Tnb.ProductionMgr create_id = _userManager.UserId, carry_code = input.carry_code ?? "", }; - + string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; Dictionary header = new Dictionary() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN, JsonConvert.SerializeObject(mesCarrySignInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); if (authResponse.code != 200) @@ -248,11 +240,11 @@ namespace Tnb.ProductionMgr await db.Insertable(prdMaterialReceiptH).ExecuteCommandAsync(); await db.Insertable(list).ExecuteCommandAsync(); }); - + } } - if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - if(!result2.IsSuccess) throw Oops.Bah(result2.ErrorMessage); + if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + if (!result2.IsSuccess) throw Oops.Bah(result2.ErrorMessage); return "签收成功"; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 823e74c8..7869fe92 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -5,7 +5,6 @@ using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; using JNPF.FriendlyException; using JNPF.Logging; @@ -106,7 +105,7 @@ namespace Tnb.ProductionMgr // } // return data!; // } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); @@ -119,22 +118,22 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c) => c.EnCode == DictConst.MeasurementUnit) .LeftJoin((a, b, c, d) => c.Id == d.DictionaryTypeId && a.unit_id == d.Id) .LeftJoin((a, b, c, d, e) => a.mo_status == e.Id) - .LeftJoin((a, b, c, d, e,f) => a.mo_type==f.Id) + .LeftJoin((a, b, c, d, e, f) => a.mo_type == f.Id) .WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d, e) => a.mo_code.Contains(moCode)) .WhereIF(!string.IsNullOrEmpty(combineMoCode), (a, b, c, d, e) => a.combine_mo_code.Contains(combineMoCode)) .WhereIF(!string.IsNullOrEmpty(moStatus), (a, b, c, d, e) => a.mo_status == moStatus) - .Where(a=>SqlFunc.IsNullOrEmpty(a.parent_id)) - .OrderByDescending(a=>a.create_time) - .Select((a, b, c, d, e,f) => new PrdMoListOuput + .Where(a => SqlFunc.IsNullOrEmpty(a.parent_id)) + .OrderByDescending(a => a.create_time) + .Select((a, b, c, d, e, f) => new PrdMoListOuput { id = a.id, mo_type = f.FullName, - mo_source = a.mo_source=="1" ? "ERP同步" : "新建/导入", + mo_source = a.mo_source == "1" ? "ERP同步" : "新建/导入", mo_code = a.mo_code, - plan_start_date = a.plan_start_date==null ? "" : a.plan_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), - material_id = b.code+"/"+b.name, + plan_start_date = a.plan_start_date == null ? "" : a.plan_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), + material_id = b.code + "/" + b.name, material_id_id = b.id, plan_qty = a.plan_qty, unit_id = d.FullName, @@ -145,17 +144,17 @@ namespace Tnb.ProductionMgr .LeftJoin((aa, bb, cc) => cc.EnCode == DictConst.MeasurementUnit) .LeftJoin((aa, bb, cc, dd) => cc.Id == dd.DictionaryTypeId && aa.unit_id == dd.Id) .LeftJoin((aa, bb, cc, dd, ee) => aa.mo_status == ee.Id) - .LeftJoin((aa, bb, cc, dd, ee,ff) => aa.mo_type==ff.Id) - .Where(aa=>aa.parent_id==a.id) - .ToList((aa,bb,cc,dd,ee,ff)=>new PrdMoListOuput + .LeftJoin((aa, bb, cc, dd, ee, ff) => aa.mo_type == ff.Id) + .Where(aa => aa.parent_id == a.id) + .ToList((aa, bb, cc, dd, ee, ff) => new PrdMoListOuput { id = aa.id, mo_type = ff.FullName, - mo_source = aa.mo_source=="1" ? "ERP同步" : "新建/导入", + mo_source = aa.mo_source == "1" ? "ERP同步" : "新建/导入", mo_code = aa.mo_code, - plan_start_date = aa.plan_start_date==null ? "" : aa.plan_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = aa.plan_end_date==null ? "" : aa.plan_end_date.Value.ToString("yyyy-MM-dd"), - material_id = bb.code+"/"+bb.name, + plan_start_date = aa.plan_start_date == null ? "" : aa.plan_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = aa.plan_end_date == null ? "" : aa.plan_end_date.Value.ToString("yyyy-MM-dd"), + material_id = bb.code + "/" + bb.name, material_id_id = bb.id, plan_qty = aa.plan_qty, unit_id = dd.FullName, @@ -296,7 +295,7 @@ namespace Tnb.ProductionMgr // } // return multi; // } - + /// /// 关联同组工单 /// @@ -308,9 +307,9 @@ namespace Tnb.ProductionMgr (bool executeRes, string errMsg) multi = (true, ""); var list = await _repository.AsSugarClient().Queryable() .LeftJoin((a, b) => a.material_id == b.material_id) - .LeftJoin((a,b,c)=>b.mold_id==c.id) - .Where((a, b,c) => input.WorkOrderIds.Contains(a.id)) - .Select((a, b,c) => new + .LeftJoin((a, b, c) => b.mold_id == c.id) + .Where((a, b, c) => input.WorkOrderIds.Contains(a.id)) + .Select((a, b, c) => new { planDate = a.plan_start_date, mold_code = c.mold_code, @@ -386,24 +385,24 @@ namespace Tnb.ProductionMgr scheduled_qty = a.scheduled_qty, tobe_scheduled_qty = a.plan_qty - a.scheduled_qty, reported_work_qty = a.reported_work_qty, - complete_rate = a.reported_work_qty==null?0:SqlFunc.ToDecimal(a.reported_work_qty*100)/SqlFunc.ToDecimal(a.plan_qty), + complete_rate = a.reported_work_qty == null ? 0 : SqlFunc.ToDecimal(a.reported_work_qty * 100) / SqlFunc.ToDecimal(a.plan_qty), children = SqlFunc.Subqueryable() - .LeftJoin((x,y)=>x.mo_task_status==y.EnCode && y.DictionaryTypeId==DictConst.PrdTaskStatusTypeId) - .Where(x=>x.mo_id==a.id && SqlFunc.IsNullOrEmpty(x.parent_id)) - .OrderByDesc((x,y)=>x.create_time) - .ToList((x,y)=>new PrdMoStatisticsDetailOutput() - { - id = x.id, - mo_task_code = x.mo_task_code, - mo_task_status = y.FullName, - estimated_start_date = x.estimated_start_date==null ? "" : x.estimated_start_date.Value.ToString(DbTimeFormat.SS), - estimated_end_date = x.estimated_end_date==null ? "" : x.estimated_end_date.Value.ToString(DbTimeFormat.SS), - scheduled_qty = x.scheduled_qty, - reported_work_qty = x.reported_work_qty, - scrap_qty = x.scrap_qty, - }), + .LeftJoin((x, y) => x.mo_task_status == y.EnCode && y.DictionaryTypeId == DictConst.PrdTaskStatusTypeId) + .Where(x => x.mo_id == a.id && SqlFunc.IsNullOrEmpty(x.parent_id)) + .OrderByDesc((x, y) => x.create_time) + .ToList((x, y) => new PrdMoStatisticsDetailOutput() + { + id = x.id, + mo_task_code = x.mo_task_code, + mo_task_status = y.FullName, + estimated_start_date = x.estimated_start_date == null ? "" : x.estimated_start_date.Value.ToString(DbTimeFormat.SS), + estimated_end_date = x.estimated_end_date == null ? "" : x.estimated_end_date.Value.ToString(DbTimeFormat.SS), + scheduled_qty = x.scheduled_qty, + reported_work_qty = x.reported_work_qty, + scrap_qty = x.scrap_qty, + }), }) - .MergeTable().OrderByDescending(a=>a.complete_rate) + .MergeTable().OrderByDescending(a => a.complete_rate) .ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); @@ -432,8 +431,8 @@ namespace Tnb.ProductionMgr if (!string.IsNullOrEmpty(input.barcode)) { ids2 = await _db.Queryable() - .LeftJoin((a,b)=>a.mo_task_id==b.id) - .Where((a,b) => a.barcode.Contains(input.barcode)).Select((a,b) => b.mo_id).ToListAsync(); + .LeftJoin((a, b) => a.mo_task_id == b.id) + .Where((a, b) => a.barcode.Contains(input.barcode)).Select((a, b) => b.mo_id).ToListAsync(); ids = ids2; } @@ -441,27 +440,27 @@ namespace Tnb.ProductionMgr { ids = ids1.Intersect(ids2).ToList(); } - + var result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .WhereIF(!string.IsNullOrEmpty(input.mo_code),(a,b)=>a.mo_code.Contains(input.mo_code)) - .WhereIF(ids!=null && ids.Count>0,(a,b)=>ids.Contains(a.id)) + .WhereIF(!string.IsNullOrEmpty(input.mo_code), (a, b) => a.mo_code.Contains(input.mo_code)) + .WhereIF(ids != null && ids.Count > 0, (a, b) => ids.Contains(a.id)) .Select((a, b) => new PrdMoFromOneListOutput { id = a.id, mo_code = a.mo_code, material_id = a.material_id, - type = (a.mo_type==DictConst.PrdMoTypeZS || a.mo_type==DictConst.PrdMoTypeJC ) ? 1 : 2, + type = (a.mo_type == DictConst.PrdMoTypeZS || a.mo_type == DictConst.PrdMoTypeJC) ? 1 : 2, material_code = b.code, material_name = b.name, material_standard = b.material_standard, - act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS), - act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS) + act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS), + act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS) }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } - + /// /// 工单追溯二级列表 /// @@ -476,22 +475,22 @@ namespace Tnb.ProductionMgr List ids = new List(); if (!string.IsNullOrEmpty(barcode)) { - ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync(); + ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); } - + PrdMo prdMo = await _repository.GetSingleAsync(x => x.id == mo_id); if (prdMo.mo_type is DictConst.PrdMoTypeZS or DictConst.PrdMoTypeJC) { return await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .LeftJoin((a,b,c)=>a.eqp_id==c.ObjectId && c.ObjectType=="Eqp") - .LeftJoin((a,b,c,d)=>c.OrganizeId==d.Id) - .LeftJoin((a,b,c,d,e)=>d.OrganizeIdTree.Contains(e.Id) && e.Category==DictConst.RegionCategoryWorkshopCode) - .LeftJoin((a,b,c,d,e,f)=>a.eqp_id==f.id) - .WhereIF(!string.IsNullOrEmpty(mo_id),(a,b,c,d)=>a.mo_id==mo_id) - .WhereIF(!string.IsNullOrEmpty(mo_task_code),(a,b,c,d)=>a.mo_task_code==mo_task_code) - .WhereIF(ids!=null && ids.Count>0,(a,b,c,d)=>ids.Contains(a.id)) - .Select((a, b, c, d,e,f) => + .LeftJoin((a, b, c) => a.eqp_id == c.ObjectId && c.ObjectType == "Eqp") + .LeftJoin((a, b, c, d) => c.OrganizeId == d.Id) + .LeftJoin((a, b, c, d, e) => d.OrganizeIdTree.Contains(e.Id) && e.Category == DictConst.RegionCategoryWorkshopCode) + .LeftJoin((a, b, c, d, e, f) => a.eqp_id == f.id) + .WhereIF(!string.IsNullOrEmpty(mo_id), (a, b, c, d) => a.mo_id == mo_id) + .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d) => a.mo_task_code == mo_task_code) + .WhereIF(ids != null && ids.Count > 0, (a, b, c, d) => ids.Contains(a.id)) + .Select((a, b, c, d, e, f) => new PrdMoFromTwoListOutput { id = a.id, @@ -513,9 +512,9 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.workline_id == c.Id) .LeftJoin((a, b, c, d) => a.bom_id == d.id) - .WhereIF(!string.IsNullOrEmpty(mo_id),(a,b,c,d)=>a.mo_id==mo_id) - .WhereIF(!string.IsNullOrEmpty(mo_task_code),(a,b,c,d)=>a.mo_task_code.Contains(mo_task_code)) - .WhereIF(ids!=null && ids.Count>0,(a,b,c,d)=>ids.Contains(a.id)) + .WhereIF(!string.IsNullOrEmpty(mo_id), (a, b, c, d) => a.mo_id == mo_id) + .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(mo_task_code)) + .WhereIF(ids != null && ids.Count > 0, (a, b, c, d) => ids.Contains(a.id)) .Select((a, b, c, d) => new PrdMoFromTwoListOutput { @@ -531,9 +530,9 @@ namespace Tnb.ProductionMgr mbom_version = d.version }).ToListAsync(); } - + } - + /// /// 工单追溯三级级列表 /// @@ -548,19 +547,19 @@ namespace Tnb.ProductionMgr List ids = new List(); if (!string.IsNullOrEmpty(barcode)) { - ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync(); + ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); } - + PrdMoTask prdMoTask = await _db.Queryable().SingleAsync(x => x.id == mo_task_id); - List processStations = await _db.Queryable().Where(x=>x.process_id==prdMoTask.process_id).ToListAsync(); + List processStations = await _db.Queryable().Where(x => x.process_id == prdMoTask.process_id).ToListAsync(); List orgIds = processStations.Select(x => x.id).ToList(); - List orgs = await _db.Queryable().Where(x=>x.Category==DictConst.RegionCategoryStationCode && x.DeleteMark==null).ToListAsync(); + List orgs = await _db.Queryable().Where(x => x.Category == DictConst.RegionCategoryStationCode && x.DeleteMark == null).ToListAsync(); return await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .LeftJoin((a,b,c)=>a.process_id==c.id) - .WhereIF(!string.IsNullOrEmpty(mo_task_id),(a,b,c)=>a.id==mo_task_id) - .WhereIF(!string.IsNullOrEmpty(mo_task_code),(a,b,c)=>a.mo_task_code.Contains(mo_task_code)) - .WhereIF(ids!=null && ids.Count>0,(a,b,c)=>ids.Contains(a.id)) + .LeftJoin((a, b, c) => a.process_id == c.id) + .WhereIF(!string.IsNullOrEmpty(mo_task_id), (a, b, c) => a.id == mo_task_id) + .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c) => a.mo_task_code.Contains(mo_task_code)) + .WhereIF(ids != null && ids.Count > 0, (a, b, c) => ids.Contains(a.id)) .Select((a, b, c) => new PrdMoFromThreeListOutput { @@ -574,16 +573,16 @@ namespace Tnb.ProductionMgr process_name = c.process_name, }).Mapper(x => { - List orgId1 = orgs.Where(y => y.OrganizeIdTree.Contains(x.workline_id)).Select(y=>y.Id).ToList(); + List orgId1 = orgs.Where(y => y.OrganizeIdTree.Contains(x.workline_id)).Select(y => y.Id).ToList(); string station_id = orgIds.Intersect(orgId1)?.FirstOrDefault(); if (!string.IsNullOrEmpty(station_id)) { x.station_name = orgs.FirstOrDefault(y => y.Id == station_id)?.FullName; } }).ToListAsync(); - + } - + /// /// 工单追溯人列表 /// @@ -597,15 +596,15 @@ namespace Tnb.ProductionMgr List ids = new List(); if (!string.IsNullOrEmpty(barcode)) { - ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync(); + ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); } return await _db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) .WhereIF(!string.IsNullOrEmpty(mo_task_id), (a, b) => a.mo_task_id == mo_task_id) // .WhereIF(ids!=null && ids.Count>0,(a,b)=>ids.Contains(a.mo_task_id)) - .WhereIF(!string.IsNullOrEmpty(barcode),(a,b)=>a.barcode.Contains(barcode)) - .GroupBy((a,b)=>new {a.create_id,employee_name = b.RealName}) + .WhereIF(!string.IsNullOrEmpty(barcode), (a, b) => a.barcode.Contains(barcode)) + .GroupBy((a, b) => new { a.create_id, employee_name = b.RealName }) .Select((a, b) => new PrdMoFromManListOutput() { // id = a.id, @@ -618,7 +617,7 @@ namespace Tnb.ProductionMgr }) .ToListAsync(); } - + /// /// 工单追溯机列表 /// @@ -632,21 +631,21 @@ namespace Tnb.ProductionMgr List ids = new List(); if (!string.IsNullOrEmpty(barcode)) { - ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync(); + ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); } return await _db.Queryable() .LeftJoin((a, b) => a.eqp_id == b.id) - .LeftJoin((a,b,c)=>a.mold_id==c.id) + .LeftJoin((a, b, c) => a.mold_id == c.id) .WhereIF(!string.IsNullOrEmpty(mo_task_id), (a, b) => a.id == mo_task_id) - .WhereIF(ids!=null && ids.Count>0,(a,b)=>ids.Contains(a.id)) - .Select((a, b,c) => new PrdMoFromEquipListOutput() + .WhereIF(ids != null && ids.Count > 0, (a, b) => ids.Contains(a.id)) + .Select((a, b, c) => new PrdMoFromEquipListOutput() { equip_code = b.code, mold_code = b.code, }).ToListAsync(); } - + /// /// 工单追溯料列表 /// @@ -660,7 +659,7 @@ namespace Tnb.ProductionMgr List ids = new List(); if (!string.IsNullOrEmpty(barcode)) { - ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x=>x.mo_task_id).ToListAsync(); + ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); } PrdMoTask prdMoTask = await _db.Queryable().SingleAsync(x => x.id == mo_task_id); PrdMo prdMo = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); @@ -675,10 +674,10 @@ namespace Tnb.ProductionMgr if (prdMoTask.schedule_type == 1) { return await _db.Queryable() - .LeftJoin((a,b)=>a.id==b.ebom_id) - .LeftJoin((a,b,c)=>b.material_id==c.id) - .Where((a,b,c)=>a.id==prdMoTask.ebom_id) - .Select((a,b,c)=>new PrdMoFromMaterialListOutput() + .LeftJoin((a, b) => a.id == b.ebom_id) + .LeftJoin((a, b, c) => b.material_id == c.id) + .Where((a, b, c) => a.id == prdMoTask.ebom_id) + .Select((a, b, c) => new PrdMoFromMaterialListOutput() { material_code = c.code, material_name = c.name, @@ -687,9 +686,9 @@ namespace Tnb.ProductionMgr else { return await _db.Queryable() - .LeftJoin((a,b)=>a.material_id==b.id) - .Where((a,b)=>a.mbom_id==prdMoTask.bom_id) - .Select((a,b)=>new PrdMoFromMaterialListOutput() + .LeftJoin((a, b) => a.material_id == b.id) + .Where((a, b) => a.mbom_id == prdMoTask.bom_id) + .Select((a, b) => new PrdMoFromMaterialListOutput() { material_code = b.code, material_name = b.name, @@ -699,7 +698,7 @@ namespace Tnb.ProductionMgr else { PrdReport prdReport = await _db.Queryable().Where(x => x.barcode == barcode).FirstAsync(); - List prdReports = await _db.Queryable().Where(x=>x.create_time<=prdReport.create_time && x.barcode!=barcode && x.mo_task_id==mo_task_id).ToListAsync(); + List prdReports = await _db.Queryable().Where(x => x.create_time <= prdReport.create_time && x.barcode != barcode && x.mo_task_id == mo_task_id).ToListAsync(); int? beforeReportNum = prdReports.Sum(x => x.reported_qty); List prdFeedingIds = new List(); if (prdMoTask.schedule_type == 1) @@ -713,7 +712,7 @@ namespace Tnb.ProductionMgr List prdFeedingDs = await _db.Queryable() .LeftJoin((a, b) => a.feeding_id == b.id) .Where((a, b) => a.material_id == item.material_id && b.mo_task_id == mo_task_id) - .OrderBy((a,b)=>b.create_time) + .OrderBy((a, b) => b.create_time) .Select((a, b) => a).ToListAsync(); decimal sum1 = 0; decimal sum2 = 0; @@ -737,7 +736,7 @@ namespace Tnb.ProductionMgr } } } - + return await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.material_receipt_detail_id == c.id) @@ -754,40 +753,40 @@ namespace Tnb.ProductionMgr instock_time = c.instock_time.ToString(DbTimeFormat.SS), feeding_time = e.create_time == null ? "" : e.create_time.Value.ToString(DbTimeFormat.SS), }).ToListAsync(); - + } else { - List basMbomInputs = await _db.Queryable().Where(x=>x.mbom_process_id==prdMoTask.mbom_process_id).ToListAsync(); + List basMbomInputs = await _db.Queryable().Where(x => x.mbom_process_id == prdMoTask.mbom_process_id).ToListAsync(); BasMbom basMbom = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.bom_id); BasMbomProcess basMbomProcess = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); List lastPrdReportIds = new List(); foreach (var item in basMbomInputs) { - BasMbomOutput basMbomOutput = await _db.Queryable().Where(x=>x.mbom_process_id==basMbomProcess.id && x.material_id==prdMoTask.material_id).FirstAsync(); - if (basMbomOutput == null) break; + BasMbomOutput basMbomOutput = await _db.Queryable().Where(x => x.mbom_process_id == basMbomProcess.id && x.material_id == prdMoTask.material_id).FirstAsync(); + if (basMbomOutput == null) break; decimal? num1 = beforeReportNum / Convert.ToDecimal(basMbomOutput.num) * item.num; List prdFeedingDs = await _db.Queryable() .LeftJoin((a, b) => a.feeding_id == b.id) .Where((a, b) => a.material_id == item.material_id && b.mo_task_id == mo_task_id) - .OrderBy((a,b)=>b.create_time) + .OrderBy((a, b) => b.create_time) .Select((a, b) => a).ToListAsync(); - + if (prdFeedingDs == null || prdFeedingDs.Count <= 0) { if (string.IsNullOrEmpty(basMbomProcess.last_process_no)) continue; - - List lastBasMbomProcesses = await _db.Queryable().Where(x=>x.no==basMbomProcess.last_process_no && x.mbom_id==prdMoTask.bom_id).ToListAsync(); + + List lastBasMbomProcesses = await _db.Queryable().Where(x => x.no == basMbomProcess.last_process_no && x.mbom_id == prdMoTask.bom_id).ToListAsync(); foreach (var lastBasMbomProcess in lastBasMbomProcesses) { List lastPrdReports = await _db.Queryable() - .Where(x=>x.mbom_process_id==lastBasMbomProcess.id && x.material_id==item.material_id) - .OrderBy(x=>x.create_time) + .Where(x => x.mbom_process_id == lastBasMbomProcess.id && x.material_id == item.material_id) + .OrderBy(x => x.create_time) .ToListAsync(); if (lastPrdReports == null || lastPrdReports.Count <= 0) continue; - - PrdMoTask lastPrdMoTask = await _db.Queryable().FirstAsync(x=>x.mo_id==prdMo.id && x.mbom_process_id==lastBasMbomProcess.id); - + + PrdMoTask lastPrdMoTask = await _db.Queryable().FirstAsync(x => x.mo_id == prdMo.id && x.mbom_process_id == lastBasMbomProcess.id); + decimal sum1 = 0; decimal sum2 = 0; foreach (var lastPrdReport in lastPrdReports) @@ -809,9 +808,9 @@ namespace Tnb.ProductionMgr } } } - + } - + } else @@ -839,7 +838,7 @@ namespace Tnb.ProductionMgr } } } - + var queryable1 = _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.material_receipt_detail_id == c.id) @@ -877,14 +876,14 @@ namespace Tnb.ProductionMgr { return await queryable1.ToListAsync(); } - + } } - + } #endregion - + #region 反向工单追溯相关 /// @@ -908,7 +907,7 @@ namespace Tnb.ProductionMgr ["currentPage"] = 1, ["pageSize"] = int.MaxValue, }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE,JsonConvert.SerializeObject(postData),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE, JsonConvert.SerializeObject(postData), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -918,15 +917,15 @@ namespace Tnb.ProductionMgr } else { - PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter()); + PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(), new Tnb.Common.Utils.DateTimeJsonConverter()); if (output.list != null && output.list.Count > 0) { - BasMaterial basMaterial = await _db.Queryable().SingleAsync(x=>x.id==output.list[0].material_id); - BasSupplier basSupplier = await _db.Queryable().SingleAsync(x=>x.id==output.list[0].supplier_id); + BasMaterial basMaterial = await _db.Queryable().SingleAsync(x => x.id == output.list[0].material_id); + BasSupplier basSupplier = await _db.Queryable().SingleAsync(x => x.id == output.list[0].supplier_id); DictionaryDataEntity unit = await _db.Queryable() - .LeftJoin((a,b)=>a.Id==b.DictionaryTypeId) - .Where((a,b)=>a.EnCode==DictConst.MeasurementUnit && b.EnCode==output.list[0].unit_id) - .Select((a,b)=>b) + .LeftJoin((a, b) => a.Id == b.DictionaryTypeId) + .Where((a, b) => a.EnCode == DictConst.MeasurementUnit && b.EnCode == output.list[0].unit_id) + .Select((a, b) => b) .FirstAsync(); output.list[0].feeding_num = await _db.Queryable() .LeftJoin((a, b) => a.id == b.material_receipt_detail_id) @@ -935,15 +934,15 @@ namespace Tnb.ProductionMgr output.list[0].material_standard = basMaterial.material_standard; output.list[0].supplier_name = basSupplier?.supplier_name ?? ""; output.list[0].unit_name = unit?.FullName ?? ""; - + return output.list[0]; - } + } } return Array.Empty(); } - + /// /// 物料反向追溯投料信息 /// @@ -995,7 +994,7 @@ namespace Tnb.ProductionMgr return result; // return PageResult.SqlSugarPageResult(result); } - + /// /// 物料反向追溯产出信息 /// @@ -1006,12 +1005,12 @@ namespace Tnb.ProductionMgr { string feeding_detail_id = prdMoReverseFromOutInfoQueryInput.feeding_detail_id ?? ""; PrdFeedingD prdFeedingD = await _db.Queryable().FirstAsync(x => x.id == feeding_detail_id); - if(prdFeedingD.use_num<=0) return Array.Empty(); + if (prdFeedingD.use_num <= 0) return Array.Empty(); PrdFeedingH prdFeedingH = await _db.Queryable().FirstAsync(x => x.id == prdFeedingD.feeding_id); PrdMoTask prdMoTask = await _db.Queryable().FirstAsync(x => x.id == prdFeedingH.mo_task_id); List prdFeedingDs = await _db.Queryable() .LeftJoin((a, b) => a.feeding_id == b.id) - .Where((a, b) => a.material_id == prdFeedingD.material_id && b.mo_task_id == prdFeedingH.mo_task_id && b.create_time<=prdFeedingH.create_time && a.id!=prdFeedingD.id) + .Where((a, b) => a.material_id == prdFeedingD.material_id && b.mo_task_id == prdFeedingH.mo_task_id && b.create_time <= prdFeedingH.create_time && a.id != prdFeedingD.id) .Select((a, b) => a).ToListAsync(); decimal beforeIn = prdFeedingDs.Sum(x => x.num); List reportIds = new List(); @@ -1022,7 +1021,7 @@ namespace Tnb.ProductionMgr BasEbomD basEbomD = basEbomDs.Where(x => x.material_id == prdFeedingD.material_id).FirstOrDefault(); if (basEbomD != null) { - List prdReports = await _db.Queryable().Where(x => x.mo_task_id == prdMoTask.id).OrderBy(x=>x.create_time).ToListAsync(); + List prdReports = await _db.Queryable().Where(x => x.mo_task_id == prdMoTask.id).OrderBy(x => x.create_time).ToListAsync(); if (prdReports != null && prdReports.Count > 0) { bool flag = true; @@ -1048,7 +1047,7 @@ namespace Tnb.ProductionMgr reportIds.Add(prdReport.id); break; } - + flag = false; continue; @@ -1058,7 +1057,8 @@ namespace Tnb.ProductionMgr { residueNeed -= needNum; reportIds.Add(prdReport.id); - }else + } + else { reportIds.Add(prdReport.id); break; @@ -1075,30 +1075,30 @@ namespace Tnb.ProductionMgr { return Array.Empty(); } - - } + + } else { List prdReports = await _db.Queryable() .LeftJoin((a, b) => a.mbom_process_id == b.id) .LeftJoin((a, b, c) => a.id == c.mo_task_id) .Where((a, b, c) => a.mo_id == prdMoTask.mo_id && b.next_process_no == null) - .OrderBy((a,b,c)=>c.create_time) + .OrderBy((a, b, c) => c.create_time) .Select((a, b, c) => c).ToListAsync(); if (prdReports != null && prdReports.Count > 0) { - List mbomProcesssIds = new List(){prdMoTask.mbom_process_id}; - BasMbomProcess startMbomProcess = await _db.Queryable().Where(x=>x.id==prdMoTask.mbom_process_id).FirstAsync(); - List allMbomProcesses = await _db.Queryable().Where(x=>x.mbom_id==prdMoTask.bom_id).ToListAsync(); + List mbomProcesssIds = new List() { prdMoTask.mbom_process_id }; + BasMbomProcess startMbomProcess = await _db.Queryable().Where(x => x.id == prdMoTask.mbom_process_id).FirstAsync(); + List allMbomProcesses = await _db.Queryable().Where(x => x.mbom_id == prdMoTask.bom_id).ToListAsync(); string startNo = startMbomProcess.next_process_no; if (!string.IsNullOrEmpty(startNo)) { while (true) { - BasMbomProcess nextMbomProcess = allMbomProcesses.FirstOrDefault(x=>x.no==startNo); + BasMbomProcess nextMbomProcess = allMbomProcesses.FirstOrDefault(x => x.no == startNo); - if (nextMbomProcess==null || nextMbomProcess.no==null) + if (nextMbomProcess == null || nextMbomProcess.no == null) { break; } @@ -1120,23 +1120,23 @@ namespace Tnb.ProductionMgr List outputList = await _db.Queryable() .LeftJoin((a, b) => a.id == b.mbom_process_id) .Where((a, b) => mbomProcesssIds.Contains(a.id)) - .Select((a,b)=>b).ToListAsync(); - + .Select((a, b) => b).ToListAsync(); + List inputList = await _db.Queryable() .LeftJoin((a, b) => a.id == b.mbom_process_id) .Where((a, b) => mbomProcesssIds.Contains(a.id)) - .Select((a,b)=>b).ToListAsync(); + .Select((a, b) => b).ToListAsync(); decimal? needNum = 1;//一个最终物料需要本任务单投入物料的数量 - string tempMaterialId = outputList.FirstOrDefault(x=>x.mbom_process_id==mbomProcesssIds[mbomProcesssIds.Count-1])?.material_id; - for (int i = mbomProcesssIds.Count - 1; i > 0;i--) + string tempMaterialId = outputList.FirstOrDefault(x => x.mbom_process_id == mbomProcesssIds[mbomProcesssIds.Count - 1])?.material_id; + for (int i = mbomProcesssIds.Count - 1; i > 0; i--) { List inputs = inputList.Where(x => x.mbom_process_id == mbomProcesssIds[i]).ToList(); - BasMbomOutput output = outputList.FirstOrDefault(x => x.mbom_process_id == mbomProcesssIds[i] && x.material_id==tempMaterialId); + BasMbomOutput output = outputList.FirstOrDefault(x => x.mbom_process_id == mbomProcesssIds[i] && x.material_id == tempMaterialId); List inputMaterialIds = inputs.Select(x => x.material_id).ToList(); - List lastOutputs = outputList.Where(x=>x.mbom_process_id==mbomProcesssIds[i-1]).ToList(); - decimal? inputNum = inputs.FirstOrDefault(x => inputMaterialIds.Contains(x.material_id))?.num; + List lastOutputs = outputList.Where(x => x.mbom_process_id == mbomProcesssIds[i - 1]).ToList(); + decimal? inputNum = inputs.FirstOrDefault(x => inputMaterialIds.Contains(x.material_id))?.num; if (inputNum == null) { throw new Exception("生产bom投入产出物料配置错误"); @@ -1171,7 +1171,7 @@ namespace Tnb.ProductionMgr reportIds.Add(prdReport.id); break; } - + flag = false; continue; @@ -1181,25 +1181,26 @@ namespace Tnb.ProductionMgr { residueNeed -= needNumTotal; reportIds.Add(prdReport.id); - }else + } + else { reportIds.Add(prdReport.id); break; } } } - - - + + + } else { return Array.Empty(); } } - - List barCodes = await _db.Queryable().Where(x=>reportIds.Contains(x.id)).Select(x=>x.barcode).ToListAsync(); - + + List barCodes = await _db.Queryable().Where(x => reportIds.Contains(x.id)).Select(x => x.barcode).ToListAsync(); + string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; Dictionary header = new Dictionary() { @@ -1212,7 +1213,7 @@ namespace Tnb.ProductionMgr ["currentPage"] = 1, ["pageSize"] = int.MaxValue, }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE,JsonConvert.SerializeObject(postData),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE, JsonConvert.SerializeObject(postData), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -1223,7 +1224,7 @@ namespace Tnb.ProductionMgr else { BasMaterial basMaterial = await _db.Queryable().FirstAsync(x => x.id == prdMoTask.material_id); - PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter()); + PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(), new Tnb.Common.Utils.DateTimeJsonConverter()); if (output.list != null && output.list.Count > 0) { foreach (var item in output.list) @@ -1235,7 +1236,7 @@ namespace Tnb.ProductionMgr return output.list; } } - + #endregion } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs index 72fd26ad..6aa2a463 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs @@ -1,31 +1,19 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Systems.Interfaces.System; +using JNPF.Systems.Entitys.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using NPOI.Util; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using SqlSugar; +using Tnb.BasicData; using Tnb.BasicData.Entities; using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Interfaces; -using Aspose.Cells.Drawing; -using Microsoft.AspNetCore.Mvc; -using JNPF.Common.Extension; -using JNPF.Common.Filter; -using JNPF.Systems.Entitys.System; -using Newtonsoft.Json; -using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; -using Tnb.BasicData; using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr { @@ -101,7 +89,7 @@ namespace Tnb.ProductionMgr // } // return data!; // } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); @@ -112,24 +100,24 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => c.EnCode == DictConst.TaskStatus) .LeftJoin((a, b, c, d) => c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode) - .LeftJoin((a,b,c,d,e)=>a.mold_id==e.id) - .LeftJoin((a,b,c,d,e,f)=>a.mo_id==f.id) - .LeftJoin((a,b,c,d,e,f,g)=>g.id==a.eqp_id) + .LeftJoin((a, b, c, d, e) => a.mold_id == e.id) + .LeftJoin((a, b, c, d, e, f) => a.mo_id == f.id) + .LeftJoin((a, b, c, d, e, f, g) => g.id == a.eqp_id) .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode)) .WhereIF(!string.IsNullOrEmpty(moTaskStatus), (a, b, c, d) => a.mo_task_status == moTaskStatus) - .Where((a,b,c,d,e,f)=>a.schedule_type==1) - .Select((a, b, c, d,e,f,g) => new PrdMoTaskIssueListOutput + .Where((a, b, c, d, e, f) => a.schedule_type == 1) + .Select((a, b, c, d, e, f, g) => new PrdMoTaskIssueListOutput { id = a.id, mo_task_code = a.mo_task_code, - material_id = b.code+"/"+b.name, - mold_id = e.mold_code+"/"+e.mold_name, - eqp_id = g.code+"/"+g.name, + material_id = b.code + "/" + b.name, + mold_id = e.mold_code + "/" + e.mold_name, + eqp_id = g.code + "/" + g.name, mo_task_status = d.FullName, plan_qty = f.plan_qty, scheduled_qty = a.scheduled_qty, - create_time = a.create_time==null ? "" :a.create_time.Value.ToString(DbTimeFormat.SS), - }).OrderByDescending(a=>a.create_time).ToPagedListAsync(input.currentPage, input.pageSize); + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + }).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index cda260c3..cfb0f976 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1,52 +1,35 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using DbModels; +using System.Reflection; using JNPF.Common.Core.Manager; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Tnb.BasicData.Entities; -using Tnb.BasicData; -using Tnb.EquipMgr.Entities; -using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Entities.Dto.PrdManage; -using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Interfaces; using JNPF.Common.Enums; using JNPF.Common.Extension; +using JNPF.Common.Filter; using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; using JNPF.FriendlyException; -using Tnb.ProductionMgr.Entities.Enums; +using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; -using JNPF.VisualDev.Entitys; -using Aop.Api.Domain; -using Senparc.Weixin.MP.AdvancedAPIs.Card; -using Aspose.Cells.Drawing.Texts; -using JNPF.Systems.Entitys.Permission; -using WebSocketSharp.Frame; -using JNPF.Logging; -using System.Dynamic; -using Tnb.EquipMgr.Entities.Dto; -using JNPF.Common.Filter; -using JNPF.Systems.Entitys.System; -using Microsoft.ClearScript.Util.Web; +using Mapster; +using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; +using SqlSugar; +using Tnb.BasicData; +using Tnb.BasicData.Entities; using Tnb.BasicData.Entities.Dto; -using NPOI.SS.Formula.Functions; +using Tnb.EquipMgr.Entities; using Tnb.PerMgr.Entities; -using Tnb.QcMgr.Interfaces; +using Tnb.ProductionMgr.Entities; +using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Entities.Dto.PrdManage; +using Tnb.ProductionMgr.Entities.Enums; +using Tnb.ProductionMgr.Interfaces; using Tnb.QcMgr.Entities; using Tnb.QcMgr.Entities.Enums; +using Tnb.QcMgr.Interfaces; // using Tnb.PerMgr.Entities; @@ -95,7 +78,7 @@ namespace Tnb.ProductionMgr OverideFuncs.GetListAsync = GetList; _billRuleService = billRullService; _prdInstockService = prdInstockService; - _qcCheckPlanService=qcCheckPlanService; + _qcCheckPlanService = qcCheckPlanService; } #region Get @@ -255,12 +238,12 @@ namespace Tnb.ProductionMgr var users = await db.Queryable().ToListAsync(); if (defects?.Count > 0) { - output.batchItems = defects.GroupBy(g => new { g.batch,g.create_id }).Select(t => new BatchItem + output.batchItems = defects.GroupBy(g => new { g.batch, g.create_id }).Select(t => new BatchItem { scrap_qty = t.Sum(d => d.defective_item_qty), batch = t.Key.batch, create_time = t.Key.batch.ParseToDateTime().ToString("yyyy-MM-dd HH:mm:ss"), - create_name = users.First(x=>x.Id==t.Key.create_id)?.RealName ?? "", + create_name = users.First(x => x.Id == t.Key.create_id)?.RealName ?? "", categoryItems = t.GroupBy(g => g.defective_cagetory_id).Select(c => new CategoryItem { name = _dicDefect[c.Key]?.ToString(), @@ -272,7 +255,7 @@ namespace Tnb.ProductionMgr }).ToList(), }).ToList(), }).ToList(); - + } return output; } @@ -310,7 +293,7 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c, d) => a.mold_id == d.id) .LeftJoin((a, b, c, d, e) => a.eqp_id == e.id) .Where((a, b, c, d, e) => a.mo_id == moId) - .OrderByDescending((a,b,c,d,e)=>a.create_time) + .OrderByDescending((a, b, c, d, e) => a.create_time) .Select((a, b, c, d, e) => new PrdMoTaskOutput { mo_task_code = a.mo_task_code, @@ -326,10 +309,10 @@ namespace Tnb.ProductionMgr estimated_start_date = a.estimated_start_date.Value.ToString(DbTimeFormat.SS), estimated_end_date = a.estimated_end_date.Value.ToString(DbTimeFormat.SS), plan_qty = a.scheduled_qty, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), process_code = SqlFunc.Subqueryable().Where(it => it.id == a.process_id).Select(it => it.process_code), process_name = SqlFunc.Subqueryable().Where(it => it.id == a.process_id).Select(it => it.process_name), - create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), }) .Mapper(it => { @@ -342,10 +325,10 @@ namespace Tnb.ProductionMgr result = await _db.Queryable().LeftJoin((a, b) => a.mo_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .LeftJoin((a, b, c, d) => a.workline_id == d.Id) - .LeftJoin((a,b,c,d,e)=>a.process_id==e.id) + .LeftJoin((a, b, c, d, e) => a.process_id == e.id) .Where((a, b, c, d) => (b.id == moId || b.parent_id == moId) && SqlFunc.IsNullOrEmpty(a.parent_id)) - .OrderByDescending((a,b,c,d,e)=>a.create_time) - .Select((a, b, c, d,e) => new PrdMoTaskOutput + .OrderByDescending((a, b, c, d, e) => a.create_time) + .Select((a, b, c, d, e) => new PrdMoTaskOutput { mo_task_code = a.mo_task_code, mo_task_status = a.mo_task_status, @@ -359,8 +342,8 @@ namespace Tnb.ProductionMgr estimated_start_date = a.estimated_start_date.Value.ToString(DbTimeFormat.SS), estimated_end_date = a.estimated_end_date.Value.ToString(DbTimeFormat.SS), plan_qty = a.scheduled_qty, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0), - create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), }) .Mapper(it => { @@ -386,7 +369,7 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c, d) => a.bom_id == d.id) .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(input.mo_task_code)) .Where((a, b, c, d) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id)) - .OrderByDescending(a=>a.create_time) + .OrderByDescending(a => a.create_time) .Select((a, b, c, d) => new PackSechelToBeIssueListOutput { mo_task_id = a.id, @@ -402,8 +385,8 @@ namespace Tnb.ProductionMgr scheduled_qty = a.scheduled_qty, plan_qty = SqlFunc.Subqueryable().Where(it => it.id == a.mo_id).Select(it => it.plan_qty), complete_qty = a.last_process_complete_qty, - estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM), - estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM), + estimated_start_date = a.estimated_start_date == null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM), + estimated_end_date = a.estimated_end_date == null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM), bom_id = d.id, bom_version = d.version }) @@ -424,9 +407,9 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.workline_id == c.Id) .LeftJoin((a, b, c, d) => a.mo_id == d.id) - .LeftJoin((a,b,c,d,e)=>a.process_id==e.id) + .LeftJoin((a, b, c, d, e) => a.process_id == e.id) .Where((a, b, c, d) => a.parent_id == mo_task_id) - .Select((a, b, c, d,e) => new PackSechelToBeIssueListOutput + .Select((a, b, c, d, e) => new PackSechelToBeIssueListOutput { mo_task_id = a.id, mo_task_code = a.mo_task_code, @@ -438,9 +421,9 @@ namespace Tnb.ProductionMgr scheduled_qty = a.scheduled_qty, plan_qty = d.plan_qty, process_task_qty = a.process_task_qty, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0), - estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM), - estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), + estimated_start_date = a.estimated_start_date == null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM), + estimated_end_date = a.estimated_end_date == null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM), process_name = e.process_name, bom_version = SqlFunc.Subqueryable().Where(it => it.material_id == a.material_id).Select(it => it.version) }) @@ -530,8 +513,8 @@ namespace Tnb.ProductionMgr // }; // return PageResult.SqlSugarPageResult(pagedList); // } - - + + /// /// 获取组装、包装 待排产工单树形列表 /// @@ -541,17 +524,17 @@ namespace Tnb.ProductionMgr { Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); List moStatusList = new List(); - if (queryJson!=null && queryJson.ContainsKey("mo_stauts")) + if (queryJson != null && queryJson.ContainsKey("mo_stauts")) { moStatusList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(queryJson["mo_status"])); } List moTypeList = new List(); - if (queryJson!=null && queryJson.ContainsKey("mo_type")) + if (queryJson != null && queryJson.ContainsKey("mo_type")) { moTypeList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(queryJson["mo_type"])); } - string moCode = queryJson!=null && queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : ""; - string combineMoCode = queryJson!=null && queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : ""; + string moCode = queryJson != null && queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : ""; + string combineMoCode = queryJson != null && queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : ""; var db = _repository.AsSugarClient(); var result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) @@ -561,10 +544,10 @@ namespace Tnb.ProductionMgr .WhereIF(moStatusList != null && moStatusList.Count > 0, (a, b, c, d, e) => moStatusList.Contains(a.mo_status)) .WhereIF(moTypeList != null && moTypeList.Count > 0, (a, b, c, d, e) => moTypeList.Contains(a.mo_type)) - .WhereIF(!string.IsNullOrEmpty(moCode),(a,b,c,d,e)=>a.mo_code.Contains(moCode)) - .WhereIF(!string.IsNullOrEmpty(combineMoCode),(a,b,c,d,e)=>a.combine_mo_code.Contains(combineMoCode)) - .Where((a,b,c,d,e)=>SqlFunc.IsNullOrEmpty(a.parent_id)) - .OrderByDescending((a,b,c,d,e)=>a.create_time) + .WhereIF(!string.IsNullOrEmpty(moCode), (a, b, c, d, e) => a.mo_code.Contains(moCode)) + .WhereIF(!string.IsNullOrEmpty(combineMoCode), (a, b, c, d, e) => a.combine_mo_code.Contains(combineMoCode)) + .Where((a, b, c, d, e) => SqlFunc.IsNullOrEmpty(a.parent_id)) + .OrderByDescending((a, b, c, d, e) => a.create_time) .Select((a, b, c, d, e) => new PrdMoListTreeOutput { org_id = a.org_id, @@ -581,9 +564,9 @@ namespace Tnb.ProductionMgr scrap_qty = a.scrap_qty.Value.ToString(), plan_start_date = a.plan_start_date.Value.ToString("yyyy-MM-dd"), plan_end_date = a.plan_end_date.Value.ToString("yyyy-MM-dd"), - is_create_dispatch = a.is_create_dispatch==0 ? "否" : "是", + is_create_dispatch = a.is_create_dispatch == 0 ? "否" : "是", production_linecode = a.production_linecode, - is_merge = a.is_merge==0 ? "否" : "是", + is_merge = a.is_merge == 0 ? "否" : "是", combine_mo_code = a.combine_mo_code, time_stamp = a.time_stamp, create_id = e.RealName, @@ -593,49 +576,49 @@ namespace Tnb.ProductionMgr scheduled_qty = a.scheduled_qty.Value.ToString(), parent_id = "0", id = a.id, - hasChildren = SqlFunc.Subqueryable().Where(x=>x.parent_id==a.id).Any(), - num = SqlFunc.Subqueryable().Where(x=>x.parent_id==a.id).Count(), - isLeaf = SqlFunc.Subqueryable().Where(x=>x.parent_id==a.id).Any(), + hasChildren = SqlFunc.Subqueryable().Where(x => x.parent_id == a.id).Any(), + num = SqlFunc.Subqueryable().Where(x => x.parent_id == a.id).Count(), + isLeaf = SqlFunc.Subqueryable().Where(x => x.parent_id == a.id).Any(), children = SqlFunc.Subqueryable() - .LeftJoin((h,i) => h.material_id == i.id) - .LeftJoin((h,i,j) => h.mo_type == j.Id) - .LeftJoin((h,i,j,k) => h.mo_status == k.Id) - .LeftJoin((h,i,j,k,l) => h.create_id == l.Id) - .Where((h,i,j,k,l)=>a.id==h.parent_id).ToList((h,i,j,k,l)=>new PrdMoListTreeOutput() - { - org_id = h.org_id, - mo_id = h.id, - mo_code = h.mo_code, - material_code = i.code, - material_name = i.name, - material_standard = i.material_standard, - mo_type = j.FullName, - mo_status = k.FullName, - plan_qty = h.plan_qty.Value.ToString(), - input_qty = h.input_qty.Value.ToString(), - complete_qty = h.complete_qty.Value.ToString(), - scrap_qty = h.scrap_qty.Value.ToString(), - plan_start_date = h.plan_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = h.plan_end_date.Value.ToString("yyyy-MM-dd"), - is_create_dispatch = h.is_create_dispatch==0 ? "否" : "是", - production_linecode = h.production_linecode, - is_merge = h.is_merge==0 ? "否" : "是", - combine_mo_code = h.combine_mo_code, - time_stamp = h.time_stamp, - create_id = l.RealName, - create_time = h.create_time.Value.ToString("yyyy-MM-dd : HH:mm:ss"), - material_id = i.code, - material_id_id = h.material_id, - scheduled_qty = h.scheduled_qty.Value.ToString(), - parent_id = a.id, - id = h.id, - hasChildren = false, - num = 0, - isLeaf = true, - }) + .LeftJoin((h, i) => h.material_id == i.id) + .LeftJoin((h, i, j) => h.mo_type == j.Id) + .LeftJoin((h, i, j, k) => h.mo_status == k.Id) + .LeftJoin((h, i, j, k, l) => h.create_id == l.Id) + .Where((h, i, j, k, l) => a.id == h.parent_id).ToList((h, i, j, k, l) => new PrdMoListTreeOutput() + { + org_id = h.org_id, + mo_id = h.id, + mo_code = h.mo_code, + material_code = i.code, + material_name = i.name, + material_standard = i.material_standard, + mo_type = j.FullName, + mo_status = k.FullName, + plan_qty = h.plan_qty.Value.ToString(), + input_qty = h.input_qty.Value.ToString(), + complete_qty = h.complete_qty.Value.ToString(), + scrap_qty = h.scrap_qty.Value.ToString(), + plan_start_date = h.plan_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = h.plan_end_date.Value.ToString("yyyy-MM-dd"), + is_create_dispatch = h.is_create_dispatch == 0 ? "否" : "是", + production_linecode = h.production_linecode, + is_merge = h.is_merge == 0 ? "否" : "是", + combine_mo_code = h.combine_mo_code, + time_stamp = h.time_stamp, + create_id = l.RealName, + create_time = h.create_time.Value.ToString("yyyy-MM-dd : HH:mm:ss"), + material_id = i.code, + material_id_id = h.material_id, + scheduled_qty = h.scheduled_qty.Value.ToString(), + parent_id = a.id, + id = h.id, + hasChildren = false, + num = 0, + isLeaf = true, + }) }).ToPagedListAsync(input.currentPage, input.pageSize); - - + + return PageResult.SqlSugarPageResult(result); } @@ -674,7 +657,7 @@ namespace Tnb.ProductionMgr { var mo = await db.Queryable().FirstAsync(it => it.id == input.mo_id); BasMbomProcess basMbomProcess = null; - if(!string.IsNullOrEmpty(input.bom_id)) + if (!string.IsNullOrEmpty(input.bom_id)) basMbomProcess = await db.Queryable().FirstAsync(x => x.mbom_id == input.bom_id); var moTask = input.Adapt(); moTask.id = SnowflakeIdHelper.NextId(); @@ -688,9 +671,9 @@ namespace Tnb.ProductionMgr if (!string.IsNullOrEmpty(input.eqp_id)) { - OrganizeRelationEntity organizeRelationEntity = await db.Queryable() - .Where(x => x.ObjectId == input.eqp_id && x.ObjectType == "Eqp").FirstAsync(); - moTask.workstation_id = organizeRelationEntity?.OrganizeId ?? ""; + OrganizeRelationEntity organizeRelationEntity = await db.Queryable() + .Where(x => x.ObjectId == input.eqp_id && x.ObjectType == "Eqp").FirstAsync(); + moTask.workstation_id = organizeRelationEntity?.OrganizeId ?? ""; } var moCode = mo?.mo_code; @@ -730,29 +713,29 @@ namespace Tnb.ProductionMgr if (mo != null) {//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产 - // if (schedQty.HasValue && schedQty.Value >= mo.plan_qty) - // { - // mo.mo_status = DictConst.AlreadyId; - // } - // else - // { - // if (schedQty.HasValue) - // mo.scheduled_qty = schedQty.Value; - // } - // row = await db.Updateable(mo).ExecuteCommandAsync(); - + // if (schedQty.HasValue && schedQty.Value >= mo.plan_qty) + // { + // mo.mo_status = DictConst.AlreadyId; + // } + // else + // { + // if (schedQty.HasValue) + // mo.scheduled_qty = schedQty.Value; + // } + // row = await db.Updateable(mo).ExecuteCommandAsync(); + if (mo.scheduled_qty == null) { await _db.Updateable() .SetColumns(x => x.mo_status == DictConst.AlreadyId) .SetColumns(x => x.scheduled_qty == input.scheduled_qty) - .Where(x=>x.id==mo.id) + .Where(x => x.id == mo.id) .ExecuteCommandAsync(); } else { await _db.Updateable().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty) - .Where(x=>x.id==mo.id) + .Where(x => x.id == mo.id) .ExecuteCommandAsync(); } } @@ -925,17 +908,17 @@ namespace Tnb.ProductionMgr await _db.Updateable() .SetColumns(x => x.mo_status == DictConst.AlreadyId) .SetColumns(x => x.scheduled_qty == input.scheduled_qty) - .Where(x=>x.id==mo.id) + .Where(x => x.id == mo.id) .ExecuteCommandAsync(); } else { await _db.Updateable().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty) - .Where(x=>x.id==mo.id) + .Where(x => x.id == mo.id) .ExecuteCommandAsync(); } } - + var subTaskList = await _db.Queryable() .LeftJoin((a, b) => a.id == b.mbom_id) .LeftJoin((a, b, c) => a.route_id == c.id) @@ -943,7 +926,7 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b, c, d) => b.route_detail_id == d.id) .LeftJoin((a, b, c, d, e) => a.id == e.mbom_id && e.mbom_process_id == b.id) .Where((a, b, c, d, e) => a.id == input.bom_id) - .OrderBy((a,b,c,d,e)=>b.ordinal) + .OrderBy((a, b, c, d, e) => b.ordinal) .Select((a, b, c, d, e) => new SubBomListOutput { version = a.version, @@ -961,17 +944,17 @@ namespace Tnb.ProductionMgr { List workstationIds = await _db.Queryable().Where(x => x.Category == DictConst.RegionCategoryStationCode && - x.OrganizeIdTree.Contains(input.workline_id)).Select(x=>x.Id).ToListAsync(); - - + x.OrganizeIdTree.Contains(input.workline_id)).Select(x => x.Id).ToListAsync(); + + List subMoTasks = new(); List subMoTaskLogs = new(); foreach (var item in subTaskList) { - BasMbomProcess basMbomProcess = await _db.Queryable().SingleAsync(x=>x.id==item.mbom_process_id); - List mbomProcessStationIds = JsonConvert.DeserializeObject(basMbomProcess.station).Select(x=>x[x.Length-1]).ToList(); + BasMbomProcess basMbomProcess = await _db.Queryable().SingleAsync(x => x.id == item.mbom_process_id); + List mbomProcessStationIds = JsonConvert.DeserializeObject(basMbomProcess.station).Select(x => x[x.Length - 1]).ToList(); List? resultList = workstationIds.Intersect(mbomProcessStationIds).ToList(); - + PrdMoTask subMoTask = new(); subMoTask.mo_id = input.mo_id; subMoTask.material_id = item.material_id; @@ -992,7 +975,7 @@ namespace Tnb.ProductionMgr subMoTask.create_id = _userManager.UserId; subMoTask.create_time = DateTime.Now; subMoTasks.Add(subMoTask); - + var subTaskLog = new PrdTaskLog(); var subMaterial = await _db.Queryable().SingleAsync(x => x.id == item.material_id); subTaskLog.id = SnowflakeIdHelper.NextId(); @@ -1089,7 +1072,7 @@ namespace Tnb.ProductionMgr // } } - + var taskReportLogs = new List(); var prdTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).ToListAsync(); @@ -1127,7 +1110,7 @@ namespace Tnb.ProductionMgr throw Oops.Bah("已开始的不能再开始"); } - if (item.mo_task_status!=DictConst.ToBeStartedEnCode && item.mo_task_status!=DictConst.MoStatusPauseCode) + if (item.mo_task_status != DictConst.ToBeStartedEnCode && item.mo_task_status != DictConst.MoStatusPauseCode) { throw Oops.Bah("状态错误无法开始"); } @@ -1137,7 +1120,7 @@ namespace Tnb.ProductionMgr { throw Oops.Bah("已暂停的不能再暂停"); } - if (item.mo_task_status!=DictConst.InProgressEnCode) + if (item.mo_task_status != DictConst.InProgressEnCode) { throw Oops.Bah("状态错误无法暂停"); } @@ -1147,7 +1130,7 @@ namespace Tnb.ProductionMgr { throw Oops.Bah("已完成的不能再完成"); } - if (item.mo_task_status!=DictConst.InProgressEnCode && item.mo_task_status!=DictConst.MoStatusPauseCode) + if (item.mo_task_status != DictConst.InProgressEnCode && item.mo_task_status != DictConst.MoStatusPauseCode) { throw Oops.Bah("状态错误无法完成"); } @@ -1160,7 +1143,7 @@ namespace Tnb.ProductionMgr break; } } - + prdTaskList.ForEach(x => x.mo_task_status = status); if (behavior == PrdTaskBehavior.Start) { @@ -1176,7 +1159,7 @@ namespace Tnb.ProductionMgr if (string.IsNullOrEmpty(item.parent_id)) continue; //子任务所有状态相同才修改父任务状态 int count1 = await db.Queryable().CountAsync(y => y.parent_id == item.parent_id); - int count2 = await db.Queryable().CountAsync(y => y.parent_id == item.parent_id && y.mo_task_status==status); + int count2 = await db.Queryable().CountAsync(y => y.parent_id == item.parent_id && y.mo_task_status == status); if (count1 == count2) { await db.Updateable().SetColumns(x => x.mo_task_status == status) @@ -1376,7 +1359,7 @@ namespace Tnb.ProductionMgr row = await db.Updateable(icmoItem).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); return (row > 0); } - + // /// // /// 生产提报 // /// @@ -1425,7 +1408,7 @@ namespace Tnb.ProductionMgr // } // return row > 0; // } - + /// /// 生产提报 /// @@ -1446,9 +1429,9 @@ namespace Tnb.ProductionMgr { var db = _repository.AsSugarClient(); var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); - var equip = await db.Queryable().SingleAsync(x=>x.id==prdMoTask.eqp_id); + var equip = await db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id); var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { var row = -1; var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); @@ -1467,9 +1450,9 @@ namespace Tnb.ProductionMgr var config2 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS_PERCENTAGE); if (!string.IsNullOrEmpty(config2?.value)) { - if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty*(100+Convert.ToDecimal(config2?.value ?? "1"))/100) + if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty * (100 + Convert.ToDecimal(config2?.value ?? "1")) / 100) { - throw Oops.Bah($"提报数量不能大于{100+Convert.ToDecimal(config2?.value ?? "0")}%排产数量"); + throw Oops.Bah($"提报数量不能大于{100 + Convert.ToDecimal(config2?.value ?? "0")}%排产数量"); } } } @@ -1500,7 +1483,7 @@ namespace Tnb.ProductionMgr report.material_id = prdMoTask.material_id; report.unit_id = prdMoTask.unit_id; report.process_id = mbomProcess?.process_id ?? ""; - + row = await db.Insertable(report).ExecuteCommandAsync(); #region 质检模块 @@ -1511,7 +1494,7 @@ namespace Tnb.ProductionMgr entity.workid = prdMoTask.workstation_id; var reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty; var scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty; - entity.oldpronum = reported+ scrap; + entity.oldpronum = reported + scrap; entity.newpronum = input.reported_qty; entity.triggerevent = EnumTriggerEvent.生产检定量; await _qcCheckPlanService.CreateTask(entity); @@ -1533,7 +1516,7 @@ namespace Tnb.ProductionMgr .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } - if (prdMoTask.schedule_type==1) + if (prdMoTask.schedule_type == 1) { if (prdMo.reported_work_qty == null) { @@ -1547,7 +1530,7 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); } - + if (prdMo.complete_qty == null) { await db.Updateable() @@ -1560,30 +1543,30 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); } - - PerProcessStandardsH processStandardsH = await db.Queryable() - .Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id && - x.output_material_id == prdMoTask.material_id && x.enabled == 1) - .OrderByDescending(x => x.create_time).FirstAsync(); - ToolMolds toolMolds = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mold_id); - if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null && - processStandardsH?.moulding_cycle > 0) + PerProcessStandardsH processStandardsH = await db.Queryable() + .Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id && + x.output_material_id == prdMoTask.material_id && x.enabled == 1) + .OrderByDescending(x => x.create_time).FirstAsync(); + + ToolMolds toolMolds = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mold_id); + if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null && + processStandardsH?.moulding_cycle > 0) + { + decimal? addTime = ((prdMoTask.scheduled_qty - input.reported_qty - (prdMoTask.scrap_qty ?? 0)) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; + if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { - decimal? addTime = ((prdMoTask.scheduled_qty-input.reported_qty-(prdMoTask.scrap_qty??0)) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; - if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) - { - DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); - await db.Updateable() - .SetColumns(x => x.plan_end_date == cal_plan_end_date) - .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - } + DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); + await db.Updateable() + .SetColumns(x => x.plan_end_date == cal_plan_end_date) + .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } + } } - if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id)) + if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id)) { - if (mbomProcess.is_last==1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id)) + if (mbomProcess.is_last == 1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id)) { var parentMoTask = await db.Queryable().SingleAsync(x => x.id == prdMoTask.parent_id); if (parentMoTask?.last_process_complete_qty == null) @@ -1592,14 +1575,15 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.last_process_complete_qty == input.reported_qty) // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) .Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync(); - }else if (parentMoTask?.last_process_complete_qty != null) + } + else if (parentMoTask?.last_process_complete_qty != null) { await db.Updateable() .SetColumns(x => x.last_process_complete_qty == x.last_process_complete_qty + input.reported_qty) // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) .Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync(); } - + if (prdMo.reported_work_qty == null) { await db.Updateable() @@ -1612,7 +1596,7 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); } - + if (prdMo.complete_qty == null) { await db.Updateable() @@ -1626,13 +1610,13 @@ namespace Tnb.ProductionMgr .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); } } - + var list = await db.Queryable() - .LeftJoin((a,b)=>a.process_id==b.process_id && b.enabled==1) - .Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync(); - + .LeftJoin((a, b) => a.process_id == b.process_id && b.enabled == 1) + .Where((a, b) => a.process_id == prdMoTask.process_id).Select((a, b) => b).ToListAsync(); + decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x); - decimal? addTime = (prdMoTask.scheduled_qty-input.reported_qty-(prdMoTask.scrap_qty??0)) * max; + decimal? addTime = (prdMoTask.scheduled_qty - input.reported_qty - (prdMoTask.scrap_qty ?? 0)) * max; if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); @@ -1641,7 +1625,7 @@ namespace Tnb.ProductionMgr .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } } - + var master = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); if (master != null) { @@ -1649,8 +1633,8 @@ namespace Tnb.ProductionMgr master.completed_qty += input.reported_qty; await db.Updateable(master).ExecuteCommandAsync(); } - - + + //扣除生产投料 按最先投入的依次扣除 // List prdFeedingDs = await db.Queryable() // .LeftJoin((a,b)=>a.id==b.feeding_id) @@ -1728,7 +1712,7 @@ namespace Tnb.ProductionMgr // } // } - + }); @@ -1745,7 +1729,7 @@ namespace Tnb.ProductionMgr if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess; } - + /// /// 自检报废提交 /// @@ -1779,7 +1763,7 @@ namespace Tnb.ProductionMgr { throw Oops.Bah("暂停的任务单无法报废"); } - + var result = await db.Ado.UseTranAsync(async () => { List destDefects = new(); @@ -1809,7 +1793,7 @@ namespace Tnb.ProductionMgr { #region 质检模块 //质检模块 - + TriggerPlanEntity entity = new TriggerPlanEntity(); entity.materialid = prdMoTask.material_id; entity.processid = prdMoTask.process_id; @@ -1831,7 +1815,7 @@ namespace Tnb.ProductionMgr } var reportMaster = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); - + if (prdMo.reported_work_qty == null) { await db.Updateable() @@ -1844,7 +1828,7 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.scrap_qty == x.scrap_qty + input.scrap_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); } - + if (prdMo.complete_qty == null) { await db.Updateable() @@ -1857,7 +1841,7 @@ namespace Tnb.ProductionMgr .SetColumns(x => x.complete_qty == x.complete_qty + input.scrap_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); } - + if (reportMaster != null) { reportMaster.completed_qty += input.scrap_qty; @@ -1875,7 +1859,7 @@ namespace Tnb.ProductionMgr if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null && processStandardsH?.moulding_cycle > 0) { - decimal? addTime = ((prdMoTask.scheduled_qty-prdMoTask.reported_work_qty-input.scrap_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; + decimal? addTime = ((prdMoTask.scheduled_qty - prdMoTask.reported_work_qty - input.scrap_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); @@ -1888,11 +1872,11 @@ namespace Tnb.ProductionMgr else { var list = await db.Queryable() - .LeftJoin((a,b)=>a.process_id==b.process_id && b.enabled==1) - .Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync(); - + .LeftJoin((a, b) => a.process_id == b.process_id && b.enabled == 1) + .Where((a, b) => a.process_id == prdMoTask.process_id).Select((a, b) => b).ToListAsync(); + decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x); - decimal? addTime = (prdMoTask.scheduled_qty-prdMoTask.reported_work_qty-input.scrap_qty) * max; + decimal? addTime = (prdMoTask.scheduled_qty - prdMoTask.reported_work_qty - input.scrap_qty) * max; if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); @@ -2052,7 +2036,7 @@ namespace Tnb.ProductionMgr // } // return data!; // } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); @@ -2063,7 +2047,7 @@ namespace Tnb.ProductionMgr List equipIds = new List(); if (!string.IsNullOrEmpty(eqpId)) { - worklineIds = await db.Queryable().Where(x => x.ParentId == eqpId && x.Category==DictConst.RegionCategoryWorklineCode && x.DeleteMark==null).Select(x=>x.Id).ToListAsync(); + worklineIds = await db.Queryable().Where(x => x.ParentId == eqpId && x.Category == DictConst.RegionCategoryWorklineCode && x.DeleteMark == null).Select(x => x.Id).ToListAsync(); equipIds = await db.Queryable().Where(x => x.equip_type_id == eqpId).Select(x => x.id).ToListAsync(); } @@ -2081,26 +2065,26 @@ namespace Tnb.ProductionMgr (a, b, c, d) => a.workline_id == eqpId || a.eqp_id == eqpId) .WhereIF(worklineIds.Count > 0, (a, b, c, d) => worklineIds.Contains(a.workline_id)) .WhereIF(equipIds.Count > 0, (a, b, c, d) => equipIds.Contains(a.eqp_id)) - .Where((a)=>a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_code==DictConst.ToBeScheduledEncode || a.mo_task_code==DictConst.MoStatusPauseCode) - .Select((a, b, c, d,e,f,g,h) => new WorkOrderAdjustmentListOutput + .Where((a) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_code == DictConst.ToBeScheduledEncode || a.mo_task_code == DictConst.MoStatusPauseCode) + .Select((a, b, c, d, e, f, g, h) => new WorkOrderAdjustmentListOutput { id = a.id, mo_task_code = a.mo_task_code, - material_id = b.code+"/"+b.name, + material_id = b.code + "/" + b.name, material_id_id = a.material_id, - mold_id = e.mold_code+"/"+e.mold_name, + mold_id = e.mold_code + "/" + e.mold_name, mold_id_id = a.mold_id, mo_task_status = d.FullName, plan_qty = f.plan_qty, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), scheduled_qty = a.scheduled_qty, - workline_id = a.workline_id==null ? "" :g.EnCode+"/"+g.FullName, + workline_id = a.workline_id == null ? "" : g.EnCode + "/" + g.FullName, workline_id_id = a.workline_id, - estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), - estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"), - eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name, + estimated_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + estimated_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"), + eqp_id = a.eqp_id == null ? "" : h.code + "/" + h.name, eqp_id_id = a.eqp_id, - create_time = a.create_time==null ? "" :a.create_time.Value.ToString(DbTimeFormat.SS) + create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS) }).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } @@ -2156,8 +2140,8 @@ namespace Tnb.ProductionMgr .OrderByDescending(x => x.create_time).FirstAsync(); ToolMolds toolMolds = await db.Queryable().SingleAsync(x => x.id == input.molds_id); - if(toolMolds==null) throw Oops.Bah("没找到模具"); - if(toolMolds?.mold_cavity<=0) throw Oops.Bah("模穴数错误"); + if (toolMolds == null) throw Oops.Bah("没找到模具"); + if (toolMolds?.mold_cavity <= 0) throw Oops.Bah("模穴数错误"); if (processStandardsH == null) throw Oops.Bah("工艺标准成型周期错误"); if (processStandardsH?.moulding_cycle <= 0) throw Oops.Bah("工艺标准成型周期错误"); @@ -2167,8 +2151,8 @@ namespace Tnb.ProductionMgr else { var list = await db.Queryable() - .LeftJoin((a,b)=>a.process_id==b.process_id && b.enabled==1) - .Where((a,b)=>a.mbom_id==input.mbom_id).Select((a,b)=>b).ToListAsync(); + .LeftJoin((a, b) => a.process_id == b.process_id && b.enabled == 1) + .Where((a, b) => a.mbom_id == input.mbom_id).Select((a, b) => b).ToListAsync(); decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x); decimal? addTime = input.scheduled_qty * max; @@ -2176,7 +2160,7 @@ namespace Tnb.ProductionMgr } } - + /// /// 获取这个产线生产中的任务单 @@ -2184,7 +2168,7 @@ namespace Tnb.ProductionMgr /// /// [HttpPost] - public async Task GetMoTaskByWorklineId(Dictionary dic) + public async Task GetMoTaskByWorklineId(Dictionary dic) { string id = dic["id"]; return await _repository.AsSugarClient().Queryable() @@ -2199,17 +2183,17 @@ namespace Tnb.ProductionMgr public async Task ChangeEquip(ChangeEquipInput input) { var db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); if (moTask.eqp_id == input.equip_id) { throw new Exception("与原机台相同"); } - + await db.Updateable().SetColumns(x => x.eqp_id == input.equip_id) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - + var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); @@ -2228,15 +2212,15 @@ namespace Tnb.ProductionMgr taskLog.mo_task_code = moTask.mo_task_code; taskLog.station_code = ""; taskLog.process_code = process?.code; - + await db.Insertable(taskLog).ExecuteCommandAsync(); }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "更换成功" : result.ErrorMessage; - + } - + /// /// 更换模具 /// @@ -2245,17 +2229,17 @@ namespace Tnb.ProductionMgr public async Task ChangeMold(ChangeMoldInput input) { var db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); if (moTask.mold_id == input.mold_id) { throw new Exception("与原模具相同"); } - + await db.Updateable().SetColumns(x => x.mold_id == input.mold_id) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - + var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); var mold = await db.Queryable().SingleAsync(x => x.id == input.mold_id); var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); @@ -2275,15 +2259,15 @@ namespace Tnb.ProductionMgr taskLog.mo_task_code = moTask.mo_task_code; taskLog.station_code = ""; taskLog.process_code = process?.code; - + await db.Insertable(taskLog).ExecuteCommandAsync(); }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "更换成功" : result.ErrorMessage; - + } - + /// /// 更换产线 /// @@ -2292,18 +2276,18 @@ namespace Tnb.ProductionMgr public async Task ChangeWorkline(ChangeWorklineInput input) { var db = _repository.AsSugarClient(); - DbResult result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); if (moTask.workline_id == input.workline_id) { throw new Exception("与原产线相同"); } - - + + await db.Updateable().SetColumns(x => x.workline_id == input.workline_id) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - + var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); @@ -2322,21 +2306,21 @@ namespace Tnb.ProductionMgr taskLog.mo_task_code = moTask.mo_task_code; taskLog.station_code = ""; taskLog.process_code = process?.code; - + await db.Insertable(taskLog).ExecuteCommandAsync(); }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "更换成功" : result.ErrorMessage; - + } - + /// /// 根据id获取任务单相关信息 /// /// [HttpPost] - public async Task GetPrdMoTaskInfoById(Dictionary dic) + public async Task GetPrdMoTaskInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; if (string.IsNullOrEmpty(id)) return null; @@ -2345,11 +2329,11 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) - .LeftJoin((a,b,c,d,e)=>e.EnCode==a.mo_task_status && e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId) - .LeftJoin((a,b,c,d,e,f)=>a.process_id==f.id) - .LeftJoin((a,b,c,d,e,f,g)=>a.workstation_id==g.Id) + .LeftJoin((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId) + .LeftJoin((a, b, c, d, e, f) => a.process_id == f.id) + .LeftJoin((a, b, c, d, e, f, g) => a.workstation_id == g.Id) .Where((a, b, c, d) => a.id == id) - .Select((a, b, c, d,e,f,g) => new + .Select((a, b, c, d, e, f, g) => new { id = a.id, mo_task_code = a.mo_task_code, @@ -2385,10 +2369,10 @@ namespace Tnb.ProductionMgr var db = _repository.AsSugarClient(); Dictionary result = new Dictionary(); var listRows = await db.Queryable() - .LeftJoin((a,b)=>a.equip_type_id==b.id) - .Where((a,b)=>b.code=="ZSJ" || b.code=="005") - .OrderBy((a,b)=>b.code) - .Select((a,b) => new + .LeftJoin((a, b) => a.equip_type_id == b.id) + .Where((a, b) => b.code == "ZSJ" || b.code == "005") + .OrderBy((a, b) => b.code) + .Select((a, b) => new { id = a.id, expanded = true, @@ -2396,21 +2380,21 @@ namespace Tnb.ProductionMgr parentId = "" }).ToListAsync(); - DateTime startTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1).AddDays(-15).ToString("yyyy-MM-dd 00:00:00")); - DateTime endTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1).AddMonths(1).AddDays(-1).AddDays(15).ToString("yyyy-MM-dd 23:59:59")); + DateTime startTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-15).ToString("yyyy-MM-dd 00:00:00")); + DateTime endTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1).AddDays(15).ToString("yyyy-MM-dd 23:59:59")); var charItems = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .LeftJoin((a,b,c)=>c.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==c.EnCode) + .LeftJoin((a, b, c) => c.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == c.EnCode) .Where((a, b) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.ToBeScheduledEncode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.InProgressEnCode) - .Where((a,b)=>a.schedule_type==1 && string.IsNullOrEmpty(a.parent_id)) - .Where((a,b)=>a.estimated_start_date!=null && a.estimated_end_date!=null) - .Where((a,b)=>a.estimated_start_date>=startTime && a.estimated_end_date<=endTime) - .Select((a, b,c) => new + .Where((a, b) => a.schedule_type == 1 && string.IsNullOrEmpty(a.parent_id)) + .Where((a, b) => a.estimated_start_date != null && a.estimated_end_date != null) + .Where((a, b) => a.estimated_start_date >= startTime && a.estimated_end_date <= endTime) + .Select((a, b, c) => new { id = a.id, label = b.name, material_name = b.name, - reported_work_qty = a.reported_work_qty==null ? 0 : a.reported_work_qty, + reported_work_qty = a.reported_work_qty == null ? 0 : a.reported_work_qty, scheduled_qty = a.scheduled_qty, mo_task_status = c.FullName, // label = b.name +" " +(a.reported_work_qty==null?0:a.reported_work_qty)+"/"+a.scheduled_qty + " " +c.FullName, @@ -2437,16 +2421,16 @@ namespace Tnb.ProductionMgr TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts3 = ts1.Subtract(ts2).Duration(); - - - result.Add("listRows",listRows); - result.Add("charItems",charItems); - result.Add("startTime",startTime); - result.Add("endTime",endTime); - result.Add("totalDays",ts3.TotalDays); + + + result.Add("listRows", listRows); + result.Add("charItems", charItems); + result.Add("startTime", startTime); + result.Add("endTime", endTime); + result.Add("totalDays", ts3.TotalDays); return result; } - + /// /// 获取组装包装生产排产甘特图信息 /// @@ -2457,31 +2441,31 @@ namespace Tnb.ProductionMgr var db = _repository.AsSugarClient(); Dictionary result = new Dictionary(); var listRows = await db.Queryable() - .Where(x => x.DeleteMark==null && (x.Category == DictConst.RegionCategoryWorklineCode || x.Category == DictConst.RegionCategoryWorkshopCode)) - .OrderByDescending(x=>x.Category) + .Where(x => x.DeleteMark == null && (x.Category == DictConst.RegionCategoryWorklineCode || x.Category == DictConst.RegionCategoryWorkshopCode)) + .OrderByDescending(x => x.Category) .Select(x => new { id = x.Id, expanded = true, label = x.FullName, - parentId = x.Category==DictConst.RegionCategoryWorklineCode ? x.ParentId : "" + parentId = x.Category == DictConst.RegionCategoryWorklineCode ? x.ParentId : "" }).ToListAsync(); - DateTime startTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1).AddDays(-15).ToString("yyyy-MM-dd 00:00:00")); - DateTime endTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year,DateTime.Now.Month,1).AddMonths(1).AddDays(-1).AddDays(15).ToString("yyyy-MM-dd 23:59:59")); + DateTime startTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddDays(-15).ToString("yyyy-MM-dd 00:00:00")); + DateTime endTime = Convert.ToDateTime(new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).AddMonths(1).AddDays(-1).AddDays(15).ToString("yyyy-MM-dd 23:59:59")); var charItems = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .LeftJoin((a,b,c)=>c.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==c.EnCode) + .LeftJoin((a, b, c) => c.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == c.EnCode) .Where((a, b) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.ToBeScheduledEncode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.InProgressEnCode) - .Where((a,b)=>a.schedule_type==2 && string.IsNullOrEmpty(a.parent_id)) - .Where((a,b)=>a.estimated_start_date!=null && a.estimated_end_date!=null) - .Where((a,b)=>a.estimated_start_date>=startTime && a.estimated_end_date<=endTime) - .Select((a, b,c) => new + .Where((a, b) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id)) + .Where((a, b) => a.estimated_start_date != null && a.estimated_end_date != null) + .Where((a, b) => a.estimated_start_date >= startTime && a.estimated_end_date <= endTime) + .Select((a, b, c) => new { id = a.id, label = b.name, material_name = b.name, - reported_work_qty = a.reported_work_qty==null ? 0 : a.reported_work_qty, + reported_work_qty = a.reported_work_qty == null ? 0 : a.reported_work_qty, scheduled_qty = a.scheduled_qty, mo_task_status = c.FullName, // label = b.name +" " +(a.reported_work_qty==null?0:a.reported_work_qty)+"/"+a.scheduled_qty + " " +c.FullName, @@ -2508,16 +2492,16 @@ namespace Tnb.ProductionMgr TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts3 = ts1.Subtract(ts2).Duration(); - - - result.Add("listRows",listRows); - result.Add("charItems",charItems); - result.Add("startTime",startTime); - result.Add("endTime",endTime); - result.Add("totalDays",ts3.TotalDays); + + + result.Add("listRows", listRows); + result.Add("charItems", charItems); + result.Add("startTime", startTime); + result.Add("endTime", endTime); + result.Add("totalDays", ts3.TotalDays); return result; } - + /// /// 保存注塑挤出生产排产甘特图信息 /// @@ -2530,37 +2514,37 @@ namespace Tnb.ProductionMgr { foreach (var item in input) { - + // if(await db.Queryable().Where(x=>x.Id==item.row_id && x.Category==DictConst.RegionCategoryWorkshopCode).AnyAsync()) // throw Oops.Bah("不能排在车间上"); var prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); if (prdMoTask.eqp_id != item.row_id) { await db.Updateable() - .SetColumns(x=>x.workline_id == item.row_id) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.workline_id == item.row_id) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } if (prdMoTask.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.start.Value.ToString("yyyy-MM-dd HH:mm")) { await db.Updateable() - .SetColumns(x=>x.estimated_start_date==item.time.start) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.estimated_start_date == item.time.start) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } - if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm")!=item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) + if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) { await db.Updateable() - .SetColumns(x=>x.estimated_end_date==item.time.end) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.estimated_end_date == item.time.end) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } } }); - if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "排产成功" : result.ErrorMessage; } - + /// /// 保存组装包装生产排产甘特图信息 /// @@ -2573,33 +2557,33 @@ namespace Tnb.ProductionMgr { foreach (var item in input) { - - if(await db.Queryable().Where(x=>x.Id==item.row_id && x.Category==DictConst.RegionCategoryWorkshopCode).AnyAsync()) + + if (await db.Queryable().Where(x => x.Id == item.row_id && x.Category == DictConst.RegionCategoryWorkshopCode).AnyAsync()) throw Oops.Bah("不能排在车间上"); var prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); if (prdMoTask.workline_id != item.row_id) { await db.Updateable() - .SetColumns(x=>x.workline_id == item.row_id) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.workline_id == item.row_id) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } if (prdMoTask.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.start.Value.ToString("yyyy-MM-dd HH:mm")) { await db.Updateable() - .SetColumns(x=>x.estimated_start_date==item.time.start) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.estimated_start_date == item.time.start) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } - if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm")!=item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) + if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) { await db.Updateable() - .SetColumns(x=>x.estimated_end_date==item.time.end) - .Where(x=>x.id==item.id).ExecuteCommandAsync(); + .SetColumns(x => x.estimated_end_date == item.time.end) + .Where(x => x.id == item.id).ExecuteCommandAsync(); } } }); - if(!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); + if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); return result.IsSuccess ? "排产成功" : result.ErrorMessage; } @@ -2612,19 +2596,19 @@ namespace Tnb.ProductionMgr public async Task GetMoTaskStatusNum() { return await _db.Queryable(). - LeftJoin((a,b)=>a.Id==b.DictionaryTypeId) - .LeftJoin((a,b,c)=>b.Id==c.mo_status) - .Where((a,b,c)=>a.EnCode==DictConst.MoTaskStatusCode) - .GroupBy((a,b,c)=>new { mo_status_code = b.EnCode,mo_status_name = b.FullName}) - .Select((a,b,c) => new + LeftJoin((a, b) => a.Id == b.DictionaryTypeId) + .LeftJoin((a, b, c) => b.Id == c.mo_status) + .Where((a, b, c) => a.EnCode == DictConst.MoTaskStatusCode) + .GroupBy((a, b, c) => new { mo_status_code = b.EnCode, mo_status_name = b.FullName }) + .Select((a, b, c) => new { mo_status_code = b.EnCode, mo_status_name = b.FullName, count = SqlFunc.AggregateCount(c.mo_status) }).ToListAsync(); } - - + + /// /// 获取备料计划 /// @@ -2661,8 +2645,8 @@ namespace Tnb.ProductionMgr var prdMoTaskList = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) - .Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now && (a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ToBeScheduledEncode || a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode)) - .Select((a,b)=>new MaterialPreparationPlanOutput() + .Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now && (a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ToBeScheduledEncode || a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode)) + .Select((a, b) => new MaterialPreparationPlanOutput() { mo_task_id = a.id, mo_task_code = a.mo_task_code, @@ -2679,7 +2663,7 @@ namespace Tnb.ProductionMgr { foreach (var itemChildChild in itemChild.children) { - if (itemChildChild.num > 0 && itemChild.rate_num != null && itemChild.rate_num>0) + if (itemChildChild.num > 0 && itemChild.rate_num != null && itemChild.rate_num > 0) { itemChildChild.num = item.num * itemChildChild.num / itemChild.rate_num; } @@ -2700,17 +2684,17 @@ namespace Tnb.ProductionMgr { string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : ""; if (string.IsNullOrEmpty(station_id)) throw Oops.Bah("工位错误"); - var prdMoTask = await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id!=null && x.mo_task_status==DictConst.InProgressEnCode).FirstAsync(); + var prdMoTask = await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id != null && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync(); if (prdMoTask != null) { BasMaterial basMaterial = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); prdMoTask.material_name = basMaterial.name; } - + return prdMoTask; } } - + } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index cdd4c2b0..dae8b582 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -16,8 +16,6 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using Spire.Pdf.Exporting.XPS.Schema; using SqlSugar; using Tnb.BasicData; using Tnb.BasicData.Entities; @@ -45,8 +43,8 @@ namespace Tnb.ProductionMgr private readonly IOrganizeService _organizeService; private readonly IUserManager _userManager; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - - public PrdOutstockService(ISqlSugarRepository repository, IOrganizeService organizeService,IRunService runService, IUserManager userManager,IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService) + + public PrdOutstockService(ISqlSugarRepository repository, IOrganizeService organizeService, IRunService runService, IUserManager userManager, IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService) { _db = repository.AsSugarClient(); _runService = runService; @@ -57,7 +55,7 @@ namespace Tnb.ProductionMgr _organizeService = organizeService; OverideFuncs.CreateAsync = Create; } - + private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) { try @@ -67,7 +65,7 @@ namespace Tnb.ProductionMgr MESCreateOutstockInput input = new MESCreateOutstockInput(); input.outstock = new MESWmsOutstockHInput(); input.outstockDs = new List(); - + string locationId = visualDevModelDataCrInput.data.ContainsKey("location_id") ? visualDevModelDataCrInput.data["location_id"].ToString() : ""; BasLocation location = await db.Queryable().SingleAsync(x => x.id == locationId); @@ -91,14 +89,14 @@ namespace Tnb.ProductionMgr // source_id = item.Value("source_id"), // }); // } - + input.outstockDs = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(visualDevModelDataCrInput.data["tablefield107"])); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; Dictionary header = new Dictionary() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK,JsonConvert.SerializeObject(input),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -119,7 +117,7 @@ namespace Tnb.ProductionMgr Log.Error(e.Message); throw Oops.Bah(e.Message); } - + } public async Task GeneralOutstock(GeneralOutstockInput generalOutstockInput) @@ -132,9 +130,9 @@ namespace Tnb.ProductionMgr MESCreateOutstockInput input = new MESCreateOutstockInput(); input.outstock = new MESWmsOutstockHInput(); input.outstockDs = new List(); - - PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x=>x.id==generalOutstockInput.mo_task_id); - BasLocation location = await db.Queryable().Where(x=>x.location_code==generalOutstockInput.location_code).FirstAsync(); + + PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == generalOutstockInput.mo_task_id); + BasLocation location = await db.Queryable().Where(x => x.location_code == generalOutstockInput.location_code).FirstAsync(); if (location == null) throw Oops.Bah("未找到库位"); string locationId = location.id; @@ -146,17 +144,17 @@ namespace Tnb.ProductionMgr input.outstock.create_id = _userManager.UserId; input.outstock.location_code = location?.location_code ?? ""; OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); - + List materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList(); - List basMaterials = await db.Queryable().Where(x=>materialIds.Contains(x.id)).ToListAsync(); - Dictionary unitIdDic = await db.Queryable() + List basMaterials = await db.Queryable().Where(x => materialIds.Contains(x.id)).ToListAsync(); + Dictionary unitIdDic = await db.Queryable() .LeftJoin((a, b) => b.EnCode == DictConst.MeasurementUnit) .LeftJoin((a, b, c) => b.Id == c.DictionaryTypeId && a.unit_id == c.EnCode) - .Where((a,b,c)=>materialIds.Contains(a.id)) - .Select((a, b, c) => new + .Where((a, b, c) => materialIds.Contains(a.id)) + .Select((a, b, c) => new { key = a.id, - value = c.Id + value = c.Id }) .ToDictionaryAsync(x => x.key, x => x.value); @@ -165,18 +163,18 @@ namespace Tnb.ProductionMgr input.outstockDs.Add(new MESWmsOutstockDInput() { material_id = item.material_id, - material_code = basMaterials.First(x=>x.id==item.material_id).code, + material_code = basMaterials.First(x => x.id == item.material_id).code, pr_qty = item.num, unit_id = unitIdDic[item.material_id].ToString() }); } - + string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; Dictionary header = new Dictionary() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK,JsonConvert.SerializeObject(input),header); + var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -202,16 +200,16 @@ namespace Tnb.ProductionMgr prdOutstockDs.Add(new PrdOutstockD() { material_id = item.material_id, - material_code = basMaterials.First(x=>x.id==item.material_id).code, - material_name = basMaterials.First(x=>x.id==item.material_id).name, + material_code = basMaterials.First(x => x.id == item.material_id).code, + material_name = basMaterials.First(x => x.id == item.material_id).name, pr_qty = item.num, unit_id = unitIdDic[item.material_id].ToString(), outstock_id = prdOutstockH.id, source_id = prdMoTask.mo_task_code }); } - - DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => + + DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { await _repository.InsertAsync(prdOutstockH); if (prdOutstockDs.Count > 0) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index f7751cfd..06455d94 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -15,8 +15,8 @@ using Tnb.EquipMgr.Entities; using Tnb.PerMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto.PrdManage; -using Tnb.ProductionMgr.Interfaces; using Tnb.ProductionMgr.Entities.Entity; +using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr @@ -53,7 +53,7 @@ namespace Tnb.ProductionMgr list = Array.Empty() }; } - + List trees = new(); var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); var list = await _db.Queryable().Where(it => it.Category == "workline").ToListAsync(); @@ -63,12 +63,12 @@ namespace Tnb.ProductionMgr _dicWorkLine = list.ToDictionary(x => x.Id, x => Tuple.Create(x.EnCode, x.FullName)); } bool start = false; - bool end=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; + start = true; startTimes[0] = GetDateTimeMilliseconds(input.estimated_start_date![0]); startTimes[1] = GetDateTimeMilliseconds(input.estimated_start_date![1]); @@ -83,14 +83,14 @@ namespace Tnb.ProductionMgr 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.id==d.parent_id) + .LeftJoin((a, b, c, d) => a.id == d.parent_id) .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim()) - // .WhereIF(start, a => a.estimated_start_date != null&& startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date) - // .WhereIF(end, a => a.estimated_end_date != null && endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date) + // .WhereIF(start, a => a.estimated_start_date != null&& startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date) + // .WhereIF(end, a => a.estimated_end_date != null && 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") - .Where((a,b,c,d)=>d.workstation_id==input.stationId) - .OrderByDescending(a=>a.create_time) + .Where((a, b, c, d) => d.workstation_id == input.stationId) + .OrderByDescending(a => a.create_time) .Select((a, b, c) => new PrdMoTask { id = a.id, @@ -107,9 +107,9 @@ namespace Tnb.ProductionMgr }) .ToPagedListAsync(input.currentPage, input.pageSize); if (start) - items.list= items.list.Where(a => startTimes[0] <= a.plan_start_date && startTimes[1] >= a.plan_start_date).ToList(); + items.list = items.list.Where(a => startTimes[0] <= a.plan_start_date && startTimes[1] >= a.plan_start_date).ToList(); if (end) - items.list= items.list.Where(a => endTimes[0] <= a.plan_end_date && endTimes[1] >= a.plan_end_date).ToList(); + items.list = items.list.Where(a => endTimes[0] <= a.plan_end_date && endTimes[1] >= a.plan_end_date).ToList(); _db.ThenMapper(items.list, it => { it.mo_task_status = it.mo_task_status.IsNotEmptyOrNull() && dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : ""; @@ -131,31 +131,31 @@ namespace Tnb.ProductionMgr } node.plan_start_date = item.plan_start_date.HasValue ? item.plan_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; node.plan_end_date = item.plan_end_date.HasValue ? item.plan_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; - await GetChild(item.id, trees, dic,input.stationId); + await GetChild(item.id, trees, dic, input.stationId); trees.Add(node); } } var treeList = trees.ToTree(); if (!string.IsNullOrEmpty(input.process)) { - List< PackReportTreeOutput > removelist = new List< PackReportTreeOutput >(); + List removelist = new List(); 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&& item.children.Count>0) + if (item.children != null && item.children.Count > 0) { - var childs = item.children.Adapt>(); + var childs = item.children.Adapt>(); if (childs.Where(p => p.process_id.Contains(input.process)).Any()) flag = true; } if (!flag) removelist.Add(item); - + } removelist.ForEach(p => treeList.Remove(p)); - + } SqlSugarPagedList pagedList = new() { @@ -179,13 +179,13 @@ namespace Tnb.ProductionMgr return dt; } - private async Task GetChild(string parentId, List nodes, Dictionary dic,string stationId) + private async Task GetChild(string parentId, List nodes, Dictionary dic, string stationId) { 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) - .Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled" && a.workstation_id==stationId) + .Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled" && a.workstation_id == stationId) .OrderBy((a, b, c, d) => d.ordinal) .Select((a, b, c) => new PrdMoTask { @@ -199,7 +199,7 @@ namespace Tnb.ProductionMgr plan_end_date = a.estimated_end_date, plan_qty = a.scheduled_qty, //complete_qty = SqlFunc.Subqueryable().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty), - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), mo_task_status = a.mo_task_status, }).ToListAsync(); @@ -217,7 +217,7 @@ namespace Tnb.ProductionMgr nsChild[i].process_id = $"{items[i].process_code}/{items[i].process_name}"; nsChild[i].plan_start_date = items[i].plan_start_date.HasValue ? items[i].plan_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; nsChild[i].plan_end_date = items[i].plan_end_date.HasValue ? items[i].plan_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : ""; - + if (nsChild[i].workline_id.IsNotEmptyOrNull()) { var workLine = _dicWorkLine.ContainsKey(nsChild[i].workline_id) ? (Tuple)_dicWorkLine[nsChild[i].workline_id] : null; @@ -231,11 +231,11 @@ namespace Tnb.ProductionMgr nodes.AddRange(nsChild); foreach (var item in items) { - await GetChild(item.id, nodes, dic,stationId); + await GetChild(item.id, nodes, dic, stationId); } } } - + /// /// pda端根据工位获取注塑挤出列表 /// @@ -251,16 +251,16 @@ namespace Tnb.ProductionMgr list = Array.Empty() }; } - + var result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) .LeftJoin((a, b, c, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode) - .LeftJoin((a,b,c,e,f)=>a.eqp_id==f.id) - .LeftJoin((a,b,c,e,f,g)=>a.mold_id==g.id) - .Where((a, b) => a.workstation_id == input.stationId && a.mo_task_status != DictConst.ToBeScheduledEncode && a.schedule_type==1) + .LeftJoin((a, b, c, e, f) => a.eqp_id == f.id) + .LeftJoin((a, b, c, e, f, g) => a.mold_id == g.id) + .Where((a, b) => a.workstation_id == input.stationId && a.mo_task_status != DictConst.ToBeScheduledEncode && a.schedule_type == 1) .OrderByDescending((a, b) => a.create_time) - .Select((a, b, c, e,f,g) => new PADPackageTaskPageOutput + .Select((a, b, c, e, f, g) => new PADPackageTaskPageOutput { id = a.id, mo_task_code = a.mo_task_code, @@ -272,12 +272,12 @@ namespace Tnb.ProductionMgr // workline_name = d.FullName, bom_id = a.bom_id, mo_task_status = e.FullName, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), scrap_qty = a.scrap_qty, scheduled_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, - estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS), - estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS), + estimated_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS), + estimated_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS), parent_id = a.parent_id, process_id = a.process_id, process_name = c.process_name, @@ -308,13 +308,13 @@ namespace Tnb.ProductionMgr list = Array.Empty() }; } - + var result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) .LeftJoin((a, b, c, d) => a.workline_id == d.Id) .LeftJoin((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode) - .Where((a, b) => a.workstation_id == input.stationId && a.mo_task_status != DictConst.ToBeScheduledEncode && a.schedule_type==2) + .Where((a, b) => a.workstation_id == input.stationId && a.mo_task_status != DictConst.ToBeScheduledEncode && a.schedule_type == 2) .OrderByDescending((a, b) => a.create_time) .Select((a, b, c, d, e) => new PADPackageTaskPageOutput { @@ -328,12 +328,12 @@ namespace Tnb.ProductionMgr workline_name = d.FullName, bom_id = a.bom_id, mo_task_status = e.FullName, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), scrap_qty = a.scrap_qty, scheduled_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, - estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS), - estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS), + estimated_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS), + estimated_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS), parent_id = a.parent_id, process_id = a.process_id, process_name = c.process_name, @@ -342,7 +342,7 @@ namespace Tnb.ProductionMgr return PageResult.SqlSugarPageResult(result); } - + /// /// pda端根据工位获取任务单列表 /// @@ -358,12 +358,12 @@ namespace Tnb.ProductionMgr list = Array.Empty() }; } - + Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>(); string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; - DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; - DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; + DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; + DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; List statusList = new List(); if (!string.IsNullOrEmpty(status)) { @@ -389,26 +389,26 @@ namespace Tnb.ProductionMgr input.sidx = "create_time"; input.sort = "desc"; } - + var result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) .LeftJoin((a, b, c, d) => a.workline_id == d.Id) .LeftJoin((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode) - .LeftJoin((a,b,c,d,e,f)=>a.eqp_id==f.id) - .LeftJoin((a,b,c,d,e,f,g)=>a.mold_id==g.id) - .LeftJoin((a,b,c,d,e,f,g,h)=>a.material_id==h.output_material_id && a.eqp_id==h.equip_id && a.mold_id==h.molds_id && h.enabled==1) - .LeftJoin((a,b,c,d,e,f,g,h,i)=>a.process_id==i.process_id && i.enabled==1) - .LeftJoin((a,b,c,d,e,f,g,h,i,j)=>a.mo_id==j.id) - .LeftJoin((a,b,c,d,e,f,g,h,i,j,k)=>a.material_id==k.material_id && k.auxiliary_unit_id=="kg") - .LeftJoin((a,b,c,d,e,f,g,h,i,j,k,l)=>a.eqp_id==l.equip_id && l.enabled==1 && l.label_point=="提报装箱称重点位") - .Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode) ) - .WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code)) + .LeftJoin((a, b, c, d, e, f) => a.eqp_id == f.id) + .LeftJoin((a, b, c, d, e, f, g) => a.mold_id == g.id) + .LeftJoin((a, b, c, d, e, f, g, h) => a.material_id == h.output_material_id && a.eqp_id == h.equip_id && a.mold_id == h.molds_id && h.enabled == 1) + .LeftJoin((a, b, c, d, e, f, g, h, i) => a.process_id == i.process_id && i.enabled == 1) + .LeftJoin((a, b, c, d, e, f, g, h, i, j) => a.mo_id == j.id) + .LeftJoin((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg") + .LeftJoin((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_point == "提报装箱称重点位") + .Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode)) + .WhereIF(!string.IsNullOrEmpty(mo_task_code), a => a.mo_task_code.Contains(mo_task_code)) //.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status) - .WhereIF(statusList.Count>0,a=>statusList.Contains(a.mo_task_status)) - .WhereIF(status=="3" && start_time!=null,a=>a.act_end_date>=start_time) - .WhereIF(status=="3" && end_time!=null,a=>a.act_end_date<=end_time) - .Select((a, b, c, d, e,f,g,h,i,j,k,l) => new PADPackageTaskPageOutput + .WhereIF(statusList.Count > 0, a => statusList.Contains(a.mo_task_status)) + .WhereIF(status == "3" && start_time != null, a => a.act_end_date >= start_time) + .WhereIF(status == "3" && end_time != null, a => a.act_end_date <= end_time) + .Select((a, b, c, d, e, f, g, h, i, j, k, l) => new PADPackageTaskPageOutput { id = a.id, mo_task_code = a.mo_task_code, @@ -421,12 +421,12 @@ namespace Tnb.ProductionMgr workline_name = d.FullName, bom_id = a.bom_id, mo_task_status = e.FullName, - complete_qty = SqlFunc.IsNull(a.reported_work_qty,0) + SqlFunc.IsNull(a.scrap_qty,0), + complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0), scrap_qty = a.scrap_qty, scheduled_qty = a.scheduled_qty, reported_work_qty = a.reported_work_qty, - estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS), - estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS), + estimated_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS), + estimated_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS), parent_id = a.parent_id, process_id = a.process_id, process_name = c.process_name, @@ -442,9 +442,9 @@ namespace Tnb.ProductionMgr mold_cavity = g.mold_cavity, moulding_cycle = h.moulding_cycle, standard_time = i.standard_time, - act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS), - act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS), - plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString(DbTimeFormat.SS), + act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS), + act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS), + plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString(DbTimeFormat.SS), tube = f.tube, minpacking = b.minpacking, main_num = k.number_of_primary_unit, @@ -457,7 +457,7 @@ namespace Tnb.ProductionMgr .ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); - + } /// @@ -468,8 +468,8 @@ namespace Tnb.ProductionMgr public async Task CheckMold(CheckMoldInput input) { PrdMoTask prdMoTask = await _db.Queryable().SingleAsync(x => x.id == input.mo_task_id); - BasQrcode basQrcode = await _db.Queryable().Where(x=>x.source_name=="TOOL_MOLDS" && x.code==input.mold_qrcode).FirstAsync(); - if (prdMoTask != null && basQrcode!=null) + BasQrcode basQrcode = await _db.Queryable().Where(x => x.source_name == "TOOL_MOLDS" && x.code == input.mold_qrcode).FirstAsync(); + if (prdMoTask != null && basQrcode != null) { return prdMoTask.mold_id == basQrcode.source_id; } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs index 62eee87e..931cf10c 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs @@ -1,35 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using COSXML.Model.Tag; -using JNPF.Common.Core.Manager; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; -using NPOI.Util; -using SqlSugar; -using Tnb.BasicData.Entities; -using Tnb.EquipMgr.Entities; -using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Interfaces; -using Aspose.Cells.Drawing; -using Microsoft.AspNetCore.Mvc; -using DbModels; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Security; -using Tnb.ProductionMgr.Entities.Dto.PrdManage; -using NPOI.OpenXmlFormats; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; +using SqlSugar; using Tnb.BasicData; +using Tnb.BasicData.Entities; +using Tnb.EquipMgr.Entities; +using Tnb.ProductionMgr.Entities; +using Tnb.ProductionMgr.Entities.Dto.PrdManage; +using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr { @@ -113,13 +102,13 @@ namespace Tnb.ProductionMgr // } // return data!; // } - + private async Task GetList(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); - string moTaskCode = queryJson!=null && queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; - string stationId = queryJson!=null && queryJson.ContainsKey("stationId") ? queryJson["stationId"].ToString() : ""; + string moTaskCode = queryJson != null && queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; + string stationId = queryJson != null && queryJson.ContainsKey("stationId") ? queryJson["stationId"].ToString() : ""; if (string.IsNullOrEmpty(stationId)) { @@ -129,52 +118,52 @@ namespace Tnb.ProductionMgr list = Array.Empty() }; } - + Dictionary dic = await _dictionaryDataService.GetDicByKey(DictConst.TaskStatus); - + DateTime[] planStartDateArr = null; DateTime[] planEndDateArr = null; if (queryJson.TryGetValue("plan_start_date", out var value1)) { - planStartDateArr = value1.ToObject().Select(x=>x.TimeStampToDateTime()).ToArray(); + planStartDateArr = value1.ToObject().Select(x => x.TimeStampToDateTime()).ToArray(); } if (queryJson.TryGetValue("plan_end_date", out var value2)) { - planEndDateArr = value2.ToObject().Select(x=>x.TimeStampToDateTime()).ToArray(); + planEndDateArr = value2.ToObject().Select(x => x.TimeStampToDateTime()).ToArray(); } - - + + var result = await db.Queryable() .LeftJoin((a, b) => a.eqp_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .LeftJoin((a, b, c, d) => a.mold_id == d.id) - .Where((a,b,c,d)=>(a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode || a.mo_task_status==DictConst.MoStatusExceptionCode || a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ComplatedEnCode)) - .Where((a,b,c,d)=>a.schedule_type==1) - .WhereIF(!string.IsNullOrEmpty(moTaskCode),(a,b,c,d)=>a.mo_task_code.Contains(moTaskCode)) - .WhereIF(planStartDateArr!=null, (a, b, c, d) => a.estimated_start_date>=planStartDateArr[0] && a.estimated_start_date<=planStartDateArr[1]) - .WhereIF(planEndDateArr!=null, (a, b, c, d) => a.estimated_end_date>=planEndDateArr[0] && a.estimated_end_date<=planEndDateArr[1]) - .Where((a,b,c,d)=>a.workstation_id==stationId) + .Where((a, b, c, d) => (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)) + .Where((a, b, c, d) => a.schedule_type == 1) + .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode)) + .WhereIF(planStartDateArr != null, (a, b, c, d) => a.estimated_start_date >= planStartDateArr[0] && a.estimated_start_date <= planStartDateArr[1]) + .WhereIF(planEndDateArr != null, (a, b, c, d) => a.estimated_end_date >= planEndDateArr[0] && a.estimated_end_date <= planEndDateArr[1]) + .Where((a, b, c, d) => a.workstation_id == stationId) .OrderByDescending((a, b, c, d) => a.create_time) .Select((a, b, c, d) => new PrdTaskManageListOutput() { id = a.id, mo_task_code = a.mo_task_code, - material_id = c.code+"/"+c.name, - mold_id = d.mold_code+"/"+d.mold_name, - eqp_id = b.code+"/"+b.name, - plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), - plan_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"), + material_id = c.code + "/" + c.name, + mold_id = d.mold_code + "/" + d.mold_name, + eqp_id = b.code + "/" + b.name, + plan_start_date = a.estimated_start_date == null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.estimated_end_date == null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"), plan_qty = a.scheduled_qty, complete_qty = a.reported_work_qty, mo_task_status = a.mo_task_status, schedule_type = a.schedule_type.ToString(), }) - .Mapper(x=>x.mo_task_status=dic[x.mo_task_status].ToString()) + .Mapper(x => x.mo_task_status = dic[x.mo_task_status].ToString()) .ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } - - + + // /// // /// 根据任务单号获取提报记录明细 // /// @@ -249,8 +238,8 @@ namespace Tnb.ProductionMgr // // return prdTask; // } - - + + /// /// 根据任务单号获取提报记录明细 /// @@ -270,14 +259,14 @@ namespace Tnb.ProductionMgr var db = _repository.AsSugarClient(); var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); var prdTask = await db.Queryable() - .LeftJoin((a,b)=>a.material_id==b.id) - .LeftJoin((a,b,c)=>a.mold_id==c.id) - .LeftJoin((a,b,c,d)=>a.eqp_id==d.id) - .LeftJoin((a,b,c,d,e)=>e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId && a.mo_task_status==e.EnCode) - .LeftJoin((a,b,c,d,e,f)=>a.workline_id==f.Id) - .LeftJoin((a,b,c,d,e,f,g)=>a.process_id==g.id) - .Where((a,b) => a.mo_task_code == mo_task_code) - .Select((a,b,c,d,e,f,g) => new + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a, b, c) => a.mold_id == c.id) + .LeftJoin((a, b, c, d) => a.eqp_id == d.id) + .LeftJoin((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode) + .LeftJoin((a, b, c, d, e, f) => a.workline_id == f.Id) + .LeftJoin((a, b, c, d, e, f, g) => a.process_id == g.id) + .Where((a, b) => a.mo_task_code == mo_task_code) + .Select((a, b, c, d, e, f, g) => new { id = a.id, mo_task_code = a.mo_task_code, diff --git a/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs index 6ebdb3ce..21fdb00c 100644 --- a/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs @@ -1,31 +1,21 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.VisualDev; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Mvc; -using SqlSugar; -using Tnb.BasicData.Entities; -using Tnb.ProductionMgr.Entities; -using Tnb.ProductionMgr.Interfaces; -using JNPF.Systems.Interfaces.System; -using Tnb.BasicData; -using JNPF.Common.Extension; -using JNPF.Common.Filter; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using SqlSugar; +using Tnb.BasicData; +using Tnb.ProductionMgr.Entities; using Tnb.ProductionMgr.Entities.Dto; +using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr { @@ -85,7 +75,7 @@ namespace Tnb.ProductionMgr // //} // return data!; // } - + private async Task GetList(VisualDevModelListQueryInput input) { @@ -100,11 +90,11 @@ namespace Tnb.ProductionMgr } var db = _repository.AsSugarClient(); var result = await db.Queryable() - .LeftJoin((a,b)=>a.mo_task_type==b.Id) - .LeftJoin((a,b,c)=>a.status==c.EnCode) - .LeftJoin((a,b,c,d)=>a.mo_task_id==d.id) - .WhereIF(!string.IsNullOrEmpty(moTaskCode),(a,b,c)=>a.mo_task_code.Contains(moTaskCode)) - .Select((a,b,c,d)=>new ReportRecordListOutput + .LeftJoin((a, b) => a.mo_task_type == b.Id) + .LeftJoin((a, b, c) => a.status == c.EnCode) + .LeftJoin((a, b, c, d) => a.mo_task_id == d.id) + .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c) => a.mo_task_code.Contains(moTaskCode)) + .Select((a, b, c, d) => new ReportRecordListOutput { id = a.id, masterial_code = a.masterial_code, @@ -113,27 +103,27 @@ namespace Tnb.ProductionMgr mo_task_id = a.mo_task_code, mo_task_id_id = a.mo_task_id, mo_task_type = b.FullName, - plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-mm-dd"), - plan_start_date = a.plan_start_date==null ? "" : a.plan_start_date.Value.ToString("yyyy-mm-dd"), + plan_end_date = a.plan_end_date == null ? "" : a.plan_end_date.Value.ToString("yyyy-mm-dd"), + plan_start_date = a.plan_start_date == null ? "" : a.plan_start_date.Value.ToString("yyyy-mm-dd"), plan_qty = d.scheduled_qty, reported_work_qty = a.reported_work_qty, - completed_qty = SqlFunc.IsNull(d.reported_work_qty,0) + SqlFunc.IsNull(d.scrap_qty,0), + completed_qty = SqlFunc.IsNull(d.reported_work_qty, 0) + SqlFunc.IsNull(d.scrap_qty, 0), status = c.FullName, tablefield107 = SqlFunc.Subqueryable() - .LeftJoin((x,y)=>x.create_id==y.Id) - .Where(x=>x.mo_task_code==a.mo_task_code).ToList((x,y)=>new ReportRecordListChildrenOutput - { - reported_qty = x.reported_qty, - create_id = y.RealName, - create_id_id = x.create_id, - create_time = x.create_time==null ? "" : x.create_time.Value.ToString(DbTimeFormat.MM), - batch = x.barcode - }) + .LeftJoin((x, y) => x.create_id == y.Id) + .Where(x => x.mo_task_code == a.mo_task_code).ToList((x, y) => new ReportRecordListChildrenOutput + { + reported_qty = x.reported_qty, + create_id = y.RealName, + create_id_id = x.create_id, + create_time = x.create_time == null ? "" : x.create_time.Value.ToString(DbTimeFormat.MM), + batch = x.barcode + }) }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } - private async Task AddRecord(string id,VisualDevModelDataUpInput input) + private async Task AddRecord(string id, VisualDevModelDataUpInput input) { var db = _repository.AsSugarClient(); var result = await db.Ado.UseTranAsync(async () => @@ -147,7 +137,7 @@ namespace Tnb.ProductionMgr { mo_task_id = input.data["mo_task_id"]?.ToString(), mo_task_code = input.data["mo_task_code"]?.ToString(), - reported_qty = item["reported_qty"]!=null ? (int)item["reported_qty"] : 0, + reported_qty = item["reported_qty"] != null ? (int)item["reported_qty"] : 0, create_id = item["create_id"]?.ToString(), create_time = DateTime.Now, }); diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 0d5cb241..2d8b55a1 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -1,17 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Cache; +using JNPF.Common.Cache; using Microsoft.Extensions.Hosting; -using Newtonsoft.Json.Linq; using Newtonsoft.Json; -using UAParser; -using Tnb.ProductionMgr.Interfaces; +using Newtonsoft.Json.Linq; using Tnb.ProductionMgr.Entities.Dto; -using JNPF.ClayObject.Extensions; using Tnb.ProductionMgr.Entities.Enums; +using Tnb.ProductionMgr.Interfaces; namespace Tnb.ProductionMgr { @@ -100,7 +93,7 @@ namespace Tnb.ProductionMgr { if (res.Value("Value")) { - // + // } } } @@ -113,8 +106,8 @@ namespace Tnb.ProductionMgr } public Task StartAsync(CancellationToken cancellationToken) { - // packtimer = new Timer(GetPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); - // limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); + // packtimer = new Timer(GetPackStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); + // limittimer = new Timer(GetLimitStatus, null, TimeSpan.Zero, TimeSpan.FromSeconds(2)); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs index 8f4836f5..dbbe2981 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs @@ -1,13 +1,8 @@ -using System.Collections; -using JNPF.Common.Cache; -using JNPF.Common.Extension; -using JNPF.Common.Manager; +using JNPF.Common.Cache; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using JNPF.TaskScheduler; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Options; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Tnb.ProductionMgr.Interfaces; @@ -19,13 +14,13 @@ namespace Tnb.ProductionMgr /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] - public class RedisDataService: IRedisDataService, IDynamicApiController, ITransient + public class RedisDataService : IRedisDataService, IDynamicApiController, ITransient { private readonly RedisCache _redisCache; public RedisDataService(RedisCache redisCache) { _redisCache = redisCache; - + } /// /// 根据机号获取重量 @@ -33,23 +28,23 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetWeight(string device, string jihao) { - /* - var dic =await _redisCache.HGetAll("TY4C-JICHU"); - string a = ""; - foreach (var kvp in dic) - { - a += kvp.Key + "&" + kvp.Value + "$"; - } + /* + var dic =await _redisCache.HGetAll("TY4C-JICHU"); + string a = ""; + foreach (var kvp in dic) + { + a += kvp.Key + "&" + kvp.Value + "$"; + } - string aa = ""; - var ss= aa.Split('$', StringSplitOptions.RemoveEmptyEntries); - foreach (var s in ss) - { - var b = s.Split('&'); - await _redisCache.HSet("TY4C-JICHU", b[0], b[1]); - }*/ - + string aa = ""; + var ss= aa.Split('$', StringSplitOptions.RemoveEmptyEntries); + foreach (var s in ss) + { + var b = s.Split('&'); + await _redisCache.HSet("TY4C-JICHU", b[0], b[1]); + }*/ + decimal result = 0; bool flag = await _redisCache.HashExist(device, jihao); if (!flag) diff --git a/ProductionMgr/Tnb.ProductionMgr/Tnb.ProductionMgr.csproj b/ProductionMgr/Tnb.ProductionMgr/Tnb.ProductionMgr.csproj index c8532136..fde22e81 100644 --- a/ProductionMgr/Tnb.ProductionMgr/Tnb.ProductionMgr.csproj +++ b/ProductionMgr/Tnb.ProductionMgr/Tnb.ProductionMgr.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs b/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs index 32fa0cee..daa990cc 100644 --- a/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells; -using DingTalk.Api.Request; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -68,7 +61,7 @@ namespace Tnb.ProductionMgr var dic = new Dictionary { {"id",item.EqpId }, - { "mold_id", item.id} + { "mold_id", item.id} }; var row2 = await db.Updateable(dic).AS("eqp_equipment") .WhereColumns("id"). diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs index 7c4c1096..44c005ac 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItem.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.QcMgr.Entities +namespace Tnb.QcMgr.Entities { public class CheckItemOut { diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs index c6c9b706..ad5417ac 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckItems.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.QcMgr.Entities +namespace Tnb.QcMgr.Entities { public class CheckItemsInput { @@ -56,9 +50,10 @@ namespace Tnb.QcMgr.Entities public string? itemdid { get; set; } public Show? setShow { get; set; } public Data? setData { get; set; } - + } - public class Show { + public class Show + { public bool extype { get; set; } public bool excontent { get; set; } public bool check { get; set; } @@ -69,7 +64,8 @@ namespace Tnb.QcMgr.Entities public bool customer { get; set; } public bool isexec { get; set; } } - public class Data { + public class Data + { public string? extype { get; set; } public Excontent? excontent { get; set; } public string? check { get; set; } diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs index 7849ddde..00ad7332 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckPlan.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.QcMgr.Entities +namespace Tnb.QcMgr.Entities { public class CheckPlanInput { diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs index 23982478..ffc907f0 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTask.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.QcMgr.Entities +namespace Tnb.QcMgr.Entities { public class QcCheckExecHOut { @@ -84,8 +78,8 @@ namespace Tnb.QcMgr.Entities public IsexecE? isexec { get; set; } } public class Excontent - { - public string? excontentType { get; set; } + { + public string? excontentType { get; set; } public string? excontentNum { get; set; } public string? amongMaxNum { get; set; } public string? amongMinNum { get; set; } @@ -130,7 +124,7 @@ namespace Tnb.QcMgr.Entities } public class ExecItemInput { - public string? itemdid { get; set; } + public string? itemdid { get; set; } public string? itemid { get; set; } public string? code { get; set; } public string? name { get; set; } diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTaskData.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTaskData.cs index 0683b82b..555e4193 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTaskData.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/CheckTaskData.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.QcMgr.Entities +namespace Tnb.QcMgr.Entities { public class CheckTaskData { public string? checktype { get; set; } - + public string? materialid { get; set; } public string? processid { get; set; } public string? workid { get; set; } diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/SpcData.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/SpcData.cs index d9b3bf7b..cfc2c9e5 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/SpcData.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/SpcData.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Spire.Xls.Core.Spreadsheet.Charts; - -namespace Tnb.QcMgr.Entities +namespace Tnb.QcMgr.Entities { public class SpcDataInput { diff --git a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs index 42983040..ff4126df 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Dto/Trigger.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using NPOI.SS.Formula.PTG; -using Tnb.QcMgr.Entities.Enums; +using Tnb.QcMgr.Entities.Enums; namespace Tnb.QcMgr.Entities { @@ -13,7 +7,7 @@ namespace Tnb.QcMgr.Entities public string? id { get; set; } public string? name { get; set; } public string? code { get; set; } - public string? type { get; set; } + public string? type { get; set; } public string? cycle { get; set; } public string[]? trievent { get; set; } public string[]? trieventid { get; set; } diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSampleCode.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSampleCode.cs index 40291e15..827a84fc 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSampleCode.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSampleCode.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSamplePlan.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSamplePlan.cs index a17387ae..0f62c634 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSamplePlan.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcAqlSamplePlan.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecD.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecD.cs index c793007a..b15ec47c 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecD.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecD.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecH.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecH.cs index 8107f4c3..6b40831b 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecH.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckExecH.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs index 2d5aa266..3a886f64 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItem.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs index f90e3bcb..ac1c588b 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsD.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs index b6472209..9cf0df71 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsH.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs index 0266db63..70f0ee22 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckItemsR.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanAdd.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanAdd.cs index 9cbba68d..86c0d7d4 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanAdd.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanAdd.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs index f21854a9..208c9639 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanD.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; @@ -25,7 +20,7 @@ namespace Tnb.QcMgr.Entities.Entity /// 质检方案主表编号 /// public string? mainid { get; set; } - + /// /// 执行项格式 /// diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs index f3ea5cd6..fa738eda 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanH.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanMaterial.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanMaterial.cs index a93cf8ed..65adc0b6 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanMaterial.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanMaterial.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanProcess.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanProcess.cs index 7712d68f..8cfaeece 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanProcess.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanProcess.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanWork.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanWork.cs index c38b862a..fba3e678 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanWork.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckPlanWork.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs index 49266496..7a6e877d 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcCheckType.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorCause.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorCause.cs index 8391c1d6..8eb72689 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorCause.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorCause.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorLevel.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorLevel.cs index eec0e3a7..ddbe3cda 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorLevel.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcErrorLevel.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcConfig.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcConfig.cs index 4cf90a08..3ef1690c 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcConfig.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcConfig.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcD.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcD.cs index ec893256..c5f5ecbb 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcD.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcD.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcH.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcH.cs index 2a81b63e..b43a564e 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcH.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcSpcH.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerEvent.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerEvent.cs index 4f71db19..e0cfb20c 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerEvent.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerEvent.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerPlan.cs b/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerPlan.cs index 5eadc716..80060688 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerPlan.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Entity/QcTriggerPlan.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/QcMgr/Tnb.QcMgr.Entities/Enums/EnumTriggerType.cs b/QcMgr/Tnb.QcMgr.Entities/Enums/EnumTriggerType.cs index c6d5ccc8..33a749e2 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Enums/EnumTriggerType.cs +++ b/QcMgr/Tnb.QcMgr.Entities/Enums/EnumTriggerType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; namespace Tnb.QcMgr.Entities.Enums { diff --git a/QcMgr/Tnb.QcMgr.Entities/Tnb.QcMgr.Entities.csproj b/QcMgr/Tnb.QcMgr.Entities/Tnb.QcMgr.Entities.csproj index edabb960..bd191439 100644 --- a/QcMgr/Tnb.QcMgr.Entities/Tnb.QcMgr.Entities.csproj +++ b/QcMgr/Tnb.QcMgr.Entities/Tnb.QcMgr.Entities.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs index 3f2544ec..d08914d0 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckItemService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities; namespace Tnb.QcMgr.Interfaces { diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs index c48775a2..1041014a 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckPlanService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities; namespace Tnb.QcMgr.Interfaces { @@ -22,7 +17,7 @@ namespace Tnb.QcMgr.Interfaces /// /// public Task GetCheckItems(string id); - + /// /// 获取触发计划清单 /// diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTaskService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTaskService.cs index 5eb82b69..be27c8dc 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTaskService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities; namespace Tnb.QcMgr.Interfaces { diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs index 75c5ae9b..0e8403ef 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcCheckTypeService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.QcMgr.Entities; - -namespace Tnb.QcMgr.Interfaces +namespace Tnb.QcMgr.Interfaces { public interface IQcCheckTypeService { diff --git a/QcMgr/Tnb.QcMgr.Interfaces/IQcSpcService.cs b/QcMgr/Tnb.QcMgr.Interfaces/IQcSpcService.cs index 77097e46..736c726a 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/IQcSpcService.cs +++ b/QcMgr/Tnb.QcMgr.Interfaces/IQcSpcService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.QcMgr.Entities; +using Tnb.QcMgr.Entities; namespace Tnb.QcMgr.Interfaces { diff --git a/QcMgr/Tnb.QcMgr.Interfaces/Tnb.QcMgr.Interfaces.csproj b/QcMgr/Tnb.QcMgr.Interfaces/Tnb.QcMgr.Interfaces.csproj index c2786e35..83334969 100644 --- a/QcMgr/Tnb.QcMgr.Interfaces/Tnb.QcMgr.Interfaces.csproj +++ b/QcMgr/Tnb.QcMgr.Interfaces/Tnb.QcMgr.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs index fea60fdb..615aa824 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs @@ -1,26 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using COSXML.Model.Tag; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.JsonSerialization; using JNPF.VisualDev; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; -using NPOI.SS.Formula.Eval; -using NPOI.Util; using SqlSugar; -using Tnb.Common; using Tnb.QcMgr.Entities; using Tnb.QcMgr.Interfaces; @@ -48,8 +35,8 @@ namespace Tnb.QcMgr private async Task Delete(string id) { var db = _repository.AsSugarClient(); - var QcCheckItemsH=await db.Queryable< QcCheckItemsH >().Where(p=>p.id==id).FirstAsync(); - var QcCheckItemsRs = await db.Queryable().Where(p => p.itemshid == id).ToListAsync() ; + var QcCheckItemsH = await db.Queryable().Where(p => p.id == id).FirstAsync(); + var QcCheckItemsRs = await db.Queryable().Where(p => p.itemshid == id).ToListAsync(); var QcCheckItemsDs = await db.Queryable().Where(p => QcCheckItemsRs.Select(p => p.itemsdid).ToList().Contains(p.id)).ToListAsync(); await db.Ado.BeginTranAsync(); await db.Deleteable(QcCheckItemsH).ExecuteCommandAsync(); @@ -243,7 +230,7 @@ namespace Tnb.QcMgr await db.Ado.CommitTranAsync(); } catch (Exception) - { + { await db.Ado.RollbackTranAsync(); throw Oops.Oh(ErrorCode.COM1000); } diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs index 0793142c..ae2f83f8 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs @@ -1,14 +1,4 @@ -using System; -using System.ArrayExtensions; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using COSXML.Model.Tag; -using JNPF.Common.Contracts; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.DependencyInjection; @@ -21,10 +11,7 @@ using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; using JNPF.TaskScheduler.Entitys.Model; using JNPF.VisualDev; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; using SqlSugar; -using Tnb.ProductionMgr.Entities; -using Tnb.QcMgr.Entities; using Tnb.QcMgr.Entities; using Tnb.QcMgr.Entities.Entity; using Tnb.QcMgr.Entities.Enums; @@ -142,13 +129,13 @@ namespace Tnb.QcMgr Item.setShow.isexec = false; } else - { - if(!Item.setData.isexec.attachment&& !Item.setData.isexec.remark) + { + if (!Item.setData.isexec.attachment && !Item.setData.isexec.remark) Item.setShow.isexec = false; - else + else Item.setShow.isexec = true; } - + CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First()?.items?.Add(Item); } } diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs index b6544561..7a49684f 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; +using System.Linq.Expressions; using JNPF.Common.Core.Manager; using JNPF.Common.Filter; using JNPF.DependencyInjection; @@ -15,7 +9,6 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; -using NPOI.SS.Formula.Functions; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.QcMgr.Entities; @@ -42,7 +35,7 @@ namespace Tnb.QcMgr private async Task GetListAsync(VisualDevModelListQueryInput input) { var db = _repository.AsSugarClient(); - Dictionary dic= new Dictionary(); + Dictionary dic = new Dictionary(); dic.Add("ok", "合格"); dic.Add("no", "不合格"); dic.Add("barelyok", "让步合格"); @@ -55,7 +48,7 @@ namespace Tnb.QcMgr var list = await db.Queryable() .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); - var BasLocations= await db.Queryable().ToListAsync(); + var BasLocations = await db.Queryable().ToListAsync(); var result = await db.Queryable() .LeftJoin((a, b) => a.materialid == b.id) .LeftJoin((a, b, c) => a.processid == c.id) @@ -79,13 +72,13 @@ namespace Tnb.QcMgr tasktime = a.tasktime == null ? "" : a.tasktime, exectime = a.exectime == null ? "" : a.exectime, execuser = e.RealName == null ? "" : e.RealName, - }).OrderByDescending(a =>DateTime.Parse( a.exectime)).ToPagedListAsync(input.currentPage, input.pageSize); + }).OrderByDescending(a => DateTime.Parse(a.exectime)).ToPagedListAsync(input.currentPage, input.pageSize); foreach (var item in result.list) { item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; item.result = dic.Where(p => p.Key == item.result).Any() ? dic.Where(p => p.Key == item.result).First().Value : ""; - item.wareid = BasLocations.Where(p => p.id == item.wareid).Any() ? BasLocations.Where(p => p.id == item.wareid).First().location_code: ""; + item.wareid = BasLocations.Where(p => p.id == item.wareid).Any() ? BasLocations.Where(p => p.id == item.wareid).First().location_code : ""; } return PageResult.SqlSugarPageResult(result); } @@ -125,7 +118,7 @@ namespace Tnb.QcMgr .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid) .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype) .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status) - // .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id) + // .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "已完成").First().Id) .Select((a, b, c, d, e) => new QcCheckExecHOut { id = a.id, @@ -141,7 +134,7 @@ namespace Tnb.QcMgr exectime = a.exectime == null ? "" : a.exectime, execuser = e.RealName == null ? "" : e.RealName, }).OrderByDescending(expression).ToPagedListAsync(input.currentPage, input.pageSize); - + foreach (var item in result.list) { item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs index 7582e695..1f1201d1 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; -using JNPF.Common.Enums; +using JNPF.Common.Core.Manager; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; @@ -17,21 +9,12 @@ using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.BasicData; -using Tnb.EquipMgr.Entities; -using Tnb.ProductionMgr.Entities.Dto; -using Tnb.ProductionMgr.Entities; using Tnb.QcMgr.Entities; -using Tnb.QcMgr.Entities; -using Tnb.QcMgr.Entities.Entity; using Tnb.QcMgr.Interfaces; -using JNPF.Common.Extension; -using Microsoft.AspNetCore.Authorization; namespace Tnb.QcMgr { @@ -79,7 +62,7 @@ namespace Tnb.QcMgr .WhereIF(!string.IsNullOrEmpty(materialid), (a, b, c, d, e) => a.materialid == materialid) .WhereIF(!string.IsNullOrEmpty(checktype), (a, b, c, d, e) => a.checktype == checktype) .WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status) - .Where((a,b,c,d,e)=>a.status== list.Where(p=>p.FullName=="待执行").First().Id) + .Where((a, b, c, d, e) => a.status == list.Where(p => p.FullName == "待执行").First().Id) .Select((a, b, c, d, e) => new QcCheckExecHOut { id = a.id, @@ -145,7 +128,7 @@ namespace Tnb.QcMgr Item.name = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().name!; Item.setData = new ExecItemData(); Item.setData.extype = QcCheckExecD.extype!; - Item.setData.excontent = JSON.Deserialize(QcCheckExecD.excontent!); + Item.setData.excontent = JSON.Deserialize(QcCheckExecD.excontent!); Item.setData.check = QcCheckExecD.check!; if (!string.IsNullOrEmpty(QcCheckExecD.errorcause)) { @@ -174,7 +157,7 @@ namespace Tnb.QcMgr Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype); Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent); Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check); - Item.setShow.errorcause = Item.setData.errorcause==null|| Item.setData.errorcause?.Count == 0 ? false : true; + Item.setShow.errorcause = Item.setData.errorcause == null || Item.setData.errorcause?.Count == 0 ? false : true; Item.setShow.errorlevel = Item.setData.errorlevel == null || Item.setData.errorlevel?.Count == 0 ? false : true; Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark); Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); @@ -197,8 +180,8 @@ namespace Tnb.QcMgr try { var QcCheckExecH = await db.Queryable().Where(p => p.id == CheckTaskInput.mainid).FirstAsync(); - var DictionaryType = await db.Queryable().Where(p=>p.FullName== "质检状态").FirstAsync(); - var DictionaryData = await db.Queryable< DictionaryDataEntity >().Where(p => p.DictionaryTypeId==DictionaryType.Id&&p.FullName== "已完成").FirstAsync(); + var DictionaryType = await db.Queryable().Where(p => p.FullName == "质检状态").FirstAsync(); + var DictionaryData = await db.Queryable().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "已完成").FirstAsync(); QcCheckExecH.checknum = CheckTaskInput.checknum; QcCheckExecH.status = DictionaryData.Id; QcCheckExecH.result = CheckTaskInput.result; @@ -209,7 +192,7 @@ namespace Tnb.QcMgr var QcCheckExecDinsert = new List(); if (CheckTaskInput.checktypes?.Count > 0) { - for (int i=0;i< CheckTaskInput.checktypes.Count;i++) + for (int i = 0; i < CheckTaskInput.checktypes.Count; i++) { if (CheckTaskInput.checktypes[i].Count > 0) { @@ -285,10 +268,10 @@ namespace Tnb.QcMgr Result.status = QcCheckExecH.status!; Result.checktypes = new List>(); Result.result = QcCheckExecH.result; - var groupkeys = QcCheckExecDs.Select(p=>p.checkindex).Distinct().ToList(); + var groupkeys = QcCheckExecDs.Select(p => p.checkindex).Distinct().ToList(); foreach (var key in groupkeys) - { - var QcCheckExecDsbykey= QcCheckExecDs.Where(p=>p.checkindex==key).ToList(); + { + var QcCheckExecDsbykey = QcCheckExecDs.Where(p => p.checkindex == key).ToList(); var checktype = new List(); foreach (var QcCheckExecD in QcCheckExecDsbykey) { @@ -349,7 +332,7 @@ namespace Tnb.QcMgr } Result.checktypes.Add(checktype); } - + return Result; } diff --git a/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs b/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs index ac18a64f..bff674e9 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs @@ -1,24 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Mvc; -using NPOI.Util; using SqlSugar; -using Tnb.QcMgr.Interfaces; using Tnb.QcMgr.Entities; -using Microsoft.AspNetCore.Identity; -using JNPF.Systems.Entitys.Permission; +using Tnb.QcMgr.Interfaces; namespace Tnb.QcMgr { diff --git a/QcMgr/Tnb.QcMgr/QcSpcService.cs b/QcMgr/Tnb.QcMgr/QcSpcService.cs index 70a74eb1..44099ebb 100644 --- a/QcMgr/Tnb.QcMgr/QcSpcService.cs +++ b/QcMgr/Tnb.QcMgr/QcSpcService.cs @@ -1,25 +1,15 @@ -using System; -using System.ArrayExtensions; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Spire.Xls.Core; using SqlSugar; using Tnb.QcMgr.Entities; -using Tnb.QcMgr.Entities.Entity; using Tnb.QcMgr.Interfaces; namespace Tnb.QcMgr -{ +{ /// /// spc模块 /// @@ -41,15 +31,15 @@ namespace Tnb.QcMgr [HttpPost] public async Task GetSpcItems(string id) { - var datas= await _repository.AsSugarClient().Queryable().Where(p => p.mainid == id).ToListAsync(); - List SpcDataInputs=new List(); + var datas = await _repository.AsSugarClient().Queryable().Where(p => p.mainid == id).ToListAsync(); + List SpcDataInputs = new List(); datas.ForEach(p => { SpcDataInput SpcDataInput = new SpcDataInput(); SpcDataInput.mainid = p.mainid; SpcDataInput.checktime = p.checktime; SpcDataInput.batch = p.batch; - SpcDataInput.data = Array.ConvertAll(p.data!.Split(","),float.Parse); + SpcDataInput.data = Array.ConvertAll(p.data!.Split(","), float.Parse); SpcDataInput.checknum = p.checknum; SpcDataInput.defectivenum = p.defectivenum; SpcDataInputs.Add(SpcDataInput); @@ -74,7 +64,7 @@ namespace Tnb.QcMgr SpcDataInput.ForEach(p => { - QcSpcD QcSpcD=new QcSpcD(); + QcSpcD QcSpcD = new QcSpcD(); QcSpcD.mainid = p.mainid; QcSpcD.checktime = p.checktime; QcSpcD.batch = p.batch; @@ -82,7 +72,7 @@ namespace Tnb.QcMgr QcSpcD.checknum = p.checknum; QcSpcD.defectivenum = p.defectivenum; QcSpcD.create_id = _userManager.UserId; - QcSpcD.create_time=DateTime.Now; + QcSpcD.create_time = DateTime.Now; QcSpcDs.Add(QcSpcD); }); await db.Ado.BeginTranAsync(); @@ -371,8 +361,8 @@ namespace Tnb.QcMgr private static float CalculateMovRange(IEnumerable values) { List floats = new List(); - var arr=values.ToArray(); - for (int i = 0; i < arr.Length-1; i++) + var arr = values.ToArray(); + for (int i = 0; i < arr.Length - 1; i++) { floats.Add(Math.Abs((arr[i + 1] - arr[i]))); } @@ -380,6 +370,6 @@ namespace Tnb.QcMgr } - + } } diff --git a/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj b/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj index 518e6220..612c4841 100644 --- a/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj +++ b/QcMgr/Tnb.QcMgr/Tnb.QcMgr.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/Tnb.Server.sln b/Tnb.Server.sln index 1b62b7aa..e21e89b9 100644 --- a/Tnb.Server.sln +++ b/Tnb.Server.sln @@ -15,14 +15,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "05-WorkFlow", "05-WorkFlow" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "06-VisualDev", "06-VisualDev", "{161853F8-ADB9-4281-B706-E2E23D40D0F1}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "08-Extend", "08-Extend", "{A5AB62A9-B65A-4348-BC4A-60EF67FC1B9D}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "07-App", "07-App", "{80FA1E47-5DA6-4688-A033-F867B0FA6F22}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "解决方案项", "解决方案项", "{7876D0A1-7141-4904-8A3B-88DF61BEE7EE}" ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig - common.props = common.props Directory.Build.props = Directory.Build.props dotnet.ruleset = dotnet.ruleset global.json = global.json @@ -81,12 +78,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Systems.Interfaces", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.API.Entry", "apihost\Tnb.API.Entry\Tnb.API.Entry.csproj", "{DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Extend", "extend\Tnb.Extend\Tnb.Extend.csproj", "{0282541C-4295-4A2A-A826-54E9C69718D9}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Extend.Entitys", "extend\Tnb.Extend.Entitys\Tnb.Extend.Entitys.csproj", "{08A36D02-DC53-4895-9E1C-E02BC1BBA890}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.Extend.Interfaces", "extend\Tnb.Extend.Interfaces\Tnb.Extend.Interfaces.csproj", "{2E9F8B23-37B9-42BD-A62F-140A38C43A89}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tnb.SqlSugar", "common\Tnb.SqlSugar\Tnb.SqlSugar.csproj", "{E600E59F-18EE-4DBC-8298-BEF4307F69D9}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "11-BasicData", "11-BasicData", "{52B19E13-6B04-444C-A38A-B9955B199A98}" @@ -296,24 +287,6 @@ Global {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.Release|Any CPU.Build.0 = Release|Any CPU {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.ActiveCfg = Debug|Any CPU {DB646C4B-D6FB-44CB-A8F6-C0F6AA83AB8A}.tianyi|Any CPU.Build.0 = Debug|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.Release|Any CPU.Build.0 = Release|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.ActiveCfg = Debug|Any CPU - {0282541C-4295-4A2A-A826-54E9C69718D9}.tianyi|Any CPU.Build.0 = Debug|Any CPU - {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Debug|Any CPU.Build.0 = Debug|Any CPU - {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Release|Any CPU.ActiveCfg = Release|Any CPU - {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.Release|Any CPU.Build.0 = Release|Any CPU - {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.tianyi|Any CPU.ActiveCfg = tianyi|Any CPU - {08A36D02-DC53-4895-9E1C-E02BC1BBA890}.tianyi|Any CPU.Build.0 = tianyi|Any CPU - {2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Debug|Any CPU.Build.0 = Debug|Any CPU - {2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Release|Any CPU.ActiveCfg = Release|Any CPU - {2E9F8B23-37B9-42BD-A62F-140A38C43A89}.Release|Any CPU.Build.0 = Release|Any CPU - {2E9F8B23-37B9-42BD-A62F-140A38C43A89}.tianyi|Any CPU.ActiveCfg = tianyi|Any CPU - {2E9F8B23-37B9-42BD-A62F-140A38C43A89}.tianyi|Any CPU.Build.0 = tianyi|Any CPU {E600E59F-18EE-4DBC-8298-BEF4307F69D9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E600E59F-18EE-4DBC-8298-BEF4307F69D9}.Debug|Any CPU.Build.0 = Debug|Any CPU {E600E59F-18EE-4DBC-8298-BEF4307F69D9}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -455,9 +428,6 @@ Global {4062FBA9-7EBD-4B5E-A2EA-9BA0B96119A3} = {C617010A-DDB0-4C64-8706-5B9732AEC034} {1C97CF6C-B2DE-4261-824C-C2DE99307CCE} = {C617010A-DDB0-4C64-8706-5B9732AEC034} {6ACA8115-4403-4E04-8B4C-A409E0F0B289} = {C617010A-DDB0-4C64-8706-5B9732AEC034} - {0282541C-4295-4A2A-A826-54E9C69718D9} = {A5AB62A9-B65A-4348-BC4A-60EF67FC1B9D} - {08A36D02-DC53-4895-9E1C-E02BC1BBA890} = {A5AB62A9-B65A-4348-BC4A-60EF67FC1B9D} - {2E9F8B23-37B9-42BD-A62F-140A38C43A89} = {A5AB62A9-B65A-4348-BC4A-60EF67FC1B9D} {E600E59F-18EE-4DBC-8298-BEF4307F69D9} = {E4872924-2348-4E06-881A-08625ED98E9F} {FB41DBE3-4537-47AB-B248-7F6BDC1FC4B3} = {D90E2789-189A-4F05-B081-27F2FABB2E7E} {85E36D25-ACF8-4560-AD3F-05288B1ADD84} = {D90E2789-189A-4F05-B081-27F2FABB2E7E} diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs index 46153ecd..957bcac0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/CallerAttribute.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Attributes +namespace Tnb.WarehouseMgr.Entities.Attributes { [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] public class CallerAttribute : Attribute diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/RelationalFieldAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/RelationalFieldAttribute.cs index 4434e42b..f91882a5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/RelationalFieldAttribute.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/RelationalFieldAttribute.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Attributes +namespace Tnb.WarehouseMgr.Entities.Attributes { [AttributeUsage(AttributeTargets.Property)] diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs index 0224145f..5461e351 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/ServiceModuleAttribute.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Attributes +namespace Tnb.WarehouseMgr.Entities.Attributes { /// /// 业务类型模块特性 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/TimedAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/TimedAttribute.cs index 1b8edfd3..62cf3806 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/TimedAttribute.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Attributes/TimedAttribute.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Attributes +namespace Tnb.WarehouseMgr.Entities.Attributes { /// ///定时任务特性 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/AgvRequestConfig.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/AgvRequestConfig.cs index ac28e5aa..903932cf 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/AgvRequestConfig.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/AgvRequestConfig.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Configs +namespace Tnb.WarehouseMgr.Entities.Configs { public class AgvRequestConfig { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs index e9cc09d3..07ec571e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Configs/ElevatorControlConfiguration.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Configs +namespace Tnb.WarehouseMgr.Entities.Configs { public class ElevatorControlConfiguration { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs index 7cff5b42..1a440145 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/ElevatorConsts.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Consts +namespace Tnb.WarehouseMgr.Entities.Consts { public class ElevatorConsts { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/GenericEnumDicionary.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/GenericEnumDicionary.cs index c8183b00..cc514be2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/GenericEnumDicionary.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/GenericEnumDicionary.cs @@ -1,14 +1,7 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; +using System.Collections.Concurrent; using System.ComponentModel; -using System.Linq; using System.Reflection; -using System.Text; -using System.Threading.Tasks; using JNPF.Common.Extension; -using Spire.Pdf.Widget; -using Tnb.WarehouseMgr.Entities.Enums; namespace Tnb.WarehouseMgr.Entities.Consts { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsCarryConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsCarryConst.cs index df345851..4500944d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsCarryConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsCarryConst.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Consts +namespace Tnb.WarehouseMgr.Entities.Consts { public class WmsCarryConst { @@ -12,7 +6,7 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// 载具更换EnCode业务编码 /// public const string WMS_CARRY_REPLACE_ENCODE = "WmsCarryReplace"; - - + + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index f29e9c0a..0dc16b62 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -1,12 +1,4 @@ -using System; -using System.CodeDom; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Org.BouncyCastle.Asn1.Mozilla; - -namespace Tnb.WarehouseMgr.Entities.Consts +namespace Tnb.WarehouseMgr.Entities.Consts { public class WmsWareHouseConst { @@ -57,7 +49,7 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// 入库申请生成Encode /// public const string WMS_INSTOCK_ENCODE = "WmsInStock"; - + /// /// 任务执行ENCODE /// @@ -235,7 +227,7 @@ namespace Tnb.WarehouseMgr.Entities.Consts /// /// 打印状态-打印完成 /// - public const string PRINT_STATUS_PRINTCOMPLETE= "26191372853541"; + public const string PRINT_STATUS_PRINTCOMPLETE = "26191372853541"; /// /// 同步状态-无需同步 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodePrintInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodePrintInput.cs index 32c63039..f47f84de 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodePrintInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/BarCodePrintInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 条码打印输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs index 2eac52e8..35e56f0d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ChainStatusReportingUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 创建任务链输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ConfirmInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ConfirmInput.cs index 9a5329fc..63db30c1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ConfirmInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ConfirmInput.cs @@ -1,6 +1,4 @@ -using Tnb.WarehouseMgr.Entities.Enums; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { public class ConfirmInput { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ExChangeCarryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ExChangeCarryInput.cs index 542665fa..1ff3c380 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ExChangeCarryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ExChangeCarryInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 更换载具输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/GenPreTaskUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/GenPreTaskUpInput.cs index e705315c..e89398ff 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/GenPreTaskUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/GenPreTaskUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 生成预任务成功后输入参数 @@ -22,7 +16,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto /// /// 载具id集合 /// - public List? CarryIds { get; set; } + public List? CarryIds { get; set; } /// /// 载具Code /// @@ -50,7 +44,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto /// /// 预任务条码记录 /// - public List PreTaskHandleCodes { get; set; }=new List(); + public List PreTaskHandleCodes { get; set; } = new List(); /// /// 是否检验 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs index 3f1de637..3bbc7b41 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/InOutStockApplyforUpInput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Enums; +using Tnb.WarehouseMgr.Entities.Enums; namespace Tnb.WarehouseMgr.Entities.Dto { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryInput.cs index 4215b2fc..04800d45 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES载具查询接口输入 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryResultInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryResultInput.cs index 668a580c..b155ac15 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryResultInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarryQueryResultInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES载具查询返回接口输入 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarrySignInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarrySignInput.cs index c4e4bac6..bee2b79f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarrySignInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCarrySignInput.cs @@ -12,7 +12,7 @@ /// /// 载具Id /// - public string carry_code { get; set;} + public string carry_code { get; set; } /// /// 创建热Id /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs index 26ea874e..203f2eba 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Filter; +using JNPF.Common.Filter; namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateInstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateInstockInput.cs index 665a9b9f..d887b273 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateInstockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateInstockInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES入库输入 @@ -50,7 +44,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 来源单据ID /// - public string source_id { get; set; } + public string source_id { get; set; } /// /// 来源单据代码 @@ -65,19 +59,19 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 载具编号 /// - public string carry_code { get; set; } + public string carry_code { get; set; } /// /// 库位编号 /// - public string location_code { get; set; } + public string location_code { get; set; } /// /// 未检验:0,已检验:1 /// - public int is_check { get; set; } + public int is_check { get; set; } } - public class MESWmsInstockDInput + public class MESWmsInstockDInput { /// @@ -98,12 +92,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 入库需求数量 /// - public decimal pr_qty { get; set; } + public decimal pr_qty { get; set; } /// /// 批次 /// - public string code_batch { get; set; } + public string code_batch { get; set; } } @@ -137,6 +131,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 批次 /// - public string code_batch { get; set; } + public string code_batch { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateOutstockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateOutstockInput.cs index 8c6e913c..b56f6fef 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateOutstockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCreateOutstockInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES出库输入 @@ -14,15 +8,15 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 生产出库主表 /// - public MESWmsOutstockHInput outstock { get; set; } + public MESWmsOutstockHInput outstock { get; set; } /// /// 生产出库明细表 /// - public List outstockDs { get; set; } + public List outstockDs { get; set; } } public class MESWmsOutstockHInput { - + /// /// 所属组织ID /// @@ -98,5 +92,5 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// public string source_id { get; set; } } - + } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryInStockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryInStockInput.cs index 1c4d5452..2a766905 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryInStockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryInStockInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES空载具入库输入 @@ -14,22 +8,22 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 组织ID /// - public string org_id { get; set; } + public string org_id { get; set; } /// /// 库位编号 /// - public string location_code { get; set; } + public string location_code { get; set; } /// /// 载具编号 /// - public string carry_code { get; set; } + public string carry_code { get; set; } /// /// 创建用户 /// - public string create_id { get; set; } + public string create_id { get; set; } /// /// 入库仓库 /// - public string warehouse_id { get; set; } + public string warehouse_id { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryOutStkInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryOutStkInput.cs index f1393044..1e9fe062 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryOutStkInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESEmptyCarryOutStkInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES空载具出库输入 @@ -25,20 +19,20 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 创建用户 /// - public string create_id { get; set; } + public string create_id { get; set; } /// /// 入库仓库 /// - public string warehouse_id { get; set; } + public string warehouse_id { get; set; } /// /// 载具规格编号 /// - public string carrystd_id { get; set; } + public string carrystd_id { get; set; } /// /// 数量 /// - public int qty { get; set; } + public int qty { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESKittingOutStkInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESKittingOutStkInput.cs index c93af439..1c26eade 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESKittingOutStkInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESKittingOutStkInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// MES齐套出库输入类 @@ -14,7 +8,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 所属组织ID /// - public string org_id { get; set; } + public string org_id { get; set; } /// /// 出库单创建日期 @@ -49,22 +43,22 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 载具编号 /// - public string carry_code { get; set; } + public string carry_code { get; set; } /// /// 产品ID /// - public string material_id { get; set; } + public string material_id { get; set; } /// /// 产品编号 /// - public string material_code { get; set; } + public string material_code { get; set; } /// /// 齐套搭配方案ID /// - public string collocation_scheme_id { get; set; } + public string collocation_scheme_id { get; set; } /// /// 齐套搭配方案编号 @@ -74,7 +68,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 来源单据ID /// - public string source_id { get; set; } + public string source_id { get; set; } /// /// 来源单据号 @@ -84,12 +78,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 创建用户ID /// - public string create_id { get; set; } + public string create_id { get; set; } /// /// MES齐套出库明细表输入 /// - public List wmsKittingoutDs { get; set; } + public List wmsKittingoutDs { get; set; } } /// @@ -107,33 +101,33 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// /// 单位编号 /// - public string unit_code { get; set; } + public string unit_code { get; set; } /// /// 产品ID /// - public string material_id { get; set; } + public string material_id { get; set; } /// /// 产品编号 /// - public string material_code { get; set; } + public string material_code { get; set; } /// /// 批次 /// - public string code_batch { get; set; } + public string code_batch { get; set; } /// /// 数量(件数) /// - public decimal pr_qty { get; set; } + public decimal pr_qty { get; set; } /// /// 箱数 /// - public int box { get; set; } + public int box { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ModifyPoliciesStatusInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ModifyPoliciesStatusInput.cs index 7f4098f8..4e5b9d31 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ModifyPoliciesStatusInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/ModifyPoliciesStatusInput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Enums; +using Tnb.WarehouseMgr.Entities.Enums; namespace Tnb.WarehouseMgr.Entities.Dto { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/NotifyMessage.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/NotifyMessage.cs index 0e4362e2..9bb2e1bd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/NotifyMessage.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/NotifyMessage.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 通知消息类 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs index a4ae81bf..c62f798d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/RobotCallBackInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 机器人回调操作输入参数s diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SacnBarCodeInStockInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SacnBarCodeInStockInput.cs index f27031ce..c4821726 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SacnBarCodeInStockInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SacnBarCodeInStockInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 扫码入库输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs index 6ab920ac..09eb503d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/SignForDeliveryInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 出库签收输入参数 @@ -19,7 +13,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs /// 载具ID /// public string carryId { get; set; } - public string carry_code { get; set; } + public string carry_code { get; set; } public string new_carry_code { get; set; } @@ -31,5 +25,5 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs public List distaskCodes { get; set; } } - + } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCallBackInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCallBackInput.cs index 81ad0a54..99b13e57 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCallBackInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCallBackInput.cs @@ -1,6 +1,4 @@ -using Tnb.WarehouseMgr.Entities.Enums; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { public class TaskCallBackInput { @@ -28,7 +26,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto /// 取货/放货 /// public string action { get; set; } - + } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskChainCallBackInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskChainCallBackInput.cs index 5eb90d34..0afb4b8c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskChainCallBackInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskChainCallBackInput.cs @@ -1,6 +1,4 @@ -using Tnb.WarehouseMgr.Entities.Enums; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { public class TaskChainCallBackInput { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs index a9a09e06..d3dad8e0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskCompleUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 任务完成输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs index ccf2943c..56e013ba 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteAfterUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 任务执行取操作输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteUpInput.cs index 496364b5..bd726fdd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TaskExecuteUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { /// /// 任务执行输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TimedtaskInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TimedtaskInput.cs index 398d08b8..dad15518 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TimedtaskInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/TimedtaskInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Inputs +namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { public class TimedtaskInput { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs index fa48bda3..0eba2328 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/WareHouseUpInput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 库房业务更新输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryCodeDetailOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryCodeDetailOutput.cs index 41dec7d9..23538105 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryCodeDetailOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryCodeDetailOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 载具条码明细输出类 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryInfoOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryInfoOutput.cs index 279ad345..4a49a883 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryInfoOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryInfoOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Outputs +namespace Tnb.WarehouseMgr.Entities.Dto.Outputs { /// /// 载具信息输出类 @@ -128,7 +122,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 载具明细列表 /// - public List carryDetails { get; set; }=new List(); + public List carryDetails { get; set; } = new List(); /// /// 载具条码列表 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryQueryOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryQueryOutput.cs index 787e5351..988f8a0b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryQueryOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CarryQueryOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Outputs +namespace Tnb.WarehouseMgr.Entities.Dto.Outputs { /// /// 载具查询输出类 @@ -47,7 +41,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 来源单据ID /// - public string? source_id { get; set; } + public string? source_id { get; set; } /// /// 打包号 @@ -88,7 +82,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 载具查询明细输出类 /// - public class CarryCodeQueryOutput + public class CarryCodeQueryOutput { /// /// 主键ID @@ -161,7 +155,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// 单位代码 /// public string unit_code { get; set; } = string.Empty; - + /// /// 仓库ID /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs index 64ee7215..f85e388b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Org.BouncyCastle.Asn1.Mozilla; -using SqlSugar; +using Newtonsoft.Json; namespace Tnb.WarehouseMgr.Entities.Dto.Outputs { @@ -70,7 +63,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 齐套明细Json /// - public string CollocationSchemeDsJson { get; set; }=string.Empty; + public string CollocationSchemeDsJson { get; set; } = string.Empty; [JsonIgnore] public List? list { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs index f2602191..3a1520fb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/InStockDetailOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 入库单据物料明细信息 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs index 556560e8..908efcc0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/MaterailLabelOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto.Outputs +namespace Tnb.WarehouseMgr.Entities.Dto.Outputs { /// /// 物料标签查询返回结果 @@ -22,7 +16,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 批次 /// - public string code_batch { get; set;} + public string code_batch { get; set; } /// /// 采购单号 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs index de687a8b..3186ed6a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/OutStockDetailOutput.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 出库库单据物料明细信息 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs index 7e3012bd..1a247c43 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/Result.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Enums; +using JNPF.Common.Enums; namespace Tnb.WarehouseMgr.Entities.Dto.Outputs { @@ -27,6 +22,6 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// public object data { get; set; } - + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InOutStockDetailQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InOutStockDetailQuery.cs index 2a931b06..ce2fe3cf 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InOutStockDetailQuery.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InOutStockDetailQuery.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Enums; +using Tnb.WarehouseMgr.Entities.Enums; namespace Tnb.WarehouseMgr.Entities.Dto { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs index 54064105..2d17ead3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/InStockStrategyQuery.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { /// /// 入库策略输入参数 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs index 96cc6a27..79031d9a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/MaterialLabelQuery.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Filter; -using Microsoft.AspNetCore.Mvc.RazorPages; +using JNPF.Common.Filter; namespace Tnb.WarehouseMgr.Entities.Dto.Queries { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs index 879a02f1..cd4df518 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Queries/OutStockStrategyQuery.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Dto +namespace Tnb.WarehouseMgr.Entities.Dto { public class OutStockStrategyQuery { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockCode.cs index 8ace46ca..affe63ee 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockCode.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockCode.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities +namespace Tnb.WarehouseMgr.Entities { public interface IInOutStockCode { string bill_d_id { get; set; } - + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockDetail.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockDetail.cs index 5869a54f..ca775bf6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockDetail.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IInOutStockDetail.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; namespace Tnb.WarehouseMgr.Entities { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/ITaskManagerDel.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/ITaskManagerDel.cs index 021221fc..89eb6faa 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/ITaskManagerDel.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/ITaskManagerDel.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Entity +namespace Tnb.WarehouseMgr.Entities.Entity { public interface ITaskManagerDel { string startlocation_id { get; set; } string endlocation_id { get; set; } string carry_id { get; set; } - string area_code { get;set; } + string area_code { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IUpdatePoliciesStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IUpdatePoliciesStatus.cs index 1757984b..6605ee81 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IUpdatePoliciesStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IUpdatePoliciesStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Entity +namespace Tnb.WarehouseMgr.Entities.Entity { /// /// 出入库策略状态契约接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsCarryEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsCarryEntity.cs index 2130abef..fcdcccaa 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsCarryEntity.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsCarryEntity.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities +namespace Tnb.WarehouseMgr.Entities { public interface IWmsCarryEntity { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsRoadEntity.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsRoadEntity.cs index c0cd0c73..1cef139a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsRoadEntity.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/Constraints/IWmsRoadEntity.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities +namespace Tnb.WarehouseMgr.Entities { public interface IWmsRoadEntity { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs index 698881c0..abc29c92 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryCode.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs index 13a0fb4e..e2bbf362 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.cs @@ -1,7 +1,6 @@ using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; -using SqlSugar.DbConvert; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.part.cs index 336fd5bd..3f45a3ae 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCarryH.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCheckstockD.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCheckstockD.part.cs index d313bff9..26c04195 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCheckstockD.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsCheckstockD.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs index e380d56d..c8f2d129 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsDistaskH.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; using Tnb.WarehouseMgr.Entities.Entity; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs index 6fafa4bf..88ca59b7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.cs @@ -1,5 +1,4 @@ -using System.Security.Principal; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.part.cs index ce417fad..a605cbb1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsElevatorH.part.cs @@ -1,7 +1,4 @@ -using System.Security.Principal; -using JNPF.Common.Contracts; -using JNPF.Common.Security; -using SqlSugar; +using SqlSugar; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs index 7b191f25..e2f071d6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.cs @@ -1,9 +1,6 @@ -using JNPF.Common.Const; -using JNPF; using JNPF.Common.Contracts; using JNPF.Common.Security; using SqlSugar; -using Tnb.WarehouseMgr.Entities; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.part.cs index 24f8f909..bc250c13 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockCode.part.cs @@ -1,9 +1,3 @@ -using JNPF.Common.Const; -using JNPF; -using JNPF.Common.Contracts; -using JNPF.Common.Security; -using SqlSugar; - namespace Tnb.WarehouseMgr.Entities; /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs index 57477412..f3ee1510 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockD.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockPolicies.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockPolicies.part.cs index e51c8ca8..587b36be 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockPolicies.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsInstockPolicies.part.cs @@ -1,6 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; -using SqlSugar; using Tnb.WarehouseMgr.Entities.Entity; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockCode.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockCode.part.cs index cc9122cc..d6fa46d1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockCode.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockCode.part.cs @@ -1,7 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; -using SqlSugar; - namespace Tnb.WarehouseMgr.Entities; /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockPolicies.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockPolicies.part.cs index 63088f9c..34df3e68 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockPolicies.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsOutstockPolicies.part.cs @@ -1,6 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; -using SqlSugar; using Tnb.WarehouseMgr.Entities.Entity; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPretaskH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPretaskH.part.cs index aa14821e..4ab03baa 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPretaskH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsPretaskH.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; using Tnb.WarehouseMgr.Entities.Entity; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSetsortingH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSetsortingH.part.cs index 0d34f784..ed825483 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSetsortingH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsSetsortingH.part.cs @@ -1,5 +1,3 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; using SqlSugar; namespace Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs index fef9ccbb..984ecc3c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsStockReportH.part.cs @@ -1,13 +1,11 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Security; -using SqlSugar; +using SqlSugar; namespace Tnb.WarehouseMgr.Entities; /// /// 库存报表 /// -public partial class WmsStockReportH +public partial class WmsStockReportH { /// /// 物料名称 @@ -17,7 +15,7 @@ public partial class WmsStockReportH /// /// 明细列表 /// - [SugarColumn(IsIgnore =true)] + [SugarColumn(IsIgnore = true)] public List Details { get; set; } [SugarColumn(IsIgnore = true)] public decimal codeqty { get; set; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvControl.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvControl.cs index 938b5917..f9bdb970 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvControl.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvControl.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { public enum EnumAgvControl { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvStatus.cs index 570fe908..6f187d1f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumAgvStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { public enum EnumAgvStatus { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCarryStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCarryStatus.cs index c7bbef14..65a82d3b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCarryStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCarryStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 载具状态枚举 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckConclusion.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckConclusion.cs index 6de4aff1..880b317d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckConclusion.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckConclusion.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.ComponentModel; namespace Tnb.WarehouseMgr.Entities.Enums { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckStatus.cs index e817fe91..a42a82bb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 盘点状态 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckType.cs index a497e2ee..e361b285 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckType.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumCheckType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { public enum EnumCheckType { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumDoorStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumDoorStatus.cs index 283ffedf..79ea3cc8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumDoorStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumDoorStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { public enum EnumDoorStatus { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumInOutStockType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumInOutStockType.cs index ad03a4f7..d4e5eeb6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumInOutStockType.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumInOutStockType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 出入库申请类型 @@ -14,10 +8,10 @@ namespace Tnb.WarehouseMgr.Entities.Enums /// /// 入库 /// - In=1, + In = 1, /// /// 出库 /// - Out=2, + Out = 2, } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumLocationType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumLocationType.cs index 68e38397..afa934c4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumLocationType.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumLocationType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 库位类型 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumOutStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumOutStatus.cs index f13e2e51..8b8ba82e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumOutStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumOutStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 出库状态 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumRunStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumRunStatus.cs index f3b6d1b0..13644f78 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumRunStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumRunStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 电梯运行状态 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumSysStatus.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumSysStatus.cs index cbfeb966..1d882190 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumSysStatus.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumSysStatus.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 电梯系统状态枚举 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumTaskChainType.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumTaskChainType.cs index 3b9f2dc1..5938fe77 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumTaskChainType.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumTaskChainType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 任务链类型 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs index 8c55ebb1..3fef0cf2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/EnumWareHouseModule.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { /// /// 库房模块 @@ -14,11 +8,11 @@ namespace Tnb.WarehouseMgr.Entities.Enums /// /// 其它 /// - other= 1, + other = 1, /// /// 空载具出库 /// - WmsEptyOutStk=2, + WmsEptyOutStk = 2, /// /// 载具移出 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/TimeSpanUnit.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/TimeSpanUnit.cs index b9a26e80..991c6564 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/TimeSpanUnit.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Enums/TimeSpanUnit.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Entities.Enums +namespace Tnb.WarehouseMgr.Entities.Enums { public enum TimeSpanUnit { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Exceptions/TimedTaskException.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Exceptions/TimedTaskException.cs index 5b73e217..b9d20df4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Exceptions/TimedTaskException.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Exceptions/TimedTaskException.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; +using System.Security.Claims; using JNPF.Common.Const; using JNPF.Common.Security; using SqlSugar; diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs index 832fb911..ece5b726 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Mapper/Mapper.cs @@ -1,12 +1,8 @@ using Mapster; -using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Dto.Outputs; -using Tnb.Common; -using JNPF.Common.Extension; using Tnb.WarehouseMgr.Entities.Enums; -using Tnb.WarehouseMgr.Entities.Consts; namespace Tnb.WarehouseMgr.Entities.Mapper { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Tnb.WarehouseMgr.Entities.csproj b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Tnb.WarehouseMgr.Entities.csproj index edabb960..bd191439 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Tnb.WarehouseMgr.Entities.csproj +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Tnb.WarehouseMgr.Entities.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IBasRegionUserService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IBasRegionUserService.cs index 4f6eb634..d3cb46ed 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IBasRegionUserService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IBasRegionUserService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 区域人员设定服务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IElevatorControlService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IElevatorControlService.cs index 255d43da..f7e9baff 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IElevatorControlService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IElevatorControlService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 电梯控制服务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs index f260b905..f9c0150e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IPdaStroage.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { public interface IPdaStroage { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/ITaskMessageNotify.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/ITaskMessageNotify.cs index 1b6eb44a..a2f0105c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/ITaskMessageNotify.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/ITaskMessageNotify.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; +using System.Threading.Channels; using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs index 70965b9a..85f02655 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWHStorageService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Dto; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs index d0af5e0d..e78df528 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWareHouseService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; +using System.Linq.Expressions; using Microsoft.AspNetCore.Mvc; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -71,6 +66,6 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// /// Task TaskExecuteAfter(TaskExecuteAfterUpInput input); - Func AddUnExecuteTask { get; set; } + Func AddUnExecuteTask { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs index 8a60fe25..d697abda 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryBindService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryLedgerService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryLedgerService.cs index a78c80c8..354fd05f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryLedgerService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryLedgerService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 载具台账服务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs index c6308eba..4e3caff2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryMoveInStockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryQueryService.cs index ddcfaf51..5842fd2e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryQueryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryQueryService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs index b35a8c3a..f2d67966 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCarryService.cs @@ -1,5 +1,4 @@ -using System.Runtime.CompilerServices; -using Tnb.WarehouseMgr.Entities; +using Tnb.WarehouseMgr.Entities; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs index 06731b64..f8cbbdce 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsDeliveryService.cs index ffc91f56..f7addf8e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsDeliveryService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// Wms配送申请服务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyInstockService.cs index 915cd531..822a4d96 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyInstockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyOutstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyOutstockService.cs index 8948cbfe..4cadb8db 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyOutstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsEmptyOutstockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { @@ -17,6 +12,6 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// /// - Task MESEmptyCarryOutStk(MESEmptyCarryOutStkInput input); + Task MESEmptyCarryOutStk(MESEmptyCarryOutStkInput input); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsFeedingService.cs index be7e1b84..8e1a57d0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsFeedingService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 投料业务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsInStockService.cs index 1f4f080a..1c28a801 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsInStockService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 入库申请服务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs index 849a24b8..a42fb92f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsKittingInStkService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs index f01d39f0..1b18a8e6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsOutStockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPDATransferSignService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPDATransferSignService.cs index 6916d30b..d8d71c66 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPDATransferSignService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPDATransferSignService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 转运签收服务接口类 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs index c10e4bb1..894340eb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsPdaWHService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { public interface IWmsPdaWHService { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsRouteMgrService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsRouteMgrService.cs index 044523da..48bfeacd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsRouteMgrService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsRouteMgrService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// Wms路径管理业务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSetSortingService.cs index 7ef0907f..cf78730c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSetSortingService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 齐套分拣业务接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSignForDeliveryService.cs index dd623785..078698c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsSignForDeliveryService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// WMS签收接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmskittingOutService.cs index 691f899b..a974b4c3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmskittingOutService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; namespace Tnb.WarehouseMgr.Interfaces { diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs index ca71435b..c17dff80 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Interface1.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.WarehouseMgr.Interfaces +namespace Tnb.WarehouseMgr.Interfaces { /// /// 更新业务单据信息接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj index a57bb353..abcaef0a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/Tnb.WarehouseMgr.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs index 3ca2e321..b220b5b9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs index fd7d2bb7..6579ac49 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs @@ -1,18 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; +using System.Reflection; using System.Runtime.InteropServices; using System.Security.Claims; -using System.Security.Cryptography; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JavaScriptEngineSwitcher.Core.Extensions; using JNPF; -using JNPF.Common.Contracts; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -21,29 +10,18 @@ using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.EventBus; using JNPF.Extras.CollectiveOAuth.Enums; -using JNPF.FriendlyException; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using NPOI.HSSF.UserModel; -using NPOI.OpenXmlFormats.Dml; -using NPOI.SS.UserModel; -using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.Common.Core.EventBus.Constants; using Tnb.Common.Core.EventBus.Sources; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; -using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Dto.Outputs; -using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Interfaces; using Tnb.WarehouseMgr.Print; @@ -117,9 +95,9 @@ namespace Tnb.WarehouseMgr } }); - protected Task InvokeGenPretaskExcute() + protected Task InvokeGenPretaskExcute() { - var wareHouseSvc =App.GetRequiredService(); + var wareHouseSvc = App.GetRequiredService(); return wareHouseSvc.GenTaskExecute(); } @@ -384,7 +362,7 @@ namespace Tnb.WarehouseMgr /// /// [NonAction] - protected Task ToApiResult(HttpStatusCode statusCode, object data) + protected Task ToApiResult(HttpStatusCode statusCode, object data) { Result result = new() { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs index b243375e..3109287a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Text; using JNPF; -using JNPF.Common.Contracts; -using JNPF.Logging; using Microsoft.Extensions.Logging; using SqlSugar; using Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs index 8615273b..3f7019a0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aliyun.OSS; -using JNPF; +using JNPF; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -13,17 +7,12 @@ using JNPF.Common.Net; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.EventHandler; -using JNPF.FriendlyException; using JNPF.Logging; using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; -using JNPF.WorkFlow.Entitys.Dto.FlowLaunch; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Newtonsoft.Json; -using NPOI.OpenXmlFormats; -using Senparc.NeuChar.ApiHandlers; using SqlSugar; using Tnb.Common.Extension; using Tnb.EquipMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs index 06231ed2..b5709a50 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs @@ -1,21 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; +using System.Dynamic; using JNPF; using JNPF.Common.Extension; -using JNPF.DependencyInjection; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Hosting; -using MimeKit.Cryptography; using Newtonsoft.Json.Linq; using Tnb.Common.Extension; using Tnb.Common.Utils; -using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Configs; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Enums; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs b/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs index dda92314..d445daf5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs @@ -1,13 +1,5 @@ -using System.Reflection; -using System.Security.Claims; -using JNPF.Common.Configuration; -using JNPF.Common.Core.Manager; -using JNPF.DataEncryption; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; using JNPF.EventBus; -using JNPF.TaskScheduler.Entitys; -using NetTaste; -using SqlSugar; using Tnb.Common.Core.EventBus.Constants; using Tnb.Common.Core.EventBus.Sources; using Tnb.WarehouseMgr.Interfaces; @@ -71,4 +63,4 @@ public class TaskStatusChangeSubscriber : IEventSubscriber, ISingleton } } -} \ No newline at end of file +} \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs index f640130e..8d7394b9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs @@ -1,11 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Spire.Pdf.Widget; namespace Tnb.WarehouseMgr { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs index cc4150ae..6dd74dd8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs @@ -1,13 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Controllers; -using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.Extensions.DependencyInjection; -using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr { @@ -15,22 +8,22 @@ namespace Tnb.WarehouseMgr { public object Create(ControllerContext context) { - if(context == null) { throw new ArgumentNullException("context"); } + if (context == null) { throw new ArgumentNullException("context"); } var controllerType = context.ActionDescriptor.ControllerTypeInfo.AsType(); //获取Controller实例 - var controller =context.HttpContext.RequestServices.GetRequiredService(controllerType); + var controller = context.HttpContext.RequestServices.GetRequiredService(controllerType); //判断是否继承了自定义Controller基类 //if(controller is BaseWareHouseService basedWhSvc) //{ // basedWhSvc.WareHouseSrv = context.HttpContext.RequestServices.GetRequiredService(); //} - return controller; + return controller; } public void Release(ControllerContext context, object controller) { } - + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs index 059efe54..4c5164bb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.DependencyInjection; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs b/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs index 8484d02f..644251cd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs @@ -1,29 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; +using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.FriendlyException; using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDev; using Mapster; -using Microsoft.AspNetCore.Http; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Entities; -using JNPF.Common.Extension; -using JNPF.Logging; -using System.Reflection.Emit; -using JNPF.VisualDev.Entitys.Dto.VisualDev; -using NPOI.SS.Formula.Functions; -using Spire.Pdf.Lists; -using Aop.Api.Domain; -using NPOI.SS.UserModel; -using NPOI.XSSF.UserModel; -using NPOI.HSSF.UserModel; -using Microsoft.AspNetCore.Mvc; namespace Tnb.WarehouseMgr { @@ -117,15 +101,16 @@ namespace Tnb.WarehouseMgr } else if (locs.Count > 400) { - _db.Utilities.PageEach(locs, 100, async pageList => { - row = await _db.Insertable(pageList).ExecuteCommandAsync(); + _db.Utilities.PageEach(locs, 100, async pageList => + { + row = await _db.Insertable(pageList).ExecuteCommandAsync(); }); } - else + else { row = await _db.Insertable(locs).ExecuteCommandAsync(); } - + } catch (Exception ex) { @@ -140,6 +125,6 @@ namespace Tnb.WarehouseMgr }; return result; } - + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs index 13a386a9..499c5907 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs @@ -1,27 +1,20 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Immutable; +using JNPF; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; +using JNPF.Common.Security; using JNPF.Systems.Interfaces.System; +using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Dto; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Enums; -using Mapster; -using JNPF.Common.Security; -using System.Collections.Immutable; -using JNPF.Common.Core.Manager; -using Tnb.WarehouseMgr.Interfaces; -using Senparc.Weixin.Work.Entities; -using JNPF; using Tnb.WarehouseMgr.Entities.Exceptions; -using JNPF.Common.Const; +using Tnb.WarehouseMgr.Interfaces; //using JNPF.Extras.CollectiveOAuth.Utils; namespace Tnb.WarehouseMgr @@ -217,7 +210,7 @@ namespace Tnb.WarehouseMgr catch (Exception ex) { await curDb.Ado.RollbackTranAsync(); - if(_userManager?.ToKen.IsNullOrEmpty() ?? false) + if (_userManager?.ToKen.IsNullOrEmpty() ?? false) { TimedTaskErrorInfo ei = new() { @@ -227,7 +220,7 @@ namespace Tnb.WarehouseMgr }; var timedTaskEx = ex.ToTimedTaskException(ei); throw timedTaskEx; - } + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs index 123a358e..16976bef 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs @@ -1,14 +1,5 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; -using System.Dynamic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; using JNPF; -using JNPF.Common.Extension; -using Microsoft.Extensions.DependencyInjection; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Interfaces; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs index 4c840d73..edf25d6b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Reflection; using JNPF; using JNPF.Common.Extension; using Tnb.WarehouseMgr.Entities.Attributes; @@ -29,7 +24,7 @@ namespace Tnb.WarehouseMgr } } - public async Task Do(WareHouseUpInput input) + public async Task Do(WareHouseUpInput input) { if (_serviceMap.ContainsKey(input.bizTypeId)) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs b/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs index cc871701..4a742f5f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.DependencyModel; +using System.Runtime.InteropServices; namespace Tnb.WarehouseMgr.Print { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs b/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs index e1b220b1..049c912d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; using Tnb.BasicData.Entities; -using Tnb.ProductionMgr.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Entity; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs b/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs index 6e0b6cc1..dc3f580c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; +using System.Threading.Channels; using Microsoft.Extensions.DependencyInjection; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs index 043e0757..1f4faff6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs @@ -1,39 +1,15 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; +using System.Collections.Concurrent; using JNPF; -using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.Message; -using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.EventHandler; -using JNPF.FriendlyException; -using JNPF.Logging; -using JNPF.Message.Interfaces.Message; using JNPF.Systems.Entitys.System; -using Mapster; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -using Microsoft.Extensions.Options; -using Natasha.CSharp; -using NetTaste; using Tnb.Common.Extension; using Tnb.Common.Utils; -using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Configs; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; -using Tnb.WarehouseMgr.Entities.Dto.Outputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Entities.Exceptions; -using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj index d805e581..7d6b065d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj +++ b/WarehouseMgr/Tnb.WarehouseMgr/Tnb.WarehouseMgr.csproj @@ -1,6 +1,5 @@  - net6.0 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index a56b3ecf..66954dcb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; +using System.Diagnostics; using System.Dynamic; -using System.Linq; using System.Linq.Expressions; using JNPF; using JNPF.Common.Contracts; @@ -17,7 +14,6 @@ using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; -using Microsoft.Extensions.Configuration; using Newtonsoft.Json; //using NPOI.SS.Formula.Functions; using SqlSugar; @@ -25,7 +21,6 @@ using Tnb.BasicData.Entities; using Tnb.Common.Extension; using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Configs; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; @@ -33,7 +28,6 @@ using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; -using JNPF.Common.Extension; namespace Tnb.WarehouseMgr { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 5640c695..1076b9e7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -13,15 +8,9 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula; using SqlSugar; -using Tnb.BasicData.Entities; 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; @@ -33,7 +22,7 @@ namespace Tnb.WarehouseMgr [OverideVisualDev(ModuleConsts.MODULE_WMSCARRYBIND_ID)] public class WmsCarryBindService : BaseWareHouseService, IWmsCarryBindService { - + private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs index 991c2dbd..a2c35e74 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs @@ -1,31 +1,15 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.Systems.Interfaces.System; +using JNPF.Common.Core.Manager; +using JNPF.Common.Security; +using JNPF.FriendlyException; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Entitys.Dto.VisualDev; using JNPF.VisualDev.Interfaces; +using Mapster; using SqlSugar; +using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; -using JNPF.Common.Extension; -using JNPF.VisualDev.Entitys; -using Aspose.Cells.Drawing; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Http; -using JNPF.Logging; -using JNPF.FriendlyException; -using JNPF.Common.Security; -using Tnb.BasicData.Entities; -using Mapster; -using Aop.Api.Domain; -using JNPF.VisualDev.Entitys.Dto.VisualDev; namespace Tnb.WarehouseMgr { @@ -102,7 +86,8 @@ namespace Tnb.WarehouseMgr } else if (carrys.Count > 400) { - _db.Utilities.PageEach(carrys, 100, async pageList => { + _db.Utilities.PageEach(carrys, 100, async pageList => + { await _db.Insertable(pageList).ExecuteCommandAsync(); }); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs index 646b7fd3..9927dad9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs @@ -1,24 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using JNPF.Common.Const; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.FriendlyException; -using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -26,7 +16,6 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -63,7 +52,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = CarryMoveIn; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs index 0f8bcfd3..7107f15f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,7 +10,6 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -56,7 +50,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = CarryMoveOut; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs index 4f75c5bd..9845ee8c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs @@ -1,20 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Dynamic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; +using System.Linq.Expressions; using JNPF.Common.Extension; using JNPF.FriendlyException; using Mapster; using Microsoft.AspNetCore.Mvc; -using Org.BouncyCastle.Crypto; using SqlSugar; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Dto.Outputs; using Tnb.WarehouseMgr.Interfaces; @@ -84,7 +75,7 @@ namespace Tnb.WarehouseMgr instock_time = b.create_time, }, true) .ToListAsync(); - + if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic?.Count > 0) { if (carryCodes.Count < mCarryIdDic.Keys?.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index a1911319..923c5e3a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -1,16 +1,12 @@ -using System.Runtime.CompilerServices; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Logging; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; @@ -228,7 +224,7 @@ namespace Tnb.WarehouseMgr public async Task BarCodePrint(List barCodes) { base.BarCodePrint(barCodes); - + } } } \ No newline at end of file diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs index 4be4e239..e68c5c3c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs @@ -1,27 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; -using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.FriendlyException; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula; using SqlSugar; -using Tnb.BasicData.Entities; 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; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs index 0e61c30a..7b74d59b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; +using System.Linq.Expressions; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; @@ -15,7 +10,6 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using OBS.Internal; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -54,7 +48,7 @@ namespace Tnb.WarehouseMgr _runService = runService; _billRullService = billRullService; _userManager = userManager; - + OverideFuncs.CreateAsync = Create; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs index 4c367e00..5da01d2b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs @@ -1,20 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using Aspose.Cells.Drawing; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; using JNPF.Common.Filter; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using SqlSugar; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs index 9005c12f..c74c9049 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -18,7 +12,6 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -67,7 +60,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = Create; } /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs index 28bc827f..f088232c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs @@ -1,13 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.VisualDev; +using JNPF.VisualDev; using SqlSugar; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Entity; namespace Tnb.WarehouseMgr { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs index f167cfb4..46e7c6fd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using JNPF.Common.Contracts; +using System.Threading.Channels; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; @@ -17,10 +11,7 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; -using Spire.Doc.Formatting; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -28,7 +19,6 @@ using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; -using Tnb.WarehouseMgr.Filters; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index 56b4530b..fcbc3b89 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,7 +9,6 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -24,7 +17,6 @@ using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; -using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; @@ -62,7 +54,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = WmsEmptyOut; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs index abbcdc7c..a2879510 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using Mapster; +using System.Linq.Expressions; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs index c347eff6..672ba305 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using SqlSugar; +using SqlSugar; namespace Tnb.WarehouseMgr { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 81307269..c5b62f54 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -1,24 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.FriendlyException; -using JNPF.Logging; using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; -using Minio.DataModel; -using Newtonsoft.Json.Linq; -using NPOI.SS.Formula.Functions; -using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.Common.Utils; @@ -65,7 +53,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _wareHouseService = wareHouseService; _prdInstockService = prdInstockService; - + } /// /// 根据入库申请单ID获取申请单明细信息 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs index 1b6ac354..a1ad04ac 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -59,7 +54,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = KittingInStk; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs index e901673c..e941f909 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,7 +10,6 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -59,7 +53,7 @@ namespace Tnb.WarehouseMgr _userManager = userManager; _billRullService = billRullService; _wmsCarryService = wmsCarryService; - + OverideFuncs.CreateAsync = CarryOutBale; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index a9fe16b1..95959b54 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using System.Linq.Expressions; +using System.Runtime.InteropServices; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; using JNPF.Common.Security; +using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.System; @@ -20,9 +14,7 @@ using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; -using NPOI.SS.Formula.Functions; using SqlSugar; -using SqlSugar.DbConvert; using Tnb.BasicData.Entities; using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; @@ -32,10 +24,7 @@ using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; -using System.Reflection; using Tnb.WarehouseMgr.Print; -using System.Runtime.InteropServices; -using JNPF.EventBus; namespace Tnb.WarehouseMgr { @@ -79,7 +68,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _wmsCarryMoveInStockService = wmsCarryMoveInStockService; _wareCarryService = wareCarryService; - + OverideFuncs.CreateAsync = OutStockApplyFor; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDABindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDABindService.cs index 392adc56..5ad60040 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDABindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDABindService.cs @@ -1,24 +1,9 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.FriendlyException; -using JNPF.Logging; +using JNPF.Common.Core.Manager; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index dd207182..d7b8e5bc 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -13,17 +8,9 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula; using SqlSugar; -using Tnb.BasicData.Entities; 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 { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs index 199b9a7f..acc6e8c4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs @@ -1,23 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Const; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.FriendlyException; -using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -60,7 +51,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = PDACarryMoveIn; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs index 111d5263..c5df2aa5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,7 +10,6 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -57,7 +51,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = PDACarryMoveOut; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs index 711685ce..3db0094d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryReplaceService.cs @@ -1,24 +1,9 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; -using JNPF.FriendlyException; -using JNPF.Logging; +using JNPF.Common.Core.Manager; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -27,16 +12,16 @@ namespace Tnb.WarehouseMgr /// PDA载具更换 /// [OverideVisualDev(ModuleConsts.MODULE_WMSCARRYREPLACEPDA_ID)] - public class WmsPDACarryReplaceService : WmsCarryService ,IPdaStroage + public class WmsPDACarryReplaceService : WmsCarryService, IPdaStroage { public WmsPDACarryReplaceService( - ISqlSugarRepository repository, - IUserManager userManager, - IBillRullService billRullService, + ISqlSugarRepository repository, + IUserManager userManager, + IBillRullService billRullService, IRunService runService, IVisualDevService visualDevService) : base(repository, userManager, billRullService, runService, visualDevService) { - + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs index 2e4ebb7a..21564566 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs @@ -1,27 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; -using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.FriendlyException; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula; using SqlSugar; -using Tnb.BasicData.Entities; 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; @@ -112,7 +98,7 @@ namespace Tnb.WarehouseMgr await _db.Ado.CommitTranAsync(); } - catch (Exception) + catch (Exception) { await _db.Ado.RollbackTranAsync(); throw; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs index 412c9266..69f6921e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs @@ -1,15 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; @@ -62,7 +54,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _wareHouseService = wareHouseService; _userManager = userManager; - + OverideFuncs.CreateAsync = Create; } /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs index 9926e68e..ecce2711 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,7 +10,6 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -57,7 +51,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = PDAWmsEmptyIn; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index aedad1a5..51381f57 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,8 +10,6 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -59,7 +52,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = PDAWmsEmptyOut; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs index a858ef0e..0c64a0ca 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs @@ -1,27 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; -using JNPF.Common.Extension; -using JNPF.Common.Security; -using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using Microsoft.CodeAnalysis; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr { @@ -61,7 +46,8 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - if (input.data.ContainsKey(nameof(WmsDistaskH.bill_code))) { + if (input.data.ContainsKey(nameof(WmsDistaskH.bill_code))) + { //更新任务执行状态 已取消 await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID }).Where(it => it.bill_code == input.data[nameof(WmsDistaskH.bill_code)].ToString()).ExecuteCommandAsync(); @@ -76,7 +62,7 @@ namespace Tnb.WarehouseMgr { //载具解锁 await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0 }).Where(it => it.id == input.data[nameof(WmsDistaskH.carry_id)].ToString()).ExecuteCommandAsync(); - } + } if (input.data.ContainsKey(nameof(WmsDistaskH.startlocation_id)) && input.data.ContainsKey(nameof(WmsDistaskH.endlocation_id))) { //所有库位解锁 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs index a64b2feb..6a260a36 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs @@ -1,27 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; -using JNPF.Common.Extension; -using JNPF.Common.Security; -using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using Microsoft.CodeAnalysis; using SqlSugar; -using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Attributes; -using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -70,7 +53,7 @@ namespace Tnb.WarehouseMgr taskCompleUpInput.disTaskIds = list; await _wareHouseService.TaskComplate(taskCompleUpInput); } - + await _db.Ado.CommitTranAsync(); } catch (Exception) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs index 5ee18bfa..5fa02e04 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs @@ -1,27 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; -using JNPF.Common.Extension; -using JNPF.Common.Security; -using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; -using Microsoft.CodeAnalysis; using SqlSugar; -using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Attributes; -using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs index 206fe46b..95adfc5b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs @@ -1,24 +1,14 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Logging; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; -using Tnb.WarehouseMgr.Entities.Consts; -using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index f502e6c5..560da974 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -1,26 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Identity; -using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json.Linq; -using NPOI.OpenXmlFormats.Vml; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.Common.Utils; @@ -28,7 +16,6 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; @@ -65,7 +52,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = ScanCodeInStock; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs index 939e05d9..48aa70fa 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -13,17 +7,13 @@ using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; @@ -60,7 +50,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = Inbale; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs index c86d5f92..f111f450 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAKittingInStkService.cs @@ -1,28 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; -using JNPF.Common.Extension; -using JNPF.Common.Security; +using JNPF.Common.Core.Manager; using JNPF.EventBus; -using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; -using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.BasicData.Entities; 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 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs index afa30529..f5503d9b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -16,14 +10,12 @@ using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -50,7 +42,7 @@ namespace Tnb.WarehouseMgr IUserManager userManager, IBillRullService billRullService, IEventPublisher eventPublisher - ) + ) { _db = repository.AsSugarClient(); _runService = runService; @@ -58,7 +50,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = PDAOutBale; } @@ -158,7 +150,7 @@ namespace Tnb.WarehouseMgr await _db.Ado.RollbackTranAsync(); throw; - + } finally { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs index 7be5ce4b..06855e5c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; using JNPF.Common.Security; @@ -13,7 +7,6 @@ using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using Mapster; -using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.ProductionMgr.Interfaces; @@ -56,7 +49,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _wareHouseService = wareHouseService; _prdInstockService = prdInstockService; - + OverideFuncs.CreateAsync = ScanInStock; } public async Task ScanInStock(VisualDevModelDataCrInput input) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs index 4b145362..271fc586 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -15,8 +9,6 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; using SqlSugar; using Tnb.BasicData.Entities; @@ -24,7 +16,6 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -61,7 +52,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = CarryTransfer; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs index b2786d36..25f71638 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs @@ -1,20 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.FriendlyException; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDev; using Mapster; -using Microsoft.AspNetCore.Mvc; -using NPOI.HSSF.UserModel; -using NPOI.SS.Formula; -using NPOI.SS.UserModel; -using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -100,7 +90,7 @@ namespace Tnb.WarehouseMgr { _db.Utilities.PageEach(points, 100, async pageList => { - row = await _db.Insertable(pageList).ExecuteCommandAsync(); + row = await _db.Insertable(pageList).ExecuteCommandAsync(); }); } else diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPretaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPretaskService.cs index d8668c42..834189c5 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPretaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPretaskService.cs @@ -1,13 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using JNPF.VisualDev; -using NPOI.SS.Formula.Functions; +using JNPF.VisualDev; using SqlSugar; -using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; namespace Tnb.WarehouseMgr diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs index ef7ce566..2aa5e33d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; using JNPF.Common.Security; @@ -14,8 +7,6 @@ using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; -using Newtonsoft.Json; -using NPOI.OpenXmlFormats; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -55,7 +46,7 @@ namespace Tnb.WarehouseMgr _warehouseService = warehouseService; _billRullService = billRullService; _wmsKittingInStkService = wmsKittingInStkService; - + } /// /// 机器人完成任务后回调接口 diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs index 1b405274..5e76dee1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs @@ -1,29 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells.Drawing; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Security; -using JNPF.DependencyInjection; -using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.VisualDev; using JNPF.VisualDev.Interfaces; using Mapster; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using NPOI.HSSF.UserModel; -using NPOI.SS.Formula; -using NPOI.SS.UserModel; -using NPOI.XSSF.UserModel; using SqlSugar; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Interfaces; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index 4429c4d5..4e681733 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -1,15 +1,6 @@ -using System; -using System.ArrayExtensions; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; -using JNPF; -using JNPF.Common.Const; +using JNPF; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Manager; using JNPF.Common.Security; @@ -21,9 +12,7 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; -using NPOI.SS.Formula; using SqlSugar; -using TencentCloud.Common; using Tnb.BasicData.Entities; using Tnb.Common.Utils; using Tnb.WarehouseMgr.Entities; @@ -33,7 +22,6 @@ using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Entities.Exceptions; using Tnb.WarehouseMgr.Interfaces; -using UAParser; namespace Tnb.WarehouseMgr { @@ -70,7 +58,7 @@ namespace Tnb.WarehouseMgr _cacheManager = cacheManager; _runService = runService; _visualDevService = visualDevService; - + //OverideFuncs.CreateAsync = Create; } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index aa2258b8..fccf6a02 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -1,18 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; -using JNPF.Common.Core.Manager; -using JNPF.Common.Enums; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; -using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; -using Microsoft.CodeAnalysis.Operations; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs index ab1a2f9c..b96ebaa3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs @@ -1,17 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using Mapster; -using MimeKit.Cryptography; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -51,7 +43,7 @@ namespace Tnb.WarehouseMgr }, true) .ToListAsync(); var carryCodes = await _db.Queryable().ToListAsync(); - var storeMap = items.DistinctBy(x=> new {x.warehouse_id,x.material_id }).ToDictionary(x => new {x.warehouse_id,x.material_id }, x => x); + var storeMap = items.DistinctBy(x => new { x.warehouse_id, x.material_id }).ToDictionary(x => new { x.warehouse_id, x.material_id }, x => x); var result = items.GroupBy(g => new { g.warehouse_id, g.material_id }).Select(itGroup => { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs index 41d978f1..ee047edd 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Channels; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -16,8 +9,6 @@ using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; -using Mapster; -using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; using SqlSugar; using Tnb.BasicData.Entities; @@ -25,7 +16,6 @@ using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; -using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Interfaces; namespace Tnb.WarehouseMgr @@ -61,7 +51,7 @@ namespace Tnb.WarehouseMgr _wareHouseService = wareHouseService; _userManager = userManager; _billRullService = billRullService; - + OverideFuncs.CreateAsync = CarryTransfer; } @@ -146,7 +136,7 @@ namespace Tnb.WarehouseMgr await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); - + } } @@ -161,7 +151,7 @@ namespace Tnb.WarehouseMgr } finally { - await InvokeGenPretaskExcute();; + await InvokeGenPretaskExcute(); ; } return Task.FromResult(true); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index b7b26e4b..f9f506d2 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -1,34 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Data; -using System.Data.Common; -using System.Linq; +using System.Data; using System.Linq.Expressions; -using System.Net.Http; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; -using System.Transactions; -using Aop.Api.Domain; using JNPF; -using JNPF.Common.Const; using JNPF.Common.Core.Manager; -using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Manager; using JNPF.Common.Security; -using JNPF.DataEncryption; using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.LinqBuilder; using JNPF.Logging; -using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.System; using Mapster; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.CodeAnalysis.CSharp.Syntax; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; @@ -36,7 +20,6 @@ using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; -using Tnb.WarehouseMgr.Entities.Dto.Outputs; using Tnb.WarehouseMgr.Entities.Enums; using Tnb.WarehouseMgr.Entities.Exceptions; using Tnb.WarehouseMgr.Interfaces; @@ -72,7 +55,7 @@ namespace Tnb.WarehouseMgr _billRullService = billRullService; _carryService = carryService; _cacheManager = cacheManager; - + } /// /// 齐套出库(新增状态) diff --git a/apihost/Tnb.API.Entry/Extensions/ConfigureEventBusExtensions.cs b/apihost/Tnb.API.Entry/Extensions/ConfigureEventBusExtensions.cs index 214f6c8a..8689ae1d 100644 --- a/apihost/Tnb.API.Entry/Extensions/ConfigureEventBusExtensions.cs +++ b/apihost/Tnb.API.Entry/Extensions/ConfigureEventBusExtensions.cs @@ -1,8 +1,6 @@ using JNPF; using JNPF.Common.Core; -using JNPF.Common.Options; using JNPF.EventHandler; -using OnceMi.AspNetCore.OSS; namespace Microsoft.Extensions.DependencyInjection; @@ -11,13 +9,13 @@ namespace Microsoft.Extensions.DependencyInjection; /// public static class ConfigureEventBusExtensions { - /// - /// OSS服务配置. - /// - /// - /// - public static IServiceCollection ConfigureEventBus(this IServiceCollection services) - { + /// + /// OSS服务配置. + /// + /// + /// + public static IServiceCollection ConfigureEventBus(this IServiceCollection services) + { // 注册EventBus服务 // 注册EventBus服务 services.AddEventBus(options => @@ -66,5 +64,5 @@ public static class ConfigureEventBusExtensions services.AddConfigurableOptions(); return services; - } + } } \ No newline at end of file diff --git a/apihost/Tnb.API.Entry/Extensions/ConfigureLoggingExtensions.cs b/apihost/Tnb.API.Entry/Extensions/ConfigureLoggingExtensions.cs index 31797ac2..882201be 100644 --- a/apihost/Tnb.API.Entry/Extensions/ConfigureLoggingExtensions.cs +++ b/apihost/Tnb.API.Entry/Extensions/ConfigureLoggingExtensions.cs @@ -1,9 +1,4 @@ -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using JNPF; -using JNPF.Logging; -using Spire.Xls; -using SqlSugar; +using JNPF.Logging; namespace Microsoft.Extensions.DependencyInjection; @@ -12,69 +7,69 @@ namespace Microsoft.Extensions.DependencyInjection; /// public static class ConfigureLoggingExtensions { - const string DATEFORMAT = "HH:mm:ss.fff"; + const string DATEFORMAT = "HH:mm:ss.fff"; - public static IServiceCollection ConfigureLogging(this IServiceCollection services) - { - services.AddConsoleFormatter(option => + public static IServiceCollection ConfigureLogging(this IServiceCollection services) { - option.MessageFormat = LoggerConsoleFormat; - }).AddFileLogging(options => - { - options.MessageFormat = LoggerFileFormat; - options.FileNameRule = fileName => string.Format(fileName, DateTime.Now); // 每天创建一个文件 - options.HandleWriteError = (writeError) => // 写入失败时启用备用文件 - { - writeError.UseRollbackFileName(Path.GetFileNameWithoutExtension(writeError.CurrentFileName) + "-oops" + Path.GetExtension(writeError.CurrentFileName)); - }; - }); - // 日志监听 - // services.AddMonitorLogging(options => - //{ - // options.IgnorePropertyNames = new[] { "Byte" }; - // options.IgnorePropertyTypes = new[] { typeof(byte[]) }; - //}); + services.AddConsoleFormatter(option => + { + option.MessageFormat = LoggerConsoleFormat; + }).AddFileLogging(options => + { + options.MessageFormat = LoggerFileFormat; + options.FileNameRule = fileName => string.Format(fileName, DateTime.Now); // 每天创建一个文件 + options.HandleWriteError = (writeError) => // 写入失败时启用备用文件 + { + writeError.UseRollbackFileName(Path.GetFileNameWithoutExtension(writeError.CurrentFileName) + "-oops" + Path.GetExtension(writeError.CurrentFileName)); + }; + }); + // 日志监听 + // services.AddMonitorLogging(options => + //{ + // options.IgnorePropertyNames = new[] { "Byte" }; + // options.IgnorePropertyTypes = new[] { typeof(byte[]) }; + //}); - return services; - } - private static string LoggerLevelName(LogLevel level) - { - return level switch - { - LogLevel.Trace => "Trace", - LogLevel.Debug => "Debug", - LogLevel.Information => "Info", - LogLevel.Warning => "Warn", - LogLevel.Error => "Error", - LogLevel.Critical => "Crit", - _ => "None" - }; - } - private static string LoggerFileFormat(LogMessage msg) - { - var txt = $"{LoggerLevelName(msg.LogLevel)} {msg.LogDateTime.ToString(DATEFORMAT)} {msg.ThreadId}# {msg.Message}"; - if (msg.Exception != null) - { - //var EXCEPTION_SEPARATOR_WITHCOLOR = AppendWithColor(default, EXCEPTION_SEPARATOR, logLevelColors).ToString(); - txt += $"{Environment.NewLine}{msg.Exception}"; + return services; } - return txt; - } - private static string LoggerConsoleFormat(LogMessage msg) - { - var fclr = msg.LogLevel switch + private static string LoggerLevelName(LogLevel level) { - LogLevel.Warning => "\u001b[1m\u001b[33m", - LogLevel.Error => "\u001b[1m\u001b[31m", - _ => "\u001b[39m\u001b[22m" - }; - var txt = $"{fclr}{LoggerLevelName(msg.LogLevel)}\u001b[49m \u001b[36m{msg.LogDateTime.ToString(DATEFORMAT)}\u001b[49m \u001b[39m\u001b[22m{msg.ThreadId}#\u001b[49m {fclr}{msg.Message}\u001b[49m"; - if (msg.Exception != null) - { - //var EXCEPTION_SEPARATOR_WITHCOLOR = AppendWithColor(default, EXCEPTION_SEPARATOR, logLevelColors).ToString(); - txt += $"{Environment.NewLine}{fclr}{msg.Exception}\u001b[49m"; + return level switch + { + LogLevel.Trace => "Trace", + LogLevel.Debug => "Debug", + LogLevel.Information => "Info", + LogLevel.Warning => "Warn", + LogLevel.Error => "Error", + LogLevel.Critical => "Crit", + _ => "None" + }; + } + private static string LoggerFileFormat(LogMessage msg) + { + var txt = $"{LoggerLevelName(msg.LogLevel)} {msg.LogDateTime.ToString(DATEFORMAT)} {msg.ThreadId}# {msg.Message}"; + if (msg.Exception != null) + { + //var EXCEPTION_SEPARATOR_WITHCOLOR = AppendWithColor(default, EXCEPTION_SEPARATOR, logLevelColors).ToString(); + txt += $"{Environment.NewLine}{msg.Exception}"; + } + return txt; + } + private static string LoggerConsoleFormat(LogMessage msg) + { + var fclr = msg.LogLevel switch + { + LogLevel.Warning => "\u001b[1m\u001b[33m", + LogLevel.Error => "\u001b[1m\u001b[31m", + _ => "\u001b[39m\u001b[22m" + }; + var txt = $"{fclr}{LoggerLevelName(msg.LogLevel)}\u001b[49m \u001b[36m{msg.LogDateTime.ToString(DATEFORMAT)}\u001b[49m \u001b[39m\u001b[22m{msg.ThreadId}#\u001b[49m {fclr}{msg.Message}\u001b[49m"; + if (msg.Exception != null) + { + //var EXCEPTION_SEPARATOR_WITHCOLOR = AppendWithColor(default, EXCEPTION_SEPARATOR, logLevelColors).ToString(); + txt += $"{Environment.NewLine}{fclr}{msg.Exception}\u001b[49m"; + } + return txt; } - return txt; - } } \ No newline at end of file diff --git a/apihost/Tnb.API.Entry/Extensions/ConfigureMvcControllerExtensions.cs b/apihost/Tnb.API.Entry/Extensions/ConfigureMvcControllerExtensions.cs index 4a984aa6..a3f102db 100644 --- a/apihost/Tnb.API.Entry/Extensions/ConfigureMvcControllerExtensions.cs +++ b/apihost/Tnb.API.Entry/Extensions/ConfigureMvcControllerExtensions.cs @@ -1,17 +1,12 @@ using System.Globalization; -using JNPF; +using JNPF.API.Entry.Handlers; using JNPF.Common.Core.Filter; -using JNPF.Common.Options; -using JNPF.EventHandler; using JNPF.JsonSerialization; using JNPF.UnifyResult; -using Microsoft.AspNetCore.HttpOverrides; -using Newtonsoft.Json.Serialization; -using Newtonsoft.Json; -using OnceMi.AspNetCore.OSS; -using JNPF.API.Entry.Handlers; -using JNPF.Common.Cache; using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.HttpOverrides; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; namespace Microsoft.Extensions.DependencyInjection; @@ -125,7 +120,7 @@ public static class ConfigureMvcControllerExtensions return services; } - + public class MyNewtonsoftDateTimeJsonConverter : NewtonsoftDateTimeJsonConverter { public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) @@ -134,20 +129,20 @@ public static class ConfigureMvcControllerExtensions if (reader.TokenType == JsonToken.Null || string.IsNullOrEmpty(reader.Value.ToString())) { if (!flag) - throw new JsonSerializationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Cannot convert null value to {0}.", (object) objectType)); - return (object) null; + throw new JsonSerializationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Cannot convert null value to {0}.", (object)objectType)); + return (object)null; } long result = 0; if (reader.TokenType == JsonToken.Integer) - result = (long) reader.Value; + result = (long)reader.Value; else if (reader.TokenType == JsonToken.String) { - if (!long.TryParse((string) reader.Value, out result)) - return (object) Convert.ToDateTime(reader.Value.ToString()); - return reader.TokenType == JsonToken.Date ? reader.Value : throw new JsonSerializationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Unexpected token parsing date. Expected Integer or String, got {0}.", (object) reader.TokenType)); + if (!long.TryParse((string)reader.Value, out result)) + return (object)Convert.ToDateTime(reader.Value.ToString()); + return reader.TokenType == JsonToken.Date ? reader.Value : throw new JsonSerializationException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Unexpected token parsing date. Expected Integer or String, got {0}.", (object)reader.TokenType)); } if (result < 0L) - return (object) DateTime.Now; + return (object)DateTime.Now; try { DateTime dt = Convert.ToDateTime(reader.Value.ToString()); @@ -158,7 +153,7 @@ public static class ConfigureMvcControllerExtensions DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(result); dateTimeOffset = dateTimeOffset.ToLocalTime(); DateTime dateTime = dateTimeOffset.DateTime; - return (flag ? Nullable.GetUnderlyingType(objectType) : objectType) == typeof (DateTimeOffset) ? (object) new DateTimeOffset(dateTime, TimeSpan.Zero) : (object) dateTime; + return (flag ? Nullable.GetUnderlyingType(objectType) : objectType) == typeof(DateTimeOffset) ? (object)new DateTimeOffset(dateTime, TimeSpan.Zero) : (object)dateTime; } } } diff --git a/apihost/Tnb.API.Entry/Extensions/ConfigureSqlSugarExtensions.cs b/apihost/Tnb.API.Entry/Extensions/ConfigureSqlSugarExtensions.cs index 6dbf0ca7..2204c17e 100644 --- a/apihost/Tnb.API.Entry/Extensions/ConfigureSqlSugarExtensions.cs +++ b/apihost/Tnb.API.Entry/Extensions/ConfigureSqlSugarExtensions.cs @@ -1,9 +1,5 @@ -using System.ComponentModel.DataAnnotations; -using System.Reflection; -using JNPF; +using JNPF; using JNPF.DatabaseAccessor; -using JNPF.Logging; -using Spire.Xls; using SqlSugar; namespace Microsoft.Extensions.DependencyInjection; diff --git a/apihost/Tnb.API.Entry/Handlers/JwtHandler.cs b/apihost/Tnb.API.Entry/Handlers/JwtHandler.cs index f0e9de90..0c57894a 100644 --- a/apihost/Tnb.API.Entry/Handlers/JwtHandler.cs +++ b/apihost/Tnb.API.Entry/Handlers/JwtHandler.cs @@ -1,6 +1,5 @@ using JNPF.Authorization; using JNPF.Common.Const; -using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.DataEncryption; using Microsoft.AspNetCore.Authorization; diff --git a/apihost/Tnb.API.Entry/Program.cs b/apihost/Tnb.API.Entry/Program.cs index 5dfadd09..1f9701d7 100644 --- a/apihost/Tnb.API.Entry/Program.cs +++ b/apihost/Tnb.API.Entry/Program.cs @@ -1,27 +1,25 @@ -using JNPF.Common.Security; - Serve.Run(RunOptions.Default .AddWebComponent().WithArgs(args)); public class WebComponent : IWebComponent { - public void Load(WebApplicationBuilder builder, ComponentContext componentContext) - { - builder.Host.UseWindowsService(); - //// 日志过滤 - //builder.Logging.AddFilter((provider, category, logLevel) => - //{ - // return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information; - //}); - builder.WebHost.ConfigureKestrel(options => + public void Load(WebApplicationBuilder builder, ComponentContext componentContext) { - // 长度最好不要设置 null - options.Limits.MaxRequestBodySize = 52428800; - }); + builder.Host.UseWindowsService(); + //// 日志过滤 + //builder.Logging.AddFilter((provider, category, logLevel) => + //{ + // return !new[] { "Microsoft.Hosting", "Microsoft.AspNetCore" }.Any(u => category.StartsWith(u)) && logLevel >= LogLevel.Information; + //}); + builder.WebHost.ConfigureKestrel(options => + { + // 长度最好不要设置 null + options.Limits.MaxRequestBodySize = 52428800; + }); - //builder.Logging.AddConsoleFormatter(options => - //{ - // options.DateFormat = "yyyy-MM-dd HH:mm:ss(zzz) dddd"; - //}); - } + //builder.Logging.AddConsoleFormatter(options => + //{ + // options.DateFormat = "yyyy-MM-dd HH:mm:ss(zzz) dddd"; + //}); + } } \ No newline at end of file diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs index f517e4d4..d7d716d8 100644 --- a/apihost/Tnb.API.Entry/Startup.cs +++ b/apihost/Tnb.API.Entry/Startup.cs @@ -1,28 +1,16 @@ -using System.Reflection; -using IGeekFan.AspNetCore.Knife4jUI; -using JNPF.API.Entry.Handlers; +using IGeekFan.AspNetCore.Knife4jUI; using JNPF.Common.Cache; -using JNPF.Common.Core; -using JNPF.Common.Core.Filter; using JNPF.Common.Core.Handlers; using JNPF.Common.Security; -using JNPF.DatabaseAccessor; -using JNPF.EventHandler; -using JNPF.JsonSerialization; using JNPF.SpecificationDocument; using JNPF.TaskScheduler.Interfaces.TaskScheduler; -using JNPF.UnifyResult; using JNPF.VisualDev; -using Microsoft.AspNetCore.HttpOverrides; using Microsoft.Extensions.Options; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; using Senparc.CO2NET; using Senparc.CO2NET.RegisterServices; using Senparc.Weixin; using Senparc.Weixin.Entities; using Senparc.Weixin.RegisterServices; -using SqlSugar; using Tnb.ProductionMgr; using Tnb.WarehouseMgr; diff --git a/apihost/Tnb.API.Entry/Tnb.API.Entry.csproj b/apihost/Tnb.API.Entry/Tnb.API.Entry.csproj index e2a9a094..8267f70f 100644 --- a/apihost/Tnb.API.Entry/Tnb.API.Entry.csproj +++ b/apihost/Tnb.API.Entry/Tnb.API.Entry.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/app/Tnb.Apps.Entitys/Tnb.Apps.Entitys.csproj b/app/Tnb.Apps.Entitys/Tnb.Apps.Entitys.csproj index 08bcb7bf..91e9762b 100644 --- a/app/Tnb.Apps.Entitys/Tnb.Apps.Entitys.csproj +++ b/app/Tnb.Apps.Entitys/Tnb.Apps.Entitys.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/app/Tnb.Apps.Interfaces/Tnb.Apps.Interfaces.csproj b/app/Tnb.Apps.Interfaces/Tnb.Apps.Interfaces.csproj index 52320baa..f86b6da1 100644 --- a/app/Tnb.Apps.Interfaces/Tnb.Apps.Interfaces.csproj +++ b/app/Tnb.Apps.Interfaces/Tnb.Apps.Interfaces.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/app/Tnb.Apps/AppMenuService.cs b/app/Tnb.Apps/AppMenuService.cs index b276558b..1102d5a0 100644 --- a/app/Tnb.Apps/AppMenuService.cs +++ b/app/Tnb.Apps/AppMenuService.cs @@ -3,8 +3,8 @@ using JNPF.Apps.Interfaces; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using Microsoft.AspNetCore.Mvc; using Mapster; +using Microsoft.AspNetCore.Mvc; namespace JNPF.Apps; diff --git a/app/Tnb.Apps/Tnb.Apps.csproj b/app/Tnb.Apps/Tnb.Apps.csproj index 23b2954e..602d4ac6 100644 --- a/app/Tnb.Apps/Tnb.Apps.csproj +++ b/app/Tnb.Apps/Tnb.Apps.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/AlipayMpAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/AlipayMpAuthRequest.cs index 1be2a407..7fcdc5cb 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/AlipayMpAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/AlipayMpAuthRequest.cs @@ -1,10 +1,10 @@ -using JNPF.Extras.CollectiveOAuth.Config; -using JNPF.Extras.CollectiveOAuth.Models; -using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Cache; -using Aop.Api; +using Aop.Api; using Aop.Api.Request; using Aop.Api.Response; +using JNPF.Extras.CollectiveOAuth.Cache; +using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Models; +using JNPF.Extras.CollectiveOAuth.Utils; using Newtonsoft.Json; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/CodingAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/CodingAuthRequest.cs index e3a0da6f..95d3b9b4 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/CodingAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/CodingAuthRequest.cs @@ -1,8 +1,8 @@ -using JNPF.Extras.CollectiveOAuth.Cache; +using System.Net; +using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using System.Net; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/DingTalkScanAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/DingTalkScanAuthRequest.cs index c80983d5..3be3576b 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/DingTalkScanAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/DingTalkScanAuthRequest.cs @@ -1,13 +1,8 @@ -using JNPF.Extras.CollectiveOAuth.Cache; +using JNPF.Common.Security; +using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; -using Newtonsoft.Json; -using DingTalk.Api; -using DingTalk.Api.Response; -using DingTalk.Api.Request; -using JNPF.Common.Security; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/DouYinAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/DouYinAuthRequest.cs index 4b46cdd1..e38587ac 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/DouYinAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/DouYinAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/ElemeAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/ElemeAuthRequest.cs index cf0ad9a1..6a2769dc 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/ElemeAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/ElemeAuthRequest.cs @@ -1,10 +1,10 @@ -using JNPF.Extras.CollectiveOAuth.Cache; +using System.Security.Cryptography; +using System.Text; +using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; -using System.Text; -using System.Security.Cryptography; using Newtonsoft.Json; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/FeiShuAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/FeiShuAuthRequest.cs index 1181f506..b8dd6ba1 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/FeiShuAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/FeiShuAuthRequest.cs @@ -1,9 +1,9 @@ -using JNPF.Common.Security; +using System.Web; +using JNPF.Common.Security; using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using System.Web; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs index d3555c2a..7c8600cd 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/GithubAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/GitlabAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/GitlabAuthRequest.cs index 12ac6648..72c2a31d 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/GitlabAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/GitlabAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/GoogleAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/GoogleAuthRequest.cs index 9a70189c..7fde18c9 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/GoogleAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/GoogleAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/HuaweiAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/HuaweiAuthRequest.cs index b964f757..f4f2a30e 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/HuaweiAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/HuaweiAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; @@ -71,7 +71,7 @@ public class HuaweiAuthRequest : DefaultAuthRequest authUser.nickname = userObj.getString("userName"); authUser.gender = gender; authUser.avatar = userObj.getString("headPictureURL"); - + authUser.token = authToken; authUser.source = source.getName(); authUser.originalUser = userObj; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/KujialeAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/KujialeAuthRequest.cs index 5f658a17..b2bca70e 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/KujialeAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/KujialeAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/LinkedinAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/LinkedinAuthRequest.cs index f1fdc967..ceb9a4e9 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/LinkedinAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/LinkedinAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/MeituanAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/MeituanAuthRequest.cs index 7429d596..f49baf40 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/MeituanAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/MeituanAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/MicrosoftAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/MicrosoftAuthRequest.cs index 52bc26d1..8b8d07e6 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/MicrosoftAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/MicrosoftAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; using Newtonsoft.Json; namespace JNPF.Extras.CollectiveOAuth.Request; @@ -136,7 +136,7 @@ public class MicrosoftAuthRequest : DefaultAuthRequest * * @param authToken 用户授权后的token * @return 返回获取userInfo的url - */ + */ protected override string userInfoUrl(AuthToken authToken) { return UrlBuilder.fromBaseUrl(source.userInfo()).build(); diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/PinterestAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/PinterestAuthRequest.cs index b614d36b..7dce8614 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/PinterestAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/PinterestAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/QQAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/QQAuthRequest.cs index 92793fd6..5d6727d7 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/QQAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/QQAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/RenrenAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/RenrenAuthRequest.cs index 1de6cdc3..d65974da 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/RenrenAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/RenrenAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/StackOverflowAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/StackOverflowAuthRequest.cs index 97b40a6d..2bc0bba1 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/StackOverflowAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/StackOverflowAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/TeambitionAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/TeambitionAuthRequest.cs index c6fe9c1c..3c1396cc 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/TeambitionAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/TeambitionAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; @@ -74,7 +74,7 @@ public class TeambitionAuthRequest : DefaultAuthRequest return authUser; } - + public override AuthResponse refresh(AuthToken oldToken) { string uid = oldToken.uid; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/ToutiaoAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/ToutiaoAuthRequest.cs index 77104017..97fbf7e7 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/ToutiaoAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/ToutiaoAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseAuthRequest.cs index b36efbee..cc45525e 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseAuthRequest.cs @@ -12,7 +12,7 @@ public class WeChatEnterpriseAuthRequest : DefaultAuthRequest { } - public WeChatEnterpriseAuthRequest(ClientConfig config, IAuthStateCache authStateCache) + public WeChatEnterpriseAuthRequest(ClientConfig config, IAuthStateCache authStateCache) : base(config, new WechatEnterpriseAuthSource(), authStateCache) { } diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseScanAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseScanAuthRequest.cs index d0fafb1c..4bf1a8bd 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseScanAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatEnterpriseScanAuthRequest.cs @@ -61,7 +61,7 @@ public class WeChatEnterpriseScanAuthRequest : DefaultAuthRequest authUser.location = userDetailObj.getString("address"); authUser.email = userDetailObj.getString("email"); authUser.uuid = userDetailObj.getString("userId"); - if(authUser.uuid.IsNullOrWhiteSpace()) authUser.uuid = userDetailObj.getString("userid"); + if (authUser.uuid.IsNullOrWhiteSpace()) authUser.uuid = userDetailObj.getString("userid"); authUser.token = authToken; authUser.source = source.getName(); authUser.gender = GlobalAuthUtil.getWechatRealGender(userDetailObj.getString("gender")); diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatMpAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatMpAuthRequest.cs index bbbd3bed..9cfcfd92 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatMpAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatMpAuthRequest.cs @@ -1,8 +1,8 @@ -using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Cache; +using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; -using JNPF.Extras.CollectiveOAuth.Cache; namespace JNPF.Extras.CollectiveOAuth.Request; diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatOpenAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatOpenAuthRequest.cs index b9761019..683a4399 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatOpenAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeChatOpenAuthRequest.cs @@ -1,8 +1,8 @@ -using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Cache; +using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; -using JNPF.Extras.CollectiveOAuth.Cache; namespace JNPF.Extras.CollectiveOAuth.Request; @@ -12,7 +12,7 @@ public partial class WeChatOpenAuthRequest : DefaultAuthRequest { } - public WeChatOpenAuthRequest(ClientConfig config, IAuthStateCache authStateCache) + public WeChatOpenAuthRequest(ClientConfig config, IAuthStateCache authStateCache) : base(config, new WechatOpenAuthSource(), authStateCache) { } diff --git a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeiboAuthRequest.cs b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeiboAuthRequest.cs index 2fb525cb..e95e5b3a 100644 --- a/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeiboAuthRequest.cs +++ b/common/Tnb.CollectiveOAuth/Request/AuthRequests/WeiboAuthRequest.cs @@ -1,8 +1,8 @@ using JNPF.Extras.CollectiveOAuth.Cache; using JNPF.Extras.CollectiveOAuth.Config; +using JNPF.Extras.CollectiveOAuth.Enums; using JNPF.Extras.CollectiveOAuth.Models; using JNPF.Extras.CollectiveOAuth.Utils; -using JNPF.Extras.CollectiveOAuth.Enums; namespace JNPF.Extras.CollectiveOAuth.Request; @@ -46,7 +46,7 @@ public class WeiboAuthRequest : DefaultAuthRequest reqParams.Add("API-RemoteIP", "application/x-www-form-urlencoded"); string response = HttpUtils.RequestGet(userInfoUrl(authToken), reqParams); - + var userObj = response.parseObject(); if (userObj.ContainsKey("error")) { diff --git a/common/Tnb.CollectiveOAuth/Tnb.CollectiveOAuth.csproj b/common/Tnb.CollectiveOAuth/Tnb.CollectiveOAuth.csproj index c151ca4a..d6e59035 100644 --- a/common/Tnb.CollectiveOAuth/Tnb.CollectiveOAuth.csproj +++ b/common/Tnb.CollectiveOAuth/Tnb.CollectiveOAuth.csproj @@ -1,6 +1,4 @@  - - net6.0 enable diff --git a/common/Tnb.CollectiveOAuth/Utils/ConfigurationManager.cs b/common/Tnb.CollectiveOAuth/Utils/ConfigurationManager.cs index f8408026..20a18ad8 100644 --- a/common/Tnb.CollectiveOAuth/Utils/ConfigurationManager.cs +++ b/common/Tnb.CollectiveOAuth/Utils/ConfigurationManager.cs @@ -1,6 +1,6 @@ -using Newtonsoft.Json.Linq; -using System.Collections.Specialized; +using System.Collections.Specialized; using System.Text; +using Newtonsoft.Json.Linq; namespace JNPF.Extras.CollectiveOAuth.Utils; diff --git a/common/Tnb.CollectiveOAuth/Utils/GlobalAuthUtil.cs b/common/Tnb.CollectiveOAuth/Utils/GlobalAuthUtil.cs index f2e15340..375ebacc 100644 --- a/common/Tnb.CollectiveOAuth/Utils/GlobalAuthUtil.cs +++ b/common/Tnb.CollectiveOAuth/Utils/GlobalAuthUtil.cs @@ -1,7 +1,7 @@ -using JNPF.Extras.CollectiveOAuth.Enums; -using System.Text; -using Newtonsoft.Json; +using System.Text; using System.Web; +using JNPF.Extras.CollectiveOAuth.Enums; +using Newtonsoft.Json; namespace JNPF.Extras.CollectiveOAuth.Utils; diff --git a/common/Tnb.Common.Core/EventBus/Constants/EventSubscribeEventConsts.cs b/common/Tnb.Common.Core/EventBus/Constants/EventSubscribeEventConsts.cs index 6203f9ef..05bcd5b6 100644 --- a/common/Tnb.Common.Core/EventBus/Constants/EventSubscribeEventConsts.cs +++ b/common/Tnb.Common.Core/EventBus/Constants/EventSubscribeEventConsts.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.Common.Core.EventBus.Constants +namespace Tnb.Common.Core.EventBus.Constants { public class EventSubscribeEventConsts { diff --git a/common/Tnb.Common.Core/EventBus/Sources/TaskStatusChangeSource.cs b/common/Tnb.Common.Core/EventBus/Sources/TaskStatusChangeSource.cs index fde34ead..717116c3 100644 --- a/common/Tnb.Common.Core/EventBus/Sources/TaskStatusChangeSource.cs +++ b/common/Tnb.Common.Core/EventBus/Sources/TaskStatusChangeSource.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.EventBus; -using SqlSugar; +using JNPF.EventBus; namespace Tnb.Common.Core.EventBus.Sources { diff --git a/common/Tnb.Common.Core/EventBus/Storers/RabbitMQEventSourceStorer.cs b/common/Tnb.Common.Core/EventBus/Storers/RabbitMQEventSourceStorer.cs index 016b366e..8d7a6908 100644 --- a/common/Tnb.Common.Core/EventBus/Storers/RabbitMQEventSourceStorer.cs +++ b/common/Tnb.Common.Core/EventBus/Storers/RabbitMQEventSourceStorer.cs @@ -1,12 +1,12 @@ +using System.Text; +using System.Text.Json; +using System.Threading.Channels; using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.EventBus; using JNPF.Logging; using RabbitMQ.Client; using RabbitMQ.Client.Events; -using System.Text; -using System.Text.Json; -using System.Threading.Channels; namespace JNPF.EventHandler; diff --git a/common/Tnb.Common.Core/Filter/LogExceptionHandler.cs b/common/Tnb.Common.Core/Filter/LogExceptionHandler.cs index 2c019ac4..38f7a194 100644 --- a/common/Tnb.Common.Core/Filter/LogExceptionHandler.cs +++ b/common/Tnb.Common.Core/Filter/LogExceptionHandler.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Const; +using System.Security.Claims; +using JNPF.Common.Const; using JNPF.Common.Extension; using JNPF.Common.Net; using JNPF.Common.Security; @@ -8,9 +9,8 @@ using JNPF.EventBus; using JNPF.EventHandler; using JNPF.FriendlyException; using JNPF.Logging.Attributes; -using Microsoft.AspNetCore.Mvc.Filters; using JNPF.Systems.Entitys.System; -using System.Security.Claims; +using Microsoft.AspNetCore.Mvc.Filters; using SqlSugar; namespace JNPF.Common.Core.Filter; diff --git a/common/Tnb.Common.Core/Filter/RequestActionFilter.cs b/common/Tnb.Common.Core/Filter/RequestActionFilter.cs index 10cb0f5d..46d764a8 100644 --- a/common/Tnb.Common.Core/Filter/RequestActionFilter.cs +++ b/common/Tnb.Common.Core/Filter/RequestActionFilter.cs @@ -1,19 +1,19 @@ -using JNPF.Common.Const; +using System.Diagnostics; +using System.Security.Claims; +using JNPF.Common.Const; using JNPF.Common.Extension; using JNPF.Common.Net; using JNPF.Common.Security; using JNPF.DataEncryption; using JNPF.EventBus; using JNPF.EventHandler; +using JNPF.Logging; using JNPF.Logging.Attributes; using JNPF.Systems.Entitys.System; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; -using System.Diagnostics; -using System.Security.Claims; -using SqlSugar; using Microsoft.AspNetCore.Mvc.Controllers; -using JNPF.Logging; +using Microsoft.AspNetCore.Mvc.Filters; +using SqlSugar; namespace JNPF.Common.Core.Filter; diff --git a/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs b/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs index 2ce7223d..b51c4019 100644 --- a/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs +++ b/common/Tnb.Common.Core/Manager/DataBase/DataBaseManager.cs @@ -339,50 +339,50 @@ public class DataBaseManager : IDataBaseManager, ITransient //try //{ - int total = 0; + int total = 0; - if (_sqlSugarClient.CurrentConnectionConfig.DbType == SqlSugar.DbType.Oracle) strSql = strSql.Replace(";", string.Empty); + if (_sqlSugarClient.CurrentConnectionConfig.DbType == SqlSugar.DbType.Oracle) strSql = strSql.Replace(";", string.Empty); - var sidx = pageInput.sidx.IsNotEmptyOrNull() && pageInput.sort.IsNotEmptyOrNull(); // 按前端参数排序 - var defaultSidx = columnDesign.defaultSidx.IsNotEmptyOrNull() && columnDesign.sort.IsNotEmptyOrNull(); // 按模板默认排序 + var sidx = pageInput.sidx.IsNotEmptyOrNull() && pageInput.sort.IsNotEmptyOrNull(); // 按前端参数排序 + var defaultSidx = columnDesign.defaultSidx.IsNotEmptyOrNull() && columnDesign.sort.IsNotEmptyOrNull(); // 按模板默认排序 - var dataRuleJson = new List(); - if (pageInput.dataRuleJson.IsNotEmptyOrNull()) dataRuleJson = _sqlSugarClient.Utilities.JsonToConditionalModels(pageInput.dataRuleJson); + var dataRuleJson = new List(); + if (pageInput.dataRuleJson.IsNotEmptyOrNull()) dataRuleJson = _sqlSugarClient.Utilities.JsonToConditionalModels(pageInput.dataRuleJson); - var querJson = new List(); - if (pageInput.queryJson.IsNotEmptyOrNull()) querJson = _sqlSugarClient.Utilities.JsonToConditionalModels(pageInput.queryJson); + var querJson = new List(); + if (pageInput.queryJson.IsNotEmptyOrNull()) querJson = _sqlSugarClient.Utilities.JsonToConditionalModels(pageInput.queryJson); - var superQueryJson = new List(); - if (pageInput.superQueryJson.IsNotEmptyOrNull()) superQueryJson = _sqlSugarClient.Utilities.JsonToConditionalModels(pageInput.superQueryJson); - // var sql = _sqlSugarClient.SqlQueryable(strSql) - // .Where(dataRuleJson).Where(querJson).Where(superQueryJson).Where(dataPermissions).ToSqlString(); - DataTable dt = _sqlSugarClient.SqlQueryable(strSql) - .Where(dataRuleJson).Where(querJson).Where(superQueryJson).Where(dataPermissions) - .OrderByIF(sidx, pageInput.sidx + " " + pageInput.sort).OrderByIF(!sidx && defaultSidx, columnDesign.defaultSidx + " " + columnDesign.sort) - .ToDataTablePage(pageInput.currentPage, pageInput.pageSize, ref total); + var superQueryJson = new List(); + if (pageInput.superQueryJson.IsNotEmptyOrNull()) superQueryJson = _sqlSugarClient.Utilities.JsonToConditionalModels(pageInput.superQueryJson); + // var sql = _sqlSugarClient.SqlQueryable(strSql) + // .Where(dataRuleJson).Where(querJson).Where(superQueryJson).Where(dataPermissions).ToSqlString(); + DataTable dt = _sqlSugarClient.SqlQueryable(strSql) + .Where(dataRuleJson).Where(querJson).Where(superQueryJson).Where(dataPermissions) + .OrderByIF(sidx, pageInput.sidx + " " + pageInput.sort).OrderByIF(!sidx && defaultSidx, columnDesign.defaultSidx + " " + columnDesign.sort) + .ToDataTablePage(pageInput.currentPage, pageInput.pageSize, ref total); - // 如果有字段别名 替换 ColumnName - if (outColumnName != null && outColumnName.Count > 0) + // 如果有字段别名 替换 ColumnName + if (outColumnName != null && outColumnName.Count > 0) + { + var resultKey = string.Empty; + for (var i = 0; i < dt.Columns.Count; i++) + dt.Columns[i].ColumnName = outColumnName.TryGetValue(dt.Columns[i].ColumnName.ToUpper(), out resultKey) == true ? outColumnName[dt.Columns[i].ColumnName.ToUpper()] : dt.Columns[i].ColumnName.ToUpper(); + } + + var data = new PageResult>() + { + pagination = new PageResult() { - var resultKey = string.Empty; - for (var i = 0; i < dt.Columns.Count; i++) - dt.Columns[i].ColumnName = outColumnName.TryGetValue(dt.Columns[i].ColumnName.ToUpper(), out resultKey) == true ? outColumnName[dt.Columns[i].ColumnName.ToUpper()] : dt.Columns[i].ColumnName.ToUpper(); - } + currentPage = pageInput.currentPage, + pageSize = pageInput.pageSize, + total = total + }, + list = dt.ToObject>>().ToObject>>() + }; - var data = new PageResult>() - { - pagination = new PageResult() - { - currentPage = pageInput.currentPage, - pageSize = pageInput.pageSize, - total = total - }, - list = dt.ToObject>>().ToObject>>() - }; + _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); - _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); - - return data; + return data; //} //catch (Exception ex) //{ @@ -456,15 +456,15 @@ public class DataBaseManager : IDataBaseManager, ITransient _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); return list.Adapt>(); } - - public List GetPrimaries(DbLinkEntity? link, string tableName) + + public List GetPrimaries(DbLinkEntity? link, string tableName) { if (link != null && _sqlSugarClient.CurrentConnectionConfig.ConfigId != link.Id) - _sqlSugarClient = ChangeDataBase(link); + _sqlSugarClient = ChangeDataBase(link); var data = _sqlSugarClient.DbMaintenance.GetPrimaries(tableName); - _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); - return data; + _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); + return data; } /// @@ -597,7 +597,7 @@ public class DataBaseManager : IDataBaseManager, ITransient //var modelList = _sqlSugarClient.Ado.SqlQuery(sql).ToList(); var modelList = _sqlSugarClient.Ado.SqlQuery(sql).ToList(); //return modelList.Select(x => new DatabaseTableListOutput { table = x.F_TABLE, tableName = x.F_TABLENAME, sum = x.F_SUM.ParseToInt() }).ToList(); - _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); + _sqlSugarClient.ChangeDatabase(_connectionStrings.ConfigId); return modelList; } diff --git a/common/Tnb.Common.Core/Manager/DataBase/IDataBaseManager.cs b/common/Tnb.Common.Core/Manager/DataBase/IDataBaseManager.cs index baeba4e2..5e2723df 100644 --- a/common/Tnb.Common.Core/Manager/DataBase/IDataBaseManager.cs +++ b/common/Tnb.Common.Core/Manager/DataBase/IDataBaseManager.cs @@ -80,7 +80,7 @@ public interface IDataBaseManager /// /// 表名. /// 表字段集合. - void AddTableColumn(DbLinkEntity link ,string tableName, List tableFieldList); + void AddTableColumn(DbLinkEntity link, string tableName, List tableFieldList); /// /// 删除表. diff --git a/common/Tnb.Common.Core/Manager/Files/FileManager.cs b/common/Tnb.Common.Core/Manager/Files/FileManager.cs index b96df78c..b0ed00d7 100644 --- a/common/Tnb.Common.Core/Manager/Files/FileManager.cs +++ b/common/Tnb.Common.Core/Manager/Files/FileManager.cs @@ -1,5 +1,4 @@ -using System.IO; -using System.Text; +using System.Text; using JNPF.Common.Configuration; using JNPF.Common.Enums; using JNPF.Common.Extension; @@ -321,7 +320,8 @@ namespace JNPF.Common.Core.Manager.Files var stream = new MemoryStream(byteList); await UploadFileByType(stream, _filePath, _fileName); _cacheManager.Set(_fileName, string.Empty); - return new { + return new + { name = _fileName, url = string.Format("/api/file/Download?encryption={0}", DESCEncryption.Encrypt(string.Format("{0}|{1}|json", _userManager.UserId, _fileName), "JNPF")) }; diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.cs b/common/Tnb.Common.Core/Manager/User/UserManager.cs index 0b202ff7..cd6974f0 100644 --- a/common/Tnb.Common.Core/Manager/User/UserManager.cs +++ b/common/Tnb.Common.Core/Manager/User/UserManager.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Const; +using System.Security.Claims; +using JNPF.Common.Const; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Manager; @@ -14,7 +15,6 @@ using JNPF.Systems.Entitys.System; using Mapster; using Microsoft.AspNetCore.Http; using SqlSugar; -using System.Security.Claims; namespace JNPF.Common.Core.Manager; diff --git a/common/Tnb.Common.Core/Manager/User/UserManager.part.cs b/common/Tnb.Common.Core/Manager/User/UserManager.part.cs index 18b70051..a36fd66a 100644 --- a/common/Tnb.Common.Core/Manager/User/UserManager.part.cs +++ b/common/Tnb.Common.Core/Manager/User/UserManager.part.cs @@ -1,22 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Enums; -using JNPF.Common.Extension; -using JNPF.Common.Manager; -using JNPF.Common.Models.Authorize; -using JNPF.Common.Models.User; -using JNPF.Common.Net; -using JNPF.Common.Security; -using JNPF.DataEncryption; -using JNPF.DependencyInjection; -using JNPF.Systems.Entitys.Entity.Permission; -using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Entitys.System; -using Mapster; -using Microsoft.AspNetCore.Http; -using SqlSugar; -using System.Security.Claims; - -namespace JNPF.Common.Core.Manager; +namespace JNPF.Common.Core.Manager; /// /// 用户管理 . diff --git a/common/Tnb.Common.Core/Tnb.Common.Core.csproj b/common/Tnb.Common.Core/Tnb.Common.Core.csproj index 71303e8b..08b9033e 100644 --- a/common/Tnb.Common.Core/Tnb.Common.Core.csproj +++ b/common/Tnb.Common.Core/Tnb.Common.Core.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/common/Tnb.Common/Cache/MemoryCache.cs b/common/Tnb.Common/Cache/MemoryCache.cs index 7f982516..4e243ab1 100644 --- a/common/Tnb.Common/Cache/MemoryCache.cs +++ b/common/Tnb.Common/Cache/MemoryCache.cs @@ -1,6 +1,6 @@ -using JNPF.DependencyInjection; +using System.Reflection; +using JNPF.DependencyInjection; using Microsoft.Extensions.Caching.Memory; -using System.Reflection; namespace JNPF.Common.Cache; diff --git a/common/Tnb.Common/Cache/RedisCache.cs b/common/Tnb.Common/Cache/RedisCache.cs index a57fe0c5..4a177bbd 100644 --- a/common/Tnb.Common/Cache/RedisCache.cs +++ b/common/Tnb.Common/Cache/RedisCache.cs @@ -226,7 +226,7 @@ public class RedisCache : ICache, ISingleton } public Task GetHash(string key, string field) { - return RedisHelper.HGetAsync(key, field); + return RedisHelper.HGetAsync(key, field); } public Task HashExist(string key, string field) { @@ -238,6 +238,6 @@ public class RedisCache : ICache, ISingleton } public Task HSet(string key, string field, string value) { - return RedisHelper.HSetAsync(key, field,value); + return RedisHelper.HSetAsync(key, field, value); } } \ No newline at end of file diff --git a/common/Tnb.Common/Captcha/General/GeneralCaptcha.cs b/common/Tnb.Common/Captcha/General/GeneralCaptcha.cs index 934c957b..6bfa8bbc 100644 --- a/common/Tnb.Common/Captcha/General/GeneralCaptcha.cs +++ b/common/Tnb.Common/Captcha/General/GeneralCaptcha.cs @@ -1,8 +1,8 @@ -using JNPF.Common.Const; -using JNPF.Common.Manager; +using System.Runtime.InteropServices; +using JNPF.Common.Const; using JNPF.Common.Extension; +using JNPF.Common.Manager; using JNPF.DependencyInjection; -using System.Runtime.InteropServices; using SkiaSharp; namespace JNPF.Common.Captcha.General; diff --git a/common/Tnb.Common/Contracts/BaseEntity`1.cs b/common/Tnb.Common/Contracts/BaseEntity`1.cs index b74bb002..1f20b6e3 100644 --- a/common/Tnb.Common/Contracts/BaseEntity`1.cs +++ b/common/Tnb.Common/Contracts/BaseEntity`1.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Security; -using SqlSugar; +using SqlSugar; namespace JNPF.Common.Contracts; @@ -16,6 +10,6 @@ public class BaseEntity : IEntity where TKey : IEquatable [SugarColumn(ColumnName = "id", ColumnDescription = "主键", IsPrimaryKey = true)] public TKey id { get; set; } - + } diff --git a/common/Tnb.Common/Contracts/CEntityBase.cs b/common/Tnb.Common/Contracts/CEntityBase.cs index da3cbe15..57037ec5 100644 --- a/common/Tnb.Common/Contracts/CEntityBase.cs +++ b/common/Tnb.Common/Contracts/CEntityBase.cs @@ -1,7 +1,6 @@ using JNPF.Common.Const; using JNPF.Common.Security; using JNPF.DependencyInjection; -using JNPF.Extras.DatabaseAccessor.SqlSugar.Models; using SqlSugar; namespace JNPF.Common.Contracts; diff --git a/common/Tnb.Common/DataValidation/Check.cs b/common/Tnb.Common/DataValidation/Check.cs index cc102ead..b583e8c3 100644 --- a/common/Tnb.Common/DataValidation/Check.cs +++ b/common/Tnb.Common/DataValidation/Check.cs @@ -1,7 +1,4 @@ -using JetBrains.Annotations; -using System; -using System.Collections.Generic; -using System.Diagnostics; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; namespace Tnb.Common; @@ -159,11 +156,11 @@ public static class Check short value, string parameterName) { - if(value == 0) + if (value == 0) { throw new ArgumentException($"{parameterName} is equal to zero"); } - else if(value < 0) + else if (value < 0) { throw new ArgumentException($"{parameterName} is less than zero"); } @@ -251,7 +248,7 @@ public static class Check Int16 minimumValue, Int16 maximumValue = Int16.MaxValue) { - if(value < minimumValue || value > maximumValue) + if (value < minimumValue || value > maximumValue) { throw new ArgumentException($"{parameterName} is out of range min: {minimumValue} - max: {maximumValue}"); } diff --git a/common/Tnb.Common/Dtos/VisualDev/VisualDevModelDataCrInput.cs b/common/Tnb.Common/Dtos/VisualDev/VisualDevModelDataCrInput.cs index c58b1dca..d2f4ea7a 100644 --- a/common/Tnb.Common/Dtos/VisualDev/VisualDevModelDataCrInput.cs +++ b/common/Tnb.Common/Dtos/VisualDev/VisualDevModelDataCrInput.cs @@ -7,7 +7,7 @@ namespace JNPF.Common.Dtos.VisualDev; /// 在线功能开发数据创建输入. /// [SuppressSniffer] -public class VisualDevModelDataCrInput: FlowTaskOtherModel +public class VisualDevModelDataCrInput : FlowTaskOtherModel { /// /// 数据. diff --git a/common/Tnb.Common/Enums/AccountType.cs b/common/Tnb.Common/Enums/AccountType.cs index 05d9f4da..f7c0e284 100644 --- a/common/Tnb.Common/Enums/AccountType.cs +++ b/common/Tnb.Common/Enums/AccountType.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/FileLocation.cs b/common/Tnb.Common/Enums/FileLocation.cs index 6d986468..5ade4e5c 100644 --- a/common/Tnb.Common/Enums/FileLocation.cs +++ b/common/Tnb.Common/Enums/FileLocation.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/Gender.cs b/common/Tnb.Common/Enums/Gender.cs index 804c5c5a..459276e2 100644 --- a/common/Tnb.Common/Enums/Gender.cs +++ b/common/Tnb.Common/Enums/Gender.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/HttpStatusCode.cs b/common/Tnb.Common/Enums/HttpStatusCode.cs index c6675dc3..fc5fcd7a 100644 --- a/common/Tnb.Common/Enums/HttpStatusCode.cs +++ b/common/Tnb.Common/Enums/HttpStatusCode.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/LoginMethod.cs b/common/Tnb.Common/Enums/LoginMethod.cs index 0bab083e..773b1f8c 100644 --- a/common/Tnb.Common/Enums/LoginMethod.cs +++ b/common/Tnb.Common/Enums/LoginMethod.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/NoticeStatus.cs b/common/Tnb.Common/Enums/NoticeStatus.cs index c3a465b6..235ce52d 100644 --- a/common/Tnb.Common/Enums/NoticeStatus.cs +++ b/common/Tnb.Common/Enums/NoticeStatus.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/NoticeUserStatus.cs b/common/Tnb.Common/Enums/NoticeUserStatus.cs index a394e3d8..7bbbd754 100644 --- a/common/Tnb.Common/Enums/NoticeUserStatus.cs +++ b/common/Tnb.Common/Enums/NoticeUserStatus.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/PreviewType.cs b/common/Tnb.Common/Enums/PreviewType.cs index b20fb5a9..ceea0446 100644 --- a/common/Tnb.Common/Enums/PreviewType.cs +++ b/common/Tnb.Common/Enums/PreviewType.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/QueryType.cs b/common/Tnb.Common/Enums/QueryType.cs index af367735..a9b5d6bb 100644 --- a/common/Tnb.Common/Enums/QueryType.cs +++ b/common/Tnb.Common/Enums/QueryType.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Common.Enums; diff --git a/common/Tnb.Common/Enums/RequestType.cs b/common/Tnb.Common/Enums/RequestType.cs index 45154e1c..9044284e 100644 --- a/common/Tnb.Common/Enums/RequestType.cs +++ b/common/Tnb.Common/Enums/RequestType.cs @@ -22,7 +22,7 @@ public enum RequestType /// POST请求. /// Run = 2, - + /// /// 本地方法 /// diff --git a/common/Tnb.Common/Extension/ConcurrentDictionaryExtensions.cs b/common/Tnb.Common/Extension/ConcurrentDictionaryExtensions.cs index 77775dca..06c1ccca 100644 --- a/common/Tnb.Common/Extension/ConcurrentDictionaryExtensions.cs +++ b/common/Tnb.Common/Extension/ConcurrentDictionaryExtensions.cs @@ -1,7 +1,7 @@ -using JNPF.DependencyInjection; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.Dynamic; using System.Reflection; +using JNPF.DependencyInjection; using Newtonsoft.Json; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/ConfigurationExtensions.cs b/common/Tnb.Common/Extension/ConfigurationExtensions.cs index d0c8173d..4f3906f0 100644 --- a/common/Tnb.Common/Extension/ConfigurationExtensions.cs +++ b/common/Tnb.Common/Extension/ConfigurationExtensions.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Configuration; namespace Tnb.Common.Extension { diff --git a/common/Tnb.Common/Extension/DictionaryExtensions.cs b/common/Tnb.Common/Extension/DictionaryExtensions.cs index d01410dd..2c715227 100644 --- a/common/Tnb.Common/Extension/DictionaryExtensions.cs +++ b/common/Tnb.Common/Extension/DictionaryExtensions.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/EnumExtensions.cs b/common/Tnb.Common/Extension/EnumExtensions.cs index 891eb758..da3d0314 100644 --- a/common/Tnb.Common/Extension/EnumExtensions.cs +++ b/common/Tnb.Common/Extension/EnumExtensions.cs @@ -1,8 +1,8 @@ -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using System.Collections.Concurrent; +using System.Collections.Concurrent; using System.ComponentModel; using System.Reflection; +using JNPF.Common.Security; +using JNPF.DependencyInjection; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/EnumerableExtensions.cs b/common/Tnb.Common/Extension/EnumerableExtensions.cs index 54ff27bb..6f4c9688 100644 --- a/common/Tnb.Common/Extension/EnumerableExtensions.cs +++ b/common/Tnb.Common/Extension/EnumerableExtensions.cs @@ -1,8 +1,5 @@ -using JNPF.DependencyInjection; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Text; +using JNPF.DependencyInjection; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/LambdaExpressionExtensions.cs b/common/Tnb.Common/Extension/LambdaExpressionExtensions.cs index c4c0ddd9..a87f09b4 100644 --- a/common/Tnb.Common/Extension/LambdaExpressionExtensions.cs +++ b/common/Tnb.Common/Extension/LambdaExpressionExtensions.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; +using System.Linq.Expressions; namespace JNPF.Common.Extension { @@ -55,7 +50,7 @@ namespace JNPF.Common.Extension var castPropertyValue = Expression.Convert(propertyValue, property!.PropertyType); var assignExp = Expression.Assign(propExp, castPropertyValue); - return Expression.Lambda>(assignExp, new[] { target,propertyValue }).Compile(); + return Expression.Lambda>(assignExp, new[] { target, propertyValue }).Compile(); } } diff --git a/common/Tnb.Common/Extension/StreamExtensions.cs b/common/Tnb.Common/Extension/StreamExtensions.cs index a5835f44..f86207aa 100644 --- a/common/Tnb.Common/Extension/StreamExtensions.cs +++ b/common/Tnb.Common/Extension/StreamExtensions.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.Text; +using System.Text; +using JNPF.DependencyInjection; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/StringBuilderExtensions.cs b/common/Tnb.Common/Extension/StringBuilderExtensions.cs index 69899427..bc50f3e6 100644 --- a/common/Tnb.Common/Extension/StringBuilderExtensions.cs +++ b/common/Tnb.Common/Extension/StringBuilderExtensions.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.Text; +using System.Text; +using JNPF.DependencyInjection; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/StringExtensions.cs b/common/Tnb.Common/Extension/StringExtensions.cs index 0541e0f1..e58c88de 100644 --- a/common/Tnb.Common/Extension/StringExtensions.cs +++ b/common/Tnb.Common/Extension/StringExtensions.cs @@ -1,11 +1,11 @@ -using JNPF.Common.Security; -using JNPF.DependencyInjection; -using System.Diagnostics; +using System.Diagnostics; using System.Globalization; -using System.Text.Json; using System.Text; +using System.Text.Json; using System.Text.RegularExpressions; using System.Web; +using JNPF.Common.Security; +using JNPF.DependencyInjection; namespace JNPF.Common.Extension; diff --git a/common/Tnb.Common/Extension/TaskExtensions.cs b/common/Tnb.Common/Extension/TaskExtensions.cs index 96f5a278..28b01717 100644 --- a/common/Tnb.Common/Extension/TaskExtensions.cs +++ b/common/Tnb.Common/Extension/TaskExtensions.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.Common.Extension +namespace Tnb.Common.Extension { public static class TaskEx { @@ -25,7 +19,7 @@ namespace Tnb.Common.Extension return tcs.Task; } - public static async Task Retry(Func> task, int retries, + public static async Task Retry(Func> task, int retries, TimeSpan delay, CancellationToken cts = default) => await task().ContinueWith(async innerTask => { @@ -40,7 +34,7 @@ namespace Tnb.Common.Extension - public static async Task Catch(this Task task, Func exceptionHandler) + public static async Task Catch(this Task task, Func exceptionHandler) { try { diff --git a/common/Tnb.Common/Extension/TnbStringExtensions.cs b/common/Tnb.Common/Extension/TnbStringExtensions.cs index 8be6669e..25e9d5d8 100644 --- a/common/Tnb.Common/Extension/TnbStringExtensions.cs +++ b/common/Tnb.Common/Extension/TnbStringExtensions.cs @@ -1,6 +1,5 @@ using System.Text.RegularExpressions; using JNPF.Common.Extension; -using Microsoft.CodeAnalysis.CSharp.Syntax; namespace System; @@ -188,7 +187,7 @@ public static class StringExtensions public static (string, string) LastSplit(this string str, char seperate) { int n = str.LastIndexOf(seperate); - if(n > 0) + if (n > 0) { return (str.Substring(0, n), str.Substring(n + 1)); } diff --git a/common/Tnb.Common/Models/NPOI/ExcelColumnModel.cs b/common/Tnb.Common/Models/NPOI/ExcelColumnModel.cs index 394a2a52..4d665ed8 100644 --- a/common/Tnb.Common/Models/NPOI/ExcelColumnModel.cs +++ b/common/Tnb.Common/Models/NPOI/ExcelColumnModel.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.Drawing; +using System.Drawing; +using JNPF.DependencyInjection; namespace JNPF.Common.Models.NPOI; diff --git a/common/Tnb.Common/Models/SocialsLoginConfigModel.cs b/common/Tnb.Common/Models/SocialsLoginConfigModel.cs index ae261a9e..ad27fc48 100644 --- a/common/Tnb.Common/Models/SocialsLoginConfigModel.cs +++ b/common/Tnb.Common/Models/SocialsLoginConfigModel.cs @@ -1,6 +1,4 @@ -using NPOI.SS.Formula.Functions; - -namespace JNPF.Common.Models; +namespace JNPF.Common.Models; /// /// 通用登录配置-第三方登录配置. diff --git a/common/Tnb.Common/Net/IUserAgent.cs b/common/Tnb.Common/Net/IUserAgent.cs index 42d0611c..74f7a792 100644 --- a/common/Tnb.Common/Net/IUserAgent.cs +++ b/common/Tnb.Common/Net/IUserAgent.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -namespace JNPF.Common.Net; +namespace JNPF.Common.Net; public interface IUserAgent { diff --git a/common/Tnb.Common/Options/ConfigureSwaggerUIOptions.cs b/common/Tnb.Common/Options/ConfigureSwaggerUIOptions.cs index 2b17b266..6705209c 100644 --- a/common/Tnb.Common/Options/ConfigureSwaggerUIOptions.cs +++ b/common/Tnb.Common/Options/ConfigureSwaggerUIOptions.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Options; using Swashbuckle.AspNetCore.SwaggerUI; diff --git a/common/Tnb.Common/Options/OauthOptions.cs b/common/Tnb.Common/Options/OauthOptions.cs index c6017eb2..86a3f094 100644 --- a/common/Tnb.Common/Options/OauthOptions.cs +++ b/common/Tnb.Common/Options/OauthOptions.cs @@ -1,7 +1,4 @@ -using Aspose.Cells; -using JNPF.Common.Enums; -using JNPF.ConfigurableOptions; -using NPOI.SS.Formula.Functions; +using JNPF.ConfigurableOptions; namespace JNPF.Common.Options; diff --git a/common/Tnb.Common/Options/SocialsOptions.cs b/common/Tnb.Common/Options/SocialsOptions.cs index 56732d7d..ed95d457 100644 --- a/common/Tnb.Common/Options/SocialsOptions.cs +++ b/common/Tnb.Common/Options/SocialsOptions.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Enums; -using JNPF.ConfigurableOptions; +using JNPF.ConfigurableOptions; namespace JNPF.Common.Options; diff --git a/common/Tnb.Common/Security/CodeGenExportDataHelper.cs b/common/Tnb.Common/Security/CodeGenExportDataHelper.cs index 61b8e36a..5034d7bf 100644 --- a/common/Tnb.Common/Security/CodeGenExportDataHelper.cs +++ b/common/Tnb.Common/Security/CodeGenExportDataHelper.cs @@ -1,6 +1,5 @@ using System.Text.RegularExpressions; using JNPF.Common.Configuration; -using JNPF.Common.Extension; using JNPF.Common.Models.NPOI; using JNPF.DataEncryption; using JNPF.DependencyInjection; diff --git a/common/Tnb.Common/Security/ExcelImportHelper.cs b/common/Tnb.Common/Security/ExcelImportHelper.cs index 1d1deff8..77b164b1 100644 --- a/common/Tnb.Common/Security/ExcelImportHelper.cs +++ b/common/Tnb.Common/Security/ExcelImportHelper.cs @@ -1,8 +1,8 @@ -using JNPF.DependencyInjection; +using System.Data; +using JNPF.DependencyInjection; using NPOI.HSSF.UserModel; using NPOI.SS.UserModel; using NPOI.XSSF.UserModel; -using System.Data; namespace JNPF.Common.Helper { @@ -10,7 +10,7 @@ namespace JNPF.Common.Helper /// Excel导入操作类 /// 版 本:V3.2.0 /// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com) - /// 日 期:2017.03.12. + /// 日 期:2017.03.12. /// [SuppressSniffer] public class ExcelImportHelper @@ -108,7 +108,7 @@ namespace JNPF.Common.Helper //} //else //{ - dataRow[j] = cell.ToString()?.Trim(); + dataRow[j] = cell.ToString()?.Trim(); //} } } @@ -134,7 +134,7 @@ namespace JNPF.Common.Helper sheet = null; } #region 清除最后的空行 - for (int i = table.Rows.Count-1; i >= 0; i--) + for (int i = table.Rows.Count - 1; i >= 0; i--) { bool isnull = true; for (int j = 0; j < table.Columns.Count; j++) diff --git a/common/Tnb.Common/Security/FileHelper.cs b/common/Tnb.Common/Security/FileHelper.cs index 55d4b8d8..06985c42 100644 --- a/common/Tnb.Common/Security/FileHelper.cs +++ b/common/Tnb.Common/Security/FileHelper.cs @@ -1,11 +1,11 @@ -using JNPF.Common.Configuration; -using JNPF.Common.Extension; -using JNPF.Common.Models; -using JNPF.DependencyInjection; -using System.Drawing; +using System.Drawing; using System.Drawing.Imaging; using System.Text; using System.Web; +using JNPF.Common.Configuration; +using JNPF.Common.Extension; +using JNPF.Common.Models; +using JNPF.DependencyInjection; namespace JNPF.Common.Security; diff --git a/common/Tnb.Common/Security/NetHelper.cs b/common/Tnb.Common/Security/NetHelper.cs index 6424734f..9444de66 100644 --- a/common/Tnb.Common/Security/NetHelper.cs +++ b/common/Tnb.Common/Security/NetHelper.cs @@ -1,7 +1,6 @@ using System.Net.NetworkInformation; using System.Text; using JNPF.DependencyInjection; -using JNPF.JsonSerialization; using JNPF.RemoteRequest.Extensions; using Microsoft.AspNetCore.Http; diff --git a/common/Tnb.Common/Security/PinyinHelper.cs b/common/Tnb.Common/Security/PinyinHelper.cs index fe4ea1c5..1d862a43 100644 --- a/common/Tnb.Common/Security/PinyinHelper.cs +++ b/common/Tnb.Common/Security/PinyinHelper.cs @@ -108,16 +108,16 @@ public class PinyinHelper #region 汉字转换成全拼的拼音 - /// - /// 汉字转换成全拼的拼音. - /// - /// - /// - public static string Pinyin(string Chstr) - { - // 定义拼音区编码数组 - int[] getValue = new int[] + /// + /// 汉字转换成全拼的拼音. + /// + /// + /// + public static string Pinyin(string Chstr) { + // 定义拼音区编码数组 + int[] getValue = new int[] + { -20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, -20032, -20026, -20002, -19990, -19986, -19982, -19976, -19805, -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741, -19739, -19728, -19725, -19715, -19540, -19531, -19525, -19515, @@ -151,11 +151,11 @@ public class PinyinHelper -11055, -11052, -11045, -11041, -11038, -11024, -11020, -11019, -11018, -11014, -10838, -10832, -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533, -10519, -10331, -10329, -10328, -10322, -10315, -10309, -10307, -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254 - }; + }; - // 定义拼音数组 - string[] getName = new string[] - { + // 定义拼音数组 + string[] getName = new string[] + { "A", "Ai", "An", "Ang", "Ao", "Ba", "Bai", "Ban", "Bang", "Bao", "Bei", "Ben", "Beng", "Bi", "Bian", "Biao", "Bie", "Bin", "Bing", "Bo", "Bu", "Ba", "Cai", "Can", "Cang", "Cao", "Ce", "Ceng", "Cha", "Chai", "Chan", "Chang", "Chao", "Che", "Chen", "Cheng", @@ -189,7 +189,7 @@ public class PinyinHelper "Za", "Zai", "Zan", "Zang", "Zao", "Ze", "Zei", "Zen", "Zeng", "Zha", "Zhai", "Zhan", "Zhang", "Zhao", "Zhe", "Zhen", "Zheng", "Zhi", "Zhong", "Zhou", "Zhu", "Zhua", "Zhuai", "Zhuan", "Zhuang", "Zhui", "Zhun", "Zhuo", "Zi", "Zong", "Zou", "Zu", "Zuan", "Zui", "Zun", "Zuo" - }; + }; // 验证是否输入汉字 Regex reg = new Regex("^[\u4e00-\u9fa5]$"); diff --git a/common/Tnb.Common/Security/QueryTreeHelper.cs b/common/Tnb.Common/Security/QueryTreeHelper.cs index 9c2497d5..3baf070b 100644 --- a/common/Tnb.Common/Security/QueryTreeHelper.cs +++ b/common/Tnb.Common/Security/QueryTreeHelper.cs @@ -1,6 +1,6 @@ -using JNPF.DependencyInjection; -using System.Data; +using System.Data; using System.Reflection; +using JNPF.DependencyInjection; namespace JNPF.Common.Security; diff --git a/common/Tnb.Common/Security/SnowflakeIdHelper.cs b/common/Tnb.Common/Security/SnowflakeIdHelper.cs index 211fe01d..e3bf078f 100644 --- a/common/Tnb.Common/Security/SnowflakeIdHelper.cs +++ b/common/Tnb.Common/Security/SnowflakeIdHelper.cs @@ -1,7 +1,5 @@ using System.Runtime.InteropServices; using JNPF.Common.Cache; -using JNPF.Common.Const; -using JNPF.FriendlyException; using Yitter.IdGenerator; namespace JNPF.Common.Security; @@ -11,56 +9,56 @@ namespace JNPF.Common.Security; /// public class SnowflakeIdHelper { - // 定义dll路径 - public const string RegWorkerId_DLL_NAME = "lib\\regworkerid_lib_v1.3.1\\yitidgengo.dll"; + // 定义dll路径 + public const string RegWorkerId_DLL_NAME = "lib\\regworkerid_lib_v1.3.1\\yitidgengo.dll"; - // 根据文档定义三个接口 + // 根据文档定义三个接口 - // 注册一个 WorkerId,会先注销所有本机已注册的记录 - // ip: redis 服务器地址 - // port: redis 端口 - // password: redis 访问密码,可为空字符串“” - // maxWorkerId: 最大 WorkerId - [DllImport(RegWorkerId_DLL_NAME, EntryPoint = "RegisterOne", CallingConvention = CallingConvention.Cdecl, ExactSpelling = false)] - private static extern ushort RegisterOne(string ip, int port, string password, int maxWorkerId); + // 注册一个 WorkerId,会先注销所有本机已注册的记录 + // ip: redis 服务器地址 + // port: redis 端口 + // password: redis 访问密码,可为空字符串“” + // maxWorkerId: 最大 WorkerId + [DllImport(RegWorkerId_DLL_NAME, EntryPoint = "RegisterOne", CallingConvention = CallingConvention.Cdecl, ExactSpelling = false)] + private static extern ushort RegisterOne(string ip, int port, string password, int maxWorkerId); - // 注销本机已注册的 WorkerId - [DllImport(RegWorkerId_DLL_NAME, EntryPoint = "UnRegister", CallingConvention = CallingConvention.Cdecl, ExactSpelling = false)] - private static extern void UnRegister(); + // 注销本机已注册的 WorkerId + [DllImport(RegWorkerId_DLL_NAME, EntryPoint = "UnRegister", CallingConvention = CallingConvention.Cdecl, ExactSpelling = false)] + private static extern void UnRegister(); - // 检查本地WorkerId是否有效(0-有效,其它-无效) - [DllImport(RegWorkerId_DLL_NAME, EntryPoint = "Validate", CallingConvention = CallingConvention.Cdecl, ExactSpelling = false)] - private static extern int Validate(int workerId); + // 检查本地WorkerId是否有效(0-有效,其它-无效) + [DllImport(RegWorkerId_DLL_NAME, EntryPoint = "Validate", CallingConvention = CallingConvention.Cdecl, ExactSpelling = false)] + private static extern int Validate(int workerId); - /// - /// 初始化YitId配置 - /// - public static void InitYitIdWorker() - { - //var option = new IdGeneratorOptions - //{ - // WorkerId = 1, //必须 全局唯一,必须 程序设定,理论最大值 2^WorkerIdBitLength-1 - // //BaseTime = new DateTime(2023, 1, 1, 0, 0, 0, DateTimeKind.Utc), //用生成ID时的系统时间与基础时间的差值(毫秒数)作为生成ID的时间戳 - // WorkerIdBitLength = 16, //机器码位长,决定 WorkerId 的最大值,默认值6,取值范围 [1, 16] - // //SeqBitLength = 4, //序列数位长,默认值6,取值范围 [3, 21](建议不小于4),决定每毫秒基础生成的ID个数 - // //MinSeqNumber = 5, //最小序列数,默认值5,取值范围 [5, MaxSeqNumber] - // //MaxSeqNumber 最大序列数,设置范围 [MinSeqNumber, 2^SeqBitLength-1],默认值0 - //}; - var option = App.GetConfig("YitId"); - if (option.WorkerId == 0) + /// + /// 初始化YitId配置 + /// + public static void InitYitIdWorker() { - CacheOptions _cacheOptions = App.GetConfig("Cache", true); - option.WorkerId = RegisterOne(_cacheOptions.ip, _cacheOptions.port, _cacheOptions.password, 63); + //var option = new IdGeneratorOptions + //{ + // WorkerId = 1, //必须 全局唯一,必须 程序设定,理论最大值 2^WorkerIdBitLength-1 + // //BaseTime = new DateTime(2023, 1, 1, 0, 0, 0, DateTimeKind.Utc), //用生成ID时的系统时间与基础时间的差值(毫秒数)作为生成ID的时间戳 + // WorkerIdBitLength = 16, //机器码位长,决定 WorkerId 的最大值,默认值6,取值范围 [1, 16] + // //SeqBitLength = 4, //序列数位长,默认值6,取值范围 [3, 21](建议不小于4),决定每毫秒基础生成的ID个数 + // //MinSeqNumber = 5, //最小序列数,默认值5,取值范围 [5, MaxSeqNumber] + // //MaxSeqNumber 最大序列数,设置范围 [MinSeqNumber, 2^SeqBitLength-1],默认值0 + //}; + var option = App.GetConfig("YitId"); + if (option.WorkerId == 0) + { + CacheOptions _cacheOptions = App.GetConfig("Cache", true); + option.WorkerId = RegisterOne(_cacheOptions.ip, _cacheOptions.port, _cacheOptions.password, 63); + } + YitIdHelper.SetIdGenerator(option); } - YitIdHelper.SetIdGenerator(option); - } - /// - /// 生成ID. - /// - /// - public static string NextId() - { - return YitIdHelper.NextId().ToString(); - } + /// + /// 生成ID. + /// + /// + public static string NextId() + { + return YitIdHelper.NextId().ToString(); + } } \ No newline at end of file diff --git a/common/Tnb.Common/Utils/DateTimeJsonConverter.cs b/common/Tnb.Common/Utils/DateTimeJsonConverter.cs index 5a5d3a37..0a192660 100644 --- a/common/Tnb.Common/Utils/DateTimeJsonConverter.cs +++ b/common/Tnb.Common/Utils/DateTimeJsonConverter.cs @@ -8,17 +8,17 @@ namespace Tnb.Common.Utils { return objectType == typeof(DateTime); } - + public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { TypeCode typeCode = Type.GetTypeCode(reader.Value.GetType()); if (typeCode == TypeCode.DateTime) return reader.Value; - + var t = long.Parse((string)(reader.Value.ToString())); return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddMilliseconds(t); } - + public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { throw new NotImplementedException(); diff --git a/common/Tnb.Common/Utils/DeepCopyHelper.cs b/common/Tnb.Common/Utils/DeepCopyHelper.cs index 1c4cc78c..1ffd127c 100644 --- a/common/Tnb.Common/Utils/DeepCopyHelper.cs +++ b/common/Tnb.Common/Utils/DeepCopyHelper.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; +using System.Linq.Expressions; using System.Reflection; -using System.Text; -using System.Threading.Tasks; namespace Tnb.Common.Utils { diff --git a/common/Tnb.Common/Utils/Dijkstra.cs b/common/Tnb.Common/Utils/Dijkstra.cs index 6d1cfb3c..355dbb79 100644 --- a/common/Tnb.Common/Utils/Dijkstra.cs +++ b/common/Tnb.Common/Utils/Dijkstra.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Contracts; -using NPOI.SS.Formula.Functions; - -namespace Tnb.Common.Utils +namespace Tnb.Common.Utils { /// /// 迪杰斯特拉(最短路径算法) diff --git a/common/Tnb.Common/Utils/HttpClientHelper.cs b/common/Tnb.Common/Utils/HttpClientHelper.cs index ae4a9599..57fd4041 100644 --- a/common/Tnb.Common/Utils/HttpClientHelper.cs +++ b/common/Tnb.Common/Utils/HttpClientHelper.cs @@ -1,13 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Net.Http; -using System.Net.Http.Headers; -using System.Reflection; -using System.Security.Policy; +using System.Net.Http.Headers; using System.Text; -using System.Threading; -using System.Threading.Tasks; using JNPF.Logging; using Microsoft.AspNetCore.WebUtilities; using Newtonsoft.Json; @@ -130,7 +122,7 @@ namespace Tnb.Common.Utils } - public static async Task PostStreamAsync(string url,object content, CancellationToken cancellationToken) + public static async Task PostStreamAsync(string url, object content, CancellationToken cancellationToken) { using (var client = new HttpClient()) using (var request = new HttpRequestMessage(HttpMethod.Post, url)) diff --git a/common/Tnb.Common/Utils/ParameterCheckHelper.cs b/common/Tnb.Common/Utils/ParameterCheckHelper.cs index 2553d6d0..fcf316d5 100644 --- a/common/Tnb.Common/Utils/ParameterCheckHelper.cs +++ b/common/Tnb.Common/Utils/ParameterCheckHelper.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.Common.Utils +namespace Tnb.Common.Utils { public class PropertyNotNullChecker { diff --git a/common/Tnb.Common/Utils/SkipNormalizationAttribute.cs b/common/Tnb.Common/Utils/SkipNormalizationAttribute.cs index 384def4e..93bcc410 100644 --- a/common/Tnb.Common/Utils/SkipNormalizationAttribute.cs +++ b/common/Tnb.Common/Utils/SkipNormalizationAttribute.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Tnb.Common.Utils +namespace Tnb.Common.Utils { [AttributeUsage(AttributeTargets.Method)] public class SkipNormalizationAttribute : Attribute diff --git a/common/Tnb.Common/Utils/SkipNormalizationAttributeConventionalRegistrar.cs b/common/Tnb.Common/Utils/SkipNormalizationAttributeConventionalRegistrar.cs index 5ec1b080..b983cc5f 100644 --- a/common/Tnb.Common/Utils/SkipNormalizationAttributeConventionalRegistrar.cs +++ b/common/Tnb.Common/Utils/SkipNormalizationAttributeConventionalRegistrar.cs @@ -1,13 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.SpecificationDocument; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; - -namespace Tnb.Common.Utils +namespace Tnb.Common.Utils { //public class SkipNormalizationAttributeConventionalRegistrar : IConventionalRegistrar //{ diff --git a/common/Tnb.Common/Utils/ThrowIf.cs b/common/Tnb.Common/Utils/ThrowIf.cs index 578062bd..b1cea249 100644 --- a/common/Tnb.Common/Utils/ThrowIf.cs +++ b/common/Tnb.Common/Utils/ThrowIf.cs @@ -5,133 +5,133 @@ namespace System; public static class ThrowIf { - public static void When(bool isMatch, string msg) - { - if (isMatch) + public static void When(bool isMatch, string msg) { - throw new ArgumentException(msg); - } - } - - public static T IsNull([NotNull] T? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) - { - if (value == null) - { - throw string.IsNullOrEmpty(msg) ? new ArgumentNullException(paraName) : new ArgumentException(msg); + if (isMatch) + { + throw new ArgumentException(msg); + } } - return value; - } - - public static T IsNullOrDefault([NotNull] T? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) where T : struct - { - if (!value.HasValue || value.Value.Equals(default(T))) + public static T IsNull([NotNull] T? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) { - throw string.IsNullOrEmpty(msg) ? new ArgumentException("值不可为空或默认值", paraName) : new ArgumentException(msg); + if (value == null) + { + throw string.IsNullOrEmpty(msg) ? new ArgumentNullException(paraName) : new ArgumentException(msg); + } + + return value; } - return value.Value; - } - - - public static string IsNullOrWhiteSpace([NotNull] string? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) - { - if (string.IsNullOrWhiteSpace(value)) + public static T IsNullOrDefault([NotNull] T? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) where T : struct { - throw string.IsNullOrEmpty(msg) ? new ArgumentException("值不可为空或空格", paraName) : new ArgumentException(msg); - } - return value; - } + if (!value.HasValue || value.Value.Equals(default(T))) + { + throw string.IsNullOrEmpty(msg) ? new ArgumentException("值不可为空或默认值", paraName) : new ArgumentException(msg); + } - public static string IsNullOrEmpty([NotNull] string? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) - { - if (string.IsNullOrEmpty(value)) - { - throw string.IsNullOrEmpty(msg) ? new ArgumentException("值不可为空", paraName) : new ArgumentException(msg); + return value.Value; } - return value; - } - //public static ICollection NotNullOrEmpty(ICollection value, string paraName) - //{ - // if (value.IsNullOrEmpty()) - // { - // throw new ArgumentException(paraName + " can not be null or empty!", paraName); - // } - - // return value; - //} - - //public static Type AssignableTo(Type type, string paraName) - //{ - // NotNull(type, paraName); - // if (!type.IsAssignableTo()) - // { - // throw new ArgumentException(paraName + " (type of " + type.AssemblyQualifiedName + ") should be assignable to the " + typeof(TBaseType).GetFullNameWithAssemblyName() + "!"); - // } - - // return type; - //} - - public static short OutOfRange(short value, string paraName, short minimumValue, short maximumValue = short.MaxValue) - { - if (value < minimumValue || value > maximumValue) + public static string IsNullOrWhiteSpace([NotNull] string? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) { - throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + if (string.IsNullOrWhiteSpace(value)) + { + throw string.IsNullOrEmpty(msg) ? new ArgumentException("值不可为空或空格", paraName) : new ArgumentException(msg); + } + return value; } - return value; - } - - public static int OutOfRange(int value, string paraName, int minimumValue, int maximumValue = int.MaxValue) - { - if (value < minimumValue || value > maximumValue) + public static string IsNullOrEmpty([NotNull] string? value, string? msg = null, [CallerArgumentExpression("value")] string? paraName = null) { - throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + if (string.IsNullOrEmpty(value)) + { + throw string.IsNullOrEmpty(msg) ? new ArgumentException("值不可为空", paraName) : new ArgumentException(msg); + } + + return value; } - return value; - } + //public static ICollection NotNullOrEmpty(ICollection value, string paraName) + //{ + // if (value.IsNullOrEmpty()) + // { + // throw new ArgumentException(paraName + " can not be null or empty!", paraName); + // } - public static long OutOfRange(long value, string paraName, long minimumValue, long maximumValue = long.MaxValue) - { - if (value < minimumValue || value > maximumValue) + // return value; + //} + + //public static Type AssignableTo(Type type, string paraName) + //{ + // NotNull(type, paraName); + // if (!type.IsAssignableTo()) + // { + // throw new ArgumentException(paraName + " (type of " + type.AssemblyQualifiedName + ") should be assignable to the " + typeof(TBaseType).GetFullNameWithAssemblyName() + "!"); + // } + + // return type; + //} + + public static short OutOfRange(short value, string paraName, short minimumValue, short maximumValue = short.MaxValue) { - throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + if (value < minimumValue || value > maximumValue) + { + throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + + return value; } - return value; - } - - public static float OutOfRange(float value, string paraName, float minimumValue, float maximumValue = float.MaxValue) - { - if (value < minimumValue || value > maximumValue) + public static int OutOfRange(int value, string paraName, int minimumValue, int maximumValue = int.MaxValue) { - throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + if (value < minimumValue || value > maximumValue) + { + throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + + return value; } - return value; - } - - public static double OutOfRange(double value, string paraName, double minimumValue, double maximumValue = double.MaxValue) - { - if (value < minimumValue || value > maximumValue) + public static long OutOfRange(long value, string paraName, long minimumValue, long maximumValue = long.MaxValue) { - throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + if (value < minimumValue || value > maximumValue) + { + throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + + return value; } - return value; - } - - public static decimal OutOfRange(decimal value, string paraName, decimal minimumValue, decimal maximumValue = decimal.MaxValue) - { - if (value < minimumValue || value > maximumValue) + public static float OutOfRange(float value, string paraName, float minimumValue, float maximumValue = float.MaxValue) { - throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + if (value < minimumValue || value > maximumValue) + { + throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + + return value; } - return value; - } + public static double OutOfRange(double value, string paraName, double minimumValue, double maximumValue = double.MaxValue) + { + if (value < minimumValue || value > maximumValue) + { + throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + + return value; + } + + public static decimal OutOfRange(decimal value, string paraName, decimal minimumValue, decimal maximumValue = decimal.MaxValue) + { + if (value < minimumValue || value > maximumValue) + { + throw new ArgumentException($"{paraName} is out of range min: {minimumValue} - max: {maximumValue}"); + } + + return value; + } } diff --git a/common/Tnb.SqlSugar/Extensions/TenantLinkExtensions.cs b/common/Tnb.SqlSugar/Extensions/TenantLinkExtensions.cs index 723aafd0..c12e0b4c 100644 --- a/common/Tnb.SqlSugar/Extensions/TenantLinkExtensions.cs +++ b/common/Tnb.SqlSugar/Extensions/TenantLinkExtensions.cs @@ -1,6 +1,5 @@ using JNPF; using JNPF.DataEncryption; -using JNPF.Extras.DatabaseAccessor.SqlSugar; using JNPF.Extras.DatabaseAccessor.SqlSugar.Extensions; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration.Json; diff --git a/common/Tnb.SqlSugar/Internal/SqlSugarPagedList.cs b/common/Tnb.SqlSugar/Internal/SqlSugarPagedList.cs index a47780fd..3c332ba7 100644 --- a/common/Tnb.SqlSugar/Internal/SqlSugarPagedList.cs +++ b/common/Tnb.SqlSugar/Internal/SqlSugarPagedList.cs @@ -42,4 +42,4 @@ public class SqlSugarPagedList /// 分页集合 /// public class PagedModel : SqlSugarPagedList -{} \ No newline at end of file +{ } \ No newline at end of file diff --git a/common/Tnb.SqlSugar/Repositories/ISqlSugarRepository.cs b/common/Tnb.SqlSugar/Repositories/ISqlSugarRepository.cs index 3ca58074..228bd3ca 100644 --- a/common/Tnb.SqlSugar/Repositories/ISqlSugarRepository.cs +++ b/common/Tnb.SqlSugar/Repositories/ISqlSugarRepository.cs @@ -1,5 +1,3 @@ -using System.Linq.Expressions; - namespace SqlSugar; /// diff --git a/common/Tnb.SqlSugar/Repositories/SqlSugarRepository.cs b/common/Tnb.SqlSugar/Repositories/SqlSugarRepository.cs index e24fece9..18a55888 100644 --- a/common/Tnb.SqlSugar/Repositories/SqlSugarRepository.cs +++ b/common/Tnb.SqlSugar/Repositories/SqlSugarRepository.cs @@ -1,5 +1,4 @@ using JNPF; -using JNPF.DataEncryption; using JNPF.Extras.DatabaseAccessor.SqlSugar.Models; using JNPF.FriendlyException; using JNPF.JsonSerialization; diff --git a/common/Tnb.SqlSugar/Tnb.SqlSugar.csproj b/common/Tnb.SqlSugar/Tnb.SqlSugar.csproj index 1db069e8..87c80703 100644 --- a/common/Tnb.SqlSugar/Tnb.SqlSugar.csproj +++ b/common/Tnb.SqlSugar/Tnb.SqlSugar.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/common/Tnb.Thirdparty/Email/MailUtil.cs b/common/Tnb.Thirdparty/Email/MailUtil.cs index bfb16c7c..3e8b01a5 100644 --- a/common/Tnb.Thirdparty/Email/MailUtil.cs +++ b/common/Tnb.Thirdparty/Email/MailUtil.cs @@ -75,7 +75,7 @@ public class MailUtil var mult = new Multipart("mixed") { body }; foreach (var attachment in mailModel.Attachment) { - var file = new FileInfo(Path.Combine(mailFilePath , attachment.fileId)); + var file = new FileInfo(Path.Combine(mailFilePath, attachment.fileId)); if (file.Exists) { var mimePart = new MimePart(); diff --git a/common/Tnb.Thirdparty/Tnb.Thirdparty.csproj b/common/Tnb.Thirdparty/Tnb.Thirdparty.csproj index 697f654a..a89997d5 100644 --- a/common/Tnb.Thirdparty/Tnb.Thirdparty.csproj +++ b/common/Tnb.Thirdparty/Tnb.Thirdparty.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/common/Tnb.WebSockets/Middlewares/WebSocketMiddleware.cs b/common/Tnb.WebSockets/Middlewares/WebSocketMiddleware.cs index 756b27b8..1bb98120 100644 --- a/common/Tnb.WebSockets/Middlewares/WebSocketMiddleware.cs +++ b/common/Tnb.WebSockets/Middlewares/WebSocketMiddleware.cs @@ -1,5 +1,4 @@ -using System.Net; -using System.Net.WebSockets; +using System.Net.WebSockets; using System.Text; using System.Web; using JNPF.Common.Net; diff --git a/common/Tnb.WebSockets/Tnb.WebSockets.csproj b/common/Tnb.WebSockets/Tnb.WebSockets.csproj index 7993a15e..7800fba6 100644 --- a/common/Tnb.WebSockets/Tnb.WebSockets.csproj +++ b/common/Tnb.WebSockets/Tnb.WebSockets.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/message/Tnb.Message.Entitys/Dto/MessageAccount/EmailSendTestQuery.cs b/message/Tnb.Message.Entitys/Dto/MessageAccount/EmailSendTestQuery.cs index 519dadc3..6dd01c10 100644 --- a/message/Tnb.Message.Entitys/Dto/MessageAccount/EmailSendTestQuery.cs +++ b/message/Tnb.Message.Entitys/Dto/MessageAccount/EmailSendTestQuery.cs @@ -1,6 +1,4 @@ -using JNPF.Common.Filter; - -namespace JNPF.Message.Entitys.Dto.MessageAccount; +namespace JNPF.Message.Entitys.Dto.MessageAccount; public class EmailSendTestQuery : MessageAccountListOutput { diff --git a/message/Tnb.Message.Entitys/Mapper/Mapper.cs b/message/Tnb.Message.Entitys/Mapper/Mapper.cs index 4eafbabb..157aeb49 100644 --- a/message/Tnb.Message.Entitys/Mapper/Mapper.cs +++ b/message/Tnb.Message.Entitys/Mapper/Mapper.cs @@ -1,6 +1,5 @@ using JNPF.Common.Models.User; using JNPF.Message.Entitys.Dto.IM; -using JNPF.Message.Entitys.Dto.MessageAccount; using JNPF.Message.Entitys.Model.IM; using Mapster; diff --git a/message/Tnb.Message.Entitys/Tnb.Message.Entitys.csproj b/message/Tnb.Message.Entitys/Tnb.Message.Entitys.csproj index 08bcb7bf..91e9762b 100644 --- a/message/Tnb.Message.Entitys/Tnb.Message.Entitys.csproj +++ b/message/Tnb.Message.Entitys/Tnb.Message.Entitys.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/message/Tnb.Message.Interfaces/Tnb.Message.Interfaces.csproj b/message/Tnb.Message.Interfaces/Tnb.Message.Interfaces.csproj index a60a47f8..82a14c27 100644 --- a/message/Tnb.Message.Interfaces/Tnb.Message.Interfaces.csproj +++ b/message/Tnb.Message.Interfaces/Tnb.Message.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/message/Tnb.Message/Service/ImReplyService.cs b/message/Tnb.Message/Service/ImReplyService.cs index cff13fc2..13b6cbe9 100644 --- a/message/Tnb.Message/Service/ImReplyService.cs +++ b/message/Tnb.Message/Service/ImReplyService.cs @@ -59,7 +59,7 @@ public class ImReplyService : IImReplyService, IDynamicApiController, ITransient // 获取全部聊天对象列表 var objectList = _repository.AsSugarClient().UnionAll( - _repository.AsQueryable().Where(i => i.ReceiveUserId == _userManager.UserId && (SqlFunc.IsNullOrEmpty(i.ImreplySendDeleteMark)||i.ImreplySendDeleteMark != _userManager.UserId)).Select(it => new ImReplyObjectIdOutput { userId = it.UserId, latestDate = it.ReceiveTime }), + _repository.AsQueryable().Where(i => i.ReceiveUserId == _userManager.UserId && (SqlFunc.IsNullOrEmpty(i.ImreplySendDeleteMark) || i.ImreplySendDeleteMark != _userManager.UserId)).Select(it => new ImReplyObjectIdOutput { userId = it.UserId, latestDate = it.ReceiveTime }), _repository.AsQueryable().Where(i => i.UserId == _userManager.UserId && (SqlFunc.IsNullOrEmpty(i.ImreplySendDeleteMark) || i.ImreplySendDeleteMark != _userManager.UserId)).Select(it => new ImReplyObjectIdOutput { userId = it.ReceiveUserId, latestDate = it.ReceiveTime })).MergeTable().GroupBy(it => new { it.userId }).Select(it => new { it.userId, latestDate = SqlFunc.AggregateMax(it.latestDate) }).ToList(); var objectUserList = objectList.Adapt>(); if (objectUserList.Count > 0) @@ -78,7 +78,7 @@ public class ImReplyService : IImReplyService, IDynamicApiController, ITransient it.realName = item.RealName; it.headIcon = "/api/File/Image/userAvatar/" + item.HeadIcon; - var imContent = _repository.AsSugarClient().Queryable().Where(i => (i.SendUserId == _userManager.UserId && i.ReceiveUserId == it.userId) || (i.SendUserId == it.userId && i.ReceiveUserId == _userManager.UserId)).Where(i => i.SendTime.Equals(it.latestDate) && (SqlFunc.IsNullOrEmpty(i.SendDeleteMark)|| i.SendDeleteMark != _userManager.UserId)).ToList().FirstOrDefault(); + var imContent = _repository.AsSugarClient().Queryable().Where(i => (i.SendUserId == _userManager.UserId && i.ReceiveUserId == it.userId) || (i.SendUserId == it.userId && i.ReceiveUserId == _userManager.UserId)).Where(i => i.SendTime.Equals(it.latestDate) && (SqlFunc.IsNullOrEmpty(i.SendDeleteMark) || i.SendDeleteMark != _userManager.UserId)).ToList().FirstOrDefault(); // 获取最信息 if (imContent != null) diff --git a/message/Tnb.Message/Service/MessageDataTypeService.cs b/message/Tnb.Message/Service/MessageDataTypeService.cs index 2bb38b32..3198d3db 100644 --- a/message/Tnb.Message/Service/MessageDataTypeService.cs +++ b/message/Tnb.Message/Service/MessageDataTypeService.cs @@ -1,13 +1,6 @@ -using JNPF.Common.Enums; -using JNPF.Common.Extension; -using JNPF.Common.Filter; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.FriendlyException; -using JNPF.Message.Entitys.Dto.MessageAccount; using JNPF.Message.Entitys.Entity; -using JNPF.Systems.Entitys.Permission; -using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; @@ -40,7 +33,7 @@ public class MessageDataTypeService : IDynamicApiController, ITransient [HttpGet("getTypeList/{type}")] public async Task GetTypeList(string type) { - return (await _repository.GetListAsync(x => x.Type == type && x.DeleteMark == null)).Select(x => new { id = x.Id, fullName = x.FullName ,enCode=x.EnCode}).ToList(); + return (await _repository.GetListAsync(x => x.Type == type && x.DeleteMark == null)).Select(x => new { id = x.Id, fullName = x.FullName, enCode = x.EnCode }).ToList(); } #endregion } diff --git a/message/Tnb.Message/Service/MessageMonitorService.cs b/message/Tnb.Message/Service/MessageMonitorService.cs index 08a335ad..1b20d43f 100644 --- a/message/Tnb.Message/Service/MessageMonitorService.cs +++ b/message/Tnb.Message/Service/MessageMonitorService.cs @@ -1,6 +1,5 @@ using JNPF.Common.Extension; using JNPF.Common.Filter; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.LinqBuilder; @@ -8,7 +7,6 @@ using JNPF.Message.Entitys.Dto.MessageMonitor; using JNPF.Message.Entitys.Entity; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Interfaces.Permission; -using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; diff --git a/message/Tnb.Message/Service/MessageService.cs b/message/Tnb.Message/Service/MessageService.cs index 65d59f29..4c6d71de 100644 --- a/message/Tnb.Message/Service/MessageService.cs +++ b/message/Tnb.Message/Service/MessageService.cs @@ -120,7 +120,7 @@ public class MessageService : IMessageService, IDynamicApiController, ITransient title = a.Title, type = a.Type, isRead = b.IsRead, - flowType=a.FlowType + flowType = a.FlowType }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(list); } @@ -414,7 +414,7 @@ public class MessageService : IMessageService, IDynamicApiController, ITransient //modifyby zhoukeda 20230704 定时任务发起的推送消息没有user string userManagerUserId = _userManager.UserId ?? ""; string userManagerTenantId = _userManager.TenantId ?? ""; - + MessageEntity entity = new MessageEntity(); entity.Id = SnowflakeIdHelper.NextId(); entity.Title = title; diff --git a/message/Tnb.Message/Service/MessageTemplateService.cs b/message/Tnb.Message/Service/MessageTemplateService.cs index 14df414f..41b56eaa 100644 --- a/message/Tnb.Message/Service/MessageTemplateService.cs +++ b/message/Tnb.Message/Service/MessageTemplateService.cs @@ -203,7 +203,7 @@ public class MessageTemplateService : IDynamicApiController, ITransient { var paramEntity = item.Adapt(); paramEntity.TemplateId = entity.Id; - paramEntity.Id= SnowflakeIdHelper.NextId(); + paramEntity.Id = SnowflakeIdHelper.NextId(); await _repository.AsSugarClient().Insertable(paramEntity).IgnoreColumns(ignoreNullColumn: true).CallEntityMethod(m => m.Create()).ExecuteCommandAsync(); } var smsFieldList = await _repository.AsSugarClient().Queryable().Where(x => x.TemplateId == id && x.DeleteMark == null).ToListAsync(); diff --git a/message/Tnb.Message/Service/SendMessageService.cs b/message/Tnb.Message/Service/SendMessageService.cs index e934651a..658e4e59 100644 --- a/message/Tnb.Message/Service/SendMessageService.cs +++ b/message/Tnb.Message/Service/SendMessageService.cs @@ -360,7 +360,7 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT var paramsDic = messageSendModel.paramJson.ToDictionary(x => x.field, y => y.value);//参数 var title = messageTemplateEntity.Title; var content = messageTemplateEntity.Content; - if (messageTemplateEntity.MessageType=="6") + if (messageTemplateEntity.MessageType == "6") { try { @@ -462,9 +462,9 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT return errorList.Any() ? string.Join(",", errorList) : string.Empty; } - public async Task SendMessageDefult(string enCode, List toUser,string creatorUser, string flowName, Dictionary bodyDic) + public async Task SendMessageDefult(string enCode, List toUser, string creatorUser, string flowName, Dictionary bodyDic) { - var msgTemplateEntity= await _repository.AsSugarClient().Queryable().FirstAsync(x => x.EnCode == enCode && x.TemplateType=="1" && x.DeleteMark == null); + var msgTemplateEntity = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.EnCode == enCode && x.TemplateType == "1" && x.DeleteMark == null); msgTemplateEntity.Title = msgTemplateEntity.Title.Replace("@流程发起人", creatorUser).Replace("@流程名称", flowName); msgTemplateEntity.Content = msgTemplateEntity.Content.Replace("@流程发起人", creatorUser).Replace("@流程名称", flowName); await _messageService.SentMessage(toUser, msgTemplateEntity.Title, msgTemplateEntity.Content, bodyDic); @@ -534,7 +534,7 @@ public class SendMessageService : ISendMessageService, IDynamicApiController, IT Password = messageAccountEntity.SmtpPassword, SMTPHost = messageAccountEntity.SmtpServer, SMTPPort = messageAccountEntity.SmtpPort.ParseToInt(), - Ssl=messageAccountEntity.SslLink.Equals("1") + Ssl = messageAccountEntity.SslLink.Equals("1") }, mailModel); } diff --git a/message/Tnb.Message/Service/ShortLinkService.cs b/message/Tnb.Message/Service/ShortLinkService.cs index 5e5cba1f..85b77538 100644 --- a/message/Tnb.Message/Service/ShortLinkService.cs +++ b/message/Tnb.Message/Service/ShortLinkService.cs @@ -99,8 +99,8 @@ public class ShortLinkService : IShortLinkService, IDynamicApiController, ITrans } else { - _sqlSugarClient.AddConnection(JNPFTenantExtensions.GetConfig(options)); - _sqlSugarClient.ChangeDatabase(tenantId); + _sqlSugarClient.AddConnection(JNPFTenantExtensions.GetConfig(options)); + _sqlSugarClient.ChangeDatabase(tenantId); } } diff --git a/message/Tnb.Message/Service/WechatOpenService.cs b/message/Tnb.Message/Service/WechatOpenService.cs index dc3ef1a6..d7d5a4fa 100644 --- a/message/Tnb.Message/Service/WechatOpenService.cs +++ b/message/Tnb.Message/Service/WechatOpenService.cs @@ -1,18 +1,14 @@ using System.Text; using System.Xml; -using JNPF.Common.Enums; using JNPF.Common.Extension; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Extras.Thirdparty.WeChat; using JNPF.Extras.Thirdparty.WeChat.Internal; -using JNPF.FriendlyException; using JNPF.Logging.Attributes; using JNPF.Message.Entitys.Entity; using JNPF.Systems.Entitys.Permission; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Senparc.Weixin.MP; using SqlSugar; @@ -122,7 +118,7 @@ public class WechatOpenService : IDynamicApiController, ITransient var input = new WechatMPEvent(); input.ToUserName = doc.DocumentElement.SelectSingleNode("ToUserName").InnerText.Trim(); input.FromUserName = doc.DocumentElement.SelectSingleNode("FromUserName").InnerText.Trim(); - input.Event= doc.DocumentElement.SelectSingleNode("Event").InnerText.Trim(); + input.Event = doc.DocumentElement.SelectSingleNode("Event").InnerText.Trim(); return input; } } diff --git a/message/Tnb.Message/Tnb.Message.csproj b/message/Tnb.Message/Tnb.Message.csproj index ca7ad31b..532b9e1f 100644 --- a/message/Tnb.Message/Tnb.Message.csproj +++ b/message/Tnb.Message/Tnb.Message.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/system/Tnb.OAuth/Dto/CurrentUserOutput.cs b/system/Tnb.OAuth/Dto/CurrentUserOutput.cs index 8916d9d6..06194d1d 100644 --- a/system/Tnb.OAuth/Dto/CurrentUserOutput.cs +++ b/system/Tnb.OAuth/Dto/CurrentUserOutput.cs @@ -1,5 +1,4 @@ using JNPF.Common.Models.User; -using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.Systems.Entitys.Dto.Module; diff --git a/system/Tnb.OAuth/Dto/LockScreenInput.cs b/system/Tnb.OAuth/Dto/LockScreenInput.cs index 26991f2c..82486c43 100644 --- a/system/Tnb.OAuth/Dto/LockScreenInput.cs +++ b/system/Tnb.OAuth/Dto/LockScreenInput.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using JNPF.DependencyInjection; namespace JNPF.OAuth.Dto; diff --git a/system/Tnb.OAuth/Dto/LoginInput.cs b/system/Tnb.OAuth/Dto/LoginInput.cs index 091fba62..e15bde48 100644 --- a/system/Tnb.OAuth/Dto/LoginInput.cs +++ b/system/Tnb.OAuth/Dto/LoginInput.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using JNPF.DependencyInjection; namespace JNPF.OAuth.Dto; diff --git a/system/Tnb.OAuth/OAuthService.cs b/system/Tnb.OAuth/OAuthService.cs index 2bb9ddd6..086e5692 100644 --- a/system/Tnb.OAuth/OAuthService.cs +++ b/system/Tnb.OAuth/OAuthService.cs @@ -1,50 +1,46 @@ -using JNPF.Common.Const; -using JNPF.Common.Captcha.General; +using JNPF.Common.Captcha.General; +using JNPF.Common.Const; +using JNPF.Common.Core.Handlers; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.OAuth; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Manager; +using JNPF.Common.Models; using JNPF.Common.Models.User; using JNPF.Common.Net; +using JNPF.Common.Options; using JNPF.Common.Security; using JNPF.DataEncryption; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.EventBus; using JNPF.EventHandler; +using JNPF.Extras.CollectiveOAuth.Models; +using JNPF.Extras.DatabaseAccessor.SqlSugar.Models; using JNPF.FriendlyException; using JNPF.Logging.Attributes; +using JNPF.Message.Interfaces.Message; using JNPF.OAuth.Dto; using JNPF.OAuth.Model; using JNPF.RemoteRequest.Extensions; +using JNPF.Systems.Entitys.Dto.Module; using JNPF.Systems.Entitys.Enum; +using JNPF.Systems.Entitys.Model.Permission.SocialsUser; using JNPF.Systems.Entitys.Model.SysConfig; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using JNPF.UnifyResult; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; +using Microsoft.CodeAnalysis; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using SqlSugar; -using JNPF.Systems.Entitys.Dto.Module; -using JNPF.Systems.Entitys.Model.Permission.SocialsUser; -using JNPF.Systems.Interfaces.Permission; -using JNPF.Extras.CollectiveOAuth.Models; -using JNPF.Common.Models; -using JNPF.Common.Options; -using Microsoft.CodeAnalysis; -using JNPF.Common.Core.Handlers; -using JNPF.Message.Interfaces.Message; -using JNPF.Extras.DatabaseAccessor.SqlSugar.Models; -using Aop.Api.Domain; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Hosting; -using bf = System.Reflection.BindingFlags; -using System.Linq.Expressions; namespace JNPF.OAuth; @@ -417,10 +413,10 @@ public class OAuthService : IDynamicApiController, ITransient public async Task Logout([FromQuery] string ticket) { //modify by ly on 20230918 -/* stopTimedTaskSvcCTS ??= new(); - await _backgroundService.StopAsync(stopTimedTaskSvcCTS.Token); - stopTimedTaskSvcCTS.Cancel(); -*/ //stopTimedTaskSvcCTS.Dispose(); + /* stopTimedTaskSvcCTS ??= new(); + await _backgroundService.StopAsync(stopTimedTaskSvcCTS.Token); + stopTimedTaskSvcCTS.Cancel(); + */ //stopTimedTaskSvcCTS.Dispose(); UserManager.AsscessToken = string.Empty; diff --git a/system/Tnb.OAuth/Tnb.OAuth.csproj b/system/Tnb.OAuth/Tnb.OAuth.csproj index fa156afa..0abba9be 100644 --- a/system/Tnb.OAuth/Tnb.OAuth.csproj +++ b/system/Tnb.OAuth/Tnb.OAuth.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs index f1d38fef..7de4e26d 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/Department/DepartmentCrInput.cs @@ -1,5 +1,4 @@ using JNPF.DependencyInjection; -using JNPF.Systems.Entitys.Model.Organize; using Newtonsoft.Json.Linq; namespace JNPF.Systems.Entitys.Dto.Department; diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/OrganizeAdministrator/OrganizeAdminIsTratorCrInput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/OrganizeAdministrator/OrganizeAdminIsTratorCrInput.cs index b932ea81..387bc840 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/OrganizeAdministrator/OrganizeAdminIsTratorCrInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/OrganizeAdministrator/OrganizeAdminIsTratorCrInput.cs @@ -7,7 +7,7 @@ namespace JNPF.Systems.Entitys.Dto.OrganizeAdministrator; /// 机构分级管理创建输入. /// [SuppressSniffer] -public class OrganizeAdminIsTratorCrInput: TreeModel +public class OrganizeAdminIsTratorCrInput : TreeModel { /// /// 用户主键. diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/Socials/SocialsUserListOutput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/Socials/SocialsUserListOutput.cs index c1f72198..dcc5bedc 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/Socials/SocialsUserListOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/Socials/SocialsUserListOutput.cs @@ -1,7 +1,4 @@ -using System.Text.Json.Nodes; -using JNPF.Common.Filter; -using JNPF.Common.Models.User; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.Socials; diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/User/GetDefaultCurrentValueInput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/User/GetDefaultCurrentValueInput.cs index 85c0a9d6..3cc760ae 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/User/GetDefaultCurrentValueInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/User/GetDefaultCurrentValueInput.cs @@ -1,5 +1,4 @@ -using System.Text.Json.Serialization; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.User; diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/User/UserListAllOutput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/User/UserListAllOutput.cs index 4c9301e3..4e5dff2d 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/User/UserListAllOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/User/UserListAllOutput.cs @@ -1,5 +1,4 @@ using JNPF.DependencyInjection; -using System.Text.Json.Serialization; namespace JNPF.Systems.Entitys.Dto.User; diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentInfoUpInput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentInfoUpInput.cs index 1240c6de..0afc7b64 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentInfoUpInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentInfoUpInput.cs @@ -1,5 +1,4 @@ using JNPF.DependencyInjection; -using System; namespace JNPF.Systems.Entitys.Dto.UsersCurrent; diff --git a/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentSystemLogOutput.cs b/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentSystemLogOutput.cs index 9882fe2d..825d3c86 100644 --- a/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentSystemLogOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/Permission/UsersCurrent/UsersCurrentSystemLogOutput.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.Text.Json.Serialization; +using System.Text.Json.Serialization; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.UsersCurrent; diff --git a/system/Tnb.Systems.Entitys/Dto/System/ComFields/ComFieldsUpInput.cs b/system/Tnb.Systems.Entitys/Dto/System/ComFields/ComFieldsUpInput.cs index adbf2f22..0d7b2eb4 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/ComFields/ComFieldsUpInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/ComFields/ComFieldsUpInput.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.ComFields; diff --git a/system/Tnb.Systems.Entitys/Dto/System/DataBase/DatabaseTableDataCleanInput.cs b/system/Tnb.Systems.Entitys/Dto/System/DataBase/DatabaseTableDataCleanInput.cs index 4dba9466..ae317f45 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/DataBase/DatabaseTableDataCleanInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/DataBase/DatabaseTableDataCleanInput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.Database { @@ -13,7 +8,7 @@ namespace JNPF.Systems.Entitys.Dto.Database [SuppressSniffer] public class DatabaseTableDataCleanInput { - + /// /// 数据库名称 /// diff --git a/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncActionsExecuteInput.cs b/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncActionsExecuteInput.cs index 433896d0..834e5c25 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncActionsExecuteInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncActionsExecuteInput.cs @@ -36,5 +36,5 @@ public class DbSyncActionsExecuteInput /// /// 字段类型. /// - public Dictionary convertRuleMap { get; set; } + public Dictionary convertRuleMap { get; set; } } \ No newline at end of file diff --git a/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncOutput.cs b/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncOutput.cs index 49b7e7a2..ff217ac0 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/DataSync/DbSyncOutput.cs @@ -20,5 +20,5 @@ public class DbSyncOutput /// /// 映射字段. /// - public Dictionary> convertRuleMap { get; set; } + public Dictionary> convertRuleMap { get; set; } } diff --git a/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthInput.cs b/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthInput.cs index 926c757a..3da81d66 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthInput.cs @@ -1,6 +1,4 @@ -using Newtonsoft.Json; - -namespace JNPF.Systems.Entitys.Dto.System.InterfaceOauth +namespace JNPF.Systems.Entitys.Dto.System.InterfaceOauth { public class InterfaceOauthInput { diff --git a/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthOutput.cs b/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthOutput.cs index 51ffafe7..7142e2f4 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/InterfaceOauth/InterfaceOauthOutput.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Systems.Entitys.Dto.DataInterFace; +using JNPF.Systems.Entitys.Dto.DataInterFace; namespace JNPF.Systems.Entitys.Dto.System.InterfaceOauth { diff --git a/system/Tnb.Systems.Entitys/Dto/System/PrintDev/PrintDevListOutput.cs b/system/Tnb.Systems.Entitys/Dto/System/PrintDev/PrintDevListOutput.cs index f85a72c8..0ee3c339 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/PrintDev/PrintDevListOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/PrintDev/PrintDevListOutput.cs @@ -1,5 +1,4 @@ -using System.Text.Json.Serialization; -using JNPF.Common.Security; +using JNPF.Common.Security; using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.PrintDev; diff --git a/system/Tnb.Systems.Entitys/Dto/System/SysConfig/SetAdminInput.cs b/system/Tnb.Systems.Entitys/Dto/System/SysConfig/SetAdminInput.cs index d55f6378..5e1d50a4 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/SysConfig/SetAdminInput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/SysConfig/SetAdminInput.cs @@ -9,7 +9,7 @@ namespace JNPF.Systems.Entitys.Dto.SysConfig; public class SetAdminInput { /// - /// 赋予超级管理员 Id 集合. - /// + /// 赋予超级管理员 Id 集合. + /// public List adminIds { get; set; } } \ No newline at end of file diff --git a/system/Tnb.Systems.Entitys/Dto/System/SysLog/LogExceptionOutput.cs b/system/Tnb.Systems.Entitys/Dto/System/SysLog/LogExceptionOutput.cs index 55a3e4f3..1cd0a661 100644 --- a/system/Tnb.Systems.Entitys/Dto/System/SysLog/LogExceptionOutput.cs +++ b/system/Tnb.Systems.Entitys/Dto/System/SysLog/LogExceptionOutput.cs @@ -1,5 +1,4 @@ -using System.Text.Json.Serialization; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Dto.SysLog; diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/OrganizeEntity.part.cs b/system/Tnb.Systems.Entitys/Entity/Permission/OrganizeEntity.part.cs index 6602eeae..6c9a01ab 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/OrganizeEntity.part.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/OrganizeEntity.part.cs @@ -1,9 +1,8 @@ -using JNPF.Common.Contracts; -using SqlSugar; +using SqlSugar; namespace JNPF.Systems.Entitys.Permission; -public partial class OrganizeEntity +public partial class OrganizeEntity { /// /// diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/SignImgEntity.cs b/system/Tnb.Systems.Entitys/Entity/Permission/SignImgEntity.cs index 8c5ed972..d768cdaa 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/SignImgEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/SignImgEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.Entity.Permission; diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/TenantSocialsEntity.cs b/system/Tnb.Systems.Entitys/Entity/Permission/TenantSocialsEntity.cs index d1001d35..b03410d7 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/TenantSocialsEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/TenantSocialsEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.Permission; diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs index dbae17a6..dc5136cb 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.Permission; diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs index 351c0b51..9d6b23de 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/UserEntity.part.cs @@ -1,6 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; -using SqlSugar; +using SqlSugar; namespace JNPF.Systems.Entitys.Permission; diff --git a/system/Tnb.Systems.Entitys/Entity/Permission/UserRelationEntity.cs b/system/Tnb.Systems.Entitys/Entity/Permission/UserRelationEntity.cs index d47c4940..ff3f63b1 100644 --- a/system/Tnb.Systems.Entitys/Entity/Permission/UserRelationEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/Permission/UserRelationEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.Permission; diff --git a/system/Tnb.Systems.Entitys/Entity/System/SmsTemplateEntity.cs b/system/Tnb.Systems.Entitys/Entity/System/SmsTemplateEntity.cs index a1545404..1c4d9c12 100644 --- a/system/Tnb.Systems.Entitys/Entity/System/SmsTemplateEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/System/SmsTemplateEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.System; diff --git a/system/Tnb.Systems.Entitys/Entity/System/SynThirdInfoEntity.cs b/system/Tnb.Systems.Entitys/Entity/System/SynThirdInfoEntity.cs index f440ea21..c0369c37 100644 --- a/system/Tnb.Systems.Entitys/Entity/System/SynThirdInfoEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/System/SynThirdInfoEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.System; diff --git a/system/Tnb.Systems.Entitys/Entity/System/SysConfigEntity.cs b/system/Tnb.Systems.Entitys/Entity/System/SysConfigEntity.cs index bd5c8a33..5b378ef0 100644 --- a/system/Tnb.Systems.Entitys/Entity/System/SysConfigEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/System/SysConfigEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.System; diff --git a/system/Tnb.Systems.Entitys/Entity/System/TimeTaskEntity.cs b/system/Tnb.Systems.Entitys/Entity/System/TimeTaskEntity.cs index 7655e1fa..613d40fe 100644 --- a/system/Tnb.Systems.Entitys/Entity/System/TimeTaskEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/System/TimeTaskEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using JNPF.Common.Enums; using SqlSugar; diff --git a/system/Tnb.Systems.Entitys/Entity/System/TimeTaskLogEntity.cs b/system/Tnb.Systems.Entitys/Entity/System/TimeTaskLogEntity.cs index aebb6e8c..27d5d357 100644 --- a/system/Tnb.Systems.Entitys/Entity/System/TimeTaskLogEntity.cs +++ b/system/Tnb.Systems.Entitys/Entity/System/TimeTaskLogEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.Systems.Entitys.System; diff --git a/system/Tnb.Systems.Entitys/Enum/AreaType.cs b/system/Tnb.Systems.Entitys/Enum/AreaType.cs index 24b9fda8..a37f87f9 100644 --- a/system/Tnb.Systems.Entitys/Enum/AreaType.cs +++ b/system/Tnb.Systems.Entitys/Enum/AreaType.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Enum; diff --git a/system/Tnb.Systems.Entitys/Enum/ErrorStrategy.cs b/system/Tnb.Systems.Entitys/Enum/ErrorStrategy.cs index 2d4cc0b2..6731faee 100644 --- a/system/Tnb.Systems.Entitys/Enum/ErrorStrategy.cs +++ b/system/Tnb.Systems.Entitys/Enum/ErrorStrategy.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Enum; diff --git a/system/Tnb.Systems.Entitys/Enum/MenuCategory.cs b/system/Tnb.Systems.Entitys/Enum/MenuCategory.cs index 8c08264f..fc681968 100644 --- a/system/Tnb.Systems.Entitys/Enum/MenuCategory.cs +++ b/system/Tnb.Systems.Entitys/Enum/MenuCategory.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Enum; diff --git a/system/Tnb.Systems.Entitys/Enum/MenuType.cs b/system/Tnb.Systems.Entitys/Enum/MenuType.cs index c64881f5..866f7b66 100644 --- a/system/Tnb.Systems.Entitys/Enum/MenuType.cs +++ b/system/Tnb.Systems.Entitys/Enum/MenuType.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Enum; diff --git a/system/Tnb.Systems.Entitys/Enum/SysConfig.cs b/system/Tnb.Systems.Entitys/Enum/SysConfig.cs index ee963396..3642e78e 100644 --- a/system/Tnb.Systems.Entitys/Enum/SysConfig.cs +++ b/system/Tnb.Systems.Entitys/Enum/SysConfig.cs @@ -1,5 +1,5 @@ -using JNPF.DependencyInjection; -using System.ComponentModel; +using System.ComponentModel; +using JNPF.DependencyInjection; namespace JNPF.Systems.Entitys.Enum; diff --git a/system/Tnb.Systems.Entitys/Mapper/ConnectionMapper.cs b/system/Tnb.Systems.Entitys/Mapper/ConnectionMapper.cs index 346b6708..b578ea9a 100644 --- a/system/Tnb.Systems.Entitys/Mapper/ConnectionMapper.cs +++ b/system/Tnb.Systems.Entitys/Mapper/ConnectionMapper.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Mapster; +using Mapster; using SqlSugar; namespace Tnb.Systems.Entitys.Mapper diff --git a/system/Tnb.Systems.Entitys/Model/Permission/SocialsUser/SocialsUserModel.cs b/system/Tnb.Systems.Entitys/Model/Permission/SocialsUser/SocialsUserModel.cs index 443dd180..25ce46c6 100644 --- a/system/Tnb.Systems.Entitys/Model/Permission/SocialsUser/SocialsUserModel.cs +++ b/system/Tnb.Systems.Entitys/Model/Permission/SocialsUser/SocialsUserModel.cs @@ -46,7 +46,7 @@ public class SocialsUserInfo public string socialName { get; set; } } -public class AuthCallbackNew: AuthCallback +public class AuthCallbackNew : AuthCallback { public string authCode; } diff --git a/system/Tnb.Systems.Entitys/Model/System/DataBase/DbEntityInfo.cs b/system/Tnb.Systems.Entitys/Model/System/DataBase/DbEntityInfo.cs index 28111354..b6da75e9 100644 --- a/system/Tnb.Systems.Entitys/Model/System/DataBase/DbEntityInfo.cs +++ b/system/Tnb.Systems.Entitys/Model/System/DataBase/DbEntityInfo.cs @@ -1,6 +1,4 @@ using JNPF.DependencyInjection; -using NPOI.SS.Formula.Functions; -using SqlSugar; namespace JNPF.Systems.Entitys.Dto.Database; diff --git a/system/Tnb.Systems.Entitys/Model/System/DataBase/DynamicDbTableModel.cs b/system/Tnb.Systems.Entitys/Model/System/DataBase/DynamicDbTableModel.cs index b6e07638..84314fac 100644 --- a/system/Tnb.Systems.Entitys/Model/System/DataBase/DynamicDbTableModel.cs +++ b/system/Tnb.Systems.Entitys/Model/System/DataBase/DynamicDbTableModel.cs @@ -1,6 +1,4 @@ -using JNPF.DependencyInjection; - -namespace JNPF.Systems.Entitys.Model.DataBase; +namespace JNPF.Systems.Entitys.Model.DataBase; ///// ///// 表列表实体. diff --git a/system/Tnb.Systems.Entitys/Tnb.Systems.Entitys.csproj b/system/Tnb.Systems.Entitys/Tnb.Systems.Entitys.csproj index 5cb0a5a3..3eb5ce90 100644 --- a/system/Tnb.Systems.Entitys/Tnb.Systems.Entitys.csproj +++ b/system/Tnb.Systems.Entitys/Tnb.Systems.Entitys.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/system/Tnb.Systems.Interfaces/Common/IFileService.cs b/system/Tnb.Systems.Interfaces/Common/IFileService.cs index 07938eeb..d1f10b82 100644 --- a/system/Tnb.Systems.Interfaces/Common/IFileService.cs +++ b/system/Tnb.Systems.Interfaces/Common/IFileService.cs @@ -1,7 +1,4 @@ -using Microsoft.AspNetCore.Http; -using OnceMi.AspNetCore.OSS; - -namespace JNPF.Systems.Interfaces.Common; +namespace JNPF.Systems.Interfaces.Common; /// /// 通用控制器. diff --git a/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs b/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs index 92a02c9b..beb26e7b 100644 --- a/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs +++ b/system/Tnb.Systems.Interfaces/Permission/IOrganizeService.cs @@ -85,5 +85,5 @@ public interface IOrganizeService /// /// /// - Task GetAnyParentByWorkstationId(string id,string type); + Task GetAnyParentByWorkstationId(string id, string type); } \ No newline at end of file diff --git a/system/Tnb.Systems.Interfaces/Permission/ISocialsUserService.cs b/system/Tnb.Systems.Interfaces/Permission/ISocialsUserService.cs index 64f4bde2..fb1b160f 100644 --- a/system/Tnb.Systems.Interfaces/Permission/ISocialsUserService.cs +++ b/system/Tnb.Systems.Interfaces/Permission/ISocialsUserService.cs @@ -17,7 +17,7 @@ public interface ISocialsUserService List GetLoginList(string ticket); - Task Binding([FromQuery] SocialsUserInputModel model); + Task Binding([FromQuery] SocialsUserInputModel model); Task GetSocialsUserInfo([FromQuery] SocialsUserInputModel model); diff --git a/system/Tnb.Systems.Interfaces/Permission/IUserRelationService.cs b/system/Tnb.Systems.Interfaces/Permission/IUserRelationService.cs index 641fa8d4..a616d894 100644 --- a/system/Tnb.Systems.Interfaces/Permission/IUserRelationService.cs +++ b/system/Tnb.Systems.Interfaces/Permission/IUserRelationService.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Filter; -using JNPF.Systems.Entitys.Dto.User; +using JNPF.Systems.Entitys.Dto.User; using JNPF.Systems.Entitys.Permission; namespace JNPF.Systems.Interfaces.Permission; diff --git a/system/Tnb.Systems.Interfaces/Permission/IUsersService.cs b/system/Tnb.Systems.Interfaces/Permission/IUsersService.cs index a352eb73..b498d785 100644 --- a/system/Tnb.Systems.Interfaces/Permission/IUsersService.cs +++ b/system/Tnb.Systems.Interfaces/Permission/IUsersService.cs @@ -1,6 +1,6 @@ -using JNPF.Common.Models.User; +using System.Linq.Expressions; +using JNPF.Common.Models.User; using JNPF.Systems.Entitys.Permission; -using System.Linq.Expressions; namespace JNPF.Systems.Interfaces.Permission; diff --git a/system/Tnb.Systems.Interfaces/System/IDataInterfaceService.cs b/system/Tnb.Systems.Interfaces/System/IDataInterfaceService.cs index f0ea634f..5ebe0623 100644 --- a/system/Tnb.Systems.Interfaces/System/IDataInterfaceService.cs +++ b/system/Tnb.Systems.Interfaces/System/IDataInterfaceService.cs @@ -1,7 +1,7 @@ -using JNPF.Common.Dtos.VisualDev; +using System.Data; +using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Models; using JNPF.Systems.Entitys.System; -using System.Data; namespace JNPF.Systems.Interfaces.System; diff --git a/system/Tnb.Systems.Interfaces/System/IModuleColumnService.cs b/system/Tnb.Systems.Interfaces/System/IModuleColumnService.cs index f1b50014..465af3eb 100644 --- a/system/Tnb.Systems.Interfaces/System/IModuleColumnService.cs +++ b/system/Tnb.Systems.Interfaces/System/IModuleColumnService.cs @@ -1,5 +1,4 @@ -using JNPF.Systems.Entitys.Dto.ModuleColumn; -using JNPF.Systems.Entitys.System; +using JNPF.Systems.Entitys.System; namespace JNPF.Systems.Interfaces.System; diff --git a/system/Tnb.Systems.Interfaces/Tnb.Systems.Interfaces.csproj b/system/Tnb.Systems.Interfaces/Tnb.Systems.Interfaces.csproj index cceae252..2cc455e7 100644 --- a/system/Tnb.Systems.Interfaces/Tnb.Systems.Interfaces.csproj +++ b/system/Tnb.Systems.Interfaces/Tnb.Systems.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/system/Tnb.Systems/Common/HeartbeatService.cs b/system/Tnb.Systems/Common/HeartbeatService.cs index 43b96649..2e4a6061 100644 --- a/system/Tnb.Systems/Common/HeartbeatService.cs +++ b/system/Tnb.Systems/Common/HeartbeatService.cs @@ -1,19 +1,8 @@ -using System.Data; -using JNPF.Common.Core.Manager; -using JNPF.Common.Filter; -using JNPF.Common.Security; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Extras.Thirdparty.JSEngine; -using JNPF.JsonSerialization; using JNPF.Logging.Attributes; -using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Entitys.System; -using JNPF.TaskScheduler; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; -using SqlSugar; namespace JNPF.Systems.Common; @@ -24,12 +13,12 @@ namespace JNPF.Systems.Common; [Route("api")] public class HeartbeatService : IDynamicApiController, ITransient { - [HttpGet("heartbeat")] - [AllowAnonymous] - [IgnoreLog] - public string Heartbeat() - { - return DateTime.Now.ToString(); - } + [HttpGet("heartbeat")] + [AllowAnonymous] + [IgnoreLog] + public string Heartbeat() + { + return DateTime.Now.ToString(); + } } diff --git a/system/Tnb.Systems/Common/SampleService.cs b/system/Tnb.Systems/Common/SampleService.cs index 1a0a5523..03ccfd4b 100644 --- a/system/Tnb.Systems/Common/SampleService.cs +++ b/system/Tnb.Systems/Common/SampleService.cs @@ -1,23 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; +using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; +using JNPF.Systems.Entitys.Permission; using JNPF.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Mvc; -using NPOI.Util; -using SqlSugar; -using JNPF.Systems.Entitys.Permission; using Mapster; -using JNPF.Common.Filter; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; namespace Tnb.BasicData { diff --git a/system/Tnb.Systems/Common/TestService.cs b/system/Tnb.Systems/Common/TestService.cs index ac3b083f..68d6783c 100644 --- a/system/Tnb.Systems/Common/TestService.cs +++ b/system/Tnb.Systems/Common/TestService.cs @@ -1,15 +1,9 @@ -using System.Data; -using JNPF.Common.Core.Manager; -using JNPF.Common.Filter; -using JNPF.Common.Security; +using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Extras.Thirdparty.JSEngine; using JNPF.JsonSerialization; using JNPF.Logging.Attributes; using JNPF.Systems.Entitys.Permission; -using JNPF.Systems.Entitys.System; -using JNPF.TaskScheduler; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Cors; using Microsoft.AspNetCore.Mvc; @@ -71,17 +65,17 @@ public class TestService : IDynamicApiController, ITransient } - public async Task ImportMoldData() + public async Task ImportMoldData() { - + } - public void xx(UserEntity user) - { - user.Account = "2312321"; + public void xx(UserEntity user) + { + user.Account = "2312321"; - } + } public void xx1(UserEntity user) { diff --git a/system/Tnb.Systems/Permission/AuthorizeService.cs b/system/Tnb.Systems/Permission/AuthorizeService.cs index a680dfc6..ae68c5d3 100644 --- a/system/Tnb.Systems/Permission/AuthorizeService.cs +++ b/system/Tnb.Systems/Permission/AuthorizeService.cs @@ -1,5 +1,4 @@ -using Aop.Api.Domain; -using JNPF.Common.Const; +using JNPF.Common.Const; using JNPF.Common.Core.Handlers; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; @@ -7,7 +6,6 @@ using JNPF.Common.Extension; using JNPF.Common.Manager; using JNPF.Common.Models.User; using JNPF.Common.Security; -using JNPF.DatabaseAccessor; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; diff --git a/system/Tnb.Systems/Permission/DepartmentService.cs b/system/Tnb.Systems/Permission/DepartmentService.cs index 872c5ce1..2233e3db 100644 --- a/system/Tnb.Systems/Permission/DepartmentService.cs +++ b/system/Tnb.Systems/Permission/DepartmentService.cs @@ -1,12 +1,9 @@ -using System.Collections; -using Aop.Api.Domain; -using JNPF.Common.Core.Manager; +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; @@ -20,7 +17,6 @@ using Mapster; using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Senparc.Weixin.MP.AdvancedAPIs.Comment.CommentJson; using SqlSugar; using Tnb.BasicData; using Tnb.BasicData.Entities; @@ -315,7 +311,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra if (adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); #endregion - + if (input.category != DictConst.RegionCategoryCompanyCode) { var jsonObj = input.propertyJson; @@ -478,7 +474,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra int isOK = await _repository.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).CallEntityMethod(m => m.LastModify()).ExecuteCommandAsync(); if (!(isOK > 0)) throw Oops.Oh(ErrorCode.D2018); - + //modified by zkd on 20230718 处理二维码 if (input.category != DictConst.RegionCategoryCompanyCode) { @@ -486,7 +482,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra var qrcode = jsonObj.GetValue("qrcode"); if (qrcode is not null && !string.IsNullOrEmpty(qrcode.ToString())) { - if (await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == qrcode.ToString() && x.source_id!=id)) + if (await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == qrcode.ToString() && x.source_id != id)) { throw Oops.Bah("二维码总表中已存在该二维码"); } @@ -514,7 +510,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra } } } - + //modified by ly on 20230426 处理工位信息,将工位插入到设备表 if (input.category == DictConst.RegionCategoryStationCode) { @@ -555,7 +551,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra if (processVal is not null) { //modifyby zhoukeda 2023.06.25 - var dic = _repository.GetList(x=>x.DeleteMark==null).ToDictionary(x => x.FullName, x => x.Id); + var dic = _repository.GetList(x => x.DeleteMark == null).ToDictionary(x => x.FullName, x => x.Id); var procList = jsonObj.Value("rowprocess"); var pids = procList.Select(x => x.Value("id")).Distinct().ToList(); var dbProcIds = await _repository.AsSugarClient().Queryable().Where(it => pids.Contains(it.process_id)).Select(it => it.process_id).ToListAsync(); @@ -584,11 +580,11 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra isOK = await _repository.AsSugarClient().Updateable(it => new BasProcessStation { station_id = "", station_code = "" }).Where(it => curProcIds.Contains(it.process_id)).ExecuteCommandAsync(); } } - var correlation= jsonObj.GetValue("correlation"); + var correlation = jsonObj.GetValue("correlation"); if (correlation is not null) { await _repository.AsSugarClient().Deleteable(p => p.OrganizeId == id && p.ObjectType == "User").ExecuteCommandAsync(); - var OrganizeRelationEntitys=new List(); + var OrganizeRelationEntitys = new List(); for (int i = 0; i < correlation.Count(); i++) { OrganizeRelationEntity organizeRelationEntity = new OrganizeRelationEntity(); @@ -651,7 +647,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra /// /// [HttpPost] - public async Task GetFpropertyjsonById(Dictionary dic) + public async Task GetFpropertyjsonById(Dictionary dic) { string id = dic["id"]; string type = dic["type"]; @@ -681,9 +677,9 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra if (dictionary.TryGetValue("rowprocess", out var value)) { List processes = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(value)); - return new Dictionary() + return new Dictionary() { - ["list"] = processes.Select(x=>new + ["list"] = processes.Select(x => new { id = x.id, code = x.process_code, @@ -693,7 +689,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra } } } - return new Dictionary() + return new Dictionary() { ["list"] = Enumerable.Empty() }; @@ -720,7 +716,7 @@ public class DepartmentService : IDepartmentService, IDynamicApiController, ITra return null; } - + /// /// 根据工位id获取车间信息 /// diff --git a/system/Tnb.Systems/Permission/GroupService.cs b/system/Tnb.Systems/Permission/GroupService.cs index 693e2f67..c6fa135d 100644 --- a/system/Tnb.Systems/Permission/GroupService.cs +++ b/system/Tnb.Systems/Permission/GroupService.cs @@ -6,10 +6,10 @@ using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Entitys.Dto.Group; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.Permission; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; diff --git a/system/Tnb.Systems/Permission/OrganizeAdministratorService.cs b/system/Tnb.Systems/Permission/OrganizeAdministratorService.cs index 111711c9..fa2e3cb8 100644 --- a/system/Tnb.Systems/Permission/OrganizeAdministratorService.cs +++ b/system/Tnb.Systems/Permission/OrganizeAdministratorService.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Contracts; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Filter; @@ -78,7 +77,8 @@ public class OrganizeAdministratorService : IOrganizeAdministratorService, IDyna List? orgIds = dataScope.Where(x => x.ThisLayerSelect.Equals(1)).Select(x => x.OrganizeId).ToList(); if (dataScope.Any(x => x.SubLayerSelect.Equals(1))) { - dataScope.Where(x => x.SubLayerSelect.Equals(1)).ToList().ForEach(item => { + dataScope.Where(x => x.SubLayerSelect.Equals(1)).ToList().ForEach(item => + { var resList = _repository.AsSugarClient().Queryable().Where(o => !o.Id.Equals(item.OrganizeId) && o.OrganizeIdTree.Contains(item.OrganizeId) && o.DeleteMark == null && o.EnabledMark == 1).Select(x => x.Id).ToList(); orgIds.AddRange(resList); }); @@ -352,7 +352,7 @@ public class OrganizeAdministratorService : IOrganizeAdministratorService, IDyna resultItem.organizeIdTree = orgItem.OrganizeIdTree; if (userItem.ThisLayerAdd.Equals(0)) resultItem.thisLayerAdd = -1; - else if(userItem.ThisLayerAdd.Equals(1)) resultItem.thisLayerAdd = 2; + else if (userItem.ThisLayerAdd.Equals(1)) resultItem.thisLayerAdd = 2; else if (userItem.ThisLayerAdd.Equals(3) || userItem.ThisLayerAdd.Equals(1)) resultItem.thisLayerAdd = 3; if (userItem.ThisLayerEdit.Equals(0)) resultItem.thisLayerEdit = -1; @@ -504,7 +504,7 @@ public class OrganizeAdministratorService : IOrganizeAdministratorService, IDyna [UnitOfWork] public async Task Save([FromBody] OrganizeAdminIsTratorUpInput input) { - if(input.userId.Equals(_userManager.UserId)) throw Oops.Oh(ErrorCode.D2304); + if (input.userId.Equals(_userManager.UserId)) throw Oops.Oh(ErrorCode.D2304); // 处理组织树 名称 List orgTreeNameList = GetOrgListTreeName(); @@ -552,7 +552,7 @@ public class OrganizeAdministratorService : IOrganizeAdministratorService, IDyna }); // 管理员权限 - var adminList= currList.Where(x => x.ThisLayerAdd.Equals(1) || x.ThisLayerEdit.Equals(1) || x.ThisLayerDelete.Equals(1) || x.ThisLayerSelect.Equals(1) || + var adminList = currList.Where(x => x.ThisLayerAdd.Equals(1) || x.ThisLayerEdit.Equals(1) || x.ThisLayerDelete.Equals(1) || x.ThisLayerSelect.Equals(1) || x.SubLayerAdd.Equals(1) || x.SubLayerEdit.Equals(1) || x.SubLayerDelete.Equals(1) || x.SubLayerSelect.Equals(1)).Where(x => x.UserId.Equals(_userManager.UserId)).ToList().Copy(); adminList.Where(x => x.SubLayerAdd.Equals(1) || x.SubLayerEdit.Equals(1) || x.SubLayerDelete.Equals(1) || x.SubLayerSelect.Equals(1)).ToList().ForEach(item => { @@ -733,7 +733,7 @@ public class OrganizeAdministratorService : IOrganizeAdministratorService, IDyna /// private List GetOrganizeAdministrators(List orgAdminList, string userId, List oldList, List adminList) { - if(!_userManager.IsAdministrator) + if (!_userManager.IsAdministrator) { var addItems = new List(); orgAdminList.ForEach(item => @@ -768,7 +768,7 @@ public class OrganizeAdministratorService : IOrganizeAdministratorService, IDyna }); oldList.ForEach(item => { - if(!orgAdminList.Any(x => x.organizeId.Equals(item.OrganizeId)) && !adminList.Any(x => x.OrganizeId.Equals(item.OrganizeId))) + if (!orgAdminList.Any(x => x.organizeId.Equals(item.OrganizeId)) && !adminList.Any(x => x.OrganizeId.Equals(item.OrganizeId))) { addItems.Add(new OrganizeAdminCrInput() { diff --git a/system/Tnb.Systems/Permission/OrganizeService.cs b/system/Tnb.Systems/Permission/OrganizeService.cs index e2a7bf88..a0a14251 100644 --- a/system/Tnb.Systems/Permission/OrganizeService.cs +++ b/system/Tnb.Systems/Permission/OrganizeService.cs @@ -19,7 +19,6 @@ using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using Tnb.BasicData; using Yitter.IdGenerator; namespace JNPF.Systems; @@ -317,19 +316,19 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie queryWhere = queryWhere.And(x => x.DeleteMark == null); List? data = await _repository.AsQueryable().Where(queryWhere) .WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword)).Select(a => new OrganizeListOutput - { - id = a.Id, - organizeIdTree = a.OrganizeIdTree, - type = a.Category, - parentId = a.ParentId, - lastFullName = a.FullName, - fullName = a.FullName, - enabledMark = a.EnabledMark, - creatorTime = a.CreatorTime, - icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1", - sortCode = a.SortCode, - isLeaf = true - }).ToListAsync(); + { + id = a.Id, + organizeIdTree = a.OrganizeIdTree, + type = a.Category, + parentId = a.ParentId, + lastFullName = a.FullName, + fullName = a.FullName, + enabledMark = a.EnabledMark, + creatorTime = a.CreatorTime, + icon = a.Category.Equals("company") ? "icon-ym icon-ym-tree-organization3" : "icon-ym icon-ym-tree-department1", + sortCode = a.SortCode, + isLeaf = true + }).ToListAsync(); // 获取所有组织 List? allOrgList = GetOrgListTreeName(); @@ -420,7 +419,7 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie }); }); - if(adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); + if (adminlist.Any()) await _repository.AsSugarClient().Insertable(adminlist).CallEntityMethod(m => m.Create()).ExecuteReturnEntityAsync(); #endregion #region 第三方同步 @@ -839,9 +838,9 @@ public class OrganizeService : IOrganizeService, IDynamicApiController, ITransie public async Task GetAnyParentByWorkstationId(string id, string type) { return await _repository.AsQueryable() - .LeftJoin((a,b)=>a.OrganizeIdTree.Contains(b.Id) && b.Category==type) - .Where((a,b)=>a.Id==id) - .Select((a,b)=>b).FirstAsync(); + .LeftJoin((a, b) => a.OrganizeIdTree.Contains(b.Id) && b.Category == type) + .Where((a, b) => a.Id == id) + .Select((a, b) => b).FirstAsync(); } /// diff --git a/system/Tnb.Systems/Permission/PositionService.cs b/system/Tnb.Systems/Permission/PositionService.cs index 9bb961ca..29753cdd 100644 --- a/system/Tnb.Systems/Permission/PositionService.cs +++ b/system/Tnb.Systems/Permission/PositionService.cs @@ -4,7 +4,6 @@ using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Manager; -using JNPF.Common.Models.User; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; diff --git a/system/Tnb.Systems/Permission/SocialsUserService.cs b/system/Tnb.Systems/Permission/SocialsUserService.cs index 2c0df364..22b4b979 100644 --- a/system/Tnb.Systems/Permission/SocialsUserService.cs +++ b/system/Tnb.Systems/Permission/SocialsUserService.cs @@ -1,5 +1,4 @@ using System.Web; -using JNPF.Common.Const; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Manager; @@ -354,7 +353,7 @@ public class SocialsUserService : ISocialsUserService, IDynamicApiController, IT return new WeChatOpenAuthRequest(clientConfig, authStateCache); case DefaultAuthSourceEnum.WECHAT_ENTERPRISE: - //return new WeChatEnterpriseAuthRequest(clientConfig, authStateCache); + //return new WeChatEnterpriseAuthRequest(clientConfig, authStateCache); case DefaultAuthSourceEnum.WECHAT_ENTERPRISE_SCAN: clientConfig.redirectUri = HttpUtility.UrlEncode(clientConfig.redirectUri); diff --git a/system/Tnb.Systems/Permission/UserRelationService.cs b/system/Tnb.Systems/Permission/UserRelationService.cs index 5c8ee7bc..cb97df41 100644 --- a/system/Tnb.Systems/Permission/UserRelationService.cs +++ b/system/Tnb.Systems/Permission/UserRelationService.cs @@ -384,7 +384,7 @@ public class UserRelationService : IUserRelationService, IDynamicApiController, else { return _repository.AsSugarClient().Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.UserId == b.Id)) - .Where((a, b) => b.DeleteMark == null && (objId.Contains(a.ObjectId)|| objId.Contains(a.UserId)) && b.EnabledMark > 0).Select(a => a.UserId).Distinct().ToList(); + .Where((a, b) => b.DeleteMark == null && (objId.Contains(a.ObjectId) || objId.Contains(a.UserId)) && b.EnabledMark > 0).Select(a => a.UserId).Distinct().ToList(); } } else diff --git a/system/Tnb.Systems/Permission/UsersCurrentService.cs b/system/Tnb.Systems/Permission/UsersCurrentService.cs index 09535467..e01ca9e2 100644 --- a/system/Tnb.Systems/Permission/UsersCurrentService.cs +++ b/system/Tnb.Systems/Permission/UsersCurrentService.cs @@ -335,7 +335,8 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController, user.ChangePasswordDate = DateTime.Now; user.LastModifyTime = DateTime.Now; user.LastModifyUserId = _userManager.UserId; - int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new { + int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new + { it.Password, it.ChangePasswordDate, it.LastModifyUserId, @@ -356,7 +357,8 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController, userInfo.IsAdministrator = Convert.ToInt32(_userManager.IsAdministrator); userInfo.LastModifyTime = DateTime.Now; userInfo.LastModifyUserId = _userManager.UserId; - int isOk = await _repository.AsUpdateable(userInfo).UpdateColumns(it => new { + int isOk = await _repository.AsUpdateable(userInfo).UpdateColumns(it => new + { it.RealName, it.Signature, it.Gender, @@ -390,7 +392,8 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController, user.Theme = input.theme; user.LastModifyTime = DateTime.Now; user.LastModifyUserId = _userManager.UserId; - int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new { + int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new + { it.Theme, it.LastModifyUserId, it.LastModifyTime @@ -409,7 +412,8 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController, user.Language = input.language; user.LastModifyTime = DateTime.Now; user.LastModifyUserId = _userManager.UserId; - int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new { + int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new + { it.Language, it.LastModifyUserId, it.LastModifyTime @@ -428,7 +432,8 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController, user.HeadIcon = name; user.LastModifyTime = DateTime.Now; user.LastModifyUserId = _userManager.UserId; - int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new { + int isOk = await _repository.AsUpdateable(user).UpdateColumns(it => new + { it.HeadIcon, it.LastModifyUserId, it.LastModifyTime @@ -521,7 +526,8 @@ public class UsersCurrentService : IUsersCurrentService, IDynamicApiController, userInfo.LastModifyTime = DateTime.Now; userInfo.LastModifyUserId = _userManager.UserId; - int isOk = await _repository.AsUpdateable(userInfo).UpdateColumns(it => new { + int isOk = await _repository.AsUpdateable(userInfo).UpdateColumns(it => new + { it.OrganizeId, it.PositionId, it.LastModifyUserId, diff --git a/system/Tnb.Systems/Permission/UsersService.cs b/system/Tnb.Systems/Permission/UsersService.cs index 18cf74b8..ad73a566 100644 --- a/system/Tnb.Systems/Permission/UsersService.cs +++ b/system/Tnb.Systems/Permission/UsersService.cs @@ -1,4 +1,4 @@ -using Aop.Api.Domain; +using System.Linq.Expressions; using JNPF.Common.Configuration; using JNPF.Common.Const; using JNPF.Common.Core.Manager; @@ -32,21 +32,11 @@ using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; using Mapster; -using Microsoft.AspNetCore.Authentication.OAuth; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; using Microsoft.Extensions.Options; -using NPOI.SS.Formula.Eval; -using NPOI.SS.Formula.Functions; -using Org.BouncyCastle.Ocsp; -using Qiniu.Util; -using Senparc.NeuChar.App.AppStore; using SqlSugar; -using System; -using System.Linq.Expressions; -using System.Security.Principal; -using System.Text.Json.Nodes; namespace JNPF.Systems; @@ -312,7 +302,8 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient .Where((a, b) => b.ObjectType == "Organize" && orgList.Contains(b.ObjectId)).Where((a, b) => a.EnabledMark == 1 && a.DeleteMark == null) .Where((a, b) => a.RealName.Contains(input.keyword) || a.Account.Contains(input.keyword)) .GroupBy((a, b) => new { a.Id, a.RealName, a.Account, a.EnabledMark }) - .Select((a, b) => new { + .Select((a, b) => new + { id = a.Id, fullName = SqlFunc.MergeString(a.RealName, "/", a.Account), enabledMark = a.EnabledMark, @@ -357,7 +348,8 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient var res = await _repository.AsSugarClient().Queryable((a, b) => new JoinQueryInfos(JoinType.Left, b.UserId == a.Id)) .Where((a, b) => b.ObjectType == "Organize" && b.ObjectId == input.organizeId).Where((a, b) => a.EnabledMark == 1 && a.DeleteMark == null) .GroupBy((a, b) => new { a.Id, a.RealName, a.Account, a.EnabledMark }) - .Select((a, b) => new { + .Select((a, b) => new + { id = a.Id, fullName = SqlFunc.MergeString(a.RealName, "/", a.Account), enabledMark = a.EnabledMark, @@ -564,7 +556,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient var oids = userList.Where(x => x.UserId.Equals(item.id)).Select(x => x.ObjectId).ToList(); var oTree = orgList.Where(x => oids.Contains(x.Id)).Select(x => x.Description).ToList(); item.organize = string.Join(",", oTree); - //item.type = org.fullName; + //item.type = org.fullName; }); } @@ -1148,7 +1140,7 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient public async Task Update(string id, [FromBody] UserUpInput input) { UserEntity? oldUserEntity = await _repository.GetFirstAsync(it => it.Id == id); - input.roleId = input.roleId == null ? string.Empty : input.roleId; + input.roleId = input.roleId == null ? string.Empty : input.roleId; // 超级管理员 只有 admin 账号才有变更权限 if (_userManager.UserId != oldUserEntity.Id && oldUserEntity.IsAdministrator == 1 && _userManager.Account != "admin") @@ -1240,7 +1232,8 @@ public class UsersService : IUsersService, IDynamicApiController, ITransient try { // 更新用户记录 - int newEntity = await _repository.AsUpdateable(entity).UpdateColumns(it => new { + int newEntity = await _repository.AsUpdateable(entity).UpdateColumns(it => new + { it.Account, it.RealName, it.QuickQuery, diff --git a/system/Tnb.Systems/System/BillRuleService.cs b/system/Tnb.Systems/System/BillRuleService.cs index 77a35854..07e3b943 100644 --- a/system/Tnb.Systems/System/BillRuleService.cs +++ b/system/Tnb.Systems/System/BillRuleService.cs @@ -311,7 +311,7 @@ public class BillRuleService : IBillRullService, IDynamicApiController, ITransie if (entity != null) { // 处理隔天流水号归0 - if (entity.OutputNumber != null) + if (entity.OutputNumber != null) { var serialDate = entity.OutputNumber.Remove(entity.OutputNumber.Length - (int)entity.Digit).Replace(entity.Prefix, string.Empty); var thisDate = entity.DateFormat == "no" ? string.Empty : DateTime.Now.ToString(entity.DateFormat); diff --git a/system/Tnb.Systems/System/DataInterfaceService.cs b/system/Tnb.Systems/System/DataInterfaceService.cs index f6379698..91a451b7 100644 --- a/system/Tnb.Systems/System/DataInterfaceService.cs +++ b/system/Tnb.Systems/System/DataInterfaceService.cs @@ -4,7 +4,6 @@ using System.Security.Cryptography; using System.Text; using System.Text.RegularExpressions; using System.Web; -using JNPF.ClayObject; using JNPF.Common.Configuration; using JNPF.Common.Const; using JNPF.Common.Core.Manager; @@ -521,7 +520,8 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController if (interfaceOauthEntity == null) return null; var ymDate = DateTime.Now.ParseToUnixTime().ToString(); var authorization = GetVerifySignature(interfaceOauthEntity, intefaceId, ymDate); - return new { + return new + { YmDate = ymDate, Authorization = authorization, }; @@ -564,7 +564,7 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController var result = await Preview(id, input); if (result is DataTable) { - List> list = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(result)); + List> list = JsonConvert.DeserializeObject>>(JsonConvert.SerializeObject(result)); return list.FirstOrDefault()?.Keys.ToList() ?? Enumerable.Empty(); } else @@ -712,7 +712,8 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController { // 分页 var dt = GetPageToDataTable(resTable, input.currentPage, input.pageSize); - output = new { + output = new + { pagination = new PageResult() { currentPage = input.currentPage, @@ -759,7 +760,8 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController // }); //} resList = resList.FindAll(x => x.Where(xx => xx.Value != null && xx.Value.Contains(input.keyword)).Any()); - output = new { + output = new + { pagination = new PageResult() { currentPage = input.currentPage, @@ -798,7 +800,8 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController if (input.sort.Equals("desc")) resList = resList.OrderBy(x => x[input.sidx]).ToList(); else resList = resList.OrderByDescending(x => x[input.sidx]).ToList(); } - output = new { + output = new + { pagination = new PageResult() { currentPage = input.currentPage, @@ -810,7 +813,8 @@ public class DataInterfaceService : IDataInterfaceService, IDynamicApiController } else { - output = new { + output = new + { pagination = new PageResult() { currentPage = input.currentPage, diff --git a/system/Tnb.Systems/System/DataSyncService.cs b/system/Tnb.Systems/System/DataSyncService.cs index 96bfcbf8..6d70632a 100644 --- a/system/Tnb.Systems/System/DataSyncService.cs +++ b/system/Tnb.Systems/System/DataSyncService.cs @@ -242,7 +242,7 @@ public class DataSyncService : IDynamicApiController, ITransient fieldTypeList.Add("number", GetDataTypeList(3, dbTypeTo)); fieldTypeList.Add("number", GetDataTypeList(4, dbTypeTo)); fieldTypeList.Add("clob", GetDataTypeList(5, dbTypeTo)); - break ; + break; case "dm": fieldTypeList.Add("varchar", GetDataTypeList(0, dbTypeTo)); fieldTypeList.Add("int", GetDataTypeList(1, dbTypeTo)); diff --git a/system/Tnb.Systems/System/DictionaryDataService.cs b/system/Tnb.Systems/System/DictionaryDataService.cs index e4171e29..ec5ed2db 100644 --- a/system/Tnb.Systems/System/DictionaryDataService.cs +++ b/system/Tnb.Systems/System/DictionaryDataService.cs @@ -1,5 +1,4 @@ -using JNPF.ClayObject.Extensions; -using JNPF.Common.Core.Manager; +using JNPF.Common.Core.Manager; using JNPF.Common.Core.Manager.Files; using JNPF.Common.Enums; using JNPF.Common.Manager; diff --git a/system/Tnb.Systems/System/InterfaceOauthService.cs b/system/Tnb.Systems/System/InterfaceOauthService.cs index 97525968..a67f4a2a 100644 --- a/system/Tnb.Systems/System/InterfaceOauthService.cs +++ b/system/Tnb.Systems/System/InterfaceOauthService.cs @@ -22,7 +22,7 @@ namespace JNPF.Systems.System; /// 接口认证 /// 版 本:V3.2 /// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com) - /// 日 期:2021-06-01. +/// 日 期:2021-06-01. /// [ApiDescriptionSettings(Tag = "System", Name = "InterfaceOauth", Order = 202)] [Route("api/system/[controller]")] diff --git a/system/Tnb.Systems/System/ModuleColumnService.cs b/system/Tnb.Systems/System/ModuleColumnService.cs index 27d2a174..bd3a250e 100644 --- a/system/Tnb.Systems/System/ModuleColumnService.cs +++ b/system/Tnb.Systems/System/ModuleColumnService.cs @@ -12,7 +12,6 @@ using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev.Engine; -using JNPF.VisualDev.Engine.Core; using JNPF.VisualDev.Entitys; using Mapster; using Microsoft.AspNetCore.Mvc; @@ -74,7 +73,7 @@ public class ModuleColumnService : IModuleColumnService, IDynamicApiController, fullName = a.FullName, enCode = SqlFunc.IF(a.FieldRule == 1 && !SqlFunc.IsNullOrEmpty(a.BindTable)).Return(a.EnCode.Replace("jnpf_" + a.BindTable + "_jnpf_", "")) .ElseIF(b.Type == 3 && a.FieldRule == 1).Return(a.EnCode.Replace(a.BindTable + ".", "")) - .ElseIF(a.FieldRule == 2).Return(a.EnCode.Replace(a.ChildTableKey+"-", "")).End(a.EnCode), + .ElseIF(a.FieldRule == 2).Return(a.EnCode.Replace(a.ChildTableKey + "-", "")).End(a.EnCode), id = a.Id, sortCode = a.SortCode }).ToListAsync(); @@ -91,7 +90,7 @@ public class ModuleColumnService : IModuleColumnService, IDynamicApiController, { var data = await _repository.GetFirstAsync(x => x.Id == id && x.DeleteMark == null); if (data.FieldRule == 2 && data.ChildTableKey.IsNotEmptyOrNull()) - data.EnCode = data.EnCode.Replace(data.ChildTableKey+"-", string.Empty); + data.EnCode = data.EnCode.Replace(data.ChildTableKey + "-", string.Empty); var menu = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.Id == data.ModuleId && x.DeleteMark == null); if (menu.IsNotEmptyOrNull() && data.BindTable.IsNotEmptyOrNull() && data.FieldRule == 1) { @@ -138,7 +137,7 @@ public class ModuleColumnService : IModuleColumnService, IDynamicApiController, { var entity = input.Adapt(); if (entity.FieldRule == 2 && input.childTableKey.IsNotEmptyOrNull()) - entity.EnCode = input.childTableKey +"-"+ entity.EnCode; + entity.EnCode = input.childTableKey + "-" + entity.EnCode; var menu = await _repository.AsSugarClient().Queryable().FirstAsync(x => x.Id == input.moduleId && x.DeleteMark == null); if (menu.IsNotEmptyOrNull() && entity.BindTable.IsNotEmptyOrNull() && entity.FieldRule == 1) { @@ -236,7 +235,7 @@ public class ModuleColumnService : IModuleColumnService, IDynamicApiController, entity.FullName = item.fullName; entity.BindTable = item.bindTable; entity.FieldRule = item.fieldRule; - entity.ChildTableKey=item.childTableKey; + entity.ChildTableKey = item.childTableKey; entity.SortCode = 0; if (entity.FieldRule == 2 && item.childTableKey.IsNotEmptyOrNull()) entity.EnCode = item.childTableKey + "-" + entity.EnCode; diff --git a/system/Tnb.Systems/System/ModuleDataAuthorizeService.cs b/system/Tnb.Systems/System/ModuleDataAuthorizeService.cs index 05a0deba..1d6cdea0 100644 --- a/system/Tnb.Systems/System/ModuleDataAuthorizeService.cs +++ b/system/Tnb.Systems/System/ModuleDataAuthorizeService.cs @@ -10,7 +10,6 @@ using JNPF.Systems.Entitys.Dto.ModuleDataAuthorize; using JNPF.Systems.Entitys.Dto.ModuleDataAuthorizeScheme; using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev.Engine; using JNPF.VisualDev.Engine.Core; using JNPF.VisualDev.Entitys; using Mapster; diff --git a/system/Tnb.Systems/System/ModuleFormService.cs b/system/Tnb.Systems/System/ModuleFormService.cs index 2b43ecbd..bdf22970 100644 --- a/system/Tnb.Systems/System/ModuleFormService.cs +++ b/system/Tnb.Systems/System/ModuleFormService.cs @@ -12,7 +12,6 @@ using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev.Engine; -using JNPF.VisualDev.Engine.Core; using JNPF.VisualDev.Entitys; using Mapster; using Microsoft.AspNetCore.Mvc; diff --git a/system/Tnb.Systems/System/MonitorService.cs b/system/Tnb.Systems/System/MonitorService.cs index 89541a3d..f304fe7b 100644 --- a/system/Tnb.Systems/System/MonitorService.cs +++ b/system/Tnb.Systems/System/MonitorService.cs @@ -1,10 +1,9 @@ -using JNPF.Common.Security; +using System.Runtime.InteropServices; +using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.Systems.Entitys.Dto.Monitor; -using JNPF.Systems.Interfaces.System; using Microsoft.AspNetCore.Mvc; -using System.Runtime.InteropServices; namespace JNPF.Systems; diff --git a/system/Tnb.Systems/System/PrintDevService.cs b/system/Tnb.Systems/System/PrintDevService.cs index 98c3d510..35c0f307 100644 --- a/system/Tnb.Systems/System/PrintDevService.cs +++ b/system/Tnb.Systems/System/PrintDevService.cs @@ -90,9 +90,9 @@ public class PrintDevService : IDynamicApiController, ITransient [HttpGet("")] public async Task GetList_Api([FromQuery] PrintDevListInput input) { - var list = await _repository.AsSugarClient().Queryable((a, b, c, d,e) => - new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId,JoinType.Left,d.EnCode=="printDev", JoinType.Left, a.Category == e.EnCode && d.Id==e.DictionaryTypeId)) - .Where((a, b, c, d,e) => a.DeleteMark == null ) + var list = await _repository.AsSugarClient().Queryable((a, b, c, d, e) => + new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId, JoinType.Left, d.EnCode == "printDev", JoinType.Left, a.Category == e.EnCode && d.Id == e.DictionaryTypeId)) + .Where((a, b, c, d, e) => a.DeleteMark == null) .WhereIF(input.category.IsNotEmptyOrNull(), a => a.Category == input.category) .WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword)) .OrderBy(a => a.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc) @@ -120,10 +120,10 @@ public class PrintDevService : IDynamicApiController, ITransient [HttpGet("Selector")] public async Task GetList_Api([FromQuery] string type) { - var list = await _repository.AsSugarClient().Queryable((a, b, c, d,e) => new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId, JoinType.Left, d.EnCode=="printDev", JoinType.Left, a.Category == e.EnCode && d.Id==e.DictionaryTypeId)) + var list = await _repository.AsSugarClient().Queryable((a, b, c, d, e) => new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId, JoinType.Left, d.EnCode == "printDev", JoinType.Left, a.Category == e.EnCode && d.Id == e.DictionaryTypeId)) .Where((a, b, c, d) => a.DeleteMark == null && a.EnabledMark == 1).OrderBy(a => a.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc) .WhereIF(type.IsNotEmptyOrNull(), (a) => a.Type == type.ParseToInt()) - .Select((a, b, c, d,e) => new PrintDevListOutput + .Select((a, b, c, d, e) => new PrintDevListOutput { category = a.Category, id = a.Id, diff --git a/system/Tnb.Systems/System/PrintLogService.cs b/system/Tnb.Systems/System/PrintLogService.cs index 4d038345..45f27513 100644 --- a/system/Tnb.Systems/System/PrintLogService.cs +++ b/system/Tnb.Systems/System/PrintLogService.cs @@ -1,5 +1,6 @@ using JNPF.Common.Core.Manager; using JNPF.Common.Enums; +using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Security; using JNPF.DependencyInjection; @@ -12,7 +13,6 @@ using JNPF.Systems.Entitys.Permission; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using JNPF.Common.Extension; namespace JNPF.Systems.System; @@ -94,7 +94,7 @@ public class PrintLogService : IDynamicApiController, ITransient public async Task Delete([FromBody] PrintLogOutuut input) { var entity = input.Adapt(); - entity.Id= SnowflakeIdHelper.NextId(); + entity.Id = SnowflakeIdHelper.NextId(); entity.PrintMan = _userManager.UserId; entity.PrintTime = DateTime.Now; var isOk = await _repository.AsInsertable(entity).ExecuteCommandAsync(); diff --git a/system/Tnb.Systems/System/ProvinceService.cs b/system/Tnb.Systems/System/ProvinceService.cs index 586c2901..da0db5e5 100644 --- a/system/Tnb.Systems/System/ProvinceService.cs +++ b/system/Tnb.Systems/System/ProvinceService.cs @@ -6,7 +6,6 @@ using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Dto.Province; using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; diff --git a/system/Tnb.Systems/System/SysLogService.cs b/system/Tnb.Systems/System/SysLogService.cs index 8ece9d8f..20d6453d 100644 --- a/system/Tnb.Systems/System/SysLogService.cs +++ b/system/Tnb.Systems/System/SysLogService.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Extension; +using System.Reflection; +using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.DatabaseAccessor; using JNPF.DependencyInjection; @@ -10,7 +11,6 @@ using JNPF.Systems.Entitys.System; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; -using System.Reflection; namespace JNPF.Systems; diff --git a/system/Tnb.Systems/System/SystemService.cs b/system/Tnb.Systems/System/SystemService.cs index a7cb7e81..7685865d 100644 --- a/system/Tnb.Systems/System/SystemService.cs +++ b/system/Tnb.Systems/System/SystemService.cs @@ -1,10 +1,8 @@ -using Aop.Api.Domain; -using JNPF.Common.Const; +using JNPF.Common.Const; using JNPF.Common.Core.Handlers; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; using JNPF.Common.Extension; -using JNPF.Common.Filter; using JNPF.Common.Manager; using JNPF.Common.Models.User; using JNPF.Common.Security; diff --git a/system/Tnb.Systems/Tnb.Systems.csproj b/system/Tnb.Systems/Tnb.Systems.csproj index 1baf4b60..ef1765d0 100644 --- a/system/Tnb.Systems/Tnb.Systems.csproj +++ b/system/Tnb.Systems/Tnb.Systems.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/taskschedule/Tnb.TaskScheduler.Entitys/Dto/TaskScheduler/TimeTaskUpInput.cs b/taskschedule/Tnb.TaskScheduler.Entitys/Dto/TaskScheduler/TimeTaskUpInput.cs index ea39fb97..1c785009 100644 --- a/taskschedule/Tnb.TaskScheduler.Entitys/Dto/TaskScheduler/TimeTaskUpInput.cs +++ b/taskschedule/Tnb.TaskScheduler.Entitys/Dto/TaskScheduler/TimeTaskUpInput.cs @@ -3,7 +3,7 @@ namespace JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; [SuppressSniffer] -public class TimeTaskUpInput:TimeTaskCrInput +public class TimeTaskUpInput : TimeTaskCrInput { /// /// id. diff --git a/taskschedule/Tnb.TaskScheduler.Entitys/Entity/SnowId.cs b/taskschedule/Tnb.TaskScheduler.Entitys/Entity/SnowId.cs index a0993514..ee306a88 100644 --- a/taskschedule/Tnb.TaskScheduler.Entitys/Entity/SnowId.cs +++ b/taskschedule/Tnb.TaskScheduler.Entitys/Entity/SnowId.cs @@ -14,6 +14,6 @@ namespace JNPF.TaskScheduler.Entitys.Entity; [Tenant(ClaimConst.TENANTID)] public class SnowIdEntity : IEntity { - //[SugarColumn(ColumnName = "id")] - public string Id { get; set; } + //[SugarColumn(ColumnName = "id")] + public string Id { get; set; } } diff --git a/taskschedule/Tnb.TaskScheduler.Entitys/Entity/TimeTaskEntity.cs b/taskschedule/Tnb.TaskScheduler.Entitys/Entity/TimeTaskEntity.cs index ea046fd7..6528ad2f 100644 --- a/taskschedule/Tnb.TaskScheduler.Entitys/Entity/TimeTaskEntity.cs +++ b/taskschedule/Tnb.TaskScheduler.Entitys/Entity/TimeTaskEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using JNPF.Common.Contracts; +using JNPF.Common.Contracts; using SqlSugar; namespace JNPF.TaskScheduler.Entitys; diff --git a/taskschedule/Tnb.TaskScheduler.Entitys/Mapper/Mapper.cs b/taskschedule/Tnb.TaskScheduler.Entitys/Mapper/Mapper.cs index 4663f2e8..d784042b 100644 --- a/taskschedule/Tnb.TaskScheduler.Entitys/Mapper/Mapper.cs +++ b/taskschedule/Tnb.TaskScheduler.Entitys/Mapper/Mapper.cs @@ -1,6 +1,5 @@ using JNPF.Common.Extension; using JNPF.Common.Security; -using JNPF.TaskScheduler.Entitys; using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; using JNPF.TaskScheduler.Entitys.Model; using Mapster; diff --git a/taskschedule/Tnb.TaskScheduler.Entitys/Tnb.TaskScheduler.Entitys.csproj b/taskschedule/Tnb.TaskScheduler.Entitys/Tnb.TaskScheduler.Entitys.csproj index f42db347..76ff6275 100644 --- a/taskschedule/Tnb.TaskScheduler.Entitys/Tnb.TaskScheduler.Entitys.csproj +++ b/taskschedule/Tnb.TaskScheduler.Entitys/Tnb.TaskScheduler.Entitys.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/taskschedule/Tnb.TaskScheduler.Interfaces/Tnb.TaskScheduler.Interfaces.csproj b/taskschedule/Tnb.TaskScheduler.Interfaces/Tnb.TaskScheduler.Interfaces.csproj index 296a711e..06e5f273 100644 --- a/taskschedule/Tnb.TaskScheduler.Interfaces/Tnb.TaskScheduler.Interfaces.csproj +++ b/taskschedule/Tnb.TaskScheduler.Interfaces/Tnb.TaskScheduler.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/taskschedule/Tnb.TaskScheduler/Listener/GenerateMaintainPlanTimeWorker.cs b/taskschedule/Tnb.TaskScheduler/Listener/GenerateMaintainPlanTimeWorker.cs index a58f132d..baba20a4 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/GenerateMaintainPlanTimeWorker.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/GenerateMaintainPlanTimeWorker.cs @@ -1,6 +1,5 @@ using JNPF.Common.Security; using JNPF.Logging; -using Microsoft.AspNetCore.Components; using SqlSugar; using Tnb.EquipMgr.Entities; @@ -17,7 +16,7 @@ namespace JNPF.TaskScheduler.Listener // _repository = repository; // } - [SpareTime("0 0 0 * * ?", "生成设备保养计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)] + [SpareTime("0 0 0 * * ?", "生成设备保养计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] public async void GenerateSpotInspectionPlan(SpareTimer timer, long count) { Log.Information("----------------------开始生成设备保养计划----------------------"); @@ -25,12 +24,12 @@ namespace JNPF.TaskScheduler.Listener try { var db = _repository.CopyNew(); - List eqpSpotInsTemEquipHsByOne = await db.Queryable().Where(x => x.is_start=="1" && x.plan_cycle_unit == "1").ToListAsync(); - List eqpSpotInsTemEquipHsByCirculate = await db.Queryable().Where(x => x.is_start=="1" && x.plan_cycle_unit == "2").ToListAsync(); + List eqpSpotInsTemEquipHsByOne = await db.Queryable().Where(x => x.is_start == "1" && x.plan_cycle_unit == "1").ToListAsync(); + List eqpSpotInsTemEquipHsByCirculate = await db.Queryable().Where(x => x.is_start == "1" && x.plan_cycle_unit == "2").ToListAsync(); List tobeCreateList = new List(); List tobeCreateTemplets = new List(); - - + + foreach (var item in eqpSpotInsTemEquipHsByOne) { if (item.start_time.AddDays((double)item.plan_cycle).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")) @@ -38,7 +37,7 @@ namespace JNPF.TaskScheduler.Listener tobeCreateTemplets.Add(item); } } - + if (eqpSpotInsTemEquipHsByCirculate != null && eqpSpotInsTemEquipHsByCirculate.Count > 0) { @@ -48,24 +47,24 @@ namespace JNPF.TaskScheduler.Listener TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts3 = ts1.Subtract(ts2).Duration(); - if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle)==0) + if (ts3.TotalDays * 10 % (10 * (double)item.plan_cycle) == 0) { tobeCreateTemplets.Add(item); } } } - + if (tobeCreateTemplets != null && tobeCreateTemplets.Count > 0) { - List equipments = await db.Queryable().Where(x => x.life==Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync(); + List equipments = await db.Queryable().Where(x => x.life == Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync(); int index = 1; foreach (var item in tobeCreateTemplets) { //只有启用设备才生成计划 if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null) continue; - - string code = $"{DateTime.Now.ToString("yyyyMMdd")+(index++).ToString().PadLeft(3,'0')}"; + + string code = $"{DateTime.Now.ToString("yyyyMMdd") + (index++).ToString().PadLeft(3, '0')}"; tobeCreateList.Add(new EqpMaintainRecordH() { code = code, @@ -94,7 +93,7 @@ namespace JNPF.TaskScheduler.Listener List spotInsItemIDs = spotInsTemEquipDs.Select(x => x.maintain_item_id).ToList(); List spotCheckItems = await db.Queryable().Where(x => spotInsItemIDs.Contains(x.id)).ToListAsync(); - + List spotInsRecordDs = new List(); foreach (var tobeCreatePlan in tobeCreateList) { @@ -120,7 +119,7 @@ namespace JNPF.TaskScheduler.Listener } } - if (spotInsRecordDs.Count<=0) + if (spotInsRecordDs.Count <= 0) { return; } @@ -151,7 +150,7 @@ namespace JNPF.TaskScheduler.Listener Log.Error(e.Message); } - + Log.Information("----------------------结束生成设备保养计划----------------------"); } } diff --git a/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpEquipCheckPlanTimeWorker.cs b/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpEquipCheckPlanTimeWorker.cs index b2742ceb..dc39847b 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpEquipCheckPlanTimeWorker.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpEquipCheckPlanTimeWorker.cs @@ -11,8 +11,8 @@ namespace JNPF.TaskScheduler.Listener public class GenerateSpEquipCheckPlanTimeWorker : ISpareTimeWorker { private ISqlSugarRepository _repository => App.GetService>(); - - [SpareTime("0 0 0 * * ?", "生成特种设备检验计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)] + + [SpareTime("0 0 0 * * ?", "生成特种设备检验计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] public void GenerateSpotInspectionPlan(SpareTimer timer, long count) { Log.Information("----------------------开始生成特种设备检验计划----------------------"); @@ -23,20 +23,20 @@ namespace JNPF.TaskScheduler.Listener List ids = _repository.GetList(x => x.status == "0").Select(x => x.equip_id).Distinct() .ToList(); - - List list = db.Queryable().GroupBy(x=>new - { - x.equip_id, - }).Where(x => x.status == "1" && !ids.Contains(x.equip_id))//排除有未检验的 - .Select(x=>new + + List list = db.Queryable().GroupBy(x => new + { + x.equip_id, + }).Where(x => x.status == "1" && !ids.Contains(x.equip_id))//排除有未检验的 + .Select(x => new { equip_id = x.equip_id, create_time = SqlFunc.AggregateMax(x.create_time), - + }) .MergeTable() - .LeftJoin((x,y)=>x.equip_id==y.equip_id && x.create_time!.Value.ToString("yyyy-MM-dd")==y.create_time!.Value.ToString("yyyy-MM-dd")) - .Select((x,y)=>y) + .LeftJoin((x, y) => x.equip_id == y.equip_id && x.create_time!.Value.ToString("yyyy-MM-dd") == y.create_time!.Value.ToString("yyyy-MM-dd")) + .Select((x, y) => y) .ToList(); List insertList = new List(); @@ -44,7 +44,7 @@ namespace JNPF.TaskScheduler.Listener { foreach (var item in list) { - if (item.end_time != null && item.warn_unit!=null) + if (item.end_time != null && item.warn_unit != null) { if (item.warn_unit == "1") { @@ -58,8 +58,9 @@ namespace JNPF.TaskScheduler.Listener status = "0" }); } - - }else if (item.warn_unit == "2") + + } + else if (item.warn_unit == "2") { if (item.end_time.Value.AddDays(-item.warm_time!.Value).ToString("yyyy-MM-dd") == DateTime.Now.ToString("yyyy-MM-dd")) @@ -72,9 +73,9 @@ namespace JNPF.TaskScheduler.Listener }); } } - + } - + } _repository.InsertRange(insertList); @@ -86,7 +87,7 @@ namespace JNPF.TaskScheduler.Listener Log.Error(e.Message); } - + Log.Information("----------------------结束生成特种设备检验计划----------------------"); } } diff --git a/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs b/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs index 6fd44130..67761aed 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/GenerateSpotInspectionPlanTimeWorker.cs @@ -1,6 +1,5 @@ using JNPF.Common.Security; using JNPF.Logging; -using Microsoft.AspNetCore.Components; using SqlSugar; using Tnb.EquipMgr.Entities; @@ -17,7 +16,7 @@ namespace JNPF.TaskScheduler.Listener // _repository = repository; // } - [SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false)] + [SpareTime("0 0,30 * * * ?", "生成点巡检计划", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] public async void GenerateSpotInspectionPlan(SpareTimer timer, long count) { Log.Information("----------------------开始生成点巡检计划----------------------"); @@ -25,11 +24,11 @@ namespace JNPF.TaskScheduler.Listener try { var db = _repository.CopyNew(); - List eqpSpotInsTemEquipHsByOne = await db.Queryable().Where(x => x.is_start=="1" && x.plan_cycle_unit == "1").ToListAsync(); - List eqpSpotInsTemEquipHsByCirculate = await db.Queryable().Where(x => x.is_start=="1" && x.plan_cycle_unit == "2").ToListAsync(); + List eqpSpotInsTemEquipHsByOne = await db.Queryable().Where(x => x.is_start == "1" && x.plan_cycle_unit == "1").ToListAsync(); + List eqpSpotInsTemEquipHsByCirculate = await db.Queryable().Where(x => x.is_start == "1" && x.plan_cycle_unit == "2").ToListAsync(); List tobeCreateList = new List(); List tobeCreateTemplets = new List(); - + foreach (var item in eqpSpotInsTemEquipHsByOne) { if (item.start_time.AddHours((double)item.plan_cycle).ToString("yyyy-MM-dd HH:mm") == DateTime.Now.ToString("yyyy-MM-dd HH:mm")) @@ -37,7 +36,7 @@ namespace JNPF.TaskScheduler.Listener tobeCreateTemplets.Add(item); } } - + if (eqpSpotInsTemEquipHsByCirculate != null && eqpSpotInsTemEquipHsByCirculate.Count > 0) { //查询最后一条数据加上周期是否等于现在等于表示周期到了 已废除 @@ -71,24 +70,24 @@ namespace JNPF.TaskScheduler.Listener TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm")).Ticks); TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(item.start_time.ToString("yyyy-MM-dd HH:mm")).Ticks); TimeSpan ts3 = ts1.Subtract(ts2).Duration(); - if ((ts3.TotalMinutes+offsetMinute) * 10 / 60 % (10 * (double)item.plan_cycle)==0) + if ((ts3.TotalMinutes + offsetMinute) * 10 / 60 % (10 * (double)item.plan_cycle) == 0) { tobeCreateTemplets.Add(item); } } } - + if (tobeCreateTemplets != null && tobeCreateTemplets.Count > 0) { - List equipments = await db.Queryable().Where(x => x.life==Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync(); + List equipments = await db.Queryable().Where(x => x.life == Tnb.EquipMgr.EquipmentLife.ENABLE).ToListAsync(); int index = 1; foreach (var item in tobeCreateTemplets) { //只有启用设备才生成计划 if (equipments.FirstOrDefault(x => x.id == item.equip_id) == null) continue; - - string code = $"{DateTime.Now.ToString("yyyyMMddHHmm")+(index++).ToString().PadLeft(3,'0')}"; + + string code = $"{DateTime.Now.ToString("yyyyMMddHHmm") + (index++).ToString().PadLeft(3, '0')}"; tobeCreateList.Add(new EqpSpotInsRecordH() { id = SnowflakeIdHelper.NextId(), @@ -118,7 +117,7 @@ namespace JNPF.TaskScheduler.Listener List spotInsItemIDs = spotInsTemEquipDs.Select(x => x.spot_ins_item_id).ToList(); List spotCheckItems = await db.Queryable().Where(x => spotInsItemIDs.Contains(x.id)).ToListAsync(); - + List spotInsRecordDs = new List(); foreach (var tobeCreatePlan in tobeCreateList) { @@ -147,9 +146,9 @@ namespace JNPF.TaskScheduler.Listener remark = tobeCreateItem.remark }); } - + } - if (spotInsRecordDs.Count<=0) + if (spotInsRecordDs.Count <= 0) { return; } @@ -180,9 +179,9 @@ namespace JNPF.TaskScheduler.Listener Log.Error(e.Message); } - + Log.Information("----------------------结束生成点巡检计划----------------------"); } - + } } \ No newline at end of file diff --git a/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs b/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs index 8c0418e3..9ab69020 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/MoldMaintainTask.cs @@ -1,32 +1,23 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF; +using JNPF; using JNPF.Common.Security; -using JNPF.Systems.Entitys.System; using JNPF.TaskScheduler; using JNPF.TaskScheduler.Entitys.Model; using JNPF.TaskScheduler.Interfaces.TaskScheduler; using SqlSugar; using Tnb.EquipMgr.Entities; -using Tnb.ProductionMgr.Entities; -using Tnb.QcMgr.Entities; -using Tnb.QcMgr.Entities.Entity; namespace Tnb.TaskScheduler.Listener { public class MoldMaintainTask : ISpareTimeWorker { private ISqlSugarRepository repository => App.GetService>(); - private ITimeTaskService timeTaskService => App.GetService(); + private ITimeTaskService timeTaskService => App.GetService(); [SpareTime("0 0 0 * * ?", "生成模具保养任务", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false)] public async void CreateTask(SpareTimer timer, long count) { try { - var TimeTasks =await timeTaskService.GetTasks(); + var TimeTasks = await timeTaskService.GetTasks(); var timeTaskEntity = TimeTasks.Where(p => p.Id == timer.WorkerName && p.EnabledMark == 1).FirstOrDefault(); if (timeTaskEntity == null) return; @@ -35,12 +26,12 @@ namespace Tnb.TaskScheduler.Listener var ToolMoldMaintainRule = await client.Queryable().Where(p => p.id == comtentModel.parameter.Where(p => p.field == "id").First().value).FirstAsync(); if (ToolMoldMaintainRule == null) return; - var ToolMoldMaintainRuleRelations= await client.Queryable().Where(p => p.rule_id == ToolMoldMaintainRule.id).ToListAsync(); + var ToolMoldMaintainRuleRelations = await client.Queryable().Where(p => p.rule_id == ToolMoldMaintainRule.id).ToListAsync(); if (ToolMoldMaintainRuleRelations.Count() > 0) { var now = DateTime.Now; Random rNum = new Random(); - ToolMoldMaintainPlan toolMoldMaintainPlan=new ToolMoldMaintainPlan(); + ToolMoldMaintainPlan toolMoldMaintainPlan = new ToolMoldMaintainPlan(); toolMoldMaintainPlan.id = SnowflakeIdHelper.NextId(); toolMoldMaintainPlan.plan_code = "JHDM" + now.ToString("yyyyMMdd") + rNum.Next(1000, 9999).ToString(); toolMoldMaintainPlan.mode = ToolMoldMaintainRule.mode; @@ -53,7 +44,7 @@ namespace Tnb.TaskScheduler.Listener foreach (var ToolMoldMaintainRuleRelation in ToolMoldMaintainRuleRelations) { ToolMoldMaintainPlanRelation toolMoldMaintainPlanRelation = new ToolMoldMaintainPlanRelation(); - toolMoldMaintainPlanRelation.id= SnowflakeIdHelper.NextId(); + toolMoldMaintainPlanRelation.id = SnowflakeIdHelper.NextId(); toolMoldMaintainPlanRelation.maintain_plan_id = toolMoldMaintainPlan.id; toolMoldMaintainPlanRelation.mold_id = ToolMoldMaintainRuleRelation.mold_id; toolMoldMaintainPlanRelation.group_id = ToolMoldMaintainRuleRelation.item_group_id; diff --git a/taskschedule/Tnb.TaskScheduler/Listener/PushMsgTimeWorker.cs b/taskschedule/Tnb.TaskScheduler/Listener/PushMsgTimeWorker.cs index 0d9a8089..039211fd 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/PushMsgTimeWorker.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/PushMsgTimeWorker.cs @@ -1,6 +1,5 @@ using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.Message; -using JNPF.Common.Enums; using JNPF.Common.Security; using JNPF.Logging; using JNPF.Message.Entitys.Entity; @@ -9,7 +8,6 @@ using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; using JNPF.TaskScheduler.Entitys.Model; -using JNPF.TaskScheduler.Interfaces.TaskScheduler; using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData.Entities; @@ -23,14 +21,14 @@ namespace JNPF.TaskScheduler.Listener public class PushMsgTimeWorker : ISpareTimeWorker { private ISqlSugarRepository _repository => App.GetService>(); - + private TimeTaskService _timeTaskService => App.GetService(); private SendMessageService _sendMessageService => App.GetService(); private IUserManager _userManager => App.GetService(); - - + + // [SpareTime(2*60, "推送消息", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false,DoOnce = true)] - [SpareTime("* * * * * ?", "推送消息", ExecuteType = SpareTimeExecuteTypes.Serial,StartNow = false,DoOnce = true)] + [SpareTime("* * * * * ?", "推送消息", ExecuteType = SpareTimeExecuteTypes.Serial, StartNow = false, DoOnce = true)] public async void PushMsg(SpareTimer timer, long count) { // Log.Information("----------------------开始生成特种设备检验计划----------------------"); @@ -40,14 +38,14 @@ namespace JNPF.TaskScheduler.Listener var db = _repository.AsSugarClient(); BasPushRuleLog basPushRuleLog = await db.Queryable().FirstAsync(x => x.timetask_id == timer.WorkerName); - + if (basPushRuleLog?.is_push == 1) { - BasPushRuleH basPushRuleH = await db.Queryable().FirstAsync(x=>x.id==basPushRuleLog.push_rule_id); - BasPushRuleD basPushRuleD = await db.Queryable().FirstAsync(x=>x.push_rule_id==basPushRuleLog.push_rule_id && x.ordinal==basPushRuleLog.ordinal); - BasPushRuleD nextBasPushRuleD = await db.Queryable().FirstAsync(x=>x.push_rule_id==basPushRuleLog.push_rule_id && x.ordinal==basPushRuleLog.ordinal+1); + BasPushRuleH basPushRuleH = await db.Queryable().FirstAsync(x => x.id == basPushRuleLog.push_rule_id); + BasPushRuleD basPushRuleD = await db.Queryable().FirstAsync(x => x.push_rule_id == basPushRuleLog.push_rule_id && x.ordinal == basPushRuleLog.ordinal); + BasPushRuleD nextBasPushRuleD = await db.Queryable().FirstAsync(x => x.push_rule_id == basPushRuleLog.push_rule_id && x.ordinal == basPushRuleLog.ordinal + 1); - if (basPushRuleH?.enabled==1 && basPushRuleD != null) + if (basPushRuleH?.enabled == 1 && basPushRuleD != null) { TimeTaskEntity timeTaskEntity = await db.Queryable().SingleAsync(x => x.Id == timer.WorkerName); List list = await _sendMessageService.SendTest(basPushRuleD.send_config_id); @@ -57,16 +55,16 @@ namespace JNPF.TaskScheduler.Listener { toUsers.AddRange(JsonConvert.DeserializeObject>(basPushRuleD.user_ids)); } - + if (!string.IsNullOrEmpty(basPushRuleD.position_ids)) { - + toUsers.AddRange(db.Queryable().Where(x => basPushRuleD.position_ids.Contains(x.Id)).Select(s => s.UserId).ToList()); } - + if (!string.IsNullOrEmpty(basPushRuleD.role_ids)) { - + toUsers.AddRange(db.Queryable().Where(x => basPushRuleD.role_ids.Contains(x.Id)).Select(s => s.UserId).ToList()); } @@ -88,7 +86,7 @@ namespace JNPF.TaskScheduler.Listener { DateTime executeTime = DateTime.Now.AddMinutes(nextBasPushRuleD.interval); string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?"; - + var comtentModel = new ContentModel(); var timeTaskComtentModel = JsonConvert.DeserializeObject(timeTaskEntity.ExecuteContent); // comtentModel.cron = (nextBasPushRuleD.interval * 60).ToString(); @@ -107,7 +105,7 @@ namespace JNPF.TaskScheduler.Listener comtentModel.TenantDbName = timeTaskComtentModel?.TenantDbName; comtentModel.ConnectionConfig = timeTaskComtentModel?.ConnectionConfig; comtentModel.Token = timeTaskComtentModel?.Token; - + List nextMessageList = await _sendMessageService.SendTest(nextBasPushRuleD.send_config_id); List messageSendParams = JsonConvert.DeserializeObject>(timeTaskEntity.Description); string paramJson = ""; @@ -115,7 +113,7 @@ namespace JNPF.TaskScheduler.Listener { foreach (var param in item.paramJson) { - var field = messageSendParams.FirstOrDefault(x=>x.fieldName==param.fieldName); + var field = messageSendParams.FirstOrDefault(x => x.fieldName == param.fieldName); if (field != null) { param.value = field.value; @@ -148,20 +146,20 @@ namespace JNPF.TaskScheduler.Listener enabledMark = 1, }; - await _timeTaskService.Create(timeTaskCrInput,false); + await _timeTaskService.Create(timeTaskCrInput, false); TimeTaskEntity timeTaskEntityNew = await db.Queryable().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync(); string newId = timeTaskEntityNew?.Id ?? ""; - + await db.Updateable() - .SetColumns(x=>x.timetask_id==newId) + .SetColumns(x => x.timetask_id == newId) .SetColumns(x => x.ordinal == x.ordinal + 1) - .Where(x=>x.timetask_id==timer.WorkerName).ExecuteCommandAsync(); + .Where(x => x.timetask_id == timer.WorkerName).ExecuteCommandAsync(); } } - + } } - + //进入次方法后删除次定时任务 // _timeTaskService.Delete(timer.WorkerName); SpareTime.Cancel(timer.WorkerName); @@ -173,10 +171,10 @@ namespace JNPF.TaskScheduler.Listener Log.Error(e.Message); } - + // Log.Information("----------------------结束生成特种设备检验计划----------------------"); } - + private List SendTest(string id) { var db = _repository.AsSugarClient(); diff --git a/taskschedule/Tnb.TaskScheduler/Listener/QcTaskTimeWorker.cs b/taskschedule/Tnb.TaskScheduler/Listener/QcTaskTimeWorker.cs index be66dff6..3b041b3c 100644 --- a/taskschedule/Tnb.TaskScheduler/Listener/QcTaskTimeWorker.cs +++ b/taskschedule/Tnb.TaskScheduler/Listener/QcTaskTimeWorker.cs @@ -1,23 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aop.Api.Domain; -using JNPF; +using JNPF; using JNPF.Common.Security; using JNPF.Systems.Entitys.System; using JNPF.TaskScheduler; -using JNPF.TaskScheduler.Entitys; using JNPF.TaskScheduler.Entitys.Model; using JNPF.TaskScheduler.Interfaces.TaskScheduler; using SqlSugar; -using Tnb.BasicData.Entities; -using Tnb.EquipMgr.Entities; using Tnb.ProductionMgr.Entities; using Tnb.QcMgr.Entities; using Tnb.QcMgr.Entities.Entity; -using TimeTaskEntity = JNPF.TaskScheduler.Entitys.TimeTaskEntity; namespace Tnb.TaskScheduler.Listener { @@ -33,12 +23,12 @@ namespace Tnb.TaskScheduler.Listener { try { - var TimeTasks =await timeTaskService.GetTasks(); + var TimeTasks = await timeTaskService.GetTasks(); var timeTaskEntity = TimeTasks.Where(p => p.Id == timer.WorkerName && p.EnabledMark == 1).FirstOrDefault(); if (timeTaskEntity == null) return; ContentModel? comtentModel = timeTaskEntity.ExecuteContent.ToObject(); - var client= repository.CopyNew(); + var client = repository.CopyNew(); var PlanH = await client.Queryable().Where(p => p.id == comtentModel.parameter.Where(p => p.field == "id").First().value).FirstAsync(); var PlanDs = await client.Queryable().Where(p => p.mainid == PlanH.id).ToListAsync(); if (PlanH == null || PlanDs.Count == 0) diff --git a/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs b/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs index 32d30c37..3261e1ed 100644 --- a/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs +++ b/taskschedule/Tnb.TaskScheduler/TimeTaskService.cs @@ -12,14 +12,12 @@ using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.LinqBuilder; -using JNPF.Schedule; using JNPF.Systems.Interfaces.System; using JNPF.TaskScheduler.Entitys; using JNPF.TaskScheduler.Entitys.Dto.TaskScheduler; using JNPF.TaskScheduler.Entitys.Enum; using JNPF.TaskScheduler.Entitys.Model; using JNPF.TaskScheduler.Interfaces.TaskScheduler; -using JNPF.TimeCrontab; using Mapster; using Microsoft.AspNetCore.Mvc; using SqlSugar; @@ -149,7 +147,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie /// 实体对象. /// [HttpPost("")] - public async Task Create([FromBody] TimeTaskCrInput input,bool startNow = true) + public async Task Create([FromBody] TimeTaskCrInput input, bool startNow = true) { if (await _repository.IsAnyAsync(x => (x.EnCode == input.enCode || x.FullName == input.fullName) && x.DeleteMark == null)) throw Oops.Oh(ErrorCode.COM1004); @@ -168,7 +166,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie _ = result ?? throw Oops.Oh(ErrorCode.COM1000); // 添加到任务调度里 - AddTimerJob(result,startNow); + AddTimerJob(result, startNow); //await AddJob(result); } @@ -233,11 +231,11 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie [HttpDelete("{fullName}")] public async Task DeleteByName(string fullName) { - var entitys = await _repository.AsQueryable().Where(p=>p.FullName==fullName).ToListAsync(); + var entitys = await _repository.AsQueryable().Where(p => p.FullName == fullName).ToListAsync(); foreach (var entity in entitys) { - await _repository.AsSugarClient().Deleteable(entity).ExecuteCommandAsync(); - + await _repository.AsSugarClient().Deleteable(entity).ExecuteCommandAsync(); + // 从调度器里取消 SpareTime.Cancel(entity.Id); } @@ -308,7 +306,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie // 非多租户模式启动自启任务 if (!KeyVariable.MultiTenancy) { - _repository.AsSugarClient().CopyNew().Queryable().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x=>AddTimerJob(x,false));//modifyby zhoukeda 20230607 + _repository.AsSugarClient().CopyNew().Queryable().Where(x => x.DeleteMark == null && x.EnabledMark == 1).ToList().ForEach(x => AddTimerJob(x, false));//modifyby zhoukeda 20230607 } } @@ -356,7 +354,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie /// 新增定时任务. /// /// - private async void AddTimerJob(TimeTaskEntity input,bool startNow = true) + private async void AddTimerJob(TimeTaskEntity input, bool startNow = true) { Action? action = null; ContentModel? comtentModel = input.ExecuteContent.ToObject(); @@ -402,7 +400,7 @@ public class TimeTaskService : ITimeTaskService, IDynamicApiController, ITransie var isRun = comtentModel.endTime.IsNullOrEmpty() ? DateTime.Now >= starTime : DateTime.Now >= starTime && DateTime.Now < endTime; if (isRun) { - nextHandle = ()=>SpareTime.GetCronNextOccurrence(comtentModel.cron); + nextHandle = () => SpareTime.GetCronNextOccurrence(comtentModel.cron); } SpareTime.Do(nextHandle , diff --git a/taskschedule/Tnb.TaskScheduler/Tnb.TaskScheduler.csproj b/taskschedule/Tnb.TaskScheduler/Tnb.TaskScheduler.csproj index 6d63dc6b..64004e32 100644 --- a/taskschedule/Tnb.TaskScheduler/Tnb.TaskScheduler.csproj +++ b/taskschedule/Tnb.TaskScheduler/Tnb.TaskScheduler.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/visualdev/Tnb.Vengine/AppService/BaseAppService.cs b/visualdev/Tnb.Vengine/AppService/BaseAppService.cs index 96f5268e..48475349 100644 --- a/visualdev/Tnb.Vengine/AppService/BaseAppService.cs +++ b/visualdev/Tnb.Vengine/AppService/BaseAppService.cs @@ -3,13 +3,8 @@ // https://git.tuotong-tech.com/tnb/tnb.server // ///////////////////////////////////////////////////////////////////////////////// -using Aspose.Cells.Drawing; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Tnb.Core; -using Tnb.Vengine.Domain; namespace Tnb.Vengine.AppService; diff --git a/visualdev/Tnb.Vengine/AppService/VengineAppService.cs b/visualdev/Tnb.Vengine/AppService/VengineAppService.cs index 26b70109..735622de 100644 --- a/visualdev/Tnb.Vengine/AppService/VengineAppService.cs +++ b/visualdev/Tnb.Vengine/AppService/VengineAppService.cs @@ -40,7 +40,7 @@ public class VengineAppService : BaseAppService, IVengineAppService /// 获取一条 数据信息 /// [HttpGet("api/[area]/[controller]/{vmid}/get")] - public async Task GetAsync(string vmid, [FromQuery]VmGetInput input) + public async Task GetAsync(string vmid, [FromQuery] VmGetInput input) { var vm = await _dataAccess.GetVmodelAsync(vmid, true); VmListInput arg = input.Adapt(); diff --git a/visualdev/Tnb.Vengine/AppService/VengineAppServiceT.cs b/visualdev/Tnb.Vengine/AppService/VengineAppServiceT.cs index bf3abee6..750b130d 100644 --- a/visualdev/Tnb.Vengine/AppService/VengineAppServiceT.cs +++ b/visualdev/Tnb.Vengine/AppService/VengineAppServiceT.cs @@ -4,7 +4,6 @@ ///////////////////////////////////////////////////////////////////////////////// using System.Reflection; -using JNPF.Common.Security; using Mapster; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; diff --git a/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs b/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs index 7ded486e..9cac3067 100644 --- a/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs +++ b/visualdev/Tnb.Vengine/AppService/VmodelAppService.cs @@ -4,7 +4,6 @@ ///////////////////////////////////////////////////////////////////////////////// using JNPF; -using JNPF.Common.Extension; using JNPF.Common.Security; using JNPF.ViewEngine; using Mapster; @@ -48,7 +47,7 @@ public class VmodelAppService : VengineAppService, IVmodelAppService { vm = await _dataAccess.GetVmodelAsync(input.id, para.drill); } - else if(!string.IsNullOrEmpty(para.areaCode) && !string.IsNullOrEmpty(para.vmCode)) + else if (!string.IsNullOrEmpty(para.areaCode) && !string.IsNullOrEmpty(para.vmCode)) { vm = await _dataAccess.GetVmodelAsync(para.areaCode, para.vmCode, para.drill); } diff --git a/visualdev/Tnb.Vengine/CodeGenerator/TemplateContext.cs b/visualdev/Tnb.Vengine/CodeGenerator/TemplateContext.cs index c0d9f40f..b3fc49b9 100644 --- a/visualdev/Tnb.Vengine/CodeGenerator/TemplateContext.cs +++ b/visualdev/Tnb.Vengine/CodeGenerator/TemplateContext.cs @@ -1,5 +1,4 @@ using System.Text.RegularExpressions; -using JNPF.Common.Configuration; namespace Tnb.Vengine; diff --git a/visualdev/Tnb.Vengine/DataAccess/DataAccess.cs b/visualdev/Tnb.Vengine/DataAccess/DataAccess.cs index 22299cdb..bf523801 100644 --- a/visualdev/Tnb.Vengine/DataAccess/DataAccess.cs +++ b/visualdev/Tnb.Vengine/DataAccess/DataAccess.cs @@ -1,10 +1,8 @@ using System.Collections.Concurrent; -using System.Security.Cryptography.Xml; using JNPF; using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.DependencyInjection; -using Microsoft.Extensions.Configuration; using SqlSugar; using Tnb.Core; using Tnb.Vengine.Domain; diff --git a/visualdev/Tnb.Vengine/Domain/VmQueryParser.cs b/visualdev/Tnb.Vengine/Domain/VmQueryParser.cs index 68763d1f..dc1729f7 100644 --- a/visualdev/Tnb.Vengine/Domain/VmQueryParser.cs +++ b/visualdev/Tnb.Vengine/Domain/VmQueryParser.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Extension; +using JNPF.Common.Extension; using Tnb.Vengine.DataAccess; namespace Tnb.Vengine.Domain @@ -100,6 +95,6 @@ namespace Tnb.Vengine.Domain internal class NavigateVmodel { public Vmodel? navModel { get; set; } - public string navPath { get; set; } + public string navPath { get; set; } } } diff --git a/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs b/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs index 39a3b500..cee6be81 100644 --- a/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs +++ b/visualdev/Tnb.VisualDev.Engine/Core/FormDataParsing.cs @@ -122,7 +122,8 @@ public class FormDataParsing : ITransient { conversionData = data.ToString() + ".".PadRight((int)fieldsModel.precision + 1, '0'); conversionData = conversionData.ParseToDouble();//modifyby zhoukeda 20230605 - }else conversionData = data; + } + else conversionData = data; break; case JnpfKeyConst.JNPFAMOUNT: conversionData = data.ParseToDecimal(); // 金额输入 @@ -525,7 +526,7 @@ public class FormDataParsing : ITransient { if (isShortLink && model.__config__.jnpfKey.Equals(JnpfKeyConst.CREATETIME)) return null; - else if(model.__config__.jnpfKey.Equals(JnpfKeyConst.CREATETIME) || model.__config__.jnpfKey.Equals(JnpfKeyConst.DATE)) + else if (model.__config__.jnpfKey.Equals(JnpfKeyConst.CREATETIME) || model.__config__.jnpfKey.Equals(JnpfKeyConst.DATE)) return res.ToString().ParseToDateTime(); else if (model.__config__.jnpfKey.Equals(JnpfKeyConst.NUMINPUT) || model.__config__.jnpfKey.Equals(JnpfKeyConst.SWITCH))//modify by zhoukeda 2023427 开关默认数字 return res; @@ -1826,7 +1827,7 @@ public class FormDataParsing : ITransient var res = _runService.GetRelationFormList(relationFormModel, listQueryInput).WaitAsync(TimeSpan.FromMinutes(2)).Result; relationFormDataList = res.list.ToList(); _cacheManager.Set(redisName, relationFormDataList, TimeSpan.FromMinutes(10)); // 缓存10分钟 - }); + }); } } @@ -1908,7 +1909,7 @@ public class FormDataParsing : ITransient form.__config__.templateJson.ForEach(x => x.defaultValue = (dataMap.ContainsKey(x.relationField) && dataMap[x.relationField] != null) ? dataMap[x.relationField]?.ToString() : x.defaultValue); _databaseService.ChangeDataBase(_databaseService.GetTenantDbLink(_userManager.TenantId, _userManager.TenantDbName)); var res = _dataInterfaceService.GetResponseByType(form.__config__.propsUrl, 0, string.Empty, new Common.Dtos.VisualDev.VisualDevDataFieldDataListInput() { paramList = form.__config__.templateJson.Adapt>(), pageSize = 500, currentPage = 1 }).Result; - var resList = res.ToObject>>(); + var resList = res.ToObject>>(); if (resList != null && resList.list.Any()) { foreach (object? item in mValue) diff --git a/visualdev/Tnb.VisualDev.Engine/Model/IndexSearchFieldModel.cs b/visualdev/Tnb.VisualDev.Engine/Model/IndexSearchFieldModel.cs index ed53d852..d4ad3ab0 100644 --- a/visualdev/Tnb.VisualDev.Engine/Model/IndexSearchFieldModel.cs +++ b/visualdev/Tnb.VisualDev.Engine/Model/IndexSearchFieldModel.cs @@ -1,5 +1,4 @@ using JNPF.DependencyInjection; -using JNPF.VisualDev.Engine.Model.CodeGen; namespace JNPF.VisualDev.Engine; diff --git a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/IOverideVisualDevService.cs b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/IOverideVisualDevService.cs index 492348c2..84c71918 100644 --- a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/IOverideVisualDevService.cs +++ b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/IOverideVisualDevService.cs @@ -1,43 +1,28 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Extension; -using JNPF.DependencyInjection; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; +using JNPF.DependencyInjection; namespace JNPF.VisualDev { - public interface IVisualDevOverideActionManager : ISingleton - { - void Set(string modelId, IOverideVisualDevService overideVisualDev); + public interface IVisualDevOverideActionManager : ISingleton + { + void Set(string modelId, IOverideVisualDevService overideVisualDev); - IOverideVisualDevService? GetOrDefault(string modelId); - } + IOverideVisualDevService? GetOrDefault(string modelId); + } - public interface IOverideVisualDevService - { - //string ModelId { get; set; } - OverideVisualDevFunc OverideFuncs { get; } + public interface IOverideVisualDevService + { + //string ModelId { get; set; } + OverideVisualDevFunc OverideFuncs { get; } - //Task? GetList(VisualDevModelListQueryInput input); - //Task? GetInfo(string id); - //Task? GetDetails(string id, string modelId); - //Task? Create(VisualDevModelDataCrInput visualdevModelDataCrForm); - //Task? Update(string id, VisualDevModelDataUpInput visualdevModelDataUpForm); - //Task? Delete(string id); - //Task? BatchDelete(VisualDevModelDataBatchDelInput input); - //Task? Export(VisualDevModelListQueryInput input); - //Task? Import(IFormFile file); - } + //Task? GetList(VisualDevModelListQueryInput input); + //Task? GetInfo(string id); + //Task? GetDetails(string id, string modelId); + //Task? Create(VisualDevModelDataCrInput visualdevModelDataCrForm); + //Task? Update(string id, VisualDevModelDataUpInput visualdevModelDataUpForm); + //Task? Delete(string id); + //Task? BatchDelete(VisualDevModelDataBatchDelInput input); + //Task? Export(VisualDevModelListQueryInput input); + //Task? Import(IFormFile file); + } } diff --git a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevAttribute.cs b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevAttribute.cs index 57a8c83a..008b6ee4 100644 --- a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevAttribute.cs +++ b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevAttribute.cs @@ -1,22 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Extension; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Mvc.Filters; - -namespace JNPF.VisualDev +namespace JNPF.VisualDev { - [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] //modified by ly on 20230428 允许特性在一个类上多重定义 - public class OverideVisualDevAttribute : Attribute - { - public string ModelId { get; set; } - public OverideVisualDevAttribute(string modelId) + [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] //modified by ly on 20230428 允许特性在一个类上多重定义 + public class OverideVisualDevAttribute : Attribute { - ModelId = modelId; + public string ModelId { get; set; } + public OverideVisualDevAttribute(string modelId) + { + ModelId = modelId; + } } - } } diff --git a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevFunc.cs b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevFunc.cs index 2b19c03e..accae107 100644 --- a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevFunc.cs +++ b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevFunc.cs @@ -1,34 +1,21 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Dtos.VisualDev; -using JNPF.Common.Extension; -using JNPF.DependencyInjection; -using JNPF.VisualDev.Entitys; +using JNPF.Common.Dtos.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDev; using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; -using JNPF.VisualDev.Interfaces; using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Filters; namespace JNPF.VisualDev { - public class OverideVisualDevFunc - { - public Func>? GetListAsync { get; set; } = null; - public Func>? GetAsync { get; set; } = null; - public Func>? GetDetailsAsync { get; set; } = null; - public Func>? CreateAsync { get; set; } = null; - public Func>? UpdateAsync { get; set; } = null; - public Func? DeleteAsync { get; set; } = null; - public Func? DeleteRangeAsync { get; set; } = null; - public Func>? ExportAsync { get; set; } = null; - public Func>? ImportAsync { get; set; } = null; - public Func>? ImportDataAsync { get; set; } = null; + public class OverideVisualDevFunc + { + public Func>? GetListAsync { get; set; } = null; + public Func>? GetAsync { get; set; } = null; + public Func>? GetDetailsAsync { get; set; } = null; + public Func>? CreateAsync { get; set; } = null; + public Func>? UpdateAsync { get; set; } = null; + public Func? DeleteAsync { get; set; } = null; + public Func? DeleteRangeAsync { get; set; } = null; + public Func>? ExportAsync { get; set; } = null; + public Func>? ImportAsync { get; set; } = null; + public Func>? ImportDataAsync { get; set; } = null; } } diff --git a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevManager.cs b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevManager.cs index 0e449307..382635a6 100644 --- a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevManager.cs +++ b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevManager.cs @@ -1,38 +1,28 @@ -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Concurrent; using JNPF.Common.Extension; -using JNPF.DependencyInjection; -using JNPF.VisualDev.Entitys; -using JNPF.VisualDev.Interfaces; -using Microsoft.AspNetCore.Mvc.Filters; namespace JNPF.VisualDev { - public class OverideVisualDevManager - { - private static ConcurrentDictionary actions = new ConcurrentDictionary(); - public OverideVisualDevManager() + public class OverideVisualDevManager { - } + private static ConcurrentDictionary actions = new ConcurrentDictionary(); + public OverideVisualDevManager() + { + } - public static IOverideVisualDevService? GetOrDefault(string modelId) - { - var tp = actions.GetOrDefault(modelId); - if (tp != null) { return (IOverideVisualDevService)App.GetService(tp); } - return null; - } + public static IOverideVisualDevService? GetOrDefault(string modelId) + { + var tp = actions.GetOrDefault(modelId); + if (tp != null) { return (IOverideVisualDevService)App.GetService(tp); } + return null; + } - public static void Add(string modelId, Type overideVisualDev) - { - if (!actions.ContainsKey(modelId)) - { - actions.TryAdd(modelId, overideVisualDev); - } + public static void Add(string modelId, Type overideVisualDev) + { + if (!actions.ContainsKey(modelId)) + { + actions.TryAdd(modelId, overideVisualDev); + } + } } - } } diff --git a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevServiceCollectionExtensions.cs b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevServiceCollectionExtensions.cs index f7c72bdd..1ff2eff6 100644 --- a/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevServiceCollectionExtensions.cs +++ b/visualdev/Tnb.VisualDev.Engine/OverideVisualDev/OverideVisualDevServiceCollectionExtensions.cs @@ -4,28 +4,28 @@ using Microsoft.Extensions.DependencyInjection; namespace JNPF.VisualDev { - [SuppressSniffer] - public static class OverideVisualDevServiceCollectionExtensions - { - /// - /// 添加重写在线开发接口的服务 - /// - /// - /// - public static IServiceCollection AddOverideVisualDev(this IServiceCollection services) + [SuppressSniffer] + public static class OverideVisualDevServiceCollectionExtensions { - var actions = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IOverideVisualDevService).IsAssignableFrom(u)).ToList(); - foreach (var item in actions) - { - var attr = item.GetAttribute(); - if (attr != null) + /// + /// 添加重写在线开发接口的服务 + /// + /// + /// + public static IServiceCollection AddOverideVisualDev(this IServiceCollection services) { - OverideVisualDevManager.Add(attr.ModelId, item); + var actions = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IOverideVisualDevService).IsAssignableFrom(u)).ToList(); + foreach (var item in actions) + { + var attr = item.GetAttribute(); + if (attr != null) + { + OverideVisualDevManager.Add(attr.ModelId, item); + } + } + + return services; } - } - return services; } - - } } diff --git a/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/CodeGenControlsAttributeHelper.cs b/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/CodeGenControlsAttributeHelper.cs index 876c77ac..f615e5bc 100644 --- a/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/CodeGenControlsAttributeHelper.cs +++ b/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/CodeGenControlsAttributeHelper.cs @@ -1,5 +1,4 @@ -using Aop.Api.Domain; -using JNPF.Common.Const; +using JNPF.Common.Const; using JNPF.Common.Extension; using JNPF.Common.Models; using JNPF.Common.Models.Authorize; diff --git a/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/GetCodeGenIndexButtonHelper.cs b/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/GetCodeGenIndexButtonHelper.cs index bbef17b2..0e68e27f 100644 --- a/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/GetCodeGenIndexButtonHelper.cs +++ b/visualdev/Tnb.VisualDev.Engine/Security/BackEnd/GetCodeGenIndexButtonHelper.cs @@ -1,6 +1,4 @@ -using Microsoft.AspNetCore.Components.Forms; - -namespace JNPF.VisualDev.Engine.Security; +namespace JNPF.VisualDev.Engine.Security; /// /// 代码生成列表按钮帮助类. diff --git a/visualdev/Tnb.VisualDev.Engine/Tnb.VisualDev.Engine.csproj b/visualdev/Tnb.VisualDev.Engine/Tnb.VisualDev.Engine.csproj index 178ed887..39aadc75 100644 --- a/visualdev/Tnb.VisualDev.Engine/Tnb.VisualDev.Engine.csproj +++ b/visualdev/Tnb.VisualDev.Engine/Tnb.VisualDev.Engine.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/visualdev/Tnb.VisualDev.Entitys/Dto/Dashboard/EmailHomeOutput.cs b/visualdev/Tnb.VisualDev.Entitys/Dto/Dashboard/EmailHomeOutput.cs new file mode 100644 index 00000000..2a01b2ec --- /dev/null +++ b/visualdev/Tnb.VisualDev.Entitys/Dto/Dashboard/EmailHomeOutput.cs @@ -0,0 +1,22 @@ +using JNPF.DependencyInjection; + +namespace JNPF.VisualDev.Entitys.Dto.Dashboard; + +[SuppressSniffer] +public class EmailHomeOutput +{ + /// + /// ID. + /// + public string? id { get; set; } + + /// + /// 标题. + /// + public string? fullName { get; set; } + + /// + /// 创建时间. + /// + public DateTime? creatorTime { get; set; } +} diff --git a/visualdev/Tnb.VisualDev.Entitys/Dto/Screen/ScreenInfoOutput.cs b/visualdev/Tnb.VisualDev.Entitys/Dto/Screen/ScreenInfoOutput.cs index e558c49d..dfde724f 100644 --- a/visualdev/Tnb.VisualDev.Entitys/Dto/Screen/ScreenInfoOutput.cs +++ b/visualdev/Tnb.VisualDev.Entitys/Dto/Screen/ScreenInfoOutput.cs @@ -1,6 +1,4 @@ -using System; - -namespace JNPF.VisualData.Entitys.Dto.Screen; +namespace JNPF.VisualData.Entitys.Dto.Screen; /// /// 大屏信息输出. diff --git a/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs b/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs index 5a28bb9a..5463d159 100644 --- a/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs +++ b/visualdev/Tnb.VisualDev.Entitys/Dto/VisualDevModelData/VisualDevModelListQueryInput.cs @@ -26,7 +26,7 @@ public class VisualDevModelListQueryInput : PageInputBase /// 高级查询. /// public virtual string superQueryJson { get; set; } - // TODO 不能放在这里 + // TODO 不能放在这里 /// /// 工位编码 /// diff --git a/visualdev/Tnb.VisualDev.Entitys/Entity/EmailReceiveEntity.cs b/visualdev/Tnb.VisualDev.Entitys/Entity/EmailReceiveEntity.cs new file mode 100644 index 00000000..ab28635e --- /dev/null +++ b/visualdev/Tnb.VisualDev.Entitys/Entity/EmailReceiveEntity.cs @@ -0,0 +1,93 @@ +using JNPF.Common.Contracts; +using SqlSugar; + +namespace JNPF.VisualDev.Entitys; + +/// +/// 邮件接收 +/// 版 本:V3.2 +/// 版 权:引迈信息技术有限公司(https://www.jnpfsoft.com) +/// 作 者:JNPF开发平台组 +/// 日 期:2021-06-01. +/// +[SugarTable("EXT_EMAILRECEIVE")] +public class EmailReceiveEntity : CLDEntityBase +{ + /// + /// 类型:【1-外部、0-内部】. + /// + [SugarColumn(ColumnName = "F_TYPE")] + public int? Type { get; set; } + + /// + /// 邮箱账户. + /// + [SugarColumn(ColumnName = "F_MACCOUNT")] + public string? MAccount { get; set; } + + /// + /// MID. + /// + [SugarColumn(ColumnName = "F_MID")] + public string? MID { get; set; } + + /// + /// 发件人. + /// + [SugarColumn(ColumnName = "F_SENDER")] + public string? Sender { get; set; } + + /// + /// 发件人名称. + /// + [SugarColumn(ColumnName = "F_SENDERNAME")] + public string? SenderName { get; set; } + + /// + /// 主题. + /// + [SugarColumn(ColumnName = "F_SUBJECT")] + public string? Subject { get; set; } + + /// + /// 正文. + /// + [SugarColumn(ColumnName = "F_BODYTEXT")] + public string? BodyText { get; set; } + + /// + /// 附件. + /// + [SugarColumn(ColumnName = "F_ATTACHMENT")] + public string? Attachment { get; set; } + + /// + /// 阅读. + /// + [SugarColumn(ColumnName = "F_READ")] + public int? Read { get; set; } + + /// + /// Date. + /// + [SugarColumn(ColumnName = "F_DATE")] + public DateTime? Date { get; set; } + + /// + /// 星标. + /// + [SugarColumn(ColumnName = "F_STARRED")] + public int? Starred { get; set; } + + /// + /// 描述. + /// + [SugarColumn(ColumnName = "F_DESCRIPTION")] + public string? Description { get; set; } + + /// + /// 排序码. + /// + [SugarColumn(ColumnName = "F_SORTCODE")] + public long? SortCode { get; set; } +} diff --git a/visualdev/Tnb.VisualDev.Entitys/Entity/VisualCategoryEntity.cs b/visualdev/Tnb.VisualDev.Entitys/Entity/VisualCategoryEntity.cs index 5a2de0b2..25c3323f 100644 --- a/visualdev/Tnb.VisualDev.Entitys/Entity/VisualCategoryEntity.cs +++ b/visualdev/Tnb.VisualDev.Entitys/Entity/VisualCategoryEntity.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Const; -using SqlSugar; +using SqlSugar; namespace JNPF.VisualData.Entity; diff --git a/visualdev/Tnb.VisualDev.Entitys/Entity/VisualEntity.cs b/visualdev/Tnb.VisualDev.Entitys/Entity/VisualEntity.cs index 72c425c6..bcb06dd4 100644 --- a/visualdev/Tnb.VisualDev.Entitys/Entity/VisualEntity.cs +++ b/visualdev/Tnb.VisualDev.Entitys/Entity/VisualEntity.cs @@ -1,6 +1,5 @@ using JNPF.Common.Const; using SqlSugar; -using System; using Yitter.IdGenerator; namespace JNPF.VisualData.Entity; @@ -92,7 +91,7 @@ public class VisualEntity var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value; this.CreateTime = DateTime.Now; this.Id = YitIdHelper.NextId().ToString(); - this.BackgroundUrl = (this.BackgroundUrl == null || this.BackgroundUrl == string.Empty)? "/api/file/VisusalImg/bg/bg1.png" : this.BackgroundUrl; + this.BackgroundUrl = (this.BackgroundUrl == null || this.BackgroundUrl == string.Empty) ? "/api/file/VisusalImg/bg/bg1.png" : this.BackgroundUrl; this.IsDeleted = 0; this.Status = 1; if (!string.IsNullOrEmpty(userId)) diff --git a/visualdev/Tnb.VisualDev.Entitys/Tnb.VisualDev.Entitys.csproj b/visualdev/Tnb.VisualDev.Entitys/Tnb.VisualDev.Entitys.csproj index 08bcb7bf..91e9762b 100644 --- a/visualdev/Tnb.VisualDev.Entitys/Tnb.VisualDev.Entitys.csproj +++ b/visualdev/Tnb.VisualDev.Entitys/Tnb.VisualDev.Entitys.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/visualdev/Tnb.VisualDev.Interfaces/Tnb.VisualDev.Interfaces.csproj b/visualdev/Tnb.VisualDev.Interfaces/Tnb.VisualDev.Interfaces.csproj index dbf40cd5..b05836bd 100644 --- a/visualdev/Tnb.VisualDev.Interfaces/Tnb.VisualDev.Interfaces.csproj +++ b/visualdev/Tnb.VisualDev.Interfaces/Tnb.VisualDev.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/visualdev/Tnb.VisualDev/CodeGen/DataParsing/ControlParsing.cs b/visualdev/Tnb.VisualDev/CodeGen/DataParsing/ControlParsing.cs index 3d5e91ba..e06593b5 100644 --- a/visualdev/Tnb.VisualDev/CodeGen/DataParsing/ControlParsing.cs +++ b/visualdev/Tnb.VisualDev/CodeGen/DataParsing/ControlParsing.cs @@ -1,20 +1,20 @@ using JNPF.Common.Const; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.Common.Manager; using JNPF.Common.Security; using JNPF.DependencyInjection; +using JNPF.RemoteRequest.Extensions; +using JNPF.Systems.Entitys.Model.DataInterFace; using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; using JNPF.VisualDev.Engine; -using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; using JNPF.VisualDev.Interfaces; using Newtonsoft.Json.Linq; using SqlSugar; -using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; -using JNPF.RemoteRequest.Extensions; -using JNPF.Systems.Entitys.Model.DataInterFace; -using JNPF.Common.Core.Manager; namespace JNPF.Common.CodeGen.DataParsing; diff --git a/visualdev/Tnb.VisualDev/CodeGenService.cs b/visualdev/Tnb.VisualDev/CodeGenService.cs index 489d1922..96e00624 100644 --- a/visualdev/Tnb.VisualDev/CodeGenService.cs +++ b/visualdev/Tnb.VisualDev/CodeGenService.cs @@ -1,4 +1,6 @@ -using JNPF.Common.Configuration; +using System.IO.Compression; +using System.Text; +using JNPF.Common.Configuration; using JNPF.Common.Const; using JNPF.Common.Core.Manager; using JNPF.Common.Enums; @@ -21,10 +23,7 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.CodeGen; using JNPF.VisualDev.Entitys.Enum; using Microsoft.AspNetCore.Mvc; -using NPOI.Util; using SqlSugar; -using System.IO.Compression; -using System.Text; namespace JNPF.CodeGen; @@ -393,7 +392,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { var tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, NameSpace = formDataModel.areasName, @@ -528,7 +528,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { string tContent = File.ReadAllText(templatePathList[i]); - string tResult = _viewEngine.RunCompileFromCached(tContent, new { + string tResult = _viewEngine.RunCompileFromCached(tContent, new + { NameSpace = codeGenConfigModel.NameSpace, BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, @@ -648,7 +649,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { var tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, NameSpace = formDataModel.areasName, @@ -773,7 +775,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (var i = 0; i < templatePathList.Count; i++) { var tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { NameSpace = codeGenConfigModel.NameSpace, BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, @@ -904,7 +907,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { var tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, NameSpace = formDataModel.areasName, @@ -984,7 +988,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { var tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, NameSpace = formDataModel.areasName, @@ -1117,7 +1122,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { string tContent = File.ReadAllText(templatePathList[i]); - string tResult = _viewEngine.RunCompileFromCached(tContent, new { + string tResult = _viewEngine.RunCompileFromCached(tContent, new + { NameSpace = codeGenConfigModel.NameSpace, BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, @@ -1272,7 +1278,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (var i = 0; i < templatePathList.Count; i++) { var tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { NameSpace = codeGenConfigModel.NameSpace, BusName = codeGenConfigModel.BusName, ClassName = codeGenConfigModel.ClassName, @@ -1558,7 +1565,8 @@ public class CodeGenService : IDynamicApiController, ITransient for (int i = 0; i < templatePathList.Count; i++) { string tContent = File.ReadAllText(templatePathList[i]); - var tResult = _viewEngine.RunCompileFromCached(tContent, new { + var tResult = _viewEngine.RunCompileFromCached(tContent, new + { NameSpace = frondEndGenConfig.NameSpace, ClassName = frondEndGenConfig.ClassName, FormRef = frondEndGenConfig.FormRef, diff --git a/visualdev/Tnb.VisualDev/DashboardService.cs b/visualdev/Tnb.VisualDev/DashboardService.cs index 5783aa08..a8c6dcee 100644 --- a/visualdev/Tnb.VisualDev/DashboardService.cs +++ b/visualdev/Tnb.VisualDev/DashboardService.cs @@ -1,10 +1,9 @@ using JNPF.Common.Core.Manager; using JNPF.DependencyInjection; using JNPF.DynamicApiController; -using JNPF.Extend.Entitys; -using JNPF.Extend.Entitys.Dto.Email; using JNPF.Message.Entitys; using JNPF.Message.Interfaces.Message; +using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.Dashboard; using JNPF.WorkFlow.Entitys.Entity; using JNPF.WorkFlow.Interfaces.Repository; diff --git a/visualdev/Tnb.VisualDev/HmiService.cs b/visualdev/Tnb.VisualDev/HmiService.cs index 58e53dd9..240ed82d 100644 --- a/visualdev/Tnb.VisualDev/HmiService.cs +++ b/visualdev/Tnb.VisualDev/HmiService.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Aspose.Cells; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; using JNPF.DynamicApiController; using Microsoft.AspNetCore.Mvc; diff --git a/visualdev/Tnb.VisualDev/PortalService.cs b/visualdev/Tnb.VisualDev/PortalService.cs index 709275c9..127de427 100644 --- a/visualdev/Tnb.VisualDev/PortalService.cs +++ b/visualdev/Tnb.VisualDev/PortalService.cs @@ -3,14 +3,12 @@ using JNPF.Common.Core.Manager.Files; using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.Common.Filter; -using JNPF.Common.Models.User; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.Common; using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Entitys.Dto.Portal; using JNPF.VisualDev.Entitys.Dto.VisualDev; @@ -169,7 +167,7 @@ public class PortalService : IDynamicApiController, ITransient { if (_userManager.Roles != null && !_userManager.IsAdministrator) { - List? roleId = await _portalRepository.AsSugarClient().Queryable().Where(r =>_userManager.Roles.Contains(r.Id)).Where(r => r.EnabledMark == 1 && r.DeleteMark == null).Select(r => r.Id).ToListAsync(); + List? roleId = await _portalRepository.AsSugarClient().Queryable().Where(r => _userManager.Roles.Contains(r.Id)).Where(r => r.EnabledMark == 1 && r.DeleteMark == null).Select(r => r.Id).ToListAsync(); var items = await _portalRepository.AsSugarClient().Queryable().Where(a => roleId.Contains(a.ObjectId)).Where(a => a.ItemType == "portal").GroupBy(it => new { it.ItemId }).Select(it => new { it.ItemId }).ToListAsync(); if (items.Count == 0) return null; PortalEntity? entity = await _portalRepository.AsQueryable().Where(p => items.Select(it => it.ItemId).Contains(p.Id)).SingleAsync(p => p.Id == id && p.EnabledMark == 1 && p.DeleteMark == null); diff --git a/visualdev/Tnb.VisualDev/RunService.cs b/visualdev/Tnb.VisualDev/RunService.cs index 3bef9517..59bc6a60 100644 --- a/visualdev/Tnb.VisualDev/RunService.cs +++ b/visualdev/Tnb.VisualDev/RunService.cs @@ -1,5 +1,4 @@ using System.Data; -using System.Text; using System.Text.RegularExpressions; using JNPF.Common.Const; using JNPF.Common.Core.Manager; @@ -14,7 +13,6 @@ using JNPF.DependencyInjection; using JNPF.FriendlyException; using JNPF.JsonSerialization; using JNPF.RemoteRequest.Extensions; -using JNPF.Systems.Entitys.Dto.Authorize; using JNPF.Systems.Entitys.Model.DataBase; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; @@ -824,7 +822,7 @@ public class RunService : IRunService, ITransient if (child.Key.Equals("id") && child.Value.IsNotEmptyOrNull()) { //modify by ly on 20230720 判断如果子表主键为空的把原主键值赋值给子表主键,直接复制会导致主键重复 - if(tableField[childPrimary.field].IsNull() || tableField[childPrimary.field].ToString().IsNullOrEmpty()) + if (tableField[childPrimary.field].IsNull() || tableField[childPrimary.field].ToString().IsNullOrEmpty()) { tableField[childPrimary.field] = child.Value; } diff --git a/visualdev/Tnb.VisualDev/Tnb.VisualDev.csproj b/visualdev/Tnb.VisualDev/Tnb.VisualDev.csproj index 20d4ac1d..bf53fff4 100644 --- a/visualdev/Tnb.VisualDev/Tnb.VisualDev.csproj +++ b/visualdev/Tnb.VisualDev/Tnb.VisualDev.csproj @@ -12,7 +12,6 @@ - diff --git a/visualdev/Tnb.VisualDev/VisualDevService.cs b/visualdev/Tnb.VisualDev/VisualDevService.cs index 0d9ca71d..2d9166bc 100644 --- a/visualdev/Tnb.VisualDev/VisualDevService.cs +++ b/visualdev/Tnb.VisualDev/VisualDevService.cs @@ -723,9 +723,9 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans moduleModel.ModuleId = input.id; moduleModel.ParentId = oldWebModule != null ? oldWebModule.ParentId : (input.pcModuleParentId.Equals(input.pcSystemId) ? "-1" : input.pcModuleParentId); // 父级菜单节点 moduleModel.Category = "Web"; - moduleModel.FullName = oldWebModule!=null ? oldWebModule.FullName : entity.FullName; //modifyby zhoukeda 发布功能不更新名称排序图标 + moduleModel.FullName = oldWebModule != null ? oldWebModule.FullName : entity.FullName; //modifyby zhoukeda 发布功能不更新名称排序图标 moduleModel.EnCode = entity.EnCode; - moduleModel.Icon = oldWebModule!=null ? oldWebModule.Icon : "icon-ym icon-ym-webForm"; //modifyby zhoukeda 发布功能不更新名称排序图标 + moduleModel.Icon = oldWebModule != null ? oldWebModule.Icon : "icon-ym icon-ym-webForm"; //modifyby zhoukeda 发布功能不更新名称排序图标 moduleModel.UrlAddress = oldWebModule != null ? oldWebModule.UrlAddress : "model/" + entity.EnCode; moduleModel.Type = 3; moduleModel.EnabledMark = 1; @@ -789,7 +789,8 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans SortCode = 0 }); }); - ctList.ForEach(item => { + ctList.ForEach(item => + { formAuth.Add(new ModuleFormEntity() { @@ -993,7 +994,8 @@ public class VisualDevService : IVisualDevService, IDynamicApiController, ITrans SortCode = 0 }); }); - ctList.ForEach(item => { + ctList.ForEach(item => + { formAuth.Add(new ModuleFormEntity() { diff --git a/workflow/Tnb.WorkFlow.Entitys/Dto/FlowBefore/FlowBeforeInfoOutput.cs b/workflow/Tnb.WorkFlow.Entitys/Dto/FlowBefore/FlowBeforeInfoOutput.cs index 174aaa20..00eb6ebd 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Dto/FlowBefore/FlowBeforeInfoOutput.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Dto/FlowBefore/FlowBeforeInfoOutput.cs @@ -31,7 +31,7 @@ public class FlowBeforeInfoOutput /// /// 流程任务节点. /// - public List? flowTaskNodeList { get; set; }=new List(){ }; + public List? flowTaskNodeList { get; set; } = new List() { }; /// /// 流程任务经办. diff --git a/workflow/Tnb.WorkFlow.Entitys/Dto/FlowMonitor/FlowMonitorListOutput.cs b/workflow/Tnb.WorkFlow.Entitys/Dto/FlowMonitor/FlowMonitorListOutput.cs index 433c3b96..155724c9 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Dto/FlowMonitor/FlowMonitorListOutput.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Dto/FlowMonitor/FlowMonitorListOutput.cs @@ -78,7 +78,7 @@ public class FlowMonitorListOutput /// /// 用户名称. /// - public string? userName{ get; set; } + public string? userName { get; set; } /// /// 描述. diff --git a/workflow/Tnb.WorkFlow.Entitys/Dto/WorkFlowForm/LeaveApply/LeaveApplyInput.cs b/workflow/Tnb.WorkFlow.Entitys/Dto/WorkFlowForm/LeaveApply/LeaveApplyInput.cs index 81f65fbf..99db178c 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Dto/WorkFlowForm/LeaveApply/LeaveApplyInput.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Dto/WorkFlowForm/LeaveApply/LeaveApplyInput.cs @@ -1,5 +1,4 @@ -using JNPF.Common.Models.WorkFlow; -using JNPF.DependencyInjection; +using JNPF.DependencyInjection; namespace JNPF.WorkFlow.Entitys.Dto.WorkFlowForm.LeaveApply; diff --git a/workflow/Tnb.WorkFlow.Entitys/Entity/WorkFlowForm/SalesOrderEntryEntity.cs b/workflow/Tnb.WorkFlow.Entitys/Entity/WorkFlowForm/SalesOrderEntryEntity.cs index 8e351a68..08e03ba9 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Entity/WorkFlowForm/SalesOrderEntryEntity.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Entity/WorkFlowForm/SalesOrderEntryEntity.cs @@ -4,11 +4,11 @@ using SqlSugar; namespace JNPF.WorkFlow.Entitys { -    /// + /// /// 订单明细 /// 版 本:V3.2 /// 版 权:拓通智联科技有限公司(http://www.tuotong-tech.com) - /// 日 期:2018-07-23 . + /// 日 期:2018-07-23 . /// [SugarTable("WFORM_SALESORDERENTRY")] [Tenant(ClaimConst.TENANTID)] diff --git a/workflow/Tnb.WorkFlow.Entitys/Mapper/Mapper.cs b/workflow/Tnb.WorkFlow.Entitys/Mapper/Mapper.cs index d4e015e7..708d3ec9 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Mapper/Mapper.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Mapper/Mapper.cs @@ -1,7 +1,6 @@ using JNPF.Common.Extension; using JNPF.WorkFlow.Entitys.Dto.FlowBefore; using JNPF.WorkFlow.Entitys.Dto.FlowEngine; -using JNPF.WorkFlow.Entitys.Dto.FlowLaunch; using JNPF.WorkFlow.Entitys.Entity; using JNPF.WorkFlow.Entitys.Model; using JNPF.WorkFlow.Entitys.Model.Properties; diff --git a/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/FuncConfig.cs b/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/FuncConfig.cs index 51fea2ee..c08125d3 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/FuncConfig.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/FuncConfig.cs @@ -1,6 +1,5 @@ using JNPF.Common.Dtos.Message; using JNPF.DependencyInjection; -using JNPF.WorkFlow.Entitys.Model.Item; namespace JNPF.WorkFlow.Entitys.Model.Conifg; diff --git a/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/MsgConfig.cs b/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/MsgConfig.cs index c5bb453a..3ebe56fb 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/MsgConfig.cs +++ b/workflow/Tnb.WorkFlow.Entitys/Model/Conifg/MsgConfig.cs @@ -1,6 +1,5 @@ using JNPF.Common.Dtos.Message; using JNPF.DependencyInjection; -using JNPF.WorkFlow.Entitys.Model.Item; namespace JNPF.WorkFlow.Entitys.Model.Conifg; diff --git a/workflow/Tnb.WorkFlow.Entitys/Tnb.WorkFlow.Entitys.csproj b/workflow/Tnb.WorkFlow.Entitys/Tnb.WorkFlow.Entitys.csproj index 7efd33cf..1d28267e 100644 --- a/workflow/Tnb.WorkFlow.Entitys/Tnb.WorkFlow.Entitys.csproj +++ b/workflow/Tnb.WorkFlow.Entitys/Tnb.WorkFlow.Entitys.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTaskService.cs b/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTaskService.cs index dfa9b3db..2fc7ea15 100644 --- a/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTaskService.cs +++ b/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTaskService.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using JNPF.Common.Models.WorkFlow; +using JNPF.Common.Models.WorkFlow; namespace JNPF.WorkFlow.Interfaces.Service { diff --git a/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTemplateService.cs b/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTemplateService.cs index 49a2f0c2..79b3ff2b 100644 --- a/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTemplateService.cs +++ b/workflow/Tnb.WorkFlow.Interfaces/Service/IFlowTemplateService.cs @@ -1,5 +1,4 @@ -using JNPF.WorkFlow.Entitys.Dto.FlowEngine; -using JNPF.WorkFlow.Entitys.Dto.FlowTemplate; +using JNPF.WorkFlow.Entitys.Dto.FlowTemplate; namespace JNPF.WorkFlow.Interfaces.Service; diff --git a/workflow/Tnb.WorkFlow.Interfaces/Service/ILeaveApplyService.cs b/workflow/Tnb.WorkFlow.Interfaces/Service/ILeaveApplyService.cs index 53c898fb..5837bde0 100644 --- a/workflow/Tnb.WorkFlow.Interfaces/Service/ILeaveApplyService.cs +++ b/workflow/Tnb.WorkFlow.Interfaces/Service/ILeaveApplyService.cs @@ -1,6 +1,4 @@ -using System.Threading.Tasks; - -namespace JNPF.WorkFlow.Interfaces.Service; +namespace JNPF.WorkFlow.Interfaces.Service; /// /// 请假申请 diff --git a/workflow/Tnb.WorkFlow.Interfaces/Tnb.WorkFlow.Interfaces.csproj b/workflow/Tnb.WorkFlow.Interfaces/Tnb.WorkFlow.Interfaces.csproj index e5f53fe4..f6218d45 100644 --- a/workflow/Tnb.WorkFlow.Interfaces/Tnb.WorkFlow.Interfaces.csproj +++ b/workflow/Tnb.WorkFlow.Interfaces/Tnb.WorkFlow.Interfaces.csproj @@ -1,5 +1,4 @@ - net6.0 diff --git a/workflow/Tnb.WorkFlow/Manager/FlowTaskMsgUtil.cs b/workflow/Tnb.WorkFlow/Manager/FlowTaskMsgUtil.cs index f4ea1ecf..6c5815d9 100644 --- a/workflow/Tnb.WorkFlow/Manager/FlowTaskMsgUtil.cs +++ b/workflow/Tnb.WorkFlow/Manager/FlowTaskMsgUtil.cs @@ -61,7 +61,7 @@ public class FlowTaskMsgUtil //默认消息 if (msgConfig.on == 3) { - var crUser =await _usersService.GetUserName(flowTaskParamter.flowTaskEntity.CreatorUserId, false); + var crUser = await _usersService.GetUserName(flowTaskParamter.flowTaskEntity.CreatorUserId, false); var flowName = _flowTaskRepository.GetFlowTemplateJsonInfo(x => x.Id == flowTaskParamter.flowTaskEntity.FlowId).FullName; await _sendMessageService.SendMessageDefult(enCode, users, crUser, flowName, bodyDic); } @@ -164,7 +164,8 @@ public class FlowTaskMsgUtil { foreach (var item in flowTaskOperatorEntities) { - var value = new { + var value = new + { enCode = flowTaskParamter.flowTaskEntity.FlowCode, flowId = flowTaskParamter.flowTaskEntity.FlowId, status = type == 1 ? 0 : 1, @@ -184,7 +185,8 @@ public class FlowTaskMsgUtil } else { - var value = new { + var value = new + { enCode = flowTaskParamter.flowTaskEntity.FlowCode, flowId = flowTaskParamter.flowTaskEntity.FlowId, status = type == 1 ? 0 : 1, diff --git a/workflow/Tnb.WorkFlow/Manager/FlowTaskOtherUtil.cs b/workflow/Tnb.WorkFlow/Manager/FlowTaskOtherUtil.cs index 1b441c1e..d28500c2 100644 --- a/workflow/Tnb.WorkFlow/Manager/FlowTaskOtherUtil.cs +++ b/workflow/Tnb.WorkFlow/Manager/FlowTaskOtherUtil.cs @@ -364,7 +364,7 @@ public class FlowTaskOtherUtil { try { - var value=jobj[timeOutConfig.formField].ToString(); + var value = jobj[timeOutConfig.formField].ToString(); if (!DateTime.TryParse(value, out dt)) { dt = jobj[timeOutConfig.formField].ParseToLong().TimeStampToDateTime(); @@ -417,12 +417,12 @@ public class FlowTaskOtherUtil { mapRule = GetMapRule(approversPro.assignList, flowTaskParamter.flowTaskNodeEntity.NodeCode); } - var data =await _runService.GetFlowFormDataDetails(thisFormId, flowTaskParamter.flowTaskEntity.Id); + var data = await _runService.GetFlowFormDataDetails(thisFormId, flowTaskParamter.flowTaskEntity.Id); if (!data.ContainsKey("flowId"))//modifyby zhoukeda 20230704 { - if (((Dictionary)flowTaskParamter.formData).TryGetValue("flowId",out var value)) + if (((Dictionary)flowTaskParamter.formData).TryGetValue("flowId", out var value)) { - data.Add("flowId",value); + data.Add("flowId", value); } } var nextFormData = await _runService.SaveDataToDataByFId(thisFormId, nextFormId, mapRule, data); diff --git a/workflow/Tnb.WorkFlow/Repository/FlowTaskRepository.cs b/workflow/Tnb.WorkFlow/Repository/FlowTaskRepository.cs index 7c8aaaf4..9f73b929 100644 --- a/workflow/Tnb.WorkFlow/Repository/FlowTaskRepository.cs +++ b/workflow/Tnb.WorkFlow/Repository/FlowTaskRepository.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Core.Manager; +using System.Linq.Expressions; +using JNPF.Common.Core.Manager; using JNPF.Common.Extension; using JNPF.Common.Filter; using JNPF.Common.Models.WorkFlow; @@ -21,7 +22,6 @@ using JNPF.WorkFlow.Entitys.Model.Properties; using JNPF.WorkFlow.Interfaces.Repository; using Mapster; using SqlSugar; -using System.Linq.Expressions; namespace JNPF.WorkFlow.Repository; @@ -512,7 +512,8 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient var output = new List(); foreach (var item in list.GroupBy(x => x.TemplateId)) { - output.Add(new { + output.Add(new + { id = item.Key, fullName = string.Format("{0}({1})", item.FirstOrDefault().FlowName, item.Count()), count = item.Count() @@ -1390,7 +1391,7 @@ public class FlowTaskRepository : IFlowTaskRepository, ITransient userName = SqlFunc.Subqueryable().Where(u => u.Id == a.HandleId).Select(u => SqlFunc.MergeString(u.RealName, "/", u.Account)), operatorId = SqlFunc.Subqueryable().Where(u => u.Id == a.OperatorId).Select(u => SqlFunc.MergeString(u.RealName, "/", u.Account)), // creatorTime = SqlFunc.IsNullOrEmpty(b.CreatorTime) ? a.HandleTime : b.CreatorTime, - creatorTime = b.CreatorTime==null ? a.HandleTime : b.CreatorTime, //modifyby zhoukeda 20230704 + creatorTime = b.CreatorTime == null ? a.HandleTime : b.CreatorTime, //modifyby zhoukeda 20230704 fileList = a.FileList }).ToListAsync(); } diff --git a/workflow/Tnb.WorkFlow/Service/FlowBeforeService.cs b/workflow/Tnb.WorkFlow/Service/FlowBeforeService.cs index b4a66a95..55e8dbc9 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowBeforeService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowBeforeService.cs @@ -194,7 +194,7 @@ public class FlowBeforeService : IDynamicApiController, ITransient var flowJson = _flowTaskRepository.GetFlowTemplateJsonInfo(x => x.Id == item.FlowId && x.DeleteMark == null); if (flowJson.IsNotEmptyOrNull()) { - output.Add(new { id = flowJson.Id, fullName =string.Format("{0}(v{1})", flowJson.FullName, flowJson.Version), flowTemplateJson= flowJson.FlowTemplateJson }); + output.Add(new { id = flowJson.Id, fullName = string.Format("{0}(v{1})", flowJson.FullName, flowJson.Version), flowTemplateJson = flowJson.FlowTemplateJson }); } } return output.Distinct(); @@ -304,7 +304,7 @@ public class FlowBeforeService : IDynamicApiController, ITransient [HttpGet("Suspend/{taskId}")] public async Task Suspend(string taskId) { - return await _flowTaskRepository.AnyFlowTask(x => x.ParentId == taskId && x.IsAsync == 1 && x.DeleteMark == null); + return await _flowTaskRepository.AnyFlowTask(x => x.ParentId == taskId && x.IsAsync == 1 && x.DeleteMark == null); } #endregion @@ -491,7 +491,7 @@ public class FlowBeforeService : IDynamicApiController, ITransient /// 审批参数. /// [HttpPost("Suspend/{taskId}")] - public async Task Suspend(string taskId,[FromBody] FlowHandleModel flowHandleModel) + public async Task Suspend(string taskId, [FromBody] FlowHandleModel flowHandleModel) { var flowTaskParamter = await _flowTaskRepository.GetTaskParamterByTaskId(taskId, flowHandleModel); await _flowTaskManager.Suspend(flowTaskParamter); diff --git a/workflow/Tnb.WorkFlow/Service/FlowDelegateService.cs b/workflow/Tnb.WorkFlow/Service/FlowDelegateService.cs index d12b1df6..4908953f 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowDelegateService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowDelegateService.cs @@ -182,7 +182,7 @@ public class FlowDelegateService : IDynamicApiController, ITransient public async Task GetFlowList([FromQuery] string flowId) { var userList = await _repository.AsSugarClient() - .Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, b.FlowId.Contains(a.TemplateId)||b.FlowName=="全部流程", JoinType.Left, b.UserId == c.Id)) + .Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, b.FlowId.Contains(a.TemplateId) || b.FlowName == "全部流程", JoinType.Left, b.UserId == c.Id)) .Where((a, b, c) => a.Id == flowId && b.Type == "0" && b.ToUserId == _userManager.UserId && b.EndTime > DateTime.Now && b.StartTime < DateTime.Now).Select((a, b, c) => new UserListOutput { id = c.Id, diff --git a/workflow/Tnb.WorkFlow/Service/FlowEngineService.cs b/workflow/Tnb.WorkFlow/Service/FlowEngineService.cs index 802cddc3..839561b9 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowEngineService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowEngineService.cs @@ -147,7 +147,7 @@ public class FlowEngineService : IFlowEngineService, IDynamicApiController, ITra data = data.FindAll(o => o.fullName.Contains(input.keyword) || o.enCode.Contains(input.keyword)); var pageList = new SqlSugarPagedList() { - list = data.Skip((input.currentPage - 1)* input.pageSize).Take(input.pageSize).ToList(), + list = data.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList(), pagination = new Pagination() { CurrentPage = input.currentPage, @@ -619,7 +619,7 @@ public class FlowEngineService : IFlowEngineService, IDynamicApiController, ITra sortCode = a.SortCode, type = c.Type, visibleType = c.VisibleType, - parentId = SqlFunc.Subqueryable().Where(d => d.EnCode == c.Category && d.DictionaryTypeId== "507f4f5df86b47588138f321e0b0dac7").Select(d => d.Id), + parentId = SqlFunc.Subqueryable().Where(d => d.EnCode == c.Category && d.DictionaryTypeId == "507f4f5df86b47588138f321e0b0dac7").Select(d => d.Id), }).MergeTable().OrderBy(a => a.sortCode).OrderBy(a => a.creatorTime, OrderByType.Desc) .OrderBy(a => a.lastModifyTime, OrderByType.Desc).ToListAsync(); } diff --git a/workflow/Tnb.WorkFlow/Service/FlowFormService.cs b/workflow/Tnb.WorkFlow/Service/FlowFormService.cs index be19f111..c302d640 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowFormService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowFormService.cs @@ -7,18 +7,15 @@ using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; -using JNPF.Systems.Entitys.Dto.ModuleForm; using JNPF.Systems.Entitys.Model.DataBase; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.System; using JNPF.VisualDev.Engine.Core; using JNPF.VisualDev.Engine.Model; using JNPF.VisualDev.Interfaces; using JNPF.WorkFlow.Entitys.Dto.FlowEngine; using JNPF.WorkFlow.Entitys.Dto.FlowForm; using JNPF.WorkFlow.Entitys.Entity; -using JNPF.WorkFlow.Interfaces.Repository; using Mapster; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; diff --git a/workflow/Tnb.WorkFlow/Service/FlowLaunchService.cs b/workflow/Tnb.WorkFlow/Service/FlowLaunchService.cs index 7a8e59ac..4ee10a75 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowLaunchService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowLaunchService.cs @@ -80,7 +80,7 @@ public class FlowLaunchService : IDynamicApiController, ITransient if (await _flowTaskRepository.AnyFlowTask(x => flowTaskParamter.flowTaskEntity.Id == x.ParentId && x.DeleteMark == null && x.Suspend == 1)) throw Oops.Oh(ErrorCode.WF0046); if (flowTaskParamter.flowTaskEntity.Status != 1) throw Oops.Oh(ErrorCode.WF0011); - if (flowTaskParamter.flowTaskEntity.ParentId.IsNotEmptyOrNull()&& !flowTaskParamter.flowTaskEntity.ParentId.Equals("0")) + if (flowTaskParamter.flowTaskEntity.ParentId.IsNotEmptyOrNull() && !flowTaskParamter.flowTaskEntity.ParentId.Equals("0")) throw Oops.Oh(ErrorCode.WF0015); await _flowTaskManager.Revoke(flowTaskParamter); } diff --git a/workflow/Tnb.WorkFlow/Service/FlowTaskService.cs b/workflow/Tnb.WorkFlow/Service/FlowTaskService.cs index ce7fdec1..262df2ba 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowTaskService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowTaskService.cs @@ -6,7 +6,6 @@ using JNPF.FriendlyException; using JNPF.WorkFlow.Entitys.Model; using JNPF.WorkFlow.Interfaces.Manager; using JNPF.WorkFlow.Interfaces.Service; -using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; namespace JNPF.WorkFlow.Service; diff --git a/workflow/Tnb.WorkFlow/Service/FlowTemplateService.cs b/workflow/Tnb.WorkFlow/Service/FlowTemplateService.cs index 9eea97f7..d2dcfe3e 100644 --- a/workflow/Tnb.WorkFlow/Service/FlowTemplateService.cs +++ b/workflow/Tnb.WorkFlow/Service/FlowTemplateService.cs @@ -11,9 +11,7 @@ using JNPF.FriendlyException; using JNPF.LinqBuilder; using JNPF.Systems.Entitys.Permission; using JNPF.Systems.Entitys.System; -using JNPF.Systems.Interfaces.Permission; using JNPF.Systems.Interfaces.System; -using JNPF.VisualDev.Entitys; using JNPF.WorkFlow.Entitys.Dto.FlowTemplate; using JNPF.WorkFlow.Entitys.Entity; using JNPF.WorkFlow.Entitys.Model; diff --git a/workflow/Tnb.WorkFlow/Tnb.WorkFlow.csproj b/workflow/Tnb.WorkFlow/Tnb.WorkFlow.csproj index c4d8fc92..5d764794 100644 --- a/workflow/Tnb.WorkFlow/Tnb.WorkFlow.csproj +++ b/workflow/Tnb.WorkFlow/Tnb.WorkFlow.csproj @@ -1,5 +1,4 @@  - net6.0 diff --git a/workflow/Tnb.WorkFlow/WorkFlowForm/LeaveApplyService.cs b/workflow/Tnb.WorkFlow/WorkFlowForm/LeaveApplyService.cs index 2c6f73cf..38b26359 100644 --- a/workflow/Tnb.WorkFlow/WorkFlowForm/LeaveApplyService.cs +++ b/workflow/Tnb.WorkFlow/WorkFlowForm/LeaveApplyService.cs @@ -5,7 +5,6 @@ using JNPF.Common.Core.Manager.Files; using JNPF.Common.Extension; using JNPF.Common.Manager; using JNPF.Common.Models; -using JNPF.Common.Models.WorkFlow; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; diff --git a/workflow/Tnb.WorkFlow/WorkFlowForm/SalesOrderService.cs b/workflow/Tnb.WorkFlow/WorkFlowForm/SalesOrderService.cs index 7422205f..e903a450 100644 --- a/workflow/Tnb.WorkFlow/WorkFlowForm/SalesOrderService.cs +++ b/workflow/Tnb.WorkFlow/WorkFlowForm/SalesOrderService.cs @@ -5,7 +5,6 @@ using JNPF.Common.Core.Manager.Files; using JNPF.Common.Extension; using JNPF.Common.Manager; using JNPF.Common.Models; -using JNPF.Common.Models.WorkFlow; using JNPF.Common.Security; using JNPF.DependencyInjection; using JNPF.DynamicApiController; From 1dbb17f1039c6bf6ec3d51c43cb2d21b09015b56 Mon Sep 17 00:00:00 2001 From: "fei.pan" Date: Mon, 6 Nov 2023 19:59:12 +0800 Subject: [PATCH 10/10] =?UTF-8?q?=E6=89=A7=E8=A1=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=B8=85=E7=90=86=EF=BC=8C=E4=BF=AE=E5=A4=8Dwarning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../App/AppEqpRepairApplyService.cs | 34 +- .../Tnb.EquipMgr/BaseMoldMaintainService.cs | 38 +- EquipMgr/Tnb.EquipMgr/EqpDaqService.cs | 8 +- EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs | 15 +- EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs | 11 +- .../Tnb.EquipMgr/EqpEquipSparePartsService.cs | 15 +- .../EqpMaintainTemEquipService.cs | 11 +- .../Tnb.EquipMgr/EqpMaintainTemService.cs | 27 +- .../Tnb.EquipMgr/EqpRepairApplyService.cs | 71 +- .../Tnb.EquipMgr/EqpRepairDelayService.cs | 9 +- .../Tnb.EquipMgr/EqpRepairOutApplyService.cs | 25 +- .../EqpSpEquipCheckRecordService.cs | 2 +- .../EqpSparePartsRequisitionHService.cs | 27 +- EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs | 27 +- EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs | 6 +- .../EqpTechnologyParameterService.cs | 8 +- .../EqpWorkshopChangeLogService.cs | 17 +- .../Tnb.EquipMgr/EquMaintainRecordService.cs | 64 +- .../Tnb.EquipMgr/EquSpotInsRecordService.cs | 55 +- .../Tnb.EquipMgr/EquSpotInsTemEquipService.cs | 11 +- EquipMgr/Tnb.EquipMgr/EquipmentService.cs | 26 +- .../Tnb.EquipMgr/ToolMoldLocationService.cs | 14 +- .../ToolMoldMaintainGroupService.cs | 16 +- .../ToolMoldMaintainPlanService.cs | 21 +- .../ToolMoldMaintainRuleService.cs | 135 ++- .../ToolMoldMaintainRunService.cs | 285 +++-- .../ToolMoldMaintainTaskService.cs | 26 +- .../ToolMoldRequisitionService.cs | 43 +- .../Tnb.EquipMgr/ToolMoldReturnService.cs | 9 +- EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs | 64 +- .../APP/AppPrdMoTaskLogService.cs | 12 +- .../APP/AppPrdMoTaskOneService.cs | 8 +- .../APP/AppPrdMoTaskTwoService.cs | 8 +- .../Tnb.ProductionMgr/AndonRecordService.cs | 80 +- .../Tnb.ProductionMgr/AndonService.cs | 52 +- .../PrdCancelCloseDownService.cs | 187 +-- .../Tnb.ProductionMgr/PrdFeedingService.cs | 209 ++-- .../Tnb.ProductionMgr/PrdInstockService.cs | 225 ++-- .../Tnb.ProductionMgr/PrdKittingOutService.cs | 94 +- .../PrdMaterialReceiptService.cs | 50 +- .../Tnb.ProductionMgr/PrdMoService.cs | 166 ++- .../PrdMoTaskIssueService.cs | 6 +- .../Tnb.ProductionMgr/PrdMoTaskService.cs | 1019 +++++++++-------- .../Tnb.ProductionMgr/PrdOutstockService.cs | 66 +- .../Tnb.ProductionMgr/PrdPackReportService.cs | 73 +- .../Tnb.ProductionMgr/PrdTaskManageService.cs | 51 +- .../ProductionReportRecordService.cs | 18 +- .../Tnb.ProductionMgr/RedisBackGround.cs | 49 +- .../Tnb.ProductionMgr/RedisDataService.cs | 23 +- .../WorkOrderSchedulingService.cs | 30 +- .../Tnb.ProductionMgr/WorklineCommService.cs | 10 +- QcMgr/Tnb.QcMgr/QcCheckItemService.cs | 169 +-- QcMgr/Tnb.QcMgr/QcCheckPlanService.cs | 329 +++--- QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs | 76 +- QcMgr/Tnb.QcMgr/QcCheckTaskService.cs | 379 +++--- QcMgr/Tnb.QcMgr/QcCheckTypeService.cs | 8 +- QcMgr/Tnb.QcMgr/QcSpcService.cs | 288 +++-- .../Tnb.WarehouseMgr/BasRegionUserService.cs | 8 +- .../Tnb.WarehouseMgr/BaseWareHouseService.cs | 103 +- .../BaseWareHouseService`1.cs | 16 +- .../Tnb.WarehouseMgr/DeviceProviderService.cs | 49 +- .../ElevatorControlService.cs | 116 +- .../TaskStatusChangeSubscriber.cs | 2 +- .../Extensions/BackgroundServiceExtensions.cs | 2 +- .../WareHouseBasedControllerActivator.cs | 6 +- .../Filters/NotifyFilterAttribute.cs | 4 +- .../LocationDefinitionService.cs | 98 +- .../PDATransferSignService.cs | 48 +- .../Tnb.WarehouseMgr/PcStroageService.cs | 4 +- .../Tnb.WarehouseMgr/PdaStroageService.cs | 8 +- .../Tnb.WarehouseMgr/Print/PPLBUtility.cs | 36 +- .../Tnb.WarehouseMgr/TaskManagerDelBase.cs | 16 +- .../Tnb.WarehouseMgr/TaskMesageNotify.cs | 2 +- .../TimedTaskBackgroundService.cs | 30 +- .../Tnb.WarehouseMgr/WareHouseService.cs | 338 +++--- .../Tnb.WarehouseMgr/WmsCarryBindService.cs | 59 +- .../Tnb.WarehouseMgr/WmsCarryLedgerService.cs | 29 +- .../WmsCarryMoveInStockService.cs | 123 +- .../WmsCarryMoveOutStockService.cs | 93 +- .../Tnb.WarehouseMgr/WmsCarryQueryService.cs | 40 +- .../Tnb.WarehouseMgr/WmsCarryService.cs | 43 +- .../Tnb.WarehouseMgr/WmsCarryUnbindService.cs | 27 +- .../Tnb.WarehouseMgr/WmsCheckTaskService.cs | 77 +- .../WmsCollocationSchemeSevice.cs | 8 +- .../Tnb.WarehouseMgr/WmsDeliveryService.cs | 84 +- .../Tnb.WarehouseMgr/WmsDistaskService.cs | 8 +- .../WmsEmptyInstockService.cs | 168 +-- .../WmsEmptyOutstockService .cs | 63 +- .../Tnb.WarehouseMgr/WmsFeedingService.cs | 8 +- .../WmsInStockPoliciesService.cs | 2 +- .../Tnb.WarehouseMgr/WmsInStockService.cs | 174 +-- .../WmsKittingInStkService.cs | 152 +-- .../Tnb.WarehouseMgr/WmsOutBaleService.cs | 97 +- .../Tnb.WarehouseMgr/WmsOutStockService.cs | 364 +++--- .../WmsPDACarryBindService.cs | 59 +- .../WmsPDACarryMoveInStockService.cs | 121 +- .../WmsPDACarryMoveOutStockService.cs | 92 +- .../WmsPDACarryUnbindService .cs | 27 +- .../Tnb.WarehouseMgr/WmsPDADeliveryService.cs | 86 +- .../WmsPDAEmptyInstockService.cs | 123 +- .../WmsPDAEmptyOutstockService .cs | 45 +- .../WmsPDAExceptionCancelService.cs | 10 +- .../WmsPDAExceptionCompleteService.cs | 2 +- .../WmsPDAExceptionReexcuteService.cs | 2 +- .../Tnb.WarehouseMgr/WmsPDAFeedingService.cs | 23 +- .../Tnb.WarehouseMgr/WmsPDAInStockService.cs | 139 ++- .../Tnb.WarehouseMgr/WmsPDAInbaleService.cs | 125 +- .../WmsPDAOutBaleServiceService.cs | 85 +- .../WmsPDAScanInStockService.cs | 166 +-- .../Tnb.WarehouseMgr/WmsPDATransferService.cs | 71 +- .../Tnb.WarehouseMgr/WmsPointService.cs | 62 +- .../WmsRobotCallbackService.cs | 122 +- .../Tnb.WarehouseMgr/WmsRouteMgrService.cs | 50 +- .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 133 +-- .../WmsSignForDeliveryService.cs | 36 +- .../Tnb.WarehouseMgr/WmsStockReportService.cs | 38 +- .../Tnb.WarehouseMgr/WmsTransferService.cs | 74 +- .../Tnb.WarehouseMgr/WmskittingOutService.cs | 156 +-- 118 files changed, 5046 insertions(+), 4111 deletions(-) diff --git a/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs index 531d2e4d..1a7de295 100644 --- a/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/App/AppEqpRepairApplyService.cs @@ -14,7 +14,7 @@ using Tnb.BasicData; using Tnb.EquipMgr.Entities; using Tnb.EquipMgr.Entities.Dto; -namespace Tnb.EquipMgr +namespace Tnb.EquipMgr.App { /// /// app设备维修登记 @@ -45,12 +45,12 @@ namespace Tnb.EquipMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); - string code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; - string name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string? code = queryJson != null && queryJson.ContainsKey("code") ? queryJson["code"].ToString() : ""; + string? name = queryJson != null && queryJson.ContainsKey("name") ? queryJson["name"].ToString() : ""; string userId = _userManager.UserId; - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.equip_id == b.id) .LeftJoin((a, b, c) => a.apply_user_id == c.Id) .LeftJoin((a, b, c, d) => d.EnCode == DictConst.RepairStatus) @@ -86,27 +86,31 @@ namespace Tnb.EquipMgr /// /// [HttpPost] - public async Task GetRepairInfoById(Dictionary dic) + public async Task GetRepairInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; - if (string.IsNullOrEmpty(id)) return null; - var db = _repository.AsSugarClient(); + if (string.IsNullOrEmpty(id)) + { + return null; + } + + ISqlSugarClient db = _repository.AsSugarClient(); return await db.Queryable() .LeftJoin((a, b) => a.equip_id == b.id) .Where((a, b) => a.id == id) .Select((a, b) => new { - id = a.id, + a.id, a.code, a.name, - equip_id = a.equip_id, + a.equip_id, equip_code = b.code, equip_name = b.name, expect_complete_time = a.expect_complete_time == null ? "" : a.expect_complete_time.Value.ToString("yyyy-MM-dd"), - is_ugent = a.is_ugent, - description = a.description, - status = a.status, - repairer_id = a.repairer_id, + a.is_ugent, + a.description, + a.status, + a.repairer_id, }).FirstAsync(); } diff --git a/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs b/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs index 4d51e102..35ba5762 100644 --- a/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs +++ b/EquipMgr/Tnb.EquipMgr/BaseMoldMaintainService.cs @@ -30,28 +30,38 @@ namespace Tnb.EquipMgr protected async Task Relevance(TSrc input, string mColumnName, string name, Expression> deleleExp) where TDest : BaseEntity, new() where TSrc : BaseMoldMaintainInput { - if (input == null) throw new ArgumentNullException(nameof(input)); - await _db.Deleteable().Where(deleleExp).ExecuteCommandAsync(); - var entities = new List(); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + _ = await _db.Deleteable().Where(deleleExp).ExecuteCommandAsync(); + List entities = new(); if (input.ids?.Count > 0) { - foreach (var id in input.ids) + foreach (string id in input.ids) { - var pk = id; + string pk = id; TDest entity = new(); entity.PropertySetValue(mColumnName, input.id); entity.PropertySetValue(name, pk); entities.Add(entity); } } - var row = await _db.Insertable(entities).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1000); + int row = await _db.Insertable(entities).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1000); + } } protected async Task Delete(Expression> delFilter) where T : BaseEntity, new() { - var row = await _db.Deleteable().Where(delFilter).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1002); + int row = await _db.Deleteable().Where(delFilter).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1002); + } } @@ -62,13 +72,13 @@ namespace Tnb.EquipMgr Expression> destMap ) where TDest : BaseEntity, new() { - var config = new TypeAdapterConfig(); - config.ForType().Map(destMap, srcMap); - var list = new List(); - var itemIds = await _db.Queryable().Where(masterFilterExp).Select(masterSelector).ToListAsync(); + TypeAdapterConfig config = new(); + _ = config.ForType().Map(destMap, srcMap); + List list = new(); + List itemIds = await _db.Queryable().Where(masterFilterExp).Select(masterSelector).ToListAsync(); if (itemIds?.Count > 0) { - var items = await _db.Queryable().Where(it => itemIds.Contains(it.id)).ToListAsync(); + List items = await _db.Queryable().Where(it => itemIds.Contains(it.id)).ToListAsync(); list = items.Adapt>(); } return list; diff --git a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs index dc8be317..a2eb3303 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpDaqService.cs @@ -32,13 +32,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetEquipDaqList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) .WhereIF(input != null, a => a.equip_id == input!.equip_id) .WhereIF(queryJson != null && queryJson.ContainsKey("data_source"), a => a.data_source == queryJson!["data_source"]) @@ -56,7 +56,7 @@ namespace Tnb.EquipMgr label_name = a.label_name, label_point = a.label_point, remark = a.remark - }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs index 33e7a176..61d56003 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipFileService.cs @@ -40,12 +40,12 @@ namespace Tnb.EquipMgr [HttpPost] public async Task Upload([FromForm] string equip_id, [FromForm] ChunkModel input) { - string msg = ""; + string msg; try { - var attachment = await _fileService.Uploader("annexpic", input); + dynamic attachment = await _fileService.Uploader("annexpic", input); - EqpEquipFile eqpEquipFile = new EqpEquipFile() + EqpEquipFile eqpEquipFile = new() { file_name = input.file.FileName, equip_id = equip_id, @@ -55,12 +55,11 @@ namespace Tnb.EquipMgr org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _repository.InsertAsync(eqpEquipFile); + _ = await _repository.InsertAsync(eqpEquipFile); msg = "上传成功"; } catch (Exception e) { - msg = "上传失败"; Log.Error(e.Message); throw Oops.Oh(ErrorCode.D8001); } @@ -71,13 +70,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetEquipFileList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (!string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) .LeftJoin((a, b, c) => a.modify_id == c.Id) .LeftJoin((a, b, c, d) => a.equip_id == d.id) diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs index b06ff48e..ff3f0e01 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipScrapService.cs @@ -33,22 +33,19 @@ namespace Tnb.EquipMgr [HttpPost] public async Task Scrap(EqpEquipScrap eqpEquipScrap) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { eqpEquipScrap.id = SnowflakeIdHelper.NextId(); eqpEquipScrap.create_id = _userManager.UserId; eqpEquipScrap.create_time = DateTime.Now; - await _repository.InsertAsync(eqpEquipScrap); + _ = await _repository.InsertAsync(eqpEquipScrap); - await db.Updateable().SetColumns(x => x.life == EquipmentLife.SCRAP) + _ = await db.Updateable().SetColumns(x => x.life == EquipmentLife.SCRAP) .Where(x => x.id == eqpEquipScrap.equip_id).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - - return result.IsSuccess ? "报废成功" : result.ErrorMessage; - + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "报废成功" : result.ErrorMessage; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs b/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs index 6c751f92..bcd10817 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpEquipSparePartsService.cs @@ -33,14 +33,17 @@ namespace Tnb.EquipMgr public async Task AddEquipSpareParts(EquipSparePartsInput input) { List oldList = await _repository.GetListAsync(x => x.equip_id == input.equip_id); - List list = new List(); + List list = new(); string orgId = _userManager?.GetUserInfo().Result.organizeId ?? ""; if (input != null && input.spare_parts_ids != null) { - foreach (var spare_parts_id in input.spare_parts_ids) + foreach (string spare_parts_id in input.spare_parts_ids) { if (oldList.Any(x => x.spare_parts_id == spare_parts_id)) + { continue; + } + list.Add(new EqpEquipSpareParts() { id = SnowflakeIdHelper.NextId(), @@ -53,19 +56,19 @@ namespace Tnb.EquipMgr } } - await _repository.InsertRangeAsync(list); + _ = await _repository.InsertRangeAsync(list); } [HttpPost] public async Task GetEquipSparePartsList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (!string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.spare_parts_id == b.id) .LeftJoin((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null) .LeftJoin((a, b, c, d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode) diff --git a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs index d0b07c26..b908de1c 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemEquipService.cs @@ -30,22 +30,25 @@ namespace Tnb.EquipMgr string id = parameters["id"]; DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.UpdateAsync(x => new EqpMaintainTemEquipH() + _ = await _repository.UpdateAsync(x => new EqpMaintainTemEquipH() { is_start = "0" }, x => x.id == id); List ids = await _repository.AsSugarClient().Queryable() .Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED) .Select(x => x.id).ToListAsync(); - await _repository.AsSugarClient().Deleteable() + _ = await _repository.AsSugarClient().Deleteable() .Where(x => x.maintain_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync(); - await _repository.AsSugarClient().Deleteable() + _ = await _repository.AsSugarClient().Deleteable() .Where(x => ids.Contains(x.maintain_record_id)).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) + { + throw Oops.Oh(ErrorCode.COM1008); + } } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs index aecb9304..cb689602 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpMaintainTemService.cs @@ -36,7 +36,7 @@ namespace Tnb.EquipMgr [HttpPost] public async Task Publish(SpotInsTemPublishInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { EqpMaintainTemH eqpMaintainTemH = await _repository.GetSingleAsync(x => x.id == input.id); @@ -44,13 +44,13 @@ namespace Tnb.EquipMgr if (input.equipIds != null && input.equipIds.Length > 0) { - List insertEqpMaintainTemEquipHs = new List(); - List insertEqpMaintainTemEquipDs = new List(); - foreach (var equipId in input.equipIds) + List insertEqpMaintainTemEquipHs = new(); + List insertEqpMaintainTemEquipDs = new(); + foreach (string equipId in input.equipIds) { string id = SnowflakeIdHelper.NextId(); string code = $"{DateTime.Now.ToString("yyyyMMdd") + equipId}"; - EqpMaintainTemEquipH eqpMaintainTemEquipH = new EqpMaintainTemEquipH() + EqpMaintainTemEquipH eqpMaintainTemEquipH = new() { id = id, code = code, @@ -79,9 +79,9 @@ namespace Tnb.EquipMgr if (eqpMaintainTemDs != null && eqpMaintainTemDs.Count > 0) { - foreach (var eqpMaintainTem in eqpMaintainTemDs) + foreach (EqpMaintainTemD eqpMaintainTem in eqpMaintainTemDs) { - EqpMaintainTemEquipD eqpMaintainTemEquipD = new EqpMaintainTemEquipD() + EqpMaintainTemEquipD eqpMaintainTemEquipD = new() { id = SnowflakeIdHelper.NextId(), maintain_item_id = eqpMaintainTem.maintain_item_id, @@ -92,27 +92,28 @@ namespace Tnb.EquipMgr } EqpMaintainTemEquipH oldMaintainTemEquipH = await db.Queryable().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).FirstAsync(); - await db.Deleteable().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync(); + _ = await db.Deleteable().Where(x => x.maintain_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync(); if (oldMaintainTemEquipH != null) - await db.Deleteable().Where(x => x.maintain_tem_equip_id == oldMaintainTemEquipH.id).ExecuteCommandAsync(); + { + _ = await db.Deleteable().Where(x => x.maintain_tem_equip_id == oldMaintainTemEquipH.id).ExecuteCommandAsync(); + } } if (insertEqpMaintainTemEquipHs != null && insertEqpMaintainTemEquipHs.Count > 0) { - await db.Insertable(insertEqpMaintainTemEquipHs).ExecuteCommandAsync(); + _ = await db.Insertable(insertEqpMaintainTemEquipHs).ExecuteCommandAsync(); } if (insertEqpMaintainTemEquipDs != null && insertEqpMaintainTemEquipDs.Count > 0) { - await db.Insertable(insertEqpMaintainTemEquipDs).ExecuteCommandAsync(); + _ = await db.Insertable(insertEqpMaintainTemEquipDs).ExecuteCommandAsync(); } } }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "发布成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "发布成功" : result.ErrorMessage; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs index f1093657..de39f2f4 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -97,21 +97,23 @@ namespace Tnb.EquipMgr input.data["code"] = await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE); } - EqpRepairApply eqpRepairApply = new EqpRepairApply(); - eqpRepairApply.code = (string)input.data["code"]; - eqpRepairApply.name = (string)input.data["name"]; - eqpRepairApply.equip_id = (string)input.data["equip_id"]; - eqpRepairApply.expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null; - eqpRepairApply.is_ugent = (int?)(long)input.data["is_ugent"]; - eqpRepairApply.attachment = input.data.ContainsKey("attachment") ? (string)input.data["attachment"] : null; - eqpRepairApply.apply_user_id = (string)input.data["apply_user_id"]; - eqpRepairApply.create_id = (string)input.data["create_id"]; - eqpRepairApply.create_time = DateTime.Now; - eqpRepairApply.org_id = (string)input.data["org_id"]; - eqpRepairApply.remark = (string)input.data["remark"]; - eqpRepairApply.description = (string)input.data["description"]; - eqpRepairApply.status = RepairApplyStatus.TOBEEXECUTED; - await _repository.InsertAsync(eqpRepairApply); + EqpRepairApply eqpRepairApply = new() + { + code = (string)input.data["code"], + name = (string)input.data["name"], + equip_id = (string)input.data["equip_id"], + expect_complete_time = input.data["expect_complete_time"] != null && input.data["expect_complete_time"].ToString() != "" ? Convert.ToDateTime(input.data["expect_complete_time"]) : null, + is_ugent = (int?)(long)input.data["is_ugent"], + attachment = input.data.ContainsKey("attachment") ? (string)input.data["attachment"] : null, + apply_user_id = (string)input.data["apply_user_id"], + create_id = (string)input.data["create_id"], + create_time = DateTime.Now, + org_id = (string)input.data["org_id"], + remark = (string)input.data["remark"], + description = (string)input.data["description"], + status = RepairApplyStatus.TOBEEXECUTED + }; + _ = await _repository.InsertAsync(eqpRepairApply); // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); // await _runService.Create(templateEntity, input); @@ -122,7 +124,7 @@ namespace Tnb.EquipMgr public async Task Repeal(Dictionary dic) { string id = dic["id"]; - await _repository.UpdateAsync(x => new EqpRepairApply() + _ = await _repository.UpdateAsync(x => new EqpRepairApply() { status = RepairApplyStatus.REPEAL }, x => x.id == id); @@ -133,7 +135,7 @@ namespace Tnb.EquipMgr public async Task Close(Dictionary dic) { string id = dic["id"]; - await _repository.UpdateAsync(x => new EqpRepairApply() + _ = await _repository.UpdateAsync(x => new EqpRepairApply() { status = RepairApplyStatus.CLOSE, }, x => x.id == id); @@ -146,10 +148,10 @@ namespace Tnb.EquipMgr string id = dic["id"]; string repairerId = dic["repairerId"]; EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); - if (eqpRepairApply.status == RepairApplyStatus.TOBEEXECUTED || - eqpRepairApply.status == RepairApplyStatus.REFUSE) + if (eqpRepairApply.status is RepairApplyStatus.TOBEEXECUTED or + RepairApplyStatus.REFUSE) { - await _repository.UpdateAsync(x => new EqpRepairApply() + _ = await _repository.UpdateAsync(x => new EqpRepairApply() { repairer_id = repairerId, status = RepairApplyStatus.TOBERECEIVED, @@ -172,7 +174,7 @@ namespace Tnb.EquipMgr { if (_userManager.UserId == eqpRepairApply.repairer_id) { - await _repository.UpdateAsync(x => new EqpRepairApply() + _ = await _repository.UpdateAsync(x => new EqpRepairApply() { status = RepairApplyStatus.RECEIVED, }, x => x.id == id); @@ -194,7 +196,7 @@ namespace Tnb.EquipMgr { string id = dic["id"]; string reason = dic["reason"]; - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); @@ -202,11 +204,11 @@ namespace Tnb.EquipMgr { if (_userManager.UserId == eqpRepairApply.repairer_id) { - await _repository.UpdateAsync(x => new EqpRepairApply() + _ = await _repository.UpdateAsync(x => new EqpRepairApply() { status = RepairApplyStatus.REFUSE, }, x => x.id == id); - EqpRepairRefuse eqpRepairRefuse = new EqpRepairRefuse() + EqpRepairRefuse eqpRepairRefuse = new() { repair_apply_id = id, reason = reason, @@ -214,7 +216,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId }; - await db.Insertable(eqpRepairRefuse).ExecuteCommandAsync(); + _ = await db.Insertable(eqpRepairRefuse).ExecuteCommandAsync(); } else { @@ -227,8 +229,7 @@ namespace Tnb.EquipMgr } }); - if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); - return "拒绝成功"; + return !result.IsSuccess ? throw Oops.Oh(result.ErrorMessage) : "拒绝成功"; } [HttpPost] @@ -248,7 +249,7 @@ namespace Tnb.EquipMgr if (_userManager.UserId == eqpRepairApply.repairer_id) { string status = input.is_out_apply == 1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED; - await _repository.UpdateAsync(x => new EqpRepairApply() + _ = await _repository.UpdateAsync(x => new EqpRepairApply() { fault_id = input.fault_id, is_complete = input.is_complete, @@ -294,13 +295,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetRepairRecordList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (!string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.apply_user_id == b.Id) .LeftJoin((a, b, c) => a.repairer_id == c.Id) .Where(a => a.equip_id == input.equip_id) @@ -328,7 +329,7 @@ namespace Tnb.EquipMgr DateTime? start_time = input.start_time; DateTime? end_time = input.end_time; - List statusList = new List(); + List statusList = new(); if (!string.IsNullOrEmpty(input.status)) { switch (input.status) @@ -363,8 +364,8 @@ namespace Tnb.EquipMgr input.sidx = "a." + input.sidx; } - var db = _repository.AsSugarClient(); - var result = await db.Queryable() + ISqlSugarClient db = _repository.AsSugarClient(); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.apply_user_id == b.Id) .LeftJoin((a, b, c) => a.repairer_id == c.Id) .LeftJoin((a, b, c, d) => a.equip_id == d.id) @@ -393,7 +394,7 @@ namespace Tnb.EquipMgr repairer_id_id = c.Id, remark = a.remark, status = f.FullName - }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs index 58a7e909..0d955dce 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairDelayService.cs @@ -39,7 +39,7 @@ namespace Tnb.EquipMgr DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == input.repair_apply_id); - EqpRepairDelay repairDelay = new EqpRepairDelay() + EqpRepairDelay repairDelay = new() { id = SnowflakeIdHelper.NextId(), equip_id = eqpRepairApply?.equip_id ?? "", @@ -52,15 +52,14 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, }; - await _repository.InsertAsync(repairDelay); + _ = await _repository.InsertAsync(repairDelay); - await _repository.AsSugarClient().Updateable() + _ = await _repository.AsSugarClient().Updateable() .SetColumns(x => x.expect_complete_time == input.expected_time) .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "延期成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "延期成功" : result.ErrorMessage; } } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs index ced5c394..a4e3b8fe 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairOutApplyService.cs @@ -51,10 +51,10 @@ namespace Tnb.EquipMgr public async Task OutApply(RepairOutApplyInput input) { EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable().SingleAsync(x => x.id == input.repair_apply_id); - if (eqpRepairApply.status == RepairApplyStatus.TOBEOUTAPPLY || - eqpRepairApply.status == RepairApplyStatus.APPROVENOTPASS) + if (eqpRepairApply.status is RepairApplyStatus.TOBEOUTAPPLY or + RepairApplyStatus.APPROVENOTPASS) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id; DbResult result = await db.Ado.UseTranAsync(async () => { @@ -92,7 +92,7 @@ namespace Tnb.EquipMgr // },x=>x.id==input.id); } - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.status == RepairApplyStatus.OUTAPPLYAPPROVE) .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); @@ -100,7 +100,10 @@ namespace Tnb.EquipMgr }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) + { + throw Oops.Oh(ErrorCode.COM1008); + } if (result.IsSuccess) { @@ -129,7 +132,7 @@ namespace Tnb.EquipMgr } else { - var entity = await _repository.GetSingleAsync(x => x.id == input.id); + EqpRepairOutApply entity = await _repository.GetSingleAsync(x => x.id == input.id); if (entity != null) { @@ -170,10 +173,10 @@ namespace Tnb.EquipMgr public async Task Register(RepairApplyOutRegisterInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - await _repository.UpdateAsync(x => new EqpRepairOutApply() + _ = await _repository.UpdateAsync(x => new EqpRepairOutApply() { real_supplier_id = input.real_supplier_id, cost = input.cost, @@ -183,12 +186,10 @@ namespace Tnb.EquipMgr attachment = input.attachment, }, x => x.id == input.id); - await db.Updateable().SetColumns(x => x.status == RepairApplyStatus.COMPLETED) + _ = await db.Updateable().SetColumns(x => x.status == RepairApplyStatus.COMPLETED) .Where(x => x.id == input.repair_apply_id).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - - return result.IsSuccess ? "登记成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "登记成功" : result.ErrorMessage; } } diff --git a/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs b/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs index 8cd6c648..87ca5155 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSpEquipCheckRecordService.cs @@ -50,7 +50,7 @@ namespace Tnb.EquipMgr entity.create_time = DateTime.Now; entity.create_id = _userManager.UserId; entity.org_id = _userManager.GetUserInfo().Result.organizeId; - await _repository.InsertAsync(entity); + _ = await _repository.InsertAsync(entity); } } diff --git a/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs b/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs index bcda549b..225f3154 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSparePartsRequisitionHService.cs @@ -47,13 +47,13 @@ namespace Tnb.EquipMgr private async Task Create(VisualDevModelDataCrInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { // VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); // await _runService.Create(templateEntity, input); - var code = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.SPAREPARTSREQUISITION_CODE); - EqpSparePartsRequisitionH eqpSparePartsRequisitionH = new EqpSparePartsRequisitionH() + string code = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.SPAREPARTSREQUISITION_CODE); + EqpSparePartsRequisitionH eqpSparePartsRequisitionH = new() { code = code, equip_id = input.data.ContainsKey("equip_id") ? input.data["equip_id"].ToString() : "", @@ -65,14 +65,14 @@ namespace Tnb.EquipMgr org_id = _userManager.GetUserInfo().Result.organizeId, }; - await db.Insertable(eqpSparePartsRequisitionH).ExecuteCommandAsync(); + _ = await db.Insertable(eqpSparePartsRequisitionH).ExecuteCommandAsync(); - if (input.data.TryGetValue("tablefield120", out var value)) + if (input.data.TryGetValue("tablefield120", out object? value)) { - var details = value.ToObject>>(); - List eqpSparePartsList = new List(); - List eqpSparePartsRequisitionDs = new List() { }; - foreach (var detail in details) + List> details = value.ToObject>>(); + List eqpSparePartsList = new(); + List eqpSparePartsRequisitionDs = new() { }; + foreach (Dictionary detail in details) { string instockDetailId = detail.ContainsKey("instock_detail_id") ? detail["instock_detail_id"] : ""; string sparePartsId = detail.ContainsKey("spare_parts_id") ? detail["spare_parts_id"] : ""; @@ -99,7 +99,7 @@ namespace Tnb.EquipMgr org_id = _userManager.GetUserInfo().Result.organizeId }); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.use_quantity == x.use_quantity + quantity) .Where(x => x.id == instockDetailId).ExecuteCommandAsync(); } @@ -112,19 +112,18 @@ namespace Tnb.EquipMgr if (eqpSparePartsRequisitionDs.Count > 0) { - await db.Insertable(eqpSparePartsRequisitionDs).ExecuteCommandAsync(); + _ = await db.Insertable(eqpSparePartsRequisitionDs).ExecuteCommandAsync(); } if (eqpSparePartsList.Count > 0) { - await db.Insertable(eqpSparePartsList).ExecuteCommandAsync(); + _ = await db.Insertable(eqpSparePartsList).ExecuteCommandAsync(); } } }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs b/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs index 50fa264a..64dc3a39 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSpotInsTemService.cs @@ -36,7 +36,7 @@ namespace Tnb.EquipMgr [HttpPost] public async Task Publish(SpotInsTemPublishInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { EqpSpotInsTemH eqpSpotInsTemH = await _repository.GetSingleAsync(x => x.id == input.id); @@ -44,13 +44,13 @@ namespace Tnb.EquipMgr if (input.equipIds != null && input.equipIds.Length > 0) { - List insertEqpSpotInsTemEquipHs = new List(); - List insertEqpSpotInsTemEquipDs = new List(); - foreach (var equipId in input.equipIds) + List insertEqpSpotInsTemEquipHs = new(); + List insertEqpSpotInsTemEquipDs = new(); + foreach (string equipId in input.equipIds) { string id = SnowflakeIdHelper.NextId(); string code = $"{DateTime.Now.ToString("yyyyMMdd") + equipId}"; - EqpSpotInsTemEquipH eqpSpotInsTemEquipH = new EqpSpotInsTemEquipH() + EqpSpotInsTemEquipH eqpSpotInsTemEquipH = new() { id = id, code = code, @@ -79,9 +79,9 @@ namespace Tnb.EquipMgr if (eqpSpotInsTemDs != null && eqpSpotInsTemDs.Count > 0) { - foreach (var eqpSpotInsTem in eqpSpotInsTemDs) + foreach (EqpSpotInsTemD eqpSpotInsTem in eqpSpotInsTemDs) { - EqpSpotInsTemEquipD eqpSpotInsTemEquipD = new EqpSpotInsTemEquipD() + EqpSpotInsTemEquipD eqpSpotInsTemEquipD = new() { id = SnowflakeIdHelper.NextId(), spot_ins_item_id = eqpSpotInsTem?.spot_ins_item_id ?? "", @@ -92,27 +92,28 @@ namespace Tnb.EquipMgr } EqpSpotInsTemEquipH oldSpotInsTemEquipH = await db.Queryable().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).FirstAsync(); - await db.Deleteable().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync(); + _ = await db.Deleteable().Where(x => x.spot_ins_tem_id == input.id && x.equip_id == equipId).ExecuteCommandAsync(); if (oldSpotInsTemEquipH != null) - await db.Deleteable().Where(x => x.spot_ins_tem_equip_id == oldSpotInsTemEquipH.id).ExecuteCommandAsync(); + { + _ = await db.Deleteable().Where(x => x.spot_ins_tem_equip_id == oldSpotInsTemEquipH.id).ExecuteCommandAsync(); + } } if (insertEqpSpotInsTemEquipHs != null && insertEqpSpotInsTemEquipHs.Count > 0) { - await db.Insertable(insertEqpSpotInsTemEquipHs).ExecuteCommandAsync(); + _ = await db.Insertable(insertEqpSpotInsTemEquipHs).ExecuteCommandAsync(); } if (insertEqpSpotInsTemEquipDs != null && insertEqpSpotInsTemEquipDs.Count > 0) { - await db.Insertable(insertEqpSpotInsTemEquipDs).ExecuteCommandAsync(); + _ = await db.Insertable(insertEqpSpotInsTemEquipDs).ExecuteCommandAsync(); } } }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "发布成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "发布成功" : result.ErrorMessage; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs b/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs index 7c278cd1..267ccaaf 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpSubEquipService.cs @@ -32,13 +32,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetSubEquipList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (!string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) .LeftJoin((a, b, c) => a.modify_id == c.Id) .LeftJoin((a, b, c, d) => a.equip_id == d.id) diff --git a/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs b/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs index 115999e8..c0eb9c9c 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpTechnologyParameterService.cs @@ -30,13 +30,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetEquipTechnologyParameterList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .WhereIF(input != null, a => a.equip_id == input!.equip_id) .WhereIF(queryJson != null && queryJson.ContainsKey("name"), a => a.name.Contains(queryJson!["name"])) .Select(a => new EquipTechnologyParameterQueryOutput @@ -45,7 +45,7 @@ namespace Tnb.EquipMgr name = a.name, definition = a.definition, remark = a.remark - }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } diff --git a/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs b/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs index 750197da..2e9ece5d 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpWorkshopChangeLogService.cs @@ -32,13 +32,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetEquipWorkshopChangeList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); // Dictionary? queryJson = new Dictionary(); // if (input!=null && !string.IsNullOrEmpty(input.queryJson)) // { // queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); // } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.old_workshop_id == b.Id) .LeftJoin((a, b, c) => a.new_workshop_id == c.Id) .WhereIF(input != null, a => a.equip_id == input!.equip_id) @@ -52,7 +52,7 @@ namespace Tnb.EquipMgr new_installation_location = a.new_installation_location, remark = a.remark, create_time = a.create_time == null ? null : a.create_time.Value.ToString("yyyy-MM-dd"), - }).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } @@ -60,12 +60,12 @@ namespace Tnb.EquipMgr [HttpPost] public async Task WorkshopChange(EquipWorkshopChangeInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { EqpEquipment eqpEquipment = await db.Queryable().SingleAsync(x => x.id == input.equip_id); - EqpWorkshopChangeLog eqpWorkshopChangeLog = new EqpWorkshopChangeLog() + EqpWorkshopChangeLog eqpWorkshopChangeLog = new() { equip_id = input.equip_id, old_workshop_id = eqpEquipment.use_department_id, @@ -78,17 +78,16 @@ namespace Tnb.EquipMgr org_id = _userManager.GetUserInfo().Result.organizeId }; - await _repository.InsertAsync(eqpWorkshopChangeLog); + _ = await _repository.InsertAsync(eqpWorkshopChangeLog); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.use_department_id == input.new_workshop_id) .SetColumns(x => x.installation_location == input.new_installation_location) .Where(x => x.id == input.equip_id).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "迁移成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "迁移成功" : result.ErrorMessage); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs index dd80af65..c7c003da 100644 --- a/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquMaintainRecordService.cs @@ -50,7 +50,7 @@ namespace Tnb.EquipMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); Dictionary? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary() : input.queryJson.ToObject>(); string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : ""; string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : ""; @@ -67,7 +67,7 @@ namespace Tnb.EquipMgr input.sidx = "a." + input.sidx; } - var list = await db.Queryable((a, b, c, d) => new object[] + SqlSugarPagedList list = await db.Queryable((a, b, c, d) => new object[] { JoinType.Left, a.equip_id == b.id, JoinType.Left, a.execute_user_id == c.Id, @@ -105,7 +105,7 @@ namespace Tnb.EquipMgr a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.last_execute_time = a.date_last_execute_time == null ? "" : a.date_last_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); }) - .ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + .ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(list); } @@ -120,16 +120,8 @@ namespace Tnb.EquipMgr DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { EqpMaintainRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id); - string status = ""; - if (eqpSpotInsRecordH.is_repeat == "1") - { - status = SpotInsRecordExecutionStatus.TOBECHECK; - } - else - { - status = SpotInsRecordExecutionStatus.COMPLETED; - } - await _repository.UpdateAsync(x => new EqpMaintainRecordH() + string status = eqpSpotInsRecordH.is_repeat == "1" ? SpotInsRecordExecutionStatus.TOBECHECK : SpotInsRecordExecutionStatus.COMPLETED; + _ = await _repository.UpdateAsync(x => new EqpMaintainRecordH() { result = input.result, attachment = input.attachment, @@ -141,9 +133,9 @@ namespace Tnb.EquipMgr if (input != null && input.details != null) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { - await _repository.AsSugarClient().Updateable() + _ = await _repository.AsSugarClient().Updateable() .SetColumns(x => x.result == item["result"]) .SetColumnsIF(item.ContainsKey("maintain_descrip"), x => x.maintain_descrip == item["maintain_descrip"]) .Where(x => x.id == item["id"]) @@ -154,8 +146,7 @@ namespace Tnb.EquipMgr }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "执行成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "执行成功" : result.ErrorMessage); } /// @@ -184,7 +175,7 @@ namespace Tnb.EquipMgr { x.maintain_type = typeDic.ContainsKey(x.maintain_type) ? typeDic[x.maintain_type] + "" : x.maintain_type; }); - MaintainRecordRepeatOutput output = new MaintainRecordRepeatOutput() + MaintainRecordRepeatOutput output = new() { model = eqpSpotInsRecordH, details = eqpSpotInsRecordDs, @@ -199,7 +190,7 @@ namespace Tnb.EquipMgr [HttpPost] public async Task RepeatMaintain(MaintainRecordRepeatInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); EqpMaintainRecordH eqpMaintainRecordH = await _repository.GetSingleAsync(x => x.id == input.id); if (eqpMaintainRecordH.status == "1") { @@ -210,9 +201,9 @@ namespace Tnb.EquipMgr if (input != null && input.details != null) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { - await db.Updateable() + _ = await db.Updateable() .SetColumnsIF(item.ContainsKey("repeat_descrip"), x => x.repeat_descrip == item["repeat_descrip"]) .SetColumns(x => x.repeat_result == item["repeat_result"]) .Where(x => x.id == item["id"]).ExecuteCommandAsync(); @@ -221,7 +212,7 @@ namespace Tnb.EquipMgr if (input != null) { - await _repository.UpdateAsync(x => new EqpMaintainRecordH() + _ = await _repository.UpdateAsync(x => new EqpMaintainRecordH() { repeat_result = input.repeat_result, repeat_remark = input.repeat_remark, @@ -232,20 +223,19 @@ namespace Tnb.EquipMgr } }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "复核成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : result.IsSuccess ? "复核成功" : result.ErrorMessage; } [HttpPost] public async Task GetMaintainRecordList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (!string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.equip_id == b.id) .LeftJoin((a, b, c) => a.execute_user_id == c.Id) .LeftJoin((a, b, c, d) => a.repeat_user_id == d.Id) @@ -277,24 +267,28 @@ namespace Tnb.EquipMgr /// /// [HttpPost] - public async Task GetEqpMaintainRecordInfoById(Dictionary dic) + public async Task GetEqpMaintainRecordInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; - if (string.IsNullOrEmpty(id)) return null; - var db = _repository.AsSugarClient(); + if (string.IsNullOrEmpty(id)) + { + return null; + } + + ISqlSugarClient db = _repository.AsSugarClient(); return await db.Queryable() .LeftJoin((a, b) => a.equip_id == b.id) .Where((a, b) => a.id == id) .Select((a, b) => new { - id = a.id, - equip_id = a.equip_id, + a.id, + a.equip_id, equip_code = b.code, equip_name = b.name, create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - result_remark = a.result_remark, - result = a.result, - status = a.status, + a.result_remark, + a.result, + a.status, }).FirstAsync(); } diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs index 3b0ffce9..111e86a7 100644 --- a/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsRecordService.cs @@ -49,7 +49,7 @@ namespace Tnb.EquipMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); Dictionary? queryJson = (input == null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary() : input.queryJson.ToObject>(); string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : ""; string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : ""; @@ -66,7 +66,7 @@ namespace Tnb.EquipMgr input.sidx = "a." + input.sidx; } - var list = await db.Queryable((a, b, c, d) => new object[] + SqlSugarPagedList list = await db.Queryable((a, b, c, d) => new object[] { JoinType.Left, a.equip_id == b.id, JoinType.Left, a.spot_record_user_id == c.Id, @@ -101,7 +101,7 @@ namespace Tnb.EquipMgr a.spot_record_date_time = a.date_spot_record_date_time == null ? "" : a.date_spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss"); }) - .ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + .ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(list); } @@ -117,16 +117,8 @@ namespace Tnb.EquipMgr { EqpSpotInsRecordH eqpSpotInsRecordH = _repository.GetSingle(x => x.id == input.id); - string status = ""; - if (eqpSpotInsRecordH.is_repeat == "1") - { - status = SpotInsRecordExecutionStatus.TOBECHECK; - } - else - { - status = SpotInsRecordExecutionStatus.COMPLETED; - } - await _repository.UpdateAsync(x => new EqpSpotInsRecordH() + string status = eqpSpotInsRecordH.is_repeat == "1" ? SpotInsRecordExecutionStatus.TOBECHECK : SpotInsRecordExecutionStatus.COMPLETED; + _ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH() { result = input.result, attachment = input.attachment, @@ -138,9 +130,9 @@ namespace Tnb.EquipMgr if (input != null && input.details != null) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { - await _repository.AsSugarClient().Updateable(). + _ = await _repository.AsSugarClient().Updateable(). SetColumns(x => x.result == item["result"]) .SetColumnsIF(item["judge_type"] == "1", x => x.real_value == Convert.ToDouble(item["real_value"])) .Where(x => x.id == item["id"]) @@ -151,8 +143,7 @@ namespace Tnb.EquipMgr }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "执行成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "执行成功" : result.ErrorMessage); } /// @@ -167,7 +158,7 @@ namespace Tnb.EquipMgr EqpSpotInsRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id); List eqpSpotInsRecordDs = await _repository.AsSugarClient().Queryable() .Where(x => x.spot_ins_record_id == id).ToListAsync(); - SpotInsRecordRepeatOutput output = new SpotInsRecordRepeatOutput() + SpotInsRecordRepeatOutput output = new() { model = eqpSpotInsRecordH, details = eqpSpotInsRecordDs, @@ -187,7 +178,7 @@ namespace Tnb.EquipMgr { throw Oops.Bah("状态错误"); } - await _repository.UpdateAsync(x => new EqpSpotInsRecordH() + _ = await _repository.UpdateAsync(x => new EqpSpotInsRecordH() { repeat_result = input.repeat_result, repeat_remark = input.repeat_remark, @@ -200,13 +191,13 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GetSpotInsRecordList(EquipQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary? queryJson = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = new(); if (!string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input.queryJson); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.repeat_user_id == b.Id) .Where(a => a.equip_id == input.equip_id) .Select((a, b) => new EquipSpotInsRecordQueryOutput @@ -235,24 +226,28 @@ namespace Tnb.EquipMgr /// /// [HttpPost] - public async Task GetEqpSpotInsRecordInfoById(Dictionary dic) + public async Task GetEqpSpotInsRecordInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; - if (string.IsNullOrEmpty(id)) return null; - var db = _repository.AsSugarClient(); + if (string.IsNullOrEmpty(id)) + { + return null; + } + + ISqlSugarClient db = _repository.AsSugarClient(); return await db.Queryable() .LeftJoin((a, b) => a.equip_id == b.id) .Where((a, b) => a.id == id) .Select((a, b) => new { - id = a.id, - equip_id = a.equip_id, + a.id, + a.equip_id, equip_code = b.code, equip_name = b.name, create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - result_remark = a.result_remark, - result = a.result, - status = a.status, + a.result_remark, + a.result, + a.status, }).FirstAsync(); } diff --git a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs index edc3b02b..b9de2b04 100644 --- a/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquSpotInsTemEquipService.cs @@ -29,22 +29,25 @@ namespace Tnb.EquipMgr string id = parameters["id"]; DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.UpdateAsync(x => new EqpSpotInsTemEquipH() + _ = await _repository.UpdateAsync(x => new EqpSpotInsTemEquipH() { is_start = "0" }, x => x.id == id); List ids = await _repository.AsSugarClient().Queryable() .Where(x => x.spot_ins_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED) .Select(x => x.id).ToListAsync(); - await _repository.AsSugarClient().Deleteable() + _ = await _repository.AsSugarClient().Deleteable() .Where(x => x.spot_ins_tem_equip_id == id && x.status == SpotInsRecordExecutionStatus.TOBEEXECUTED).ExecuteCommandAsync(); - await _repository.AsSugarClient().Deleteable() + _ = await _repository.AsSugarClient().Deleteable() .Where(x => ids.Contains(x.spot_ins_record_id)).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); + if (!result.IsSuccess) + { + throw Oops.Oh(ErrorCode.COM1008); + } } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs index c8392d9c..09ed9bf3 100644 --- a/EquipMgr/Tnb.EquipMgr/EquipmentService.cs +++ b/EquipMgr/Tnb.EquipMgr/EquipmentService.cs @@ -55,13 +55,13 @@ namespace Tnb.EquipMgr /// private async Task GetList(VisualDevModelListQueryInput input) { - var dic = new Dictionary + Dictionary dic = new() { { "Qualified","合格"}, { "Unqualified","不合格"}, }; - var pagedList = await _repository.AsQueryable() + SqlSugarPagedList pagedList = await _repository.AsQueryable() //.Where(it => it.station_code == input.station_code || string.IsNullOrEmpty(input.station_code)) .Select(it => new EquipmentListOutput { @@ -82,7 +82,7 @@ namespace Tnb.EquipMgr private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) { - string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"]?.ToString() : ""; + string? qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"]?.ToString() : ""; if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == qrcode)) { throw Oops.Bah("二维码总表中已存在该二维码"); @@ -96,7 +96,7 @@ namespace Tnb.EquipMgr if (!string.IsNullOrEmpty(qrcode)) { - BasQrcode basQrcode = new BasQrcode() + BasQrcode basQrcode = new() { code = visualDevModelDataCrInput.data["qrcode"].ToString(), source_id = equipId, @@ -105,7 +105,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); } } return await Task.FromResult(true); @@ -113,7 +113,7 @@ namespace Tnb.EquipMgr private async Task Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput) { - string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"]?.ToString() : ""; + string? qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"]?.ToString() : ""; if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id)) { throw Oops.Bah("二维码总表中已存在该二维码"); @@ -127,13 +127,13 @@ namespace Tnb.EquipMgr { if (await _repository.AsSugarClient().Queryable().AnyAsync(x => x.source_id == id)) { - await _repository.AsSugarClient().Updateable() + _ = await _repository.AsSugarClient().Updateable() .SetColumns(x => x.code == visualDevModelDataUpInput.data["qrcode"].ToString()).Where(x => x.source_id == id) .ExecuteCommandAsync(); } else { - BasQrcode basQrcode = new BasQrcode() + BasQrcode basQrcode = new() { code = visualDevModelDataUpInput.data["qrcode"].ToString(), source_id = id, @@ -142,7 +142,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); } } } @@ -169,8 +169,8 @@ namespace Tnb.EquipMgr public async Task GetWorklineAndEquipTree(Dictionary dic) { string equipTypes = dic.ContainsKey("equipTypes") ? dic["equipTypes"] : ""; - var db = _repository.AsSugarClient(); - var queryable1 = db.Queryable() + ISqlSugarClient db = _repository.AsSugarClient(); + ISugarQueryable queryable1 = db.Queryable() .Where((a) => a.DeleteMark == null && a.Category == DictConst.RegionCategoryWorkshopCode) .Select((a) => new WorklineAndEquipTreeOutput() { @@ -191,7 +191,7 @@ namespace Tnb.EquipMgr }) }); - List list2 = new List(); + List list2 = new(); if (!string.IsNullOrEmpty(equipTypes)) { string[] equipTypeArr = equipTypes.Split(","); @@ -219,7 +219,7 @@ namespace Tnb.EquipMgr } // var list = await db.UnionAll(queryable1, queryable2).ToListAsync(); - var list1 = await queryable1.ToListAsync(); + List list1 = await queryable1.ToListAsync(); list1.AddRange(list2); return new AuthResponse(200, "", new Dictionary() { diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs index 8c68f022..144bd1df 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldLocationService.cs @@ -47,7 +47,7 @@ namespace Tnb.EquipMgr private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) { - string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : ""; + string? qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : ""; if (!string.IsNullOrEmpty(qrcode) && await _db.Queryable().AnyAsync(x => x.code == qrcode)) { throw Oops.Bah("二维码总表中已存在该二维码"); @@ -61,7 +61,7 @@ namespace Tnb.EquipMgr if (!string.IsNullOrEmpty(qrcode)) { - BasQrcode basQrcode = new BasQrcode() + BasQrcode basQrcode = new() { code = visualDevModelDataCrInput.data["qrcode"].ToString(), source_id = id, @@ -70,7 +70,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _db.Insertable(basQrcode).ExecuteCommandAsync(); + _ = await _db.Insertable(basQrcode).ExecuteCommandAsync(); } } return await Task.FromResult(true); @@ -78,7 +78,7 @@ namespace Tnb.EquipMgr private async Task Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput) { - string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : ""; + string? qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : ""; if (!string.IsNullOrEmpty(qrcode) && await _db.Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id)) { throw Oops.Bah("二维码总表中已存在该二维码"); @@ -92,13 +92,13 @@ namespace Tnb.EquipMgr { if (await _db.Queryable().AnyAsync(x => x.source_id == id)) { - await _db.Updateable() + _ = await _db.Updateable() .SetColumns(x => x.code == visualDevModelDataUpInput.data["qrcode"].ToString()).Where(x => x.source_id == id) .ExecuteCommandAsync(); } else { - BasQrcode basQrcode = new BasQrcode() + BasQrcode basQrcode = new() { code = visualDevModelDataUpInput.data["qrcode"].ToString(), source_id = id, @@ -107,7 +107,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _db.Insertable(basQrcode).ExecuteCommandAsync(); + _ = await _db.Insertable(basQrcode).ExecuteCommandAsync(); } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs index dfe67409..3769e54e 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs @@ -32,11 +32,11 @@ namespace Tnb.EquipMgr [HttpGet("{itemGroupId}")] public async Task GetMaintianItemListByGroupId(string itemGroupId) { - var list = new List(); - var itemIds = await _db.Queryable().Where(it => it.item_group_id == itemGroupId).Select(it => it.item_id).ToListAsync(); + List list = new(); + List itemIds = await _db.Queryable().Where(it => it.item_group_id == itemGroupId).Select(it => it.item_id).ToListAsync(); if (itemIds?.Count > 0) { - var items = await _db.Queryable().Where(it => itemIds.Contains(it.id)).ToListAsync(); + List items = await _db.Queryable().Where(it => itemIds.Contains(it.id)).ToListAsync(); list = items.Adapt>(); } return list; @@ -49,11 +49,11 @@ namespace Tnb.EquipMgr [HttpGet("{itemGroupId}")] public async Task GetMoldListByGroupId(string itemGroupId) { - var list = new List(); - var moldIds = await _db.Queryable().Where(it => it.item_group_id == itemGroupId).Select(it => it.mold_id).ToListAsync(); + List list = new(); + List moldIds = await _db.Queryable().Where(it => it.item_group_id == itemGroupId).Select(it => it.mold_id).ToListAsync(); if (moldIds?.Count > 0) { - var items = await _db.Queryable().Where(it => moldIds.Contains(it.id)).ToListAsync(); + List items = await _db.Queryable().Where(it => moldIds.Contains(it.id)).ToListAsync(); list = items.Adapt>(); } return list; @@ -107,9 +107,9 @@ namespace Tnb.EquipMgr #endregion - private async Task Delete(Expression> deleteExp) where T : BaseEntity, new() + private new async Task Delete(Expression> deleteExp) where T : BaseEntity, new() { - await _db.Deleteable().Where(deleteExp).ExecuteCommandAsync(); + _ = await _db.Deleteable().Where(deleteExp).ExecuteCommandAsync(); } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs index 5f137ba9..486efce8 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainPlanService.cs @@ -30,8 +30,8 @@ namespace Tnb.EquipMgr private readonly IToolMoldsService _moldService; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - private static Dictionary _dicHouse = new Dictionary(); - private static Dictionary _dicLocation = new Dictionary(); + private static Dictionary _dicHouse = new(); + private static Dictionary _dicLocation = new(); public ToolMoldMaintainPlanService( ISqlSugarRepository repository, @@ -75,7 +75,7 @@ namespace Tnb.EquipMgr [HttpGet] public async Task GetMoldListByPlanId([FromRoute] string planId) { - var result = new List(); + List result = new(); if (_dicHouse.Count < 1) { _dicHouse = await _moldHouseService.GetHouseDictionary(); @@ -84,13 +84,13 @@ namespace Tnb.EquipMgr { _dicLocation = await _moldLocationService.GetLocationDictionary(); } - var list = await _db.Queryable().Where(it => it.maintain_plan_id == planId).ToListAsync(); + List list = await _db.Queryable().Where(it => it.maintain_plan_id == planId).ToListAsync(); if (list?.Count > 0) { - var ids = list.Select(it => it.mold_id).Distinct().ToList(); + List ids = list.Select(it => it.mold_id).Distinct().ToList(); if (ids?.Count > 0) { - var items = await _moldService.GetListByIds(ids); + List items = await _moldService.GetListByIds(ids); _db.ThenMapper(items, it => { if (!it.warehosue_id!.IsNullOrEmpty()) @@ -114,16 +114,21 @@ namespace Tnb.EquipMgr /// /// [HttpPost] - public async Task RelevanceMoldFromPlan(RelevanceMoldFromPlanInput input) => + public async Task RelevanceMoldFromPlan(RelevanceMoldFromPlanInput input) + { await Relevance(input, nameof(ToolMoldMaintainPlanRelation.maintain_plan_id), nameof(ToolMoldMaintainPlanRelation.mold_id), it => it.maintain_plan_id == input.id); + } + /// /// 删除计划与模具关联关系 /// /// 输入参数 /// [HttpPost] - public async Task DeleteMold(RelevanceMoldFromPlanInput input) => + public async Task DeleteMold(RelevanceMoldFromPlanInput input) + { await Delete(it => it.maintain_plan_id == input.id && input.ids.Contains(it.mold_id)); + } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs index a1be51ba..33d3de12 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRuleService.cs @@ -38,6 +38,8 @@ namespace Tnb.EquipMgr private readonly IVisualDevService _visualDevService; private readonly IRunService _runService; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + + [Obsolete] public ToolMoldMaintainRuleService(ISqlSugarRepository repository, IUserManager userManager, IDictionaryDataService dictionaryDataService, TimeTaskService timeTaskService, IVisualDevService visualDevService, IRunService runService) { _db = repository.AsSugarClient(); @@ -49,35 +51,41 @@ namespace Tnb.EquipMgr OverideFuncs.DeleteAsync = Delete; OverideFuncs.CreateAsync = Create; } + + [Obsolete] private async Task Create(VisualDevModelDataCrInput input) { int cycle = int.Parse(input.data["cycle"].ToString()!); - var startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddMilliseconds(long.Parse(input.data["startandend_date"].ToString()!)); - ToolMoldMaintainRule toolMoldMaintainRule = new ToolMoldMaintainRule(); - toolMoldMaintainRule.id = SnowflakeIdHelper.NextId(); - toolMoldMaintainRule.mode = input.data["mode"].ToString(); - toolMoldMaintainRule.cycle = cycle; - toolMoldMaintainRule.startandend_date = startTime.ToString("yyyy-MM-dd HH:mm:ss"); - toolMoldMaintainRule.create_id = _userManager.UserId; - toolMoldMaintainRule.create_time = DateTime.Now; - await _db.Insertable(toolMoldMaintainRule).ExecuteCommandAsync(); + DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1)).AddMilliseconds(long.Parse(input.data["startandend_date"].ToString()!)); + ToolMoldMaintainRule toolMoldMaintainRule = new() + { + id = SnowflakeIdHelper.NextId(), + mode = input.data["mode"].ToString(), + cycle = cycle, + startandend_date = startTime.ToString("yyyy-MM-dd HH:mm:ss"), + create_id = _userManager.UserId, + create_time = DateTime.Now + }; + _ = await _db.Insertable(toolMoldMaintainRule).ExecuteCommandAsync(); if (toolMoldMaintainRule.mode == "27118635748885") { string id = toolMoldMaintainRule.id; - var comtentModel = new ContentModel(); - comtentModel.cron = "0 0 9 " + startTime.Day + "/" + toolMoldMaintainRule.cycle + " * ?"; - comtentModel.interfaceId = ""; - comtentModel.interfaceName = ""; - comtentModel.parameter = new List(); + ContentModel comtentModel = new() + { + cron = "0 0 9 " + startTime.Day + "/" + toolMoldMaintainRule.cycle + " * ?", + interfaceId = "", + interfaceName = "", + parameter = new List() + }; comtentModel.parameter!.Add(new InterfaceParameter() { field = "id", value = id, defaultValue = "" }); comtentModel.localHostTaskId = "MoldMaintainTask/CreateTask"; - DateTimeOffset dateTimeOffset = new DateTimeOffset(startTime); + DateTimeOffset dateTimeOffset = new(startTime); comtentModel.startTime = dateTimeOffset.ToUnixTimeMilliseconds(); comtentModel.TenantId = _userManager?.TenantId!; comtentModel.TenantDbName = _userManager?.TenantDbName!; comtentModel.ConnectionConfig = _userManager?.ConnectionConfig!; comtentModel.Token = _userManager?.ToKen!; - TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() + TimeTaskCrInput timeTaskCrInput = new() { enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), fullName = "生成模具保养任务" + id, @@ -94,12 +102,12 @@ namespace Tnb.EquipMgr } private async Task Delete(string id) { - var ToolMoldMaintainRule = await _db.Queryable().Where(p => p.id == id).FirstAsync(); - var ToolMoldMaintainRuleRelations = await _db.Queryable().Where(p => p.rule_id == id).ToListAsync(); + ToolMoldMaintainRule ToolMoldMaintainRule = await _db.Queryable().Where(p => p.id == id).FirstAsync(); + List ToolMoldMaintainRuleRelations = await _db.Queryable().Where(p => p.rule_id == id).ToListAsync(); await _timeTaskService.DeleteByName("生成模具保养任务" + id); await _db.Ado.BeginTranAsync(); - await _db.Deleteable(ToolMoldMaintainRule).ExecuteCommandAsync(); - await _db.Deleteable(ToolMoldMaintainRuleRelations).ExecuteCommandAsync(); + _ = await _db.Deleteable(ToolMoldMaintainRule).ExecuteCommandAsync(); + _ = await _db.Deleteable(ToolMoldMaintainRuleRelations).ExecuteCommandAsync(); await _db.Ado.CommitTranAsync(); } /// @@ -110,11 +118,11 @@ namespace Tnb.EquipMgr [HttpGet] public async Task GetListById([FromRoute] string ruleId) { - var result = new List(); - var list = await _db.Queryable().Where(it => it.rule_id == ruleId).ToListAsync(); + List result = new(); + List list = await _db.Queryable().Where(it => it.rule_id == ruleId).ToListAsync(); if (list?.Count > 0) { - var ids = list.Select(it => it.mold_id).ToList(); + List ids = list.Select(it => it.mold_id).ToList(); result = await _db.Queryable().Where(it => ids.Contains(it.id)) .Select(it => new MaintainRuleMoldListOutput { mold_id = it.id, item_group_id = list.First().item_group_id }, true) .Mapper @@ -138,7 +146,7 @@ namespace Tnb.EquipMgr }, true) .Mapper(it => { - var itemGroupIds = _db.Queryable().Where(x => x.mold_id == it.mold_id).Select(x => x.item_group_id).Distinct().ToList(); + List itemGroupIds = _db.Queryable().Where(x => x.mold_id == it.mold_id).Select(x => x.item_group_id).Distinct().ToList(); it.groupItems = _db.Queryable().Where(x => itemGroupIds.Contains(x.id)).Select(x => new MaintainItemGroupItem { item_group_id = x.id, name = x.name }).ToList(); }) .ToListAsync(); @@ -154,23 +162,32 @@ namespace Tnb.EquipMgr [HttpPost] public async Task RelevanceMold(RelevanceMoldInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - await _db.Deleteable().Where(it => it.rule_id == input.rule_id).ExecuteCommandAsync(); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + _ = await _db.Deleteable().Where(it => it.rule_id == input.rule_id).ExecuteCommandAsync(); if (input.rowIds?.Count > 0) { List entities = new(); - foreach (var item in input.rowIds) + foreach (RowIdItem item in input.rowIds) { - ToolMoldMaintainRuleRelation entity = new(); - entity.id = SnowflakeIdHelper.NextId(); - entity.rule_id = input.rule_id; - entity.mold_id = item.mold_id; - entity.item_group_id = item.group_id; + ToolMoldMaintainRuleRelation entity = new() + { + id = SnowflakeIdHelper.NextId(), + rule_id = input.rule_id, + mold_id = item.mold_id, + item_group_id = item.group_id + }; entities.Add(entity); } - var row = await _db.Insertable(entities).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1000); + int row = await _db.Insertable(entities).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1000); + } } } /// @@ -183,8 +200,11 @@ namespace Tnb.EquipMgr { if (input.ids?.Count > 0) { - var row = await _db.Deleteable().Where(it => it.rule_id == input.rule_id && input.ids.Contains(it.mold_id)).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1002); + int row = await _db.Deleteable().Where(it => it.rule_id == input.rule_id && input.ids.Contains(it.mold_id)).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1002); + } } } /// @@ -194,41 +214,48 @@ namespace Tnb.EquipMgr [HttpPost] public async Task GenMaintainPlan(MaintainPlanCrInput input) { - if (input == null) throw new ArgumentNullException("input"); + if (input == null) + { + throw new ArgumentNullException("input"); + } try { await _db.Ado.BeginTranAsync(); - var maintainRules = await _db.Queryable().Where(it => input.ruleIds.Contains(it.id)).ToListAsync(); - var ruleMoldRelations = await _db.Queryable().Where(it => input.ruleIds.Contains(it.rule_id)).ToListAsync(); + List maintainRules = await _db.Queryable().Where(it => input.ruleIds.Contains(it.id)).ToListAsync(); + List ruleMoldRelations = await _db.Queryable().Where(it => input.ruleIds.Contains(it.rule_id)).ToListAsync(); if (ruleMoldRelations?.Count > 0) { List maintainPlans = new(); List maintainPlanRelations = new(); - foreach (var mrr in ruleMoldRelations) + foreach (ToolMoldMaintainRuleRelation mrr in ruleMoldRelations) { - var rule = await _db.Queryable().FirstAsync(it => it.id == mrr.rule_id); + ToolMoldMaintainRule rule = await _db.Queryable().FirstAsync(it => it.id == mrr.rule_id); if (rule != null && rule.cycle.HasValue && rule.cycle.Value > 0) { - ToolMoldMaintainPlan maintainPlan = new(); - maintainPlan.plan_code = $"JHDM{DateTime.Now:yyyyMMddmmss}"; - maintainPlan.mode = rule.mode; - maintainPlan.status = DictConst.UnMaintainStatusCode; - maintainPlan.plan_start_date = DateTime.Now; - maintainPlan.plan_end_date = DateTime.Now.AddDays(rule.cycle.Value); - maintainPlan.create_id = _userManager.UserId; - maintainPlan.create_time = DateTime.Now; + ToolMoldMaintainPlan maintainPlan = new() + { + plan_code = $"JHDM{DateTime.Now:yyyyMMddmmss}", + mode = rule.mode, + status = DictConst.UnMaintainStatusCode, + plan_start_date = DateTime.Now, + plan_end_date = DateTime.Now.AddDays(rule.cycle.Value), + create_id = _userManager.UserId, + create_time = DateTime.Now + }; maintainPlans.Add(maintainPlan); - ToolMoldMaintainPlanRelation maintainPlanReation = new(); - maintainPlanReation.maintain_plan_id = maintainPlan.id; - maintainPlanReation.mold_id = mrr.mold_id; + ToolMoldMaintainPlanRelation maintainPlanReation = new() + { + maintain_plan_id = maintainPlan.id, + mold_id = mrr.mold_id + }; maintainPlanRelations.Add(maintainPlanReation); } } - await _db.Insertable(maintainPlans).ExecuteCommandAsync(); - await _db.Insertable(maintainPlanRelations).ExecuteCommandAsync(); + _ = await _db.Insertable(maintainPlans).ExecuteCommandAsync(); + _ = await _db.Insertable(maintainPlanRelations).ExecuteCommandAsync(); await _db.Ado.CommitTranAsync(); } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs index f7de66d7..2ada52bb 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs @@ -55,17 +55,17 @@ namespace Tnb.EquipMgr .Where(a => a.maintain_plan_id == planId) .Select((a, b, c, d) => new { - mold_id = a.mold_id, - plan_start_time = d.plan_start_time, - designer = d.designer + a.mold_id, + d.plan_start_time, + d.designer }) .ToListAsync(); - var moldids = planMoldRelations.Select(x => x.mold_id).ToList(); - var molds = await _db.Queryable().Where(it => moldids.Contains(it.id)).ToListAsync(); + List moldids = planMoldRelations.Select(x => x.mold_id).ToList(); + List molds = await _db.Queryable().Where(it => moldids.Contains(it.id)).ToListAsync(); foreach (var planMoldRelation in planMoldRelations) { - var mold = molds.Where(p => p.id == planMoldRelation.mold_id).FirstOrDefault(); + ToolMolds? mold = molds.Where(p => p.id == planMoldRelation.mold_id).FirstOrDefault(); if (mold != null) { dynamic info = new ExpandoObject(); @@ -74,12 +74,12 @@ namespace Tnb.EquipMgr info.mold_name = mold.mold_name; info.mold_status = (await _dictionaryDataService.GetInfo(mold.mold_status!))?.FullName; info.maintain_qty = mold.maintain_qty; - info.designer = planMoldRelation.designer == null ? "" : planMoldRelation.designer; + info.designer = planMoldRelation.designer ?? ""; info.plan_start_time = planMoldRelation.plan_start_time == null ? "" : ((DateTime)planMoldRelation.plan_start_time).ToString("yyyy-MM-dd"); - var moldEqpRelation = await _db.Queryable().FirstAsync(it => it.mold_id == mold.id); + ToolMoldsEquipment moldEqpRelation = await _db.Queryable().FirstAsync(it => it.mold_id == mold.id); if (moldEqpRelation != null) { - var eqp = await _db.Queryable().FirstAsync(it => it.id == moldEqpRelation.equipment_id); + EqpEquipment eqp = await _db.Queryable().FirstAsync(it => it.id == moldEqpRelation.equipment_id); info.eqp_code = eqp.code; info.eqp_name = eqp.name; } @@ -92,19 +92,21 @@ namespace Tnb.EquipMgr [HttpGet] public async Task GetMaintainInfo([FromQuery] MaintainInfoQueryinput input) { - Dictionary dicstatus = new Dictionary(); - dicstatus.Add("UnMaintain", "待保养"); - dicstatus.Add("Completed", "已完成"); + Dictionary dicstatus = new() + { + { "UnMaintain", "待保养" }, + { "Completed", "已完成" } + }; List result = new(); - var plans = await _db.Queryable().ToListAsync(); - var ToolMolds = await _db.Queryable().ToListAsync(); - var ToolMoldsEquipments = await _db.Queryable().ToListAsync(); - var EqpEquipments = await _db.Queryable().ToListAsync(); - var dic = await _db.Queryable().Where(p => p.DictionaryTypeId == "26149299883285").ToListAsync(); - var users = await _db.Queryable().ToListAsync(); - var records = _db.Queryable().ToList(); - var runrecords = _db.Queryable().ToList(); - foreach (var plan in plans) + List plans = await _db.Queryable().ToListAsync(); + List ToolMolds = await _db.Queryable().ToListAsync(); + List ToolMoldsEquipments = await _db.Queryable().ToListAsync(); + List EqpEquipments = await _db.Queryable().ToListAsync(); + List dic = await _db.Queryable().Where(p => p.DictionaryTypeId == "26149299883285").ToListAsync(); + List users = await _db.Queryable().ToListAsync(); + List records = _db.Queryable().ToList(); + List runrecords = _db.Queryable().ToList(); + foreach (ToolMoldMaintainPlan plan in plans) { var planMoldRelations = await _db.Queryable() .LeftJoin((a, b) => a.maintain_plan_id == b.id) @@ -112,25 +114,27 @@ namespace Tnb.EquipMgr .Where(a => a.maintain_plan_id == plan.id) .Select((a, b, c) => new { - mold_id = a.mold_id, - plan_start_time = c.plan_start_time, + a.mold_id, + c.plan_start_time, }).ToListAsync(); if (planMoldRelations?.Count > 0) { - var mids = planMoldRelations.Select(x => x.mold_id).ToList(); - var molds = ToolMolds.Where(it => mids.Contains(it.id)) + List mids = planMoldRelations.Select(x => x.mold_id).ToList(); + List molds = ToolMolds.Where(it => mids.Contains(it.id)) .WhereIF(!string.IsNullOrEmpty(input.keyword), p => p.mold_code!.Contains(input.keyword!) || p.mold_name!.Contains(input.keyword!)) .ToList(); if (molds?.Count > 0) { for (int i = 0, cnt = molds.Count; i < cnt; i++) { - var mold = molds[i]; + ToolMolds mold = molds[i]; if (!string.IsNullOrEmpty(input.status)) { - var moldstatus = records.Where(p => p.mold_id == mold.id && p.plan_id == plan.id).Any() ? "已完成" : "待保养"; + string moldstatus = records.Where(p => p.mold_id == mold.id && p.plan_id == plan.id).Any() ? "已完成" : "待保养"; if (input.status != moldstatus) + { continue; + } } dynamic info = new ExpandoObject(); info.mold_id = mold.id; @@ -146,13 +150,13 @@ namespace Tnb.EquipMgr info.starttime = ""; if (runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).Any()) { - var run = runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).First(); + ToolMoldMaintainRunRecord run = runrecords.Where(p => p.mold_code == mold.mold_code && p.plan_code == plan.plan_code).First(); info.starttime = run.plan_start_time != null ? ((DateTime)run.plan_start_time).ToString("yyyy-MM-dd") : ""; } - var moldEqpRelation = ToolMoldsEquipments.Where(it => it.mold_id == mold.id).FirstOrDefault(); + ToolMoldsEquipment? moldEqpRelation = ToolMoldsEquipments.Where(it => it.mold_id == mold.id).FirstOrDefault(); if (moldEqpRelation != null) { - var eqp = EqpEquipments.Where(it => it.id == moldEqpRelation.equipment_id).FirstOrDefault(); + EqpEquipment? eqp = EqpEquipments.Where(it => it.id == moldEqpRelation.equipment_id).FirstOrDefault(); if (eqp != null) { info.eqp_code = eqp.code; @@ -167,9 +171,14 @@ namespace Tnb.EquipMgr if (!string.IsNullOrEmpty(input.sort)) { if (input.sort == "createtime") + { result = result.OrderByDescending(p => p.createtime).ToList(); + } + if (input.sort == "plan_start_time") - result = result.OrderByDescending(p => p.plan_start_time).ToList(); ; + { + result = result.OrderByDescending(p => p.plan_start_time).ToList(); + }; } return result; } @@ -188,8 +197,8 @@ namespace Tnb.EquipMgr { input.sidx = "b." + input.sidx; } - var records = await _db.Queryable().Select(p => p.plan_id + p.mold_id).ToListAsync(); - var result = await _db.Queryable() + List records = await _db.Queryable().Select(p => p.plan_id + p.mold_id).ToListAsync(); + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.maintain_plan_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => b.plan_code == d.plan_code && c.mold_code == d.mold_code) @@ -214,7 +223,7 @@ namespace Tnb.EquipMgr createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS), plan_start_time = b.plan_start_date == null ? "" : b.plan_start_date.Value.ToString(DbTimeFormat.SS), starttime = d.plan_start_time == null ? "" : d.plan_start_time.Value.ToString(DbTimeFormat.SS), - }).OrderBy($"{input.sidx} {input.sort}").ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50)); + }).OrderBy($"{input.sidx} {input.sort}").ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } @@ -244,8 +253,12 @@ namespace Tnb.EquipMgr [HttpGet] public async Task GetCheckItemAndGrpByMoldId([FromQuery] CheckItemQueryinput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var items = await _db.Queryable() + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + List? items = await _db.Queryable() .InnerJoin((a, b) => a.mold_id == b.mold_id) .InnerJoin((a, b, c) => b.item_group_id == c.item_group_id) .InnerJoin((a, b, c, d) => c.item_group_id == d.id) @@ -262,22 +275,25 @@ namespace Tnb.EquipMgr }) .ToListAsync(); //新增功能 - var ToolMoldMaintainPlanRelation = _db.Queryable().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id && !string.IsNullOrEmpty(a.group_id)).First(); + ToolMoldMaintainPlanRelation ToolMoldMaintainPlanRelation = _db.Queryable().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id && !string.IsNullOrEmpty(a.group_id)).First(); if (ToolMoldMaintainPlanRelation != null) + { items = items.Where(a => a.item_group_id == ToolMoldMaintainPlanRelation.group_id).ToList(); + } + var checkItems = await _db.Queryable().Where(it => it.plan_id == input.plan_id && it.mold_id == input.mold_id).Select(it => new { - plan_id = it.plan_id, - item_id = it.item_id, - item_group_id = it.item_group_id, - mold_id = it.mold_id, + it.plan_id, + it.item_id, + it.item_group_id, + it.mold_id, }).ToListAsync(); var dicCheckItems = checkItems.GroupBy(g => $"{g.plan_id}{g.mold_id}{g.item_group_id}{g.item_id}").ToDictionary(x => x.Key, x => x.FirstOrDefault()); if (items?.Count > 0 && checkItems?.Count > 0) { - foreach (var item in items) + foreach (CheckItemOutput? item in items) { - var key = $"{item.plan_id}{item.mold_id}{item.item_group_id}{item.item_id}"; + string key = $"{item.plan_id}{item.mold_id}{item.item_group_id}{item.item_id}"; if (dicCheckItems.ContainsKey(key) && dicCheckItems[key] != null) { item.status = 1; @@ -300,8 +316,12 @@ namespace Tnb.EquipMgr [HttpPost] public async Task MaintainStart(MoldMaintainRunUpInput input) { - if (input == null) throw new ArgumentNullException("input"); - var flag = _db.Queryable() + if (input == null) + { + throw new ArgumentNullException("input"); + } + + bool flag = _db.Queryable() .LeftJoin((a, b) => a.plan_code == b.plan_code) .LeftJoin((a, b, c) => a.mold_code == c.mold_code) .Where((a, b, c) => b.id == input.plan_id && c.id == input.mold_id).Any(); @@ -313,33 +333,41 @@ namespace Tnb.EquipMgr { await _db.Ado.BeginTranAsync(); - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.MaintainStatusTypeId); - var mold = await _db.Queryable().FirstAsync(it => it.id == input.mold_id); + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.MaintainStatusTypeId); + ToolMolds mold = await _db.Queryable().FirstAsync(it => it.id == input.mold_id); if (mold != null) { mold.mold_status = MoldUseStatus.MOLD_USE_STATUS_MAINTAIN_ID; - var isOk = await _db.Updateable(mold).Where(it => it.id == input.mold_id).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); - var plan = await _db.Queryable().LeftJoin((a, b) => a.maintain_plan_id == b.id) + bool isOk = await _db.Updateable(mold).Where(it => it.id == input.mold_id).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } + + ToolMoldMaintainPlan? plan = await _db.Queryable().LeftJoin((a, b) => a.maintain_plan_id == b.id) .Where(a => a.mold_id == input.mold_id && a.maintain_plan_id == input.plan_id).Select((a, b) => b).FirstAsync(); if (plan is not null) { //插入保养计划记录 - ToolMoldMaintainRunRecord record = new(); - record.plan_code = plan.plan_code; - record.mode = plan.mode; - record.plan_status = dic.ContainsKey(plan.plan_code) ? dic[plan.plan_code].ToString() : ""; - record.designer = _userManager.RealName; - record.designer_time = DateTime.Now; - record.mold_code = mold.mold_code; - record.mold_name = mold.mold_name; - record.plan_start_time = string.IsNullOrEmpty(input.starttime) ? DateTime.Now : DateTime.Parse(input.starttime); - var row = await _db.Insertable(record).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + ToolMoldMaintainRunRecord record = new() + { + plan_code = plan.plan_code, + mode = plan.mode, + plan_status = dic.ContainsKey(plan.plan_code) ? dic[plan.plan_code].ToString() : "", + designer = _userManager.RealName, + designer_time = DateTime.Now, + mold_code = mold.mold_code, + mold_name = mold.mold_name, + plan_start_time = string.IsNullOrEmpty(input.starttime) ? DateTime.Now : DateTime.Parse(input.starttime) + }; + int row = await _db.Insertable(record).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } - - var groupids = _db.Queryable().Where(a => !string.IsNullOrEmpty(a.group_id) && a.mold_id == input.mold_id && a.maintain_plan_id == input.plan_id).ToList().Select(p => p.group_id); + IEnumerable groupids = _db.Queryable().Where(a => !string.IsNullOrEmpty(a.group_id) && a.mold_id == input.mold_id && a.maintain_plan_id == input.plan_id).ToList().Select(p => p.group_id); /* var maintainInfos = await _db.Queryable() @@ -374,16 +402,21 @@ namespace Tnb.EquipMgr List recordDs = new(); foreach (var info in maintainInfos) { - ToolMoldMaintainRunRecordD record_d = new(); - record_d.mainid = record.id; - record_d.group_id = info.group_id; - record_d.group_name = info.group_name; - record_d.check_item_id = info.check_item_id; - record_d.check_item_name = info.check_item_name; + ToolMoldMaintainRunRecordD record_d = new() + { + mainid = record.id, + group_id = info.group_id, + group_name = info.group_name, + check_item_id = info.check_item_id, + check_item_name = info.check_item_name + }; recordDs.Add(record_d); } row = await _db.Insertable(recordDs).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } @@ -405,47 +438,71 @@ namespace Tnb.EquipMgr [HttpPost] public async Task FinishMaintain(MoldMaintainRunUpInput input) { - if (input == null) throw new ArgumentNullException("input"); - if (input.items == null || input.items.Count == 0) throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty"); - List records = new(); - foreach (var item in input.items) + if (input == null) { - ToolMoldMaintainItemRecord record = new(); - record.plan_id = input.plan_id; - record.mold_id = input.mold_id; - record.item_group_id = item.item_group_id; - record.item_id = item.item_id; - record.status = 1; - record.result = item.result; + throw new ArgumentNullException("input"); + } + + if (input.items == null || input.items.Count == 0) + { + throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty"); + } + + List records = new(); + foreach (MaintainItemInfo item in input.items) + { + ToolMoldMaintainItemRecord record = new() + { + plan_id = input.plan_id, + mold_id = input.mold_id, + item_group_id = item.item_group_id, + item_id = item.item_id, + status = 1, + result = item.result + }; records.Add(record); } - await _db.Insertable(records).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLD_USE_STATUS_ZK_ID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync(); - var count = await _db.Queryable().Where(p => p.maintain_plan_id == input.plan_id).Select(p => p.mold_id).Distinct().CountAsync(); - var finish = await _db.Queryable().Where(p => p.plan_id == input.plan_id).Select(p => p.mold_id).Distinct().CountAsync(); + _ = await _db.Insertable(records).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLD_USE_STATUS_ZK_ID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync(); + int count = await _db.Queryable().Where(p => p.maintain_plan_id == input.plan_id).Select(p => p.mold_id).Distinct().CountAsync(); + int finish = await _db.Queryable().Where(p => p.plan_id == input.plan_id).Select(p => p.mold_id).Distinct().CountAsync(); if (count == finish) - await _db.Updateable().SetColumns(it => new ToolMoldMaintainPlan { status = MoldPlanMaintainStatus.MOLDPLAN_MAINTAIN_STATUS_COMPLETED_CODE }).Where(it => it.id == input.plan_id).ExecuteCommandAsync(); - + { + _ = await _db.Updateable().SetColumns(it => new ToolMoldMaintainPlan { status = MoldPlanMaintainStatus.MOLDPLAN_MAINTAIN_STATUS_COMPLETED_CODE }).Where(it => it.id == input.plan_id).ExecuteCommandAsync(); + } } [HttpPost] public async Task MaintainItemFinish(MoldMaintainRunUpInput input) { - if (input == null) throw new ArgumentNullException("input"); - if (input.items == null || input.items.Count == 0) throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty"); - List records = new(); - foreach (var item in input.items) + if (input == null) { - ToolMoldMaintainItemRecord record = new(); - record.plan_id = input.plan_id; - record.mold_id = input.mold_id; - record.item_group_id = item.item_group_id; - record.item_id = item.item_id; - record.status = 1; + throw new ArgumentNullException("input"); + } + + if (input.items == null || input.items.Count == 0) + { + throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty"); + } + + List records = new(); + foreach (MaintainItemInfo item in input.items) + { + ToolMoldMaintainItemRecord record = new() + { + plan_id = input.plan_id, + mold_id = input.mold_id, + item_group_id = item.item_group_id, + item_id = item.item_id, + status = 1 + }; records.Add(record); } - var row = await _db.Insertable(records).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + int row = await _db.Insertable(records).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } /// @@ -456,7 +513,7 @@ namespace Tnb.EquipMgr [HttpPost] public async Task MaintainFinish(MoldMaintainRunUpInput input) { - var items = await _db.Queryable() + List? items = await _db.Queryable() .InnerJoin((a, b) => a.mold_id == b.mold_id) .InnerJoin((a, b, c) => b.item_group_id == c.item_group_id) .InnerJoin((a, b, c, d) => c.item_group_id == d.id) @@ -473,28 +530,30 @@ namespace Tnb.EquipMgr }) .ToListAsync(); //新增功能 - var ToolMoldMaintainPlanRelation = _db.Queryable().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id && !string.IsNullOrEmpty(a.group_id)).First(); + ToolMoldMaintainPlanRelation ToolMoldMaintainPlanRelation = _db.Queryable().Where((a) => a.maintain_plan_id == input.plan_id && a.mold_id == input.mold_id && !string.IsNullOrEmpty(a.group_id)).First(); if (ToolMoldMaintainPlanRelation != null) + { items = items.Where(a => a.item_group_id == ToolMoldMaintainPlanRelation.group_id).ToList(); + } var checkItems = await _db.Queryable().Where(it => it.plan_id == input.plan_id && it.mold_id == input.mold_id).Select(it => new { - plan_id = it.plan_id, - item_id = it.item_id, - item_group_id = it.item_group_id, - mold_id = it.mold_id, + it.plan_id, + it.item_id, + it.item_group_id, + it.mold_id, }).ToListAsync(); var dicCheckItems = checkItems.GroupBy(g => $"{g.plan_id}{g.mold_id}{g.item_group_id}{g.item_id}").ToDictionary(x => x.Key, x => x.FirstOrDefault()); - var maintainedItems = items.Where(it => dicCheckItems.ContainsKey($"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}") && dicCheckItems[$"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}"] != null).ToList(); - if ((items?.Count > 0 && maintainedItems?.Count > 0) || (maintainedItems == null || maintainedItems.Count < 1)) + List? maintainedItems = items.Where(it => dicCheckItems.ContainsKey($"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}") && dicCheckItems[$"{it.plan_id}{it.mold_id}{it.item_group_id}{it.item_id}"] != null).ToList(); + if ((items?.Count > 0 && maintainedItems?.Count > 0) || maintainedItems == null || maintainedItems.Count < 1) { - if (maintainedItems.Count < items.Count || (maintainedItems == null || maintainedItems.Count < 1)) + if (maintainedItems.Count < items.Count || maintainedItems == null || maintainedItems.Count < 1) { throw new AppFriendlyException("当前模具有未完成的保养项目", 500); } } - var row = await _db.Updateable().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLD_USE_STATUS_ZK_ID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync(); - var allMoldStatus = await _db.Queryable().InnerJoin((a, b) => a.mold_id == b.id) + int row = await _db.Updateable().SetColumns(it => new ToolMolds { mold_status = MoldUseStatus.MOLD_USE_STATUS_ZK_ID }).Where(it => it.id == input.mold_id).ExecuteCommandAsync(); + List allMoldStatus = await _db.Queryable().InnerJoin((a, b) => a.mold_id == b.id) .Where((a, b) => a.maintain_plan_id == input.plan_id) .Select((a, b) => b.mold_status) .ToListAsync(); @@ -502,8 +561,10 @@ namespace Tnb.EquipMgr { row = await _db.Updateable().SetColumns(it => new ToolMoldMaintainPlan { status = MoldPlanMaintainStatus.MOLDPLAN_MAINTAIN_STATUS_COMPLETED_CODE }).Where(it => it.id == input.plan_id).ExecuteCommandAsync(); } - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); - + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs index a1a20167..4979f99f 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs @@ -28,7 +28,7 @@ namespace Tnb.EquipMgr private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; - private static Dictionary _dicMold = new Dictionary(); + private static Dictionary _dicMold = new(); public ToolMoldMaintainTaskService( ISqlSugarRepository repository, IRunService runService, @@ -48,19 +48,19 @@ namespace Tnb.EquipMgr { if (_dicMold.Count < 1) { - var items = await _db.Queryable().ToListAsync(); + List items = await _db.Queryable().ToListAsync(); _dicMold = items?.ToDictionary(x => x.id, x => (x.mold_code, x.mold_name))!; } VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); - var data = await _runService.GetListResult(templateEntity, input); + JNPF.Common.Filter.PageResult> data = await _runService.GetListResult(templateEntity, input); if (data?.list.Count > 0) { - foreach (var row in data.list) + foreach (Dictionary row in data.list) { - var pair = row[nameof(ToolMoldMaintainTask.mold_id)]; + object pair = row[nameof(ToolMoldMaintainTask.mold_id)]; if (pair.IsNotEmptyOrNull()) { - if (_dicMold.TryGetValue(pair.ToString(), out var multi)) + if (_dicMold.TryGetValue(pair.ToString(), out (string code, string name) multi)) { row[nameof(ToolMoldMaintainTask.mold_id)] = $"{multi.code}/{multi.name}"; } @@ -73,8 +73,11 @@ namespace Tnb.EquipMgr public async Task Create(ToolMoldMaintainTask entity) { - var row = await _db.Insertable(entity).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1000); + int row = await _db.Insertable(entity).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1000); + } } /// /// 修改任务单状态 @@ -90,9 +93,12 @@ namespace Tnb.EquipMgr { endTime = DateTime.Now; } - var row = await _db.Updateable().SetColumns(it => new ToolMoldMaintainTask { status = input.status, modify_strat_time = beginTiem, modify_end_time = endTime }) + int row = await _db.Updateable().SetColumns(it => new ToolMoldMaintainTask { status = input.status, modify_strat_time = beginTiem, modify_end_time = endTime }) .Where(it => input.ids.Contains(it.id)).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs index a129d430..f71ae603 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldRequisitionService.cs @@ -51,29 +51,29 @@ namespace Tnb.EquipMgr private async Task GetList(VisualDevModelListQueryInput input) { - Dictionary? queryJson = new Dictionary(); + Dictionary? queryJson = new(); string? requisitionCode = ""; - DateTime[] requisitionTimeArr = null; - DateTime[] estimatedReturnArr = null; + DateTime[]? requisitionTimeArr = null; + DateTime[]? estimatedReturnArr = null; if (input != null && !string.IsNullOrEmpty(input.queryJson)) { queryJson = JsonConvert.DeserializeObject>(input?.queryJson ?? ""); } - if (queryJson!.TryGetValue("requisition_code", out var value)) + if (queryJson!.TryGetValue("requisition_code", out object? value)) { requisitionCode = value.ToString(); } - if (queryJson!.TryGetValue("requisition_time", out var value1)) + if (queryJson!.TryGetValue("requisition_time", out object? value1)) { requisitionTimeArr = value1.ToObject().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray(); } - if (queryJson!.TryGetValue("estimated_return_time", out var value2)) + if (queryJson!.TryGetValue("estimated_return_time", out object? value2)) { estimatedReturnArr = value2.ToObject().Select(x => DateTimeOffset.FromUnixTimeSeconds(x / 1000).ToLocalTime().DateTime).ToArray(); } - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.mo_task_id == b.id) .LeftJoin((a, b, c) => a.equip_id == c.id) .LeftJoin((a, b, c, d) => a.recipient_id == d.Id) @@ -105,35 +105,38 @@ namespace Tnb.EquipMgr await _runService.Create(templateEntity, input); - await _db.Updateable().SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.SCTypeId) + _ = await _db.Updateable().SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.SCTypeId) .Where(X => X.id == input.data["mold_id"]).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); } [HttpPost] public async Task GetTools(ToolInput toolinput) { - Dictionary dic = new Dictionary(); - dic.Add("26149307089941", "在库"); - dic.Add("26149309121045", "生产"); - dic.Add("26149311082005", "保养"); - dic.Add("26149314425877", "报废"); - dic.Add("26149312750101", "外协"); - dic.Add("26149320818965", "维修"); + Dictionary dic = new() + { + { "26149307089941", "在库" }, + { "26149309121045", "生产" }, + { "26149311082005", "保养" }, + { "26149314425877", "报废" }, + { "26149312750101", "外协" }, + { "26149320818965", "维修" } + }; List result = new(); - var BasLocations = await _db.Queryable().ToListAsync(); - var ToolMolds = await _db.Queryable() + List BasLocations = await _db.Queryable().ToListAsync(); + List ToolMolds = await _db.Queryable() .WhereIF(!string.IsNullOrEmpty(toolinput.keyword), p => p.mold_code!.Contains(toolinput.keyword!) || p.mold_name!.Contains(toolinput.keyword!)) .WhereIF(!string.IsNullOrEmpty(toolinput.status), p => p.mold_status == dic.Where(p => p.Value == toolinput.status).First().Key) .ToListAsync(); if (string.IsNullOrEmpty(toolinput.sort)) { if (toolinput.sort == "mold_code") + { ToolMolds = ToolMolds.OrderByDescending(p => p.mold_code).ToList(); + } } - foreach (var tool in ToolMolds) + foreach (ToolMolds tool in ToolMolds) { dynamic info = new ExpandoObject(); info.id = tool.id; diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs index cbf274e4..2c413d78 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldReturnService.cs @@ -48,23 +48,22 @@ namespace Tnb.EquipMgr string? locationId = ""; - if (input.data.TryGetValue("location_id", out var value)) + if (input.data.TryGetValue("location_id", out object? value)) { locationId = value.ToString(); } - string moldId = input.data.ContainsKey("mold_id") ? input.data["mold_id"].ToString() : ""; + string? moldId = input.data.ContainsKey("mold_id") ? input.data["mold_id"].ToString() : ""; if (!string.IsNullOrEmpty(moldId)) { - await _db.Updateable() + _ = await _db.Updateable() .SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.ZKTypeId) .SetColumnsIF(!string.IsNullOrEmpty(locationId), x => x.location_id == locationId) .Where(X => X.id == moldId).ExecuteCommandAsync(); } }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs index 871b8345..bb2d2b4a 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldsService.cs @@ -41,7 +41,7 @@ namespace Tnb.EquipMgr } private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) { - string qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : ""; + string? qrcode = visualDevModelDataCrInput.data.ContainsKey("qrcode") ? visualDevModelDataCrInput.data["qrcode"].ToString() : ""; if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == qrcode)) { throw Oops.Bah("二维码总表中已存在该二维码"); @@ -55,7 +55,7 @@ namespace Tnb.EquipMgr if (!string.IsNullOrEmpty(qrcode)) { - BasQrcode basQrcode = new BasQrcode() + BasQrcode basQrcode = new() { code = visualDevModelDataCrInput.data["qrcode"].ToString(), source_id = ToolId, @@ -64,7 +64,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); } } return await Task.FromResult(true); @@ -72,7 +72,7 @@ namespace Tnb.EquipMgr private async Task Update(string id, VisualDevModelDataUpInput visualDevModelDataUpInput) { - string qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : ""; + string? qrcode = visualDevModelDataUpInput.data.ContainsKey("qrcode") ? visualDevModelDataUpInput.data["qrcode"].ToString() : ""; if (!string.IsNullOrEmpty(qrcode) && await _repository.AsSugarClient().Queryable().AnyAsync(x => x.code == visualDevModelDataUpInput.data["qrcode"] && x.source_id != id)) { throw Oops.Bah("二维码总表中已存在该二维码"); @@ -86,13 +86,13 @@ namespace Tnb.EquipMgr { if (await _repository.AsSugarClient().Queryable().AnyAsync(x => x.source_id == id)) { - await _repository.AsSugarClient().Updateable() + _ = await _repository.AsSugarClient().Updateable() .SetColumns(x => x.code == visualDevModelDataUpInput.data["qrcode"].ToString()).Where(x => x.source_id == id) .ExecuteCommandAsync(); } else { - BasQrcode basQrcode = new BasQrcode() + BasQrcode basQrcode = new() { code = visualDevModelDataUpInput.data["qrcode"].ToString(), source_id = id, @@ -101,7 +101,7 @@ namespace Tnb.EquipMgr create_time = DateTime.Now, org_id = _userManager.GetUserInfo().Result.organizeId, }; - await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(basQrcode).ExecuteCommandAsync(); } } } @@ -126,8 +126,8 @@ namespace Tnb.EquipMgr [HttpGet] public async Task> GetListByEqpId([FromRoute] string eqpId) { - var db = _repository.AsSugarClient(); - var result = await db.Queryable().InnerJoin((a, b) => a.id == b.mold_id) + ISqlSugarClient db = _repository.AsSugarClient(); + List result = await db.Queryable().InnerJoin((a, b) => a.id == b.mold_id) .Where((a, b) => b.equipment_id == eqpId) .Select((a, b) => a) .ToListAsync(); @@ -137,13 +137,12 @@ namespace Tnb.EquipMgr /// /// 根据模具id获取设备集合 /// - /// /// [HttpPost] public async Task> GetEquipmentLists(ToolMoldInput ToolMoldInput) { - var db = _repository.AsSugarClient(); - var list = await db.Queryable((a, b) => new object[] + ISqlSugarClient db = _repository.AsSugarClient(); + List list = await db.Queryable((a, b) => new object[] { JoinType.Inner, a.id == b.equipment_id, }) @@ -160,50 +159,51 @@ namespace Tnb.EquipMgr /// /// 增加模具设备绑定 /// - /// - /// + /// /// [HttpPost] public async Task SaveData(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var his = await _repository.AsSugarClient().Queryable().ToListAsync(); - var list = new List(); - foreach (var equip in ToolMoldInput.equipid) + List his = await _repository.AsSugarClient().Queryable().ToListAsync(); + List list = new(); + foreach (string equip in ToolMoldInput.equipid) { if (his.Where(p => p.mold_id == ToolMoldInput.mold && p.equipment_id == equip).ToList().Count > 0) + { continue; - var entity = new ToolMoldsEquipment(); - entity.id = SnowflakeIdHelper.NextId(); - entity.mold_id = ToolMoldInput.mold; - entity.equipment_id = equip; - entity.create_time = DateTime.Now; - entity.create_id = _userManager.UserId; + } + + ToolMoldsEquipment entity = new() + { + id = SnowflakeIdHelper.NextId(), + mold_id = ToolMoldInput.mold, + equipment_id = equip, + create_time = DateTime.Now, + create_id = _userManager.UserId + }; list.Add(entity); } - await _repository.AsSugarClient().Insertable(list).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(list).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "保存成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "保存成功" : result.ErrorMessage); } /// /// 批量删除模具设备绑定 /// - /// - /// + /// /// [HttpPost] public async Task DetachData(ToolMoldInput ToolMoldInput) { DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.equipid.Contains(x.equipment_id)).ToList(); - await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync(); + List arr = _repository.AsSugarClient().Queryable().Where(x => x.mold_id == ToolMoldInput.mold && ToolMoldInput.equipid.Contains(x.equipment_id)).ToList(); + _ = await _repository.AsSugarClient().Deleteable(arr).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "操作成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "操作成功" : result.ErrorMessage); } public Task GetListById(string moldId) diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs index 3ed4c7df..2951377d 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs @@ -55,12 +55,12 @@ namespace Tnb.ProductionMgr.APP private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : ""; string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) @@ -107,7 +107,11 @@ namespace Tnb.ProductionMgr.APP public async Task GetLogById(Dictionary dic) { string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : ""; - if (string.IsNullOrEmpty(mo_task_id)) return Array.Empty(); + if (string.IsNullOrEmpty(mo_task_id)) + { + return Array.Empty(); + } + Dictionary statsDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); return await _db.Queryable().Where(x => x.mo_task_id == mo_task_id) .OrderBy(x => x.create_time) diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs index e11e33e9..df0d8c5a 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs @@ -52,12 +52,12 @@ namespace Tnb.ProductionMgr.APP private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : ""; string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) @@ -66,7 +66,7 @@ namespace Tnb.ProductionMgr.APP .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) .Where(a => a.schedule_type == 1) - .Where(a => (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)) + .Where(a => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode) .OrderByDescending(a => a.create_time) .Select((a, b, c, d, e) => new AppPrdMoTaskOneListOutput { diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs index 8af2de3a..cc8b349f 100644 --- a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs @@ -52,12 +52,12 @@ namespace Tnb.ProductionMgr.APP private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : ""; string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) @@ -67,7 +67,7 @@ namespace Tnb.ProductionMgr.APP .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) .Where(a => a.schedule_type == 2) - .Where(a => (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)) + .Where(a => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode) .OrderByDescending(a => a.create_time) .Select((a, b, c, d, e, f) => new AppPrdMoTaskOneListOutput { diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs index 6214667e..2f873ee0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs @@ -34,7 +34,7 @@ namespace Tnb.ProductionMgr { private readonly ISqlSugarClient _db; private readonly IUserManager _userManager; - private SendMessageService _sendMessageService; + private readonly SendMessageService _sendMessageService; private readonly IBasPushRuleLogService _basPushRuleLogService; private readonly TimeTaskService _timeTaskService; @@ -54,7 +54,7 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetAndonPadList(AndonPadListInput input) { - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.andon_info_id == b.id) .LeftJoin((a, b, c) => a.repair_id == c.Id) .LeftJoin((a, b, c, d) => a.create_id == d.Id) @@ -93,7 +93,7 @@ namespace Tnb.ProductionMgr andonRecords.status = DictConst.AndonStatusHJZ; - List toUsers = new List(); + List toUsers = new(); if (!string.IsNullOrEmpty(andonInfo.personnel)) { @@ -116,18 +116,18 @@ namespace Tnb.ProductionMgr { List list = await _sendMessageService.SendTest(andonInfo.send_config_id); - foreach (var item in list) + foreach (MessageSendModel item in list) { item.toUser = toUsers; } - foreach (var item in list) + foreach (MessageSendModel item in list) { - await _sendMessageService.SendMessage(item, new Dictionary()); + _ = await _sendMessageService.SendMessage(item, new Dictionary()); } } - await _db.Insertable(andonRecords).ExecuteCommandAsync(); + _ = await _db.Insertable(andonRecords).ExecuteCommandAsync(); }); @@ -146,25 +146,27 @@ namespace Tnb.ProductionMgr // string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}"; string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?"; - var comtentModel = new ContentModel(); - // comtentModel.cron = (2 * 60).ToString(); - comtentModel.cron = cron; - comtentModel.interfaceId = ""; - comtentModel.interfaceName = ""; - comtentModel.parameter = new List(); - comtentModel.localHostTaskId = "PushMsgTimeWorker/PushMsg"; - comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - // comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString(); - comtentModel.TenantId = _userManager?.TenantId; - comtentModel.TenantDbName = _userManager?.TenantDbName; - comtentModel.ConnectionConfig = _userManager?.ConnectionConfig; - comtentModel.Token = _userManager?.ToKen; + ContentModel comtentModel = new() + { + // comtentModel.cron = (2 * 60).ToString(); + cron = cron, + interfaceId = "", + interfaceName = "", + parameter = new List(), + localHostTaskId = "PushMsgTimeWorker/PushMsg", + startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + // comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString(); + TenantId = _userManager?.TenantId, + TenantDbName = _userManager?.TenantDbName, + ConnectionConfig = _userManager?.ConnectionConfig, + Token = _userManager?.ToKen + }; // foreach (var item in sendModels) // { // } // - TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() + TimeTaskCrInput timeTaskCrInput = new() { enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), fullName = "andon推送消息" + DateTime.Now.ToString("yyyyMMddHHmmss"), @@ -179,7 +181,7 @@ namespace Tnb.ProductionMgr TimeTaskEntity timeTaskEntity = await _db.Queryable().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync(); - BasPushRuleLog basPushRuleLog = new BasPushRuleLog() + BasPushRuleLog basPushRuleLog = new() { push_rule_id = andonInfo.push_rule_id, timetask_id = timeTaskEntity?.Id, @@ -188,14 +190,13 @@ namespace Tnb.ProductionMgr is_push = 1, }; - await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); + _ = await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); } } } - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result.IsSuccess ? "发起成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result.IsSuccess ? "发起成功" : result.ErrorMessage); } [HttpPost] @@ -218,11 +219,11 @@ namespace Tnb.ProductionMgr } else { - await _db.Updateable() + _ = await _db.Updateable() .SetColumns(x => x.repair_id == _userManager.UserId) .SetColumns(x => x.response_time == DateTime.Now) .ExecuteCommandAsync(); - Dictionary postData = new Dictionary() + Dictionary postData = new() { ["id"] = andonRecords.id }; @@ -252,7 +253,7 @@ namespace Tnb.ProductionMgr } else { - await _db.Updateable() + _ = await _db.Updateable() .SetColumns(x => x.start_repair_time == DateTime.Now) .Where(x => x.id == id) .ExecuteCommandAsync(); @@ -279,7 +280,7 @@ namespace Tnb.ProductionMgr } else { - await _db.Updateable() + _ = await _db.Updateable() .SetColumns(x => x.end_repair_time == DateTime.Now) .Where(x => x.id == id) .ExecuteCommandAsync(); @@ -306,7 +307,7 @@ namespace Tnb.ProductionMgr } else { - await _db.Updateable() + _ = await _db.Updateable() .SetColumns(x => x.confirm_time == DateTime.Now) .Where(x => x.id == id) .ExecuteCommandAsync(); @@ -322,7 +323,7 @@ namespace Tnb.ProductionMgr private async Task> GetSendParamJson(string id) { - var list = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) + List list = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) .Where((a, b) => a.SendConfigId == id && a.DeleteMark == null && b.DeleteMark == null) .Select((a, b) => new MessageSendModel { @@ -333,13 +334,12 @@ namespace Tnb.ProductionMgr sendConfigId = a.SendConfigId, templateId = a.TemplateId, }).ToListAsync(); - foreach (var item in list) + foreach (MessageSendModel? item in list) { // 是否存在参数. - var flag = await _db.Queryable().AnyAsync(x => x.TemplateId == item.templateId && x.DeleteMark == null); - if (flag) - { - item.paramJson = await _db.Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id, JoinType.Left, a.TemplateId == c.TemplateId)) + bool flag = await _db.Queryable().AnyAsync(x => x.TemplateId == item.templateId && x.DeleteMark == null); + item.paramJson = flag + ? await _db.Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id, JoinType.Left, a.TemplateId == c.TemplateId)) .Where((a, b, c) => a.TemplateId == item.templateId && a.DeleteMark == null && b.DeleteMark == null && a.Field == c.Field && a.Field != "@flowLink") .Select((a, b) => new MessageSendParam { @@ -350,11 +350,8 @@ namespace Tnb.ProductionMgr templateId = a.TemplateId, templateName = b.FullName, templateType = b.TemplateType - }).ToListAsync(); - } - else - { - item.paramJson = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) + }).ToListAsync() + : await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) .Where((a, b) => a.TemplateId == item.templateId && a.DeleteMark == null && b.DeleteMark == null && a.Field != "@flowLink") .Where((a, b) => b.Title.Contains(a.Field) || b.Content.Contains(a.Field)) .Select((a, b) => new MessageSendParam @@ -367,7 +364,6 @@ namespace Tnb.ProductionMgr templateName = b.FullName, templateType = b.TemplateType }).ToListAsync(); - } } return list; } diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonService.cs index f583a39e..dbb62fbb 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonService.cs @@ -27,21 +27,23 @@ namespace Tnb.ProductionMgr [HttpGet] public async Task GetPrdTask(string stationId) { - Dictionary dic = new Dictionary(); - dic.Add("ToBeStarted", "待开工"); - dic.Add("InProgress", "进行中"); - dic.Add("Closed", "关闭"); - dic.Add("Complated", "完工"); - dic.Add("ToBeScheduled", "待下发"); - dic.Add("Pause", "暂停"); - dic.Add("Exception", "异常"); - dic.Add("Revoke", "撤销"); + Dictionary dic = new() + { + { "ToBeStarted", "待开工" }, + { "InProgress", "进行中" }, + { "Closed", "关闭" }, + { "Complated", "完工" }, + { "ToBeScheduled", "待下发" }, + { "Pause", "暂停" }, + { "Exception", "异常" }, + { "Revoke", "撤销" } + }; List result = new(); - var List = await _db.Queryable() + List List = await _db.Queryable() .WhereIF(!string.IsNullOrEmpty(stationId), p => p.workstation_id == stationId) .ToListAsync(); - var materials = await _db.Queryable().ToListAsync(); - foreach (var data in List) + List materials = await _db.Queryable().ToListAsync(); + foreach (PrdMoTask data in List) { dynamic info = new ExpandoObject(); info.id = data.id; @@ -55,31 +57,33 @@ namespace Tnb.ProductionMgr info.plan_end_date = data.estimated_end_date == null ? "" : ((DateTime)data.estimated_end_date!).ToString("yyyy-MM-dd"); result.Add(info); } - result.OrderByDescending(p => p.plan_start_date); + _ = result.OrderByDescending(p => p.plan_start_date); return result; } [HttpPost] public async Task SaveData(AndonRecordInput AndonRecordInput) { - var list = _db.Queryable().ToList(); - AndonRecords andonRecord = new AndonRecords(); - andonRecord.mo_id = AndonRecordInput.mo_id; - andonRecord.breakdown_type = list.Where(p => p.id == AndonRecordInput.breakdown).Any() ? list.Where(p => p.id == AndonRecordInput.breakdown).First().type_id : ""; - andonRecord.breakdown = AndonRecordInput.breakdown; - andonRecord.create_time = DateTime.Now; - andonRecord.create_id = _userManager.UserId; - await _db.Insertable(andonRecord).ExecuteCommandAsync(); + List list = _db.Queryable().ToList(); + AndonRecords andonRecord = new() + { + mo_id = AndonRecordInput.mo_id, + breakdown_type = list.Where(p => p.id == AndonRecordInput.breakdown).Any() ? list.Where(p => p.id == AndonRecordInput.breakdown).First().type_id : "", + breakdown = AndonRecordInput.breakdown, + create_time = DateTime.Now, + create_id = _userManager.UserId + }; + _ = await _db.Insertable(andonRecord).ExecuteCommandAsync(); } [HttpPost] public async Task GetAndonCascaderOptions() { - Dictionary result = new Dictionary(); + Dictionary result = new(); List andonTypes = await _db.Queryable().ToListAsync(); List andonInfos = await _db.Queryable().ToListAsync(); List andonBreakDowns = await _db.Queryable().ToListAsync(); - List options = new List(); - foreach (var andonType in andonTypes) + List options = new(); + foreach (AndonType andonType in andonTypes) { options.Add(new AndonCascaderOptionsOuput() { diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs index cbbe0e7b..869b1d8a 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdCancelCloseDownService.cs @@ -47,11 +47,11 @@ namespace Tnb.ProductionMgr private readonly IUserManager _userManager; private readonly IBillRullService _billRullService; private readonly TimeTaskService _timeTaskService; - private SendMessageService _sendMessageService; + private readonly SendMessageService _sendMessageService; - private static Dictionary _dicWorkStationAndShopRelacion = new Dictionary(); - private static Dictionary _dicWorkShop = new Dictionary(); + private static readonly Dictionary _dicWorkStationAndShopRelacion = new(); + private static Dictionary _dicWorkShop = new(); private const string PUSHRULEID = "27121606262805";//异常停机的推送规则id @@ -86,16 +86,16 @@ namespace Tnb.ProductionMgr { if (_dicWorkShop.Count < 1) { - var orgs = await _db.Queryable().Where(it => it.Category == "workstation").ToListAsync(); + List orgs = await _db.Queryable().Where(it => it.Category == "workstation").ToListAsync(); if (orgs?.Count > 0) { - var shopIds = orgs.Select(x => + List shopIds = orgs.Select(x => { - var shopId = ""; - var orgTree = x.OrganizeIdTree.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); + string shopId = ""; + string[] orgTree = x.OrganizeIdTree.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (orgTree?.Length > 1) { - shopId = orgTree[orgTree.Length - 2]; + shopId = orgTree[^2]; _dicWorkStationAndShopRelacion[x.EnCode] = shopId; } return shopId; @@ -106,25 +106,28 @@ namespace Tnb.ProductionMgr } } } - var result = new List(); - var closeDown = await _db.Queryable().FirstAsync(it => it.eqp_id == eqpId); + List result = new(); + PrdCancelClosedown closeDown = await _db.Queryable().FirstAsync(it => it.eqp_id == eqpId); if (closeDown != null) { if (!closeDown.reason.IsNullOrEmpty()) { - var eqp = await _db.Queryable().FirstAsync(it => it.id == eqpId); - EqpEquipType eqpTypeInfo = null; + EqpEquipment? eqp = await _db.Queryable().FirstAsync(it => it.id == eqpId); + EqpEquipType? eqpTypeInfo = null; if (eqp != null) + { eqpTypeInfo = await _db.Queryable().FirstAsync(it => it.id == eqp.equip_type_id); - var reasonArr = closeDown.reason.Split(","); - foreach (var reason in reasonArr) + } + + string[] reasonArr = closeDown.reason.Split(","); + foreach (string reason in reasonArr) { ClosedownEndListOutput ot = new(); if (eqp != null) { if (_dicWorkStationAndShopRelacion.ContainsKey(eqp.station_code)) { - var shopId = _dicWorkStationAndShopRelacion[eqp.station_code].ToString(); + string? shopId = _dicWorkStationAndShopRelacion[eqp.station_code].ToString(); ot.workshop_name = _dicWorkShop.ContainsKey(shopId) ? _dicWorkShop[shopId].ToString()! : ""; } } @@ -153,7 +156,7 @@ namespace Tnb.ProductionMgr [HttpGet] public async Task GetClosedownHistory([FromQuery] ClosedownHistoryQuery input) { - var pagedList = await _db.Queryable() + List pagedList = await _db.Queryable() .WhereIF(!string.IsNullOrEmpty(input.eqpName), it => it.eqp_name.Contains(input.eqpName)) .WhereIF(input.beginTime.HasValue, it => it.closedown_start_time.Value >= input.beginTime) .WhereIF(input.endTime.HasValue, it => it.closedown_start_time.Value <= input.endTime) @@ -184,10 +187,10 @@ namespace Tnb.ProductionMgr public async Task GetInfoFromEqpId([FromRoute] string eqpId) { dynamic info = new ExpandoObject(); - var moTask = await _db.Queryable().Where(it => it.mo_task_status == DictConst.InProgressEnCode).FirstAsync(it => it.eqp_id == eqpId); + PrdMoTask moTask = await _db.Queryable().Where(it => it.mo_task_status == DictConst.InProgressEnCode).FirstAsync(it => it.eqp_id == eqpId); if (moTask != null) { - var mold = await _db.Queryable().FirstAsync(it => it.id == moTask.mo_id); + ToolMolds? mold = await _db.Queryable().FirstAsync(it => it.id == moTask.mo_id); info.mo_task_code = moTask.mo_task_code; info.mold_code = mold?.mold_code; info.mold_name = mold?.mold_name; @@ -204,19 +207,31 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task CloseDownStart(CloseDownStartInput input) { - if (input == null) throw new ArgumentNullException("input"); - if (input.eqp_id.IsNullOrWhiteSpace()) throw new ArgumentException($"parameter {nameof(input.eqp_id)} not be null or empty"); - var eqp = await _db.Queryable().FirstAsync(it => it.id == input.eqp_id); - var cancelCloseDown = input.Adapt(); - EqpRepairApply eqpRepairApply = null; + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.eqp_id.IsNullOrWhiteSpace()) + { + throw new ArgumentException($"parameter {nameof(input.eqp_id)} not be null or empty"); + } + + EqpEquipment? eqp = await _db.Queryable().FirstAsync(it => it.id == input.eqp_id); + PrdCancelClosedown cancelCloseDown = input.Adapt(); + EqpRepairApply? eqpRepairApply = null; BasPushRuleD basPushRuleD = await _db.Queryable().FirstAsync(x => x.push_rule_id == PUSHRULEID && x.ordinal == 1); try { DbResult result = await _db.Ado.UseTranAsync(async () => { - var moTaskList = await _prdMoTaskService.GetListByEqpId(input.eqp_id); - if (moTaskList?.Count > 1) throw new AppFriendlyException($"设备{input.eqp_id},目前有两条进行中的生产任务", 500); + List? moTaskList = await _prdMoTaskService.GetListByEqpId(input.eqp_id); + if (moTaskList?.Count > 1) + { + throw new AppFriendlyException($"设备{input.eqp_id},目前有两条进行中的生产任务", 500); + } + if (moTaskList?.Count > 0) { @@ -226,23 +241,25 @@ namespace Tnb.ProductionMgr cancelCloseDown.create_time = DateTime.Now; cancelCloseDown.closedown_start_time = DateTime.Now; - await _db.Insertable(cancelCloseDown).ExecuteCommandAsync(); + _ = await _db.Insertable(cancelCloseDown).ExecuteCommandAsync(); - var record = cancelCloseDown.Adapt(); + PrdCancelClosedownRecord record = cancelCloseDown.Adapt(); record.eqp_code = eqp?.code; record.eqp_name = eqp?.name; - await _db.Insertable(record).ExecuteCommandAsync(); + _ = await _db.Insertable(record).ExecuteCommandAsync(); - var moldId = moTaskList.First().mold_id; + string? moldId = moTaskList.First().mold_id; if (!moldId.IsNullOrEmpty()) { - var mold = await _moldService.GetListById(moldId); - var maintaindTask = new ToolMoldMaintainTask(); - maintaindTask.mold_id = moldId; - maintaindTask.code = mold?.mold_code ?? ""; - maintaindTask.create_id = _userManager.UserId; - maintaindTask.status = DictConst.UnMaintainStatusCode; - maintaindTask.create_time = DateTime.Now; + ToolMolds mold = await _moldService.GetListById(moldId); + ToolMoldMaintainTask maintaindTask = new() + { + mold_id = moldId, + code = mold?.mold_code ?? "", + create_id = _userManager.UserId, + status = DictConst.UnMaintainStatusCode, + create_time = DateTime.Now + }; await _maintainTaskService.Create(maintaindTask); } @@ -252,7 +269,7 @@ namespace Tnb.ProductionMgr { List prdCancelClosedownReasons = await _db.Queryable().ToListAsync(); string[] reasonArr = input.reason.Split(","); - var reasonList = prdCancelClosedownReasons.Where(x => reasonArr.Contains(x.id)).Select(x => x.reason).ToList(); + List reasonList = prdCancelClosedownReasons.Where(x => reasonArr.Contains(x.id)).Select(x => x.reason).ToList(); reason = string.Join(',', reasonList); } @@ -269,16 +286,16 @@ namespace Tnb.ProductionMgr remark = input.remark, }; - await _db.Insertable(eqpRepairApply).ExecuteCommandAsync(); + _ = await _db.Insertable(eqpRepairApply).ExecuteCommandAsync(); if (!string.IsNullOrEmpty(eqp.responsibler_id)) { List list = await _sendMessageService.SendTest(basPushRuleD.send_config_id); List toUsers = JsonConvert.DeserializeObject>(eqp.responsibler_id); - foreach (var item in list) + foreach (MessageSendModel item in list) { - foreach (var param in item.paramJson) + foreach (MessageSendParam param in item.paramJson) { if (param.field == "equip_code") { @@ -288,15 +305,18 @@ namespace Tnb.ProductionMgr item.toUser = toUsers; } - foreach (var item in list) + foreach (MessageSendModel item in list) { - await _sendMessageService.SendMessage(item, new Dictionary()); + _ = await _sendMessageService.SendMessage(item, new Dictionary()); } } } - else throw Oops.Oh(ErrorCode.COM1001); + else + { + throw Oops.Oh(ErrorCode.COM1001); + } }); if (result.IsSuccess) { @@ -312,23 +332,25 @@ namespace Tnb.ProductionMgr // string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ? {executeTime.Year}"; string cron = $"0 {executeTime.Minute} {executeTime.Hour} {executeTime.Day} {executeTime.Month} ?"; - var comtentModel = new ContentModel(); - // comtentModel.cron = (2 * 60).ToString(); - comtentModel.cron = cron; - comtentModel.interfaceId = ""; - comtentModel.interfaceName = ""; - comtentModel.parameter = new List(); - comtentModel.localHostTaskId = "PushMsgTimeWorker/PushMsg"; - comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); - // comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString(); - comtentModel.TenantId = _userManager?.TenantId; - comtentModel.TenantDbName = _userManager?.TenantDbName; - comtentModel.ConnectionConfig = _userManager?.ConnectionConfig; - comtentModel.Token = _userManager?.ToKen; - - foreach (var item in sendModels) + ContentModel comtentModel = new() { - foreach (var param in item.paramJson) + // comtentModel.cron = (2 * 60).ToString(); + cron = cron, + interfaceId = "", + interfaceName = "", + parameter = new List(), + localHostTaskId = "PushMsgTimeWorker/PushMsg", + startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(), + // comtentModel.endTime = DateTimeOffset.Now.AddSeconds(3).ToUnixTimeMilliseconds().ToString(); + TenantId = _userManager?.TenantId, + TenantDbName = _userManager?.TenantDbName, + ConnectionConfig = _userManager?.ConnectionConfig, + Token = _userManager?.ToKen + }; + + foreach (MessageSendModel item in sendModels) + { + foreach (MessageSendParam param in item.paramJson) { if (param.field == "equip_code") { @@ -337,7 +359,7 @@ namespace Tnb.ProductionMgr } } - TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() + TimeTaskCrInput timeTaskCrInput = new() { enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), fullName = "临时推送消息" + DateTime.Now.ToString("yyyyMMddHHmmss"), @@ -352,7 +374,7 @@ namespace Tnb.ProductionMgr TimeTaskEntity timeTaskEntity = await _db.Queryable().Where(x => x.EnCode == timeTaskCrInput.enCode).FirstAsync(); - BasPushRuleLog basPushRuleLog = new BasPushRuleLog() + BasPushRuleLog basPushRuleLog = new() { push_rule_id = PUSHRULEID, timetask_id = timeTaskEntity?.Id, @@ -361,7 +383,7 @@ namespace Tnb.ProductionMgr is_push = 1, }; - await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); + _ = await _db.Insertable(basPushRuleLog).ExecuteCommandAsync(); } } @@ -384,25 +406,33 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task CloseDownEnd(CloseDownStartInput input) { - if (input == null) throw new ArgumentNullException("input"); - if (input.eqp_id.IsNullOrWhiteSpace()) throw new ArgumentException($"parameter {nameof(input.eqp_id)} not be null or empty"); + if (input == null) + { + throw new ArgumentNullException("input"); + } + + if (input.eqp_id.IsNullOrWhiteSpace()) + { + throw new ArgumentException($"parameter {nameof(input.eqp_id)} not be null or empty"); + } + try { await _db.Ado.BeginTranAsync(); - var closeDown = await _db.Queryable().Where(it => it.eqp_id == input.eqp_id).OrderByDescending(it => it.closedown_start_time).FirstAsync(); + PrdCancelClosedown closeDown = await _db.Queryable().Where(it => it.eqp_id == input.eqp_id).OrderByDescending(it => it.closedown_start_time).FirstAsync(); if (closeDown != null) { closeDown.closedown_end_time = DateTime.Now; - await _db.Updateable(closeDown).ExecuteCommandAsync(); - var record = closeDown.Adapt(); + _ = await _db.Updateable(closeDown).ExecuteCommandAsync(); + PrdCancelClosedownRecord record = closeDown.Adapt(); //计算停机时间间隔,以小时为单位 if (record.closedown_start_time.HasValue && record.closedown_end_time.HasValue) { - var interval = record.closedown_end_time.Value.Subtract(record.closedown_start_time.Value).TotalHours; + double interval = record.closedown_end_time.Value.Subtract(record.closedown_start_time.Value).TotalHours; record.closedown_time = Convert.ToDecimal(interval); } - await _db.Updateable(record).ExecuteCommandAsync(); + _ = await _db.Updateable(record).ExecuteCommandAsync(); await _db.Ado.CommitTranAsync(); } @@ -417,7 +447,7 @@ namespace Tnb.ProductionMgr private async Task> GetSendParamJson(string id) { - var list = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) + List list = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) .Where((a, b) => a.SendConfigId == id && a.DeleteMark == null && b.DeleteMark == null) .Select((a, b) => new MessageSendModel { @@ -428,13 +458,12 @@ namespace Tnb.ProductionMgr sendConfigId = a.SendConfigId, templateId = a.TemplateId, }).ToListAsync(); - foreach (var item in list) + foreach (MessageSendModel? item in list) { // 是否存在参数. - var flag = await _db.Queryable().AnyAsync(x => x.TemplateId == item.templateId && x.DeleteMark == null); - if (flag) - { - item.paramJson = await _db.Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id, JoinType.Left, a.TemplateId == c.TemplateId)) + bool flag = await _db.Queryable().AnyAsync(x => x.TemplateId == item.templateId && x.DeleteMark == null); + item.paramJson = flag + ? await _db.Queryable((a, b, c) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id, JoinType.Left, a.TemplateId == c.TemplateId)) .Where((a, b, c) => a.TemplateId == item.templateId && a.DeleteMark == null && b.DeleteMark == null && a.Field == c.Field && a.Field != "@flowLink") .Select((a, b) => new MessageSendParam { @@ -445,11 +474,8 @@ namespace Tnb.ProductionMgr templateId = a.TemplateId, templateName = b.FullName, templateType = b.TemplateType - }).ToListAsync(); - } - else - { - item.paramJson = await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) + }).ToListAsync() + : await _db.Queryable((a, b) => new JoinQueryInfos(JoinType.Left, a.TemplateId == b.Id)) .Where((a, b) => a.TemplateId == item.templateId && a.DeleteMark == null && b.DeleteMark == null && a.Field != "@flowLink") .Where((a, b) => b.Title.Contains(a.Field) || b.Content.Contains(a.Field)) .Select((a, b) => new MessageSendParam @@ -462,7 +488,6 @@ namespace Tnb.ProductionMgr templateName = b.FullName, templateType = b.TemplateType }).ToListAsync(); - } } return list; } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 285e7e76..6aebde11 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -50,17 +50,17 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task SaveData(MaterialReceiptInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - var moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); - var inputMaterials = await db.Queryable() + PrdMoTask moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); + List inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == input.mbom_process_id) .Select(x => x.material_id) .ToListAsync(); string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.FEEDING_CODE); - PrdFeedingH prdFeedingH = new PrdFeedingH() + PrdFeedingH prdFeedingH = new() { code = code, station_id = input.station_id, @@ -78,15 +78,17 @@ namespace Tnb.ProductionMgr org_id = _userManager.GetUserInfo().Result.organizeId }; - List list = new List(); + List list = new(); if (input.details != null && input.details.Count > 0) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { if (!inputMaterials.Contains(item["material_id"])) + { throw new Exception("该物料不是生产bom投入物料,不能签收"); + } - var detail = await db.Queryable() + PrdMaterialReceiptD? detail = await db.Queryable() .Where(x => x.carry_id == input.carry_id && x.is_all_feeding == 0).FirstAsync(); decimal num = Convert.ToDecimal(item["num"]); list.Add(new PrdFeedingD @@ -108,20 +110,18 @@ namespace Tnb.ProductionMgr { throw new Exception("投料数量不能大于签收数量"); } - else if (detail.feeding_num + num == detail.num) - { - await db.Updateable() - .SetColumns(x => x.feeding_num == x.feeding_num + num) - .SetColumns(x => x.is_all_feeding == 1) - .Where(x => x.id == detail.id) - .ExecuteCommandAsync(); - } else { - await db.Updateable() - .SetColumns(x => x.feeding_num == x.feeding_num + num) - .Where(x => x.id == detail.id) - .ExecuteCommandAsync(); + _ = detail.feeding_num + num == detail.num + ? await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .SetColumns(x => x.is_all_feeding == 1) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync() + : await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync(); } } else @@ -135,29 +135,31 @@ namespace Tnb.ProductionMgr throw new Exception("没有签收物料"); } - var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); - var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); - var station = await db.Queryable().SingleAsync(x => x.Id == input.station_id); - var process = await db.Queryable().SingleAsync(x => x.id == input.process_id); - var taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); - taskLog.mo_code = mo?.mo_code!; - taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.equip_id))?.code!; - taskLog.mold_code = ""; - taskLog.item_code = material?.code!; - taskLog.item_standard = material?.material_standard!; - taskLog.status = "生产投料"; - taskLog.operator_name = _userManager.RealName; - taskLog.create_id = _userManager.UserId; - taskLog.create_time = DateTime.Now; - taskLog.mo_task_id = moTask.id; - taskLog.mo_task_code = moTask.mo_task_code; - taskLog.station_code = station?.EnCode; - taskLog.process_code = process.code; + PrdMo mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); + BasMaterial? material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); + OrganizeEntity station = await db.Queryable().SingleAsync(x => x.Id == input.station_id); + BasMaterial process = await db.Queryable().SingleAsync(x => x.id == input.process_id); + PrdTaskLog taskLog = new() + { + id = SnowflakeIdHelper.NextId(), + mo_code = mo?.mo_code!, + eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.equip_id))?.code!, + mold_code = "", + item_code = material?.code!, + item_standard = material?.material_standard!, + status = "生产投料", + operator_name = _userManager.RealName, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = moTask.id, + mo_task_code = moTask.mo_task_code, + station_code = station?.EnCode, + process_code = process.code + }; - await db.Insertable(prdFeedingH).ExecuteCommandAsync(); - await db.Insertable(list).ExecuteCommandAsync(); - await db.Insertable(taskLog).ExecuteCommandAsync(); + _ = await db.Insertable(prdFeedingH).ExecuteCommandAsync(); + _ = await db.Insertable(list).ExecuteCommandAsync(); + _ = await db.Insertable(taskLog).ExecuteCommandAsync(); }); @@ -172,30 +174,29 @@ namespace Tnb.ProductionMgr // }); } - if (!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); - return result.IsSuccess ? "投料成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Oh(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "投料成功" : result.ErrorMessage); } [HttpPost] public async Task SaveDataNew(MaterialReceiptNewInput input) { - var db = _repository.AsSugarClient(); - PrdFeedingH prdFeedingH = null; - List list = new List(); - DbResult result2 = new DbResult(); + ISqlSugarClient db = _repository.AsSugarClient(); + PrdFeedingH? prdFeedingH = null; + List list = new(); + DbResult result2 = new(); DbResult result = await db.Ado.UseTranAsync(async () => { - var moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); - var parentMoTask = await db.Queryable().FirstAsync(x => x.id == moTask.parent_id); + PrdMoTask moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); + PrdMoTask parentMoTask = await db.Queryable().FirstAsync(x => x.id == moTask.parent_id); string worklineId = moTask.workline_id; if (parentMoTask != null && !string.IsNullOrEmpty(parentMoTask.workline_id)) { worklineId = parentMoTask.workline_id; } - var carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); - var workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); - var workshop = await db.Queryable().SingleAsync(x => x.Id == workline.ParentId); - var inputMaterials = await db.Queryable() + WmsCarryH carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); + OrganizeEntity workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); + OrganizeEntity workshop = await db.Queryable().SingleAsync(x => x.Id == workline.ParentId); + List inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id) .Select(x => x.material_id) .ToListAsync(); @@ -222,12 +223,14 @@ namespace Tnb.ProductionMgr if (input.details != null && input.details.Count > 0) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { if (!inputMaterials.Contains(item["material_id"])) + { throw new Exception("该物料不是生产bom投入物料,不能签收"); + } - var detail = await db.Queryable() + PrdMaterialReceiptD? detail = await db.Queryable() .Where(x => x.member_carry_code == input.carry_code && x.is_all_feeding == 0).FirstAsync(); decimal num = Convert.ToDecimal(item["num"]); list.Add(new PrdFeedingD @@ -249,20 +252,18 @@ namespace Tnb.ProductionMgr { throw new Exception("投料数量不能大于签收数量"); } - else if (detail.feeding_num + num == detail.num) - { - await db.Updateable() - .SetColumns(x => x.feeding_num == x.feeding_num + num) - .SetColumns(x => x.is_all_feeding == 1) - .Where(x => x.id == detail.id) - .ExecuteCommandAsync(); - } else { - await db.Updateable() - .SetColumns(x => x.feeding_num == x.feeding_num + num) - .Where(x => x.id == detail.id) - .ExecuteCommandAsync(); + _ = detail.feeding_num + num == detail.num + ? await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .SetColumns(x => x.is_all_feeding == 1) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync() + : await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync(); } } else @@ -277,8 +278,8 @@ namespace Tnb.ProductionMgr } - await db.Insertable(prdFeedingH).ExecuteCommandAsync(); - await db.Insertable(list).ExecuteCommandAsync(); + _ = await db.Insertable(prdFeedingH).ExecuteCommandAsync(); + _ = await db.Insertable(list).ExecuteCommandAsync(); }); @@ -322,8 +323,7 @@ namespace Tnb.ProductionMgr // } } - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "签收成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "签收成功" : result.ErrorMessage); } @@ -337,28 +337,32 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task Feeding(MaterialReceiptNewInput input) { - var db = _repository.AsSugarClient(); - var moTask = await _prdMoTaskService.GetPrdMoTaskInfoByStationId(new Dictionary() + ISqlSugarClient db = _repository.AsSugarClient(); + PrdMoTask moTask = await _prdMoTaskService.GetPrdMoTaskInfoByStationId(new Dictionary() { {"station_id",input.station_id} }); - if (moTask == null) throw Oops.Bah("找不到任务单"); - PrdFeedingH prdFeedingH = null; - List list = new List(); - DbResult result2 = new DbResult(); + if (moTask == null) + { + throw Oops.Bah("找不到任务单"); + } + + PrdFeedingH? prdFeedingH = null; + List list = new(); + DbResult result2 = new(); DbResult result = await db.Ado.UseTranAsync(async () => { - var parentMoTask = await db.Queryable().FirstAsync(x => x.id == moTask.parent_id); + PrdMoTask parentMoTask = await db.Queryable().FirstAsync(x => x.id == moTask.parent_id); string worklineId = moTask.workline_id; if (parentMoTask != null && !string.IsNullOrEmpty(parentMoTask.workline_id)) { worklineId = parentMoTask.workline_id; } - var carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); - var workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); - var workshop = await db.Queryable().SingleAsync(x => x.Id == workline.ParentId); - var inputMaterials = await db.Queryable() + WmsCarryH carry = await db.Queryable().SingleAsync(x => x.carry_code == input.carry_code); + OrganizeEntity workline = await db.Queryable().SingleAsync(x => x.Id == worklineId); + OrganizeEntity workshop = await db.Queryable().SingleAsync(x => x.Id == workline.ParentId); + List inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id && x.mbom_process_id == moTask.mbom_process_id) .Select(x => x.material_id) .ToListAsync(); @@ -385,12 +389,14 @@ namespace Tnb.ProductionMgr if (input.details != null && input.details.Count > 0) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { if (!inputMaterials.Contains(item["material_id"])) + { throw new Exception("该物料不是生产bom投入物料,不能签收"); + } - var detail = await db.Queryable() + PrdMaterialReceiptD? detail = await db.Queryable() .Where(x => x.member_carry_code == input.carry_code && x.is_all_feeding == 0).FirstAsync(); decimal num = Convert.ToDecimal(item["num"]); list.Add(new PrdFeedingD @@ -412,20 +418,18 @@ namespace Tnb.ProductionMgr { throw new Exception("投料数量不能大于签收数量"); } - else if (detail.feeding_num + num == detail.num) - { - await db.Updateable() - .SetColumns(x => x.feeding_num == x.feeding_num + num) - .SetColumns(x => x.is_all_feeding == 1) - .Where(x => x.id == detail.id) - .ExecuteCommandAsync(); - } else { - await db.Updateable() - .SetColumns(x => x.feeding_num == x.feeding_num + num) - .Where(x => x.id == detail.id) - .ExecuteCommandAsync(); + _ = detail.feeding_num + num == detail.num + ? await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .SetColumns(x => x.is_all_feeding == 1) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync() + : await db.Updateable() + .SetColumns(x => x.feeding_num == x.feeding_num + num) + .Where(x => x.id == detail.id) + .ExecuteCommandAsync(); } } else @@ -440,21 +444,20 @@ namespace Tnb.ProductionMgr } - await db.Insertable(prdFeedingH).ExecuteCommandAsync(); - await db.Insertable(list).ExecuteCommandAsync(); + _ = await db.Insertable(prdFeedingH).ExecuteCommandAsync(); + _ = await db.Insertable(list).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "签收成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "签收成功" : result.ErrorMessage); } [HttpPost] public async Task GetFeedingRecordTree() { - var db = _repository.AsSugarClient(); - var result = await db.Queryable() + ISqlSugarClient db = _repository.AsSugarClient(); + List result = await db.Queryable() .Where(a => a.schedule_type == 2 && a.parent_id != null) .Select(a => new FeedingRecordTreeOutput() { @@ -479,7 +482,7 @@ namespace Tnb.ProductionMgr }) }).Mapper(x => { - foreach (var item in x.children) + foreach (FeedingRecordChildren item in x.children) { item.children = db.Queryable() .LeftJoin((c, d) => c.material_id == d.id) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs index 7a168a59..377649b8 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -57,9 +57,9 @@ namespace Tnb.ProductionMgr private async Task GetList(VisualDevModelListQueryInput input) { - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string moCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; - var list = await _repository.AsSugarClient().Queryable() + List list = await _repository.AsSugarClient().Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => a.eqp_id == d.id) @@ -79,7 +79,7 @@ namespace Tnb.ProductionMgr estimated_end_date = a.estimated_end_date.ToString(), create_time = a.create_time.ToString() }).ToListAsync(); - var treeList = list.ToTree(); + List treeList = list.ToTree(); treeList = treeList.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList(); SqlSugarPagedList pagedList = new() { @@ -97,11 +97,11 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task SaveData(PrdInstockInput input) { - var db = _repository.AsSugarClient(); - var location = await db.Queryable().FirstAsync(x => x.location_code == input.location_code); - PrdInstockH prdInstockH = null; - List prdInstockDs = new List() { }; - DbResult result2 = new DbResult(); + ISqlSugarClient db = _repository.AsSugarClient(); + BasLocation location = await db.Queryable().FirstAsync(x => x.location_code == input.location_code); + PrdInstockH? prdInstockH = null; + List prdInstockDs = new() { }; + DbResult result2 = new(); if (string.IsNullOrEmpty(input.station_id)) { @@ -130,7 +130,7 @@ namespace Tnb.ProductionMgr status = 0, }; - foreach (var item in input.details) + foreach (Dictionary item in input.details) { prdInstockDs.Add(new PrdInstockD() { @@ -158,22 +158,24 @@ namespace Tnb.ProductionMgr if (result.IsSuccess) { - MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput(); - mesCreateInstockInput.instock = new MESWmsInstockHInput() + MESCreateInstockInput mesCreateInstockInput = new() { - org_id = _userManager.GetUserInfo().Result.organizeId, - bill_date = DateTime.Now, - bill_type = input.bill_type, - warehouse_id = location?.wh_id, - source_id = prdInstockH.id, - create_id = _userManager.UserId, - carry_code = input.carry_code, - location_code = input.location_code, - is_check = input.is_check, + instock = new MESWmsInstockHInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + bill_type = input.bill_type, + warehouse_id = location?.wh_id, + source_id = prdInstockH.id, + create_id = _userManager.UserId, + carry_code = input.carry_code, + location_code = input.location_code, + is_check = input.is_check, + }, + instockds = new List(), + instockcodes = new List() }; - mesCreateInstockInput.instockds = new List(); - mesCreateInstockInput.instockcodes = new List(); - foreach (var item in input.details) + foreach (Dictionary item in input.details) { mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput() { @@ -197,34 +199,27 @@ namespace Tnb.ProductionMgr }); } string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - if (authResponse.code != 200 || !authResponse.data.ObjToBool()) - { - throw Oops.Bah(authResponse.msg); - } - else - { - result2 = await db.Ado.UseTranAsync(async () => + result2 = authResponse.code != 200 || !authResponse.data.ObjToBool() + ? throw Oops.Bah(authResponse.msg) + : await db.Ado.UseTranAsync(async () => { - await _repository.InsertAsync(prdInstockH); + _ = await _repository.InsertAsync(prdInstockH); if (prdInstockDs.Count > 0) { - await db.Insertable(prdInstockDs).ExecuteCommandAsync(); + _ = await db.Insertable(prdInstockDs).ExecuteCommandAsync(); } }); - - } } - if (!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result2.IsSuccess ? "保存成功" : result2.ErrorMessage; + return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "保存成功" : result2.ErrorMessage); } /// @@ -235,20 +230,20 @@ namespace Tnb.ProductionMgr public async Task SyncInstock(Dictionary dic) { string sourceId = dic.ContainsKey("source_id") ? dic["source_id"] : ""; - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { if (!string.IsNullOrEmpty(sourceId)) { - await _repository.UpdateAsync(x => new PrdInstockH() + _ = await _repository.UpdateAsync(x => new PrdInstockH() { status = 1 }, x => x.id == sourceId); - var details = await db.Queryable().Where(x => x.instock_id == sourceId).ToListAsync(); + List details = await db.Queryable().Where(x => x.instock_id == sourceId).ToListAsync(); - foreach (var item in details) + foreach (PrdInstockD item in details) { - await db.Updateable().SetColumns(x => x.status == 1) + _ = await db.Updateable().SetColumns(x => x.status == 1) .Where(x => x.id == item.report_id).ExecuteCommandAsync(); } } @@ -268,21 +263,40 @@ namespace Tnb.ProductionMgr { string equip_code = inut.equip_code; string as_location_code = inut.as_location_code; - if (!string.IsNullOrEmpty(equip_code)) throw Oops.Bah("请传机台号"); - var db = _repository.AsSugarClient(); + if (!string.IsNullOrEmpty(equip_code)) + { + throw Oops.Bah("请传机台号"); + } + + ISqlSugarClient db = _repository.AsSugarClient(); EqpEquipment equipment = await db.Queryable().Where(x => x.code == equip_code).FirstAsync(); - if (equipment == null) throw Oops.Bah("未找到机台"); - if (string.IsNullOrEmpty(equipment.as_location_id)) throw Oops.Bah("未找到入库库位"); + if (equipment == null) + { + throw Oops.Bah("未找到机台"); + } + + if (string.IsNullOrEmpty(equipment.as_location_id)) + { + throw Oops.Bah("未找到入库库位"); + } + BasLocation basLocation = await db.Queryable().SingleAsync(x => x.id == equipment.as_location_id); - if (basLocation == null) throw Oops.Bah("未找到入库库位"); + if (basLocation == null) + { + throw Oops.Bah("未找到入库库位"); + } + PrdReport prdReport = await db.Queryable() .Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time) .FirstAsync(); - if (prdReport == null) throw Oops.Bah("未找到提报记录"); + if (prdReport == null) + { + throw Oops.Bah("未找到提报记录"); + } - PrdInstockH prdInstockH = null; - List prdInstockDs = new List() { }; - DbResult result2 = new DbResult(); + PrdInstockH? prdInstockH = null; + List prdInstockDs = new() { }; + DbResult result2 = new(); BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdReport.material_id); DbResult result = await db.Ado.UseTranAsync(async () => { @@ -320,21 +334,23 @@ namespace Tnb.ProductionMgr if (result.IsSuccess) { - MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput(); - mesCreateInstockInput.instock = new MESWmsInstockHInput() + MESCreateInstockInput mesCreateInstockInput = new() { - org_id = _userManager.GetUserInfo().Result.organizeId, - bill_date = DateTime.Now, - bill_type = DictConst.CHANCHENGPINRUKUDAN, - warehouse_id = basLocation?.wh_id, - source_id = prdInstockH.id, - create_id = _userManager.UserId, - carry_code = prdReport.material_box_code, - location_code = basLocation.location_code, - is_check = 1, + instock = new MESWmsInstockHInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + bill_type = DictConst.CHANCHENGPINRUKUDAN, + warehouse_id = basLocation?.wh_id, + source_id = prdInstockH.id, + create_id = _userManager.UserId, + carry_code = prdReport.material_box_code, + location_code = basLocation.location_code, + is_check = 1, + }, + instockds = new List(), + instockcodes = new List() }; - mesCreateInstockInput.instockds = new List(); - mesCreateInstockInput.instockcodes = new List(); mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput() { material_id = prdReport.material_id, @@ -354,46 +370,39 @@ namespace Tnb.ProductionMgr codeqty = (int)prdReport.reported_qty, }); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - if (authResponse.code != 200 || !authResponse.data.ObjToBool()) - { - throw Oops.Bah(authResponse.msg); - } - else - { - result2 = await db.Ado.UseTranAsync(async () => + result2 = authResponse.code != 200 || !authResponse.data.ObjToBool() + ? throw Oops.Bah(authResponse.msg) + : await db.Ado.UseTranAsync(async () => { - await _repository.InsertAsync(prdInstockH); + _ = await _repository.InsertAsync(prdInstockH); if (prdInstockDs.Count > 0) { - await db.Insertable(prdInstockDs).ExecuteCommandAsync(); + _ = await db.Insertable(prdInstockDs).ExecuteCommandAsync(); } }); - - } } - if (!result2.IsSuccess) throw Oops.Oh(ErrorCode.COM1008); - return result2.IsSuccess ? "申请成功" : result2.ErrorMessage; + return !result2.IsSuccess ? throw Oops.Oh(ErrorCode.COM1008) : (dynamic)(result2.IsSuccess ? "申请成功" : result2.ErrorMessage); } [HttpPost] public async Task InstockTubeOne(PrdReport prdReport) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); string location_code = "JMXHC-01"; string warehouse_id = "26103348825381"; - PrdInstockH prdInstockH = null; - List prdInstockDs = new List() { }; - DbResult result2 = new DbResult(); + PrdInstockH? prdInstockH = null; + List prdInstockDs = new() { }; + DbResult result2 = new(); BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdReport.material_id); DbResult result = await db.Ado.UseTranAsync(async () => { @@ -431,21 +440,23 @@ namespace Tnb.ProductionMgr if (result.IsSuccess) { - MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput(); - mesCreateInstockInput.instock = new MESWmsInstockHInput() + MESCreateInstockInput mesCreateInstockInput = new() { - org_id = _userManager.GetUserInfo().Result.organizeId, - bill_date = DateTime.Now, - bill_type = DictConst.CHANCHENGPINRUKUDAN, - warehouse_id = warehouse_id, - source_id = prdInstockH.id, - create_id = _userManager.UserId, - carry_code = prdReport.material_box_code, - location_code = location_code, - is_check = 1, + instock = new MESWmsInstockHInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + bill_type = DictConst.CHANCHENGPINRUKUDAN, + warehouse_id = warehouse_id, + source_id = prdInstockH.id, + create_id = _userManager.UserId, + carry_code = prdReport.material_box_code, + location_code = location_code, + is_check = 1, + }, + instockds = new List(), + instockcodes = new List() }; - mesCreateInstockInput.instockds = new List(); - mesCreateInstockInput.instockcodes = new List(); mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput() { material_id = prdReport.material_id, @@ -465,30 +476,24 @@ namespace Tnb.ProductionMgr codeqty = (int)prdReport.reported_qty, }); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - if (authResponse.code != 200 || !authResponse.data.ObjToBool()) - { - throw Oops.Bah(authResponse.msg); - } - else - { - result2 = await db.Ado.UseTranAsync(async () => + result2 = authResponse.code != 200 || !authResponse.data.ObjToBool() + ? throw Oops.Bah(authResponse.msg) + : await db.Ado.UseTranAsync(async () => { - await _repository.InsertAsync(prdInstockH); + _ = await _repository.InsertAsync(prdInstockH); if (prdInstockDs.Count > 0) { - await db.Insertable(prdInstockDs).ExecuteCommandAsync(); + _ = await db.Insertable(prdInstockDs).ExecuteCommandAsync(); } }); - - } } return result2.IsSuccess ? "true" : "false"; diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs index caa07277..cbff6ef9 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs @@ -164,36 +164,38 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task KittingOut(KittingOutInput kittingOutInput) { - PrdKittingOutH prdKittingOutH = new PrdKittingOutH(); + PrdKittingOutH prdKittingOutH = new(); try { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode); kittingOutInput.workline_id = workline?.Id ?? ""; - List input = new List(); - input.Add(new MESKittingOutStkInput() + List input = new() { - org_id = _userManager.GetUserInfo().Result.organizeId, - bill_date = DateTime.Now, - warehouse_id = kittingOutInput.warehouse_id, - location_code = kittingOutInput.location_code, - material_id = kittingOutInput.material_id, - material_code = kittingOutInput.material_code, - collocation_scheme_id = kittingOutInput.collocation_scheme_id, - collocation_scheme_code = kittingOutInput.collocation_scheme_code, - source_id = prdKittingOutH.id, - create_id = _userManager.UserId, - wmsKittingoutDs = new List(), - }); + new MESKittingOutStkInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + warehouse_id = kittingOutInput.warehouse_id, + location_code = kittingOutInput.location_code, + material_id = kittingOutInput.material_id, + material_code = kittingOutInput.material_code, + collocation_scheme_id = kittingOutInput.collocation_scheme_id, + collocation_scheme_code = kittingOutInput.collocation_scheme_code, + source_id = prdKittingOutH.id, + create_id = _userManager.UserId, + wmsKittingoutDs = new List(), + } + }; input[0].wmsKittingoutDs = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(kittingOutInput.tableField115)); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -217,8 +219,8 @@ namespace Tnb.ProductionMgr prdKittingOutH.create_id = _userManager.UserId; prdKittingOutH.create_time = DateTime.Now; prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId; - List prdKittingOutDs = new List(); - foreach (var item in kittingOutInput.tableField115) + List prdKittingOutDs = new(); + foreach (Dictionary item in kittingOutInput.tableField115) { prdKittingOutDs.Add(new PrdKittingOutD() { @@ -238,10 +240,10 @@ namespace Tnb.ProductionMgr DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.InsertAsync(prdKittingOutH); + _ = await _repository.InsertAsync(prdKittingOutH); if (prdKittingOutDs.Count > 0) { - await db.Insertable(prdKittingOutDs).ExecuteCommandAsync(); + _ = await db.Insertable(prdKittingOutDs).ExecuteCommandAsync(); } }); @@ -271,11 +273,11 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task KittingOutNew(KittingOutNewInput kittingOutInput) { - PrdKittingOutH prdKittingOutH = new PrdKittingOutH(); + PrdKittingOutH prdKittingOutH = new(); string warehouse_id = "26103348825381";//二楼缓存仓 try { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == kittingOutInput.mo_task_id); BasMaterial basMaterial = await db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); WmsCollocationSchemeH wmsCollocationSchemeH = await db.Queryable().SingleAsync(x => x.id == kittingOutInput.collocation_scheme_id); @@ -295,23 +297,25 @@ namespace Tnb.ProductionMgr Dictionary unitCodeDic = basMaterials.ToDictionary(x => x.id, x => x.unit_id); OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(kittingOutInput.workstation_id, DictConst.RegionCategoryWorklineCode); - List input = new List(); - input.Add(new MESKittingOutStkInput() + List input = new() { - org_id = _userManager.GetUserInfo().Result.organizeId, - bill_date = DateTime.Now, - warehouse_id = warehouse_id, - location_code = kittingOutInput.location_code, - material_id = prdMoTask.material_id, - material_code = basMaterial.code, - collocation_scheme_id = kittingOutInput.collocation_scheme_id, - collocation_scheme_code = wmsCollocationSchemeH.bill_code, - source_id = prdKittingOutH.id, - create_id = _userManager.UserId, - wmsKittingoutDs = new List(), - }); + new MESKittingOutStkInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + warehouse_id = warehouse_id, + location_code = kittingOutInput.location_code, + material_id = prdMoTask.material_id, + material_code = basMaterial.code, + collocation_scheme_id = kittingOutInput.collocation_scheme_id, + collocation_scheme_code = wmsCollocationSchemeH.bill_code, + source_id = prdKittingOutH.id, + create_id = _userManager.UserId, + wmsKittingoutDs = new List(), + } + }; - foreach (var item in wmsCollocationSchemeDs) + foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs) { input[0].wmsKittingoutDs.Add(new MESKittingOutStkDInput() { @@ -326,11 +330,11 @@ namespace Tnb.ProductionMgr } string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_KITTING_OUT_STK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -354,8 +358,8 @@ namespace Tnb.ProductionMgr prdKittingOutH.create_id = _userManager.UserId; prdKittingOutH.create_time = DateTime.Now; prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId; - List prdKittingOutDs = new List(); - foreach (var item in wmsCollocationSchemeDs) + List prdKittingOutDs = new(); + foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs) { prdKittingOutDs.Add(new PrdKittingOutD() { @@ -375,10 +379,10 @@ namespace Tnb.ProductionMgr DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.InsertAsync(prdKittingOutH); + _ = await _repository.InsertAsync(prdKittingOutH); if (prdKittingOutDs.Count > 0) { - await db.Insertable(prdKittingOutDs).ExecuteCommandAsync(); + _ = await db.Insertable(prdKittingOutDs).ExecuteCommandAsync(); } }); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index ace01ef4..5516ea48 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -53,7 +53,7 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetInfoByQrCode(string qrCode) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); // var result = await db.Queryable() // .Where((a) => a.carry_code == qrCode) // .Select(a => new @@ -77,7 +77,7 @@ namespace Tnb.ProductionMgr if (await db.Queryable() .AnyAsync(x => x.member_carry_code == qrCode && x.is_all_feeding == 0)) { - var result = await db.Queryable() + FeedingDetailOutput result = await db.Queryable() .LeftJoin((a, b) => a.carry_id == b.id) .Where((a) => a.member_carry_code == qrCode && a.is_all_feeding == 0) .Select((a, b) => new FeedingDetailOutput @@ -103,7 +103,7 @@ namespace Tnb.ProductionMgr } else { - var result = await db.Queryable() + FeedingDetailOutput result = await db.Queryable() .LeftJoin((a, b) => a.carry_id == b.id) .Where((a) => a.carry_code == qrCode) .Select((a, b) => new FeedingDetailOutput @@ -131,14 +131,14 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task SaveData(MaterialReceiptInput input) { - var db = _repository.AsSugarClient(); - DbResult result2 = new DbResult(); - PrdMaterialReceiptH prdMaterialReceiptH = null; - List list = new List(); + ISqlSugarClient db = _repository.AsSugarClient(); + DbResult result2 = new(); + PrdMaterialReceiptH? prdMaterialReceiptH = null; + List list = new(); DbResult result = await db.Ado.UseTranAsync(async () => { - var moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); - var inputMaterials = await db.Queryable() + PrdMoTask moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); + List inputMaterials = await db.Queryable() .Where(x => x.mbom_id == moTask.bom_id) .WhereIF(!string.IsNullOrEmpty(input.mbom_process_id), x => x.mbom_process_id == input.mbom_process_id) .Select(x => x.material_id) @@ -168,10 +168,12 @@ namespace Tnb.ProductionMgr if (input.details != null && input.details.Count > 0) { - foreach (var item in input.details) + foreach (Dictionary item in input.details) { if (!inputMaterials.Contains(item["material_id"])) + { throw new Exception("该物料不是生产bom投入物料,不能签收"); + } list.Add(new PrdMaterialReceiptD { @@ -214,7 +216,7 @@ namespace Tnb.ProductionMgr // carry_code = input.carry_code ?? "", // }); - var mesCarrySignInput = new MESCarrySignInput() + MESCarrySignInput mesCarrySignInput = new() { org_id = _userManager.GetUserInfo().Result.organizeId, create_id = _userManager.UserId, @@ -222,30 +224,24 @@ namespace Tnb.ProductionMgr }; string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN, JsonConvert.SerializeObject(mesCarrySignInput), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN, JsonConvert.SerializeObject(mesCarrySignInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - if (authResponse.code != 200) - { - throw Oops.Bah(authResponse.msg); - } - else - { - result2 = await db.Ado.UseTranAsync(async () => + result2 = authResponse.code != 200 + ? throw Oops.Bah(authResponse.msg) + : await db.Ado.UseTranAsync(async () => { - await db.Insertable(prdMaterialReceiptH).ExecuteCommandAsync(); - await db.Insertable(list).ExecuteCommandAsync(); + _ = await db.Insertable(prdMaterialReceiptH).ExecuteCommandAsync(); + _ = await db.Insertable(list).ExecuteCommandAsync(); }); - - } } - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - if (!result2.IsSuccess) throw Oops.Bah(result2.ErrorMessage); - return "签收成功"; + return !result.IsSuccess + ? throw Oops.Bah(result.ErrorMessage) + : !result2.IsSuccess ? throw Oops.Bah(result2.ErrorMessage) : (dynamic)"签收成功"; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index 7869fe92..bfeceab0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -108,12 +108,12 @@ namespace Tnb.ProductionMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string moCode = queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : ""; string moStatus = queryJson.ContainsKey("mo_status") ? queryJson["mo_status"].ToString() : ""; string combineMoCode = queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : ""; - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => c.EnCode == DictConst.MeasurementUnit) .LeftJoin((a, b, c, d) => c.Id == d.DictionaryTypeId && a.unit_id == d.Id) @@ -175,10 +175,10 @@ namespace Tnb.ProductionMgr /// /// [HttpGet("{icmoCode}")] - public async Task GetReportRecord(string icmoCode) + public dynamic GetReportRecord(string icmoCode) { - var db = _repository.AsSugarClient(); - var output = new PrdMoTaskDefectOutput(); + _ = _repository.AsSugarClient(); + PrdMoTaskDefectOutput output = new(); //output.mo_task_code = icmoCode; //var scrap = (await db.Queryable().FirstAsync(it => it.icmo_code == icmoCode)); //output.items = new List(); @@ -215,16 +215,16 @@ namespace Tnb.ProductionMgr throw new ArgumentException($"{nameof(input.Behavior)},not be null or empty"); } - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); //获取同组工单的Id,一起下发 - var combineMoCodes = await db.Queryable().Where(it => input.WorkOrderIds.Contains(it.id)).Select(it => it.combine_mo_code).ToListAsync(); + List combineMoCodes = await db.Queryable().Where(it => input.WorkOrderIds.Contains(it.id)).Select(it => it.combine_mo_code).ToListAsync(); if (combineMoCodes?.Count > 0) { - var moIds = await db.Queryable().Where(it => combineMoCodes.Contains(it.combine_mo_code) && !input.WorkOrderIds.Contains(it.id)).Select(it => it.id).ToListAsync(); + List moIds = await db.Queryable().Where(it => combineMoCodes.Contains(it.combine_mo_code) && !input.WorkOrderIds.Contains(it.id)).Select(it => it.id).ToListAsync(); input.WorkOrderIds = input.WorkOrderIds.Concat(moIds).ToList(); } - string getMoStatus(MoBehavior behavior) + static string getMoStatus(MoBehavior behavior) { string status = ""; switch (behavior) @@ -238,13 +238,13 @@ namespace Tnb.ProductionMgr } return status!; } - var behavior = input.Behavior.ToEnum(); - var status = getMoStatus(behavior); - var row = await db.Updateable() + MoBehavior behavior = input.Behavior.ToEnum(); + string status = getMoStatus(behavior); + int row = await db.Updateable() .SetColumns(it => new PrdMo { mo_status = status }) .Where(it => input.WorkOrderIds.Contains(it.id)) .ExecuteCommandAsync(); - return (row > 0); + return row > 0; } // /// // /// 关联同组工单 @@ -312,20 +312,20 @@ namespace Tnb.ProductionMgr .Select((a, b, c) => new { planDate = a.plan_start_date, - mold_code = c.mold_code, + c.mold_code, }).ToListAsync(); - var planDateAll = true; - var moldIdAll = true; + bool planDateAll = true; + bool moldIdAll = true; if (list?.Count > 0) { - var planDate = list.FirstOrDefault()?.planDate; - var moldCode = list.FirstOrDefault()?.mold_code; + DateTime? planDate = list.FirstOrDefault()?.planDate; + string? moldCode = list.FirstOrDefault()?.mold_code; planDateAll = list.All(x => x.planDate == planDate); moldIdAll = moldCode != null && list.All(x => x.mold_code == moldCode); if (planDateAll && moldIdAll) { - var groupId = SnowflakeIdHelper.NextId(); + string groupId = SnowflakeIdHelper.NextId(); multi.executeRes = await _repository.AsSugarClient().Updateable() .SetColumns(c => new PrdMo { combine_mo_code = groupId }) .Where(it => input.WorkOrderIds.Contains(it.id)) @@ -369,7 +369,7 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetPrdMoStatistics(PrdMoStatisticsInput input) { - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.mo_status == b.Id) .LeftJoin((a, b, c) => a.material_id == c.id) .WhereIF(!string.IsNullOrEmpty(input.mo_status), (a, b) => b.EnCode == input.mo_status) @@ -420,9 +420,9 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task PrdMoFromOneList(PrdMoFromQueryInput input) { - List ids = new List(); - List ids1 = new List(); - List ids2 = new List(); + List ids = new(); + List ids1 = new(); + List ids2 = new(); if (!string.IsNullOrEmpty(input.mo_task_code)) { ids1 = await _db.Queryable().Where(x => x.mo_task_code.Contains(x.mo_task_code)).Select(x => x.mo_id).ToListAsync(); @@ -441,7 +441,7 @@ namespace Tnb.ProductionMgr ids = ids1.Intersect(ids2).ToList(); } - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .WhereIF(!string.IsNullOrEmpty(input.mo_code), (a, b) => a.mo_code.Contains(input.mo_code)) .WhereIF(ids != null && ids.Count > 0, (a, b) => ids.Contains(a.id)) @@ -464,7 +464,6 @@ namespace Tnb.ProductionMgr /// /// 工单追溯二级列表 /// - /// /// [HttpPost] public async Task PrdMoFromTwoList(PrdMoFromTwoQueryInput prdMoFromTwoQueryInput) @@ -472,16 +471,15 @@ namespace Tnb.ProductionMgr string mo_id = prdMoFromTwoQueryInput.mo_id ?? ""; string mo_task_code = prdMoFromTwoQueryInput.mo_task_code ?? ""; string barcode = prdMoFromTwoQueryInput.barcode ?? ""; - List ids = new List(); + List ids = new(); if (!string.IsNullOrEmpty(barcode)) { ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); } PrdMo prdMo = await _repository.GetSingleAsync(x => x.id == mo_id); - if (prdMo.mo_type is DictConst.PrdMoTypeZS or DictConst.PrdMoTypeJC) - { - return await _db.Queryable() + return prdMo.mo_type is DictConst.PrdMoTypeZS or DictConst.PrdMoTypeJC + ? await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.eqp_id == c.ObjectId && c.ObjectType == "Eqp") .LeftJoin((a, b, c, d) => c.OrganizeId == d.Id) @@ -504,11 +502,8 @@ namespace Tnb.ProductionMgr workshop_name = e.FullName, station_name = d.FullName, equip_code = f.code - }).ToListAsync(); - } - else - { - return await _db.Queryable() + }).ToListAsync() + : (dynamic)await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.workline_id == c.Id) .LeftJoin((a, b, c, d) => a.bom_id == d.id) @@ -529,14 +524,12 @@ namespace Tnb.ProductionMgr workline_name = c.FullName, mbom_version = d.version }).ToListAsync(); - } } /// /// 工单追溯三级级列表 /// - /// /// [HttpPost] public async Task PrdMoFromThreeList(PrdMoFromThreeQueryInput prdMoFromThreeQueryInput) @@ -544,7 +537,7 @@ namespace Tnb.ProductionMgr string mo_task_id = prdMoFromThreeQueryInput.mo_task_id ?? ""; string mo_task_code = prdMoFromThreeQueryInput.mo_task_code ?? ""; string barcode = prdMoFromThreeQueryInput.barcode ?? ""; - List ids = new List(); + List ids = new(); if (!string.IsNullOrEmpty(barcode)) { ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); @@ -574,7 +567,7 @@ namespace Tnb.ProductionMgr }).Mapper(x => { List orgId1 = orgs.Where(y => y.OrganizeIdTree.Contains(x.workline_id)).Select(y => y.Id).ToList(); - string station_id = orgIds.Intersect(orgId1)?.FirstOrDefault(); + string? station_id = orgIds.Intersect(orgId1)?.FirstOrDefault(); if (!string.IsNullOrEmpty(station_id)) { x.station_name = orgs.FirstOrDefault(y => y.Id == station_id)?.FullName; @@ -586,14 +579,13 @@ namespace Tnb.ProductionMgr /// /// 工单追溯人列表 /// - /// /// [HttpPost] public async Task PrdMoFromManList(PrdMoFromTabQueryInput prdMoFromTabQueryInput) { string mo_task_id = prdMoFromTabQueryInput.mo_task_id ?? ""; string barcode = prdMoFromTabQueryInput.barcode ?? ""; - List ids = new List(); + List ids = new(); if (!string.IsNullOrEmpty(barcode)) { ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); @@ -621,14 +613,13 @@ namespace Tnb.ProductionMgr /// /// 工单追溯机列表 /// - /// /// [HttpPost] public async Task PrdMoFromEquipList(PrdMoFromTabQueryInput prdMoFromTabQueryInput) { string mo_task_id = prdMoFromTabQueryInput.mo_task_id ?? ""; string barcode = prdMoFromTabQueryInput.barcode ?? ""; - List ids = new List(); + List ids = new(); if (!string.IsNullOrEmpty(barcode)) { ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); @@ -649,14 +640,13 @@ namespace Tnb.ProductionMgr /// /// 工单追溯料列表 /// - /// /// [HttpPost] public async Task PrdMoFromMaterialList(PrdMoFromTabQueryInput prdMoFromTabQueryInput) { string mo_task_id = prdMoFromTabQueryInput.mo_task_id ?? ""; string barcode = prdMoFromTabQueryInput.barcode ?? ""; - List ids = new List(); + List ids = new(); if (!string.IsNullOrEmpty(barcode)) { ids = await _db.Queryable().Where(x => x.barcode.Contains(barcode)).Select(x => x.mo_task_id).ToListAsync(); @@ -671,9 +661,8 @@ namespace Tnb.ProductionMgr */ if (string.IsNullOrEmpty(barcode)) { - if (prdMoTask.schedule_type == 1) - { - return await _db.Queryable() + return prdMoTask.schedule_type == 1 + ? await _db.Queryable() .LeftJoin((a, b) => a.id == b.ebom_id) .LeftJoin((a, b, c) => b.material_id == c.id) .Where((a, b, c) => a.id == prdMoTask.ebom_id) @@ -681,11 +670,8 @@ namespace Tnb.ProductionMgr { material_code = c.code, material_name = c.name, - }).ToListAsync(); - } - else - { - return await _db.Queryable() + }).ToListAsync() + : (dynamic)await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .Where((a, b) => a.mbom_id == prdMoTask.bom_id) .Select((a, b) => new PrdMoFromMaterialListOutput() @@ -693,20 +679,19 @@ namespace Tnb.ProductionMgr material_code = b.code, material_name = b.name, }).ToListAsync(); - } } else { PrdReport prdReport = await _db.Queryable().Where(x => x.barcode == barcode).FirstAsync(); List prdReports = await _db.Queryable().Where(x => x.create_time <= prdReport.create_time && x.barcode != barcode && x.mo_task_id == mo_task_id).ToListAsync(); int? beforeReportNum = prdReports.Sum(x => x.reported_qty); - List prdFeedingIds = new List(); + List prdFeedingIds = new(); if (prdMoTask.schedule_type == 1) { BasEbomH basEbomH = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.ebom_id); List basEbomDs = await _db.Queryable().Where(x => x.ebom_id == prdMoTask.ebom_id).ToListAsync(); - foreach (var item in basEbomDs) + foreach (BasEbomD item in basEbomDs) { decimal? num1 = beforeReportNum / basEbomH.quantity * item.quantity; List prdFeedingDs = await _db.Queryable() @@ -716,7 +701,7 @@ namespace Tnb.ProductionMgr .Select((a, b) => a).ToListAsync(); decimal sum1 = 0; decimal sum2 = 0; - foreach (var prdFeedingD in prdFeedingDs) + foreach (PrdFeedingD prdFeedingD in prdFeedingDs) { if (sum1 <= num1) { @@ -760,11 +745,15 @@ namespace Tnb.ProductionMgr List basMbomInputs = await _db.Queryable().Where(x => x.mbom_process_id == prdMoTask.mbom_process_id).ToListAsync(); BasMbom basMbom = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.bom_id); BasMbomProcess basMbomProcess = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); - List lastPrdReportIds = new List(); - foreach (var item in basMbomInputs) + List lastPrdReportIds = new(); + foreach (BasMbomInput item in basMbomInputs) { BasMbomOutput basMbomOutput = await _db.Queryable().Where(x => x.mbom_process_id == basMbomProcess.id && x.material_id == prdMoTask.material_id).FirstAsync(); - if (basMbomOutput == null) break; + if (basMbomOutput == null) + { + break; + } + decimal? num1 = beforeReportNum / Convert.ToDecimal(basMbomOutput.num) * item.num; List prdFeedingDs = await _db.Queryable() .LeftJoin((a, b) => a.feeding_id == b.id) @@ -774,22 +763,28 @@ namespace Tnb.ProductionMgr if (prdFeedingDs == null || prdFeedingDs.Count <= 0) { - if (string.IsNullOrEmpty(basMbomProcess.last_process_no)) continue; + if (string.IsNullOrEmpty(basMbomProcess.last_process_no)) + { + continue; + } List lastBasMbomProcesses = await _db.Queryable().Where(x => x.no == basMbomProcess.last_process_no && x.mbom_id == prdMoTask.bom_id).ToListAsync(); - foreach (var lastBasMbomProcess in lastBasMbomProcesses) + foreach (BasMbomProcess lastBasMbomProcess in lastBasMbomProcesses) { List lastPrdReports = await _db.Queryable() .Where(x => x.mbom_process_id == lastBasMbomProcess.id && x.material_id == item.material_id) .OrderBy(x => x.create_time) .ToListAsync(); - if (lastPrdReports == null || lastPrdReports.Count <= 0) continue; + if (lastPrdReports == null || lastPrdReports.Count <= 0) + { + continue; + } PrdMoTask lastPrdMoTask = await _db.Queryable().FirstAsync(x => x.mo_id == prdMo.id && x.mbom_process_id == lastBasMbomProcess.id); decimal sum1 = 0; decimal sum2 = 0; - foreach (var lastPrdReport in lastPrdReports) + foreach (PrdReport lastPrdReport in lastPrdReports) { if (sum1 <= num1) { @@ -817,7 +812,7 @@ namespace Tnb.ProductionMgr { decimal sum1 = 0; decimal sum2 = 0; - foreach (var prdFeedingD in prdFeedingDs) + foreach (PrdFeedingD prdFeedingD in prdFeedingDs) { if (sum1 <= num1) { @@ -839,7 +834,7 @@ namespace Tnb.ProductionMgr } } - var queryable1 = _db.Queryable() + ISugarQueryable queryable1 = _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.material_receipt_detail_id == c.id) .LeftJoin((a, b, c, d) => c.supplier_id == d.id) @@ -859,7 +854,7 @@ namespace Tnb.ProductionMgr if (lastPrdReportIds != null && lastPrdReportIds.Count > 0) { - var queryable2 = _db.Queryable() + ISugarQueryable queryable2 = _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .Where((a, b) => lastPrdReportIds.Contains(a.id)) .Select((a, b) => new PrdMoFromMaterialListOutput() @@ -889,25 +884,24 @@ namespace Tnb.ProductionMgr /// /// 物料反向追溯物料信息 /// - /// /// [HttpPost] public async Task PrdMoReverseFromMaterialInfo(PrdMoReverseFromQueryInput prdMoReverseFromQueryInput) { string barcode = prdMoReverseFromQueryInput.barcode ?? ""; string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - Dictionary postData = new Dictionary() + Dictionary postData = new() { ["org_id"] = _userManager.GetUserInfo().Result.organizeId, ["barcode"] = new List() { barcode }, ["currentPage"] = 1, ["pageSize"] = int.MaxValue, }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE, JsonConvert.SerializeObject(postData), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE, JsonConvert.SerializeObject(postData), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -946,7 +940,6 @@ namespace Tnb.ProductionMgr /// /// 物料反向追溯投料信息 /// - /// /// [HttpPost] public async Task PrdMoReverseFromFeedingInfo(PrdMoReverseFromQueryInput prdMoReverseFromQueryInput) @@ -958,7 +951,7 @@ namespace Tnb.ProductionMgr .Where(a => a.barcode == barcode) .Select((a, b, c) => c.mo_task_id).ToListAsync(); - var result = await _db.Queryable() + List result = await _db.Queryable() .LeftJoin((a, b) => a.mo_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .Where((a, b, c) => ids.Contains(a.id)) @@ -998,14 +991,17 @@ namespace Tnb.ProductionMgr /// /// 物料反向追溯产出信息 /// - /// /// [HttpPost] public async Task PrdMoReverseFromOutInfo(PrdMoReverseFromOutInfoQueryInput prdMoReverseFromOutInfoQueryInput) { string feeding_detail_id = prdMoReverseFromOutInfoQueryInput.feeding_detail_id ?? ""; PrdFeedingD prdFeedingD = await _db.Queryable().FirstAsync(x => x.id == feeding_detail_id); - if (prdFeedingD.use_num <= 0) return Array.Empty(); + if (prdFeedingD.use_num <= 0) + { + return Array.Empty(); + } + PrdFeedingH prdFeedingH = await _db.Queryable().FirstAsync(x => x.id == prdFeedingD.feeding_id); PrdMoTask prdMoTask = await _db.Queryable().FirstAsync(x => x.id == prdFeedingH.mo_task_id); List prdFeedingDs = await _db.Queryable() @@ -1013,7 +1009,7 @@ namespace Tnb.ProductionMgr .Where((a, b) => a.material_id == prdFeedingD.material_id && b.mo_task_id == prdFeedingH.mo_task_id && b.create_time <= prdFeedingH.create_time && a.id != prdFeedingD.id) .Select((a, b) => a).ToListAsync(); decimal beforeIn = prdFeedingDs.Sum(x => x.num); - List reportIds = new List(); + List reportIds = new(); if (prdMoTask.schedule_type == 1) { BasEbomH basEbomH = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.ebom_id); @@ -1026,9 +1022,9 @@ namespace Tnb.ProductionMgr { bool flag = true; decimal residueNeed = 0; - foreach (var prdReport in prdReports) + foreach (PrdReport prdReport in prdReports) { - var needNum = (prdReport.reported_qty ?? 0) / basEbomH.quantity * basEbomD.quantity; + decimal needNum = (prdReport.reported_qty ?? 0) / basEbomH.quantity * basEbomD.quantity; if (beforeIn - needNum >= 0) { beforeIn -= needNum; @@ -1088,7 +1084,7 @@ namespace Tnb.ProductionMgr if (prdReports != null && prdReports.Count > 0) { - List mbomProcesssIds = new List() { prdMoTask.mbom_process_id }; + List mbomProcesssIds = new() { prdMoTask.mbom_process_id }; BasMbomProcess startMbomProcess = await _db.Queryable().Where(x => x.id == prdMoTask.mbom_process_id).FirstAsync(); List allMbomProcesses = await _db.Queryable().Where(x => x.mbom_id == prdMoTask.bom_id).ToListAsync(); string startNo = startMbomProcess.next_process_no; @@ -1128,7 +1124,7 @@ namespace Tnb.ProductionMgr .Select((a, b) => b).ToListAsync(); decimal? needNum = 1;//一个最终物料需要本任务单投入物料的数量 - string tempMaterialId = outputList.FirstOrDefault(x => x.mbom_process_id == mbomProcesssIds[mbomProcesssIds.Count - 1])?.material_id; + string? tempMaterialId = outputList.FirstOrDefault(x => x.mbom_process_id == mbomProcesssIds[^1])?.material_id; for (int i = mbomProcesssIds.Count - 1; i > 0; i--) { @@ -1150,7 +1146,7 @@ namespace Tnb.ProductionMgr bool flag = true; decimal residueNeed = 0; - foreach (var prdReport in prdReports) + foreach (PrdReport prdReport in prdReports) { decimal needNumTotal = prdReport.reported_qty * needNum ?? 0; if (beforeIn - needNumTotal >= 0) @@ -1202,18 +1198,18 @@ namespace Tnb.ProductionMgr List barCodes = await _db.Queryable().Where(x => reportIds.Contains(x.id)).Select(x => x.barcode).ToListAsync(); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - Dictionary postData = new Dictionary() + Dictionary postData = new() { ["org_id"] = _userManager.GetUserInfo().Result.organizeId, ["barcode"] = barCodes, ["currentPage"] = 1, ["pageSize"] = int.MaxValue, }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE, JsonConvert.SerializeObject(postData), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_FETCH_IN_OUT_STOCK_INFO_BY_BAR_CODE, JsonConvert.SerializeObject(postData), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -1227,7 +1223,7 @@ namespace Tnb.ProductionMgr PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(), new Tnb.Common.Utils.DateTimeJsonConverter()); if (output.list != null && output.list.Count > 0) { - foreach (var item in output.list) + foreach (PrdMoReverseFromOutput item in output.list) { item.material_name = basMaterial.name; } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs index 6aa2a463..9d17bad3 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs @@ -92,11 +92,11 @@ namespace Tnb.ProductionMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string moTaskCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string moTaskStatus = queryJson.ContainsKey("mo_task_status") ? queryJson["mo_task_status"].ToString() : ""; - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => c.EnCode == DictConst.TaskStatus) .LeftJoin((a, b, c, d) => c.Id == d.DictionaryTypeId && a.mo_task_status == d.EnCode) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index cfb0f976..b4da378d 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -48,9 +48,9 @@ namespace Tnb.ProductionMgr private readonly IDictionaryDataService _dictionaryDataService; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; - private static Dictionary _dicDefect = new Dictionary(); - private static Dictionary _dicWorkLine = new Dictionary(); - private static Dictionary _dicProcess = new Dictionary(); + private static Dictionary _dicDefect = new(); + private static readonly Dictionary _dicWorkLine = new(); + private static readonly Dictionary _dicProcess = new(); private readonly ISqlSugarClient _db; private readonly IBillRullService _billRuleService; private readonly IPrdInstockService _prdInstockService; @@ -86,7 +86,6 @@ namespace Tnb.ProductionMgr /// /// 根据产品ID获取模具列表 /// - /// 产品ID /// /// ///
return results: @@ -103,7 +102,7 @@ namespace Tnb.ProductionMgr [HttpGet("{materialId}")] public async Task GetMoldListByItemId(string materialId) { - var result = new List(); + List result = new(); result = await _db.Queryable() .InnerJoin((a, b) => a.mold_id == b.id) .InnerJoin((a, b, c) => a.material_id == c.id) @@ -128,7 +127,7 @@ namespace Tnb.ProductionMgr [HttpGet("{moldId}")] public async Task GetEquipmentListByMoldId(string moldId) { - var items = await _db.Queryable().InnerJoin((a, b) => a.equipment_id == b.id) + List items = await _db.Queryable().InnerJoin((a, b) => a.equipment_id == b.id) .Where((a, b) => a.mold_id == moldId) .Select((a, b) => new Entities.Dto.EquipmentListOutput { @@ -169,8 +168,8 @@ namespace Tnb.ProductionMgr [HttpGet("{eqpId}")] public async Task PrdTaskSort(string eqpId) { - var taskStatusDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); - var list = await _repository.AsSugarClient().Queryable() + Dictionary taskStatusDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + List list = await _repository.AsSugarClient().Queryable() .LeftJoin((a, b) => a.mo_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .LeftJoin((a, b, c, d) => a.mold_id == d.id) @@ -187,7 +186,7 @@ namespace Tnb.ProductionMgr mold_code = d.mold_code, }) .ToListAsync(); - var data = list.Select((x, idx) => new PrdTaskSortOutput + List data = list.Select((x, idx) => new PrdTaskSortOutput { no = idx + 1, mo_status_code = x.mo_status_code, @@ -209,9 +208,9 @@ namespace Tnb.ProductionMgr [HttpGet("{taskId}")] public async Task GetMoOperRecord(string taskId) { - var list = await _repository.AsSugarClient().Queryable().Where(it => it.mo_task_id == taskId).ToListAsync(); - var data = list.Adapt>(); - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + List list = await _repository.AsSugarClient().Queryable().Where(it => it.mo_task_id == taskId).ToListAsync(); + List data = list.Adapt>(); + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); _repository.AsSugarClient().ThenMapper(data, x => { x.statusName = dic.ContainsKey(x.status) ? dic[x.status].ToString() : x.status; @@ -227,15 +226,15 @@ namespace Tnb.ProductionMgr [HttpGet("{moTaskId}")] public async Task GetScarpStatRecord(string moTaskId) { - var output = new PrdMoTaskDefectOutput(); - var db = _repository.AsSugarClient(); + PrdMoTaskDefectOutput output = new(); + ISqlSugarClient db = _repository.AsSugarClient(); if (_dicDefect.Count < 1) { _dicDefect = await db.Queryable().ToDictionaryAsync(x => x.id, x => x.defect_type_name); } output.mo_task_code = (await db.Queryable().FirstAsync(it => it.id == moTaskId))?.mo_task_code; - var defects = await db.Queryable().Where(it => it.mo_task_id == moTaskId).ToListAsync(); - var users = await db.Queryable().ToListAsync(); + List defects = await db.Queryable().Where(it => it.mo_task_id == moTaskId).ToListAsync(); + List users = await db.Queryable().ToListAsync(); if (defects?.Count > 0) { output.batchItems = defects.GroupBy(g => new { g.batch, g.create_id }).Select(t => new BatchItem @@ -263,6 +262,7 @@ namespace Tnb.ProductionMgr /// 根据工单Id获取任务单列表 ///
/// + /// /// /// output: ///
{ @@ -285,10 +285,9 @@ namespace Tnb.ProductionMgr public async Task GetPrdTaskInfoByMoId(string moId, int schedType = 1) { List result = new(); - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); - if (schedType == 1) - { - result = await _db.Queryable().LeftJoin((a, b) => a.mo_id == b.id) + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + result = schedType == 1 + ? await _db.Queryable().LeftJoin((a, b) => a.mo_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .LeftJoin((a, b, c, d) => a.mold_id == d.id) .LeftJoin((a, b, c, d, e) => a.eqp_id == e.id) @@ -318,11 +317,8 @@ namespace Tnb.ProductionMgr { it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : ""; }) - .ToListAsync(); - } - else - { - result = await _db.Queryable().LeftJoin((a, b) => a.mo_id == b.id) + .ToListAsync() + : await _db.Queryable().LeftJoin((a, b) => a.mo_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .LeftJoin((a, b, c, d) => a.workline_id == d.Id) .LeftJoin((a, b, c, d, e) => a.process_id == e.id) @@ -350,7 +346,6 @@ namespace Tnb.ProductionMgr it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString()! : ""; }) .ToListAsync(); - } return result; @@ -362,8 +357,8 @@ namespace Tnb.ProductionMgr [HttpGet] public async Task GetPackScheldToBeIssueList([FromQuery] PackScheldToBeIssueListInput input) { - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); - var result = await _db.Queryable() + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + List result = await _db.Queryable() .LeftJoin((a, b) => a.workline_id == b.Id) .LeftJoin((a, b, c) => a.mo_id == c.id) .LeftJoin((a, b, c, d) => a.bom_id == d.id) @@ -402,8 +397,8 @@ namespace Tnb.ProductionMgr [HttpGet("{mo_task_id}")] public async Task GetSubMoTaskListByTaskId(string mo_task_id) { - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); - var result = await _db.Queryable() + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + List result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.workline_id == c.Id) .LeftJoin((a, b, c, d) => a.mo_id == d.id) @@ -522,21 +517,21 @@ namespace Tnb.ProductionMgr [HttpGet] public async Task GetUnSchedulingList([FromQuery] VisualDevModelListQueryInput input) { - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); - List moStatusList = new List(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + List moStatusList = new(); if (queryJson != null && queryJson.ContainsKey("mo_stauts")) { moStatusList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(queryJson["mo_status"])); } - List moTypeList = new List(); + List moTypeList = new(); if (queryJson != null && queryJson.ContainsKey("mo_type")) { moTypeList = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(queryJson["mo_type"])); } - string moCode = queryJson != null && queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : ""; - string combineMoCode = queryJson != null && queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : ""; - var db = _repository.AsSugarClient(); - var result = await db.Queryable() + string? moCode = queryJson != null && queryJson.ContainsKey("mo_code") ? queryJson["mo_code"].ToString() : ""; + string? combineMoCode = queryJson != null && queryJson.ContainsKey("combine_mo_code") ? queryJson["combine_mo_code"].ToString() : ""; + ISqlSugarClient db = _repository.AsSugarClient(); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mo_type == c.Id) .LeftJoin((a, b, c, d) => a.mo_status == d.Id) @@ -649,17 +644,20 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task ProductionScheduling(ProductionSchedulingCrInput input) { - var db = _repository.AsSugarClient(); - var row = -1; + ISqlSugarClient db = _repository.AsSugarClient(); + int row = -1; if (input.schedule_type.HasValue) { if (input.schedule_type.Value == 1) //注塑、基础排产 { - var mo = await db.Queryable().FirstAsync(it => it.id == input.mo_id); - BasMbomProcess basMbomProcess = null; + PrdMo? mo = await db.Queryable().FirstAsync(it => it.id == input.mo_id); + BasMbomProcess? basMbomProcess = null; if (!string.IsNullOrEmpty(input.bom_id)) + { basMbomProcess = await db.Queryable().FirstAsync(x => x.mbom_id == input.bom_id); - var moTask = input.Adapt(); + } + + PrdMoTask moTask = input.Adapt(); moTask.id = SnowflakeIdHelper.NextId(); moTask.create_id = _userManager.UserId; moTask.create_time = DateTime.Now; @@ -676,8 +674,8 @@ namespace Tnb.ProductionMgr moTask.workstation_id = organizeRelationEntity?.OrganizeId ?? ""; } - var moCode = mo?.mo_code; - var taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE); + string? moCode = mo?.mo_code; + string taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE); moTask.mo_task_code = taskCode; // var taskCode = await db.Queryable().Where(it => !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)).OrderByDescending(it => it.mo_task_code).Select(it => it.mo_task_code).FirstAsync(); // if (taskCode.IsNullOrEmpty()) @@ -701,15 +699,17 @@ namespace Tnb.ProductionMgr row = await db.Insertable(moTask).ExecuteCommandAsync(); #region 质检模块 //质检 - TriggerPlanEntity entity = new TriggerPlanEntity(); - entity.materialid = moTask.material_id; - entity.processid = moTask.process_id; - entity.workid = moTask.workstation_id; - entity.triggerevent = EnumTriggerEvent.首件检新的生产任务; + TriggerPlanEntity entity = new() + { + materialid = moTask.material_id, + processid = moTask.process_id, + workid = moTask.workstation_id, + triggerevent = EnumTriggerEvent.首件检新的生产任务 + }; await _qcCheckPlanService.CreateTask(entity); #endregion //根据工单号获取当前工单包含的已排产数 - var schedQty = db.Queryable().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty); + int? schedQty = db.Queryable().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty); if (mo != null) {//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产 @@ -724,38 +724,35 @@ namespace Tnb.ProductionMgr // } // row = await db.Updateable(mo).ExecuteCommandAsync(); - if (mo.scheduled_qty == null) - { - await _db.Updateable() + _ = mo.scheduled_qty == null + ? await _db.Updateable() .SetColumns(x => x.mo_status == DictConst.AlreadyId) .SetColumns(x => x.scheduled_qty == input.scheduled_qty) .Where(x => x.id == mo.id) - .ExecuteCommandAsync(); - } - else - { - await _db.Updateable().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty) + .ExecuteCommandAsync() + : await _db.Updateable().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty) .Where(x => x.id == mo.id) .ExecuteCommandAsync(); - } } - var material = await db.Queryable().FirstAsync(it => it.id == moTask.material_id); + BasMaterial? material = await db.Queryable().FirstAsync(it => it.id == moTask.material_id); - var taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); - taskLog.mo_code = (await db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!; - taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.eqp_id))?.code!; - taskLog.mold_code = (await db.Queryable().FirstAsync(it => it.id == input.mold_id))?.mold_code!; - taskLog.item_code = material?.code!; - taskLog.item_standard = material?.material_standard!; - taskLog.status = DictConst.ToBeScheduledEncode; - taskLog.operator_name = _userManager.RealName; - taskLog.create_id = _userManager.UserId; - taskLog.create_time = DateTime.Now; - taskLog.mo_task_id = moTask.id; - taskLog.mo_task_code = moTask.mo_task_code; + PrdTaskLog taskLog = new() + { + id = SnowflakeIdHelper.NextId(), + mo_code = (await db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!, + eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.eqp_id))?.code!, + mold_code = (await db.Queryable().FirstAsync(it => it.id == input.mold_id))?.mold_code!, + item_code = material?.code!, + item_standard = material?.material_standard!, + status = DictConst.ToBeScheduledEncode, + operator_name = _userManager.RealName, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = moTask.id, + mo_task_code = moTask.mo_task_code + }; - await db.Insertable(taskLog).ExecuteCommandAsync(); + _ = await db.Insertable(taskLog).ExecuteCommandAsync(); //将生产任务插入到自检报废记录表 //var sacipRecord = new PrdMoTaskDefectRecord(); //sacipRecord.id = SnowflakeIdHelper.NextId(); @@ -776,7 +773,7 @@ namespace Tnb.ProductionMgr await db.Ado.CommitTranAsync(); } - catch (Exception ex) + catch (Exception) { await db.Ado.RollbackTranAsync(); } @@ -798,11 +795,11 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task PackSchedling(PackSchedlingCrInput input) { - var row = -1; + int row = -1; try { await _db.Ado.BeginTranAsync(); - var moTask = input.Adapt(); + PrdMoTask moTask = input.Adapt(); moTask.id = SnowflakeIdHelper.NextId(); moTask.create_id = _userManager.UserId; moTask.bom_id = input.bom_id; @@ -814,14 +811,14 @@ namespace Tnb.ProductionMgr moTask.estimated_start_date = input.estimated_start_date; moTask.estimated_end_date = input.estimated_end_date; moTask.scheduled_qty = input.scheduled_qty; - var mo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id); + PrdMo? mo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id); // moTask.unit_id = mo.unit_id; - var moCode = mo?.mo_code; + string? moCode = mo?.mo_code; // var taskCode = await _db.Queryable().Where(it => string.IsNullOrEmpty(it.parent_id) && !string.IsNullOrEmpty(it.mo_task_code) && it.mo_task_code.Contains(moCode)) // .OrderByDescending(it => it.mo_task_code) // .Select(it => it.mo_task_code) // .FirstAsync(); - var taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE); + string taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE); moTask.mo_task_code = taskCode; // if (taskCode is null || taskCode.IsNullOrEmpty()) // { @@ -841,28 +838,32 @@ namespace Tnb.ProductionMgr row = await _db.Insertable(moTask).ExecuteCommandAsync(); #region 质检模块 //质检 - TriggerPlanEntity entity = new TriggerPlanEntity(); - entity.materialid = moTask.material_id; - entity.processid = moTask.process_id; - entity.workid = moTask.workstation_id; - entity.triggerevent = EnumTriggerEvent.首件检新的生产任务; + TriggerPlanEntity entity = new() + { + materialid = moTask.material_id, + processid = moTask.process_id, + workid = moTask.workstation_id, + triggerevent = EnumTriggerEvent.首件检新的生产任务 + }; await _qcCheckPlanService.CreateTask(entity); #endregion - var material_h = await _db.Queryable().FirstAsync(it => it.id == moTask.material_id); + BasMaterial? material_h = await _db.Queryable().FirstAsync(it => it.id == moTask.material_id); //添加生产任务操作记录日志 - var taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); - taskLog.mo_code = (await _db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!; - taskLog.item_code = material_h?.code!; - taskLog.item_standard = material_h?.material_standard!; - taskLog.status = DictConst.ToBeScheduledEncode; - taskLog.operator_name = _userManager.RealName; - taskLog.create_id = _userManager.UserId; - taskLog.create_time = DateTime.Now; - taskLog.mo_task_id = moTask.id; - taskLog.mo_task_code = moTask.mo_task_code!; + PrdTaskLog taskLog = new() + { + id = SnowflakeIdHelper.NextId(), + mo_code = (await _db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!, + item_code = material_h?.code!, + item_standard = material_h?.material_standard!, + status = DictConst.ToBeScheduledEncode, + operator_name = _userManager.RealName, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = moTask.id, + mo_task_code = moTask.mo_task_code! + }; row = await _db.Insertable(taskLog).ExecuteCommandAsync(); //将生产任务插入到自检报废记录表 //var sacipRecord = new PrdMoTaskDefectRecord(); @@ -883,7 +884,7 @@ namespace Tnb.ProductionMgr //await db.Insertable(sacipRecord).ExecuteCommandAsync(); //根据工单号获取当前工单包含的已排产数 - var schedQty = _db.Queryable().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty); + int? schedQty = _db.Queryable().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty); // if (mo != null) // {//判断如果当前 工单的已排产数大于工单计划数量则更新工单状态为 已排产 // if (schedQty.HasValue && schedQty.Value >= mo.plan_qty) @@ -903,23 +904,18 @@ namespace Tnb.ProductionMgr if (mo != null) { - if (mo.scheduled_qty == null) - { - await _db.Updateable() + _ = mo.scheduled_qty == null + ? await _db.Updateable() .SetColumns(x => x.mo_status == DictConst.AlreadyId) .SetColumns(x => x.scheduled_qty == input.scheduled_qty) .Where(x => x.id == mo.id) - .ExecuteCommandAsync(); - } - else - { - await _db.Updateable().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty) + .ExecuteCommandAsync() + : await _db.Updateable().SetColumns(x => x.scheduled_qty == x.scheduled_qty + input.scheduled_qty) .Where(x => x.id == mo.id) .ExecuteCommandAsync(); - } } - var subTaskList = await _db.Queryable() + List subTaskList = await _db.Queryable() .LeftJoin((a, b) => a.id == b.mbom_id) .LeftJoin((a, b, c) => a.route_id == c.id) // .LeftJoin((a, b, c, d) => b.process_id == d.process_id && c.id == d.route_id) @@ -949,24 +945,26 @@ namespace Tnb.ProductionMgr List subMoTasks = new(); List subMoTaskLogs = new(); - foreach (var item in subTaskList) + foreach (SubBomListOutput? item in subTaskList) { BasMbomProcess basMbomProcess = await _db.Queryable().SingleAsync(x => x.id == item.mbom_process_id); - List mbomProcessStationIds = JsonConvert.DeserializeObject(basMbomProcess.station).Select(x => x[x.Length - 1]).ToList(); + List mbomProcessStationIds = JsonConvert.DeserializeObject(basMbomProcess.station).Select(x => x[^1]).ToList(); List? resultList = workstationIds.Intersect(mbomProcessStationIds).ToList(); - PrdMoTask subMoTask = new(); - subMoTask.mo_id = input.mo_id; - subMoTask.material_id = item.material_id; - subMoTask.schedule_type = 2; - subMoTask.parent_id = moTask.id; - subMoTask.bom_id = input.bom_id; - subMoTask.process_id = item.process_id; - subMoTask.mbom_process_id = item.mbom_process_id; - subMoTask.workstation_id = resultList?.FirstOrDefault() ?? ""; - subMoTask.mo_task_status = DictConst.ToBeScheduledEncode; - subMoTask.workroute_id = item.route_id; - subMoTask.workline_id = input.workline_id; + PrdMoTask subMoTask = new() + { + mo_id = input.mo_id, + material_id = item.material_id, + schedule_type = 2, + parent_id = moTask.id, + bom_id = input.bom_id, + process_id = item.process_id, + mbom_process_id = item.mbom_process_id, + workstation_id = resultList?.FirstOrDefault() ?? "", + mo_task_status = DictConst.ToBeScheduledEncode, + workroute_id = item.route_id, + workline_id = input.workline_id + }; subMoTask.material_id = item.material_id; subMoTask.scheduled_qty = input.scheduled_qty; subMoTask.process_task_qty = item.output_qty * moTask.scheduled_qty; @@ -976,8 +974,8 @@ namespace Tnb.ProductionMgr subMoTask.create_time = DateTime.Now; subMoTasks.Add(subMoTask); - var subTaskLog = new PrdTaskLog(); - var subMaterial = await _db.Queryable().SingleAsync(x => x.id == item.material_id); + PrdTaskLog subTaskLog = new(); + BasMaterial? subMaterial = await _db.Queryable().SingleAsync(x => x.id == item.material_id); subTaskLog.id = SnowflakeIdHelper.NextId(); subTaskLog.mo_code = (await _db.Queryable().FirstAsync(it => it.id == input.mo_id))?.mo_code!; subTaskLog.item_code = subMaterial?.code!; @@ -1000,7 +998,7 @@ namespace Tnb.ProductionMgr } } row = await _db.Insertable(subMoTasks).ExecuteCommandAsync(); - await _db.Insertable(subMoTaskLogs).ExecuteCommandAsync(); + _ = await _db.Insertable(subMoTaskLogs).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); } @@ -1022,7 +1020,7 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task PrdTaskRelease(PrdTaskReleaseUpInput input) { - var row = -1; + int row = -1; if (input is null) { throw new ArgumentNullException(nameof(input)); @@ -1038,19 +1036,23 @@ namespace Tnb.ProductionMgr //var taskList = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && it.mo_task_status == DictConst.ToBeScheduledEncode).ToListAsync(); //if (taskList?.Count > 0) { - string SetTaskStatus(PrdTaskBehavior behavior) => behavior switch + static string SetTaskStatus(PrdTaskBehavior behavior) { - PrdTaskBehavior.Release => DictConst.ToBeStartedEnCode, - PrdTaskBehavior.Start => DictConst.InProgressEnCode, - PrdTaskBehavior.Closed => DictConst.ClosedEnCode, - PrdTaskBehavior.Compled => DictConst.ComplatedEnCode, - PrdTaskBehavior.Pause => DictConst.MoStatusPauseCode, - _ => throw new NotImplementedException(), - }; + return behavior switch + { + PrdTaskBehavior.Release => DictConst.ToBeStartedEnCode, + PrdTaskBehavior.Start => DictConst.InProgressEnCode, + PrdTaskBehavior.Closed => DictConst.ClosedEnCode, + PrdTaskBehavior.Compled => DictConst.ComplatedEnCode, + PrdTaskBehavior.Pause => DictConst.MoStatusPauseCode, + _ => throw new NotImplementedException(), + }; + } + PrdTaskBehavior behavior = input.Behavior.ToEnum(); - var status = SetTaskStatus(behavior); - var db = _repository.AsSugarClient(); - var list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync(); + string status = SetTaskStatus(behavior); + ISqlSugarClient db = _repository.AsSugarClient(); + List? list = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).Select(it => it).ToListAsync(); if (behavior == PrdTaskBehavior.Compled) { // if (list?.Count > 0) @@ -1074,27 +1076,29 @@ namespace Tnb.ProductionMgr - var taskReportLogs = new List(); - var prdTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).ToListAsync(); + List taskReportLogs = new(); + List prdTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.id)).ToListAsync(); if (prdTaskList?.Count > 0) { #region 质检模块 //质检 if (prdTaskList.Where(p => p.mo_task_status == "Pause").Count() > 0 && status == "InProgress") { - foreach (var task in prdTaskList.Where(p => p.mo_task_status == "Pause").ToList()) + foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "Pause").ToList()) { - TriggerPlanEntity entity = new TriggerPlanEntity(); - entity.materialid = task.material_id; - entity.processid = task.process_id; - entity.workid = task.workstation_id; - entity.triggerevent = EnumTriggerEvent.首件检生产任务暂停; + TriggerPlanEntity entity = new() + { + materialid = task.material_id, + processid = task.process_id, + workid = task.workstation_id, + triggerevent = EnumTriggerEvent.首件检生产任务暂停 + }; await _qcCheckPlanService.CreateTask(entity); } } #endregion - foreach (var item in prdTaskList) + foreach (PrdMoTask item in prdTaskList) { switch (behavior) { @@ -1110,7 +1114,7 @@ namespace Tnb.ProductionMgr throw Oops.Bah("已开始的不能再开始"); } - if (item.mo_task_status != DictConst.ToBeStartedEnCode && item.mo_task_status != DictConst.MoStatusPauseCode) + if (item.mo_task_status is not DictConst.ToBeStartedEnCode and not DictConst.MoStatusPauseCode) { throw Oops.Bah("状态错误无法开始"); } @@ -1130,7 +1134,7 @@ namespace Tnb.ProductionMgr { throw Oops.Bah("已完成的不能再完成"); } - if (item.mo_task_status != DictConst.InProgressEnCode && item.mo_task_status != DictConst.MoStatusPauseCode) + if (item.mo_task_status is not DictConst.InProgressEnCode and not DictConst.MoStatusPauseCode) { throw Oops.Bah("状态错误无法完成"); } @@ -1154,15 +1158,18 @@ namespace Tnb.ProductionMgr prdTaskList.ForEach(x => x.act_end_date = DateTime.Now); } row = await db.Updateable(prdTaskList).ExecuteCommandAsync(); - foreach (var item in prdTaskList) + foreach (PrdMoTask item in prdTaskList) { - if (string.IsNullOrEmpty(item.parent_id)) continue; + if (string.IsNullOrEmpty(item.parent_id)) + { + continue; + } //子任务所有状态相同才修改父任务状态 int count1 = await db.Queryable().CountAsync(y => y.parent_id == item.parent_id); int count2 = await db.Queryable().CountAsync(y => y.parent_id == item.parent_id && y.mo_task_status == status); if (count1 == count2) { - await db.Updateable().SetColumns(x => x.mo_task_status == status) + _ = await db.Updateable().SetColumns(x => x.mo_task_status == status) .Where(x => x.id == item.parent_id).ExecuteCommandAsync(); } } @@ -1174,10 +1181,10 @@ namespace Tnb.ProductionMgr if (row > 0) { //更新子任务 - var subMoTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.parent_id)).ToListAsync(); + List subMoTaskList = await db.Queryable().Where(it => input.TaskIds.Contains(it.parent_id)).ToListAsync(); if (subMoTaskList?.Count > 0) { - var subTaskIds = subMoTaskList.Select(it => it.id).ToList(); + List subTaskIds = subMoTaskList.Select(it => it.id).ToList(); row = await db.Updateable() .SetColumns(it => new PrdMoTask { mo_task_status = status }) .Where(it => subTaskIds.Contains(it.id)) @@ -1189,18 +1196,20 @@ namespace Tnb.ProductionMgr } } //插入操作记录日志 - var prdMOTasks = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && string.IsNullOrEmpty(it.parent_id)).ToListAsync(); + List prdMOTasks = await _db.Queryable().Where(it => input.TaskIds.Contains(it.id) && string.IsNullOrEmpty(it.parent_id)).ToListAsync(); if (prdMOTasks?.Count > 0) { List taskLogEntities = new(); - foreach (var taskId in input.TaskIds) + foreach (string taskId in input.TaskIds) { - var taskLog = await db.Queryable().FirstAsync(it => it.mo_task_id == taskId); + PrdTaskLog? taskLog = await db.Queryable().FirstAsync(it => it.mo_task_id == taskId); if (taskLog is null) { - var taskItem = list?.Find(x => x.id == taskId); - taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); + PrdMoTask? taskItem = list?.Find(x => x.id == taskId); + taskLog = new PrdTaskLog + { + id = SnowflakeIdHelper.NextId() + }; if (taskItem != null) { if (taskItem.mo_id!.IsNotEmptyOrNull()) @@ -1217,7 +1226,7 @@ namespace Tnb.ProductionMgr } if (taskItem.material_id!.IsNotEmptyOrNull()) { - var material = await db.Queryable().FirstAsync(it => it.id == taskItem.material_id); + BasMaterial? material = await db.Queryable().FirstAsync(it => it.id == taskItem.material_id); taskLog.item_code = material?.code!; taskLog.item_standard = material?.material_standard!; } @@ -1231,7 +1240,7 @@ namespace Tnb.ProductionMgr } else { - var records = await db.Queryable().Where(it => it.mo_task_id == taskLog.mo_task_id).ToListAsync(); + List records = await db.Queryable().Where(it => it.mo_task_id == taskLog.mo_task_id).ToListAsync(); if (records != null && !records.Select(x => x.status).Contains(status)) { taskLog.id = SnowflakeIdHelper.NextId(); @@ -1249,12 +1258,12 @@ namespace Tnb.ProductionMgr List prdTaskDefectLogs = new(); if (taskReportLogs?.Count > 0) { - foreach (var taskInfo in taskReportLogs) + foreach (PrdMoTask taskInfo in taskReportLogs) { //组装生产提报对象 - var material = (await db.Queryable().FirstAsync(it => it.id == taskInfo.material_id)); - var mo = await db.Queryable().FirstAsync(it => it.id == taskInfo.mo_id); - var record = taskInfo.Adapt(); + BasMaterial? material = await db.Queryable().FirstAsync(it => it.id == taskInfo.material_id); + PrdMo? mo = await db.Queryable().FirstAsync(it => it.id == taskInfo.mo_id); + PrdReportRecord record = taskInfo.Adapt(); record.id = SnowflakeIdHelper.NextId(); record.masterial_code = material?.code; record.masterial_name = material?.name; @@ -1269,39 +1278,41 @@ namespace Tnb.ProductionMgr prdReportLogs.Add(record); //组装自检报废对象 - var sacipRecord = new PrdMoTaskDefectRecord(); - sacipRecord.id = SnowflakeIdHelper.NextId(); - sacipRecord.material_code = material?.code!; - sacipRecord.material_name = material?.name!; - sacipRecord.eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskInfo.eqp_id))?.code!; - sacipRecord.mold_name = (await db.Queryable().FirstAsync(it => it.id == taskInfo.mold_id))?.mold_name!; - sacipRecord.estimated_start_date = taskInfo.estimated_start_date; - sacipRecord.estimated_end_date = taskInfo.estimated_end_date; - sacipRecord.plan_qty = taskInfo.plan_qty; - sacipRecord.scrap_qty = taskInfo.scrap_qty.HasValue ? taskInfo.scrap_qty.Value : 0; - sacipRecord.status = taskInfo.mo_task_status; - sacipRecord.create_id = _userManager.UserId; - sacipRecord.create_time = DateTime.Now; - sacipRecord.mo_task_id = taskInfo.id; - sacipRecord.mo_task_code = taskInfo.mo_task_code; - sacipRecord.mo_task_type = mo?.mo_type; + PrdMoTaskDefectRecord sacipRecord = new() + { + id = SnowflakeIdHelper.NextId(), + material_code = material?.code!, + material_name = material?.name!, + eqp_code = (await db.Queryable().FirstAsync(it => it.id == taskInfo.eqp_id))?.code!, + mold_name = (await db.Queryable().FirstAsync(it => it.id == taskInfo.mold_id))?.mold_name!, + estimated_start_date = taskInfo.estimated_start_date, + estimated_end_date = taskInfo.estimated_end_date, + plan_qty = taskInfo.plan_qty, + scrap_qty = taskInfo.scrap_qty.HasValue ? taskInfo.scrap_qty.Value : 0, + status = taskInfo.mo_task_status, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = taskInfo.id, + mo_task_code = taskInfo.mo_task_code, + mo_task_type = mo?.mo_type + }; sacipRecord.status = taskInfo.mo_task_status; prdTaskDefectLogs.Add(sacipRecord); } } - var reportTaskIds = prdReportLogs.Select(it => it.mo_task_id).ToList(); + List reportTaskIds = prdReportLogs.Select(it => it.mo_task_id).ToList(); if (reportTaskIds?.Count > 0) { - var items = await db.Queryable().Where(it => reportTaskIds.Contains(it.mo_task_id)).ToListAsync(); + List items = await db.Queryable().Where(it => reportTaskIds.Contains(it.mo_task_id)).ToListAsync(); if (items == null || items.Count < 1) { row = await db.Insertable(prdReportLogs).ExecuteCommandAsync(); } } - var defectTaskIds = prdTaskDefectLogs.Select(it => it.mo_task_id).ToList(); + List defectTaskIds = prdTaskDefectLogs.Select(it => it.mo_task_id).ToList(); if (defectTaskIds?.Count > 0) { - var items = await db.Queryable().Where(it => defectTaskIds.Contains(it.mo_task_id)).ToListAsync(); + List items = await db.Queryable().Where(it => defectTaskIds.Contains(it.mo_task_id)).ToListAsync(); if (items == null || items.Count < 1) { row = await db.Insertable(prdTaskDefectLogs).ExecuteCommandAsync(); @@ -1311,7 +1322,7 @@ namespace Tnb.ProductionMgr } //else // throw new AppFriendlyException("只有待下发状态的任务才可下发", 500); - return (row > 0); + return row > 0; } /// @@ -1323,18 +1334,21 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task IcmoModify(IcmoUpInput input) { - var row = -1; - var db = _repository.AsSugarClient(); + int row = -1; + ISqlSugarClient db = _repository.AsSugarClient(); if (input.icmo_id.IsNullOrWhiteSpace()) + { throw new ArgumentNullException(nameof(input.icmo_id)); - var icmoItem = await db.Queryable().FirstAsync(it => it.id == input.icmo_id); + } + + PrdMoTask? icmoItem = await db.Queryable().FirstAsync(it => it.id == input.icmo_id); switch (input.category) { case 1: //设备 if (icmoItem != null) { - var eqpItem = await db.Queryable().FirstAsync(it => it.id == icmoItem.eqp_id); + EqpEquipment eqpItem = await db.Queryable().FirstAsync(it => it.id == icmoItem.eqp_id); icmoItem.eqp_id = eqpItem.id; icmoItem.eqp_type_code = db.Queryable().First(it => it.id == eqpItem.equip_type_id)?.code!; //if (input.scheduled_qty > icmoItem.plan_qty) @@ -1348,7 +1362,7 @@ namespace Tnb.ProductionMgr case 2: //模具 if (icmoItem != null) { - var moldItem = await db.Queryable().FirstAsync(it => it.id == icmoItem.mold_id); + ToolMolds moldItem = await db.Queryable().FirstAsync(it => it.id == icmoItem.mold_id); icmoItem.mold_id = moldItem.id; icmoItem.mold_code = moldItem.mold_code; icmoItem.mold_name = moldItem.mold_name; @@ -1357,7 +1371,7 @@ namespace Tnb.ProductionMgr break; } row = await db.Updateable(icmoItem).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); - return (row > 0); + return row > 0; } // /// @@ -1427,15 +1441,15 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task PrdReport(PrdReportCrInput input) { - var db = _repository.AsSugarClient(); - var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); - var equip = await db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id); - var report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); + ISqlSugarClient db = _repository.AsSugarClient(); + PrdMoTask? prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + EqpEquipment equip = await db.Queryable().SingleAsync(x => x.id == prdMoTask.eqp_id); + PrdReport report = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - var row = -1; - var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); - var mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); + int row = -1; + PrdMo prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); + BasMbomProcess? mbomProcess = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mbom_process_id); if (prdMoTask.mo_task_status == DictConst.MoStatusPauseCode) { @@ -1444,10 +1458,10 @@ namespace Tnb.ProductionMgr if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty) { - var config1 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS); + BasFactoryConfig config1 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS); if (config1?.value == "1") { - var config2 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS_PERCENTAGE); + BasFactoryConfig? config2 = await db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.IS_SURPASS_PERCENTAGE); if (!string.IsNullOrEmpty(config2?.value)) { if ((prdMoTask.reported_work_qty ?? 0) + input.reported_qty > prdMoTask.scheduled_qty * (100 + Convert.ToDecimal(config2?.value ?? "1")) / 100) @@ -1488,61 +1502,48 @@ namespace Tnb.ProductionMgr #region 质检模块 //质检模块 - TriggerPlanEntity entity = new TriggerPlanEntity(); - entity.materialid = prdMoTask.material_id; - entity.processid = prdMoTask.process_id; - entity.workid = prdMoTask.workstation_id; - var reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty; - var scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty; + TriggerPlanEntity entity = new() + { + materialid = prdMoTask.material_id, + processid = prdMoTask.process_id, + workid = prdMoTask.workstation_id + }; + int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty; + int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty; entity.oldpronum = reported + scrap; entity.newpronum = input.reported_qty; entity.triggerevent = EnumTriggerEvent.生产检定量; await _qcCheckPlanService.CreateTask(entity); #endregion - if (prdMoTask.reported_work_qty == null) - { - await db.Updateable() + _ = prdMoTask.reported_work_qty == null + ? await db.Updateable() // .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) .SetColumns(x => x.reported_work_qty == input.reported_qty) // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) - .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync() + : await db.Updateable() // .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - } if (prdMoTask.schedule_type == 1) { - if (prdMo.reported_work_qty == null) - { - await db.Updateable() + _ = prdMo.reported_work_qty == null + ? await db.Updateable() .SetColumns(x => x.reported_work_qty == input.reported_qty) - .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == prdMo.id).ExecuteCommandAsync() + : await db.Updateable() .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - if (prdMo.complete_qty == null) - { - await db.Updateable() + _ = prdMo.complete_qty == null + ? await db.Updateable() .SetColumns(x => x.complete_qty == input.reported_qty) - .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == prdMo.id).ExecuteCommandAsync() + : await db.Updateable() .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } PerProcessStandardsH processStandardsH = await db.Queryable() .Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id && @@ -1553,11 +1554,11 @@ namespace Tnb.ProductionMgr if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null && processStandardsH?.moulding_cycle > 0) { - decimal? addTime = ((prdMoTask.scheduled_qty - input.reported_qty - (prdMoTask.scrap_qty ?? 0)) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; + decimal? addTime = ((((prdMoTask.scheduled_qty - input.reported_qty - (prdMoTask.scrap_qty ?? 0)) * processStandardsH?.moulding_cycle) - 1) / toolMolds.mold_cavity) + 1; if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.plan_end_date == cal_plan_end_date) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } @@ -1568,50 +1569,40 @@ namespace Tnb.ProductionMgr { if (mbomProcess.is_last == 1 && prdMoTask != null && !string.IsNullOrEmpty(prdMoTask.parent_id)) { - var parentMoTask = await db.Queryable().SingleAsync(x => x.id == prdMoTask.parent_id); + PrdMoTask parentMoTask = await db.Queryable().SingleAsync(x => x.id == prdMoTask.parent_id); if (parentMoTask?.last_process_complete_qty == null) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.last_process_complete_qty == input.reported_qty) // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) .Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync(); } else if (parentMoTask?.last_process_complete_qty != null) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.last_process_complete_qty == x.last_process_complete_qty + input.reported_qty) // .SetColumnsIF(flag,x=>x.mo_task_status==DictConst.ComplatedEnCode) .Where(x => x.id == prdMoTask.parent_id).ExecuteCommandAsync(); } - if (prdMo.reported_work_qty == null) - { - await db.Updateable() + _ = prdMo.reported_work_qty == null + ? await db.Updateable() .SetColumns(x => x.reported_work_qty == input.reported_qty) - .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == prdMo.id).ExecuteCommandAsync() + : await db.Updateable() .SetColumns(x => x.reported_work_qty == x.reported_work_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - if (prdMo.complete_qty == null) - { - await db.Updateable() + _ = prdMo.complete_qty == null + ? await db.Updateable() .SetColumns(x => x.complete_qty == input.reported_qty) - .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == prdMo.id).ExecuteCommandAsync() + : await db.Updateable() .SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } } - var list = await db.Queryable() + List list = await db.Queryable() .LeftJoin((a, b) => a.process_id == b.process_id && b.enabled == 1) .Where((a, b) => a.process_id == prdMoTask.process_id).Select((a, b) => b).ToListAsync(); @@ -1620,18 +1611,18 @@ namespace Tnb.ProductionMgr if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.plan_end_date == cal_plan_end_date) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } } - var master = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); + PrdReportRecord master = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); if (master != null) { master.reported_work_qty += input.reported_qty; master.completed_qty += input.reported_qty; - await db.Updateable(master).ExecuteCommandAsync(); + _ = await db.Updateable(master).ExecuteCommandAsync(); } @@ -1721,13 +1712,11 @@ namespace Tnb.ProductionMgr if (equip.tube == "1") { string resultMsg = await _prdInstockService.InstockTubeOne(report); - if (resultMsg == "true") return true; - throw Oops.Bah(resultMsg); + return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg); } } - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess; + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)result.IsSuccess; } /// @@ -1758,94 +1747,88 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task SelfTestScrapped(SelfTestScrappedInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); if (await db.Queryable().AnyAsync(x => x.id == input.mo_task_id && x.mo_task_status == DictConst.MoStatusPauseCode)) { throw Oops.Bah("暂停的任务单无法报废"); } - var result = await db.Ado.UseTranAsync(async () => + DbResult result = await db.Ado.UseTranAsync(async () => { List destDefects = new(); - var batch = DateTime.Now.ToString("yyyyMMddHHmmss"); - var prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + string batch = DateTime.Now.ToString("yyyyMMddHHmmss"); + PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); - foreach (var categoryItem in input.categoryItems) + foreach (SelfTestScrappedInputItem categoryItem in input.categoryItems) { - foreach (var dItem in categoryItem.items) + foreach (defectItem dItem in categoryItem.items) { - var defect = new PrdMoTaskDefect(); - defect.id = SnowflakeIdHelper.NextId(); - defect.mo_task_id = input.mo_task_id; - defect.batch = batch; - defect.defective_cagetory_id = categoryItem.category_id; - defect.defective_item = dItem.defective_item; - defect.defective_item_qty = dItem.defective_item_qty; - defect.create_id = _userManager.UserId; - defect.scrap_qty = input.scrap_qty; + PrdMoTaskDefect defect = new() + { + id = SnowflakeIdHelper.NextId(), + mo_task_id = input.mo_task_id, + batch = batch, + defective_cagetory_id = categoryItem.category_id, + defective_item = dItem.defective_item, + defective_item_qty = dItem.defective_item_qty, + create_id = _userManager.UserId, + scrap_qty = input.scrap_qty + }; destDefects.Add(defect); } } - await db.Insertable(destDefects).ExecuteCommandAsync(); + _ = await db.Insertable(destDefects).ExecuteCommandAsync(); - var scrapQty = db.Queryable().Where(it => it.mo_task_id == input.mo_task_id)?.Sum(d => d.defective_item_qty); + int? scrapQty = db.Queryable().Where(it => it.mo_task_id == input.mo_task_id)?.Sum(d => d.defective_item_qty); if (scrapQty.HasValue && scrapQty.Value > 0)//更新生产任务表报废数量 { #region 质检模块 //质检模块 - TriggerPlanEntity entity = new TriggerPlanEntity(); - entity.materialid = prdMoTask.material_id; - entity.processid = prdMoTask.process_id; - entity.workid = prdMoTask.workstation_id; - var reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty; - var scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty; + TriggerPlanEntity entity = new() + { + materialid = prdMoTask.material_id, + processid = prdMoTask.process_id, + workid = prdMoTask.workstation_id + }; + int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty; + int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty; entity.oldpronum = reported + scrap; entity.newpronum = input.scrap_qty; entity.triggerevent = EnumTriggerEvent.生产检定量; await _qcCheckPlanService.CreateTask(entity); #endregion - await db.Updateable().SetColumns(it => new PrdMoTask { scrap_qty = scrapQty.Value }).Where(it => it.id == input.mo_task_id).ExecuteCommandAsync(); + _ = await db.Updateable().SetColumns(it => new PrdMoTask { scrap_qty = scrapQty.Value }).Where(it => it.id == input.mo_task_id).ExecuteCommandAsync(); } - var defectRecord = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); + PrdMoTaskDefectRecord defectRecord = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); if (defectRecord != null) { defectRecord.scrap_qty += input.scrap_qty; - await db.Updateable(defectRecord).ExecuteCommandAsync(); + _ = await db.Updateable(defectRecord).ExecuteCommandAsync(); } - var reportMaster = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); - var prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); + PrdReportRecord reportMaster = await db.Queryable().FirstAsync(it => it.mo_task_id == input.mo_task_id); + PrdMo prdMo = await db.Queryable().SingleAsync(x => x.id == prdMoTask.mo_id); - if (prdMo.reported_work_qty == null) - { - await db.Updateable() + _ = prdMo.reported_work_qty == null + ? await db.Updateable() .SetColumns(x => x.scrap_qty == input.scrap_qty) - .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == prdMo.id).ExecuteCommandAsync() + : await db.Updateable() .SetColumns(x => x.scrap_qty == x.scrap_qty + input.scrap_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - if (prdMo.complete_qty == null) - { - await db.Updateable() + _ = prdMo.complete_qty == null + ? await db.Updateable() .SetColumns(x => x.complete_qty == input.scrap_qty) - .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } - else - { - await db.Updateable() + .Where(x => x.id == prdMo.id).ExecuteCommandAsync() + : await db.Updateable() .SetColumns(x => x.complete_qty == x.complete_qty + input.scrap_qty) .Where(x => x.id == prdMo.id).ExecuteCommandAsync(); - } if (reportMaster != null) { reportMaster.completed_qty += input.scrap_qty; - await db.Updateable(reportMaster).ExecuteCommandAsync(); + _ = await db.Updateable(reportMaster).ExecuteCommandAsync(); } if (prdMoTask.schedule_type == 1) @@ -1859,11 +1842,11 @@ namespace Tnb.ProductionMgr if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null && processStandardsH?.moulding_cycle > 0) { - decimal? addTime = ((prdMoTask.scheduled_qty - prdMoTask.reported_work_qty - input.scrap_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; + decimal? addTime = ((((prdMoTask.scheduled_qty - prdMoTask.reported_work_qty - input.scrap_qty) * processStandardsH?.moulding_cycle) - 1) / toolMolds.mold_cavity) + 1; if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.plan_end_date == cal_plan_end_date) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } @@ -1871,7 +1854,7 @@ namespace Tnb.ProductionMgr } else { - var list = await db.Queryable() + List list = await db.Queryable() .LeftJoin((a, b) => a.process_id == b.process_id && b.enabled == 1) .Where((a, b) => a.process_id == prdMoTask.process_id).Select((a, b) => b).ToListAsync(); @@ -1880,7 +1863,7 @@ namespace Tnb.ProductionMgr if (prdMoTask.act_start_date != null && addTime != null && addTime > 0) { DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.plan_end_date == cal_plan_end_date) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); } @@ -1892,13 +1875,16 @@ namespace Tnb.ProductionMgr /// /// 修改组装、包装,生产任务信息 /// - /// /// [HttpPost] public async Task UpdatePackMoTask(PackPrdTaskUpInput input) { - if (input == null) throw new ArgumentNullException("input"); - var row = await _db.Updateable().SetColumns(it => new PrdMoTask + if (input == null) + { + throw new ArgumentNullException("input"); + } + + int row = await _db.Updateable().SetColumns(it => new PrdMoTask { workline_id = input.workline_id, bom_id = input.bom_id, @@ -1917,54 +1903,69 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GenSubMo(GenSubMoCrInput input) { - if (input is null) throw new ArgumentNullException("input"); - if (input.ids is null || input.ids.Count == 0) throw new ArgumentException($"{nameof(input.ids)} not be null or count zero"); - var curMo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id); - if (curMo == null) throw new ArgumentNullException("创建子工单时的父工单不能为null"); + if (input is null) + { + throw new ArgumentNullException("input"); + } + if (input.ids is null || input.ids.Count == 0) + { + throw new ArgumentException($"{nameof(input.ids)} not be null or count zero"); + } + + PrdMo curMo = await _db.Queryable().FirstAsync(it => it.id == input.mo_id); + if (curMo == null) + { + throw new ArgumentNullException("创建子工单时的父工单不能为null"); + } var outMaterials = await _db.Queryable().InnerJoin((a, b) => a.id == b.mbom_id) .InnerJoin((a, b, c) => a.id == c.mbom_id && b.id == c.mbom_process_id) .Where((a, b, c) => a.id == input.bom_id && input.ids.Contains(b.process_id)) .Select((a, b, c) => new { - material_id = c.material_id, - num = c.num, + c.material_id, + c.num, }) .ToListAsync(); if (outMaterials?.Count > 0) { - var ids = outMaterials.Select(x => x.material_id).ToList(); - await _db.Deleteable().Where(it => it.parent_id == input.mo_id).ExecuteCommandAsync(); + List ids = outMaterials.Select(x => x.material_id).ToList(); + _ = await _db.Deleteable().Where(it => it.parent_id == input.mo_id).ExecuteCommandAsync(); if (ids?.Count > 0) { - var dicOutMaterialNum = outMaterials.DistinctBy(x => x.material_id).ToDictionary(x => x.material_id, x => x.num.ParseToInt()); + Dictionary dicOutMaterialNum = outMaterials.DistinctBy(x => x.material_id).ToDictionary(x => x.material_id, x => x.num.ParseToInt()); List subMoList = new(); - var outputMaterials = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); - foreach (var om in outputMaterials) + List outputMaterials = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); + foreach (BasMaterial om in outputMaterials) { - PrdMo subMo = new(); - subMo.material_id = om.id; - subMo.material_code = om.code; - subMo.plan_qty = dicOutMaterialNum.ContainsKey(om.id) ? dicOutMaterialNum[om.id] * curMo.plan_qty : 0; - subMo.mo_type = curMo.mo_type; - subMo.parent_id = curMo.id; - subMo.plan_start_date = curMo.plan_start_date; - subMo.plan_end_date = curMo.plan_end_date; - subMo.create_id = _userManager.UserId; - subMo.create_time = DateTime.Now; - subMo.mo_status = DictConst.WaitProductId; + PrdMo subMo = new() + { + material_id = om.id, + material_code = om.code, + plan_qty = dicOutMaterialNum.ContainsKey(om.id) ? dicOutMaterialNum[om.id] * curMo.plan_qty : 0, + mo_type = curMo.mo_type, + parent_id = curMo.id, + plan_start_date = curMo.plan_start_date, + plan_end_date = curMo.plan_end_date, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_status = DictConst.WaitProductId + }; subMoList.Add(subMo); } //生成子工单编码 for (int i = 0; i < subMoList.Count; i++) { - var num = (i + 1).ToString().PadLeft(2, '0'); + string num = (i + 1).ToString().PadLeft(2, '0'); subMoList[i].mo_code = $"{curMo.mo_code}-{num}"; } - var row = await _db.Insertable(subMoList).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1000); + int row = await _db.Insertable(subMoList).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1000); + } } } @@ -1973,17 +1974,17 @@ namespace Tnb.ProductionMgr #endregion - private static Dictionary dicProperties = new Dictionary(StringComparer.OrdinalIgnoreCase); - private static T DictionaryToObject(IDictionary dictionary) where T : class, new() + private static readonly Dictionary dicProperties = new(StringComparer.OrdinalIgnoreCase); + private static T DictionaryToObject(IDictionary dictionary) where T : class, new() { - var name = typeof(T).Name; + string name = typeof(T).Name; T instance = new(); if (!dicProperties.TryGetValue(name, out string[] properies)) { properies = instance.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Select(p => p.Name).ToArray(); dicProperties[name] = properies; } - foreach (var pn in properies) + foreach (string pn in properies) { if (dictionary.ContainsKey(pn)) { @@ -2039,19 +2040,19 @@ namespace Tnb.ProductionMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string moTaskCode = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string eqpId = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; - List worklineIds = new List(); - List equipIds = new List(); + List worklineIds = new(); + List equipIds = new(); if (!string.IsNullOrEmpty(eqpId)) { worklineIds = await db.Queryable().Where(x => x.ParentId == eqpId && x.Category == DictConst.RegionCategoryWorklineCode && x.DeleteMark == null).Select(x => x.Id).ToListAsync(); equipIds = await db.Queryable().Where(x => x.equip_type_id == eqpId).Select(x => x.id).ToListAsync(); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => c.EnCode == DictConst.TaskStatus) .LeftJoin((a, b, c, d) => @@ -2096,15 +2097,15 @@ namespace Tnb.ProductionMgr /// private async Task Delete(string id) { - var db = _repository.AsSugarClient(); - var result = await db.Ado.UseTranAsync(async () => + ISqlSugarClient db = _repository.AsSugarClient(); + DbResult result = await db.Ado.UseTranAsync(async () => { - var row = -1; - var prdTask = await db.Queryable().FirstAsync(it => it.id == id); + int row = -1; + PrdMoTask prdTask = await db.Queryable().FirstAsync(it => it.id == id); row = await db.Deleteable().Where(it => it.id == id).ExecuteCommandAsync(); if (row > 0) { - var prdMo = await db.Queryable().FirstAsync(it => it.id == prdTask.mo_id); + PrdMo? prdMo = await db.Queryable().FirstAsync(it => it.id == prdTask.mo_id); if (prdMo is not null) { prdMo.scheduled_qty += prdTask.scheduled_qty; @@ -2114,7 +2115,10 @@ namespace Tnb.ProductionMgr } return row > 0; }); - if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1002); + if (!result.IsSuccess) + { + throw Oops.Oh(ErrorCode.COM1002); + } } public async Task> GetListByEqpId(string eqpId) { @@ -2131,7 +2135,7 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetEstimatedEndTime(CountEstimatedEndTimeInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); if (input.type == 1) { PerProcessStandardsH processStandardsH = await db.Queryable() @@ -2140,17 +2144,32 @@ namespace Tnb.ProductionMgr .OrderByDescending(x => x.create_time).FirstAsync(); ToolMolds toolMolds = await db.Queryable().SingleAsync(x => x.id == input.molds_id); - if (toolMolds == null) throw Oops.Bah("没找到模具"); - if (toolMolds?.mold_cavity <= 0) throw Oops.Bah("模穴数错误"); - if (processStandardsH == null) throw Oops.Bah("工艺标准成型周期错误"); - if (processStandardsH?.moulding_cycle <= 0) throw Oops.Bah("工艺标准成型周期错误"); + if (toolMolds == null) + { + throw Oops.Bah("没找到模具"); + } - decimal? addTime = (input.scheduled_qty * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1; + if (toolMolds?.mold_cavity <= 0) + { + throw Oops.Bah("模穴数错误"); + } + + if (processStandardsH == null) + { + throw Oops.Bah("工艺标准成型周期错误"); + } + + if (processStandardsH?.moulding_cycle <= 0) + { + throw Oops.Bah("工艺标准成型周期错误"); + } + + decimal? addTime = (((input.scheduled_qty * processStandardsH?.moulding_cycle) - 1) / toolMolds.mold_cavity) + 1; return input.estimated_start_date.AddSeconds((double)addTime.Value).ToString("yyyy-MM-dd HH:mm:ss"); } else { - var list = await db.Queryable() + List list = await db.Queryable() .LeftJoin((a, b) => a.process_id == b.process_id && b.enabled == 1) .Where((a, b) => a.mbom_id == input.mbom_id).Select((a, b) => b).ToListAsync(); @@ -2165,7 +2184,6 @@ namespace Tnb.ProductionMgr /// /// 获取这个产线生产中的任务单 /// - /// /// [HttpPost] public async Task GetMoTaskByWorklineId(Dictionary dic) @@ -2182,43 +2200,43 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task ChangeEquip(ChangeEquipInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + PrdMoTask moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); if (moTask.eqp_id == input.equip_id) { throw new Exception("与原机台相同"); } - await db.Updateable().SetColumns(x => x.eqp_id == input.equip_id) + _ = await db.Updateable().SetColumns(x => x.eqp_id == input.equip_id) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); - var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); - var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); - var taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); - taskLog.mo_code = mo?.mo_code!; - taskLog.eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.equip_id))?.code!; - taskLog.mold_code = ""; - taskLog.item_code = material?.code!; - taskLog.item_standard = material?.material_standard!; - taskLog.status = "更换机台"; - taskLog.operator_name = _userManager.RealName; - taskLog.create_id = _userManager.UserId; - taskLog.create_time = DateTime.Now; - taskLog.mo_task_id = moTask.id; - taskLog.mo_task_code = moTask.mo_task_code; - taskLog.station_code = ""; - taskLog.process_code = process?.code; + PrdMo mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); + BasMaterial? material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); + BasMaterial process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); + PrdTaskLog taskLog = new() + { + id = SnowflakeIdHelper.NextId(), + mo_code = mo?.mo_code!, + eqp_code = (await db.Queryable().FirstAsync(it => it.id == input.equip_id))?.code!, + mold_code = "", + item_code = material?.code!, + item_standard = material?.material_standard!, + status = "更换机台", + operator_name = _userManager.RealName, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = moTask.id, + mo_task_code = moTask.mo_task_code, + station_code = "", + process_code = process?.code + }; - await db.Insertable(taskLog).ExecuteCommandAsync(); + _ = await db.Insertable(taskLog).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "更换成功" : result.ErrorMessage; - + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "更换成功" : result.ErrorMessage); } /// @@ -2228,44 +2246,44 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task ChangeMold(ChangeMoldInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + PrdMoTask moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); if (moTask.mold_id == input.mold_id) { throw new Exception("与原模具相同"); } - await db.Updateable().SetColumns(x => x.mold_id == input.mold_id) + _ = await db.Updateable().SetColumns(x => x.mold_id == input.mold_id) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); - var mold = await db.Queryable().SingleAsync(x => x.id == input.mold_id); - var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); - var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); - var taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); - taskLog.mo_code = mo?.mo_code!; - taskLog.eqp_code = ""; - taskLog.mold_code = mold?.mold_code; - taskLog.item_code = material?.code!; - taskLog.item_standard = material?.material_standard!; - taskLog.status = "更换模具"; - taskLog.operator_name = _userManager.RealName; - taskLog.create_id = _userManager.UserId; - taskLog.create_time = DateTime.Now; - taskLog.mo_task_id = moTask.id; - taskLog.mo_task_code = moTask.mo_task_code; - taskLog.station_code = ""; - taskLog.process_code = process?.code; + PrdMo mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); + ToolMolds mold = await db.Queryable().SingleAsync(x => x.id == input.mold_id); + BasMaterial? material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); + BasMaterial process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); + PrdTaskLog taskLog = new() + { + id = SnowflakeIdHelper.NextId(), + mo_code = mo?.mo_code!, + eqp_code = "", + mold_code = mold?.mold_code, + item_code = material?.code!, + item_standard = material?.material_standard!, + status = "更换模具", + operator_name = _userManager.RealName, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = moTask.id, + mo_task_code = moTask.mo_task_code, + station_code = "", + process_code = process?.code + }; - await db.Insertable(taskLog).ExecuteCommandAsync(); + _ = await db.Insertable(taskLog).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "更换成功" : result.ErrorMessage; - + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "更换成功" : result.ErrorMessage); } /// @@ -2275,44 +2293,44 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task ChangeWorkline(ChangeWorklineInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - var moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); + PrdMoTask moTask = await db.Queryable().SingleAsync(x => x.id == input.mo_task_id); if (moTask.workline_id == input.workline_id) { throw new Exception("与原产线相同"); } - await db.Updateable().SetColumns(x => x.workline_id == input.workline_id) + _ = await db.Updateable().SetColumns(x => x.workline_id == input.workline_id) .Where(x => x.id == input.mo_task_id).ExecuteCommandAsync(); - var mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); - var material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); - var process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); - var taskLog = new PrdTaskLog(); - taskLog.id = SnowflakeIdHelper.NextId(); - taskLog.mo_code = mo?.mo_code!; - taskLog.eqp_code = ""; - taskLog.mold_code = ""; - taskLog.item_code = material?.code!; - taskLog.item_standard = material?.material_standard!; - taskLog.status = "更换产线"; - taskLog.operator_name = _userManager.RealName; - taskLog.create_id = _userManager.UserId; - taskLog.create_time = DateTime.Now; - taskLog.mo_task_id = moTask.id; - taskLog.mo_task_code = moTask.mo_task_code; - taskLog.station_code = ""; - taskLog.process_code = process?.code; + PrdMo mo = await db.Queryable().SingleAsync(x => x.id == moTask.mo_id); + BasMaterial? material = await db.Queryable().SingleAsync(x => x.id == moTask.material_id); + BasMaterial process = await db.Queryable().SingleAsync(x => x.id == moTask.process_id); + PrdTaskLog taskLog = new() + { + id = SnowflakeIdHelper.NextId(), + mo_code = mo?.mo_code!, + eqp_code = "", + mold_code = "", + item_code = material?.code!, + item_standard = material?.material_standard!, + status = "更换产线", + operator_name = _userManager.RealName, + create_id = _userManager.UserId, + create_time = DateTime.Now, + mo_task_id = moTask.id, + mo_task_code = moTask.mo_task_code, + station_code = "", + process_code = process?.code + }; - await db.Insertable(taskLog).ExecuteCommandAsync(); + _ = await db.Insertable(taskLog).ExecuteCommandAsync(); }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "更换成功" : result.ErrorMessage; - + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "更换成功" : result.ErrorMessage); } /// @@ -2320,11 +2338,15 @@ namespace Tnb.ProductionMgr /// /// [HttpPost] - public async Task GetPrdMoTaskInfoById(Dictionary dic) + public async Task GetPrdMoTaskInfoById(Dictionary dic) { string id = dic.ContainsKey("id") ? dic["id"] : ""; - if (string.IsNullOrEmpty(id)) return null; - var db = _repository.AsSugarClient(); + if (string.IsNullOrEmpty(id)) + { + return null; + } + + ISqlSugarClient db = _repository.AsSugarClient(); return await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) @@ -2335,26 +2357,26 @@ namespace Tnb.ProductionMgr .Where((a, b, c, d) => a.id == id) .Select((a, b, c, d, e, f, g) => new { - id = a.id, - mo_task_code = a.mo_task_code, + a.id, + a.mo_task_code, mo_task_status = e.FullName, - material_id = a.material_id, + a.material_id, material_code = b.code, material_name = b.name, - mold_id = a.mold_id, - mold_code = c.mold_code, - mold_name = c.mold_name, - schedule_type = a.schedule_type, + a.mold_id, + c.mold_code, + c.mold_name, + a.schedule_type, equip_code = d.code, equip_name = d.name, - workstation_id = a.workstation_id, + a.workstation_id, workstation_code = g.EnCode, workstation_name = g.FullName, - scheduled_qty = a.scheduled_qty, - reported_work_qty = a.reported_work_qty, - scrap_qty = a.scrap_qty, - process_id = a.process_id, - process_name = f.process_name, + a.scheduled_qty, + a.reported_work_qty, + a.scrap_qty, + a.process_id, + f.process_name, }).FirstAsync(); } @@ -2366,15 +2388,15 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetGanntInfo1() { - var db = _repository.AsSugarClient(); - Dictionary result = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary result = new(); var listRows = await db.Queryable() .LeftJoin((a, b) => a.equip_type_id == b.id) .Where((a, b) => b.code == "ZSJ" || b.code == "005") .OrderBy((a, b) => b.code) .Select((a, b) => new { - id = a.id, + a.id, expanded = true, label = a.name, parentId = "" @@ -2391,11 +2413,11 @@ namespace Tnb.ProductionMgr .Where((a, b) => a.estimated_start_date >= startTime && a.estimated_end_date <= endTime) .Select((a, b, c) => new { - id = a.id, + a.id, label = b.name, material_name = b.name, reported_work_qty = a.reported_work_qty == null ? 0 : a.reported_work_qty, - scheduled_qty = a.scheduled_qty, + a.scheduled_qty, mo_task_status = c.FullName, // label = b.name +" " +(a.reported_work_qty==null?0:a.reported_work_qty)+"/"+a.scheduled_qty + " " +c.FullName, rowId = a.eqp_id, @@ -2418,8 +2440,8 @@ namespace Tnb.ProductionMgr }) .ToListAsync(); // DateTime min = (DateTime)charItems.Min(x => x.time.start); - TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); - TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); + TimeSpan ts1 = new(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); + TimeSpan ts2 = new(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts3 = ts1.Subtract(ts2).Duration(); @@ -2438,8 +2460,8 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetGanntInfo2() { - var db = _repository.AsSugarClient(); - Dictionary result = new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary result = new(); var listRows = await db.Queryable() .Where(x => x.DeleteMark == null && (x.Category == DictConst.RegionCategoryWorklineCode || x.Category == DictConst.RegionCategoryWorkshopCode)) .OrderByDescending(x => x.Category) @@ -2462,11 +2484,11 @@ namespace Tnb.ProductionMgr .Where((a, b) => a.estimated_start_date >= startTime && a.estimated_end_date <= endTime) .Select((a, b, c) => new { - id = a.id, + a.id, label = b.name, material_name = b.name, reported_work_qty = a.reported_work_qty == null ? 0 : a.reported_work_qty, - scheduled_qty = a.scheduled_qty, + a.scheduled_qty, mo_task_status = c.FullName, // label = b.name +" " +(a.reported_work_qty==null?0:a.reported_work_qty)+"/"+a.scheduled_qty + " " +c.FullName, rowId = a.workline_id, @@ -2489,8 +2511,8 @@ namespace Tnb.ProductionMgr }) .ToListAsync(); // DateTime min = (DateTime)charItems.Min(x => x.time.start); - TimeSpan ts1 = new TimeSpan(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); - TimeSpan ts2 = new TimeSpan(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); + TimeSpan ts1 = new(Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd")).Ticks); + TimeSpan ts2 = new(Convert.ToDateTime(startTime.ToString("yyyy-MM-dd")).Ticks); TimeSpan ts3 = ts1.Subtract(ts2).Duration(); @@ -2509,40 +2531,38 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task SaveData1(List input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - foreach (var item in input) + foreach (GanntSaveInput item in input) { // if(await db.Queryable().Where(x=>x.Id==item.row_id && x.Category==DictConst.RegionCategoryWorkshopCode).AnyAsync()) // throw Oops.Bah("不能排在车间上"); - var prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); + PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); if (prdMoTask.eqp_id != item.row_id) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.workline_id == item.row_id) .Where(x => x.id == item.id).ExecuteCommandAsync(); } if (prdMoTask.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.start.Value.ToString("yyyy-MM-dd HH:mm")) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.estimated_start_date == item.time.start) .Where(x => x.id == item.id).ExecuteCommandAsync(); } if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.estimated_end_date == item.time.end) .Where(x => x.id == item.id).ExecuteCommandAsync(); } } }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - - return result.IsSuccess ? "排产成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "排产成功" : result.ErrorMessage); } /// @@ -2552,40 +2572,41 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task SaveData2(List input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); DbResult result = await db.Ado.UseTranAsync(async () => { - foreach (var item in input) + foreach (GanntSaveInput item in input) { if (await db.Queryable().Where(x => x.Id == item.row_id && x.Category == DictConst.RegionCategoryWorkshopCode).AnyAsync()) + { throw Oops.Bah("不能排在车间上"); - var prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); + } + + PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == item.id); if (prdMoTask.workline_id != item.row_id) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.workline_id == item.row_id) .Where(x => x.id == item.id).ExecuteCommandAsync(); } if (prdMoTask.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.start.Value.ToString("yyyy-MM-dd HH:mm")) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.estimated_start_date == item.time.start) .Where(x => x.id == item.id).ExecuteCommandAsync(); } if (prdMoTask.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm") != item.time.end.Value.ToString("yyyy-MM-dd HH:mm")) { - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.estimated_end_date == item.time.end) .Where(x => x.id == item.id).ExecuteCommandAsync(); } } }); - if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - - return result.IsSuccess ? "排产成功" : result.ErrorMessage; + return !result.IsSuccess ? throw Oops.Bah(result.ErrorMessage) : (dynamic)(result.IsSuccess ? "排产成功" : result.ErrorMessage); } /// @@ -2617,7 +2638,7 @@ namespace Tnb.ProductionMgr public async Task GetMaterialPreparationPlan() { string now = DateTime.Now.ToString("yyyy-MM-dd"); - var childrenList = await _db.Queryable() + List childrenList = await _db.Queryable() .LeftJoin((a, b) => a.id == b.parent_id) .LeftJoin((a, b, c) => b.material_id == c.id) .Where((a, b) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now) @@ -2643,7 +2664,7 @@ namespace Tnb.ProductionMgr }).ToListAsync(); - var prdMoTaskList = await _db.Queryable() + List prdMoTaskList = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .Where(a => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id) && a.estimated_start_date.Value.ToString("yyyy-MM-dd") == now && (a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ToBeScheduledEncode || a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode)) .Select((a, b) => new MaterialPreparationPlanOutput() @@ -2656,12 +2677,12 @@ namespace Tnb.ProductionMgr }) .ToListAsync(); - foreach (var item in prdMoTaskList) + foreach (MaterialPreparationPlanOutput? item in prdMoTaskList) { item.children = childrenList.Where(x => x.parent_id == item.mo_task_id).ToList(); - foreach (var itemChild in item.children) + foreach (MaterialPreparationPlanDOutput itemChild in item.children) { - foreach (var itemChildChild in itemChild.children) + foreach (MaterialPreparationPlanDDOutput itemChildChild in itemChild.children) { if (itemChildChild.num > 0 && itemChild.rate_num != null && itemChild.rate_num > 0) { @@ -2683,8 +2704,12 @@ namespace Tnb.ProductionMgr public async Task GetPrdMoTaskInfoByStationId(Dictionary dic) { string station_id = dic.ContainsKey("station_id") ? dic["station_id"] : ""; - if (string.IsNullOrEmpty(station_id)) throw Oops.Bah("工位错误"); - var prdMoTask = await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id != null && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync(); + if (string.IsNullOrEmpty(station_id)) + { + throw Oops.Bah("工位错误"); + } + + PrdMoTask? prdMoTask = await _db.Queryable().Where(x => x.workstation_id == station_id && x.parent_id != null && x.mo_task_status == DictConst.InProgressEnCode).FirstAsync(); if (prdMoTask != null) { BasMaterial basMaterial = await _db.Queryable().SingleAsync(x => x.id == prdMoTask.material_id); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index dae8b582..57409ef4 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -60,13 +60,15 @@ namespace Tnb.ProductionMgr { try { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); - MESCreateOutstockInput input = new MESCreateOutstockInput(); - input.outstock = new MESWmsOutstockHInput(); - input.outstockDs = new List(); + MESCreateOutstockInput input = new() + { + outstock = new MESWmsOutstockHInput(), + outstockDs = new List() + }; - string locationId = visualDevModelDataCrInput.data.ContainsKey("location_id") ? visualDevModelDataCrInput.data["location_id"].ToString() : ""; + string? locationId = visualDevModelDataCrInput.data.ContainsKey("location_id") ? visualDevModelDataCrInput.data["location_id"].ToString() : ""; BasLocation location = await db.Queryable().SingleAsync(x => x.id == locationId); input.outstock.bill_type = visualDevModelDataCrInput.data.ContainsKey("bill_type") ? visualDevModelDataCrInput.data["bill_type"].ToString() : ""; @@ -92,11 +94,11 @@ namespace Tnb.ProductionMgr input.outstockDs = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(visualDevModelDataCrInput.data["tablefield107"])); string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -124,16 +126,22 @@ namespace Tnb.ProductionMgr { try { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); string warehouse_id = "26103348825381";//二楼缓存仓 - MESCreateOutstockInput input = new MESCreateOutstockInput(); - input.outstock = new MESWmsOutstockHInput(); - input.outstockDs = new List(); + MESCreateOutstockInput input = new() + { + outstock = new MESWmsOutstockHInput(), + outstockDs = new List() + }; PrdMoTask prdMoTask = await db.Queryable().SingleAsync(x => x.id == generalOutstockInput.mo_task_id); BasLocation location = await db.Queryable().Where(x => x.location_code == generalOutstockInput.location_code).FirstAsync(); - if (location == null) throw Oops.Bah("未找到库位"); + if (location == null) + { + throw Oops.Bah("未找到库位"); + } + string locationId = location.id; input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO; @@ -158,7 +166,7 @@ namespace Tnb.ProductionMgr }) .ToDictionaryAsync(x => x.key, x => x.value); - foreach (var item in generalOutstockInput.details) + foreach (GeneralOutstockDInput item in generalOutstockInput.details) { input.outstockDs.Add(new MESWmsOutstockDInput() { @@ -170,11 +178,11 @@ namespace Tnb.ProductionMgr } string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; - Dictionary header = new Dictionary() + Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; - var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header); + string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); @@ -184,18 +192,20 @@ namespace Tnb.ProductionMgr } else { - PrdOutstockH prdOutstockH = new PrdOutstockH(); - prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO; - prdOutstockH.warehouse_id = warehouse_id; - prdOutstockH.location_code = generalOutstockInput.location_code; - prdOutstockH.create_id = _userManager.UserId; - prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId; - prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - prdOutstockH.workstation = generalOutstockInput.workstation_id; - prdOutstockH.workline = workline?.Id ?? ""; + PrdOutstockH prdOutstockH = new() + { + bill_type = DictConst.SHENGCHANLINGLIAO, + warehouse_id = warehouse_id, + location_code = generalOutstockInput.location_code, + create_id = _userManager.UserId, + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + workstation = generalOutstockInput.workstation_id, + workline = workline?.Id ?? "" + }; - List prdOutstockDs = new List(); - foreach (var item in generalOutstockInput.details) + List prdOutstockDs = new(); + foreach (GeneralOutstockDInput item in generalOutstockInput.details) { prdOutstockDs.Add(new PrdOutstockD() { @@ -211,10 +221,10 @@ namespace Tnb.ProductionMgr DbResult result = await _repository.AsSugarClient().Ado.UseTranAsync(async () => { - await _repository.InsertAsync(prdOutstockH); + _ = await _repository.InsertAsync(prdOutstockH); if (prdOutstockDs.Count > 0) { - await db.Insertable(prdOutstockDs).ExecuteCommandAsync(); + _ = await db.Insertable(prdOutstockDs).ExecuteCommandAsync(); } }); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 06455d94..74c5bfa9 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -31,7 +31,7 @@ namespace Tnb.ProductionMgr { private readonly ISqlSugarClient _db; private readonly IDictionaryDataService _dictionaryDataService; - private static Dictionary> _dicWorkLine = new Dictionary>(); + private static Dictionary> _dicWorkLine = new(); public PrdPackReportService(ISqlSugarRepository repository, IDictionaryDataService dictionaryDataService) { _db = repository.AsSugarClient(); @@ -44,7 +44,11 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetList(PrdPackReportQueryInput input) { - if (input == null) throw new ArgumentNullException("input"); + if (input == null) + { + throw new ArgumentNullException("input"); + } + if (string.IsNullOrEmpty(input.stationId)) { return new @@ -55,8 +59,8 @@ namespace Tnb.ProductionMgr } List trees = new(); - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); - var list = await _db.Queryable().Where(it => it.Category == "workline").ToListAsync(); + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + List list = await _db.Queryable().Where(it => it.Category == "workline").ToListAsync(); if (_dicWorkLine.Count < 1) { @@ -80,7 +84,7 @@ namespace Tnb.ProductionMgr endTimes[1] = GetDateTimeMilliseconds(input.estimated_end_date![1]); } - var items = await _db.Queryable() + SqlSugarPagedList 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.id == d.parent_id) @@ -107,9 +111,15 @@ namespace Tnb.ProductionMgr }) .ToPagedListAsync(input.currentPage, input.pageSize); if (start) + { items.list = items.list.Where(a => startTimes[0] <= a.plan_start_date && startTimes[1] >= a.plan_start_date).ToList(); + } + if (end) + { items.list = items.list.Where(a => endTimes[0] <= a.plan_end_date && endTimes[1] >= a.plan_end_date).ToList(); + } + _db.ThenMapper(items.list, it => { it.mo_task_status = it.mo_task_status.IsNotEmptyOrNull() && dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString() : ""; @@ -117,13 +127,13 @@ namespace Tnb.ProductionMgr if (items != null && items.list != null && items.list.Any()) { - foreach (var item in items.list) + foreach (PrdMoTask? item in items.list) { - var node = item.Adapt(); + PackReportTreeOutput node = item.Adapt(); node.parentId = "0"; if (item.workline_id.IsNotEmptyOrNull()) { - var workLine = _dicWorkLine.ContainsKey(item.workline_id) ? (Tuple)_dicWorkLine[item.workline_id] : null; + Tuple? workLine = _dicWorkLine.ContainsKey(item.workline_id) ? _dicWorkLine[item.workline_id] : null; if (workLine != null) { node.workline_id = $"{workLine.Item1}/{workLine.Item2}"; @@ -135,24 +145,30 @@ namespace Tnb.ProductionMgr trees.Add(node); } } - var treeList = trees.ToTree(); + List treeList = trees.ToTree(); if (!string.IsNullOrEmpty(input.process)) { - List removelist = new List(); - foreach (var item in treeList) + List removelist = new(); + foreach (PackReportTreeOutput item in treeList) { bool flag = false; if (item.process_id != null && item.process_id.Contains(input.process)) + { flag = true; + } + if (item.children != null && item.children.Count > 0) { - var childs = item.children.Adapt>(); + List childs = item.children.Adapt>(); if (childs.Where(p => p.process_id.Contains(input.process)).Any()) + { flag = true; + } } if (!flag) + { removelist.Add(item); - + } } removelist.ForEach(p => treeList.Remove(p)); @@ -172,16 +188,16 @@ namespace Tnb.ProductionMgr private static DateTime GetDateTimeMilliseconds(long timestamp) { long begtime = timestamp * 10000; - DateTime dt_1970 = new DateTime(1970, 1, 1, 8, 0, 0); + DateTime dt_1970 = new(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 + DateTime dt = new(time_tricks);//转化为DateTime return dt; } private async Task GetChild(string parentId, List nodes, Dictionary dic, string stationId) { - var items = await _db.Queryable() + List 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) @@ -210,7 +226,7 @@ namespace Tnb.ProductionMgr if (items?.Count > 0) { - var nsChild = items.Adapt>(); + List nsChild = items.Adapt>(); for (int i = 0; i < nsChild.Count; i++) { nsChild[i].parentId = parentId; @@ -220,7 +236,7 @@ namespace Tnb.ProductionMgr if (nsChild[i].workline_id.IsNotEmptyOrNull()) { - var workLine = _dicWorkLine.ContainsKey(nsChild[i].workline_id) ? (Tuple)_dicWorkLine[nsChild[i].workline_id] : null; + Tuple? workLine = _dicWorkLine.ContainsKey(nsChild[i].workline_id) ? _dicWorkLine[nsChild[i].workline_id] : null; if (workLine != null) { nsChild[i].workline_id = $"{workLine.Item1}/{workLine.Item2}"; @@ -229,7 +245,7 @@ namespace Tnb.ProductionMgr } nodes.AddRange(nsChild); - foreach (var item in items) + foreach (PrdMoTask? item in items) { await GetChild(item.id, nodes, dic, stationId); } @@ -252,7 +268,7 @@ namespace Tnb.ProductionMgr }; } - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) .LeftJoin((a, b, c, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode) @@ -309,7 +325,7 @@ namespace Tnb.ProductionMgr }; } - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) .LeftJoin((a, b, c, d) => a.workline_id == d.Id) @@ -360,11 +376,11 @@ namespace Tnb.ProductionMgr } Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>(); - string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; - string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; + string? mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; + string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["start_time"]) : null; DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString() == "" ? null : Convert.ToDateTime(queryJson["end_time"]) : null; - List statusList = new List(); + List statusList = new(); if (!string.IsNullOrEmpty(status)) { switch (status) @@ -390,7 +406,7 @@ namespace Tnb.ProductionMgr input.sort = "desc"; } - var result = await _db.Queryable() + SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.process_id == c.id) .LeftJoin((a, b, c, d) => a.workline_id == d.Id) @@ -469,12 +485,7 @@ namespace Tnb.ProductionMgr { PrdMoTask prdMoTask = await _db.Queryable().SingleAsync(x => x.id == input.mo_task_id); BasQrcode basQrcode = await _db.Queryable().Where(x => x.source_name == "TOOL_MOLDS" && x.code == input.mold_qrcode).FirstAsync(); - if (prdMoTask != null && basQrcode != null) - { - return prdMoTask.mold_id == basQrcode.source_id; - } - - return false; + return prdMoTask != null && basQrcode != null ? prdMoTask.mold_id == basQrcode.source_id : (dynamic)false; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs index 931cf10c..a79766a9 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdTaskManageService.cs @@ -105,10 +105,10 @@ namespace Tnb.ProductionMgr private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); - string moTaskCode = queryJson != null && queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; - string stationId = queryJson != null && queryJson.ContainsKey("stationId") ? queryJson["stationId"].ToString() : ""; + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string? moTaskCode = queryJson != null && queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; + string? stationId = queryJson != null && queryJson.ContainsKey("stationId") ? queryJson["stationId"].ToString() : ""; if (string.IsNullOrEmpty(stationId)) { @@ -121,23 +121,23 @@ namespace Tnb.ProductionMgr Dictionary dic = await _dictionaryDataService.GetDicByKey(DictConst.TaskStatus); - DateTime[] planStartDateArr = null; - DateTime[] planEndDateArr = null; - if (queryJson.TryGetValue("plan_start_date", out var value1)) + DateTime[]? planStartDateArr = null; + DateTime[]? planEndDateArr = null; + if (queryJson.TryGetValue("plan_start_date", out object? value1)) { planStartDateArr = value1.ToObject().Select(x => x.TimeStampToDateTime()).ToArray(); } - if (queryJson.TryGetValue("plan_end_date", out var value2)) + if (queryJson.TryGetValue("plan_end_date", out object? value2)) { planEndDateArr = value2.ToObject().Select(x => x.TimeStampToDateTime()).ToArray(); } - var result = await db.Queryable() + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.eqp_id == b.id) .LeftJoin((a, b, c) => a.material_id == c.id) .LeftJoin((a, b, c, d) => a.mold_id == d.id) - .Where((a, b, c, d) => (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode)) + .Where((a, b, c, d) => a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.InProgressEnCode || a.mo_task_status == DictConst.MoStatusExceptionCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode) .Where((a, b, c, d) => a.schedule_type == 1) .WhereIF(!string.IsNullOrEmpty(moTaskCode), (a, b, c, d) => a.mo_task_code.Contains(moTaskCode)) .WhereIF(planStartDateArr != null, (a, b, c, d) => a.estimated_start_date >= planStartDateArr[0] && a.estimated_start_date <= planStartDateArr[1]) @@ -243,7 +243,6 @@ namespace Tnb.ProductionMgr /// /// 根据任务单号获取提报记录明细 /// - /// 任务单号 /// /// returns: ///
{ @@ -256,8 +255,8 @@ namespace Tnb.ProductionMgr [HttpGet] public async Task GetPrdReportByIcmoCode([FromRoute] string mo_task_code) { - var db = _repository.AsSugarClient(); - var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId); var prdTask = await db.Queryable() .LeftJoin((a, b) => a.material_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) @@ -268,28 +267,28 @@ namespace Tnb.ProductionMgr .Where((a, b) => a.mo_task_code == mo_task_code) .Select((a, b, c, d, e, f, g) => new { - id = a.id, - mo_task_code = a.mo_task_code, - mo_id = a.mo_id, - material_id = a.material_id, + a.id, + a.mo_task_code, + a.mo_id, + a.material_id, material_code = b.code, material_name = b.name, - material_property = b.material_property, + b.material_property, mo_task_status = e.FullName, - plan_qty = a.plan_qty, - scheduled_qty = a.scheduled_qty, + a.plan_qty, + a.scheduled_qty, complete_qty = a.reported_work_qty + a.scrap_qty, - scrap_qty = a.scrap_qty, - mold_code = c.mold_code, + a.scrap_qty, + c.mold_code, // icmo_qty = a.icmo_qty, - reported_work_qty = a.reported_work_qty, + a.reported_work_qty, // reported_qty = a.reported_qty, // prd_qty = a.prd_qty, eqp_code = d.code, - mbom_process_id = a.mbom_process_id, + a.mbom_process_id, workline_name = f.FullName, - process_name = g.process_name, - process_id = a.process_id + g.process_name, + a.process_id }).FirstAsync(); return prdTask; diff --git a/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs index 21fdb00c..aef57906 100644 --- a/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/ProductionReportRecordService.cs @@ -83,13 +83,13 @@ namespace Tnb.ProductionMgr if (!string.IsNullOrEmpty(input.queryJson)) { Dictionary queryJson = JsonConvert.DeserializeObject>(input.queryJson); - if (queryJson.TryGetValue("mo_task_code", out var value)) + if (queryJson.TryGetValue("mo_task_code", out string? value)) { moTaskCode = value; } } - var db = _repository.AsSugarClient(); - var result = await db.Queryable() + ISqlSugarClient db = _repository.AsSugarClient(); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.mo_task_type == b.Id) .LeftJoin((a, b, c) => a.status == c.EnCode) .LeftJoin((a, b, c, d) => a.mo_task_id == d.id) @@ -125,11 +125,11 @@ namespace Tnb.ProductionMgr private async Task AddRecord(string id, VisualDevModelDataUpInput input) { - var db = _repository.AsSugarClient(); - var result = await db.Ado.UseTranAsync(async () => + ISqlSugarClient db = _repository.AsSugarClient(); + DbResult result = await db.Ado.UseTranAsync(async () => { - List prdReports = new List(); - foreach (var item in (JArray)input.data["tablefield107"]) + List prdReports = new(); + foreach (JToken item in (JArray)input.data["tablefield107"]) { if (item["id"] == null) { @@ -144,10 +144,10 @@ namespace Tnb.ProductionMgr } } - await db.Insertable(prdReports).ExecuteCommandAsync(); + _ = await db.Insertable(prdReports).ExecuteCommandAsync(); int? sum = prdReports.Sum(x => x.reported_qty); - await db.Updateable() + _ = await db.Updateable() .SetColumns(x => x.completed_qty == x.completed_qty + sum) .SetColumns(x => x.reported_work_qty == x.reported_work_qty + sum) .Where(x => x.id == input.data["id"].ToString()).ExecuteCommandAsync(); diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index 2d8b55a1..b6e7f3ad 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -11,8 +11,8 @@ namespace Tnb.ProductionMgr //redis定时获取数采数据 public class RedisBackGround : IHostedService, IDisposable { - private Timer? packtimer; - private Timer? limittimer; + private readonly Timer? packtimer; + private readonly Timer? limittimer; private readonly RedisCache _redisCache; private readonly IPrdInstockService _prdInstockService; public RedisBackGround(RedisCache redisCache, IPrdInstockService prdInstockService) @@ -29,19 +29,24 @@ namespace Tnb.ProductionMgr string sign = "agvMode"; foreach (string s in strs) { - var dic = _redisCache.HGetAll(s).Result; - foreach (var kv in dic) + Dictionary dic = _redisCache.HGetAll(s).Result; + foreach (KeyValuePair kv in dic) { if (!kv.Key.Contains(sign)) + { continue; - var res = JsonConvert.DeserializeObject(kv.Value); + } + + JObject? res = JsonConvert.DeserializeObject(kv.Value); if (res != null && res["Value"] != null) { - if (int.Parse(res["Value"]!.ToString()) != (int)Eagvmode.无请求 || int.Parse(res["Value"]!.ToString()) != (int)Eagvmode.收到请求) + if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) or not ((int)Eagvmode.收到请求)) { - InstockInput instockInput = new InstockInput(); - instockInput.equip_code = res["TagName"]!.ToString(); - _prdInstockService.InstockTypeOne(instockInput); + InstockInput instockInput = new() + { + equip_code = res["TagName"]!.ToString() + }; + _ = _prdInstockService.InstockTypeOne(instockInput); } } } @@ -56,19 +61,24 @@ namespace Tnb.ProductionMgr string sign = "AGVFullCall"; foreach (string s in strs) { - var dic = _redisCache.HGetAll(s).Result; - foreach (var kv in dic) + Dictionary dic = _redisCache.HGetAll(s).Result; + foreach (KeyValuePair kv in dic) { if (!kv.Key.Contains(sign)) + { continue; - var res = JsonConvert.DeserializeObject(kv.Value); + } + + JObject? res = JsonConvert.DeserializeObject(kv.Value); if (res != null && res["Value"] != null) { if (res.Value("Value")) { - InstockInput instockInput = new InstockInput(); - instockInput.equip_code = res["TagName"]!.ToString(); - _prdInstockService.InstockTypeOne(instockInput); + InstockInput instockInput = new() + { + equip_code = res["TagName"]!.ToString() + }; + _ = _prdInstockService.InstockTypeOne(instockInput); } } } @@ -83,12 +93,15 @@ namespace Tnb.ProductionMgr string sign = "AGVCall"; foreach (string s in strs) { - var dic = _redisCache.HGetAll(s).Result; - foreach (var kv in dic) + Dictionary dic = _redisCache.HGetAll(s).Result; + foreach (KeyValuePair kv in dic) { if (!kv.Key.Contains(sign)) + { continue; - var res = JsonConvert.DeserializeObject(kv.Value); + } + + JObject? res = JsonConvert.DeserializeObject(kv.Value); if (res != null && res["Value"] != null) { if (res.Value("Value")) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs index dbbe2981..f6ce935f 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisDataService.cs @@ -28,6 +28,14 @@ namespace Tnb.ProductionMgr [HttpPost] public async Task GetWeight(string device, string jihao) { + bool flag = await _redisCache.HashExist(device, jihao); + if (!flag) + { + throw Oops.Bah("没有找到" + device + "----" + jihao + "的数据"); + } + + string data = await _redisCache.GetHash(device, jihao); + JObject? res = JsonConvert.DeserializeObject(data); /* var dic =await _redisCache.HGetAll("TY4C-JICHU"); string a = ""; @@ -45,20 +53,7 @@ namespace Tnb.ProductionMgr await _redisCache.HSet("TY4C-JICHU", b[0], b[1]); }*/ - decimal result = 0; - bool flag = await _redisCache.HashExist(device, jihao); - if (!flag) - throw Oops.Bah("没有找到" + device + "----" + jihao + "的数据"); - var data = await _redisCache.GetHash(device, jihao); - var res = JsonConvert.DeserializeObject(data); - if (res != null && res["Value"] != null) - { - result = decimal.Parse(res["Value"]!.ToString()); - } - else - { - throw Oops.Bah("数据格式错误"); - } + decimal result = res != null && res["Value"] != null ? decimal.Parse(res["Value"]!.ToString()) : throw Oops.Bah("数据格式错误"); return result; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs b/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs index daa990cc..d3c11d64 100644 --- a/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/WorkOrderSchedulingService.cs @@ -39,31 +39,33 @@ namespace Tnb.ProductionMgr ("25546256076325","25530834099477"), }; List list = new(); - var index = 1; - foreach (var item in multi) + int index = 1; + foreach ((string pId, string eqpId) in multi) { - MoldsEntity entity = new(); - entity.id = SnowflakeIdHelper.NextId(); - entity.MoldCode = $"m00{index}"; - entity.MoldName = "磨具" + index; - entity.ItemId = item.pId; - entity.EqpId = item.eqpId; + MoldsEntity entity = new() + { + id = SnowflakeIdHelper.NextId(), + MoldCode = $"m00{index}", + MoldName = "磨具" + index, + ItemId = pId, + EqpId = eqpId + }; list.Add(entity); index++; } - var link = await _repository.GetFirstAsync(x => x.FullName == "tnb_eqp"); - var db = _dataBaseManager.ChangeDataBase(link); - var row = await db.Insertable(list).ExecuteCommandAsync(); + DbLinkEntity link = await _repository.GetFirstAsync(x => x.FullName == "tnb_eqp"); + SqlSugarScope db = _dataBaseManager.ChangeDataBase(link); + int row = await db.Insertable(list).ExecuteCommandAsync(); if (row > 0) { - foreach (var item in list) + foreach (MoldsEntity item in list) { - var dic = new Dictionary + Dictionary dic = new() { {"id",item.EqpId }, { "mold_id", item.id} }; - var row2 = await db.Updateable(dic).AS("eqp_equipment") + int row2 = await db.Updateable(dic).AS("eqp_equipment") .WhereColumns("id"). ExecuteCommandAsync(); } diff --git a/ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs b/ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs index 63e4c92e..32bb0c29 100644 --- a/ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/WorklineCommService.cs @@ -48,16 +48,16 @@ public class WorklineCommService : IWorklineCommService, IDynamicApiController, [AllowAnonymous] public async Task GetCartonQrcode(string workline) { - var line = await _repository.GetFirstAsync(a => a.id == workline); - var productNo = line?.product_code; + PrdWorklineState line = await _repository.GetFirstAsync(a => a.id == workline); + string? productNo = line?.product_code; //TODO 仅测试接口用 if (string.IsNullOrEmpty(productNo)) { productNo = "16945" + Random.Shared.Next(0, 999999999).ToString(); //"16945155732431"; } - var pd = DateTime.Now; - var exp = pd.AddYears(3); - var lotNo = pd.ToString("yyMMddHH"); + DateTime pd = DateTime.Now; + DateTime exp = pd.AddYears(3); + string lotNo = pd.ToString("yyMMddHH"); string tpl = "(01){0}\n(11){1}\n(17){2}\n(10){3}"; string qrcode = string.Format(tpl, productNo, pd.ToString("yyMM00"), exp.ToString("yyMM00"), lotNo); return new { qrcode }; diff --git a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs index 615aa824..263e5352 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckItemService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckItemService.cs @@ -34,14 +34,14 @@ namespace Tnb.QcMgr private async Task Delete(string id) { - var db = _repository.AsSugarClient(); - var QcCheckItemsH = await db.Queryable().Where(p => p.id == id).FirstAsync(); - var QcCheckItemsRs = await db.Queryable().Where(p => p.itemshid == id).ToListAsync(); - var QcCheckItemsDs = await db.Queryable().Where(p => QcCheckItemsRs.Select(p => p.itemsdid).ToList().Contains(p.id)).ToListAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + QcCheckItemsH QcCheckItemsH = await db.Queryable().Where(p => p.id == id).FirstAsync(); + List QcCheckItemsRs = await db.Queryable().Where(p => p.itemshid == id).ToListAsync(); + List QcCheckItemsDs = await db.Queryable().Where(p => QcCheckItemsRs.Select(p => p.itemsdid).ToList().Contains(p.id)).ToListAsync(); await db.Ado.BeginTranAsync(); - await db.Deleteable(QcCheckItemsH).ExecuteCommandAsync(); - await db.Deleteable(QcCheckItemsRs).ExecuteCommandAsync(); - await db.Deleteable(QcCheckItemsDs).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckItemsH).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckItemsRs).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckItemsDs).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); } @@ -52,33 +52,37 @@ namespace Tnb.QcMgr [HttpGet] public async Task GetCheckItem() { - var db = _repository.AsSugarClient(); - List CheckItemOuts = new List(); + ISqlSugarClient db = _repository.AsSugarClient(); + List CheckItemOuts = new(); var datas = await db.Queryable().InnerJoin((a, b) => a.type == b.id).Select((a, b) => new { - id = a.id, - name = a.name, - code = a.code, - type = a.type, + a.id, + a.name, + a.code, + a.type, typename = b.name }).ToListAsync(); foreach (var data in datas) { if (CheckItemOuts.Where(p => p.checktypeid == data.type).Any()) { - var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); + CheckItemOut CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); if (CheckItemOut.items == null) { - CheckItemOut.items = new List(); - CheckItemOut.items.Add(new CheckItem { itemid = data.id, name = data.name!, code = data.code! }); + CheckItemOut.items = new List + { + new CheckItem { itemid = data.id, name = data.name!, code = data.code! } + }; } else + { CheckItemOut.items.Add(new CheckItem { itemid = data.id, name = data.name!, code = data.code! }); + } } else { CheckItemOuts.Add(new CheckItemOut { checktypeid = data.type!, checktypename = data.typename!, items = new List() }); - var CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); + CheckItemOut CheckItemOut = CheckItemOuts.Where(p => p.checktypeid == data.type).First(); CheckItemOut.items?.Add(new CheckItem() { itemid = data.id, name = data.name!, code = data.code! }); } } @@ -93,68 +97,92 @@ namespace Tnb.QcMgr [HttpPost] public async Task GetCheckItems(CheckItemsInput CheckItemsInput) { - var db = _repository.AsSugarClient(); - var QcCheckItems = await db.Queryable().ToListAsync(); - var QcCheckTypes = await db.Queryable().ToListAsync(); - var QcCheckItemsH = await db.Queryable().Where(p => p.id == CheckItemsInput.id).FirstAsync(); - List QcCheckItemsRs = new List(); - List QcCheckItemsDs = new List(); + ISqlSugarClient db = _repository.AsSugarClient(); + List QcCheckItems = await db.Queryable().ToListAsync(); + List QcCheckTypes = await db.Queryable().ToListAsync(); + QcCheckItemsH QcCheckItemsH = await db.Queryable().Where(p => p.id == CheckItemsInput.id).FirstAsync(); + List QcCheckItemsRs = new(); + List QcCheckItemsDs = new(); if (QcCheckItemsH != null) { QcCheckItemsRs = await db.Queryable().Where(p => p.itemshid == QcCheckItemsH.id).ToListAsync(); if (QcCheckItemsRs != null) + { QcCheckItemsDs = await db.Queryable().Where(p => QcCheckItemsRs.Select(p => p.itemsdid).ToList().Contains(p.id)).ToListAsync(); + } } else + { throw Oops.Oh(ErrorCode.COM1005); - var CheckItemsOut = new CheckItemsOut(); - CheckItemsOut.id = QcCheckItemsH.id; - CheckItemsOut.name = QcCheckItemsH.name!; - CheckItemsOut.status = QcCheckItemsH.status!; - CheckItemsOut.checktypes = new List(); + } + + CheckItemsOut CheckItemsOut = new() + { + id = QcCheckItemsH.id, + name = QcCheckItemsH.name!, + status = QcCheckItemsH.status!, + checktypes = new List() + }; if (QcCheckItemsRs != null && QcCheckItemsDs != null) { - foreach (var QcCheckItemsR in QcCheckItemsRs) + foreach (QcCheckItemsR QcCheckItemsR in QcCheckItemsRs) { if (CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).ToList().Count == 0) { - CheckTypeOut checkType = new CheckTypeOut(); - checkType.checktypeid = QcCheckItemsR.typeid!; - checkType.checktypename = QcCheckTypes.Where(p => p.id == QcCheckItemsR.typeid).First().name!; - checkType.items = new List(); + CheckTypeOut checkType = new() + { + checktypeid = QcCheckItemsR.typeid!, + checktypename = QcCheckTypes.Where(p => p.id == QcCheckItemsR.typeid).First().name!, + items = new List() + }; CheckItemsOut.checktypes.Add(checkType); } - var item = QcCheckItemsDs.Where(p => p.id == QcCheckItemsR.itemsdid).FirstOrDefault(); + QcCheckItemsD? item = QcCheckItemsDs.Where(p => p.id == QcCheckItemsR.itemsdid).FirstOrDefault(); if (item != null) { - ItemOut Item = new ItemOut(); - Item.itemid = QcCheckItemsR.itemid!; - Item.itemdid = item.id!; - Item.code = QcCheckItems.Where(p => p.id == QcCheckItemsR.itemid).First().code!; - Item.name = QcCheckItems.Where(p => p.id == QcCheckItemsR.itemid).First().name!; - Item.setData = new Data(); - Item.setData.extype = item.extype!; - Item.setData.excontent = JSON.Deserialize(item.excontent!); - Item.setData.check = item.check!; + ItemOut Item = new() + { + itemid = QcCheckItemsR.itemid!, + itemdid = item.id!, + code = QcCheckItems.Where(p => p.id == QcCheckItemsR.itemid).First().code!, + name = QcCheckItems.Where(p => p.id == QcCheckItemsR.itemid).First().name!, + setData = new Data + { + extype = item.extype!, + excontent = JSON.Deserialize(item.excontent!), + check = item.check! + } + }; if (!string.IsNullOrEmpty(item.errorcause)) + { Item.setData.errorcause = item.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + } + if (!string.IsNullOrEmpty(item.errorlevel)) + { Item.setData.errorlevel = item.errorlevel!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + } + Item.setData.remark = item.remark!; Item.setData.attachment = item.attachment!; Item.setData.customer = item.custom!; if (!string.IsNullOrEmpty(item.isexec)) + { Item.setData.isexec = JSON.Deserialize(item.isexec!); - Item.setShow = new Show(); - Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype); - Item.setShow.excontent = !string.IsNullOrEmpty(item.excontent); - Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check); - Item.setShow.errorcause = Item.setData.errorcause == null ? false : true; - Item.setShow.errorlevel = Item.setData.errorlevel == null ? false : true; - Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark); - Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); - Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer); - Item.setShow.isexec = Item.setData.isexec == null ? false : true; + } + + Item.setShow = new Show + { + extype = !string.IsNullOrEmpty(Item.setData.extype), + excontent = !string.IsNullOrEmpty(item.excontent), + check = !string.IsNullOrEmpty(Item.setData.check), + errorcause = Item.setData.errorcause != null, + errorlevel = Item.setData.errorlevel != null, + remark = !string.IsNullOrEmpty(Item.setData.remark), + attachment = !string.IsNullOrEmpty(Item.setData.attachment), + customer = !string.IsNullOrEmpty(Item.setData.customer), + isexec = Item.setData.isexec != null + }; CheckItemsOut.checktypes.Where(p => p.checktypeid == QcCheckItemsR.typeid).First().items?.Add(Item); } } @@ -171,27 +199,32 @@ namespace Tnb.QcMgr [HttpPost] public async Task SaveData(CheckItemsInput CheckItemsInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); try { if (!string.IsNullOrEmpty(CheckItemsInput.id)) + { await Delete(CheckItemsInput.id); - QcCheckItemsH QcCheckItemsH = new QcCheckItemsH(); - QcCheckItemsH.name = CheckItemsInput.name; - QcCheckItemsH.status = CheckItemsInput.status; - QcCheckItemsH.create_time = DateTime.Now; - QcCheckItemsH.create_id = _userManager.UserId; - List QcCheckItemsRs = new List(); - List QcCheckItemsDs = new List(); + } + + QcCheckItemsH QcCheckItemsH = new() + { + name = CheckItemsInput.name, + status = CheckItemsInput.status, + create_time = DateTime.Now, + create_id = _userManager.UserId + }; + List QcCheckItemsRs = new(); + List QcCheckItemsDs = new(); if (CheckItemsInput.checktypes != null) { - foreach (var checktype in CheckItemsInput.checktypes) + foreach (CheckTypeInput checktype in CheckItemsInput.checktypes) { if (checktype.items != null) { - foreach (var item in checktype.items) + foreach (ItemInput item in checktype.items) { - var QcCheckItemsD = new QcCheckItemsD() + QcCheckItemsD QcCheckItemsD = new() { extype = item.extype, excontent = item.excontent, @@ -204,7 +237,7 @@ namespace Tnb.QcMgr custom = item.customer }; QcCheckItemsDs.Add(QcCheckItemsD); - var QcCheckItemsR = new QcCheckItemsR() + QcCheckItemsR QcCheckItemsR = new() { itemshid = QcCheckItemsH.id, typeid = checktype.id, @@ -224,9 +257,9 @@ namespace Tnb.QcMgr }); await db.Ado.BeginTranAsync(); - await db.Insertable(QcCheckItemsH).ExecuteCommandAsync(); - await db.Insertable(QcCheckItemsRs).ExecuteCommandAsync(); - await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckItemsH).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckItemsRs).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckItemsDs).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); } catch (Exception) diff --git a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs index ae2f83f8..9fafc113 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckPlanService.cs @@ -41,21 +41,21 @@ namespace Tnb.QcMgr } private async Task Delete(string id) { - var db = _repository.AsSugarClient(); - var QcCheckPlanH = await db.Queryable().Where(p => p.id == id).FirstAsync(); - var QcCheckPlanDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); - var QcCheckPlanAdds = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); - var QcCheckPlanMaterials = await db.Queryable().Where(p => p.planid == id).ToListAsync(); - var QcCheckPlanProcesss = await db.Queryable().Where(p => p.planid == id).ToListAsync(); - var QcCheckPlanWorks = await db.Queryable().Where(p => p.planid == id).ToListAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + QcCheckPlanH QcCheckPlanH = await db.Queryable().Where(p => p.id == id).FirstAsync(); + List QcCheckPlanDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); + List QcCheckPlanAdds = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); + List QcCheckPlanMaterials = await db.Queryable().Where(p => p.planid == id).ToListAsync(); + List QcCheckPlanProcesss = await db.Queryable().Where(p => p.planid == id).ToListAsync(); + List QcCheckPlanWorks = await db.Queryable().Where(p => p.planid == id).ToListAsync(); await _timeTaskService.DeleteByName("生成质检任务" + QcCheckPlanH.id); await db.Ado.BeginTranAsync(); - await db.Deleteable(QcCheckPlanH).ExecuteCommandAsync(); - await db.Deleteable(QcCheckPlanDs).ExecuteCommandAsync(); - await db.Deleteable(QcCheckPlanAdds).ExecuteCommandAsync(); - await db.Deleteable(QcCheckPlanMaterials).ExecuteCommandAsync(); - await db.Deleteable(QcCheckPlanProcesss).ExecuteCommandAsync(); - await db.Deleteable(QcCheckPlanWorks).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckPlanH).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckPlanDs).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckPlanAdds).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckPlanMaterials).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckPlanProcesss).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckPlanWorks).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); } /// @@ -66,15 +66,17 @@ namespace Tnb.QcMgr [HttpPost] public async Task GetCheckItems(string id) { - var db = _repository.AsSugarClient(); - var QcCheckItems = await db.Queryable().ToListAsync(); - var QcCheckTypes = await db.Queryable().ToListAsync(); - var QcCheckPlanAdd = await db.Queryable().Where(p => p.mainid == id).FirstAsync(); - var QcCheckPlanDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); - var CheckPlansOut = new CheckPlansOut(); - CheckPlansOut.id = id; - CheckPlansOut.hasadd = false; - CheckPlansOut.hasitem = false; + ISqlSugarClient db = _repository.AsSugarClient(); + List QcCheckItems = await db.Queryable().ToListAsync(); + List QcCheckTypes = await db.Queryable().ToListAsync(); + QcCheckPlanAdd QcCheckPlanAdd = await db.Queryable().Where(p => p.mainid == id).FirstAsync(); + List QcCheckPlanDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); + CheckPlansOut CheckPlansOut = new() + { + id = id, + hasadd = false, + hasitem = false + }; if (QcCheckPlanAdd != null) { CheckPlansOut.hasadd = true; @@ -87,54 +89,61 @@ namespace Tnb.QcMgr { CheckPlansOut.hasitem = true; CheckPlansOut.checktypes = new List(); - foreach (var QcCheckPlanD in QcCheckPlanDs) + foreach (QcCheckPlanD QcCheckPlanD in QcCheckPlanDs) { if (CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).ToList().Count == 0) { - CheckPlanTypeOut checkType = new CheckPlanTypeOut(); - checkType.checktypeid = QcCheckPlanD.typeid!; - checkType.checktypename = QcCheckTypes.Where(p => p.id == QcCheckPlanD.typeid).First().name!; - checkType.items = new List(); + CheckPlanTypeOut checkType = new() + { + checktypeid = QcCheckPlanD.typeid!, + checktypename = QcCheckTypes.Where(p => p.id == QcCheckPlanD.typeid).First().name!, + items = new List() + }; CheckPlansOut.checktypes.Add(checkType); } - PlanItemOut Item = new PlanItemOut(); - Item.itemid = QcCheckPlanD.itemid!; - Item.itemdid = QcCheckPlanD.id!; - Item.code = QcCheckItems.Where(p => p.id == QcCheckPlanD.itemid).First().code!; - Item.name = QcCheckItems.Where(p => p.id == QcCheckPlanD.itemid).First().name!; - Item.setData = new PlanItemData(); - Item.setData.extype = QcCheckPlanD.extype!; - Item.setData.excontent = JSON.Deserialize(QcCheckPlanD.excontent!); - Item.setData.check = QcCheckPlanD.check!; + PlanItemOut Item = new() + { + itemid = QcCheckPlanD.itemid!, + itemdid = QcCheckPlanD.id!, + code = QcCheckItems.Where(p => p.id == QcCheckPlanD.itemid).First().code!, + name = QcCheckItems.Where(p => p.id == QcCheckPlanD.itemid).First().name!, + setData = new PlanItemData + { + extype = QcCheckPlanD.extype!, + excontent = JSON.Deserialize(QcCheckPlanD.excontent!), + check = QcCheckPlanD.check! + } + }; if (!string.IsNullOrEmpty(QcCheckPlanD.errorcause)) + { Item.setData.errorcause = QcCheckPlanD.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + } + if (!string.IsNullOrEmpty(QcCheckPlanD.errorlevel)) + { Item.setData.errorlevel = QcCheckPlanD.errorlevel!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + } + Item.setData.remark = QcCheckPlanD.remark!; Item.setData.attachment = QcCheckPlanD.attachment!; Item.setData.customer = QcCheckPlanD.custom!; if (!string.IsNullOrEmpty(QcCheckPlanD.isexec)) + { Item.setData.isexec = JSON.Deserialize(QcCheckPlanD.isexec!); - Item.setShow = new PlanItemShow(); - Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype); - Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckPlanD.excontent); - Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check); - Item.setShow.errorcause = Item.setData.errorcause == null ? false : true; - Item.setShow.errorlevel = Item.setData.errorlevel == null ? false : true; - Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark); - Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); - Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer); - if (Item.setData.isexec == null) - { - Item.setShow.isexec = false; } - else + + Item.setShow = new PlanItemShow { - if (!Item.setData.isexec.attachment && !Item.setData.isexec.remark) - Item.setShow.isexec = false; - else - Item.setShow.isexec = true; - } + extype = !string.IsNullOrEmpty(Item.setData.extype), + excontent = !string.IsNullOrEmpty(QcCheckPlanD.excontent), + check = !string.IsNullOrEmpty(Item.setData.check), + errorcause = Item.setData.errorcause != null, + errorlevel = Item.setData.errorlevel != null, + remark = !string.IsNullOrEmpty(Item.setData.remark), + attachment = !string.IsNullOrEmpty(Item.setData.attachment), + customer = !string.IsNullOrEmpty(Item.setData.customer) + }; + Item.setShow.isexec = Item.setData.isexec != null && (Item.setData.isexec.attachment || Item.setData.isexec.remark); CheckPlansOut.checktypes.Where(p => p.checktypeid == QcCheckPlanD.typeid).First()?.items?.Add(Item); } @@ -150,18 +159,20 @@ namespace Tnb.QcMgr [HttpPost] public async Task GetTriggerPlans() { - var db = _repository.AsSugarClient(); - var QcTriggerPlans = await db.Queryable().ToListAsync(); - var QcTriggerEvents = await db.Queryable().ToListAsync(); - List TriggerPlans = new List(); - foreach (var triggerPlan in QcTriggerPlans) + ISqlSugarClient db = _repository.AsSugarClient(); + List QcTriggerPlans = await db.Queryable().ToListAsync(); + List QcTriggerEvents = await db.Queryable().ToListAsync(); + List TriggerPlans = new(); + foreach (QcTriggerPlan triggerPlan in QcTriggerPlans) { - TriggerPlan TriggerPlan = new TriggerPlan(); - TriggerPlan.id = triggerPlan.id; - TriggerPlan.name = triggerPlan.name!; - TriggerPlan.code = triggerPlan.code!; - TriggerPlan.type = triggerPlan.type!; - TriggerPlan.cycle = triggerPlan.cycle!; + TriggerPlan TriggerPlan = new() + { + id = triggerPlan.id, + name = triggerPlan.name!, + code = triggerPlan.code!, + type = triggerPlan.type!, + cycle = triggerPlan.cycle! + }; if (!string.IsNullOrEmpty(triggerPlan.trievent)) { TriggerPlan.trieventid = triggerPlan.trievent!.Replace("[", "").Replace("]", "").Replace("\r\n", "").Replace("\"", "").Replace(" ", "").Split(',', StringSplitOptions.RemoveEmptyEntries); @@ -180,69 +191,81 @@ namespace Tnb.QcMgr [HttpPost] public async Task SaveData(CheckPlanInput CheckPlanInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); try { if (string.IsNullOrEmpty(CheckPlanInput.mainid)) + { return; + } + await _timeTaskService.DeleteByName("生成质检任务" + CheckPlanInput.mainid); - await db.Deleteable(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync(); - await db.Deleteable(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync(); - QcCheckPlanAdd QcCheckPlanAdd = new QcCheckPlanAdd(); - QcCheckPlanAdd.mainid = CheckPlanInput.mainid; - QcCheckPlanAdd.triggertype = CheckPlanInput.triggertype; - QcCheckPlanAdd.content = CheckPlanInput.content; - QcCheckPlanAdd.number = CheckPlanInput.number; - List QcCheckPlanDs = new List(); + _ = await db.Deleteable(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync(); + _ = await db.Deleteable(p => p.mainid == CheckPlanInput.mainid).ExecuteCommandAsync(); + QcCheckPlanAdd QcCheckPlanAdd = new() + { + mainid = CheckPlanInput.mainid, + triggertype = CheckPlanInput.triggertype, + content = CheckPlanInput.content, + number = CheckPlanInput.number + }; + List QcCheckPlanDs = new(); if (CheckPlanInput.checktypes != null) { - foreach (var checktype in CheckPlanInput.checktypes) + foreach (CheckPlanTypeInput checktype in CheckPlanInput.checktypes) { if (checktype.items != null) { - foreach (var item in checktype.items) + foreach (PlanItemInput item in checktype.items) { - QcCheckPlanD QcCheckPlanD = new QcCheckPlanD(); - QcCheckPlanD.mainid = CheckPlanInput.mainid; - QcCheckPlanD.typeid = checktype.id; - QcCheckPlanD.itemid = item.itemid; - QcCheckPlanD.extype = item.extype; - QcCheckPlanD.excontent = item.excontent; - QcCheckPlanD.check = item.check; - QcCheckPlanD.errorcause = item.errorcause?.Replace("\"", "").Trim(); - QcCheckPlanD.errorlevel = item.errorlevel?.Replace("\"", "").Trim(); - QcCheckPlanD.remark = item.remark; - QcCheckPlanD.attachment = item.attachment; - QcCheckPlanD.isexec = item.isexec; - QcCheckPlanD.custom = item.customer; - QcCheckPlanD.create_id = _userManager.UserId; - QcCheckPlanD.create_time = DateTime.Now; + QcCheckPlanD QcCheckPlanD = new() + { + mainid = CheckPlanInput.mainid, + typeid = checktype.id, + itemid = item.itemid, + extype = item.extype, + excontent = item.excontent, + check = item.check, + errorcause = item.errorcause?.Replace("\"", "").Trim(), + errorlevel = item.errorlevel?.Replace("\"", "").Trim(), + remark = item.remark, + attachment = item.attachment, + isexec = item.isexec, + custom = item.customer, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; QcCheckPlanDs.Add(QcCheckPlanD); } } } } await db.Ado.BeginTranAsync(); - await db.Insertable(QcCheckPlanDs).ExecuteCommandAsync(); - await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckPlanDs).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckPlanAdd).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); if (QcCheckPlanAdd.triggertype == ((int)EnumTriggerType.周期触发).ToString() || QcCheckPlanAdd.triggertype == ((int)EnumTriggerType.一次性).ToString()) { - var comtentModel = new ContentModel(); - comtentModel.cron = QcCheckPlanAdd.content!.Replace("\"", ""); - comtentModel.interfaceId = ""; - comtentModel.interfaceName = ""; - comtentModel.parameter = new List(); + ContentModel comtentModel = new() + { + cron = QcCheckPlanAdd.content!.Replace("\"", ""), + interfaceId = "", + interfaceName = "", + parameter = new List() + }; comtentModel.parameter!.Add(new InterfaceParameter() { field = "id", value = QcCheckPlanAdd.mainid, defaultValue = "" }); if (QcCheckPlanAdd.triggertype == ((int)EnumTriggerType.一次性).ToString()) + { comtentModel.parameter!.Add(new InterfaceParameter() { field = "doonce", value = true.ToString(), defaultValue = "" }); + } + comtentModel.localHostTaskId = "QcTaskTimeWorker/CreateTask"; comtentModel.startTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); comtentModel.TenantId = _userManager?.TenantId!; comtentModel.TenantDbName = _userManager?.TenantDbName!; comtentModel.ConnectionConfig = _userManager?.ConnectionConfig!; comtentModel.Token = _userManager?.ToKen!; - TimeTaskCrInput timeTaskCrInput = new TimeTaskCrInput() + TimeTaskCrInput timeTaskCrInput = new() { enCode = DateTime.Now.ToString("yyyyMMddHHmmss"), fullName = "生成质检任务" + QcCheckPlanAdd.mainid, @@ -271,7 +294,7 @@ namespace Tnb.QcMgr [HttpPost] public async Task CreateTask(TriggerPlanEntity entity) { - var Query = _repository.AsSugarClient().Queryable + ISugarQueryable Query = _repository.AsSugarClient().Queryable ((a, b, c, d, e) => new object[] { JoinType.Inner,a.id== b.mainid, JoinType.Left,a.id == c.planid, @@ -279,9 +302,9 @@ namespace Tnb.QcMgr JoinType.Left,a.id == e.planid, }); GetQuery(Query, entity); - var list = await Query.ToListAsync(); - List removes = new List(); - foreach (var data in list) + List list = await Query.ToListAsync(); + List removes = new(); + foreach (QcCheckPlanH data in list) { if (!string.IsNullOrEmpty(entity.materialid)) { @@ -322,25 +345,27 @@ namespace Tnb.QcMgr // .WhereIF(!string.IsNullOrEmpty(entity.workid), (a, b, c, d, e) => e.workid == entity.workid).ToListAsync(); Filter(list, entity); if (list.Count > 0) + { await SaveTask(list, entity); + } } private void GetQuery(ISugarQueryable Query, TriggerPlanEntity entity) { - var DictionaryData = _repository.AsSugarClient().Queryable + List DictionaryData = _repository.AsSugarClient().Queryable ((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, }) .Where((a, b) => b.FullName == "质检类型选择").ToList(); - var TriggerEvent = new QcTriggerEvent(); - var enumTriggerEvent = entity.triggerevent; - var remark = RemarkAttribute.GetRemark(enumTriggerEvent); - var type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id; + QcTriggerEvent TriggerEvent = new(); + EnumTriggerEvent? enumTriggerEvent = entity.triggerevent; + RemarkAttribute remark = RemarkAttribute.GetRemark(enumTriggerEvent); + string type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id; TriggerEvent = _repository.AsSugarClient().Queryable().Where(p => p.type == type && p.name == remark.CheckContent).First(); Query = Query.Where((a, b, c, d, e) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id)); } private void Filter(List QcCheckPlanHs, TriggerPlanEntity entity) { - var removePlanHs = new List(); - var enumTriggerEvent = entity.triggerevent; - foreach (var plan in QcCheckPlanHs) + List removePlanHs = new(); + EnumTriggerEvent? enumTriggerEvent = entity.triggerevent; + foreach (QcCheckPlanH plan in QcCheckPlanHs) { if (enumTriggerEvent == EnumTriggerEvent.首件检换模具) { @@ -378,9 +403,11 @@ namespace Tnb.QcMgr } if (enumTriggerEvent == EnumTriggerEvent.生产检定量) { - var number = _repository.AsSugarClient().Queryable().Where(p => p.mainid == plan.id).First().number; - if ((entity.newpronum + entity.oldpronum / number) <= (entity.oldpronum / number)) + int? number = _repository.AsSugarClient().Queryable().Where(p => p.mainid == plan.id).First().number; + if ((entity.newpronum + (entity.oldpronum / number)) <= (entity.oldpronum / number)) + { removePlanHs.Add(plan); + } } if (enumTriggerEvent == EnumTriggerEvent.生产检定码) { @@ -388,9 +415,11 @@ namespace Tnb.QcMgr } if (enumTriggerEvent == EnumTriggerEvent.生产检产出频次) { - var number = _repository.AsSugarClient().Queryable().Where(p => p.mainid == plan.id).First().number; + int? number = _repository.AsSugarClient().Queryable().Where(p => p.mainid == plan.id).First().number; if ((entity.pronum % number) != 0) + { removePlanHs.Add(plan); + } } if (enumTriggerEvent == EnumTriggerEvent.生产检固定次数) { @@ -401,49 +430,53 @@ namespace Tnb.QcMgr } } - removePlanHs.ForEach(p => { QcCheckPlanHs.Remove(p); }); + removePlanHs.ForEach(p => { _ = QcCheckPlanHs.Remove(p); }); } private async Task SaveTask(List planhs, TriggerPlanEntity entity) { - var DictionaryData = _repository.AsSugarClient().Queryable + DictionaryDataEntity DictionaryData = _repository.AsSugarClient().Queryable ((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, }) .Where((a, b) => b.FullName == "质检状态" && a.FullName == "待执行").First(); - var plands = await _repository.AsSugarClient().Queryable().Where(p => planhs.Select(p => p.id).ToList().Contains(p.mainid!)).ToListAsync(); - foreach (var planh in planhs) + List plands = await _repository.AsSugarClient().Queryable().Where(p => planhs.Select(p => p.id).ToList().Contains(p.mainid!)).ToListAsync(); + foreach (QcCheckPlanH planh in planhs) { - var time = DateTime.Now; - QcCheckExecH qcCheckExecH = new QcCheckExecH(); - qcCheckExecH.id = SnowflakeIdHelper.NextId(); - qcCheckExecH.checktype = planh.checktype; - qcCheckExecH.status = DictionaryData.Id; - qcCheckExecH.tasktime = time.ToString("yyyy-MM-dd HH:mm:ss"); - qcCheckExecH.materialid = entity.materialid; - qcCheckExecH.processid = entity.processid; - qcCheckExecH.workid = entity.workid; - qcCheckExecH.create_id = _userManager.UserId; - qcCheckExecH.create_time = time; - var ExecDs = new List(); - foreach (var pland in plands.Where(p => p.mainid == planh.id).ToList()) + DateTime time = DateTime.Now; + QcCheckExecH qcCheckExecH = new() { - 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; - QcCheckExecD.create_id = _userManager.UserId; - QcCheckExecD.create_time = time; + id = SnowflakeIdHelper.NextId(), + checktype = planh.checktype, + status = DictionaryData.Id, + tasktime = time.ToString("yyyy-MM-dd HH:mm:ss"), + materialid = entity.materialid, + processid = entity.processid, + workid = entity.workid, + create_id = _userManager.UserId, + create_time = time + }; + List ExecDs = new(); + foreach (QcCheckPlanD? pland in plands.Where(p => p.mainid == planh.id).ToList()) + { + QcCheckExecD QcCheckExecD = new() + { + mainid = qcCheckExecH.id, + extype = pland.extype, + excontent = pland.excontent, + check = pland.check, + errorcause = pland.errorcause, + errorlevel = pland.errorlevel, + remark = pland.remark, + attachment = pland.attachment, + isexec = pland.isexec, + custom = pland.custom, + typeid = pland.typeid, + itemid = pland.itemid, + create_id = _userManager.UserId, + create_time = time + }; ExecDs.Add(QcCheckExecD); } - await _repository.AsSugarClient().Insertable(qcCheckExecH).ExecuteCommandAsync(); - await _repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(qcCheckExecH).ExecuteCommandAsync(); + _ = await _repository.AsSugarClient().Insertable(ExecDs).ExecuteCommandAsync(); } } diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs index 7a49684f..1d2880e5 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskResultService.cs @@ -34,22 +34,24 @@ namespace Tnb.QcMgr } private async Task GetListAsync(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary dic = new Dictionary(); - dic.Add("ok", "合格"); - dic.Add("no", "不合格"); - dic.Add("barelyok", "让步合格"); - dic.Add("await", "待检"); - dic.Add("temporarily", "暂控"); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary dic = new() + { + { "ok", "合格" }, + { "no", "不合格" }, + { "barelyok", "让步合格" }, + { "await", "待检" }, + { "temporarily", "暂控" } + }; + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; - var list = await db.Queryable() + List list = await db.Queryable() .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); - var BasLocations = await db.Queryable().ToListAsync(); - var result = await db.Queryable() + List BasLocations = await db.Queryable().ToListAsync(); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.materialid == b.id) .LeftJoin((a, b, c) => a.processid == c.id) .LeftJoin((a, b, c, d) => a.workid == d.Id) @@ -69,11 +71,11 @@ namespace Tnb.QcMgr checknum = a.checknum, status = a.status, result = a.result, - tasktime = a.tasktime == null ? "" : a.tasktime, - exectime = a.exectime == null ? "" : a.exectime, - execuser = e.RealName == null ? "" : e.RealName, + tasktime = a.tasktime ?? "", + exectime = a.exectime ?? "", + execuser = e.RealName ?? "", }).OrderByDescending(a => DateTime.Parse(a.exectime)).ToPagedListAsync(input.currentPage, input.pageSize); - foreach (var item in result.list) + foreach (QcCheckExecHOut? item in result.list) { item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; @@ -86,31 +88,27 @@ namespace Tnb.QcMgr [HttpPost] public async Task GetCheckTask(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary dic = new Dictionary(); - dic.Add("ok", "合格"); - dic.Add("no", "不合格"); - dic.Add("barelyOk", "让步合格"); - dic.Add("await", "待检"); - dic.Add("temporarily", "暂控"); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary dic = new() + { + { "ok", "合格" }, + { "no", "不合格" }, + { "barelyOk", "让步合格" }, + { "await", "待检" }, + { "temporarily", "暂控" } + }; + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; - var list = await db.Queryable() + List list = await db.Queryable() .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); - var BasLocations = await db.Queryable().ToListAsync(); - Expression> expression; - if (list.Where(p => p.FullName == "待执行").First().Id == status) - { - expression = a => DateTime.Parse(a.tasktime!); - } - else - { - expression = a => DateTime.Parse(a.exectime!); - } - var result = await db.Queryable() + List BasLocations = await db.Queryable().ToListAsync(); + Expression> expression = list.Where(p => p.FullName == "待执行").First().Id == status + ? (a => DateTime.Parse(a.tasktime!)) + : (a => DateTime.Parse(a.exectime!)); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.materialid == b.id) .LeftJoin((a, b, c) => a.processid == c.id) .LeftJoin((a, b, c, d) => a.workid == d.Id) @@ -130,12 +128,12 @@ namespace Tnb.QcMgr checknum = a.checknum, status = a.status, result = a.result, - tasktime = a.tasktime == null ? "" : a.tasktime, - exectime = a.exectime == null ? "" : a.exectime, - execuser = e.RealName == null ? "" : e.RealName, + tasktime = a.tasktime ?? "", + exectime = a.exectime ?? "", + execuser = e.RealName ?? "", }).OrderByDescending(expression).ToPagedListAsync(input.currentPage, input.pageSize); - foreach (var item in result.list) + foreach (QcCheckExecHOut? item in result.list) { item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs index 1f1201d1..34a86548 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs @@ -39,22 +39,24 @@ namespace Tnb.QcMgr private async Task GetListAsync(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); - Dictionary dic = new Dictionary(); - dic.Add("ok", "合格"); - dic.Add("no", "不合格"); - dic.Add("barelyok", "让步合格"); - dic.Add("await", "待检"); - dic.Add("temporarily", "暂控"); - Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + ISqlSugarClient db = _repository.AsSugarClient(); + Dictionary dic = new() + { + { "ok", "合格" }, + { "no", "不合格" }, + { "barelyok", "让步合格" }, + { "await", "待检" }, + { "temporarily", "暂控" } + }; + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string materialid = queryJson.ContainsKey("materialid") ? queryJson["materialid"].ToString() : ""; string checktype = queryJson.ContainsKey("checktype") ? queryJson["checktype"].ToString() : ""; string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; - var list = await db.Queryable() + List list = await db.Queryable() .LeftJoin((a, b) => a.DictionaryTypeId == b.Id) .Where((a, b) => b.FullName == "质检状态" || b.FullName == "质检类型选择").ToListAsync(); - var BasLocations = await db.Queryable().ToListAsync(); - var result = await db.Queryable() + List BasLocations = await db.Queryable().ToListAsync(); + SqlSugarPagedList result = await db.Queryable() .LeftJoin((a, b) => a.materialid == b.id) .LeftJoin((a, b, c) => a.processid == c.id) .LeftJoin((a, b, c, d) => a.workid == d.Id) @@ -74,11 +76,11 @@ namespace Tnb.QcMgr checknum = a.checknum, status = a.status, result = a.result, - tasktime = a.tasktime == null ? "" : a.tasktime, - exectime = a.exectime == null ? "" : a.exectime, - execuser = e.RealName == null ? "" : e.RealName, + tasktime = a.tasktime ?? "", + exectime = a.exectime ?? "", + execuser = e.RealName ?? "", }).OrderByDescending(a => DateTime.Parse(a.tasktime)).ToPagedListAsync(input.currentPage, input.pageSize); - foreach (var item in result.list) + foreach (QcCheckExecHOut? item in result.list) { item.checktype = list.Select(p => p.Id).Contains(item.checktype) ? list.Where(p => p.Id == item.checktype).First().FullName : ""; item.status = list.Select(p => p.Id).Contains(item.status) ? list.Where(p => p.Id == item.status).First().FullName : ""; @@ -95,55 +97,66 @@ namespace Tnb.QcMgr [HttpGet] public async Task GetTaskItems(string id) { - var db = _repository.AsSugarClient(); - var QcCheckExecH = await db.Queryable().Where(p => p.id == id).FirstAsync(); - var QcCheckExecDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); - var QcCheckItems = await db.Queryable().ToListAsync(); - var QcCheckTypes = await db.Queryable().ToListAsync(); - var QcErrorCauses = await db.Queryable().ToListAsync(); - var QcErrorLevels = await db.Queryable().ToListAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + QcCheckExecH QcCheckExecH = await db.Queryable().Where(p => p.id == id).FirstAsync(); + List QcCheckExecDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); + List QcCheckItems = await db.Queryable().ToListAsync(); + List QcCheckTypes = await db.Queryable().ToListAsync(); + List QcErrorCauses = await db.Queryable().ToListAsync(); + List QcErrorLevels = await db.Queryable().ToListAsync(); - CheckTaskOut CheckTaskOut = new CheckTaskOut(); - CheckTaskOut.mainid = id; - CheckTaskOut.wareid = QcCheckExecH.wareid!; - CheckTaskOut.workid = QcCheckExecH.workid!; - CheckTaskOut.status = QcCheckExecH.status!; + CheckTaskOut CheckTaskOut = new() + { + mainid = id, + wareid = QcCheckExecH.wareid!, + workid = QcCheckExecH.workid!, + status = QcCheckExecH.status! + }; if (!string.IsNullOrEmpty(CheckTaskOut.workid)) + { CheckTaskOut.workname = db.Queryable().Where(p => p.Id == CheckTaskOut.workid).First().FullName; + } + CheckTaskOut.checktypes = new List(); - foreach (var QcCheckExecD in QcCheckExecDs) + foreach (QcCheckExecD QcCheckExecD in QcCheckExecDs) { if (CheckTaskOut.checktypes.Where(p => p.checktypeid == QcCheckExecD.typeid).ToList().Count == 0) { - CheckExecTypeOut checkType = new CheckExecTypeOut(); - checkType.checktypeid = QcCheckExecD.typeid!; - checkType.checktypename = QcCheckTypes.Where(p => p.id == QcCheckExecD.typeid).First().name!; - checkType.items = new List(); + CheckExecTypeOut checkType = new() + { + checktypeid = QcCheckExecD.typeid!, + checktypename = QcCheckTypes.Where(p => p.id == QcCheckExecD.typeid).First().name!, + items = new List() + }; CheckTaskOut.checktypes.Add(checkType); } - ExecItemOut Item = new ExecItemOut(); - Item.itemid = QcCheckExecD.itemid!; - Item.itemdid = QcCheckExecD.id!; - Item.code = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().code!; - Item.name = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().name!; - Item.setData = new ExecItemData(); - Item.setData.extype = QcCheckExecD.extype!; - Item.setData.excontent = JSON.Deserialize(QcCheckExecD.excontent!); - Item.setData.check = QcCheckExecD.check!; + ExecItemOut Item = new() + { + itemid = QcCheckExecD.itemid!, + itemdid = QcCheckExecD.id!, + code = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().code!, + name = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().name!, + setData = new ExecItemData + { + extype = QcCheckExecD.extype!, + excontent = JSON.Deserialize(QcCheckExecD.excontent!), + check = QcCheckExecD.check! + } + }; if (!string.IsNullOrEmpty(QcCheckExecD.errorcause)) { - var strs = QcCheckExecD.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + string[] strs = QcCheckExecD.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); Item.setData.errorcause = new List(); - foreach (var str in strs) + foreach (string str in strs) { Item.setData.errorcause.Add(new Error { id = str, name = QcErrorCauses.Where(p => p.id == str).First().name! }); } } if (!string.IsNullOrEmpty(QcCheckExecD.errorlevel)) { - var strs = QcCheckExecD.errorlevel!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + string[] strs = QcCheckExecD.errorlevel!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); Item.setData.errorlevel = new List(); - foreach (var str in strs) + foreach (string str in strs) { Item.setData.errorlevel.Add(new Error { id = str, name = QcErrorLevels.Where(p => p.id == str).First().name! }); } @@ -152,17 +165,22 @@ namespace Tnb.QcMgr Item.setData.attachment = QcCheckExecD.attachment!; Item.setData.customer = QcCheckExecD.custom!; if (!string.IsNullOrEmpty(QcCheckExecD.isexec)) + { Item.setData.isexec = JSON.Deserialize(QcCheckExecD.isexec!); - Item.setShow = new ExecItemShow(); - Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype); - Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent); - Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check); - Item.setShow.errorcause = Item.setData.errorcause == null || Item.setData.errorcause?.Count == 0 ? false : true; - Item.setShow.errorlevel = Item.setData.errorlevel == null || Item.setData.errorlevel?.Count == 0 ? false : true; - Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark); - Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); - Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer); - Item.setShow.isexec = Item.setData.isexec == null ? false : true; + } + + Item.setShow = new ExecItemShow + { + extype = !string.IsNullOrEmpty(Item.setData.extype), + excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent), + check = !string.IsNullOrEmpty(Item.setData.check), + errorcause = Item.setData.errorcause != null && (Item.setData.errorcause?.Count) != 0, + errorlevel = Item.setData.errorlevel != null && (Item.setData.errorlevel?.Count) != 0, + remark = !string.IsNullOrEmpty(Item.setData.remark), + attachment = !string.IsNullOrEmpty(Item.setData.attachment), + customer = !string.IsNullOrEmpty(Item.setData.customer), + isexec = Item.setData.isexec != null + }; CheckTaskOut.checktypes.Where(p => p.checktypeid == QcCheckExecD.typeid).First()?.items?.Add(Item); } return CheckTaskOut; @@ -176,57 +194,68 @@ namespace Tnb.QcMgr [HttpPost] public async Task SaveData(CheckTaskInput CheckTaskInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); try { - var QcCheckExecH = await db.Queryable().Where(p => p.id == CheckTaskInput.mainid).FirstAsync(); - var DictionaryType = await db.Queryable().Where(p => p.FullName == "质检状态").FirstAsync(); - var DictionaryData = await db.Queryable().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "已完成").FirstAsync(); + QcCheckExecH QcCheckExecH = await db.Queryable().Where(p => p.id == CheckTaskInput.mainid).FirstAsync(); + DictionaryTypeEntity DictionaryType = await db.Queryable().Where(p => p.FullName == "质检状态").FirstAsync(); + DictionaryDataEntity DictionaryData = await db.Queryable().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "已完成").FirstAsync(); QcCheckExecH.checknum = CheckTaskInput.checknum; QcCheckExecH.status = DictionaryData.Id; QcCheckExecH.result = CheckTaskInput.result; QcCheckExecH.execuser = _userManager.UserId; QcCheckExecH.exectime = DateTime.Now.ToString(); - var QcCheckExecDs = await db.Queryable().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync(); - var QcCheckExecDdel = new List(); - var QcCheckExecDinsert = new List(); + List QcCheckExecDs = await db.Queryable().Where(p => p.mainid == CheckTaskInput.mainid).ToListAsync(); + List QcCheckExecDdel = new(); + List QcCheckExecDinsert = new(); if (CheckTaskInput.checktypes?.Count > 0) { for (int i = 0; i < CheckTaskInput.checktypes.Count; i++) { if (CheckTaskInput.checktypes[i].Count > 0) { - foreach (var exextype in CheckTaskInput.checktypes[i]) + foreach (Exextype exextype in CheckTaskInput.checktypes[i]) { if (exextype.items != null) { - foreach (var item in exextype.items) + foreach (ExecItemInput item in exextype.items) { if (item.postItemForm == null) + { throw Oops.Oh("执行失败"); - var QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault(); + } + + QcCheckExecD? QcCheckExecD = QcCheckExecDs.Where(p => p.id == item.itemdid).FirstOrDefault(); if (QcCheckExecD == null) + { continue; + } + if (QcCheckExecDdel.Where(p => p.id == QcCheckExecD.id).FirstOrDefault() == null) + { QcCheckExecDdel.Add(QcCheckExecD); - var insert = new QcCheckExecD(); - insert.mainid = QcCheckExecD.mainid; - insert.extype = QcCheckExecD.extype; - insert.excontent = QcCheckExecD.excontent; - insert.check = QcCheckExecD.check; - insert.errorcause = QcCheckExecD.errorcause; - insert.errorlevel = QcCheckExecD.errorlevel; - insert.remark = QcCheckExecD.remark; - insert.attachment = QcCheckExecD.attachment; - insert.isexec = QcCheckExecD.isexec; - insert.custom = QcCheckExecD.custom; - insert.typeid = QcCheckExecD.typeid; - insert.itemid = QcCheckExecD.itemid; - insert.create_id = QcCheckExecD.create_id; - insert.create_time = QcCheckExecD.create_time; - insert.postdata = item.postItemForm; - insert.result = item.result; - insert.checkindex = (i + 1).ToString(); + } + + QcCheckExecD insert = new() + { + mainid = QcCheckExecD.mainid, + extype = QcCheckExecD.extype, + excontent = QcCheckExecD.excontent, + check = QcCheckExecD.check, + errorcause = QcCheckExecD.errorcause, + errorlevel = QcCheckExecD.errorlevel, + remark = QcCheckExecD.remark, + attachment = QcCheckExecD.attachment, + isexec = QcCheckExecD.isexec, + custom = QcCheckExecD.custom, + typeid = QcCheckExecD.typeid, + itemid = QcCheckExecD.itemid, + create_id = QcCheckExecD.create_id, + create_time = QcCheckExecD.create_time, + postdata = item.postItemForm, + result = item.result, + checkindex = (i + 1).ToString() + }; QcCheckExecDinsert.Add(insert); } } @@ -235,9 +264,9 @@ namespace Tnb.QcMgr } } await db.Ado.BeginTranAsync(); - await db.Updateable(QcCheckExecH).ExecuteCommandAsync(); - await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync(); - await db.Insertable(QcCheckExecDinsert).ExecuteCommandAsync(); + _ = await db.Updateable(QcCheckExecH).ExecuteCommandAsync(); + _ = await db.Deleteable(QcCheckExecDdel).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckExecDinsert).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); } catch (Exception) @@ -254,59 +283,67 @@ namespace Tnb.QcMgr [HttpGet] public async Task GetTaskResult(string id) { - var db = _repository.AsSugarClient(); - var QcCheckExecH = await db.Queryable().Where(p => p.id == id).FirstAsync(); - var QcCheckExecDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); - var QcCheckItems = await db.Queryable().ToListAsync(); - var QcCheckTypes = await db.Queryable().ToListAsync(); - var QcErrorCauses = await db.Queryable().ToListAsync(); - var QcErrorLevels = await db.Queryable().ToListAsync(); + ISqlSugarClient db = _repository.AsSugarClient(); + QcCheckExecH QcCheckExecH = await db.Queryable().Where(p => p.id == id).FirstAsync(); + List QcCheckExecDs = await db.Queryable().Where(p => p.mainid == id).ToListAsync(); + List QcCheckItems = await db.Queryable().ToListAsync(); + List QcCheckTypes = await db.Queryable().ToListAsync(); + List QcErrorCauses = await db.Queryable().ToListAsync(); + List QcErrorLevels = await db.Queryable().ToListAsync(); - Result Result = new Result(); - Result.mainid = id; - Result.checknum = QcCheckExecH.checknum!; - Result.status = QcCheckExecH.status!; - Result.checktypes = new List>(); - Result.result = QcCheckExecH.result; - var groupkeys = QcCheckExecDs.Select(p => p.checkindex).Distinct().ToList(); - foreach (var key in groupkeys) + Result Result = new() { - var QcCheckExecDsbykey = QcCheckExecDs.Where(p => p.checkindex == key).ToList(); - var checktype = new List(); - foreach (var QcCheckExecD in QcCheckExecDsbykey) + mainid = id, + checknum = QcCheckExecH.checknum!, + status = QcCheckExecH.status!, + checktypes = new List>(), + result = QcCheckExecH.result + }; + List groupkeys = QcCheckExecDs.Select(p => p.checkindex).Distinct().ToList(); + foreach (string? key in groupkeys) + { + List QcCheckExecDsbykey = QcCheckExecDs.Where(p => p.checkindex == key).ToList(); + List checktype = new(); + foreach (QcCheckExecD? QcCheckExecD in QcCheckExecDsbykey) { if (checktype.Where(p => p.checktypeid == QcCheckExecD.typeid).ToList().Count == 0) { - Checktype checkType = new Checktype(); - checkType.checktypeid = QcCheckExecD.typeid!; - checkType.checktypename = QcCheckTypes.Where(p => p.id == QcCheckExecD.typeid).First().name!; - checkType.items = new List(); + Checktype checkType = new() + { + checktypeid = QcCheckExecD.typeid!, + checktypename = QcCheckTypes.Where(p => p.id == QcCheckExecD.typeid).First().name!, + items = new List() + }; checktype.Add(checkType); } - ExecItem Item = new ExecItem(); - Item.itemid = QcCheckExecD.itemid!; - Item.itemdid = QcCheckExecD.id!; - Item.code = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().code!; - Item.name = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().name!; - Item.result = QcCheckExecD.result; - Item.setData = new ExecItemData(); - Item.setData.extype = QcCheckExecD.extype!; - Item.setData.excontent = JSON.Deserialize(QcCheckExecD.excontent!); - Item.setData.check = QcCheckExecD.check!; + ExecItem Item = new() + { + itemid = QcCheckExecD.itemid!, + itemdid = QcCheckExecD.id!, + code = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().code!, + name = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().name!, + result = QcCheckExecD.result, + setData = new ExecItemData + { + extype = QcCheckExecD.extype!, + excontent = JSON.Deserialize(QcCheckExecD.excontent!), + check = QcCheckExecD.check! + } + }; if (!string.IsNullOrEmpty(QcCheckExecD.errorcause)) { - var strs = QcCheckExecD.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + string[] strs = QcCheckExecD.errorcause!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); Item.setData.errorcause = new List(); - foreach (var str in strs) + foreach (string str in strs) { Item.setData.errorcause.Add(new Error { id = str, name = QcErrorCauses.Where(p => p.id == str).First().name! }); } } if (!string.IsNullOrEmpty(QcCheckExecD.errorlevel)) { - var strs = QcCheckExecD.errorlevel!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); + string[] strs = QcCheckExecD.errorlevel!.Replace("[", "").Replace("]", "").Split(',', StringSplitOptions.RemoveEmptyEntries); Item.setData.errorlevel = new List(); - foreach (var str in strs) + foreach (string str in strs) { Item.setData.errorlevel.Add(new Error { id = str, name = QcErrorLevels.Where(p => p.id == str).First().name! }); } @@ -315,19 +352,27 @@ namespace Tnb.QcMgr Item.setData.attachment = QcCheckExecD.attachment!; Item.setData.customer = QcCheckExecD.custom!; if (!string.IsNullOrEmpty(QcCheckExecD.isexec)) + { Item.setData.isexec = JSON.Deserialize(QcCheckExecD.isexec!); - Item.setShow = new ExecItemShow(); - Item.setShow.extype = !string.IsNullOrEmpty(Item.setData.extype); - Item.setShow.excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent); - Item.setShow.check = !string.IsNullOrEmpty(Item.setData.check); - Item.setShow.errorcause = Item.setData.errorcause?.Count == 0 ? false : true; - Item.setShow.errorlevel = Item.setData.errorlevel?.Count == 0 ? false : true; - Item.setShow.remark = !string.IsNullOrEmpty(Item.setData.remark); - Item.setShow.attachment = !string.IsNullOrEmpty(Item.setData.attachment); - Item.setShow.customer = !string.IsNullOrEmpty(Item.setData.customer); - Item.setShow.isexec = Item.setData.isexec == null ? false : true; + } + + Item.setShow = new ExecItemShow + { + extype = !string.IsNullOrEmpty(Item.setData.extype), + excontent = !string.IsNullOrEmpty(QcCheckExecD.excontent), + check = !string.IsNullOrEmpty(Item.setData.check), + errorcause = (Item.setData.errorcause?.Count) != 0, + errorlevel = (Item.setData.errorlevel?.Count) != 0, + remark = !string.IsNullOrEmpty(Item.setData.remark), + attachment = !string.IsNullOrEmpty(Item.setData.attachment), + customer = !string.IsNullOrEmpty(Item.setData.customer), + isexec = Item.setData.isexec != null + }; if (!string.IsNullOrEmpty(QcCheckExecD.postdata)) + { Item.postItemForm = JSON.Deserialize(QcCheckExecD.postdata!); + } + checktype.Where(p => p.checktypeid == QcCheckExecD.typeid).First()?.items?.Add(Item); } Result.checktypes.Add(checktype); @@ -339,51 +384,55 @@ namespace Tnb.QcMgr [HttpPost] public async Task CreateTaskData(CheckTaskData checkTaskData) { - var db = _repository.AsSugarClient(); - var DictionaryType = await db.Queryable().Where(p => p.FullName == "质检状态").FirstAsync(); - var DictionaryData = await db.Queryable().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync(); - QcCheckExecH QcCheckExecH = new QcCheckExecH(); - QcCheckExecH.checktype = checkTaskData.checktype; - QcCheckExecH.materialid = checkTaskData.materialid; - QcCheckExecH.processid = checkTaskData.processid; - QcCheckExecH.workid = checkTaskData.workid; - QcCheckExecH.wareid = checkTaskData.wareid; - QcCheckExecH.status = DictionaryData.Id; - QcCheckExecH.tasktime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - QcCheckExecH.create_id = _userManager.UserId; - QcCheckExecH.create_time = DateTime.Now; - List QcCheckExecDs = new List(); + ISqlSugarClient db = _repository.AsSugarClient(); + DictionaryTypeEntity DictionaryType = await db.Queryable().Where(p => p.FullName == "质检状态").FirstAsync(); + DictionaryDataEntity DictionaryData = await db.Queryable().Where(p => p.DictionaryTypeId == DictionaryType.Id && p.FullName == "待执行").FirstAsync(); + QcCheckExecH QcCheckExecH = new() + { + checktype = checkTaskData.checktype, + materialid = checkTaskData.materialid, + processid = checkTaskData.processid, + workid = checkTaskData.workid, + wareid = checkTaskData.wareid, + status = DictionaryData.Id, + tasktime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + create_id = _userManager.UserId, + create_time = DateTime.Now + }; + List QcCheckExecDs = new(); if (checkTaskData.checktypes != null) { - foreach (var checktype in checkTaskData.checktypes) + foreach (CheckTaskDataInput checktype in checkTaskData.checktypes) { if (checktype.items != null) { - foreach (var item in checktype.items) + foreach (TaskItemInput item in checktype.items) { - QcCheckExecD QcCheckExecD = new QcCheckExecD(); - QcCheckExecD.mainid = QcCheckExecH.id; - QcCheckExecD.typeid = checktype.id; - QcCheckExecD.itemid = item.itemid; - QcCheckExecD.extype = item.extype; - QcCheckExecD.excontent = item.excontent; - QcCheckExecD.check = item.check; - QcCheckExecD.errorcause = item.errorcause?.Replace("\"", "").Trim(); - QcCheckExecD.errorlevel = item.errorlevel?.Replace("\"", "").Trim(); - QcCheckExecD.remark = item.remark; - QcCheckExecD.attachment = item.attachment; - QcCheckExecD.isexec = item.isexec; - QcCheckExecD.custom = item.customer; - QcCheckExecD.create_id = _userManager.UserId; - QcCheckExecD.create_time = DateTime.Now; + QcCheckExecD QcCheckExecD = new() + { + mainid = QcCheckExecH.id, + typeid = checktype.id, + itemid = item.itemid, + extype = item.extype, + excontent = item.excontent, + check = item.check, + errorcause = item.errorcause?.Replace("\"", "").Trim(), + errorlevel = item.errorlevel?.Replace("\"", "").Trim(), + remark = item.remark, + attachment = item.attachment, + isexec = item.isexec, + custom = item.customer, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; QcCheckExecDs.Add(QcCheckExecD); } } } } await db.Ado.BeginTranAsync(); - await db.Insertable(QcCheckExecH).ExecuteCommandAsync(); - await db.Insertable(QcCheckExecDs).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckExecH).ExecuteCommandAsync(); + _ = await db.Insertable(QcCheckExecDs).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); } diff --git a/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs b/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs index bff674e9..0347b618 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTypeService.cs @@ -41,13 +41,13 @@ namespace Tnb.QcMgr } private async Task GetList(VisualDevModelListQueryInput input) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); - var data = await _runService.GetListResult(templateEntity, input); + JNPF.Common.Filter.PageResult> data = await _runService.GetListResult(templateEntity, input); if (data?.list?.Count > 0) { - var items = await db.Queryable().ToListAsync(); - foreach (var row in data.list) + List items = await db.Queryable().ToListAsync(); + foreach (Dictionary row in data.list) { row["inspection_items"] = string.Join(",", items.Where(p => p.type == row["id"].ToString()).Select(p => p.name).ToList()); } diff --git a/QcMgr/Tnb.QcMgr/QcSpcService.cs b/QcMgr/Tnb.QcMgr/QcSpcService.cs index 44099ebb..e261ac1d 100644 --- a/QcMgr/Tnb.QcMgr/QcSpcService.cs +++ b/QcMgr/Tnb.QcMgr/QcSpcService.cs @@ -31,17 +31,19 @@ namespace Tnb.QcMgr [HttpPost] public async Task GetSpcItems(string id) { - var datas = await _repository.AsSugarClient().Queryable().Where(p => p.mainid == id).ToListAsync(); - List SpcDataInputs = new List(); + List datas = await _repository.AsSugarClient().Queryable().Where(p => p.mainid == id).ToListAsync(); + List SpcDataInputs = new(); datas.ForEach(p => { - SpcDataInput SpcDataInput = new SpcDataInput(); - SpcDataInput.mainid = p.mainid; - SpcDataInput.checktime = p.checktime; - SpcDataInput.batch = p.batch; - SpcDataInput.data = Array.ConvertAll(p.data!.Split(","), float.Parse); - SpcDataInput.checknum = p.checknum; - SpcDataInput.defectivenum = p.defectivenum; + SpcDataInput SpcDataInput = new() + { + mainid = p.mainid, + checktime = p.checktime, + batch = p.batch, + data = Array.ConvertAll(p.data!.Split(","), float.Parse), + checknum = p.checknum, + defectivenum = p.defectivenum + }; SpcDataInputs.Add(SpcDataInput); }); return SpcDataInputs; @@ -54,29 +56,34 @@ namespace Tnb.QcMgr [HttpPost] public async Task SaveData(List SpcDataInput) { - var db = _repository.AsSugarClient(); + ISqlSugarClient db = _repository.AsSugarClient(); try { if (!string.IsNullOrEmpty(SpcDataInput.First().mainid)) - await db.Deleteable(p => p.mainid == SpcDataInput.First().mainid).ExecuteCommandAsync(); - List QcSpcDs = new List(); + { + _ = await db.Deleteable(p => p.mainid == SpcDataInput.First().mainid).ExecuteCommandAsync(); + } + + List QcSpcDs = new(); SpcDataInput.ForEach(p => { - QcSpcD QcSpcD = new QcSpcD(); - QcSpcD.mainid = p.mainid; - QcSpcD.checktime = p.checktime; - QcSpcD.batch = p.batch; - QcSpcD.data = string.Join(",", p.data); - QcSpcD.checknum = p.checknum; - QcSpcD.defectivenum = p.defectivenum; - QcSpcD.create_id = _userManager.UserId; - QcSpcD.create_time = DateTime.Now; + QcSpcD QcSpcD = new() + { + mainid = p.mainid, + checktime = p.checktime, + batch = p.batch, + data = string.Join(",", p.data), + checknum = p.checknum, + defectivenum = p.defectivenum, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; QcSpcDs.Add(QcSpcD); }); await db.Ado.BeginTranAsync(); - await db.Insertable(QcSpcDs).ExecuteCommandAsync(); + _ = await db.Insertable(QcSpcDs).ExecuteCommandAsync(); await db.Ado.CommitTranAsync(); } catch (Exception) @@ -91,41 +98,47 @@ namespace Tnb.QcMgr /// /// [HttpPost] - public async Task GetSpcData(string id) + public async Task GetSpcData(string id) { - var QcSpcH = await _repository.AsSugarClient().Queryable().Where(p => p.id == id).FirstAsync(); - var QcSpcDs = await _repository.AsSugarClient().Queryable().Where(p => p.mainid == id).ToListAsync(); - var cinfigs = await _repository.AsSugarClient().Queryable().ToListAsync(); + QcSpcH QcSpcH = await _repository.AsSugarClient().Queryable().Where(p => p.id == id).FirstAsync(); + List QcSpcDs = await _repository.AsSugarClient().Queryable().Where(p => p.mainid == id).ToListAsync(); + List cinfigs = await _repository.AsSugarClient().Queryable().ToListAsync(); if (QcSpcH.graphtype == "X-R控制图") { - XRchart XRchart = new XRchart(); - XRchart.xcharts = new List(); - XRchart.rcharts = new List(); - foreach (var QcSpcD in QcSpcDs) + XRchart XRchart = new() + { + xcharts = new List(), + rcharts = new List() + }; + foreach (QcSpcD QcSpcD in QcSpcDs) { List datas = Array.ConvertAll(QcSpcD.data!.Split(",", StringSplitOptions.RemoveEmptyEntries), float.Parse).ToList(); - XRxchart xchart = new XRxchart(); - xchart.x = datas.Average(); - xchart.jc = datas.Max() - datas.Min(); - xchart.usl = QcSpcH.uplimit; - xchart.cl = QcSpcH.target; - xchart.lsl = QcSpcH.lowerlimit; - XRrchart rchart = new XRrchart(); - rchart.r = datas.Max() - datas.Min(); + XRxchart xchart = new() + { + x = datas.Average(), + jc = datas.Max() - datas.Min(), + usl = QcSpcH.uplimit, + cl = QcSpcH.target, + lsl = QcSpcH.lowerlimit + }; + XRrchart rchart = new() + { + r = datas.Max() - datas.Min() + }; XRchart.xcharts.Add(xchart); XRchart.rcharts.Add(rchart); } - var xAverage = XRchart.xcharts.Select(p => p.x).Average(); - var num = XRchart.xcharts.Select(p => p.jc).Average() * cinfigs.Where(p => p.spctype == "X-R图" && p.spckey == "A2" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? xAverage = XRchart.xcharts.Select(p => p.x).Average(); + float? num = XRchart.xcharts.Select(p => p.jc).Average() * cinfigs.Where(p => p.spctype == "X-R图" && p.spckey == "A2" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); XRchart.xcharts.ForEach(p => { p.uclx = xAverage + num; p.clx = xAverage; p.lclx = xAverage - num; }); - var D4 = cinfigs.Where(p => p.spctype == "X-R图" && p.spckey == "D4" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); - var D3 = cinfigs.Where(p => p.spctype == "X-R图" && p.spckey == "D3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); - var rAverage = XRchart.rcharts.Select(p => p.r).Average(); + float? D4 = cinfigs.Where(p => p.spctype == "X-R图" && p.spckey == "D4" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? D3 = cinfigs.Where(p => p.spctype == "X-R图" && p.spckey == "D3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? rAverage = XRchart.rcharts.Select(p => p.r).Average(); XRchart.rcharts.ForEach(p => { p.uclr = rAverage * D4; @@ -136,34 +149,40 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "X-S控制图") { - XSchart XSchart = new XSchart(); - XSchart.xcharts = new List(); - XSchart.scharts = new List(); - foreach (var QcSpcD in QcSpcDs) + XSchart XSchart = new() + { + xcharts = new List(), + scharts = new List() + }; + foreach (QcSpcD QcSpcD in QcSpcDs) { List datas = Array.ConvertAll(QcSpcD.data!.Split(",", StringSplitOptions.RemoveEmptyEntries), float.Parse).ToList(); - XSxchart xchart = new XSxchart(); - xchart.x = datas.Average(); - xchart.bzc = CalculateStdDev(datas); - xchart.usl = QcSpcH.uplimit; - xchart.cl = QcSpcH.target; - xchart.lsl = QcSpcH.lowerlimit; - XSschart schart = new XSschart(); - schart.s = CalculateStdDev(datas); + XSxchart xchart = new() + { + x = datas.Average(), + bzc = CalculateStdDev(datas), + usl = QcSpcH.uplimit, + cl = QcSpcH.target, + lsl = QcSpcH.lowerlimit + }; + XSschart schart = new() + { + s = CalculateStdDev(datas) + }; XSchart.xcharts.Add(xchart); XSchart.scharts.Add(schart); } - var xAverage = XSchart.xcharts.Select(p => p.x).Average(); - var num = XSchart.xcharts.Select(p => p.bzc).Average() * cinfigs.Where(p => p.spctype == "X-S图" && p.spckey == "A3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? xAverage = XSchart.xcharts.Select(p => p.x).Average(); + float? num = XSchart.xcharts.Select(p => p.bzc).Average() * cinfigs.Where(p => p.spctype == "X-S图" && p.spckey == "A3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); XSchart.xcharts.ForEach(p => { p.uclx = xAverage + num; p.clx = xAverage; p.lclx = xAverage - num; }); - var B4 = cinfigs.Where(p => p.spctype == "X-S图" && p.spckey == "B4" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); - var B3 = cinfigs.Where(p => p.spctype == "X-S图" && p.spckey == "B3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); - var sAverage = XSchart.scharts.Select(p => p.s).Average(); + float? B4 = cinfigs.Where(p => p.spctype == "X-S图" && p.spckey == "B4" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? B3 = cinfigs.Where(p => p.spctype == "X-S图" && p.spckey == "B3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? sAverage = XSchart.scharts.Select(p => p.s).Average(); XSchart.scharts.ForEach(p => { p.ucls = sAverage * B4; @@ -174,34 +193,40 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "X中位数-R图") { - XRchart XRchart = new XRchart(); - XRchart.xcharts = new List(); - XRchart.rcharts = new List(); - foreach (var QcSpcD in QcSpcDs) + XRchart XRchart = new() + { + xcharts = new List(), + rcharts = new List() + }; + foreach (QcSpcD QcSpcD in QcSpcDs) { List datas = Array.ConvertAll(QcSpcD.data!.Split(",", StringSplitOptions.RemoveEmptyEntries), float.Parse).ToList(); - XRxchart xchart = new XRxchart(); - xchart.x = CalculateMedian(datas); - xchart.jc = datas.Max() - datas.Min(); - xchart.usl = QcSpcH.uplimit; - xchart.cl = QcSpcH.target; - xchart.lsl = QcSpcH.lowerlimit; - XRrchart rchart = new XRrchart(); - rchart.r = datas.Max() - datas.Min(); + XRxchart xchart = new() + { + x = CalculateMedian(datas), + jc = datas.Max() - datas.Min(), + usl = QcSpcH.uplimit, + cl = QcSpcH.target, + lsl = QcSpcH.lowerlimit + }; + XRrchart rchart = new() + { + r = datas.Max() - datas.Min() + }; XRchart.xcharts.Add(xchart); XRchart.rcharts.Add(rchart); } - var xAverage = XRchart.xcharts.Select(p => p.x).Average(); - var num = XRchart.xcharts.Select(p => p.jc).Average() * cinfigs.Where(p => p.spctype == "中位数图" && p.spckey == "A2" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? xAverage = XRchart.xcharts.Select(p => p.x).Average(); + float? num = XRchart.xcharts.Select(p => p.jc).Average() * cinfigs.Where(p => p.spctype == "中位数图" && p.spckey == "A2" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); XRchart.xcharts.ForEach(p => { p.uclx = xAverage + num; p.clx = xAverage; p.lclx = xAverage - num; }); - var D4 = cinfigs.Where(p => p.spctype == "中位数图" && p.spckey == "D4" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); - var D3 = cinfigs.Where(p => p.spctype == "中位数图" && p.spckey == "D3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); - var rAverage = XRchart.rcharts.Select(p => p.r).Average(); + float? D4 = cinfigs.Where(p => p.spctype == "中位数图" && p.spckey == "D4" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? D3 = cinfigs.Where(p => p.spctype == "中位数图" && p.spckey == "D3" && p.subcapacity == QcSpcH.samplesize).Select(p => p.spcdata).First(); + float? rAverage = XRchart.rcharts.Select(p => p.r).Average(); XRchart.rcharts.ForEach(p => { p.uclr = rAverage * D4; @@ -212,27 +237,33 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "X-MR控制图") { - XMRchart XMRchart = new XMRchart(); - XMRchart.xmrxcharts = new List(); - XMRchart.xmrmrcharts = new List(); - foreach (var QcSpcD in QcSpcDs) + XMRchart XMRchart = new() + { + xmrxcharts = new List(), + xmrmrcharts = new List() + }; + foreach (QcSpcD QcSpcD in QcSpcDs) { List datas = Array.ConvertAll(QcSpcD.data!.Split(",", StringSplitOptions.RemoveEmptyEntries), float.Parse).ToList(); - XMRxchart xchart = new XMRxchart(); - xchart.x = datas.Average(); - xchart.usl = QcSpcH.uplimit; - xchart.cl = QcSpcH.target; - xchart.lsl = QcSpcH.lowerlimit; + XMRxchart xchart = new() + { + x = datas.Average(), + usl = QcSpcH.uplimit, + cl = QcSpcH.target, + lsl = QcSpcH.lowerlimit + }; if (XMRchart.xmrxcharts.Count > 0) { - XMRmrschart rchart = new XMRmrschart(); - rchart.mr = Math.Abs((float)(xchart.x - XMRchart.xmrxcharts.Last().x)!); + XMRmrschart rchart = new() + { + mr = Math.Abs((float)(xchart.x - XMRchart.xmrxcharts.Last().x)!) + }; XMRchart.xmrmrcharts.Add(rchart); } XMRchart.xmrxcharts.Add(xchart); } - var xAverage = XMRchart.xmrxcharts.Select(p => p.x).Average(); - var mrAverage = XMRchart.xmrmrcharts.Select(p => p.mr).Average(); + float? xAverage = XMRchart.xmrxcharts.Select(p => p.x).Average(); + float? mrAverage = XMRchart.xmrmrcharts.Select(p => p.mr).Average(); XMRchart.xmrxcharts.ForEach(p => { p.uclx = xAverage + (float)(2.66 * mrAverage)!; @@ -249,17 +280,19 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "P图") { - List pcharts = new List(); - foreach (var QcSpcD in QcSpcDs) + List pcharts = new(); + foreach (QcSpcD QcSpcD in QcSpcDs) { - Pchart pchart = new Pchart(); - pchart.p = QcSpcD.defectivenum / QcSpcD.checknum; - pchart.n = QcSpcD.checknum; + Pchart pchart = new() + { + p = QcSpcD.defectivenum / QcSpcD.checknum, + n = QcSpcD.checknum + }; pcharts.Add(pchart); } - var pAverage = (pcharts.Select(p => p.n * p.p).Sum()) / (pcharts.Select(p => p.n).Sum()); - var nAverage = pcharts.Select(p => p.n).Average(); + float? pAverage = pcharts.Select(p => p.n * p.p).Sum() / pcharts.Select(p => p.n).Sum(); + float? nAverage = pcharts.Select(p => p.n).Average(); pcharts.ForEach(p => { p.cl = pAverage; @@ -270,16 +303,18 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "U图") { - List ucharts = new List(); - foreach (var QcSpcD in QcSpcDs) + List ucharts = new(); + foreach (QcSpcD QcSpcD in QcSpcDs) { - Uchart uchart = new Uchart(); - uchart.u = QcSpcD.defectivenum / QcSpcD.checknum; - uchart.n = QcSpcD.checknum; + Uchart uchart = new() + { + u = QcSpcD.defectivenum / QcSpcD.checknum, + n = QcSpcD.checknum + }; ucharts.Add(uchart); } - var uAverage = (ucharts.Select(p => p.u).Sum()) / (ucharts.Count()); - var nAverage = ucharts.Select(p => p.n).Average(); + float? uAverage = ucharts.Select(p => p.u).Sum() / ucharts.Count(); + float? nAverage = ucharts.Select(p => p.n).Average(); ucharts.ForEach(p => { p.cl = uAverage; @@ -290,15 +325,17 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "nP图") { - List npcharts = new List(); - foreach (var QcSpcD in QcSpcDs) + List npcharts = new(); + foreach (QcSpcD QcSpcD in QcSpcDs) { - NPchart npchart = new NPchart(); - npchart.np = QcSpcD.defectivenum; + NPchart npchart = new() + { + np = QcSpcD.defectivenum + }; npcharts.Add(npchart); } - var npAverage = (npcharts.Select(p => p.np).Sum()) / (npcharts.Count()); - var pAverage = npcharts.Select(p => p.np).Sum() / (npcharts.Count() * QcSpcH.subcapacity); + float? npAverage = npcharts.Select(p => p.np).Sum() / npcharts.Count(); + float? pAverage = npcharts.Select(p => p.np).Sum() / (npcharts.Count() * QcSpcH.subcapacity); npcharts.ForEach(p => { p.cl = npAverage; @@ -309,14 +346,16 @@ namespace Tnb.QcMgr } if (QcSpcH.graphtype == "C图") { - List ccharts = new List(); - foreach (var QcSpcD in QcSpcDs) + List ccharts = new(); + foreach (QcSpcD QcSpcD in QcSpcDs) { - Cchart cchart = new Cchart(); - cchart.c = QcSpcD.defectivenum; + Cchart cchart = new() + { + c = QcSpcD.defectivenum + }; ccharts.Add(cchart); } - var cAverage = (ccharts.Select(p => p.c).Sum()) / (ccharts.Count()); + float? cAverage = ccharts.Select(p => p.c).Sum() / ccharts.Count(); ccharts.ForEach(p => { p.cl = cAverage; @@ -346,25 +385,20 @@ namespace Tnb.QcMgr private static float CalculateMedian(IEnumerable values) { float ret = 0; - var floats = values.OrderBy(d => d).ToArray(); - if (floats.Count() % 2 == 0) - { - ret = (floats[floats.Count() / 2 - 1] + floats[(floats.Count() + 2) / 2 - 1]) / 2; - } - else - { - ret = floats[(floats.Count() + 1) / 2 - 1]; - } + float[] floats = values.OrderBy(d => d).ToArray(); + ret = floats.Count() % 2 == 0 + ? (floats[(floats.Count() / 2) - 1] + floats[((floats.Count() + 2) / 2) - 1]) / 2 + : floats[((floats.Count() + 1) / 2) - 1]; return ret; } //移动极差平均值计算 private static float CalculateMovRange(IEnumerable values) { - List floats = new List(); - var arr = values.ToArray(); + List floats = new(); + float[] arr = values.ToArray(); for (int i = 0; i < arr.Length - 1; i++) { - floats.Add(Math.Abs((arr[i + 1] - arr[i]))); + floats.Add(Math.Abs(arr[i + 1] - arr[i])); } return floats.Average(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs index b220b5b9..e37fc67a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BasRegionUserService.cs @@ -21,7 +21,7 @@ namespace Tnb.WarehouseMgr private readonly ISqlSugarClient _db; private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; - private static Dictionary _dicRegion = new Dictionary(); + private static Dictionary _dicRegion = new(); public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); public BasRegionUserService(ISqlSugarRepository repository, IRunService runService, IVisualDevService visualDevService) { @@ -39,9 +39,9 @@ namespace Tnb.WarehouseMgr } if (input.data.ContainsKey(nameof(BasRegionUser.region_id)) && input.data.ContainsKey(nameof(BasRegionUser.user_id))) { - var regionId = input.data[nameof(BasRegionUser.region_id)].ToString()!; - var userId = input.data[nameof(BasRegionUser.user_id)].ToString(); - var user = await _db.Queryable().Where(it => it.region_id == regionId && it.user_id == userId).FirstAsync(); + string regionId = input.data[nameof(BasRegionUser.region_id)].ToString()!; + string? userId = input.data[nameof(BasRegionUser.user_id)].ToString(); + BasRegionUser user = await _db.Queryable().Where(it => it.region_id == regionId && it.user_id == userId).FirstAsync(); if (user != null) { throw new AppFriendlyException($"区域【{_dicRegion[regionId]}】,已存在用户【{user.user_name}】", 500); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs index 6579ac49..ab54ec7b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService.cs @@ -31,20 +31,11 @@ namespace Tnb.WarehouseMgr [Route("api/[area]/[controller]/[action]")] public class BaseWareHouseService : IOverideVisualDevService, IDynamicApiController, ITransient { - private static Lazy> _stroageMapLazy; + private static readonly Lazy> _stroageMapLazy; public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); - public static SemaphoreSlim s_taskExecuteSemaphore = new SemaphoreSlim(1); + public static SemaphoreSlim s_taskExecuteSemaphore = new(1); - - - private IEventPublisher _eventPublisher; - - - protected IEventPublisher EventPublisher - { - set { _eventPublisher = value; } - get { return _eventPublisher; } - } + protected IEventPublisher? EventPublisher { set; get; } @@ -54,14 +45,17 @@ namespace Tnb.WarehouseMgr _stroageMapLazy = new Lazy>(() => { Dictionary map = new(); - var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList(); - foreach (var serviceType in serviceTypes) + List serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IWHStorageService).IsAssignableFrom(u)).ToList(); + foreach (Type? serviceType in serviceTypes) { - var callerName = serviceType.GetCustomAttribute()?.Name ?? string.Empty; + string callerName = serviceType.GetCustomAttribute()?.Name ?? string.Empty; if (!callerName.IsNullOrEmpty()) { - var obj = Activator.CreateInstance(serviceType) as IWHStorageService; - if (obj == null) continue; + if (Activator.CreateInstance(serviceType) is not IWHStorageService obj) + { + continue; + } + map[callerName] = obj; } } @@ -73,31 +67,30 @@ namespace Tnb.WarehouseMgr protected Task GetUserIdentity(string? asscessToken = null) { asscessToken = asscessToken?.Replace("Bearer ", "").Replace("bearer ", ""); - var at = asscessToken ?? UserManager.AsscessToken; - var claims = JWTEncryption.ReadJwtToken(at)?.Claims; - ClaimsIdentity toKen = new ClaimsIdentity(); + string at = asscessToken ?? UserManager.AsscessToken; + IEnumerable? claims = JWTEncryption.ReadJwtToken(at)?.Claims; + ClaimsIdentity toKen = new(); foreach (Claim item in claims) { toKen.AddClaim(item); } - var curUser = new ClaimsPrincipal(toKen); + ClaimsPrincipal curUser = new(toKen); return Task.FromResult(curUser); } protected Task SetUserEntity(IUserManager userManager, ClaimsPrincipal principal) - => Task.Run(() => - { - FieldInfo fieldInfo = userManager.GetType().GetField("_user", BindingFlags.NonPublic | BindingFlags.Instance); - if (fieldInfo != null) - { - fieldInfo.SetValue(userManager, principal); - } - }); + { + return Task.Run(() => + { + FieldInfo fieldInfo = userManager.GetType().GetField("_user", BindingFlags.NonPublic | BindingFlags.Instance); + fieldInfo?.SetValue(userManager, principal); + }); + } protected Task InvokeGenPretaskExcute() { - var wareHouseSvc = App.GetRequiredService(); + IWareHouseService wareHouseSvc = App.GetRequiredService(); return wareHouseSvc.GenTaskExecute(); } @@ -112,15 +105,23 @@ namespace Tnb.WarehouseMgr protected Task IsCarryAndLocationMatchByCarryStd(WmsCarryH carry, BasLocation locDest) { bool isMatch = false; - if (carry == null) throw new ArgumentNullException(nameof(carry)); - if (locDest == null) throw new ArgumentNullException(nameof(locDest)); + if (carry == null) + { + throw new ArgumentNullException(nameof(carry)); + } + + if (locDest == null) + { + throw new ArgumentNullException(nameof(locDest)); + } + if (!carry.carrystd_id.IsNullOrEmpty() && !locDest.carrystd_id.IsNullOrEmpty()) { JArray? jsonArr = null; try { jsonArr = JArray.Parse(locDest.carrystd_id); - var locCarryStdArr = jsonArr.Select(x => x.ToObject()).ToArray(); + string?[] locCarryStdArr = jsonArr.Select(x => x.ToObject()).ToArray(); isMatch = locCarryStdArr.Contains(carry.carrystd_id); } catch (Exception ex) when (ex is JsonException jex) @@ -140,7 +141,7 @@ namespace Tnb.WarehouseMgr [NonAction] protected Task GetRealFloor(int floor) { - var realFloor = 0; + int realFloor = 0; if (floor == 4) { realFloor = 5; @@ -164,7 +165,7 @@ namespace Tnb.WarehouseMgr [NonAction] protected async Task Publish(string taskName) { - await _eventPublisher.PublishAsync(new TaskStatusChangeSource(EventSubscribeEventConsts.TASKSTATUSCHANGE_EVENTID, taskName)); + await EventPublisher.PublishAsync(new TaskStatusChangeSource(EventSubscribeEventConsts.TASKSTATUSCHANGE_EVENTID, taskName)); } [NonAction] @@ -188,7 +189,7 @@ namespace Tnb.WarehouseMgr [NonAction] protected void BarCodePrint(List barCodes) { - var tcs = new TaskCompletionSource(); + TaskCompletionSource tcs = new(); // open port. try { @@ -213,8 +214,8 @@ namespace Tnb.WarehouseMgr int len1 = 128, len2 = 128; buf1 = new byte[len1]; buf2 = new byte[len2]; - PPLBUtility.B_EnumUSB(pbuf); - PPLBUtility.B_GetUSBDeviceInfo(1, buf1, out len1, buf2, out len2); + _ = PPLBUtility.B_EnumUSB(pbuf); + _ = PPLBUtility.B_GetUSBDeviceInfo(1, buf1, out len1, buf2, out len2); sw = 1; if (1 == sw) { @@ -238,14 +239,14 @@ namespace Tnb.WarehouseMgr if (2 == sw) { //Immediate Error Report. - PPLBUtility.B_WriteData(1, encAscII.GetBytes("^ee\r\n"), 5);//^ee + _ = PPLBUtility.B_WriteData(1, encAscII.GetBytes("^ee\r\n"), 5);//^ee ret = PPLBUtility.B_ReadData(pbuf, 4, 1000); } } } else { - System.IO.Directory.CreateDirectory(PPLBUtility.szSavePath); + _ = System.IO.Directory.CreateDirectory(PPLBUtility.szSavePath); ret = PPLBUtility.B_CreatePrn(0, PPLBUtility.szSaveFile);// open file. strmsg += "Open "; strmsg += PPLBUtility.szSaveFile; @@ -259,15 +260,17 @@ namespace Tnb.WarehouseMgr } } if (0 != ret) + { return; + } // sample setting. - PPLBUtility.B_Set_Originpoint(0, 0); - PPLBUtility.B_Select_Option(2); - PPLBUtility.B_Set_Darkness(8); - PPLBUtility.B_Del_Pcx("*");// delete all picture. + _ = PPLBUtility.B_Set_Originpoint(0, 0); + _ = PPLBUtility.B_Select_Option(2); + _ = PPLBUtility.B_Set_Darkness(8); + _ = PPLBUtility.B_Del_Pcx("*");// delete all picture. //PPLBUtility.B_Set_LabelForSmartPrint(254 * 3, 30);//label information: length= 3 * 25.4 mm, gap= 3 mm. 254 * 3, 30 - PPLBUtility.B_Set_Labwidth(80 * 8); + _ = PPLBUtility.B_Set_Labwidth(80 * 8); //var labelWidth = 640; //254 * 3; // 标签宽度 //var barcodeWidth = 320; // 条码宽度 //var barcodeX = (labelWidth - barcodeWidth) / 2; @@ -275,14 +278,14 @@ namespace Tnb.WarehouseMgr - foreach (var code in barCodes) + foreach (string code in barCodes) { //print text, true type text. - PPLBUtility.B_Prn_Text(200, 50, 0, 2, 2, 2, 'N', code); + _ = PPLBUtility.B_Prn_Text(200, 50, 0, 2, 2, 2, 'N', code); //barcode. - PPLBUtility.B_Prn_Barcode(50, 100, 0, "1", 3, 5, 70, 'B', code);//have a counter - // output. - PPLBUtility.B_Print_Out(1);// copy 2. + _ = PPLBUtility.B_Prn_Barcode(50, 100, 0, "1", 3, 5, 70, 'B', code);//have a counter + // output. + _ = PPLBUtility.B_Print_Out(1);// copy 2. } } catch (Exception ex) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs index 3109287a..1d7ab7ee 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/BaseWareHouseService`1.cs @@ -8,7 +8,7 @@ namespace Tnb.WarehouseMgr { public class BaseWareHouseService : BaseWareHouseService { - protected static Dictionary s_elevatorMap = new Dictionary(); + protected static Dictionary s_elevatorMap = new(); private static readonly Lazy initializationTask; @@ -44,13 +44,13 @@ namespace Tnb.WarehouseMgr cfgOpts.MessageFormat = (logMsg) => { Span span = logMsg.LogLevel.ToString().ToCharArray(); - var sb = new StringBuilder(); - sb.Append($"{span.Slice(0, 4)} "); - sb.Append($"{logMsg.LogName} "); - sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} "); - sb.Append($"#{logMsg.EventId.Id} "); - sb.Append(logMsg.Message + " "); - sb.Append(logMsg.Exception?.ToString()); + StringBuilder sb = new(); + _ = sb.Append($"{span[..4]} "); + _ = sb.Append($"{logMsg.LogName} "); + _ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} "); + _ = sb.Append($"#{logMsg.EventId.Id} "); + _ = sb.Append(logMsg.Message + " "); + _ = sb.Append(logMsg.Exception?.ToString()); return sb.ToString(); }; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs index 3f7019a0..03d7b45d 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/DeviceProviderService.cs @@ -82,7 +82,7 @@ namespace Tnb.WarehouseMgr { Log.Information("取货确认.................."); - var elevator = await _db.Queryable().LeftJoin((a, b) => a.id == b.bill_id) + WmsElevatorH elevator = await _db.Queryable().LeftJoin((a, b) => a.id == b.bill_id) .LeftJoin((a, b, c) => b.location_id == c.startlocation_id) .LeftJoin((a, b, c, d) => c.startlocation_id == d.location_id) .Where((a, b, c, d) => d.point_code == input.sourceName && input.taskCode.Contains(c.bill_code)) @@ -101,15 +101,15 @@ namespace Tnb.WarehouseMgr try { Logger.Information($"当前任务Id:{elevator.distask_id}"); - if (s_elevatorMap.TryGetValue(elevator.device_id, out var elevatorCode)) + if (s_elevatorMap.TryGetValue(elevator.device_id, out object? elevatorCode)) { - var devName = elevatorCode?.ToString() ?? _eleCtlCfg.DevName; + string devName = elevatorCode?.ToString() ?? _eleCtlCfg.DevName; (int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) = await _elevatorControlService.GetElevatorStatus(devName, CancellationToken.None); - Logger.Information($"电梯当前状态->系统状态:{sysStatus.ToEnum().ToString()},运行状态:{runStatus.ToEnum().ToString()},Agv状态:{agvStatus.ToEnum().ToString()},当前楼层:{floorNo}"); + Logger.Information($"电梯当前状态->系统状态:{sysStatus.ToEnum()},运行状态:{runStatus.ToEnum()},Agv状态:{agvStatus.ToEnum()},当前楼层:{floorNo}"); { if (doorStatus.ToEnum() != EnumDoorStatus.开门到位保持) { - await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令 + _ = await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令 } if (sysStatus.ToEnum() == EnumSysStatus.正常状态 && runStatus.ToEnum() == EnumRunStatus.停梯) { @@ -142,7 +142,7 @@ namespace Tnb.WarehouseMgr try { //根据Agv传递的参数获取,对应的电梯 - var elevator = await _db.Queryable().LeftJoin((a, b) => a.id == b.bill_id) + WmsElevatorH elevator = await _db.Queryable().LeftJoin((a, b) => a.id == b.bill_id) .LeftJoin((a, b, c) => b.location_id == c.endlocation_id) .LeftJoin((a, b, c, d) => c.endlocation_id == d.location_id) .Where((a, b, c, d) => d.point_code == input.targetName && c.bill_code == input.taskCode) @@ -153,12 +153,15 @@ namespace Tnb.WarehouseMgr }, true) .FirstAsync(); if (elevator.IsNull()) - throw new Exception($"根据参数,sourceName:{input.sourceName},taskCode:{input.taskCode},未找到匹配的电梯任务"); - if (s_elevatorMap.TryGetValue(elevator.elevator_id, out var elevatorCode)) { - var devName = elevatorCode?.ToString() ?? _eleCtlCfg.DevName; + throw new Exception($"根据参数,sourceName:{input.sourceName},taskCode:{input.taskCode},未找到匹配的电梯任务"); + } + + if (s_elevatorMap.TryGetValue(elevator.elevator_id, out object? elevatorCode)) + { + string devName = elevatorCode?.ToString() ?? _eleCtlCfg.DevName; (int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) = await _elevatorControlService.GetElevatorStatus(devName, CancellationToken.None);//elevator.elevator_code - Logger.Information($"电梯当前状态->系统状态:{sysStatus.ToEnum().ToString()},运行状态:{runStatus},门状态:{doorStatus},Agv状态:{agvStatus},当前楼层:{floorNo}"); + Logger.Information($"电梯当前状态->系统状态:{sysStatus.ToEnum()},运行状态:{runStatus},门状态:{doorStatus},Agv状态:{agvStatus},当前楼层:{floorNo}"); //判断Agv电梯是否进入状态 if (agvStatus != (int)EnumAgvStatus.AGV运行状态) { @@ -170,7 +173,7 @@ namespace Tnb.WarehouseMgr //电梯到达目标楼层后,判断当前电梯门状态是否为开门到位保持状态 if (doorStatus != (int)EnumDoorStatus.开门到位保持) { - await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令 + _ = await _elevatorControlService.SendOpenCloseCmd(devName, 3); //发送电梯前门开门指令 } if (sysStatus == (int)EnumSysStatus.正常状态 && runStatus == (int)EnumRunStatus.停梯 && doorStatus == (int)EnumDoorStatus.开门到位保持) @@ -221,9 +224,13 @@ namespace Tnb.WarehouseMgr case "ALLOCATED": break; case "PROCESSING": //if (await _cacheManager.GetAsync($"{input.taskChainCode}") == "任务链状态上报,上报状态PROCESSING") break; - if (input.taskChainCode.Trim().IsNullOrEmpty()) break; - var disTasks = await _db.Queryable().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync(); - var eps = await _db.Queryable().Where(it => it.code.Contains(input.deviceID)).ToListAsync(); + if (input.taskChainCode.Trim().IsNullOrEmpty()) + { + break; + } + + List disTasks = await _db.Queryable().Where(it => it.bill_code.Contains(input.taskChainCode)).ToListAsync(); + List eps = await _db.Queryable().Where(it => it.code.Contains(input.deviceID)).ToListAsync(); TaskExecuteUpInput taskExecuteUpInput = new() { disTaskIds = disTasks.Select(x => x.id).ToList(), @@ -238,7 +245,7 @@ namespace Tnb.WarehouseMgr } //写入redis //await _cacheManager.SetAsync($"{input.taskChainCode}", $"任务链状态上报,上报状态{input.status}"); - var opts = App.GetOptions(); + ConnectionConfigOptions opts = App.GetOptions(); UserAgent userAgent = new(App.HttpContext); //写系统日志 await _eventPublisher.PublishAsync(new LogEventSource("Log:CreateOpLog", opts, new SysLogEntity @@ -276,7 +283,7 @@ namespace Tnb.WarehouseMgr try { - var disTasks = await _db.Queryable().Where(it => it.bill_code.Contains(input.taskCode)).ToListAsync(); + List disTasks = await _db.Queryable().Where(it => it.bill_code.Contains(input.taskCode)).ToListAsync(); if (input.action == "LOAD") { TaskExecuteAfterUpInput taskExecuteAfterUpInput = new() @@ -285,15 +292,15 @@ namespace Tnb.WarehouseMgr }; await _wareHouseService.TaskExecuteAfter(taskExecuteAfterUpInput); Logger.Information($"Agv取货完成,任务Id:{string.Join(",", disTasks.Select(x => x.id))}"); - var elevatorQueueItem = await _db.Queryable().FirstAsync(it => disTasks.Select(x => x.id).Contains(it.distask_id) && it.task_status == "执行中"); + WmsElevatorUnexecute elevatorQueueItem = await _db.Queryable().FirstAsync(it => disTasks.Select(x => x.id).Contains(it.distask_id) && it.task_status == "执行中"); if (elevatorQueueItem != null) { Logger.Information("开始进入关门流程"); - var doorStatus = await _elevatorControlService.GetTagAsync(elevatorQueueItem.elevator_code, ElevatorConsts.DoorStatus); + int doorStatus = await _elevatorControlService.GetTagAsync(elevatorQueueItem.elevator_code, ElevatorConsts.DoorStatus); if (doorStatus.ToEnum() != EnumDoorStatus.关门到位保持) { - await _elevatorControlService.SendOpenCloseCmd(elevatorQueueItem.elevator_code, 4); //向电梯发送前门关门指令 - await _db.Deleteable(elevatorQueueItem).ExecuteCommandAsync(); + _ = await _elevatorControlService.SendOpenCloseCmd(elevatorQueueItem.elevator_code, 4); //向电梯发送前门关门指令 + _ = await _db.Deleteable(elevatorQueueItem).ExecuteCommandAsync(); } } @@ -327,7 +334,7 @@ namespace Tnb.WarehouseMgr { try { - var eles = await _db.Queryable().LeftJoin((a, b) => a.id == b.bill_id) + List eles = await _db.Queryable().LeftJoin((a, b) => a.id == b.bill_id) .LeftJoin((a, b, c) => b.location_id == c.startlocation_id) .Where((a, b, c) => c.startlocation_code == input.sourceName && c.bill_code == input.taskCode) .ToListAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs b/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs index b5709a50..afeebd57 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/ElevatorControlService.cs @@ -20,8 +20,8 @@ namespace Tnb.WarehouseMgr { private readonly ElevatorControlConfiguration _elevatorCtlCfg = new(); private readonly BackgroundService _agvHeartbeatMonitor; - private static Dictionary> _fetchStartedStausValue = new(); - private bool isFrontDoorBit = false; //是否到前门位 + private static readonly Dictionary> _fetchStartedStausValue = new(); + private readonly bool isFrontDoorBit = false; //是否到前门位 public ElevatorControlService() { @@ -36,17 +36,17 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task CallLiftTest(string devName, int floor) { - var isSuccefuly = false; - (int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) = await GetElevatorStatus(devName, CancellationToken.None); + bool isSuccefuly = false; + (int sysStatus, int runStatus, _, int doorStatus, int agvStatus) = await GetElevatorStatus(devName, CancellationToken.None); //判断当前楼层是否是放货楼层,如不是则呼叫电梯到当前楼层 if (sysStatus.ToEnum() == EnumSysStatus.正常状态 && runStatus.ToEnum() == EnumRunStatus.停梯 && agvStatus.ToEnum() != EnumAgvStatus.AGV运行状态) { if (doorStatus.ToEnum() != EnumDoorStatus.关门到位保持) { - await SendOpenCloseCmd(devName, (int)EnumAgvControl.前门关门); + _ = await SendOpenCloseCmd(devName, (int)EnumAgvControl.前门关门); } - var result = await WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor); //呼叫电梯到指定楼层 + dynamic result = await WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor); //呼叫电梯到指定楼层 if (!string.IsNullOrEmpty(result)) { JObject jo = JObject.Parse(result); @@ -60,7 +60,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] - public async Task ThreeFloorElevatorFlow() + public dynamic ThreeFloorElevatorFlow() { //test by close door //_agvHeartbeatMonitor.StartAsync(CancellationToken.None); @@ -118,7 +118,7 @@ namespace Tnb.WarehouseMgr private Task SetRequestParameter(string tagName, object value) { - var tcs = new TaskCompletionSource(); + TaskCompletionSource tcs = new(); dynamic reqParam = new ExpandoObject(); reqParam.DevName = _elevatorCtlCfg.DevName; reqParam.TagName = tagName; @@ -131,15 +131,14 @@ namespace Tnb.WarehouseMgr private Task> SetParameter(dynamic obj) { - var parameters = new Dictionary() + Dictionary parameters = new() { ["DevName"] = _elevatorCtlCfg.DevName, ["token"] = _elevatorCtlCfg.token, }; - var dynamicDic = obj as IDictionary; - if (dynamicDic != null) + if (obj is IDictionary dynamicDic) { - foreach (var (k, v) in dynamicDic) + foreach ((string k, object v) in dynamicDic) { parameters[k] = v?.ToString() ?? string.Empty; } @@ -150,18 +149,21 @@ namespace Tnb.WarehouseMgr /// /// 向系统发送开关门指令 /// + /// /// 开关门指令 /// public async Task SendOpenCloseCmd(string devName, int value) { - var dicCommand = new Dictionary(StringComparer.OrdinalIgnoreCase); - dicCommand["DevName"] = devName; - dicCommand["token"] = _elevatorCtlCfg.token; - dicCommand["TagName"] = "DoorExecute"; - dicCommand["Value"] = value.ToString(); + Dictionary dicCommand = new(StringComparer.OrdinalIgnoreCase) + { + ["DevName"] = devName, + ["token"] = _elevatorCtlCfg.token, + ["TagName"] = "DoorExecute", + ["Value"] = value.ToString() + }; try { - await HttpClientHelper.GetAsync(_elevatorCtlCfg.WriteTagUrl, pars: dicCommand); + _ = await HttpClientHelper.GetAsync(_elevatorCtlCfg.WriteTagUrl, pars: dicCommand); } catch (Exception) { @@ -177,43 +179,51 @@ namespace Tnb.WarehouseMgr private async Task SetAgvControlStatus(int value) { - var dicCommand = new Dictionary(StringComparer.OrdinalIgnoreCase); - dicCommand["DevName"] = _elevatorCtlCfg.DevName; - dicCommand["TagName"] = "AGVControl"; - dicCommand["Value"] = value.ToString(); - dicCommand["token"] = _elevatorCtlCfg.token; + Dictionary dicCommand = new(StringComparer.OrdinalIgnoreCase) + { + ["DevName"] = _elevatorCtlCfg.DevName, + ["TagName"] = "AGVControl", + ["Value"] = value.ToString(), + ["token"] = _elevatorCtlCfg.token + }; return await HttpClientHelper.GetAsync(_elevatorCtlCfg.WriteTagUrl, pars: dicCommand); } /// /// 向指定的标签属性写入值 /// + /// /// /// /// public async Task WriteTagAsync(string devName, string tagName, int value) { - var dicCommand = new Dictionary(StringComparer.OrdinalIgnoreCase); - dicCommand["DevName"] = devName; - dicCommand["token"] = _elevatorCtlCfg.token; - dicCommand["TagName"] = tagName; - dicCommand["Value"] = value.ToString(); + Dictionary dicCommand = new(StringComparer.OrdinalIgnoreCase) + { + ["DevName"] = devName, + ["token"] = _elevatorCtlCfg.token, + ["TagName"] = tagName, + ["Value"] = value.ToString() + }; return await HttpClientHelper.GetAsync(_elevatorCtlCfg.WriteTagUrl, pars: dicCommand); } /// /// 根据标签名称获取标签值 /// + /// /// /// public async Task GetTagAsync(string devName, string tagName) { - var dicCommand = new Dictionary(); - dicCommand["DevName"] = devName; - dicCommand["token"] = _elevatorCtlCfg.token; - dicCommand["TagName"] = tagName; - var result = await HttpClientHelper.GetAsync(_elevatorCtlCfg.GetTagUrl, pars: dicCommand); + Dictionary dicCommand = new() + { + ["DevName"] = devName, + ["token"] = _elevatorCtlCfg.token, + ["TagName"] = tagName + }; + string result = await HttpClientHelper.GetAsync(_elevatorCtlCfg.GetTagUrl, pars: dicCommand); JObject jo = JObject.Parse(result); return jo.Value("V"); } @@ -221,21 +231,24 @@ namespace Tnb.WarehouseMgr /// /// 获取电梯状态 /// + /// /// /// public async Task<(int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus)> GetElevatorStatus(string devName, CancellationToken token) { (int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) multi = (-1, -1, -1, -1, -1); - var pars = new Dictionary(); - pars["DevName"] = devName; - pars["Pos"] = "1"; - pars["Count"] = "11"; - pars["token"] = _elevatorCtlCfg.token; - var url = _elevatorCtlCfg.GetTagListUrl; - var systemInfo = await HttpClientHelper.GetAsync(url, pars: pars); - var jo = JObject.Parse(systemInfo); - var objs = jo["Items"].Values().ToList(); + Dictionary pars = new() + { + ["DevName"] = devName, + ["Pos"] = "1", + ["Count"] = "11", + ["token"] = _elevatorCtlCfg.token + }; + string url = _elevatorCtlCfg.GetTagListUrl; + string systemInfo = await HttpClientHelper.GetAsync(url, pars: pars); + JObject jo = JObject.Parse(systemInfo); + List objs = jo["Items"].Values().ToList(); //if (objs?.Count == 4) { if (objs[0].Value("Name").Equals("SysStatus") @@ -252,15 +265,16 @@ namespace Tnb.WarehouseMgr /// /// 检查Agv状态 /// + /// /// /// public async Task CheckAgvStatus(string devName, CancellationToken cancellationToken) { - var isInAgvStatus = false; - var agvStatus = await GetTagAsync(devName, ElevatorConsts.AGVStatus); + bool isInAgvStatus = false; + int agvStatus = await GetTagAsync(devName, ElevatorConsts.AGVStatus); if (agvStatus.ToEnum() != EnumAgvStatus.AGV运行状态) { - var result = await WriteTagAsync(devName, ElevatorConsts.AGVControl, 1); + dynamic result = await WriteTagAsync(devName, ElevatorConsts.AGVControl, 1); JObject jo = JObject.Parse(result); if (jo != null && jo.Value("Result").Equals("Ok", StringComparison.OrdinalIgnoreCase)) { @@ -278,17 +292,17 @@ namespace Tnb.WarehouseMgr /// public async Task CallLift(string devName, int floor, CancellationToken cancellationToken) { - var isSuccefuly = false; - (int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) = await GetElevatorStatus(devName, CancellationToken.None); + bool isSuccefuly = false; + (int sysStatus, int runStatus, _, int doorStatus, int agvStatus) = await GetElevatorStatus(devName, CancellationToken.None); //判断当前楼层是否是放货楼层,如不是则呼叫电梯到当前楼层 if (sysStatus.ToEnum() == EnumSysStatus.正常状态 && runStatus.ToEnum() == EnumRunStatus.停梯 && agvStatus.ToEnum() != EnumAgvStatus.AGV运行状态) { if (doorStatus.ToEnum() != EnumDoorStatus.关门到位保持) { - await SendOpenCloseCmd(devName, (int)EnumAgvControl.前门关门); + _ = await SendOpenCloseCmd(devName, (int)EnumAgvControl.前门关门); } - var result = await WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor); //呼叫电梯到指定楼层 + dynamic result = await WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor); //呼叫电梯到指定楼层 if (!string.IsNullOrEmpty(result)) { JObject jo = JObject.Parse(result); @@ -301,7 +315,7 @@ namespace Tnb.WarehouseMgr public class ElevatorData { - public string name { get; set; } - public string value { get; set; } + public string? name { get; set; } + public string? value { get; set; } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs b/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs index d445daf5..25024b80 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/EventSubscribers/TaskStatusChangeSubscriber.cs @@ -48,7 +48,7 @@ public class TaskStatusChangeSubscriber : IEventSubscriber, ISingleton }*/ - var tscSource = (TaskStatusChangeSource)context.Source; + TaskStatusChangeSource tscSource = (TaskStatusChangeSource)context.Source; switch (tscSource.Payload) { case nameof(_wareHouseService.GenTaskExecute): diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs index 8d7394b9..de56d383 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/BackgroundServiceExtensions.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; -namespace Tnb.WarehouseMgr +namespace Tnb.WarehouseMgr.Extensions { public static class BackgroundServiceExtensions { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs index 6dd74dd8..3828c87c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Extensions/WareHouseBasedControllerActivator.cs @@ -2,16 +2,16 @@ using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.Extensions.DependencyInjection; -namespace Tnb.WarehouseMgr +namespace Tnb.WarehouseMgr.Extensions { public class WareHouseBasedControllerActivator : IControllerActivator { public object Create(ControllerContext context) { if (context == null) { throw new ArgumentNullException("context"); } - var controllerType = context.ActionDescriptor.ControllerTypeInfo.AsType(); + Type controllerType = context.ActionDescriptor.ControllerTypeInfo.AsType(); //获取Controller实例 - var controller = context.HttpContext.RequestServices.GetRequiredService(controllerType); + object controller = context.HttpContext.RequestServices.GetRequiredService(controllerType); //判断是否继承了自定义Controller基类 //if(controller is BaseWareHouseService basedWhSvc) //{ diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs b/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs index 4c5164bb..aaa3c279 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Filters/NotifyFilterAttribute.cs @@ -10,8 +10,8 @@ namespace Tnb.WarehouseMgr.Filters public override async void OnActionExecuted(ActionExecutedContext context) { - var actionName = context.ActionDescriptor.RouteValues["action"]!; - var taskMessageNotify = context.HttpContext.RequestServices.GetRequiredService(); + string actionName = context.ActionDescriptor.RouteValues["action"]!; + ITaskMessageNotify taskMessageNotify = context.HttpContext.RequestServices.GetRequiredService(); if (taskMessageNotify != null) { NotifyMessage message = new() { TaskName = actionName }; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs b/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs index 644251cd..ca2f76d1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/LocationDefinitionService.cs @@ -29,58 +29,90 @@ namespace Tnb.WarehouseMgr private async Task DataImport(VisualDevImportDataInput input) { int row = 0; - var errorlist = new List>(); - VisualDevImportDataOutput result = new VisualDevImportDataOutput(); + List> errorlist = new(); + VisualDevImportDataOutput result = new(); try { List> dics = input.list; - List locs = new List(); - BasLocation loc = new BasLocation(); - List cStdCodes = new List(); - List whCodes = new List(); - List rgCodes = new List(); + List locs = new(); + BasLocation loc = new(); + List cStdCodes = new(); + List whCodes = new(); + List rgCodes = new(); //遍历字典,找出需要查询数据库拿的相关字段 - foreach (var d in dics) + foreach (Dictionary d in dics) { if (d.Select(x => x.Value.ToString()).ToList().Find(v => v != "" && v != string.Empty && v != null) == null) { continue; } - var LCode = d["location_code"]?.ToString() ?? string.Empty; - if (LCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位编号不可为空", 500); - var isType = d["is_type"]?.ToString() ?? string.Empty; - if (isType == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位类型不可为空", 500); - var floor = d["floor"]?.ToString() ?? string.Empty; - if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500); - var layers = d["layers"]?.ToString() ?? string.Empty; - var locLine = d["loc_line"]?.ToString() ?? string.Empty; - var locColumn = d["loc_column"]?.ToString() ?? string.Empty; - if (locLine == string.Empty || locColumn == string.Empty || layers == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据行列层不可为空", 500); - var isSign = d["is_sign"]?.ToString() ?? string.Empty; - if (isSign == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据自动签收不可为空", 500); - var cStdCode = d["carrystd_id"]?.ToString() ?? string.Empty; - var whCode = d["wh_id"]?.ToString() ?? string.Empty; - var rgCode = d["region_id"]?.ToString() ?? string.Empty; + string LCode = d["location_code"]?.ToString() ?? string.Empty; + if (LCode == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位编号不可为空", 500); + } + + string isType = d["is_type"]?.ToString() ?? string.Empty; + if (isType == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据库位类型不可为空", 500); + } + + string floor = d["floor"]?.ToString() ?? string.Empty; + if (floor == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500); + } + + string layers = d["layers"]?.ToString() ?? string.Empty; + string locLine = d["loc_line"]?.ToString() ?? string.Empty; + string locColumn = d["loc_column"]?.ToString() ?? string.Empty; + if (locLine == string.Empty || locColumn == string.Empty || layers == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据行列层不可为空", 500); + } + + string isSign = d["is_sign"]?.ToString() ?? string.Empty; + if (isSign == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据自动签收不可为空", 500); + } + + string cStdCode = d["carrystd_id"]?.ToString() ?? string.Empty; + string whCode = d["wh_id"]?.ToString() ?? string.Empty; + string rgCode = d["region_id"]?.ToString() ?? string.Empty; cStdCodes.Add(cStdCode); whCodes.Add(whCode); rgCodes.Add(rgCode); d["create_time"] = DateTime.Now; - d.Remove("modify_time"); + _ = d.Remove("modify_time"); loc = d.Adapt(); locs.Add(loc); } - var carryStdDic = await _db.Queryable().Where(it => cStdCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id); - var whDic = await _db.Queryable().Where(it => whCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.whcode)).ToDictionaryAsync(x => x.whcode, x => x.id); - var rgDic = await _db.Queryable().Where(it => rgCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.region_code)).ToDictionaryAsync(x => x.region_code, x => x.id); - var orgId = _userManager.User.OrganizeId; - var userId = _userManager.UserId; - foreach (var l in locs) + Dictionary carryStdDic = await _db.Queryable().Where(it => cStdCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id); + Dictionary whDic = await _db.Queryable().Where(it => whCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.whcode)).ToDictionaryAsync(x => x.whcode, x => x.id); + Dictionary rgDic = await _db.Queryable().Where(it => rgCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.region_code)).ToDictionaryAsync(x => x.region_code, x => x.id); + string orgId = _userManager.User.OrganizeId; + string userId = _userManager.UserId; + foreach (BasLocation l in locs) { - if (!carryStdDic.ContainsKey(l.carrystd_id)) throw new AppFriendlyException($"第{locs.IndexOf(l) + 1}个数据的载具规格有误", 500); - if (!whDic.ContainsKey(l.wh_id)) throw new AppFriendlyException($"第{locs.IndexOf(l) + 1}个数据的仓库有误", 500); - if (!rgDic.ContainsKey(l.region_id)) throw new AppFriendlyException($"第{locs.IndexOf(l) + 1}个数据的区域名称有误", 500); + if (!carryStdDic.ContainsKey(l.carrystd_id)) + { + throw new AppFriendlyException($"第{locs.IndexOf(l) + 1}个数据的载具规格有误", 500); + } + + if (!whDic.ContainsKey(l.wh_id)) + { + throw new AppFriendlyException($"第{locs.IndexOf(l) + 1}个数据的仓库有误", 500); + } + + if (!rgDic.ContainsKey(l.region_id)) + { + throw new AppFriendlyException($"第{locs.IndexOf(l) + 1}个数据的区域名称有误", 500); + } + l.id = SnowflakeIdHelper.NextId(); l.org_id = orgId; l.location_name = l.location_code; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs index 499c5907..f44348cf 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PDATransferSignService.cs @@ -50,23 +50,21 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); WmsCarryH? carry = null; WmsCarryH? newCarry = null; - if (!input.carryId.IsNullOrWhiteSpace()) - { - carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId); - } - else - { - carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); - } + carry = !input.carryId.IsNullOrWhiteSpace() + ? await _db.Queryable().SingleAsync(it => it.id == input.carryId) + : await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); if (!input.new_carry_code.IsNullOrWhiteSpace()) + { newCarry = await _db.Queryable().SingleAsync(it => it.carry_code == input.new_carry_code); + } + if (carry != null && newCarry != null) { if (carry?.location_id?.IsNotEmptyOrNull() ?? false) { - var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); loc.is_use = ((int)EnumCarryStatus.空闲).ToString(); - await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); + _ = await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); } WmsDistaskH? disTask = null; if (!input.disTaskId.IsNullOrEmpty()) @@ -83,15 +81,15 @@ namespace Tnb.WarehouseMgr } if (disTask != null) { - var nCCode = await _db.Queryable().Where(it => it.carry_id == newCarry.id).ToListAsync(); - var dicMin = await _db.Queryable().Where(it => input.distaskCodes.Select(x => x.material_id).Contains(it.id)).ToDictionaryAsync(d => d.id, d => d.minpacking); - WmsCarryCode cCode = new WmsCarryCode(); - List iCodes = new List(); - List uCodes = new List(); - foreach (var dCode in input.distaskCodes) + List nCCode = await _db.Queryable().Where(it => it.carry_id == newCarry.id).ToListAsync(); + Dictionary dicMin = await _db.Queryable().Where(it => input.distaskCodes.Select(x => x.material_id).Contains(it.id)).ToDictionaryAsync(d => d.id, d => d.minpacking); + WmsCarryCode cCode = new(); + List iCodes = new(); + List uCodes = new(); + foreach (WmsDistaskCode dCode in input.distaskCodes) { decimal codeQty = 0; - var sMCode = nCCode.Find(x => x.material_id == dCode.material_id && x.codeqty <= dicMin[dCode.material_id].ParseToDecimal()); + WmsCarryCode? sMCode = nCCode.Find(x => x.material_id == dCode.material_id && x.codeqty <= dicMin[dCode.material_id].ParseToDecimal()); cCode = dCode.Adapt(); cCode.carry_id = newCarry.id; cCode.code_batch = $"{DateTime.Today.Year}{DateTime.Today.Month}{DateTime.Today.Day}"; @@ -110,8 +108,8 @@ namespace Tnb.WarehouseMgr } - await _db.Insertable(iCodes).ExecuteCommandAsync(); - await _db.Updateable(uCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(iCodes).ExecuteCommandAsync(); + _ = await _db.Updateable(uCodes).ExecuteCommandAsync(); if (_dicBizType.ContainsKey(disTask.biz_type)) { WareHouseUpInput upInput = new() @@ -125,7 +123,7 @@ namespace Tnb.WarehouseMgr await DoUpdate(upInput); //回更业务 } disTask.is_sign = 1; - await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync(); + _ = await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync(); } } await _db.Ado.CommitTranAsync(); @@ -146,10 +144,10 @@ namespace Tnb.WarehouseMgr { //if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return; //var curUser = await GetUserIdentity(); - var curDb = _db.CopyNew(); + SqlSugarClient curDb = _db.CopyNew(); try { - List> dics = new List>(); + List> dics = new(); var sgs = await curDb.Queryable().LeftJoin((a, b) => a.id == b.bill_id) .Select((a, b) => new { @@ -171,7 +169,7 @@ namespace Tnb.WarehouseMgr Dictionary dic = new(); foreach (var itGroup in itGroups) { - var minStock = itGroup.First().min_stock; + int? minStock = itGroup.First().min_stock; if (itGroup.Select(x => x.codeqty).Sum() <= minStock) { dic.Add(nameof(WmsCarryCode.material_id), itGroup.Key); @@ -193,7 +191,7 @@ namespace Tnb.WarehouseMgr create_id= _userManager.UserId, } }; - foreach (var d in dics) + foreach (Dictionary d in dics) { input.outstock.location_code = "YCL03-01-01"; MESWmsOutstockDInput outstockD = new() @@ -218,7 +216,7 @@ namespace Tnb.WarehouseMgr RequestMethod = App.HttpContext?.Request?.Method, userIdentity = await GetUserIdentity(_userManager.ToKen), }; - var timedTaskEx = ex.ToTimedTaskException(ei); + TimedTaskException timedTaskEx = ex.ToTimedTaskException(ei); throw timedTaskEx; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs index 16976bef..86004fe1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PcStroageService.cs @@ -9,7 +9,7 @@ namespace Tnb.WarehouseMgr [Caller("web")] public class PcStroageService : IWHStorageService { - private static Dictionary _serviceMap = new(StringComparer.OrdinalIgnoreCase); + private static readonly Dictionary _serviceMap = new(StringComparer.OrdinalIgnoreCase); static PcStroageService() { @@ -21,7 +21,9 @@ namespace Tnb.WarehouseMgr public async Task Do(WareHouseUpInput input) { if (_serviceMap.ContainsKey(input.bizTypeId)) + { await _serviceMap[input.bizTypeId].ModifyAsync(input); + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs b/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs index edf25d6b..ce1d74be 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/PdaStroageService.cs @@ -10,13 +10,13 @@ namespace Tnb.WarehouseMgr [Caller("app")] public class PdaStroageService : IWHStorageService { - private static Dictionary _serviceMap = new Dictionary(StringComparer.OrdinalIgnoreCase); + private static readonly Dictionary _serviceMap = new(StringComparer.OrdinalIgnoreCase); static PdaStroageService() { - var serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IPdaStroage).IsAssignableFrom(u) && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList(); - foreach (var serviceType in serviceTypes) + List serviceTypes = App.EffectiveTypes.Where(u => u.IsClass && !u.IsInterface && !u.IsAbstract && typeof(IPdaStroage).IsAssignableFrom(u) && u.IsSubclassOf(typeof(BaseWareHouseService))).ToList(); + foreach (Type? serviceType in serviceTypes) { - var bizTypeId = serviceType.GetCustomAttribute()?.BizTypeId; + string? bizTypeId = serviceType.GetCustomAttribute()?.BizTypeId; if (!bizTypeId.IsNullOrEmpty()) { _serviceMap[bizTypeId!] = (BaseWareHouseService)App.GetService(serviceType)!; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs b/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs index 4a742f5f..1bc85611 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/Print/PPLBUtility.cs @@ -4,22 +4,19 @@ namespace Tnb.WarehouseMgr.Print { public class PPLBUtility { - - - - const uint IMAGE_BITMAP = 0; - const uint LR_LOADFROMFILE = 16; - static readonly string dllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\Winpplb.dll"); + private const uint IMAGE_BITMAP = 0; + private const uint LR_LOADFROMFILE = 16; + private static readonly string dllPath = Path.Combine(AppContext.BaseDirectory, @"Library\x64", "Library\\x64\\Winpplb.dll"); [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType, + private static extern IntPtr LoadImage(IntPtr hinst, string lpszName, uint uType, int cxDesired, int cyDesired, uint fuLoad); [DllImport("Gdi32.dll", SetLastError = true, CharSet = CharSet.Auto)] - static extern int DeleteObject(IntPtr ho); + private static extern int DeleteObject(IntPtr ho); public const string szSavePath = "C:\\Argox"; public const string szSaveFile = "C:\\Argox\\PPLB_Example.Prn"; - const string sznop1 = "nop_front\r\n"; - const string sznop2 = "nop_middle\r\n"; + private const string sznop1 = "nop_front\r\n"; + private const string sznop2 = "nop_middle\r\n"; /// /// 印出一个 Maxi Code 2D Barcode /// @@ -60,8 +57,15 @@ namespace Tnb.WarehouseMgr.Print ///打印方向,'0’是 0°,'1’是90°、'2’是180°,'3’是270° /// /// - /// - /// + /// + /// + /// + /// + /// + /// + /// + /// + /// /// 资料字串。 /// [DllImport("Library\\x64\\Library\\x64\\Winpplb.dll")] @@ -527,13 +531,12 @@ namespace Tnb.WarehouseMgr.Print /// 0 -> OK. /// Reference BW-Error.txt file. /// - /// + /// ///B_Prn_Text(50, 110, 0, 4, 1, 1, ‘N’, “A123456”); //无跳号功能 ///or ///B_Prn_Text(50, 110, 0, 4, 1, 1, ‘N’, “A123456<-1>”); //有跳号功能 /// - public static extern int B_Prn_Text(int x, int y, int ori, int font, int hor_factor, - int ver_factor, char mode, string data); + public static extern int B_Prn_Text(int x, int y, int ori, int font, int hor_factor, int ver_factor, char mode, string data); /// /// 打印出一行文字,使用中文字型档案 (1615 或 2424) /// @@ -551,8 +554,7 @@ namespace Tnb.WarehouseMgr.Print ///(1615 或 2424)。 /// [DllImport("Library\\x64\\Winpplb.dll")] - public static extern int B_Prn_Text_Chinese(int x, int y, int fonttype, string id_name, - string data); + public static extern int B_Prn_Text_Chinese(int x, int y, int fonttype, string id_name, string data); /// /// 打印Windows仿真字 /// diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs b/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs index 049c912d..681ceee0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TaskManagerDelBase.cs @@ -21,24 +21,24 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - var preTask = await _db.Queryable().SingleAsync(it => it.id == id); + T preTask = await _db.Queryable().SingleAsync(it => it.id == id); if (preTask != null) { - var locIds = new[] { preTask.startlocation_id, preTask.endlocation_id }; - var locs = await _db.Queryable().Where(it => locIds.Contains(it.id)).ToListAsync(); + string[] locIds = new[] { preTask.startlocation_id, preTask.endlocation_id }; + List locs = await _db.Queryable().Where(it => locIds.Contains(it.id)).ToListAsync(); if (locs?.Count > 0) { locs.ForEach(it => { it.is_lock = 0; }); - await _db.Updateable(locs).UpdateColumns(it => it.is_lock).ExecuteCommandAsync(); + _ = await _db.Updateable(locs).UpdateColumns(it => it.is_lock).ExecuteCommandAsync(); } - var carry = await _db.Queryable().SingleAsync(it => it.id == preTask.carry_id); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == preTask.carry_id); if (carry != null) { carry.is_lock = 0; - await _db.Updateable(carry).UpdateColumns(it => it.is_lock).ExecuteCommandAsync(); + _ = await _db.Updateable(carry).UpdateColumns(it => it.is_lock).ExecuteCommandAsync(); } - await _db.Deleteable(preTask).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => it.task_nums == it.task_nums - 1).Where(it => it.area_code == preTask.area_code).ExecuteCommandAsync(); + _ = await _db.Deleteable(preTask).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => it.task_nums == it.task_nums - 1).Where(it => it.area_code == preTask.area_code).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs b/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs index dc3f580c..5c3b04f8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TaskMesageNotify.cs @@ -33,7 +33,7 @@ namespace Tnb.WarehouseMgr { public static IServiceCollection AddTaskMessageNotify(this IServiceCollection services) { - services.AddSingleton(); + _ = services.AddSingleton(); return services; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs index 1f4faff6..fa748d84 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/TimedTaskBackgroundService.cs @@ -21,7 +21,7 @@ namespace Tnb.WarehouseMgr { public bool IsStarted { get; set; } private IEventPublisher _eventPublisher = default!; - private ElevatorControlConfiguration _elevatorControlConfiguration = App.Configuration.Build(); + private readonly ElevatorControlConfiguration _elevatorControlConfiguration = App.Configuration.Build(); private readonly IServiceProvider _serviceProvider; //private static Dictionary> _timedFuncMap = new(StringComparer.OrdinalIgnoreCase); public TimedTaskBackgroundService(IServiceProvider serviceProvider) @@ -33,19 +33,21 @@ namespace Tnb.WarehouseMgr { IsStarted = true; - var timedTask = Task.Run(() => + Task timedTask = Task.Run(() => { _eventPublisher = App.GetRequiredService(); //电梯Agv心跳检测 - TimedTask(async token => + _ = TimedTask(async token => { - var parameter = new Dictionary(); - parameter["DevName"] = _elevatorControlConfiguration.DevName; - parameter["TagName"] = "AGVKeepalive"; - parameter["Value"] = "123"; - parameter["token"] = _elevatorControlConfiguration.token; - var result = await HttpClientHelper.GetAsync(_elevatorControlConfiguration.WriteTagUrl, pars: parameter); + Dictionary parameter = new() + { + ["DevName"] = _elevatorControlConfiguration.DevName, + ["TagName"] = "AGVKeepalive", + ["Value"] = "123", + ["token"] = _elevatorControlConfiguration.token + }; + string result = await HttpClientHelper.GetAsync(_elevatorControlConfiguration.WriteTagUrl, pars: parameter); await Console.Out.WriteLineAsync($"心跳检测结果:{result}"); }, stoppingToken, 30, TimeSpanUnit.Seconds); ////齐套出库 @@ -70,7 +72,7 @@ namespace Tnb.WarehouseMgr private Task TimedTask(Func action, CancellationToken ct, int interval, TimeSpanUnit timeType = TimeSpanUnit.Seconds) { - var token = ct; + CancellationToken token = ct; return Task.Factory.StartNew(async () => { while (!token.IsCancellationRequested) @@ -158,15 +160,15 @@ namespace Tnb.WarehouseMgr internal class CustomerTaskScheduler : TaskScheduler { // 这边的 BlockingCollection 只是举个例子,如果是普通的队列,配合锁也是可以的。 - private readonly BlockingCollection _tasks = new BlockingCollection(); + private readonly BlockingCollection _tasks = new(); public CustomerTaskScheduler() { - var thread = new Thread(() => + Thread thread = new(() => { - foreach (var task in _tasks.GetConsumingEnumerable()) + foreach (Task task in _tasks.GetConsumingEnumerable()) { - TryExecuteTask(task); + _ = TryExecuteTask(task); } }) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 66954dcb..f8a94183 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -42,7 +42,7 @@ namespace Tnb.WarehouseMgr private readonly IUserManager _userManager; private readonly ICacheManager _cacheManager; private readonly IElevatorControlService _elevatorControlService; - private static Dictionary _elevatorAgvCtlStatusMap = new(StringComparer.OrdinalIgnoreCase); + private static readonly Dictionary _elevatorAgvCtlStatusMap = new(StringComparer.OrdinalIgnoreCase); private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build(); public Func AddUnExecuteTask { get; set; } @@ -84,10 +84,10 @@ namespace Tnb.WarehouseMgr .Select((a, b, c) => new { carry_id = a.id, - carry_name = a.carry_name, + a.carry_name, location_id = b.id, - location_name = b.location_name, + b.location_name, warehouse_id = c.id, warehouse_name = c.whname, }) @@ -102,14 +102,17 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task ApplyFor(InOutStockApplyforUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } async Task _updateLocalFunc(InOutStockApplyforUpInput input) where TStockD : BaseEntity, new() where TStockCode : BaseEntity, IInOutStockCode, new() { - var instockD = input.Adapt(); - var stockCodes = input.InstockCodes?.Adapt>(); + TStockD instockD = input.Adapt(); + global::System.Collections.Generic.List? stockCodes = input.InstockCodes?.Adapt>(); if (stockCodes?.Count > 0) { stockCodes.ForEach(x => @@ -124,13 +127,16 @@ namespace Tnb.WarehouseMgr return await Update(instockD, stockCodes!); } - var isOk = input.inoutStockType switch + bool isOk = input.inoutStockType switch { EnumInOutStockType.In => await _updateLocalFunc(input), EnumInOutStockType.Out => await _updateLocalFunc(input), _ => throw new ArgumentOutOfRangeException(nameof(input.inoutStockType), $"Not expected EnumInOutStockType value: {input.inoutStockType}"), }; - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } /// /// 根据明细Id获取出入库明细信息 @@ -154,12 +160,16 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task> InStockStrategy([FromQuery] InStockStrategyQuery input) { - var items = new List(); + List items = new(); try { - var policy = await _db.Queryable().Where(it => it.status == 1).FirstAsync(); - if (policy == null) throw new AppFriendlyException("没有可用的策略", 500); - var whereExp = Expressionable.Create() + WmsInstockPolicies policy = await _db.Queryable().Where(it => it.status == 1).FirstAsync(); + if (policy == null) + { + throw new AppFriendlyException("没有可用的策略", 500); + } + + Expression> whereExp = Expressionable.Create() .And(it => it.wh_id == input.warehouse_id) .And(it => it.is_lock == 0) .And(it => it.is_type == ((int)EnumLocationType.存储库位).ToString()) @@ -180,7 +190,7 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task> OutStockStrategy([FromQuery] OutStockStrategyQuery input) { - var whereExprable = Expressionable.Create() + Expressionable whereExprable = Expressionable.Create() .And((a, b, c) => a.is_lock == 0) .And((a, b, c) => !string.IsNullOrEmpty(a.location_id)) .And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString()) @@ -192,13 +202,17 @@ namespace Tnb.WarehouseMgr Expression> carryStatusFilterExp = !input.material_id.IsNullOrWhiteSpace() ? (a, b, c) => a.carry_status == ((int)EnumCarryStatus.占用).ToString() : (a, b, c) => a.carry_status == ((int)EnumCarryStatus.空闲).ToString(); - whereExprable.And(carryStatusFilterExp); - var whereExpr = whereExprable.ToExpression(); + _ = whereExprable.And(carryStatusFilterExp); + Expression> whereExpr = whereExprable.ToExpression(); - var cyDb = _db.CopyNew(); - var policy = await cyDb.Queryable().Where(it => it.status == 1).FirstAsync(); - if (policy == null) throw new AppFriendlyException("没有可用策略", 500); - var items = await cyDb.Queryable().LeftJoin((a, b) => a.id == b.carry_id) + SqlSugarClient cyDb = _db.CopyNew(); + WmsInstockPolicies policy = await cyDb.Queryable().Where(it => it.status == 1).FirstAsync(); + if (policy == null) + { + throw new AppFriendlyException("没有可用策略", 500); + } + + List items = await cyDb.Queryable().LeftJoin((a, b) => a.id == b.carry_id) .LeftJoin((a, b, c) => a.location_id == c.id) .Where(whereExpr) .OrderBy(policy.policy) @@ -219,11 +233,11 @@ namespace Tnb.WarehouseMgr Stopwatch sw = Stopwatch.StartNew(); CancellationTokenSource agvCts = new(); - var db = _db.CopyNew(); + SqlSugarClient db = _db.CopyNew(); try { //获取电梯数据 - var elevatorList = await db.Queryable().InnerJoin((a, b) => a.id == b.bill_id) + List elevatorList = await db.Queryable().InnerJoin((a, b) => a.id == b.bill_id) .Select((a, b) => new WmsElevatorH { bill_id = b.bill_id, @@ -236,7 +250,7 @@ namespace Tnb.WarehouseMgr //获取所有未下发的预任务申请 - var preTasks = await db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id) + List preTasks = await db.Queryable().InnerJoin((a, b) => a.startlocation_id == b.location_id && a.carry_id == b.id) .InnerJoin((a, b, c) => a.area_id == c.id) .Where(a => a.status == WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID && !string.IsNullOrWhiteSpace(a.startlocation_id)) .OrderBy(a => new { priority = SqlFunc.Desc(a.priority), a.bill_code }) @@ -245,40 +259,40 @@ namespace Tnb.WarehouseMgr move_num = c.move_num }, true) .ToListAsync(); - var agvElevatorTasks = preTasks + List agvElevatorTasks = preTasks .Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) && !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)) .ToList(); - var firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault()); + IEnumerable firstEleGrp = agvElevatorTasks.GroupBy(g => g.endlocation_code).Select(t => t.OrderBy(o => o.bill_code).FirstOrDefault()); agvElevatorTasks = agvElevatorTasks.FindAll(x => firstEleGrp.Select(y => y.endlocation_code).Contains(x.endlocation_code)); preTasks = preTasks.Where(it => !it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase)).Concat(agvElevatorTasks).ToList(); - var ids = preTasks.Select(x => x.id).Distinct().ToList(); - var preTaskCodes = await db.Queryable().Where(it => ids.Contains(it.bill_id)).ToListAsync(); + List ids = preTasks.Select(x => x.id).Distinct().ToList(); + List? preTaskCodes = await db.Queryable().Where(it => ids.Contains(it.bill_id)).ToListAsync(); if (preTasks.Count > 0) { //根据预任务管理区分组,获取到所有分组后的预任务,遍历每个预任务 是否为任务链,通过管理区ID - var preTaskGroups = preTasks.GroupBy(g => g.area_code).ToList(); + List> preTaskGroups = preTasks.GroupBy(g => g.area_code).ToList(); List disTasks = new(); List distaskCodes = new(); - foreach (var itGroup in preTaskGroups) + foreach (IGrouping? itGroup in preTaskGroups) { - var items = itGroup.Adapt>(); + List items = itGroup.Adapt>(); for (int i = 0, cnt = items.Count; i < cnt; i++) { items[i].id = SnowflakeIdHelper.NextId(); items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; } - var moveNum = itGroup.First().move_num; - var itemsCount = items.Count; - var mod = itemsCount % moveNum > 0 ? itemsCount / moveNum + 1 : itemsCount / moveNum; - var arrary = items.ToArray(); + int moveNum = itGroup.First().move_num; + int itemsCount = items.Count; + int mod = itemsCount % moveNum > 0 ? (itemsCount / moveNum) + 1 : itemsCount / moveNum; + WmsDistaskH[] arrary = items.ToArray(); for (int i = 1; i <= mod; i++) { - var groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); + string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); if (moveNum >= 1) { - var areaPreTasks = itGroup.ToList(); + List areaPreTasks = itGroup.ToList(); if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1)) { @@ -293,18 +307,18 @@ namespace Tnb.WarehouseMgr { items.ForEach(x => x.is_chain = 1); - var start = 0; - var end = Math.Min(itemsCount, moveNum); - var arrList = new List(mod); + int start = 0; + int end = Math.Min(itemsCount, moveNum); + List arrList = new(mod); while (start < itemsCount) { - var subArray = arrary[start..end]; + WmsDistaskH[] subArray = arrary[start..end]; arrList.Add(subArray); start = end; - end = Math.Min((end + moveNum), arrary.Length); + end = Math.Min(end + moveNum, arrary.Length); } - foreach (var arr in arrList) + foreach (WmsDistaskH[] arr in arrList) { for (int j = 1, len = arr.Length; j <= len; j++) { @@ -318,10 +332,10 @@ namespace Tnb.WarehouseMgr if (preTaskCodes?.Count > 0) { - foreach (var disTask in items) + foreach (WmsDistaskH disTask in items) { - var curPreTaskCodes = preTaskCodes.FindAll(x => x.bill_id == disTask.pretask_id); - var curDisTaskCodes = curPreTaskCodes.Adapt>(); + List curPreTaskCodes = preTaskCodes.FindAll(x => x.bill_id == disTask.pretask_id); + List curDisTaskCodes = curPreTaskCodes.Adapt>(); curDisTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -336,15 +350,15 @@ namespace Tnb.WarehouseMgr } await db.Ado.BeginTranAsync(); - var endPointIds = disTasks.Where(t => t.area_code.StartsWith("ELE", StringComparison.OrdinalIgnoreCase)).Select(t => t.endpoint_id).ToList(); + List endPointIds = disTasks.Where(t => t.area_code.StartsWith("ELE", StringComparison.OrdinalIgnoreCase)).Select(t => t.endpoint_id).ToList(); if (endPointIds?.Count > 0) { elevatorList = elevatorList.FindAll(x => endPointIds.Contains(x.point_id)); if (elevatorList?.Count > 0) { - foreach (var e in elevatorList) + foreach (WmsElevatorH? e in elevatorList) { - var disTask = disTasks.Find(x => x.endpoint_id == e.point_id); + WmsDistaskH? disTask = disTasks.Find(x => x.endpoint_id == e.point_id); if (disTask != null) { disTask.device_id = e.elevator_id; @@ -355,14 +369,14 @@ namespace Tnb.WarehouseMgr //disTasks.ForEach(x => x.id = SnowflakeIdHelper.NextId()); - var row = await db.Insertable(disTasks).ExecuteCommandAsync(); + int row = await db.Insertable(disTasks).ExecuteCommandAsync(); if (preTaskCodes?.Count > 0) { row = await db.Insertable(distaskCodes).ExecuteCommandAsync(); } if (row > 0) { - var preTaskIds = preTasks.Select(x => x.id).ToList(); + List preTaskIds = preTasks.Select(x => x.id).ToList(); row = await db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_YXF_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync(); } @@ -370,7 +384,7 @@ namespace Tnb.WarehouseMgr //呼梯操作 //获取目标库位为电梯库位的任务 - var endLocCodes = disTasks + List<(string endlocation_code, string device_id, string id, string? start_floor)> endLocCodes = disTasks .Where(it => it.endlocation_code.StartsWith("DT", StringComparison.OrdinalIgnoreCase) && !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)) .Select(it => (it.endlocation_code, it.device_id, it.id, it.start_floor)).ToList(); @@ -380,7 +394,7 @@ namespace Tnb.WarehouseMgr await CallingLanding(endLocCodes); } //执行电梯任务 - var elevatorTasks = disTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList(); + List? elevatorTasks = disTasks.Where(it => it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList(); if (elevatorTasks?.Count > 0) { @@ -388,14 +402,14 @@ namespace Tnb.WarehouseMgr Logger.Information("准备执行电梯任务"); Logger.Information("执行电梯任务"); - foreach (var elevatorTask in elevatorTasks) + foreach (WmsDistaskH? elevatorTask in elevatorTasks) { await ExecuteTargetFloorTask(elevatorTask); } } ////调用AGV创建任务链接口 - var agvTasks = disTasks.Where(it => !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList(); + List agvTasks = disTasks.Where(it => !it.area_code.Contains("ELE", StringComparison.OrdinalIgnoreCase)).ToList(); if (agvTasks?.Count > 0) { await AgvDispatch(agvTasks, agvCts.Token); @@ -414,7 +428,7 @@ namespace Tnb.WarehouseMgr } finally { - s_taskExecuteSemaphore.Release(); + _ = s_taskExecuteSemaphore.Release(); agvCts.Dispose(); } } @@ -428,31 +442,34 @@ namespace Tnb.WarehouseMgr Logger.Information($" 开始呼梯操作............."); try { - foreach (var (_, devId, disTaskId, floorNO) in endLocCodes) + foreach ((_, string devId, string disTaskId, string floorNO) in endLocCodes) { - if (!s_elevatorMap.TryGetValue(devId, out var elevatorCode)) continue; + if (!s_elevatorMap.TryGetValue(devId, out object? elevatorCode)) + { + continue; + } - var devName = elevatorCode.ToString(); + string? devName = elevatorCode.ToString(); Logger.Information($"当前:{devName.Match(@"\d+")}#梯"); await _elevatorControlService.WriteTagAsync(devName, ElevatorConsts.AGVControl, 1); (int sysStatus, int runStatus, int curFloorNo, int doorStatus, int agvStatus) eleStatusMulti = (-1, -1, -1, -1, -1); - if (!_elevatorAgvCtlStatusMap.TryGetValue(devId, out var agvCtlStatus) || agvCtlStatus != (int)EnumAgvStatus.AGV运行状态) + if (!_elevatorAgvCtlStatusMap.TryGetValue(devId, out int agvCtlStatus) || agvCtlStatus != (int)EnumAgvStatus.AGV运行状态) { do { eleStatusMulti = await _elevatorControlService.GetElevatorStatus(devName, CancellationToken.None); await Task.Delay(500); } while (eleStatusMulti.agvStatus != (int)EnumAgvStatus.AGV运行状态); - Logger.Information($"{devName.Match(@"\d+")}#, 当前Agv状态:{eleStatusMulti.agvStatus.ToEnum().ToString()}"); + Logger.Information($"{devName.Match(@"\d+")}#, 当前Agv状态:{eleStatusMulti.agvStatus.ToEnum()}"); _elevatorAgvCtlStatusMap[devId] = eleStatusMulti.agvStatus; } Logger.Information($"任务开始目标楼层为:{floorNO}"); - var floorN = await GetRealFloor(floorNO.ParseToInt()); + int floorN = await GetRealFloor(floorNO.ParseToInt()); //如果电梯在当前楼层则不呼梯 if (floorN == eleStatusMulti.curFloorNo) { @@ -472,19 +489,19 @@ namespace Tnb.WarehouseMgr create_id = _userManager.UserId, create_time = DateTime.Now }; - var elevatorQueue = await _db.Queryable().Where(it => it.distask_id == disTaskId && it.task_status == "执行中").ToListAsync(); + List elevatorQueue = await _db.Queryable().Where(it => it.distask_id == disTaskId && it.task_status == "执行中").ToListAsync(); if ((elevatorQueue.IsNull() || elevatorQueue.Count < 1) && floorN != eleStatusMulti.curFloorNo) { elevatorQueueItem.task_status = "执行中"; - var callLiftRes = await _elevatorControlService.CallLift(devName, floorN, CancellationToken.None); + bool callLiftRes = await _elevatorControlService.CallLift(devName, floorN, CancellationToken.None); string successful = "成功", fail = "失败"; - var callLiftResult = callLiftRes ? successful : fail; + string callLiftResult = callLiftRes ? successful : fail; Logger.Information($"{devName.Match(@"\d+")}#, 呼梯结果:{callLiftResult}"); } //如果当前电梯有任务在做,将当前呼梯任务放入待执行队列 - await _db.Insertable(elevatorQueueItem).ExecuteCommandAsync(); + _ = await _db.Insertable(elevatorQueueItem).ExecuteCommandAsync(); } } catch (Exception ex) @@ -505,29 +522,29 @@ namespace Tnb.WarehouseMgr Logger.Information($"开始执行电梯任务,任务ID:{disTask.id}"); try { - if (!s_elevatorMap.TryGetValue(disTask.device_id, out var elevatorCode)) + if (!s_elevatorMap.TryGetValue(disTask.device_id, out object? elevatorCode)) { return; } - var devName = s_elevatorMap[disTask.device_id]?.ToString() ?? _eleCtlCfg.DevName; + string devName = s_elevatorMap[disTask.device_id]?.ToString() ?? _eleCtlCfg.DevName; Logger.Information($"当前:{devName.Match(@"\d+")}#梯"); await _elevatorControlService.WriteTagAsync(devName, ElevatorConsts.AGVControl, 1); (int sysStatus, int runStatus, int curFloorNo, int doorStatus, int agvStatus) eleStatusMulti = (-1, -1, -1, -1, -1); - if (!_elevatorAgvCtlStatusMap.TryGetValue(disTask.id, out var agvCtlStatus) || agvCtlStatus != (int)EnumAgvStatus.AGV运行状态) + if (!_elevatorAgvCtlStatusMap.TryGetValue(disTask.id, out int agvCtlStatus) || agvCtlStatus != (int)EnumAgvStatus.AGV运行状态) { do { eleStatusMulti = await _elevatorControlService.GetElevatorStatus(devName, CancellationToken.None); await Task.Delay(500); } while (eleStatusMulti.agvStatus != (int)EnumAgvStatus.AGV运行状态); - Logger.Information($"{devName.Match(@"\d+")}#, 当前Agv状态:{eleStatusMulti.agvStatus.ToEnum().ToString()}"); + Logger.Information($"{devName.Match(@"\d+")}#, 当前Agv状态:{eleStatusMulti.agvStatus.ToEnum()}"); _elevatorAgvCtlStatusMap[disTask.id] = eleStatusMulti.agvStatus; } - var doorStatus = -1; - var closeDoorRes = await _elevatorControlService.SendOpenCloseCmd(devName, 4); //向电梯发送前门关门指令 + int doorStatus = -1; + bool closeDoorRes = await _elevatorControlService.SendOpenCloseCmd(devName, 4); //向电梯发送前门关门指令 Logger.Information($"关门结果:{closeDoorRes}"); do { @@ -536,12 +553,12 @@ namespace Tnb.WarehouseMgr } while (doorStatus != 4); Logger.Information($"当前门状态:{doorStatus}"); - var floor = await GetRealFloor(disTask.end_floor.ParseToInt()); + int floor = await GetRealFloor(disTask.end_floor.ParseToInt()); Logger.Information($"目标楼层:{floor}"); //发送到目标楼的指令 - var reuslt = await _elevatorControlService.WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor); + dynamic reuslt = await _elevatorControlService.WriteTagAsync(devName, ElevatorConsts.FloorExecute, floor); //电梯任务手动执行任务状态上报 (int sysStatus, int runStatus, int floorNo, int doorStatus, int agvStatus) tuple = (-1, -1, -1, -1, -1); @@ -556,7 +573,7 @@ namespace Tnb.WarehouseMgr if (tuple.sysStatus.ToEnum() == EnumSysStatus.正常状态 && tuple.runStatus.ToEnum() == EnumRunStatus.停梯) { Log.Information($"disTask.require_id={disTask.require_id}"); - var disTaskIds = new List { disTask.id }; + List disTaskIds = new() { disTask.id }; var upInput = new { disTaskIds = disTask.id }; TaskExecuteAfterUpInput teaUpInput = new() { @@ -588,8 +605,8 @@ namespace Tnb.WarehouseMgr //调用AGV创建任务链接口 try { - var requestCfg = App.Configuration.Build(); - var url = requestCfg.AgvRequestUrls.CreateTaskChainUrl; + AgvRequestConfig requestCfg = App.Configuration.Build(); + string url = requestCfg.AgvRequestUrls.CreateTaskChainUrl; var taskChainCodeDic = disTasks.Where(t => !t.groups.IsNullOrWhiteSpace()).GroupBy(g => g.groups!) .ToDictionary(x => x.Key, x => x.Select(it => new { @@ -599,7 +616,7 @@ namespace Tnb.WarehouseMgr containerCode = it.carry_code, })); Logger.Information($"请求地址:{url}"); - foreach (var (k, v) in taskChainCodeDic) + foreach ((string k, object v) in taskChainCodeDic) { dynamic reqBody = new ExpandoObject(); reqBody.taskChainCode = k; @@ -608,7 +625,7 @@ namespace Tnb.WarehouseMgr reqBody.taskChainPriority = 0; reqBody.taskList = v; Logger.Information($"请求参数:{JsonConvert.SerializeObject(reqBody)}"); - var respBody = await HttpClientHelper.PostStreamAsync(url, reqBody, token); + dynamic respBody = await HttpClientHelper.PostStreamAsync(url, reqBody, token); Logger.Information($"调用Agv接口响应结果:{respBody}"); } } @@ -635,22 +652,16 @@ namespace Tnb.WarehouseMgr //更任务执行 for (int i = 0, cnt = input.disTaskIds.Count; i < cnt; i++) { - if (input.EqpIds?.Count > 0) - { - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID, device_id = input.EqpIds[i] }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); - } - else - { - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); - - } + _ = input.EqpIds?.Count > 0 + ? await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID, device_id = input.EqpIds[i] }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync() + : await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); //await _db.Updateable().SetColumns(it => setColVal).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); } - var preTaskIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.pretask_id).ToListAsync(); + List preTaskIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => it.pretask_id).ToListAsync(); if (preTaskIds.Count > 0) { //更预任务申请表状态 - await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_START_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_START_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); @@ -674,19 +685,19 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_RUNING_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); //清空载具库位数据 var carryAndLocIds = await _db.Queryable().Where(it => input.disTaskIds.Contains(it.id)).Select(it => new { it.carry_id, it.startlocation_id }).ToListAsync(); if (carryAndLocIds?.Count > 0) { - var carryIds = carryAndLocIds.Select(x => x.carry_id).ToList(); - await _db.Updateable().SetColumns(it => new WmsCarryH { location_id = null, location_code = null }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync(); + List carryIds = carryAndLocIds.Select(x => x.carry_id).ToList(); + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { location_id = null, location_code = null }).Where(it => carryIds.Contains(it.id)).ExecuteCommandAsync(); } //更新起始库位,状态改为空闲、锁定状态,未锁定 if (carryAndLocIds?.Count > 0) { - var startLocationIds = carryAndLocIds.Select(x => x.startlocation_id).ToList(); - await _db.Updateable().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString(), is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); + List startLocationIds = carryAndLocIds.Select(x => x.startlocation_id).ToList(); + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString(), is_lock = 0 }).Where(it => startLocationIds.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); @@ -709,13 +720,13 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //更新任务执行表,单据状态为 完成 - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); - var disTasks = await _db.Queryable().InnerJoin((a, b) => a.carry_id == b.id).Where(a => input.disTaskIds.Contains(a.id)).Select((a, b) => new WmsDistaskH { carry_status = b.carry_status }, true).ToListAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID }).Where(it => input.disTaskIds.Contains(it.id)).ExecuteCommandAsync(); + List disTasks = await _db.Queryable().InnerJoin((a, b) => a.carry_id == b.id).Where(a => input.disTaskIds.Contains(a.id)).Select((a, b) => new WmsDistaskH { carry_status = b.carry_status }, true).ToListAsync(); if (disTasks?.Count > 0) { // 更新预任务申请表,单据状态为 已完成 - var preTaskIds = disTasks.Select(x => x.pretask_id).ToList(); - await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync(); + List preTaskIds = disTasks.Select(x => x.pretask_id).ToList(); + _ = await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID }).Where(it => preTaskIds.Contains(it.id)).ExecuteCommandAsync(); //更新电梯任务数量 /* var eles = await _db.Queryable().Where(it => disTasks.Select(x => x.area_code).Contains(it.area_code)).ToListAsync(); @@ -725,8 +736,8 @@ namespace Tnb.WarehouseMgr //更新载具,锁定状态为未锁定,更新载具的库位当前任务的目标库位 Logger.Information("更新载具及库位准备中....."); - var multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList(); - var locWhIdMap = await _db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id); + List<(string carry_id, string carry_status, string endlocation_id, string endlocation_code)> multiList = disTasks.Select(it => (it.carry_id, it.carry_status, it.endlocation_id, it.endlocation_code)).ToList(); + Dictionary locWhIdMap = await _db.Queryable().Where(it => multiList.Select(x => x.endlocation_id).Contains(it.id)).ToDictionaryAsync(it => it.id, it => it.wh_id); List carryIts = new(); List carryCodeIts = new(); List locIts = new(); @@ -739,7 +750,7 @@ namespace Tnb.WarehouseMgr location_id = multiList[i].endlocation_id, location_code = multiList[i].endlocation_code }; - var endLocId = multiList[i].endlocation_id; + string endLocId = multiList[i].endlocation_id; WmsCarryCode carryCode = new() { warehouse_id = locWhIdMap.ContainsKey(endLocId) ? locWhIdMap[endLocId].ToString() : "", @@ -749,10 +760,12 @@ namespace Tnb.WarehouseMgr carryIts.Add(carry); carryCodeIts.Add(carryCode); - BasLocation loc = new(); - loc.id = multiList[i].endlocation_id; - loc.is_lock = 0; - loc.is_use = multiList[i].carry_status; + BasLocation loc = new() + { + id = multiList[i].endlocation_id, + is_lock = 0, + is_use = multiList[i].carry_status + }; if (multiList[i].carry_status.ToEnum() == EnumCarryStatus.空闲) { loc.is_use = ((int)EnumCarryStatus.占用).ToString(); @@ -761,21 +774,21 @@ namespace Tnb.WarehouseMgr locIts.Add(loc); } Logger.Information("更新载具及库位开始....."); - await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); + _ = await _db.Updateable(carryIts).UpdateColumns(it => new { it.is_lock, it.location_id, it.location_code }).ExecuteCommandAsync(); //更新条码的库位和仓库信息 - await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); + _ = await _db.Updateable(carryCodeIts).UpdateColumns(it => new { it.warehouse_id, it.location_id, it.location_code }).Where(it => multiList.Select(x => x.carry_id).Contains(it.carry_id)).ExecuteCommandAsync(); //更新库位信息,使用状态为 使用,锁定状态为未锁定 - await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync(); + _ = await _db.Updateable(locIts).UpdateColumns(it => new { it.is_use, it.is_lock }).ExecuteCommandAsync(); Logger.Information("更新载具及库位结束....."); Logger.Information($"_userManager==null:{_userManager == null}"); /* var loginType= _userManager?.LoginType ?? "web"; Log.Information($"_userManager.LoginType={loginType}"); */ //更新业务主表的单据状态 - foreach (var dt in disTasks) + foreach (WmsDistaskH? dt in disTasks) { Logger.Information("开始业务回更"); - var disTaskCodes = await _db.Queryable().Where(it => it.bill_id == dt.id).ToListAsync(); - var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() }; + List disTaskCodes = await _db.Queryable().Where(it => it.bill_id == dt.id).ToListAsync(); + WareHouseUpInput upInput = new() { bizTypeId = dt.biz_type, requireId = dt.require_id!, distaskCodes = disTaskCodes, carryIds = disTasks.Select(x => x.carry_id).ToList() }; /*if (!_userManager?.LoginType.IsNullOrEmpty() ?? false) { @@ -816,7 +829,7 @@ namespace Tnb.WarehouseMgr async Task _updateStatus(ModifyPoliciesStatusInput input) where T : BaseEntity, IUpdatePoliciesStatus, new() { 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(); } switch (input.strategyType) @@ -847,22 +860,22 @@ namespace Tnb.WarehouseMgr }); if (preTasks.FindAll(it => it.startlocation_id == it.endlocation_id)?.Count > 0) { - preTasks.RemoveAll(it => it.startlocation_id == it.endlocation_id); + _ = preTasks.RemoveAll(it => it.startlocation_id == it.endlocation_id); } - var grpList = preTasks.OrderBy(o => o.bill_code).GroupBy(g => g.carry_id).ToList(); + List> grpList = preTasks.OrderBy(o => o.bill_code).GroupBy(g => g.carry_id).ToList(); if (grpList?.Count > 0) { - foreach (var grp in grpList) + foreach (IGrouping? grp in grpList) { - var arr = grp.ToArray(); + WmsPretaskH[] arr = grp.ToArray(); if (arr.Length > 1) { - var subArr = arr[..^1]; + WmsPretaskH[] subArr = arr[..^1]; System.Array.ForEach(subArr, a => a.chain_type = "1"); } } } - var row = await _db.Insertable(preTasks).ExecuteCommandAsync(); + int row = await _db.Insertable(preTasks).ExecuteCommandAsync(); if (preTaskCodes?.Count > 0) { row = await _db.Insertable(preTaskCodes).ExecuteCommandAsync(); @@ -889,22 +902,22 @@ namespace Tnb.WarehouseMgr //根据生成的预任务,插入预任务操作记录 if (input.PreTaskRecord != null) { - await _db.Insertable(input.PreTaskRecord).ExecuteCommandAsync(); + _ = await _db.Insertable(input.PreTaskRecord).ExecuteCommandAsync(); } if (input.PreTaskHandleCodes.Count > 0) { - await _db.Insertable(input.PreTaskHandleCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(input.PreTaskHandleCodes).ExecuteCommandAsync(); } //根据载具ID,更新是否锁定和赋值起始库位 if (setCarryColumnsExp != null) { Expression> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId; - await _db.Updateable().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync(); } //根据所有库位更新库位的锁定状态为“锁定” if (setLocaionColumbExp != null && input.LocationIds?.Count > 0) { - await _db.Updateable().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); } @@ -924,42 +937,47 @@ namespace Tnb.WarehouseMgr [NonAction] public async Task> PathAlgorithms(string pStartId, string pEndId) { - var roads = await _db.Queryable().Where(it => it.status == 1).ToListAsync(); - var points = await LocPathCalcAlgorithms(pStartId, pEndId, roads); + List roads = await _db.Queryable().Where(it => it.status == 1).ToListAsync(); + List points = await LocPathCalcAlgorithms(pStartId, pEndId, roads); try { if (points.FindAll(x => x.location_code != null && x.location_code.Contains("ELE"))?.Count > 0) { //查询当前电梯点 - var curEleDs = await _db.Queryable().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync(); + List curEleDs = await _db.Queryable().Where(it => points.Select(x => x.id).Contains(it.point_id)).ToListAsync(); //如果有电梯点,则会进行电梯的均匀分配 if (curEleDs?.Count > 0) { //当前电梯 - var curEle = await _db.Queryable().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1); - if (curEle == null) throw new AppFriendlyException("电梯被禁用或未配置", 500); + WmsElevatorH curEle = await _db.Queryable().SingleAsync(it => it.id == curEleDs.First().bill_id && it.status == 1); + if (curEle == null) + { + throw new AppFriendlyException("电梯被禁用或未配置", 500); + } //同电梯组电梯 - var sGpEle = await _db.Queryable().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync(); + List sGpEle = await _db.Queryable().Where(it => it.elevator_group == curEle.elevator_group && it.id != curEle.id && it.status == 1).ToListAsync(); //判断电梯组中各电梯任务数 if (sGpEle.FindAll(x => Math.Abs(x.task_nums - curEle.task_nums) % 2 == 1)?.Count > 0) { - var sGpDs = await _db.Queryable().Where(it => it.bill_id == sGpEle.First().id).ToListAsync(); + List sGpDs = await _db.Queryable().Where(it => it.bill_id == sGpEle.First().id).ToListAsync(); if (sGpDs?.Count > 0) { - var sGpPoints = await _db.Queryable().Where(it => sGpDs.Select(x => x.point_id).Contains(it.id)).ToListAsync(); - var sFEndId = sGpDs.Single(x => x.floor == curEleDs.First().floor).point_id; - var eFStartId = sGpDs.Single(x => x.floor == curEleDs.Last().floor).point_id; - var sFPoints = await LocPathCalcAlgorithms(pStartId, sFEndId, roads); + List sGpPoints = await _db.Queryable().Where(it => sGpDs.Select(x => x.point_id).Contains(it.id)).ToListAsync(); + string sFEndId = sGpDs.Single(x => x.floor == curEleDs.First().floor).point_id; + string eFStartId = sGpDs.Single(x => x.floor == curEleDs.Last().floor).point_id; + List sFPoints = await LocPathCalcAlgorithms(pStartId, sFEndId, roads); List elePoints = new(); - foreach (var pt in curEleDs) + foreach (WmsElevatorD pt in curEleDs) { - var elePoint = sGpPoints.Find(x => x.floor == pt.floor); + WmsPointH? elePoint = sGpPoints.Find(x => x.floor == pt.floor); if (elePoint != null) + { elePoints.Add(elePoint); + } } - var eFPoints = await LocPathCalcAlgorithms(eFStartId, pEndId, roads); - elePoints.Remove(elePoints.First()); - elePoints.Remove(elePoints.Last()); + List eFPoints = await LocPathCalcAlgorithms(eFStartId, pEndId, roads); + _ = elePoints.Remove(elePoints.First()); + _ = elePoints.Remove(elePoints.Last()); points.Clear(); points.AddRange(sFPoints); points.AddRange(elePoints); @@ -1006,28 +1024,24 @@ namespace Tnb.WarehouseMgr #endregion #region dijkstra - var points = await _db.Queryable().ToListAsync(); - var startObj = points.Find(x => x.id == pStartId); - var endObj = points.Find(x => x.id == pEndId); - var sIndex = points.IndexOf(startObj); - var eIndex = points.IndexOf(endObj); + List? points = await _db.Queryable().ToListAsync(); + WmsPointH? startObj = points.Find(x => x.id == pStartId); + WmsPointH? endObj = points.Find(x => x.id == pEndId); + int sIndex = points.IndexOf(startObj); + int eIndex = points.IndexOf(endObj); if (eIndex < sIndex) { - var tempIndex = sIndex; - sIndex = eIndex; - eIndex = tempIndex; - var temp = points[sIndex]; - points[sIndex] = points[eIndex]; - points[eIndex] = temp; + (eIndex, sIndex) = (sIndex, eIndex); + (points[eIndex], points[sIndex]) = (points[sIndex], points[eIndex]); } - var vexs = points.Select(p => p.id).ToArray(); + string[] vexs = points.Select(p => p.id).ToArray(); EData[] edges = new EData[roads.Count]; for (int i = 0; i < edges.Length; i++) { - var start = roads[i].startpoint_id; - var end = roads[i].endpoint_id; - var weight = roads[i].distance; + string start = roads[i].startpoint_id; + string end = roads[i].endpoint_id; + int weight = roads[i].distance; edges[i] = new EData(start, end, weight); } @@ -1036,7 +1050,7 @@ namespace Tnb.WarehouseMgr int[] dist = new int[pG.mVexs.Length]; List vertexs = new() { startObj }; pG.CalcDijkstra(sIndex, prev, dist); - var pointIds = points.Select(p => p.id).ToList(); + List pointIds = points.Select(p => p.id).ToList(); Stack result = new(); GetPoints(pointIds, prev, result, eIndex); @@ -1044,7 +1058,7 @@ namespace Tnb.WarehouseMgr if (points?.Count > 0) { //points.Where(it => result.Contains(it.id)); - foreach (var i in result) + foreach (string i in result) { WmsPointH? point = points?.Find(x => x.id == i); if (point != null) @@ -1069,13 +1083,13 @@ namespace Tnb.WarehouseMgr /// private void MatchPoint(List results, List roads, List shortestPathPoints, Dictionary isVisited, string pStartId, string pEndId) { - var sRoads = roads.Where(x => x.startpoint_id == pStartId).ToList(); + List sRoads = roads.Where(x => x.startpoint_id == pStartId).ToList(); for (int j = 0; j < sRoads.Count; j++) { - var sPoint = shortestPathPoints.Find(x => x.id == sRoads[j].endpoint_id); + WmsPointH? sPoint = shortestPathPoints.Find(x => x.id == sRoads[j].endpoint_id); if (sPoint != null && isVisited.ContainsKey(sPoint.id) && !isVisited[sPoint.id] && sPoint.id != pEndId) { - var code = sPoint.point_code; + string code = sPoint.point_code; results.Add(sPoint); isVisited[sPoint.id] = true; MatchPoint(results, roads, shortestPathPoints, isVisited, sPoint.id, pEndId); @@ -1091,7 +1105,7 @@ namespace Tnb.WarehouseMgr /// private static void GetPoints(List pointIds, int[] prev, Stack result, int eIdx) { - var index = eIdx; + int index = eIdx; while (index != 0) { result.Push(pointIds[index]); @@ -1101,14 +1115,14 @@ namespace Tnb.WarehouseMgr private async Task Update(T1 entity, List entities) where T1 : BaseEntity, new() where T2 : BaseEntity, new() { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); isOk = await _db.Updateable(entity).ExecuteCommandHasChangeAsync(); if (entities?.Count > 0) { - var row = await _db.Storageable(entities).ExecuteCommandAsync(); + int row = await _db.Storageable(entities).ExecuteCommandAsync(); isOk = row > 0; } await _db.Ado.CommitTranAsync(); @@ -1133,8 +1147,8 @@ namespace Tnb.WarehouseMgr where TOutput : IInOutStockDetail, new() where TStockCode : BaseEntity, IInOutStockCode, new() { - var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID); - var data = await _db.Queryable() + Dictionary dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID); + List data = await _db.Queryable() .Where(a => a.id == billDId) .Select(a => new TOutput { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs index 1076b9e7..07759054 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryBindService.cs @@ -45,7 +45,7 @@ namespace Tnb.WarehouseMgr [NonAction] public async Task CarryBind(VisualDevModelDataCrInput input) { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); @@ -53,15 +53,19 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBIND_ID, true); await _runService.Create(templateEntity, input); - if (input == null) throw new ArgumentNullException(nameof(input)); - var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); - var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + string? carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + string? subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; + WmsCarryH? carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + WmsCarryH? subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); if (carry != null && subCarry != null) { carry.carry_status = ((int)EnumCarryStatus.占用).ToString(); - var row = await _db.Updateable(carry).ExecuteCommandAsync(); + int row = await _db.Updateable(carry).ExecuteCommandAsync(); subCarry.carry_status = ((int)EnumCarryStatus.占用).ToString(); row = await _db.Updateable(subCarry).ExecuteCommandAsync(); //更新载具明细表 @@ -77,31 +81,36 @@ namespace Tnb.WarehouseMgr create_time = DateTime.Now }; row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync(); - var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); + List items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); List wmsCarrybindCodes = new(); //更新载具绑定条码表 for (int i = 0; i < items.Count; i++) { - WmsCarrybindCode wmsCarrybindCode = new(); - wmsCarrybindCode.id = SnowflakeIdHelper.NextId(); - wmsCarrybindCode.org_id = (subCarry != null && subCarry.org_id != null) ? subCarry.org_id : _userManager.User.OrganizeId; - wmsCarrybindCode.carrybind_id = input.data["ReturnIdentity"]?.ToString()!; - wmsCarrybindCode.material_id = items[i].material_id; - wmsCarrybindCode.material_code = items[i].material_code; - wmsCarrybindCode.barcode = items[i].barcode; - wmsCarrybindCode.code_batch = items[i].code_batch; - wmsCarrybindCode.codeqty = items[i].codeqty; - wmsCarrybindCode.membercarry_id = subCarry?.id; - wmsCarrybindCode.membercarry_code = subCarry?.carry_code; - wmsCarrybindCode.unit_id = items[i].unit_id; - wmsCarrybindCode.unit_code = items[i].unit_code; - wmsCarrybindCode.create_id = _userManager.UserId; - wmsCarrybindCode.create_time = DateTime.Now; + WmsCarrybindCode wmsCarrybindCode = new() + { + id = SnowflakeIdHelper.NextId(), + org_id = (subCarry != null && subCarry.org_id != null) ? subCarry.org_id : _userManager.User.OrganizeId, + carrybind_id = input.data["ReturnIdentity"]?.ToString()!, + material_id = items[i].material_id, + material_code = items[i].material_code, + barcode = items[i].barcode, + code_batch = items[i].code_batch, + codeqty = items[i].codeqty, + membercarry_id = subCarry?.id, + membercarry_code = subCarry?.carry_code, + unit_id = items[i].unit_id, + unit_code = items[i].unit_code, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; wmsCarrybindCodes.Add(wmsCarrybindCode); } row = await _db.Insertable(wmsCarrybindCodes).ExecuteCommandAsync(); - isOk = (row > 0); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + isOk = row > 0; + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs index a2c35e74..b15eee4f 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryLedgerService.cs @@ -36,7 +36,6 @@ namespace Tnb.WarehouseMgr /// /// 载具导入 /// - /// /// private async Task DataImport(VisualDevImportDataInput input) { @@ -44,28 +43,35 @@ namespace Tnb.WarehouseMgr try { List> dics = input.list; - List carrys = new List(); + List carrys = new(); Dictionary? locs = null; List locCodes = new(); List cStdCodes = new(); - WmsCarryH carryH = new WmsCarryH(); + WmsCarryH carryH = new(); //遍历字典,找出需要查询数据库拿的相关字段 - foreach (var d in dics) + foreach (Dictionary d in dics) { - var cStdCode = d["carrystd_id"].ToString() ?? string.Empty; + string cStdCode = d["carrystd_id"].ToString() ?? string.Empty; locCodes.Add(d["location_code"].ToString() ?? string.Empty); cStdCodes.Add(cStdCode); d["create_time"] = DateTime.Now; - d.Remove("modify_time"); + _ = d.Remove("modify_time"); carryH = d.Adapt(); carrys.Add(carryH); } - var carryStdDic = await _db.Queryable().Where(it => cStdCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id); + Dictionary carryStdDic = await _db.Queryable().Where(it => cStdCodes.Contains(it.carrystd_code)).ToDictionaryAsync(x => x.carrystd_code, x => x.id); if (locCodes?.Count > 0) + { locs = await _db.Queryable().Where(it => locCodes.Contains(it.location_code)).ToDictionaryAsync(x => x.location_code, x => x.id); + } + carrys.ForEach(x => { - if (!carryStdDic.Keys.Contains(x.carrystd_id)) throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500); + if (!carryStdDic.Keys.Contains(x.carrystd_id)) + { + throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500); + } + x.id = SnowflakeIdHelper.NextId(); x.org_id = _userManager.User.OrganizeId; x.status = 1; @@ -73,7 +79,10 @@ namespace Tnb.WarehouseMgr x.carrystd_id = carryStdDic[x.carrystd_id].ToString() ?? throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的载具规格有误", 500); x.carry_status = ((int)EnumCarryStatus.空闲).ToString(); if (locs != null && x.location_code != null && x.location_code != string.Empty) + { x.location_id = locs[x.location_code].ToString() ?? throw new AppFriendlyException($"第{carrys.IndexOf(x) + 1}个数据的库位编号有误", 500); + } + x.out_status = ((int)EnumOutStatus.正常).ToString(); x.is_check = 1; x.create_id = _userManager.UserId; @@ -82,13 +91,13 @@ namespace Tnb.WarehouseMgr }); if (carrys.Count > 1000) { - await _db.Fastest().BulkCopyAsync(carrys); + _ = await _db.Fastest().BulkCopyAsync(carrys); } else if (carrys.Count > 400) { _db.Utilities.PageEach(carrys, 100, async pageList => { - await _db.Insertable(pageList).ExecuteCommandAsync(); + _ = await _db.Insertable(pageList).ExecuteCommandAsync(); }); } else diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs index 9927dad9..9a40cdc6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveInStockService.cs @@ -65,8 +65,8 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = null!; WmsPointH ePoint = null!; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -75,10 +75,14 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } @@ -88,32 +92,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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(); - var ePoint = it.LastOrDefault(); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId!, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -124,31 +134,35 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()! + }; - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!; - handleH.endlocation_id = endLocations![0].id; - handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!; - handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; - handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!; - handleH.require_id = input.data["ReturnIdentity"].ToString(); - handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!, + endlocation_id = endLocations![0].id, + bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!, + carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!, + carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!, + require_id = input.data["ReturnIdentity"].ToString(), + require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //根据载具移入Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, @@ -174,9 +188,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var row = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + int row = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs index 7107f15f..1dd84ca9 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryMoveOutStockService.cs @@ -62,11 +62,13 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //判断目标库位是否自动签收 - var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); - var carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsMoveOutstock.carry_id)].ToString()); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); - + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); + WmsCarryH carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsMoveOutstock.carry_id)].ToString()); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("该载具无法放置到目标库位", 500); + } VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTK_ID, true); await _runService.Create(templateEntity, input); @@ -86,32 +88,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSMOOUTSTK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSMOOUTSTK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -126,19 +134,21 @@ namespace Tnb.WarehouseMgr { preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值 } - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; - preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()!, + PreTaskRecords = preTasks.Adapt>() + }; preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); //根据载具移出Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1 }, @@ -164,9 +174,16 @@ namespace Tnb.WarehouseMgr } public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs index 9845ee8c..3deb0ac0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryQueryService.cs @@ -29,11 +29,15 @@ namespace Tnb.WarehouseMgr public async Task MESCarryQuery(MESCarryQueryInput input) { - if (input.IsNull()) throw new ArgumentNullException("input"); - var data = new List(); + if (input.IsNull()) + { + throw new ArgumentNullException("input"); + } + + List data = new(); try { - var carrys = await _db.Queryable() + List carrys = await _db.Queryable() .InnerJoin((a, b) => a.collocation_scheme_id == b.id) .Where((a, b) => a.carry_code.Contains(input.carry_code) || b.bill_name.Contains(input.collocation_scheme_name)) .ToListAsync(); @@ -56,18 +60,26 @@ namespace Tnb.WarehouseMgr //[NonUnify] public async Task MESCarryQueryResult(MESCarryQueryResultInput input) { - if (input.IsNull()) throw new ArgumentNullException("input"); - var data = new CarryQueryOutput(); + if (input.IsNull()) + { + throw new ArgumentNullException("input"); + } + + CarryQueryOutput data = new(); try { - var carry = await _db.Queryable().FirstAsync(a => a.carry_code == input.carry_code && a.status == 1); - if (carry.IsNull()) throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在或被禁用", 500); - var mCarryIdDic = await _db.Queryable().Where(it => it.carry_id == carry.id).ToDictionaryAsync(x => x.membercarry_id, x => x.membercarry_code); + WmsCarryH carry = await _db.Queryable().FirstAsync(a => a.carry_code == input.carry_code && a.status == 1); + if (carry.IsNull()) + { + throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在或被禁用", 500); + } + + Dictionary mCarryIdDic = await _db.Queryable().Where(it => it.carry_id == carry.id).ToDictionaryAsync(x => x.membercarry_id, x => x.membercarry_code); Expression> whereExp = carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic.Keys?.Count > 0 ? a => mCarryIdDic.Keys.Contains(a.carry_id) : a => a.carry_id == carry.id; - var carryCodes = await _db.Queryable().InnerJoin((a, b) => a.carry_id == b.id).LeftJoin((a, b, c) => a.carry_id == c.carry_id) + List carryCodes = await _db.Queryable().InnerJoin((a, b) => a.carry_id == b.id).LeftJoin((a, b, c) => a.carry_id == c.carry_id) .Where(whereExp) .Select((a, b, c) => new WmsCarryCode { @@ -78,9 +90,13 @@ namespace Tnb.WarehouseMgr if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic?.Count > 0) { - if (carryCodes.Count < mCarryIdDic.Keys?.Count) throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500); - var i = 0; - foreach (var (_, v) in mCarryIdDic) + if (carryCodes.Count < mCarryIdDic.Keys?.Count) + { + throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500); + } + + int i = 0; + foreach ((string _, object v) in mCarryIdDic) { carryCodes[i].member_carrycode = v?.ToString() ?? string.Empty; i++; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index 923c5e3a..70cfa3ac 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -55,8 +55,12 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task GetCarryInfoById([FromRoute] string carryId) { - var carryOutPut = await _db.Queryable().Where(it => it.id == carryId).Select().FirstAsync(); - if (carryOutPut == null) throw new AppFriendlyException("找不到载具", 500); + CarryInfoOutput carryOutPut = await _db.Queryable().Where(it => it.id == carryId).Select().FirstAsync(); + if (carryOutPut == null) + { + throw new AppFriendlyException("找不到载具", 500); + } + carryOutPut.carryDetails = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); carryOutPut.carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); carryOutPut.carryMats = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); @@ -80,15 +84,15 @@ namespace Tnb.WarehouseMgr { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); - var oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : ""; - var oldCarry = await _db.Queryable().FirstAsync(it => it.id == oldCarryId); - var newCarry = await _db.Queryable().FirstAsync(it => it.id == newCarryId); + string? oldCarryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + string? newCarryId = input.data.ContainsKey("newcarry_id") ? input.data["newcarry_id"]?.ToString() : ""; + WmsCarryH? oldCarry = await _db.Queryable().FirstAsync(it => it.id == oldCarryId); + WmsCarryH? newCarry = await _db.Queryable().FirstAsync(it => it.id == newCarryId); if (oldCarry != null && newCarry != null) { ExChangeCarryInput carryInput = new() { old_carry_id = oldCarry.id, new_carry_id = newCarry.id }; @@ -110,7 +114,7 @@ namespace Tnb.WarehouseMgr newCarry.source_code = oldCarry.source_code; newCarry.create_id = _userManager.UserId; newCarry.create_time = DateTime.Now; - var row = await _db.Updateable(newCarry).ExecuteCommandAsync(); + int row = await _db.Updateable(newCarry).ExecuteCommandAsync(); WmsCarryReplaceH wmsCarryReplaceH = oldCarry.Adapt(); wmsCarryReplaceH.id = SnowflakeIdHelper.NextId(); wmsCarryReplaceH.org_id = _userManager.User.OrganizeId; @@ -125,8 +129,11 @@ namespace Tnb.WarehouseMgr wmsCarryReplaceH.modify_time = null; row = await _db.Insertable(wmsCarryReplaceH).ExecuteCommandAsync(); row = await await UpdateNullCarry(oldCarry); - isOk = (row > 0); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + isOk = row > 0; + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } else { @@ -154,7 +161,7 @@ namespace Tnb.WarehouseMgr [NonAction] public async Task> UpdateNullCarry(WmsCarryH carryObj, Func>? updateTask = null) { - var row = 1; + int row = 1; Task resTask = Task.FromResult(row); try { @@ -173,11 +180,11 @@ namespace Tnb.WarehouseMgr resTask = updateTask?.Invoke(carryObj) ?? _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync(); //*****删除对应明细表 //删除载具明细 - await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); + _ = await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); //删除载具分拣物料明细 - await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); + _ = await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); //删除载具条码 - await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); + _ = await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); } catch (Exception ex) { @@ -192,8 +199,8 @@ namespace Tnb.WarehouseMgr private async Task _updateSubCarry(ExChangeCarryInput input) where T : BaseEntity, IWmsCarryEntity, new() { - var row = -1; - var items = await _db.Queryable().Where(it => it.carry_id == input.old_carry_id).ToListAsync(); + int row = -1; + List items = await _db.Queryable().Where(it => it.carry_id == input.old_carry_id).ToListAsync(); if (items?.Count > 0) { List newItems = DeepCopyHelper.DeepCopyList(items); @@ -212,7 +219,7 @@ namespace Tnb.WarehouseMgr row = await _db.Deleteable(items).ExecuteCommandAsync(); } } - return (row > 0); + return row > 0; } /// @@ -221,7 +228,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] - public async Task BarCodePrint(List barCodes) + public new void BarCodePrint(List barCodes) { base.BarCodePrint(barCodes); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs index e68c5c3c..34923f99 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryUnbindService.cs @@ -40,7 +40,7 @@ namespace Tnb.WarehouseMgr } private async Task CarryUnbind(VisualDevModelDataCrInput input) { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); @@ -48,16 +48,20 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBIND_ID, true); await _runService.Create(templateEntity, input); - if (input == null) throw new ArgumentNullException(nameof(input)); - var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; - var carry = await _db.Queryable().FirstAsync(it => it.id == carryId); - var subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + string? carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + string? subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; + WmsCarryH? carry = await _db.Queryable().FirstAsync(it => it.id == carryId); + WmsCarryH? subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId); //WmsCarryunbindH wmsCarryUnbindH = carry.Adapt(); if (carry != null && subCarry != null) { - var row = await _db.Deleteable().Where(it => it.carry_id == carryId && it.membercarry_id == subCarryId).ExecuteCommandAsync(); - var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); + int row = await _db.Deleteable().Where(it => it.carry_id == carryId && it.membercarry_id == subCarryId).ExecuteCommandAsync(); + List items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); //更新载具解绑记录条码表 WmsCarryunbindCode wmsCarryUnbindCode = new(); for (int i = 0; i < items.Count; i++) @@ -82,8 +86,11 @@ namespace Tnb.WarehouseMgr row = await _db.Updateable(carry).ExecuteCommandAsync(); subCarry!.carry_status = ((int)EnumCarryStatus.空闲).ToString(); row = await _db.Updateable(subCarry).ExecuteCommandAsync(); - isOk = (row > 0); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + isOk = row > 0; + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs index 7b74d59b..3b02b958 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs @@ -54,33 +54,38 @@ namespace Tnb.WarehouseMgr private async Task Create(VisualDevModelDataCrInput input) { - var row = 1; - if (input == null) throw new ArgumentNullException(nameof(input)); + int row = 1; + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + try { await _db.Ado.BeginTranAsync(); if (input.data?.Count > 0) { - var checkType = input.data[nameof(WmsCheckstockH.checkstock_type)]?.ToString(); + string? checkType = input.data[nameof(WmsCheckstockH.checkstock_type)]?.ToString(); if (!checkType.IsNullOrEmpty()) { - var billStatus = new List + List billStatus = new() { WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID, WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID, }; - var filter = Expressionable.Create() + Expression> filter = Expressionable.Create() .And((a, b) => b.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString()) .And((a, b) => b.is_type == ((int)EnumLocationType.存储库位).ToString()) .And((a, b) => !billStatus.Contains(a.status)) .ToExpression(); - var queryTasks = new List>>(); - - queryTasks.Add(Task.Run(() => FetchDisTasks((a, b) => a.startlocation_id == b.id, filter))); - queryTasks.Add(Task.Run(() => FetchDisTasks((a, b) => a.endlocation_id == b.id, filter))); - var disTasks = await Task.WhenAll(queryTasks); + List>> queryTasks = new() + { + Task.Run(() => FetchDisTasks((a, b) => a.startlocation_id == b.id, filter)), + Task.Run(() => FetchDisTasks((a, b) => a.endlocation_id == b.id, filter)) + }; + List[] disTasks = await Task.WhenAll(queryTasks); if (disTasks?.Length > 0) { throw new AppFriendlyException("该仓库还有未完成的任务,不允许盘点!", 500); @@ -97,10 +102,10 @@ namespace Tnb.WarehouseMgr .Select() .ToListAsync(); carryCodes ??= Enumerable.Empty().ToList(); - var checkStockDs = carryCodes.Adapt>(); + List? checkStockDs = carryCodes.Adapt>(); var prQtyDic = checkStockDs.GroupBy(g => new { g.carry_id, g.material_id, g.code_batch }).ToDictionary(x => x.Key, x => x.Sum(d => d.codeqty)); - foreach (var (k, v) in prQtyDic) + foreach ((object k, decimal v) in prQtyDic) { WmsCheckstockD? checkstockD = checkStockDs?.Find(x => string.Equals(k, $"{x.carry_id}{x.material_id}{x.code_batch}")); if (checkstockD != null) @@ -112,7 +117,7 @@ namespace Tnb.WarehouseMgr details.Add(checkstockD); } } - await _db.Insertable(details).ExecuteCommandAsync(); + _ = await _db.Insertable(details).ExecuteCommandAsync(); break; case EnumCheckType.物料盘点: break; @@ -122,32 +127,36 @@ namespace Tnb.WarehouseMgr //生成预任务信息 if (details.Count > 0 && carryCodes.Count > 0) { - var locTypes = new[] { ((int)EnumLocationType.出库库位).ToString(), ((int)EnumLocationType.出入库位).ToString() }; - var endLocs = await _db.Queryable().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToArrayAsync(); - var randomIndex = new Random().Next(0, endLocs.GetUpperBound(0)); - var carrys = await _db.Queryable().Where(it => carryCodes.Select(x => x.carry_id).Distinct().Contains(it.id)).ToListAsync(); - var curDetails = details.DistinctBy(x => x.carry_id).ToList(); - var curCarryCodes = carryCodes.FindAll(x => curDetails.Select(d => d.carry_id).Contains(x.carry_id)); + string[] locTypes = new[] { ((int)EnumLocationType.出库库位).ToString(), ((int)EnumLocationType.出入库位).ToString() }; + BasLocation[] endLocs = await _db.Queryable().Where(it => it.wh_id == input.data[nameof(WmsCheckstockH.warehouse_id)].ToString() && locTypes.Contains(it.is_type)).ToArrayAsync(); + int randomIndex = new Random().Next(0, endLocs.GetUpperBound(0)); + List carrys = await _db.Queryable().Where(it => carryCodes.Select(x => x.carry_id).Distinct().Contains(it.id)).ToListAsync(); + List curDetails = details.DistinctBy(x => x.carry_id).ToList(); + List curCarryCodes = carryCodes.FindAll(x => curDetails.Select(d => d.carry_id).Contains(x.carry_id)); if (curCarryCodes.Count > 0) { List preTasks = new(); List locIds = new(); - foreach (var item in carrys) + foreach (WmsCarryH item in carrys) { WmsPointH? sPoint = await _db.Queryable().FirstAsync(it => it.location_id == item.location_id); WmsPointH? ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocs[randomIndex].id); if (sPoint != null && ePoint != null) { - var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id); + + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); if (points?.Count > 0) { locIds.AddRange(points.Select(x => x.location_id).ToList()!); - var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -182,10 +191,10 @@ namespace Tnb.WarehouseMgr } } List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH pt in preTasks) { - var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); - var curPreTaskCodes = partCodes.Adapt>(); + List partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + List curPreTaskCodes = partCodes.Adapt>(); curPreTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -194,13 +203,15 @@ namespace Tnb.WarehouseMgr }); pretaskCodes.AddRange(curPreTaskCodes); } - var isOk = await _warehouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _warehouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { - await _db.Updateable().SetColumns(it => it.status == ((int)EnumCheckStatus.盘点中).ToString()).ExecuteCommandAsync(); - GenPreTaskUpInput genPreTaskAfterUpInput = new(); - genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); - genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); + _ = await _db.Updateable().SetColumns(it => it.status == ((int)EnumCheckStatus.盘点中).ToString()).ExecuteCommandAsync(); + GenPreTaskUpInput genPreTaskAfterUpInput = new() + { + CarryIds = preTasks.Select(x => x.carry_id).ToList(), + LocationIds = new HashSet(locIds).ToList() + }; await _warehouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs index 5da01d2b..ac892e0b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs @@ -57,7 +57,7 @@ namespace Tnb.WarehouseMgr } if (!materialCode.IsNullOrEmpty() && seq > 0) { - var item = await _repository.GetFirstAsync(it => it.material_code == materialCode && it.seq == seq); + WmsCollocationSchemeH item = await _repository.GetFirstAsync(it => it.material_code == materialCode && it.seq == seq); if (item != null) { throw new AppFriendlyException($"物料+顺序【{materialCode}{seq}】,在数据库中已存在", 500); @@ -83,7 +83,11 @@ namespace Tnb.WarehouseMgr //[NonUnify] public async Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input) { - if (input.IsNull()) throw new ArgumentNullException("input"); + if (input.IsNull()) + { + throw new ArgumentNullException("input"); + } + SqlSugarPagedList pageData = new(); try { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs index c74c9049..37d9f22b 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDeliveryService.cs @@ -75,8 +75,8 @@ namespace Tnb.WarehouseMgr .Where(a => a.id == carryId) .Select((a, b) => new { - carry_code = a.carry_code, - location_code = b.location_code, + a.carry_code, + b.location_code, }) .ToListAsync(); return items; @@ -97,12 +97,15 @@ namespace Tnb.WarehouseMgr { endLocationId = input.data[nameof(WmsDelivery.endlocation_id)]?.ToString()!; } - var locIds = new[] { startLocationId, endLocationId }; - var locs = await _basLocationService.GetLocationInfobyIds(locIds); + string[] locIds = new[] { startLocationId, endLocationId }; + List locs = await _basLocationService.GetLocationInfobyIds(locIds); if (locs?.Count > 0) { - var isStoreLoc = locs.Where(x => !x.IsNullOrEmpty()).Select(x => x.is_type.ParseToInt()).Any(x => x == (int)EnumLocationType.存储库位); - if (isStoreLoc) throw new AppFriendlyException("起始库位不能为存储库位", 500); + bool isStoreLoc = locs.Where(x => !x.IsNullOrEmpty()).Select(x => x.is_type.ParseToInt()).Any(x => x == (int)EnumLocationType.存储库位); + if (isStoreLoc) + { + throw new AppFriendlyException("起始库位不能为存储库位", 500); + } } VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSDELIVERY_ID, true); await _runService.Create(templateEntity, input); @@ -121,35 +124,41 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); Log.Information($"经过的所有点位编码:{Environment.NewLine}{string.Join("\r\n", points.Select(x => x.point_code))}"); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } + + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); Log.Information("ePoint?.point_code=" + ePoint?.point_code); - WmsPretaskH preTask = new(); - preTask.org_id = _userManager.User.OrganizeId; - preTask.startlocation_id = sPoint?.location_id!; - preTask.startlocation_code = sPoint?.location_code!; - preTask.startpoint_code = sPoint?.point_code; - preTask.endpoint_code = ePoint?.point_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 = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID; + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + startpoint_code = sPoint?.point_code, + endpoint_code = ePoint?.point_code, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -160,16 +169,16 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.startlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null) { //查询库位表 - var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); + BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); { //载具加锁,增加库位信息 - await _db.Updateable().SetColumns(it => new WmsCarryH + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), is_lock = 1, @@ -179,10 +188,10 @@ namespace Tnb.WarehouseMgr } //所有库位加锁 - var ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() }; - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); + string?[] ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() }; + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); } - await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); } } @@ -203,9 +212,16 @@ namespace Tnb.WarehouseMgr } public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs index f088232c..0127a490 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsDistaskService.cs @@ -22,16 +22,16 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - var disTask = await _db.Queryable().SingleAsync(it => it.id == id); + WmsDistaskH disTask = await _db.Queryable().SingleAsync(it => it.id == id); if (disTask != null) { - var preTask = await _db.Queryable().SingleAsync(it => it.id == disTask.pretask_id); + WmsPretaskH preTask = await _db.Queryable().SingleAsync(it => it.id == disTask.pretask_id); if (preTask != null) { preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - await _db.Updateable(preTask).UpdateColumns(it => it.status).ExecuteCommandAsync(); + _ = await _db.Updateable(preTask).UpdateColumns(it => it.status).ExecuteCommandAsync(); } - await _db.Deleteable(disTask).ExecuteCommandAsync(); + _ = await _db.Deleteable(disTask).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs index 46e7c6fd..93815023 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyInstockService.cs @@ -67,8 +67,8 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //入库取终点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH? sPoint = null; WmsPointH? ePoint = null; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -77,10 +77,14 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } @@ -90,32 +94,37 @@ 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); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) else { - var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -126,33 +135,37 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; - preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()!, + PreTaskRecords = preTasks.Adapt>() + }; preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!; - handleH.endlocation_id = endLocations![0].id; - handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!; - handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; - handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!; - handleH.require_id = input.data["ReturnIdentity"].ToString(); - handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!, + endlocation_id = endLocations![0].id, + bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!, + carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!, + carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!, + require_id = input.data["ReturnIdentity"].ToString(), + require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //根据空载具入库Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, @@ -194,32 +207,38 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task MesEmptyCarryInStock(MESEmptyCarryInStockInput input) { - var isSuccessful = false; - if (input.IsNull()) throw new ArgumentNullException("input"); + bool isSuccessful = false; + if (input.IsNull()) + { + throw new ArgumentNullException("input"); + } + try { - var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); - var loc = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code); - var emptyInstock = await _db.Queryable().FirstAsync(it => it.carry_code == input.carry_code && it.status == WmsWareHouseConst.BILLSTATUS_ADD_ID); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code); + WmsEmptyInstock emptyInstock = await _db.Queryable().FirstAsync(it => it.carry_code == input.carry_code && it.status == WmsWareHouseConst.BILLSTATUS_ADD_ID); if (emptyInstock != null) { return isSuccessful; } if (carry != null && loc != null) { - var cols = new List(); - var dic = new Dictionary(); - dic[nameof(WmsEmptyInstock.id)] = SnowflakeIdHelper.NextId(); - dic[nameof(WmsEmptyInstock.org_id)] = input.org_id ?? _userManager.User.OrganizeId; - dic[nameof(WmsEmptyInstock.location_id)] = loc.id; - dic[nameof(WmsEmptyInstock.bill_code)] = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYINSTK_ENCODE); - dic[nameof(WmsEmptyInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID; - dic[nameof(WmsEmptyInstock.carry_id)] = carry.id; - dic[nameof(WmsEmptyInstock.carry_code)] = input.carry_code!; - dic[nameof(WmsEmptyInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID; - dic[nameof(WmsEmptyInstock.create_id)] = input.create_id ?? _userManager.UserId; - dic[nameof(WmsEmptyInstock.create_time)] = DateTime.Now; - dic[nameof(WmsEmptyInstock.warehouse_id)] = input.warehouse_id!; + List cols = new(); + Dictionary dic = new() + { + [nameof(WmsEmptyInstock.id)] = SnowflakeIdHelper.NextId(), + [nameof(WmsEmptyInstock.org_id)] = input.org_id ?? _userManager.User.OrganizeId, + [nameof(WmsEmptyInstock.location_id)] = loc.id, + [nameof(WmsEmptyInstock.bill_code)] = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_EMPTYINSTK_ENCODE), + [nameof(WmsEmptyInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID, + [nameof(WmsEmptyInstock.carry_id)] = carry.id, + [nameof(WmsEmptyInstock.carry_code)] = input.carry_code!, + [nameof(WmsEmptyInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID, + [nameof(WmsEmptyInstock.create_id)] = input.create_id ?? _userManager.UserId, + [nameof(WmsEmptyInstock.create_time)] = DateTime.Now, + [nameof(WmsEmptyInstock.warehouse_id)] = input.warehouse_id! + }; VisualDevModelDataCrInput visualDevModelDataCrInput = new() { @@ -229,7 +248,7 @@ namespace Tnb.WarehouseMgr isSuccessful = true; } } - catch (Exception ex) + catch (Exception) { await _db.Ado.RollbackTranAsync(); //return await ToApiResult(JNPF.Common.Enums.HttpStatusCode.InternalServerError, ex.Message); @@ -237,11 +256,18 @@ namespace Tnb.WarehouseMgr return isSuccessful; } - public async override Task ModifyAsync(WareHouseUpInput input) + public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs index fcbc3b89..3f81c037 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsEmptyOutstockService .cs @@ -71,15 +71,15 @@ namespace Tnb.WarehouseMgr var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(), Size = 1 }; var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);*/ //判断目标库位是否自动签收 - var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); //出库取起点,获取所有符合输入的载具规格的载具 - var OutStockStrategyInput = new OutStockStrategyQuery + OutStockStrategyQuery OutStockStrategyInput = new() { carrystd_id = input.data[nameof(OutStockStrategyQuery.carrystd_id)].ToString(), warehouse_id = input.data[nameof(OutStockStrategyQuery.warehouse_id)].ToString(), }; - var carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); + List? carrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); //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 == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0 && b.is_type == ((int)EnumLocationType.存储库位).ToString()) @@ -87,9 +87,12 @@ namespace Tnb.WarehouseMgr // 判断最终目标库位是否可以放置当前载具 if (carrys?.Count > 0) { - var curCarry = carrys[^carrys.Count]; - var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + WmsCarryH curCarry = carrys[^carrys.Count]; + bool isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, loc); + if (!isMatch) + { + throw new AppFriendlyException("该载具无法放置到目标库位", 500); + } VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSEMPTYOUTSTK_ID, true); await _runService.Create(templateEntity, input); @@ -97,7 +100,7 @@ namespace Tnb.WarehouseMgr } - var setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); + WmsEmptyOutstockH setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); WmsPointH? sPoint = null; WmsPointH? ePoint = null; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -112,18 +115,21 @@ namespace Tnb.WarehouseMgr { sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[i].location_id); - var isOk = false; + bool isOk = false; if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) else { - var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -186,11 +192,11 @@ namespace Tnb.WarehouseMgr create_id = _userManager.UserId, create_time = DateTime.Now }; - await _db.Insertable(wmsEmptyOutstockD) + _ = await _db.Insertable(wmsEmptyOutstockD) .ExecuteCommandAsync(); //根据空载具出库Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); @@ -217,23 +223,30 @@ namespace Tnb.WarehouseMgr return Task.FromResult(true); } - public async override Task ModifyAsync(WareHouseUpInput input) + public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + try { await _db.Ado.BeginTranAsync(); //根据载具更新明细表状态 - var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync(); + bool isOk = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync(); - var emptyCarrys = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + List emptyCarrys = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); // 判断所有明细是否都完成 if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { isOk = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); } - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } await _db.Ado.CommitTranAsync(); } @@ -252,10 +265,14 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task MESEmptyCarryOutStk(MESEmptyCarryOutStkInput input) { - if (input.IsNull()) throw new ArgumentNullException("input"); + if (input.IsNull()) + { + throw new ArgumentNullException("input"); + } + try { - var location = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString()) ?? throw new AppFriendlyException("无此库位或为存储库位", 500); + BasLocation location = await _db.Queryable().SingleAsync(it => it.location_code == input.location_code && it.is_type != EnumLocationType.存储库位.ToString()) ?? throw new AppFriendlyException("无此库位或为存储库位", 500); Dictionary dic = new() { [nameof(WmsEmptyOutstockH.id)] = SnowflakeIdHelper.NextId(), @@ -270,7 +287,7 @@ namespace Tnb.WarehouseMgr [nameof(WmsEmptyOutstockH.create_time)] = DateTime.Now }; - VisualDevModelDataCrInput visualDevModelDataCrInput = new VisualDevModelDataCrInput + VisualDevModelDataCrInput visualDevModelDataCrInput = new() { data = dic, }; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs index a2879510..098f8871 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsFeedingService.cs @@ -16,7 +16,7 @@ namespace Tnb.WarehouseMgr public class WmsFeedingService : BaseWareHouseService, IWmsFeedingService { private readonly ISqlSugarClient _db; - private static Dictionary dicMaterial = new Dictionary(); + private static Dictionary dicMaterial = new(); public WmsFeedingService(ISqlSugarRepository repository) { _db = repository.AsSugarClient(); @@ -33,15 +33,15 @@ namespace Tnb.WarehouseMgr { dicMaterial = await _db.Queryable().ToDictionaryAsync(x => x.id, x => x.name); } - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == carryId); List carryMIds = new(); if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID) { - var carryDs = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); + List carryDs = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); carryMIds = carryDs.Select(x => x.membercarry_id).ToList(); } Expression> whereExp = carryMIds?.Count > 0 ? a => carryMIds.Contains(a.carry_id) : a => a.carry_id == carryId; - var items = await _db.Queryable().Where(whereExp) + List items = await _db.Queryable().Where(whereExp) .Select() .Mapper(it => it.material_name = (it.material_id != null && dicMaterial.ContainsKey(it.material_id)) ? dicMaterial[it.material_id].ToString() : "") .ToListAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs index 672ba305..2ba47b1c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockPoliciesService.cs @@ -7,6 +7,6 @@ namespace Tnb.WarehouseMgr /// public class WmsInStockPoliciesService : BaseWareHouseService { - private readonly ISqlSugarClient _db; + private readonly ISqlSugarClient? _db; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index c5b62f54..90845eb4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -63,8 +63,8 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task GetInStockDetailsListById([FromRoute] string billId) { - var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID); - var items = await _db.Queryable().LeftJoin((a, b) => a.warehouse_id == b.id) + Dictionary dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID); + List items = await _db.Queryable().LeftJoin((a, b) => a.warehouse_id == b.id) .Select((a, b) => new WmsInstockD { warehouse_name = b.whname @@ -88,8 +88,16 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task BarCodePrint(BarCodePrintInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - if (input.BillIds == null || input.BillIds.Count == 0) throw new ArgumentException($"parameter {nameof(input.BillIds)} not be null or zero"); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + if (input.BillIds == null || input.BillIds.Count == 0) + { + throw new ArgumentException($"parameter {nameof(input.BillIds)} not be null or zero"); + } + try { await _db.Ado.BeginTranAsync(); @@ -99,37 +107,33 @@ namespace Tnb.WarehouseMgr _dicBillCodes = await _db.Queryable().ToDictionaryAsync(x => x.id, x => x.bill_code); } - var inStockDetails = await _db.Queryable().Where(it => input.BillIds.Contains(it.bill_id)).ToListAsync(); + List inStockDetails = await _db.Queryable().Where(it => input.BillIds.Contains(it.bill_id)).ToListAsync(); if (inStockDetails?.Count > 0) { List wmsTempCodes = new(); for (int i = 0; i < inStockDetails.Count; i++) { - if (inStockDetails[i] is null) continue; - var minPacking = (await _db.Queryable().FirstAsync(it => it.id == inStockDetails[i].material_id))?.minpacking; - var codeNum = 0; + if (inStockDetails[i] is null) + { + continue; + } + + decimal? minPacking = (await _db.Queryable().FirstAsync(it => it.id == inStockDetails[i].material_id))?.minpacking; + int codeNum = 0; if (inStockDetails[i].pr_qty.HasValue && minPacking.HasValue && minPacking.Value > 0) { - var mod = (int)(inStockDetails[i].pr_qty!.Value % minPacking.Value); - codeNum = (int)(mod > 0 ? inStockDetails[i].pr_qty!.Value / minPacking.Value + 1 : inStockDetails[i].pr_qty!.Value / minPacking.Value); + int mod = (int)(inStockDetails[i].pr_qty!.Value % minPacking.Value); + codeNum = (int)(mod > 0 ? (inStockDetails[i].pr_qty!.Value / minPacking.Value) + 1 : inStockDetails[i].pr_qty!.Value / minPacking.Value); if (inStockDetails[i].pr_qty!.Value > minPacking.Value) { for (int j = 0; j < codeNum; j++) { - var index = j + 1; + int index = j + 1; WmsTempCode barCode = await CreateInstock(inStockDetails[i], index); if (minPacking.HasValue) { - if (index < codeNum) - { - barCode.codeqty = minPacking; - } - else - { - if (mod > 0) barCode.codeqty = mod; - else barCode.codeqty = minPacking; - } + barCode.codeqty = index < codeNum ? minPacking : mod > 0 ? mod : minPacking; } wmsTempCodes.Add(barCode); } @@ -147,10 +151,10 @@ namespace Tnb.WarehouseMgr wmsTempCodes.Add(barCode); } } - var row = await _db.Insertable(wmsTempCodes).ExecuteCommandAsync(); + int row = await _db.Insertable(wmsTempCodes).ExecuteCommandAsync(); if (row > 0) { - await _db.Updateable().SetColumns(it => new WmsInstockH { print_status = WmsWareHouseConst.BARCODE_PRINT_STATUS_COMPLETE_ID }).Where(it => input.BillIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockH { print_status = WmsWareHouseConst.BARCODE_PRINT_STATUS_COMPLETE_ID }).Where(it => input.BillIds.Contains(it.id)).ExecuteCommandAsync(); } } @@ -164,7 +168,7 @@ namespace Tnb.WarehouseMgr private Task CreateInstock(WmsInstockD detail, int no) { - var code = $"{detail.material_code}{detail.code_batch}{no.ToString().PadLeft(4, '0')}"; + string code = $"{detail.material_code}{detail.code_batch}{no.ToString().PadLeft(4, '0')}"; WmsTempCode barCode = new() { org_id = detail.org_id, @@ -187,7 +191,10 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } //更具distaskCode的barcode 更新 instockcode 的 is_end 为 1 try { @@ -195,18 +202,18 @@ namespace Tnb.WarehouseMgr if (input.distaskCodes?.Count > 0) { - var barCodes = input.distaskCodes.Select(x => x.barcode); - await _db.Updateable().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync(); + IEnumerable barCodes = input.distaskCodes.Select(x => x.barcode); + _ = await _db.Updateable().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync(); var instockCodes = await _db.Queryable().Where(it => barCodes.Contains(it.barcode)).Select(it => new { id = it.bill_d_id, barcode_qty = it.codeqty, }).ToListAsync(); - var dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList()); - var ids = instockCodes.Select(it => it.id).ToList(); - var instockDetails = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); + Dictionary> dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList()); + List ids = instockCodes.Select(it => it.id).ToList(); + List instockDetails = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); - foreach (var item in instockDetails) + foreach (WmsInstockD item in instockDetails) { if (dic.ContainsKey(item.id)) { @@ -217,18 +224,22 @@ namespace Tnb.WarehouseMgr } } } - await _db.Updateable(instockDetails).ExecuteCommandAsync(); - var instock = await _db.Queryable().SingleAsync(it => it.id == input.requireId); - if (instock.IsNull()) ArgumentNullException.ThrowIfNull(nameof(instock)); + _ = await _db.Updateable(instockDetails).ExecuteCommandAsync(); + WmsInstockH instock = await _db.Queryable().SingleAsync(it => it.id == input.requireId); + if (instock.IsNull()) + { + ArgumentNullException.ThrowIfNull(nameof(instock)); + } + if (instock.sync_status != WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC) { //如果是自动单据,需要回更上层系统 Dictionary pars = new() { { nameof(WmsInstockH.source_id), instock?.source_id ?? string.Empty } }; - var callBackRes = await _prdInstockService.SyncInstock(pars); + dynamic callBackRes = await _prdInstockService.SyncInstock(pars); instock!.sync_status = callBackRes == true ? WmsWareHouseConst.SYNC_STATUS__SYNCCOMPLETE : WmsWareHouseConst.SYNC_STATUS__SYNCFAILED; - await _db.Updateable(instock).UpdateColumns(it => it.sync_status).ExecuteCommandAsync(); + _ = await _db.Updateable(instock).UpdateColumns(it => it.sync_status).ExecuteCommandAsync(); } - var allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + List allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { instock.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; @@ -238,7 +249,7 @@ namespace Tnb.WarehouseMgr //任务没有结束,更新状态为工作中 instock.status = WmsWareHouseConst.BILLSTATUS_ON_ID; } - await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync(); + _ = await _db.Updateable(instock).UpdateColumns(it => it.status).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); @@ -258,7 +269,7 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task MESCreateInstock(MESCreateInstockInput input) { - var isSuccessFul = false; + bool isSuccessFul = false; try { await _db.Ado.BeginTranAsync(); @@ -270,15 +281,18 @@ namespace Tnb.WarehouseMgr List instockcodes = input.instockcodes.Adapt>(); //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = instock?.warehouse_id!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = instock?.warehouse_id!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = await _db.Queryable().FirstAsync(it => it.location_code == input.instock.location_code); WmsPointH ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); - var carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.instock.carry_code); - var loc = await _db.Queryable().FirstAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.instock.carry_code); + BasLocation loc = await _db.Queryable().FirstAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } loc = await _db.Queryable().FirstAsync(it => it.location_code == input.instock.location_code && it.is_type != EnumLocationType.存储库位.ToString()); @@ -299,9 +313,9 @@ namespace Tnb.WarehouseMgr instock.print_status = WmsWareHouseConst.PRINT_STATUS_PRINTCOMPLETE;//已打印 instock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增 instock.create_time = DateTime.Now; - await _db.Insertable(instock).ExecuteCommandAsync(); + _ = await _db.Insertable(instock).ExecuteCommandAsync(); //明细表 - foreach (var instockd in instockds!) + foreach (WmsInstockD instockd in instockds!) { instockd.id = SnowflakeIdHelper.NextId(); instockd.bill_id = instock.id; @@ -310,19 +324,19 @@ namespace Tnb.WarehouseMgr instock.create_time = instock.create_time; instock.create_id = instock.create_id; } - await _db.Insertable(instockds).ExecuteCommandAsync(); - var items = instockds.Adapt>(); + _ = await _db.Insertable(instockds).ExecuteCommandAsync(); + List items = instockds.Adapt>(); List instockCOdes = new(); //条码表 - foreach (var instockcode in instockcodes!) + foreach (WmsInstockCode instockcode in instockcodes!) { instockcode.id = SnowflakeIdHelper.NextId(); - var materialCode = instockcode.material_code; - var codeBatch = instockcode.code_batch; - var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch); + string materialCode = instockcode.material_code; + string? codeBatch = instockcode.code_batch; + WmsInstockCode? b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch); if (b != null) { - var c = DeepCopyHelper.DeepCopy(b); + WmsInstockCode c = DeepCopyHelper.DeepCopy(b); c.id = SnowflakeIdHelper.NextId(); c.bill_d_id = instockds?.Find(x => x.material_code == materialCode && x.code_batch == codeBatch)?.id ?? ""; c.barcode = instockcode.barcode; @@ -333,22 +347,26 @@ namespace Tnb.WarehouseMgr instockCOdes.Add(c); } } - var orgId = _userManager.User.OrganizeId; - await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); + string orgId = _userManager.User.OrganizeId; + _ = await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); //生成预任务申请 if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } + + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -376,13 +394,13 @@ namespace Tnb.WarehouseMgr }).ToList(); //生成预任务条码信息 List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH? pt in preTasks) { if (instockCOdes.Count > 0) { - foreach (var jo in instockCOdes) + foreach (WmsInstockCode jo in instockCOdes) { - var ptc = pt.Adapt(); + WmsPretaskCode ptc = pt.Adapt(); ptc.id = SnowflakeIdHelper.NextId(); ptc.bill_id = pt.id; ptc.material_id = jo.material_id; @@ -397,7 +415,7 @@ namespace Tnb.WarehouseMgr } //生成预任务,同时如果包含条码信息同时插入条码记录 - var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { @@ -411,10 +429,10 @@ namespace Tnb.WarehouseMgr }; //创建预任务操作记录 - var operBillId = string.Empty; + string operBillId = string.Empty; if (instock != null) { - var handleH = instock.Adapt(); + WmsHandleH handleH = instock.Adapt(); operBillId = handleH.id = SnowflakeIdHelper.NextId(); handleH.startlocation_id = instock.location_id!; handleH.carry_id = instock.carry_id!; @@ -424,7 +442,7 @@ namespace Tnb.WarehouseMgr //创建预任务条码操作记录 if (instockcodes?.Count > 0) { - foreach (var jo in instockcodes) + foreach (WmsInstockCode jo in instockcodes) { WmsHandleCode handleCode = jo.Adapt(); handleCode.id = SnowflakeIdHelper.NextId(); @@ -436,7 +454,7 @@ namespace Tnb.WarehouseMgr } } //生成载具条码记录 - var carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt>(); + List carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt>(); carryCodes.ForEach(x => { @@ -445,14 +463,14 @@ namespace Tnb.WarehouseMgr x.carry_id = instock!.carry_id!; x.warehouse_id = instock!.warehouse_id!; }); - await _db.Insertable(carryCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(carryCodes).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() }); if (instockCOdes?.Count > 0) { - await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync(); } isSuccessFul = true; } @@ -482,9 +500,17 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task MesFetchInOutStockInfoByBarCode(MaterialLabelQuery input) { - if (input.IsNull()) new ArgumentException(nameof(input)); - if (input.barcode?.Count < 1) new ArgumentException(nameof(input.barcode)); - var pagedList = await _db.Queryable().InnerJoin((a, b) => a.id == b.bill_id) + if (input.IsNull()) + { + _ = new ArgumentException(nameof(input)); + } + + if (input.barcode?.Count < 1) + { + _ = new ArgumentException(nameof(input.barcode)); + } + + SqlSugarPagedList pagedList = await _db.Queryable().InnerJoin((a, b) => a.id == b.bill_id) .LeftJoin((a, b, c) => b.barcode == c.barcode) .WhereIF(!string.IsNullOrEmpty(input.org_id), (a, b, c) => a.org_id == input.org_id) .Where((a, b, c) => input.barcode.Contains(b.barcode)) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs index a1ad04ac..6b2cf63a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsKittingInStkService.cs @@ -67,8 +67,8 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH? sPoint = null; WmsPointH? ePoint = null; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -77,10 +77,14 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } @@ -89,32 +93,37 @@ 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); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -137,10 +146,10 @@ namespace Tnb.WarehouseMgr } List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH? pt in preTasks) { - var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); - var curPreTaskCodes = partCodes.Adapt>(); + List partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + List curPreTaskCodes = partCodes.Adapt>(); curPreTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -149,33 +158,37 @@ namespace Tnb.WarehouseMgr }); pretaskCodes.AddRange(curPreTaskCodes); } - var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()! + }; - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!; - handleH.endlocation_id = endLocations![0].id; - handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!; - handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; - handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!; - handleH.require_id = input.data["ReturnIdentity"].ToString(); - handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!, + endlocation_id = endLocations![0].id, + bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!, + carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!, + carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!, + require_id = input.data["ReturnIdentity"].ToString(), + require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //根据齐套入库Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); - var status = ((int)EnumCarryStatus.齐套).ToString(); - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsHandleH.carry_id)].ToString()); + _ = await _db.Updateable().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + string status = ((int)EnumCarryStatus.齐套).ToString(); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsHandleH.carry_id)].ToString()); if (carry?.out_status != status) { if (carryCodes?.Count > 0) @@ -188,7 +201,7 @@ namespace Tnb.WarehouseMgr x.create_time = DateTime.Now; x.warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!; }); - await _db.Insertable(carryCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(carryCodes).ExecuteCommandAsync(); } } await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, @@ -222,32 +235,33 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var row = await _db.Updateable().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); - var kittingIn = await _db.Queryable().SingleAsync(it => it.id == input.requireId); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + int row = await _db.Updateable().SetColumns(it => new WmsKittingInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + WmsKittingInstock kittingIn = await _db.Queryable().SingleAsync(it => it.id == input.requireId); if (kittingIn != null) { - var kittingOut = await _db.Queryable().SingleAsync(it => it.id == kittingIn.source_id); + WmsKittingoutH kittingOut = await _db.Queryable().SingleAsync(it => it.id == kittingIn.source_id); if (kittingOut != null) { - var locaion = await _db.Queryable().SingleAsync(it => it.id == kittingOut.location_id); - if (locaion != null && locaion.is_type.ToEnum() != EnumLocationType.存储库位) - { - kittingOut.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID; - - } - else - { - kittingOut.status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; - } + BasLocation locaion = await _db.Queryable().SingleAsync(it => it.id == kittingOut.location_id); + kittingOut.status = locaion != null && locaion.is_type.ToEnum() != EnumLocationType.存储库位 + ? WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID + : WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; kittingOut.carry_id = kittingIn.carry_id; kittingOut.carry_code = kittingIn.carry_code; - await _db.Updateable(kittingOut).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync(); + _ = await _db.Updateable(kittingOut).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync(); await Publish(nameof(IWmskittingOutService.KittingOutByIsToBeShipped)); } } - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs index e941f909..96650617 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutBaleService.cs @@ -64,10 +64,13 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - var carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + WmsCarryH carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("该载具无法放置到目标库位", 500); + } VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSOUTBALE_ID, true); await _runService.Create(templateEntity, input); @@ -86,32 +89,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTBALE_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTBALE_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -128,19 +137,21 @@ namespace Tnb.WarehouseMgr { preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值 } - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; - preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()!, + PreTaskRecords = preTasks.Adapt>() + }; preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); //根据载具移出Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1 }, @@ -166,18 +177,24 @@ namespace Tnb.WarehouseMgr } public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } try { await _db.Ado.BeginTranAsync(); - var isOk = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - var carryId = input.carryIds[^input.carryIds.Count]; - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); - var row = await _wmsCarryService.UpdateNullCarry(carry).Unwrap(); + bool isOk = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + string carryId = input.carryIds[^input.carryIds.Count]; + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + int row = await _wmsCarryService.UpdateNullCarry(carry).Unwrap(); isOk = row > 0; - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } await _db.Ado.CommitTranAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 95959b54..97a69412 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -92,10 +92,10 @@ namespace Tnb.WarehouseMgr * 2.1 根据这些库位去查任务执行 目的库位是这些库位的未完成任务数。 A 10 B 9 * 2.2 哪个最少给哪个 */ - var org = await _db.Queryable().FirstAsync(it => it.Id == input.data[nameof(WmsOutstockH.station_id)].ToString()); + OrganizeEntity? org = await _db.Queryable().FirstAsync(it => it.Id == input.data[nameof(WmsOutstockH.station_id)].ToString()); if (!org?.FeedingLocationId.IsNullOrWhiteSpace() ?? false) { - var fLocIds = JArray.Parse(org.FeedingLocationId).Values().ToList(); + List fLocIds = JArray.Parse(org.FeedingLocationId).Values().ToList(); var minTaskNumLocs = await _db.Queryable().Where(it => it.status != WmsWareHouseConst.PRETASK_BILL_STATUS_COMPLE_ID && fLocIds.Contains(it.endlocation_id)) .GroupBy(it => it.endlocation_id) .Select(it => new @@ -108,21 +108,21 @@ namespace Tnb.WarehouseMgr .ToListAsync(); if (minTaskNumLocs?.Count > 0) { - var freeLocIds = fLocIds.Except(minTaskNumLocs.Select(x => x.endlocation_id)).ToList(); + List freeLocIds = fLocIds.Except(minTaskNumLocs.Select(x => x.endlocation_id)).ToList(); if (freeLocIds?.Count > 0) { - var rIdx = new Random().Next(0, freeLocIds.Count); + int rIdx = new Random().Next(0, freeLocIds.Count); loc = await _db.Queryable().SingleAsync(it => it.id == freeLocIds[rIdx]); } else { - var firstLocId = minTaskNumLocs.FirstOrDefault().endlocation_id; + string firstLocId = minTaskNumLocs.FirstOrDefault().endlocation_id; loc = await _db.Queryable().SingleAsync(it => it.id == firstLocId); } } else if (minTaskNumLocs?.Count < 1) { - var rIdx = new Random().Next(0, fLocIds.Count); + int rIdx = new Random().Next(0, fLocIds.Count); loc = await _db.Queryable().SingleAsync(it => it.id == fLocIds[rIdx]); } input.data[nameof(WmsOutstockH.location_id)] = loc.id; @@ -130,26 +130,26 @@ namespace Tnb.WarehouseMgr } - var carryIds = new List(); + List carryIds = new(); //tablefield120 出库物料明细 if (input.data.ContainsKey("tablefield120") && input.data["tablefield120"].IsNotEmptyOrNull()) { - var outStockDList = input.data["tablefield120"].ToObject>(); + List outStockDList = input.data["tablefield120"].ToObject>(); if (outStockDList?.Count > 0) { List carryMats = new(); List carryCodes = new(); List carryCodesPart = new(); - foreach (var os in outStockDList) + foreach (WmsOutstockD os in outStockDList) { - var OutStockStrategyInput = new OutStockStrategyQuery + OutStockStrategyQuery OutStockStrategyInput = new() { carry_id = input.data[nameof(OutStockStrategyQuery.carry_id)]?.ToString() ?? string.Empty, warehouse_id = input.data[nameof(WmsOutstockH.warehouse_id)]?.ToString() ?? string.Empty, material_id = os.material_id, code_batch = os.code_batch, }; - var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); + List outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); Expression> whereExp = input.data.ContainsKey(nameof(WmsOutstockH.carry_id)) && input.data[nameof(WmsOutstockH.carry_id)].IsNotEmptyOrNull() ? (a, b) => a.id == input.data[nameof(WmsOutstockH.carry_id)].ToString() : (a, b) => outStkCarrys.Select(x => x.id).Contains(b.carry_id); @@ -163,7 +163,7 @@ namespace Tnb.WarehouseMgr if (carryCodesPart?.Count > 0) { - var codeQty = carryCodesPart.Sum(x => x.codeqty); + decimal codeQty = carryCodesPart.Sum(x => x.codeqty); if (codeQty < os.pr_qty) { throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500); @@ -185,7 +185,7 @@ namespace Tnb.WarehouseMgr } } carryCodes.AddRange(curCarryCodes); - var partCarryMats = curCarryCodes.Adapt>(); + List partCarryMats = curCarryCodes.Adapt>(); for (int i = 0; i < partCarryMats.Count; i++) { partCarryMats[i].need_qty = curCarryCodes[i].codeqty; @@ -199,19 +199,19 @@ namespace Tnb.WarehouseMgr carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch }) .Select(x => { - var arr = x.ToArray(); + WmsCarryMat[] arr = x.ToArray(); WmsCarryMat carryMat = arr[^arr.Length]; carryMat.need_qty = x.Sum(d => d.need_qty); return carryMat; }) .ToList(); - await _db.Insertable(carryMats).ExecuteCommandAsync(); - var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty); - var allOutIds = new List(); - var sortingOutIds = new List(); - foreach (var pair in dic) + _ = await _db.Insertable(carryMats).ExecuteCommandAsync(); + Dictionary dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty); + List allOutIds = new(); + List sortingOutIds = new(); + foreach (KeyValuePair pair in dic) { - var codes = carryCodesPart.FindAll(x => x.carry_id == pair.Key); + List codes = carryCodesPart.FindAll(x => x.carry_id == pair.Key); if (codes?.Count > 0) { if (pair.Value == codes.Sum(d => d.codeqty)) @@ -225,18 +225,18 @@ namespace Tnb.WarehouseMgr } } carryIds = allOutIds.Concat(sortingOutIds).ToList(); - var carryH = new WmsCarryH + WmsCarryH carryH = new() { out_status = ((int)EnumOutStatus.全部出).ToString(), source_id = input.data.ContainsKey(nameof(WmsOutstockH.source_id)) ? input.data[nameof(WmsOutstockH.source_id)]?.ToString() ?? string.Empty : string.Empty, source_code = input.data.ContainsKey(nameof(WmsOutstockH.source_code)) ? input.data[nameof(WmsOutstockH.source_code)]?.ToString() ?? string.Empty : string.Empty, }; - await _db.Updateable(carryH) + _ = await _db.Updateable(carryH) .UpdateColumns(it => new { it.out_status, it.source_id, it.source_code }) .Where(it => allOutIds.Contains(it.id)) .ExecuteCommandAsync(); carryH.out_status = ((int)EnumOutStatus.分拣出).ToString(); - await _db.Updateable(carryH) + _ = await _db.Updateable(carryH) .UpdateColumns(it => new { it.out_status, it.source_id, it.source_code }) .Where(it => sortingOutIds.Contains(it.id)) .ExecuteCommandAsync(); @@ -244,7 +244,7 @@ namespace Tnb.WarehouseMgr - var carrys = await _db.Queryable().Where(it => carryIds.Contains(it.id)).ToListAsync(); + List carrys = await _db.Queryable().Where(it => carryIds.Contains(it.id)).ToListAsync(); if (carrys?.Count > 0) { @@ -254,10 +254,13 @@ namespace Tnb.WarehouseMgr List preTasks = new(); List locIds = new(); - foreach (var carry in carrys) + foreach (WmsCarryH carry in carrys) { - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("该载具无法放置到目标库位", 500); + } WmsPointH sPoint = null!; WmsPointH ePoint = null!; @@ -272,16 +275,20 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); locIds.AddRange(points.Select(x => x.location_id).ToList()!); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); - var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + if (points.Count <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } + + List curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -321,10 +328,10 @@ namespace Tnb.WarehouseMgr } } List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH pt in preTasks) { - var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); - var curPreTaskCodes = partCodes.Adapt>(); + List partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + List curPreTaskCodes = partCodes.Adapt>(); curPreTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -333,24 +340,30 @@ namespace Tnb.WarehouseMgr }); pretaskCodes.AddRange(curPreTaskCodes); } - var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { outStockDList.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID); - await _db.Updateable(outStockDList).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); + _ = await _db.Updateable(outStockDList).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); - GenPreTaskUpInput genPreTaskAfterUpInput = new(); - genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); - genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); + GenPreTaskUpInput genPreTaskAfterUpInput = new() + { + CarryIds = preTasks.Select(x => x.carry_id).ToList(), + LocationIds = new HashSet(locIds).ToList() + }; await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); } } - else throw new AppFriendlyException("库存不足", 500); + else + { + throw new AppFriendlyException("库存不足", 500); + } + } + else + { + throw new AppFriendlyException($"请输入物料明细", 500); } - else throw new AppFriendlyException($"请输入物料明细", 500); - - } await _db.Ado.CommitTranAsync(); @@ -369,7 +382,7 @@ namespace Tnb.WarehouseMgr } - public async Task PrintTest(List barCodes) + public dynamic? PrintTest(List barCodes) { // open port. int nLen, ret, sw; @@ -378,7 +391,7 @@ namespace Tnb.WarehouseMgr IntPtr ver; System.Text.Encoding encAscII = System.Text.Encoding.ASCII; - System.Text.Encoding encUnicode = System.Text.Encoding.Unicode; + _ = System.Text.Encoding.Unicode; // dll version. ver = PPLBUtility.B_Get_DLL_Version(0); @@ -393,8 +406,8 @@ namespace Tnb.WarehouseMgr int len1 = 128, len2 = 128; buf1 = new byte[len1]; buf2 = new byte[len2]; - PPLBUtility.B_EnumUSB(pbuf); - PPLBUtility.B_GetUSBDeviceInfo(1, buf1, out len1, buf2, out len2); + _ = PPLBUtility.B_EnumUSB(pbuf); + _ = PPLBUtility.B_GetUSBDeviceInfo(1, buf1, out len1, buf2, out len2); sw = 1; if (1 == sw) { @@ -406,62 +419,61 @@ namespace Tnb.WarehouseMgr } if (0 != ret) { - strmsg += "Open USB fail!"; } else { strmsg += "Open USB:\r\nDevice name: "; strmsg += encAscII.GetString(buf1, 0, len1); strmsg += "\r\nDevice path: "; - strmsg += encAscII.GetString(buf2, 0, len2); + _ = encAscII.GetString(buf2, 0, len2); //sw = 2; if (2 == sw) { //Immediate Error Report. - PPLBUtility.B_WriteData(1, encAscII.GetBytes("^ee\r\n"), 5);//^ee + _ = PPLBUtility.B_WriteData(1, encAscII.GetBytes("^ee\r\n"), 5);//^ee ret = PPLBUtility.B_ReadData(pbuf, 4, 1000); } } } else { - System.IO.Directory.CreateDirectory(PPLBUtility.szSavePath); + _ = System.IO.Directory.CreateDirectory(PPLBUtility.szSavePath); ret = PPLBUtility.B_CreatePrn(0, PPLBUtility.szSaveFile);// open file. strmsg += "Open "; strmsg += PPLBUtility.szSaveFile; if (0 != ret) { - strmsg += " file fail!"; } else { - strmsg += " file succeed!"; } } if (0 != ret) + { return null; + } // sample setting. //B_Set_DebugDialog(1); //var sznop2 = "测试"; //var sznop1 = "测试2"; - PPLBUtility.B_Set_Originpoint(0, 0); - PPLBUtility.B_Select_Option(2); - PPLBUtility.B_Set_Darkness(8); - PPLBUtility.B_Del_Pcx("*");// delete all picture. + _ = PPLBUtility.B_Set_Originpoint(0, 0); + _ = PPLBUtility.B_Select_Option(2); + _ = PPLBUtility.B_Set_Darkness(8); + _ = PPLBUtility.B_Del_Pcx("*");// delete all picture. //PPLBUtility.B_WriteData(0, encAscII.GetBytes(sznop2), sznop2.Length); //PPLBUtility.B_WriteData(1, encAscII.GetBytes(sznop1), sznop1.Length); //When using standard label, and the printer is Intelli Print mode or Smart Print mode, //When calling this function and giving the correct label information, //the immediate print function will be enabled according to the label length setting. - PPLBUtility.B_Set_LabelForSmartPrint(254 * 3, 30);//label information: length= 3 * 25.4 mm, gap= 3 mm. + _ = PPLBUtility.B_Set_LabelForSmartPrint(254 * 3, 30);//label information: length= 3 * 25.4 mm, gap= 3 mm. //draw box. //PPLBUtility.B_Draw_Box(20, 20, 4, 760, 560); //PPLBUtility.B_Draw_Line('O', 400, 20, 4, 540); //print text, true type text. - PPLBUtility.B_Prn_Text(250, 50, 0, 2, 2, 2, 'N', "PPLB Lib Example"); + _ = PPLBUtility.B_Prn_Text(250, 50, 0, 2, 2, 2, 'N', "PPLB Lib Example"); //PPLBUtility.B_Prn_Text_TrueType(30, 100, 30, "Arial", 1, 400, 0, 0, 0, "AA", "TrueType Font");//save in printer. //PPLBUtility.B_Prn_Text_TrueType_W(30, 160, 20, 20, "Times New Roman", 1, 400, 0, 0, 0, "AB", "TT_W: 多字元測試"); //PPLBUtility.B_Prn_Text_TrueType_Uni(30, 220, 30, "Times New Roman", 1, 400, 0, 0, 0, "AC", Encoding.Unicode.GetBytes("TT_Uni: 多字元測試"), 1);//UTF-16 @@ -470,12 +482,12 @@ namespace Tnb.WarehouseMgr //encUnicode.GetBytes("\x0000", 0, 1, pbuf, 30);//null.//pbuf[30]=0x00,pbuf[31]=0x00; //PPLBUtility.B_Prn_Text_TrueType_UniB(30, 280, 30, "Times New Roman", 1, 400, 0, 0, 0, "AD", pbuf, 0);//Byte Order Mark. - var labelWth = 800; - var barcodeWth = 508; - var x = (labelWth - barcodeWth) / 2; + int labelWth = 800; + int barcodeWth = 508; + _ = (labelWth - barcodeWth) / 2; //barcode. - PPLBUtility.B_Prn_Barcode(150, 100, 0, "E80", 8, 500, 70, 'N', "1234<+10>");//have a counter + _ = PPLBUtility.B_Prn_Barcode(150, 100, 0, "E80", 8, 500, 70, 'N', "1234<+10>");//have a counter //PPLBUtility.B_Bar2d_QR(420, 200, 1, 3, 'M', 'A', 0, 0, 0, "QR CODE"); //picture. @@ -487,7 +499,7 @@ namespace Tnb.WarehouseMgr // DeleteObject(himage); // output. - PPLBUtility.B_Print_Out(1);// copy 2. + _ = PPLBUtility.B_Print_Out(1);// copy 2. // close port. PPLBUtility.B_ClosePrn(); @@ -503,8 +515,8 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task GetInStockDetailsListById([FromRoute] string billId) { - var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID); - var items = await _db.Queryable().Where(it => it.bill_id == billId).ToListAsync(); + Dictionary dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID); + List items = await _db.Queryable().Where(it => it.bill_id == billId).ToListAsync(); _db.ThenMapper(items, it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : ""); return items; @@ -519,7 +531,7 @@ namespace Tnb.WarehouseMgr //[NonUnify] public async Task MESCreateOutstock(MESCreateOutstockInput input) { - var isSuccessful = true; + bool isSuccessful = true; try { await _db.Ado.BeginTranAsync(); @@ -528,7 +540,7 @@ namespace Tnb.WarehouseMgr //出库申请明细表 List outstockDs = input.outstockDs.Adapt>(); - var location = await _db.Queryable().SingleAsync(it => it.location_code == input.outstock.location_code && it.is_type != EnumLocationType.存储库位.ToString()); + BasLocation location = await _db.Queryable().SingleAsync(it => it.location_code == input.outstock.location_code && it.is_type != EnumLocationType.存储库位.ToString()); //如果数据不全或有误, if (location.IsNull() || outstockDs?.Count < 1) { @@ -547,7 +559,7 @@ namespace Tnb.WarehouseMgr outstock.create_time = DateTime.Now; //明细表 - foreach (var outstockD in outstockDs!) + foreach (WmsOutstockD outstockD in outstockDs!) { outstockD.id = SnowflakeIdHelper.NextId(); outstockD.bill_id = outstock.id; @@ -558,16 +570,16 @@ namespace Tnb.WarehouseMgr } //var loc = await _db.Queryable().SingleAsync(it => it.id == outstock.location_id.ToString()); - var carryIds = new List(); + List? carryIds = new(); //tablefield120 出库物料明细 - var outStockDList = outstockDs.ToObject>(); + List outStockDList = outstockDs.ToObject>(); if (outStockDList?.Count > 0) { List carryMats = new(); List carryCodes = new(); - foreach (var os in outStockDList) + foreach (WmsOutstockD os in outStockDList) { - var whereExp = Expressionable.Create() + Expressionable whereExp = Expressionable.Create() .And((a, b, c) => a.is_lock == 0) .And((a, b, c) => !string.IsNullOrEmpty(a.location_id)) .And((a, b, c) => a.status == (int)EnumCarryStatus.占用) @@ -575,13 +587,13 @@ namespace Tnb.WarehouseMgr .And((a, b, c) => b.material_id == os.material_id) .AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch); - var carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) + List carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) .Where(whereExp.ToExpression()) .Select() .ToListAsync(); if (carryCodesPart?.Count > 0) { - var codeQty = carryCodes.Sum(x => x.codeqty); + decimal codeQty = carryCodes.Sum(x => x.codeqty); if (codeQty < os.pr_qty) { throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500); @@ -596,14 +608,14 @@ namespace Tnb.WarehouseMgr } else if (os.pr_qty <= carryCodesPart[i].codeqty) { - var tmp = DeepCopyHelper.DeepCopy(carryCodesPart[i]); + WmsCarryCode tmp = DeepCopyHelper.DeepCopy(carryCodesPart[i]); tmp.codeqty = os.pr_qty; curCarryCodes.Add(tmp); break; } } carryCodes.AddRange(curCarryCodes); - var partCarryMats = curCarryCodes.Adapt>(); + List partCarryMats = curCarryCodes.Adapt>(); for (int i = 0; i < partCarryMats.Count; i++) { partCarryMats[i].need_qty = curCarryCodes[i].codeqty; @@ -617,19 +629,19 @@ namespace Tnb.WarehouseMgr carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch }) .Select(x => { - var arr = x.ToArray(); + WmsCarryMat[] arr = x.ToArray(); WmsCarryMat carryMat = arr[^arr.Length]; carryMat.need_qty = x.Sum(d => d.need_qty); return carryMat; }) .ToList(); - await _db.Insertable(carryMats).ExecuteCommandAsync(); - var dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty); - var allOutIds = new List(); - var sortingOutIds = new List(); - foreach (var pair in dic) + _ = await _db.Insertable(carryMats).ExecuteCommandAsync(); + Dictionary dic = carryMats.DistinctBy(x => x.carry_id).ToDictionary(x => x.carry_id, x => x.need_qty); + List allOutIds = new(); + List sortingOutIds = new(); + foreach (KeyValuePair pair in dic) { - var codes = carryCodes.FindAll(x => x.carry_id == pair.Key); + List codes = carryCodes.FindAll(x => x.carry_id == pair.Key); if (codes?.Count > 0) { if (pair.Value == codes.Sum(d => d.codeqty)) @@ -645,39 +657,46 @@ namespace Tnb.WarehouseMgr carryIds = allOutIds.Concat(sortingOutIds).ToList(); if (carryIds?.Count > 0) { - var carryId = carryIds[^carryIds.Count]; - var curCurry = await _db.Queryable().SingleAsync(it => it.id == carryId); - var isMatch = await IsCarryAndLocationMatchByCarryStd(curCurry, location); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + string carryId = carryIds[^carryIds.Count]; + WmsCarryH curCurry = await _db.Queryable().SingleAsync(it => it.id == carryId); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(curCurry, location); + if (!isMatch) + { + throw new AppFriendlyException("该载具无法放置到目标库位", 500); + } } - await _db.Insertable(outstock).ExecuteCommandAsync(); - await _db.Insertable(outstockDs).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString(), source_id = outstock.source_id, source_code = outstock.source_code }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString(), source_id = outstock.source_id, source_code = outstock.source_code }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Insertable(outstock).ExecuteCommandAsync(); + _ = await _db.Insertable(outstockDs).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString(), source_id = outstock.source_id, source_code = outstock.source_code }).Where(it => allOutIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString(), source_id = outstock.source_id, source_code = outstock.source_code }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync(); } - var carrys = await _db.Queryable().Where(it => carryIds.Contains(it.id)).ToListAsync(); + List carrys = await _db.Queryable().Where(it => carryIds.Contains(it.id)).ToListAsync(); if (carrys?.Count > 0) { List preTasks = new(); List locIds = new(); - foreach (var carry in carrys) + foreach (WmsCarryH carry in carrys) { WmsPointH sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); WmsPointH ePoint = await _db.Queryable().FirstAsync(it => it.location_id == outstock.location_id.ToString()); if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); locIds.AddRange(points.Select(x => x.location_id).ToList()!); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); - var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + if (points.Count <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } + + List curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -716,10 +735,10 @@ namespace Tnb.WarehouseMgr } } List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH pt in preTasks) { - var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); - var curPreTaskCodes = partCodes.Adapt>(); + List partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + List curPreTaskCodes = partCodes.Adapt>(); curPreTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -728,22 +747,30 @@ namespace Tnb.WarehouseMgr }); pretaskCodes.AddRange(curPreTaskCodes); } - var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { outstockDs.ForEach(x => x.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID); - await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == outstock.id).ExecuteCommandAsync(); - GenPreTaskUpInput genPreTaskAfterUpInput = new(); - genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); - genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); + _ = await _db.Updateable(outstockDs).UpdateColumns(it => it.line_status).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == outstock.id).ExecuteCommandAsync(); + GenPreTaskUpInput genPreTaskAfterUpInput = new() + { + CarryIds = preTasks.Select(x => x.carry_id).ToList(), + LocationIds = new HashSet(locIds).ToList() + }; await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); } } - else throw new AppFriendlyException("库存不足", 500); + else + { + throw new AppFriendlyException("库存不足", 500); + } + } + else + { + throw new AppFriendlyException($"请输入物料明细", 500); } - else throw new AppFriendlyException($"请输入物料明细", 500); await _db.Ado.CommitTranAsync(); } @@ -763,29 +790,33 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + try { await _db.Ado.BeginTranAsync(); - var carryId = input.carryIds[^input.carryIds.Count]; - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + string carryId = input.carryIds[^input.carryIds.Count]; + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == carryId); if (carry != null) { - var otds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); - var outStatus = carry.out_status.ToEnum(); + List? otds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + EnumOutStatus outStatus = carry.out_status.ToEnum(); if (outStatus == EnumOutStatus.全部出) { //当前载具对应的所有条码插入 - var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); - var outStockCodes = carryCodes.Adapt>(); + List carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); + List outStockCodes = carryCodes.Adapt>(); outStockCodes.ForEach(x => { - var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; + string? billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; if (billDId.IsNullOrEmpty()) { billDId = otds?.Find(xx => xx.material_id == x.material_id)?.id; @@ -797,47 +828,40 @@ namespace Tnb.WarehouseMgr x.create_id = _userManager.UserId; x.create_time = DateTime.Now; }); - await _db.Insertable(outStockCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(outStockCodes).ExecuteCommandAsync(); - var detailIds = outStockCodes.Select(x => x.bill_d_id).ToList(); - var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id)); - var dic = outStockCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); - foreach (var osd in curOutstockDetails) + List detailIds = outStockCodes.Select(x => x.bill_d_id).ToList(); + List curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id)); + Dictionary> dic = outStockCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); + foreach (WmsOutstockD osd in curOutstockDetails) { if (dic.ContainsKey(osd.id)) { osd.qty += dic[osd.id].Sum(d => d); - if (osd.qty >= osd.pr_qty) - { - osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; - } - else - { - osd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID; - } + osd.line_status = osd.qty >= osd.pr_qty ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ON_ID; } } - await _db.Updateable(curOutstockDetails).ExecuteCommandAsync(); + _ = await _db.Updateable(curOutstockDetails).ExecuteCommandAsync(); if (otds.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { - await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); //如果是自动单据,需要回更上层系统 } else { //如果没有完成,修改为工作中 - await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); } - await _wareCarryService.UpdateNullCarry(carry).Unwrap(); + _ = await _wareCarryService.UpdateNullCarry(carry).Unwrap(); } else if (outStatus == EnumOutStatus.分拣出) { if (input.distaskCodes?.Count > 0) { - var osCodes = input.distaskCodes.Adapt>(); + List osCodes = input.distaskCodes.Adapt>(); osCodes.ForEach(x => { - var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; + string? billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; if (billDId.IsNullOrEmpty()) { billDId = otds?.Find(xx => xx.material_id == x.material_id)?.id; @@ -849,12 +873,12 @@ namespace Tnb.WarehouseMgr x.create_id = _userManager.UserId; x.create_time = DateTime.Now; }); - await _db.Insertable(osCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(osCodes).ExecuteCommandAsync(); // 更新主表 - var detailIds = osCodes.Select(x => x.bill_d_id).ToList(); - var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id)); - var dic = osCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); - foreach (var osd in curOutstockDetails) + List detailIds = osCodes.Select(x => x.bill_d_id).ToList(); + List curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id)); + Dictionary> dic = osCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); + foreach (WmsOutstockD osd in curOutstockDetails) { if (dic.ContainsKey(osd.id)) { @@ -870,23 +894,23 @@ namespace Tnb.WarehouseMgr } } } - await _db.Updateable(curOutstockDetails).ExecuteCommandAsync(); + _ = await _db.Updateable(curOutstockDetails).ExecuteCommandAsync(); if (otds.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { //如果是自动单据,需要回更上层系统 - await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); } else { //如果没有完成,修改为工作中 - await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); } - var carryCodes = await _db.Queryable().Where(it => input.carryIds.Contains(it.carry_id!)).ToListAsync(); - var dicCodeQty = carryCodes.GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.First().codeqty); - var dicUpdate = new Dictionary(); - var delBarcodes = new List(); - foreach (var dtc in input.distaskCodes) + List carryCodes = await _db.Queryable().Where(it => input.carryIds.Contains(it.carry_id!)).ToListAsync(); + Dictionary dicCodeQty = carryCodes.GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.First().codeqty); + Dictionary dicUpdate = new(); + List delBarcodes = new(); + foreach (WmsDistaskCode dtc in input.distaskCodes) { if (dicCodeQty.ContainsKey(dtc.barcode)) { @@ -902,36 +926,38 @@ namespace Tnb.WarehouseMgr } if (dicUpdate.Count > 0) { - foreach (var pair in dicUpdate) + foreach (KeyValuePair pair in dicUpdate) { WmsCarryCode? carryCode = carryCodes.Find(x => x.barcode == pair.Key); if (carryCode != null) { carryCode.codeqty = pair.Value; - await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).ExecuteCommandAsync(); + _ = await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).ExecuteCommandAsync(); } } } if (delBarcodes.Count > 0) { - await _db.Deleteable().Where(it => delBarcodes.Contains(it.barcode)).ExecuteCommandAsync(); + _ = await _db.Deleteable().Where(it => delBarcodes.Contains(it.barcode)).ExecuteCommandAsync(); } - var row = await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync(); - await _db.Deleteable().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync(); + int row = await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Deleteable().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync(); //载具移入 - var outStockH = await _db.Queryable().SingleAsync(it => it.id == input.requireId); - var visulDevInput = new VisualDevModelDataCrInput(); - visulDevInput.data = new Dictionary + WmsOutstockH outStockH = await _db.Queryable().SingleAsync(it => it.id == input.requireId); + VisualDevModelDataCrInput visulDevInput = new() { - [nameof(InStockStrategyQuery.warehouse_id)] = outStockH.warehouse_id, - [nameof(WmsPointH.location_id)] = outStockH.location_id, - [nameof(WmsCarryD.carry_id)] = input.carryIds.First(), - [nameof(WmsCarryH.carry_code)] = carry.carry_code, - [nameof(WmsHandleH.biz_type)] = input.bizTypeId, - [nameof(WmsHandleH.create_id)] = _userManager.UserId, - [nameof(WmsHandleH.create_time)] = DateTime.Now, - [nameof(WmsMoveInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID, - [nameof(WmsHandleH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_CARRYMOINSTK_ENCODE).GetAwaiter().GetResult(), + data = new Dictionary + { + [nameof(InStockStrategyQuery.warehouse_id)] = outStockH.warehouse_id, + [nameof(WmsPointH.location_id)] = outStockH.location_id, + [nameof(WmsCarryD.carry_id)] = input.carryIds.First(), + [nameof(WmsCarryH.carry_code)] = carry.carry_code, + [nameof(WmsHandleH.biz_type)] = input.bizTypeId, + [nameof(WmsHandleH.create_id)] = _userManager.UserId, + [nameof(WmsHandleH.create_time)] = DateTime.Now, + [nameof(WmsMoveInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID, + [nameof(WmsHandleH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_CARRYMOINSTK_ENCODE).GetAwaiter().GetResult(), + } }; await _wmsCarryMoveInStockService.CarryMoveIn(visulDevInput); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs index d7b8e5bc..3f6bf46a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryBindService.cs @@ -42,7 +42,7 @@ namespace Tnb.WarehouseMgr private async Task PDACarryBind(VisualDevModelDataCrInput input) { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); @@ -50,11 +50,15 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYBINDPDA_ID, true); await _runService.Create(templateEntity, input); - if (input == null) throw new ArgumentNullException(nameof(input)); - var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); - var subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + string? carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + string? subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; + WmsCarryH? carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + WmsCarryH? subCarry = await _db.Queryable().SingleAsync(it => it.id == subCarryId); if (carry != null && subCarry != null) { @@ -70,34 +74,39 @@ namespace Tnb.WarehouseMgr create_id = _userManager.UserId, create_time = DateTime.Now }; - var row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync(); + int row = await _db.Insertable(wmsCarryD).ExecuteCommandAsync(); carry!.carry_status = ((int)EnumCarryStatus.占用).ToString(); row = await _db.Updateable(carry).ExecuteCommandAsync(); subCarry.carry_status = ((int)EnumCarryStatus.占用).ToString(); row = await _db.Updateable(subCarry).ExecuteCommandAsync(); - var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); + List items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); //更新载具绑定条码表 for (int i = 0; i < items.Count; i++) { - WmsCarrybindCode wmsCarrybindCode = new(); - wmsCarrybindCode.id = SnowflakeIdHelper.NextId(); - wmsCarrybindCode.org_id = subCarry?.org_id!; - wmsCarrybindCode.carrybind_id = input.data["ReturnIdentity"]?.ToString()!; - wmsCarrybindCode.material_id = items[i].material_id; - wmsCarrybindCode.material_code = items[i].material_code; - wmsCarrybindCode.barcode = items[i].barcode; - wmsCarrybindCode.code_batch = items[i].code_batch; - wmsCarrybindCode.codeqty = items[i].codeqty; - wmsCarrybindCode.membercarry_id = subCarry?.id; - wmsCarrybindCode.membercarry_code = subCarry?.carry_code; - wmsCarrybindCode.unit_id = items[i].unit_id; - wmsCarrybindCode.unit_code = items[i].unit_code; - wmsCarrybindCode.create_id = _userManager.UserId; - wmsCarrybindCode.create_time = DateTime.Now; + WmsCarrybindCode wmsCarrybindCode = new() + { + id = SnowflakeIdHelper.NextId(), + org_id = subCarry?.org_id!, + carrybind_id = input.data["ReturnIdentity"]?.ToString()!, + material_id = items[i].material_id, + material_code = items[i].material_code, + barcode = items[i].barcode, + code_batch = items[i].code_batch, + codeqty = items[i].codeqty, + membercarry_id = subCarry?.id, + membercarry_code = subCarry?.carry_code, + unit_id = items[i].unit_id, + unit_code = items[i].unit_code, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; row = await _db.Insertable(wmsCarrybindCode).ExecuteCommandAsync(); } - isOk = (row > 0); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + isOk = row > 0; + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs index acc6e8c4..1a1e654a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveInStockService.cs @@ -164,8 +164,8 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = null!; WmsPointH ePoint = null!; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -174,10 +174,14 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } @@ -188,32 +192,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId!, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -224,31 +234,35 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()! + }; - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!; - handleH.endlocation_id = endLocations![0].id; - handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!; - handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; - handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!; - handleH.require_id = input.data["ReturnIdentity"].ToString(); - handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!, + endlocation_id = endLocations![0].id, + bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!, + carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!, + carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!, + require_id = input.data["ReturnIdentity"].ToString(), + require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //根据载具移入Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, @@ -275,9 +289,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsMoveInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs index c5df2aa5..772b119c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryMoveOutStockService.cs @@ -62,10 +62,13 @@ namespace Tnb.WarehouseMgr { await _db.Ado.BeginTranAsync(); - var carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsMoveOutstock.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + WmsCarryH carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsMoveOutstock.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("该载具无法放置到目标库位", 500); + } VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYMOOUTSTKPDA_ID, true); await _runService.Create(templateEntity, input); @@ -82,33 +85,39 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSMOOUTSTK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSMOOUTSTK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -124,20 +133,22 @@ namespace Tnb.WarehouseMgr { preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值 } - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()!, - preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + PreTaskRecords = preTasks.Adapt>() + }; preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); //根据载具移出Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, @@ -162,9 +173,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsMoveOutstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs index 21564566..9c7c9473 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDACarryUnbindService .cs @@ -40,7 +40,7 @@ namespace Tnb.WarehouseMgr } private async Task PDACarryUnbind(VisualDevModelDataCrInput input) { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); @@ -48,15 +48,19 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSCARRYUNBINDPDA_ID, true); await _runService.Create(templateEntity, input); - if (input == null) throw new ArgumentNullException(nameof(input)); - var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; - var carry = await _db.Queryable().FirstAsync(it => it.id == carryId); - var subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + string? carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + string? subCarryId = input.data.ContainsKey("membercarry_id") ? input.data["membercarry_id"]?.ToString() : ""; + WmsCarryH? carry = await _db.Queryable().FirstAsync(it => it.id == carryId); + WmsCarryH? subCarry = await _db.Queryable().FirstAsync(it => it.id == subCarryId); if (carry != null && subCarry != null) { - var row = await _db.Deleteable().Where(it => it.carry_id == carryId && it.membercarry_id == subCarryId).ExecuteCommandAsync(); - var items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); + int row = await _db.Deleteable().Where(it => it.carry_id == carryId && it.membercarry_id == subCarryId).ExecuteCommandAsync(); + List items = await _db.Queryable().Where(it => it.carry_id == subCarryId).ToListAsync(); //更新载具解绑记录 WmsCarryunbindCode wmsCarryUnbindCode = new(); for (int i = 0; i < items.Count; i++) @@ -81,8 +85,11 @@ namespace Tnb.WarehouseMgr row = await _db.Updateable(carry).ExecuteCommandAsync(); subCarry!.carry_status = ((int)EnumCarryStatus.空闲).ToString(); row = await _db.Updateable(subCarry).ExecuteCommandAsync(); - isOk = (row > 0); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + isOk = row > 0; + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs index 69f6921e..24414da1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDADeliveryService.cs @@ -68,8 +68,8 @@ namespace Tnb.WarehouseMgr .Where(a => a.id == carryId) .Select((a, b) => new { - carry_code = a.carry_code, - location_code = b.location_code, + a.carry_code, + b.location_code, }) .ToListAsync(); return items; @@ -90,12 +90,15 @@ namespace Tnb.WarehouseMgr { endLocationId = input.data[nameof(WmsDelivery.endlocation_id)]?.ToString()!; } - var locIds = new[] { startLocationId, endLocationId }; - var locs = await _basLocationService?.GetLocationInfobyIds(locIds)!; + string[] locIds = new[] { startLocationId, endLocationId }; + List locs = await _basLocationService?.GetLocationInfobyIds(locIds)!; if (locs?.Count > 0) { - var isStoreLoc = locs.Where(x => !x.IsNullOrEmpty()).Select(x => x.is_type.ParseToInt()).Any(x => x == (int)EnumLocationType.存储库位); - if (isStoreLoc) throw new AppFriendlyException("起始库位不能为存储库位", 500); + bool isStoreLoc = locs.Where(x => !x.IsNullOrEmpty()).Select(x => x.is_type.ParseToInt()).Any(x => x == (int)EnumLocationType.存储库位); + if (isStoreLoc) + { + throw new AppFriendlyException("起始库位不能为存储库位", 500); + } } VisualDevEntity? templateEntity = await _visualDevService?.GetInfoById(ModuleConsts.MODULE_WMSDELIVERYPDA_ID, true)!; await _runService.Create(templateEntity, input); @@ -114,32 +117,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService!.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService!.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService!.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager!.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService!.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSDELIVERY_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -150,16 +159,16 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { if (input.data.ContainsKey(nameof(WmsDelivery.startlocation_id)) && input.data.ContainsKey(nameof(WmsDelivery.endlocation_id)) && input.data[nameof(WmsDelivery.endlocation_id)] != null && input.data[nameof(WmsDelivery.endlocation_id)] != null) { //查询库位表 - var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); + BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsDelivery.startlocation_id)].ToString()); { //载具加锁,增加库位信息 - await _db.Updateable().SetColumns(it => new WmsCarryH + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), is_lock = 1, @@ -169,8 +178,8 @@ namespace Tnb.WarehouseMgr } //所有库位加锁 - var ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() }; - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); + string?[] ids = new[] { input.data[nameof(WmsDelivery.startlocation_id)].ToString(), input.data[nameof(WmsDelivery.endlocation_id)].ToString() }; + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); } } } @@ -191,9 +200,16 @@ namespace Tnb.WarehouseMgr } public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var row = await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + int row = await _db.Updateable().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs index ecce2711..e25d08b3 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyInstockService.cs @@ -63,8 +63,8 @@ namespace Tnb.WarehouseMgr await _db.Ado.BeginTranAsync(); //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = null!; WmsPointH ePoint = null!; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -73,10 +73,14 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } @@ -85,32 +89,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSEMPTYINSTOCK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -121,32 +131,36 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; - preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()!, + PreTaskRecords = preTasks.Adapt>() + }; preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!; - handleH.endlocation_id = endLocations![0].id; - handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!; - handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; - handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!; - handleH.require_id = input.data["ReturnIdentity"].ToString(); - handleH.require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!, + endlocation_id = endLocations![0].id, + bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!, + carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!, + carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!, + require_id = input.data["ReturnIdentity"].ToString(), + require_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //根据空载具入库Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, it => new BasLocation { is_lock = 1 }); @@ -171,9 +185,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsEmptyInstock { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs index 51381f57..5317bcc1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAEmptyOutstockService .cs @@ -67,11 +67,11 @@ namespace Tnb.WarehouseMgr await _runService.Create(templateEntity, input); //判断目标库位是否自动签收 - var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); //出库取起点,获取所有符合输入的载具规格的载具 - 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) + WmsEmptyOutstockH setQty = await _db.Queryable().FirstAsync(it => it.bill_code == input.data[nameof(WmsEmptyOutstockH.bill_code)].ToString()); + List? 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 == ((int)EnumCarryStatus.空闲).ToString() && a.is_lock == 0 && b.is_lock == 0 && b.is_type == ((int)EnumLocationType.存储库位).ToString()) .ToListAsync(); @@ -83,26 +83,32 @@ namespace Tnb.WarehouseMgr ePoint = await _db.Queryable().FirstAsync(it => it.location_id == input.data[nameof(WmsPointH.location_id)].ToString()); } int i = 0; - var isOk = false; + bool isOk = false; //根据每个载具的起始库位做路径运算 for (i = 0; i < setQty.qty; i++) { if (carrys?.Count > 0) + { sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carrys[i].location_id); + } if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List? points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } + + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); //生成预任务 WmsPretaskH preTask = new() { @@ -165,7 +171,7 @@ namespace Tnb.WarehouseMgr create_id = _userManager.UserId, create_time = DateTime.Now }; - await _db.Insertable(wmsEmptyOutstockD) + _ = await _db.Insertable(wmsEmptyOutstockD) .ExecuteCommandAsync(); //生成操作记录表 @@ -185,7 +191,7 @@ namespace Tnb.WarehouseMgr }; preTaskUpInput.PreTaskRecord = handleH; //根据空载具出库Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, @@ -213,20 +219,27 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } //根据载具更新明细表状态 try { await _db.Ado.BeginTranAsync(); - var isOk = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync(); + bool isOk = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockD { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.bill_id == input.requireId && input.carryIds.Contains(it.carry_id)).ExecuteCommandHasChangeAsync(); - var emptyCarrys = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + List emptyCarrys = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); // 判断所有明细是否都完成 if (emptyCarrys?.Count > 0 && emptyCarrys.All(x => x.status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { - await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsEmptyOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); } - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } + await _db.Ado.CommitTranAsync(); } catch (Exception) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs index 0c64a0ca..93e3db72 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCancelService.cs @@ -49,25 +49,25 @@ namespace Tnb.WarehouseMgr if (input.data.ContainsKey(nameof(WmsDistaskH.bill_code))) { //更新任务执行状态 已取消 - await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID }).Where(it => it.bill_code == input.data[nameof(WmsDistaskH.bill_code)].ToString()).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsDistaskH { status = WmsWareHouseConst.TASK_BILL_STATUS_CANCEL_ID }).Where(it => it.bill_code == input.data[nameof(WmsDistaskH.bill_code)].ToString()).ExecuteCommandAsync(); } if (input.data.ContainsKey(nameof(WmsDistaskH.pretask_id))) { //预任务取消 - await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID }).Where(it => it.id == input.data[nameof(WmsDistaskH.pretask_id)].ToString()).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsPretaskH { status = WmsWareHouseConst.PRETASK_BILL_STATUS_CANCEL_ID }).Where(it => it.id == input.data[nameof(WmsDistaskH.pretask_id)].ToString()).ExecuteCommandAsync(); } if (input.data.ContainsKey(nameof(WmsDistaskH.carry_id))) { //载具解锁 - await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0 }).Where(it => it.id == input.data[nameof(WmsDistaskH.carry_id)].ToString()).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { is_lock = 0 }).Where(it => it.id == input.data[nameof(WmsDistaskH.carry_id)].ToString()).ExecuteCommandAsync(); } if (input.data.ContainsKey(nameof(WmsDistaskH.startlocation_id)) && input.data.ContainsKey(nameof(WmsDistaskH.endlocation_id))) { //所有库位解锁 - var ids = new[] { input.data[nameof(WmsDistaskH.startlocation_id)]?.ToString(), input.data[nameof(WmsDistaskH.endlocation_id)]?.ToString() }; - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 0 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); + string?[] ids = new[] { input.data[nameof(WmsDistaskH.startlocation_id)]?.ToString(), input.data[nameof(WmsDistaskH.endlocation_id)]?.ToString() }; + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 0 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs index 6a260a36..d9b388c1 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionCompleteService.cs @@ -45,7 +45,7 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - var taskCompleUpInput = new TaskCompleUpInput(); + TaskCompleUpInput taskCompleUpInput = new(); List list = new(); if (input.data.ContainsKey(nameof(WmsDistaskH.id))) { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs index 5fa02e04..474d9258 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAExceptionReexcuteService.cs @@ -44,7 +44,7 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - var items = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsDistaskH.id)].ToString()); + WmsDistaskH items = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsDistaskH.id)].ToString()); //items.agreement //获取任务的协议,进行重新下发 await _db.Ado.CommitTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs index 95adfc5b..9d9a9b58 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAFeedingService.cs @@ -57,7 +57,7 @@ namespace Tnb.WarehouseMgr private async Task WmsPDAFeedingRecord(VisualDevModelDataCrInput input) { - var isOk = false; + bool isOk = false; try { await _db.Ado.BeginTranAsync(); @@ -65,12 +65,12 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSFEEDINGRECORDPDA_ID, true); await _runService.Create(templateEntity, input); - var carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; - var feedBoxCode = input.data.ContainsKey("feedbox_code") ? input.data["feedbox_code"]?.ToString() : ""; - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); - 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(); + string? carryId = input.data.ContainsKey("carry_id") ? input.data["carry_id"]?.ToString() : ""; + string? feedBoxCode = input.data.ContainsKey("feedbox_code") ? input.data["feedbox_code"]?.ToString() : ""; + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + WmsFeedbox? feedBox = await _db.Queryable().SingleAsync(it => it.feedbox_code == feedBoxCode); + WmsCarryMat? carryMaterial = await _db.Queryable().FirstAsync(it => it.carry_id == carryId); + List carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); if (carryMaterial != null && feedBox != null && carry != null) { //更新投料箱 @@ -80,7 +80,7 @@ namespace Tnb.WarehouseMgr feedBox.batch = carryMaterial?.code_batch!; feedBox.modify_id = _userManager.UserId; feedBox.modify_time = DateTime.Now; - var row = await _db.Updateable(feedBox) + int row = await _db.Updateable(feedBox) .UpdateColumns(it => new { it.material_id, @@ -92,8 +92,11 @@ namespace Tnb.WarehouseMgr }).ExecuteCommandAsync(); //更新载具 row = await _carryService.UpdateNullCarry(carry).Unwrap(); - isOk = (row > 0); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + isOk = row > 0; + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs index 560da974..b3071f86 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInStockService.cs @@ -75,8 +75,8 @@ namespace Tnb.WarehouseMgr } //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = null!; WmsPointH ePoint = null!; if (input.data.ContainsKey(nameof(WmsHandleH.startlocation_id))) @@ -85,24 +85,32 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List? points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) - if (points?.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); + if (points?.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } + if (points?.Count > 0) { - var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -137,13 +145,13 @@ namespace Tnb.WarehouseMgr }).ToList(); //生成预任务条码信息 List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH? pt in preTasks) { if (jArr?.Children().Count() > 0) { - foreach (var jo in jArr.Children()) + foreach (JToken jo in jArr.Children()) { - var ptc = pt.Adapt(); + WmsPretaskCode ptc = pt.Adapt(); ptc.id = SnowflakeIdHelper.NextId(); ptc.bill_id = pt.id; ptc.material_id = jo.Value(nameof(WmsPretaskCode.material_id))!; @@ -158,25 +166,27 @@ namespace Tnb.WarehouseMgr } //生成预任务,同时如果包含条码信息同时插入条码记录 - var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { - var requireIdField = "require_id"; + string requireIdField = "require_id"; - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data[nameof(WmsHandleH.require_id)].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data[nameof(WmsHandleH.require_id)].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()! + }; if (input.data.ContainsKey(requireIdField) && input.data[requireIdField].IsNotEmptyOrNull()) { //创建预任务操作记录 - var operBillId = string.Empty; - var instockH = await _db.Queryable().FirstAsync(it => it.id == input.data[requireIdField].ToString()); + string operBillId = string.Empty; + WmsInstockH instockH = await _db.Queryable().FirstAsync(it => it.id == input.data[requireIdField].ToString()); if (instockH != null) { - var handleH = instockH.Adapt(); + WmsHandleH handleH = instockH.Adapt(); operBillId = handleH.id = SnowflakeIdHelper.NextId(); handleH.startlocation_id = input.data[nameof(WmsHandleH.startlocation_id)]?.ToString()!; handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; @@ -187,25 +197,27 @@ namespace Tnb.WarehouseMgr jArr = JArray.Parse(input.data["tablefield115"].ToString()!); if (jArr?.Children().Count() > 0) { - foreach (var jo in jArr.Children()) + foreach (JToken jo in jArr.Children()) { - var materialId = jo.Value(nameof(WmsHandleCode.material_id)); - WmsHandleCode handleCode = new(); - handleCode.org_id = _userManager.User.OrganizeId; - handleCode.bill_id = operBillId; - handleCode.material_id = materialId!; - handleCode.material_code = jo.Value(nameof(WmsHandleCode.material_code))!; - handleCode.barcode = jo.Value(nameof(WmsHandleCode.barcode))!; - handleCode.code_batch = jo.Value(nameof(WmsHandleCode.code_batch)); - handleCode.codeqty = jo.Value(nameof(WmsHandleCode.codeqty)); - handleCode.unit_id = _db.Queryable().Single(it => it.id == materialId).unit_id; - handleCode.create_id = _userManager.UserId; - handleCode.create_time = DateTime.Now; + string? materialId = jo.Value(nameof(WmsHandleCode.material_id)); + WmsHandleCode handleCode = new() + { + org_id = _userManager.User.OrganizeId, + bill_id = operBillId, + material_id = materialId!, + material_code = jo.Value(nameof(WmsHandleCode.material_code))!, + barcode = jo.Value(nameof(WmsHandleCode.barcode))!, + code_batch = jo.Value(nameof(WmsHandleCode.code_batch)), + codeqty = jo.Value(nameof(WmsHandleCode.codeqty)), + unit_id = _db.Queryable().Single(it => it.id == materialId).unit_id, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskHandleCodes.Add(handleCode); } } //生成载具条码记录 - var carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt>(); + List carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt>(); carryCodes.ForEach(x => { @@ -215,25 +227,25 @@ namespace Tnb.WarehouseMgr x.warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString(); }); //生成入库申请条码 - var instockDetails = await _db.Queryable() + List instockDetails = await _db.Queryable() .Where(b => b.bill_id == input.data[requireIdField].ToString()) .ToListAsync(); - var items = instockDetails.Adapt>(); + List items = instockDetails.Adapt>(); //items.ForEach(it => it.org_id = _userManager.User.OrganizeId); List instockCOdes = new(); jArr = JArray.Parse(input.data["tablefield115"].ToString()!); if (jArr?.Children().Count() > 0) { - foreach (var jo in jArr.Children()) + foreach (JToken jo in jArr.Children()) { - var materialCode = jo.Value(nameof(WmsInstockCode.material_code)); - var codeBatch = jo.Value(nameof(WmsInstockCode.code_batch)); - var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch); + string? materialCode = jo.Value(nameof(WmsInstockCode.material_code)); + string? codeBatch = jo.Value(nameof(WmsInstockCode.code_batch)); + WmsInstockCode? b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch); if (b != null) { - var c = DeepCopyHelper.DeepCopy(b); + WmsInstockCode c = DeepCopyHelper.DeepCopy(b); c.id = SnowflakeIdHelper.NextId(); c.bill_d_id = b.id; c.barcode = jo.Value(nameof(WmsInstockCode.barcode))!; @@ -242,18 +254,18 @@ namespace Tnb.WarehouseMgr } } } - var orgId = _userManager.User.OrganizeId; - await _db.Insertable(carryCodes).ExecuteCommandAsync(); - await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); + string orgId = _userManager.User.OrganizeId; + _ = await _db.Insertable(carryCodes).ExecuteCommandAsync(); + _ = await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); // 更新临时条码表 状态is_end - await _db.Updateable().SetColumns(it => new WmsTempCode { is_end = 1 }).Where(it => instockCOdes.Select(x => x.barcode).Contains(it.barcode)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsTempCode { is_end = 1 }).Where(it => instockCOdes.Select(x => x.barcode).Contains(it.barcode)).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, source_id = input.data[nameof(WmsOutstockH.source_id)].ToString(), source_code = input.data[nameof(WmsOutstockH.source_code)].ToString() }, it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() }); if (instockCOdes?.Count > 0) { - await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data[nameof(WmsHandleH.require_id)].ToString()).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data[nameof(WmsHandleH.require_id)].ToString()).ExecuteCommandAsync(); } } } @@ -276,7 +288,10 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException("input"); + if (input == null) + { + throw new ArgumentNullException("input"); + } //更具distaskCode的barcode 更新 instockcode 的 is_end 为 1 try { @@ -284,18 +299,18 @@ namespace Tnb.WarehouseMgr if (input.distaskCodes?.Count > 0) { - var barCodes = input.distaskCodes.Select(x => x.barcode); - await _db.Updateable().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync(); + IEnumerable barCodes = input.distaskCodes.Select(x => x.barcode); + _ = await _db.Updateable().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync(); var instockCodes = await _db.Queryable().Where(it => barCodes.Contains(it.barcode)).Select(it => new { id = it.bill_d_id, barcode_qty = it.codeqty, }).ToListAsync(); - var dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList()); - var ids = instockCodes.Select(it => it.id).ToList(); - var instockDetails = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); + Dictionary> dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList()); + List ids = instockCodes.Select(it => it.id).ToList(); + List instockDetails = await _db.Queryable().Where(it => ids.Contains(it.id)).ToListAsync(); - foreach (var item in instockDetails) + foreach (WmsInstockD item in instockDetails) { if (dic.ContainsKey(item.id)) { @@ -306,11 +321,11 @@ namespace Tnb.WarehouseMgr } } } - await _db.Updateable(instockDetails).ExecuteCommandAsync(); - var allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + _ = await _db.Updateable(instockDetails).ExecuteCommandAsync(); + List allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { - await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); //如果是自动单据,需要回更上层系统 } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs index 48aa70fa..9f5ff757 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAInbaleService.cs @@ -64,9 +64,9 @@ namespace Tnb.WarehouseMgr //VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSINBALEINSTKPDA_ID, true); //await _runService.Create(templateEntity, input); //入库取终点 //出库起点 - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; - var inbaleItem = await _db.Queryable().SingleAsync(it => it.bill_code == input.data[nameof(WmsInbale.bill_code)].ToString()); - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = input.data[nameof(InStockStrategyQuery.warehouse_id)].ToString()!, Size = 1 }; + WmsInbale inbaleItem = await _db.Queryable().SingleAsync(it => it.bill_code == input.data[nameof(WmsInbale.bill_code)].ToString()); + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH? sPoint = null; WmsPointH? ePoint = null; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -75,41 +75,51 @@ namespace Tnb.WarehouseMgr } if (endLocations?.Count > 0) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); - var loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsCarryD.carry_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, loc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSINBALE_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSINBALE_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -120,33 +130,37 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = inbaleItem.id; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = inbaleItem.id, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()! + }; - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!; - handleH.endlocation_id = endLocations![0].id!; - handleH.bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!; - handleH.biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!; - handleH.carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!; - handleH.carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!; - handleH.require_id = inbaleItem.id; - handleH.require_code = inbaleItem.bill_code; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = input.data[nameof(WmsPointH.location_id)]?.ToString()!, + endlocation_id = endLocations![0].id!, + bill_code = input.data[nameof(WmsHandleH.bill_code)]?.ToString()!, + biz_type = input.data[nameof(WmsHandleH.biz_type)]?.ToString()!, + carry_id = input.data[nameof(WmsHandleH.carry_id)]?.ToString()!, + carry_code = input.data[nameof(WmsHandleH.carry_code)]?.ToString()!, + require_id = inbaleItem.id, + require_code = inbaleItem.bill_code, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //根据载具移入Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsInbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); - var baleNum = input.data[nameof(WmsCarryH.bale_num)]?.ToString(); + string? 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 BasLocation { is_lock = 1 }); @@ -171,9 +185,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var row = await _db.Updateable().SetColumns(it => new WmsInbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); - if (row < 1) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + int row = await _db.Updateable().SetColumns(it => new WmsInbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs index f5503d9b..c0bac3be 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAOutBaleServiceService.cs @@ -64,7 +64,7 @@ namespace Tnb.WarehouseMgr VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSOUTBALEPDA_ID, true); await _runService.Create(templateEntity, input); //出库取起点 - var carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString()); + WmsCarryH carry = await _db.Queryable().FirstAsync(it => it.id == input.data[nameof(WmsOutbale.carry_id)].ToString()); WmsPointH? sPoint = null; WmsPointH? ePoint = null; if (input.data.ContainsKey(nameof(WmsPointH.location_id))) @@ -78,33 +78,39 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTBALE_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTBALE_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -116,25 +122,27 @@ namespace Tnb.WarehouseMgr return preTask; }).ToList(); //判断目标库位是否自动签收 - var loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsPointH.location_id)].ToString()); if (loc.is_sign == 0) { preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值 } - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = input.data["ReturnIdentity"].ToString()!; - preTaskUpInput.CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = input.data["ReturnIdentity"].ToString()!, + CarryId = input.data[nameof(WmsCarryD.carry_id)]?.ToString()!, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()!, - preTaskUpInput.PreTaskRecords = preTasks.Adapt>(); + PreTaskRecords = preTasks.Adapt>() + }; preTaskUpInput.PreTaskRecords.ForEach(x => x.id = SnowflakeIdHelper.NextId()); //根据寄存出库Id,回更单据状态 - await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == preTaskUpInput.RquireId).ExecuteCommandAsync(); await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { is_lock = 1, location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, @@ -161,9 +169,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsOutbale { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs index 06855e5c..62966689 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDAScanInStockService.cs @@ -57,15 +57,30 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - var item = input.data.Adapt(); - if (item.codeqty == 0) throw new AppFriendlyException("请输入入库数量", 500); - var carryCode = item.barcode; - var carry = await _db.Queryable().FirstAsync(it => it.carry_code == carryCode); - if (carry == null) throw new AppFriendlyException("载具有误", 500); - var mat = await _db.Queryable().FirstAsync(it => it.code == item.material_code); - if (mat == null) throw new AppFriendlyException("物料有误", 500); - var loc = await _db.Queryable().FirstAsync(it => it.location_code == item.extras); - if (loc == null) throw new AppFriendlyException("库位有误", 500); + WmsInstockCode item = input.data.Adapt(); + if (item.codeqty == 0) + { + throw new AppFriendlyException("请输入入库数量", 500); + } + + string carryCode = item.barcode; + WmsCarryH carry = await _db.Queryable().FirstAsync(it => it.carry_code == carryCode); + if (carry == null) + { + throw new AppFriendlyException("载具有误", 500); + } + + BasMaterial mat = await _db.Queryable().FirstAsync(it => it.code == item.material_code); + if (mat == null) + { + throw new AppFriendlyException("物料有误", 500); + } + + BasLocation loc = await _db.Queryable().FirstAsync(it => it.location_code == item.extras); + if (loc == null) + { + throw new AppFriendlyException("库位有误", 500); + } WmsInstockH instock = new() { @@ -123,65 +138,74 @@ namespace Tnb.WarehouseMgr create_time = DateTime.Now, }; - await _db.Insertable(instock).ExecuteCommandAsync(); - await _db.Insertable(instockD).ExecuteCommandAsync(); - await _db.Insertable(instockCode).ExecuteCommandAsync(); + _ = await _db.Insertable(instock).ExecuteCommandAsync(); + _ = await _db.Insertable(instockD).ExecuteCommandAsync(); + _ = await _db.Insertable(instockCode).ExecuteCommandAsync(); - var inStockStrategyInput = new InStockStrategyQuery { warehouse_id = "26103372441637", Size = 1 }; - var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); + InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = "26103372441637", Size = 1 }; + List endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput); WmsPointH sPoint = new(); WmsPointH ePoint = new(); if (endLocations?.Count > 0) { - var eloc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(carry, eloc); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + BasLocation eloc = await _db.Queryable().SingleAsync(it => it.id == endLocations[0].id); + bool isMatch = await IsCarryAndLocationMatchByCarryStd(carry, eloc); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } + ePoint = await _db.Queryable().FirstAsync(it => it.location_id == endLocations[0].id); } sPoint = await _db.Queryable().FirstAsync(it => it.location_id == loc.id); if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID; - preTask.carry_id = carry.id; - preTask.carry_code = carry.carry_code; - preTask.area_id = sPoint?.area_id!; - preTask.area_code = it.Key; - preTask.require_id = instock.id; - preTask.require_code = instock.bill_code; - preTask.create_id = _userManager.UserId; - preTask.create_time = DateTime.Now; + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId!, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID, + carry_id = carry.id, + carry_code = carry.carry_code, + area_id = sPoint?.area_id!, + area_code = it.Key, + require_id = instock.id, + require_code = instock.bill_code, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; return preTask; }).ToList(); List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH? pt in preTasks) { WmsPretaskCode ptc = pt.Adapt(); ptc.id = SnowflakeIdHelper.NextId(); @@ -194,30 +218,34 @@ namespace Tnb.WarehouseMgr ptc.code_batch = instockCode.code_batch; pretaskCodes.Add(ptc); } - var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + bool isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); if (isOk) { - var preTaskUpInput = new GenPreTaskUpInput(); - preTaskUpInput.RquireId = instock.id; - preTaskUpInput.CarryId = carry.id; - preTaskUpInput.CarryStartLocationId = points.FirstOrDefault()!.location_id!; - preTaskUpInput.CarryStartLocationCode = points.FirstOrDefault()!.location_code!; - preTaskUpInput.LocationIds = points.Select(x => x.location_id).ToList()!; + GenPreTaskUpInput preTaskUpInput = new() + { + RquireId = instock.id, + CarryId = carry.id, + CarryStartLocationId = points.FirstOrDefault()!.location_id!, + CarryStartLocationCode = points.FirstOrDefault()!.location_code!, + LocationIds = points.Select(x => x.location_id).ToList()! + }; //生成操作记录 - WmsHandleH handleH = new(); - handleH.org_id = _userManager.User.OrganizeId; - handleH.startlocation_id = loc.id; - handleH.endlocation_id = endLocations![0].id; - handleH.bill_code = instock.bill_code; - handleH.biz_type = instock.biz_type; - handleH.carry_id = carry.id; - handleH.carry_code = carry.carry_code; - handleH.require_id = instock.id; - handleH.require_code = instock.bill_code; - handleH.create_id = _userManager.UserId; - handleH.create_time = DateTime.Now; + WmsHandleH handleH = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = loc.id, + endlocation_id = endLocations![0].id, + bill_code = instock.bill_code, + biz_type = instock.biz_type, + carry_id = carry.id, + carry_code = carry.carry_code, + require_id = instock.id, + require_code = instock.bill_code, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; preTaskUpInput.PreTaskRecord = handleH; //生成操作记录条码表 @@ -239,14 +267,14 @@ namespace Tnb.WarehouseMgr wmsCarryCode.location_code = loc.location_code; wmsCarryCode.warehouse_id = instock.warehouse_id; } - await _db.Insertable(wmsCarryCode).ExecuteCommandAsync(); + _ = await _db.Insertable(wmsCarryCode).ExecuteCommandAsync(); //回更状态 await _wareHouseService.GenInStockTaskHandleAfter(preTaskUpInput, it => new WmsCarryH { carry_code = instock!.carry_code!, is_lock = 1, carry_status = ((int)EnumCarryStatus.占用).ToString(), location_id = preTaskUpInput.CarryStartLocationId, location_code = preTaskUpInput.CarryStartLocationCode }, it => new BasLocation { is_lock = 1, is_use = ((int)EnumCarryStatus.占用).ToString() }); - await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCode.bill_d_id == it.id).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == instock!.id).ExecuteCommandAsync(); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs index 271fc586..93af33c6 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPDATransferService.cs @@ -79,32 +79,38 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -115,14 +121,14 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { //查询库位表 - var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString()); + BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString()); { //载具加锁,增加库位信息 - await _db.Updateable().SetColumns(it => new WmsCarryH + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), is_lock = 1, @@ -132,8 +138,8 @@ namespace Tnb.WarehouseMgr } //所有库位加锁 - var ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() }; - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); + string?[] ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() }; + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); } } @@ -155,9 +161,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs index 25f71638..f6ba4c77 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPointService.cs @@ -29,46 +29,62 @@ namespace Tnb.WarehouseMgr private async Task DataImport(VisualDevImportDataInput input) { int row = 0; - var errorlist = new List>(); - VisualDevImportDataOutput result = new VisualDevImportDataOutput(); + List> errorlist = new(); + VisualDevImportDataOutput result = new(); try { List> dics = input.list; - List points = new List(); - WmsPointH pt = new WmsPointH(); - List aCodes = new List(); - List lCodes = new List(); + List points = new(); + WmsPointH pt = new(); + List aCodes = new(); + List lCodes = new(); //遍历字典,找出需要查询数据库拿的相关字段 - foreach (var d in dics) + foreach (Dictionary d in dics) { if (d.Select(x => x.Value.ToString()).ToList().Find(v => v != "" && v != string.Empty && v != null) == null) { continue; } - d.ContainsKey("location_code"); - var pCode = d["point_code"]?.ToString() ?? string.Empty; - var pName = d["point_name"]?.ToString() ?? string.Empty; - var aCode = d["area_code"]?.ToString() ?? string.Empty; - var lCode = d["location_code"]?.ToString() ?? string.Empty; - var floor = d["floor"]?.ToString() ?? string.Empty; - if (pCode == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位编号不可为空", 500); - if (pName == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位名称不可为空", 500); - if (floor == string.Empty) throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500); + _ = d.ContainsKey("location_code"); + string pCode = d["point_code"]?.ToString() ?? string.Empty; + string pName = d["point_name"]?.ToString() ?? string.Empty; + string aCode = d["area_code"]?.ToString() ?? string.Empty; + string lCode = d["location_code"]?.ToString() ?? string.Empty; + string floor = d["floor"]?.ToString() ?? string.Empty; + if (pCode == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位编号不可为空", 500); + } + + if (pName == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据点位名称不可为空", 500); + } + + if (floor == string.Empty) + { + throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据楼层不可为空", 500); + } + aCodes.Add(aCode); lCodes.Add(lCode); d["create_time"] = DateTime.Now; - d.Remove("modify_time"); + _ = d.Remove("modify_time"); pt = d.Adapt(); points.Add(pt); } - var aDic = await _db.Queryable().Where(it => aCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.code)).ToDictionaryAsync(x => x.code, x => x.id); - var lDic = await _db.Queryable().Where(it => lCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.location_code)).ToDictionaryAsync(x => x.location_code, x => x.id); - var orgId = _userManager.User.OrganizeId; - var userId = _userManager.UserId; - foreach (var p in points) + Dictionary aDic = await _db.Queryable().Where(it => aCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.code)).ToDictionaryAsync(x => x.code, x => x.id); + Dictionary lDic = await _db.Queryable().Where(it => lCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.location_code)).ToDictionaryAsync(x => x.location_code, x => x.id); + string orgId = _userManager.User.OrganizeId; + string userId = _userManager.UserId; + foreach (WmsPointH p in points) { - if (!aDic.ContainsKey(p.area_code)) throw new AppFriendlyException($"第{points.IndexOf(p) + 1}个数据的管理区编号有误", 500); + if (!aDic.ContainsKey(p.area_code)) + { + throw new AppFriendlyException($"第{points.IndexOf(p) + 1}个数据的管理区编号有误", 500); + } + p.id = SnowflakeIdHelper.NextId(); p.org_id = orgId; p.is_lock = 0; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs index 2aa5e33d..be22c451 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRobotCallbackService.cs @@ -56,8 +56,8 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task RobotCallback(RobotCallBackInput input) { - var carry = await _db.Queryable().SingleAsync(it => it.id == input.carry_id); - var subCarry = await _db.Queryable().SingleAsync(it => it.id == input.membercarry_id); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == input.carry_id); + WmsCarryH subCarry = await _db.Queryable().SingleAsync(it => it.id == input.membercarry_id); if (carry != null && subCarry != null) { VisualDevModelDataCrInput visualDevModelCrInput = new() { data = new Dictionary() }; @@ -75,12 +75,12 @@ namespace Tnb.WarehouseMgr carry.collocation_scheme_id = subCarry.collocation_scheme_id; carry.collocation_scheme_code = subCarry.collocation_scheme_code; carry.carry_status = ((int)EnumCarryStatus.齐套).ToString(); - await _db.Updateable(carry).UpdateColumns(it => new { it.collocation_scheme_id, it.collocation_scheme_code, it.carry_status }).ExecuteCommandAsync(); + _ = await _db.Updateable(carry).UpdateColumns(it => new { it.collocation_scheme_id, it.collocation_scheme_code, it.carry_status }).ExecuteCommandAsync(); if (input.isLast) { - var kittingout = await _db.Queryable().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID); + WmsKittingoutH kittingout = await _db.Queryable().FirstAsync(it => it.collocation_scheme_id == carry.collocation_scheme_id && it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID); if (kittingout != null) { @@ -88,24 +88,26 @@ namespace Tnb.WarehouseMgr await Publish(nameof(IWmskittingOutService.KittingOutByIsToBeShipped)); - visualDevModelCrInput.data = new Dictionary(); - visualDevModelCrInput.data[nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id; - visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_id)] = input.carry_id; - visualDevModelCrInput.data[nameof(WmsKittingInstock.carry_code)] = input.carry_code; - visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_id)] = carry!.collocation_scheme_id!; - visualDevModelCrInput.data[nameof(WmsKittingInstock.collocation_scheme_code)] = carry!.collocation_scheme_code!; - visualDevModelCrInput.data[nameof(WmsKittingInstock.seq)] = kittingout.seq; - visualDevModelCrInput.data[nameof(WmsKittingInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID; - visualDevModelCrInput.data[nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID; - visualDevModelCrInput.data[nameof(WmsKittingInstock.create_id)] = _userManager.UserId; - visualDevModelCrInput.data[nameof(WmsKittingInstock.create_time)] = DateTime.Now; - visualDevModelCrInput.data[nameof(WmsKittingInstock.location_id)] = carry!.location_id!; - visualDevModelCrInput.data[nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult(); - visualDevModelCrInput.data[nameof(WmsKittingInstock.source_id)] = kittingout.id; - visualDevModelCrInput.data[nameof(WmsKittingInstock.source_code)] = kittingout.bill_code; + visualDevModelCrInput.data = new Dictionary + { + [nameof(InStockStrategyQuery.warehouse_id)] = kittingout.warehouse_id, + [nameof(WmsKittingInstock.carry_id)] = input.carry_id, + [nameof(WmsKittingInstock.carry_code)] = input.carry_code, + [nameof(WmsKittingInstock.collocation_scheme_id)] = carry!.collocation_scheme_id!, + [nameof(WmsKittingInstock.collocation_scheme_code)] = carry!.collocation_scheme_code!, + [nameof(WmsKittingInstock.seq)] = kittingout.seq, + [nameof(WmsKittingInstock.biz_type)] = WmsWareHouseConst.BIZTYPE_WMSKITTINGINSTK_ID, + [nameof(WmsKittingInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID, + [nameof(WmsKittingInstock.create_id)] = _userManager.UserId, + [nameof(WmsKittingInstock.create_time)] = DateTime.Now, + [nameof(WmsKittingInstock.location_id)] = carry!.location_id!, + [nameof(WmsKittingInstock.bill_code)] = _billRullService.GetBillNumber("WmsKittingInStk").GetAwaiter().GetResult(), + [nameof(WmsKittingInstock.source_id)] = kittingout.id, + [nameof(WmsKittingInstock.source_code)] = kittingout.bill_code + }; - var location = await _db.Queryable().SingleAsync(it => it.id == kittingout.location_id); + BasLocation? location = await _db.Queryable().SingleAsync(it => it.id == kittingout.location_id); if (kittingout.location_id.IsNullOrWhiteSpace() || (location != null && location.is_type.ToEnum() == EnumLocationType.存储库位)) { //入库 @@ -116,18 +118,18 @@ namespace Tnb.WarehouseMgr if (location != null && location.is_use == ((int)EnumCarryStatus.空闲).ToString() && location.is_lock == 0) { //出库 - var sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); - var ePoint = await _db.Queryable().FirstAsync(it => it.location_id == kittingout.location_id); + WmsPointH sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); + WmsPointH ePoint = await _db.Queryable().FirstAsync(it => it.location_id == kittingout.location_id); if (sPoint != null && ePoint != null) { var kittingOutObj = new { requireId = kittingout.id, requireCode = kittingout.bill_code }; - var preTasks = await _genPreTask(sPoint, ePoint, carry, kittingOutObj); - var carryCodes = await _db.Queryable().Where(it => it.carry_id == carry.id).ToListAsync(); + List preTasks = await _genPreTask(sPoint, ePoint, carry, kittingOutObj); + List carryCodes = await _db.Queryable().Where(it => it.carry_id == carry.id).ToListAsync(); List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH pt in preTasks) { - var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); - var curPreTaskCodes = partCodes.Adapt>(); + List partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + List curPreTaskCodes = partCodes.Adapt>(); curPreTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -136,12 +138,14 @@ namespace Tnb.WarehouseMgr }); pretaskCodes.AddRange(curPreTaskCodes); } - await _warehouseService.GenPreTask(preTasks, pretaskCodes); + _ = await _warehouseService.GenPreTask(preTasks, pretaskCodes); kittingout.status = WmsWareHouseConst.BILLSTATUS_ON_ID; - await _db.Updateable(kittingout).UpdateColumns(it => it.status).ExecuteCommandAsync(); - GenPreTaskUpInput genPreTaskAfterUpInput = new(); - genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); - genPreTaskAfterUpInput.LocationIds = new List { carry.location_id! }; + _ = await _db.Updateable(kittingout).UpdateColumns(it => it.status).ExecuteCommandAsync(); + GenPreTaskUpInput genPreTaskAfterUpInput = new() + { + CarryIds = preTasks.Select(x => x.carry_id).ToList(), + LocationIds = new List { carry.location_id! } + }; await _warehouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1 }, it => new BasLocation { is_lock = 1 }); await InvokeGenPretaskExcute(); @@ -161,36 +165,42 @@ namespace Tnb.WarehouseMgr private async Task> _genPreTask(WmsPointH sPoint, WmsPointH ePoint, WmsCarryH carry, dynamic KittingOutObj) { List preTasks = new(); - var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } + if (points?.Count > 0) { preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? 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 = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID; - preTask.carry_id = carry.id!; - preTask.carry_code = carry.carry_code!; - preTask.area_id = sPoint?.area_id!; - preTask.area_code = it.Key; - preTask.require_id = KittingOutObj.requireId; - preTask.require_code = KittingOutObj.requireCode; - preTask.create_id = _userManager.UserId; - preTask.create_time = DateTime.Now; + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID, + carry_id = carry.id!, + carry_code = carry.carry_code!, + area_id = sPoint?.area_id!, + area_code = it.Key, + require_id = KittingOutObj.requireId, + require_code = KittingOutObj.requireCode, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; return preTask; }).ToList(); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs index 5e76dee1..9ae0da86 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRouteMgrService.cs @@ -41,8 +41,8 @@ namespace Tnb.WarehouseMgr { if (input.data.ContainsKey(nameof(WmsRoad.startpoint_id)) && input.data.ContainsKey(nameof(WmsRoad.endpoint_id))) { - var startPointId = input.data[nameof(WmsRoad.startpoint_id)].ToString(); - var endPointId = input.data[nameof(WmsRoad.endpoint_id)].ToString(); + string? startPointId = input.data[nameof(WmsRoad.startpoint_id)].ToString(); + string? endPointId = input.data[nameof(WmsRoad.endpoint_id)].ToString(); if (string.Equals(startPointId, endPointId, StringComparison.OrdinalIgnoreCase)) { throw new AppFriendlyException("起始点位不能等于终止点位", 500); @@ -56,45 +56,59 @@ namespace Tnb.WarehouseMgr private async Task DataImport(VisualDevImportDataInput input) { int row = 0; - var errorlist = new List>(); - VisualDevImportDataOutput result = new VisualDevImportDataOutput(); + List> errorlist = new(); + VisualDevImportDataOutput result = new(); try { List> dics = input.list; - List roads = new List(); - List pointCodes = new List(); + List roads = new(); + List pointCodes = new(); List locCodes = new(); - WmsRoad road = new WmsRoad(); + WmsRoad road = new(); //遍历字典,找出需要查询数据库拿的相关字段 - foreach (var d in dics) + foreach (Dictionary d in dics) { if (d.Select(x => x.Value.ToString()).ToList().Find(v => v != "" && v != string.Empty && v != null) == null) { continue; } - var sCode = d["startpoint_code"]?.ToString() ?? string.Empty; - var eCode = d["endpoint_code"]?.ToString() ?? string.Empty; - var dis = d["distance"]?.ToString() ?? string.Empty; + string sCode = d["startpoint_code"]?.ToString() ?? string.Empty; + string eCode = d["endpoint_code"]?.ToString() ?? string.Empty; + string dis = d["distance"]?.ToString() ?? string.Empty; if (sCode == eCode) + { throw new AppFriendlyException("起始点位不能等于终止点位", 500); + } + if (dis.IsEmpty()) + { throw new AppFriendlyException($"第{dics.IndexOf(d) + 1}个数据距离不可为空", 500); + } + pointCodes.Add(sCode); pointCodes.Add(eCode); d["create_time"] = DateTime.Now; - d.Remove("modify_time"); + _ = d.Remove("modify_time"); road = d.Adapt(); roads.Add(road); } - var points = await _db.Queryable().Where(it => pointCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.point_code)).ToDictionaryAsync(x => x.point_code, x => x.id); + Dictionary points = await _db.Queryable().Where(it => pointCodes.FindAll(x => x.ToString().IsNotEmptyOrNull() && x.ToString() != "").Contains(it.point_code)).ToDictionaryAsync(x => x.point_code, x => x.id); if (!points.IsNullOrEmpty()) { - var orgId = _userManager.User.OrganizeId; - var userId = _userManager.UserId; - foreach (var r in roads) + string orgId = _userManager.User.OrganizeId; + string userId = _userManager.UserId; + foreach (WmsRoad r in roads) { - if (!points.ContainsKey(r.startpoint_code)) throw new AppFriendlyException($"第{roads.IndexOf(r) + 1}个数据的起始点位编号有误", 500); - if (!points.ContainsKey(r.endpoint_code)) throw new AppFriendlyException($"第{roads.IndexOf(r) + 1}个数据的终止点位编号有误", 500); + if (!points.ContainsKey(r.startpoint_code)) + { + throw new AppFriendlyException($"第{roads.IndexOf(r) + 1}个数据的起始点位编号有误", 500); + } + + if (!points.ContainsKey(r.endpoint_code)) + { + throw new AppFriendlyException($"第{roads.IndexOf(r) + 1}个数据的终止点位编号有误", 500); + } + r.id = SnowflakeIdHelper.NextId(); r.org_id = orgId; r.startpoint_id = points[r.startpoint_code]?.ToString() ?? throw new AppFriendlyException($"第{roads.IndexOf(r) + 1}个数据的起始点位编号有误", 500); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index 4e681733..fa338adb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -89,48 +89,48 @@ namespace Tnb.WarehouseMgr { if (_userManager.User.IsNull()) { - var curUser = await GetUserIdentity(); + System.Security.Claims.ClaimsPrincipal curUser = await GetUserIdentity(); await SetUserEntity(_userManager, curUser); } - var curDb = _db.CopyNew(); + SqlSugarClient curDb = _db.CopyNew(); try { await curDb.Ado.BeginTranAsync(); string firstLocationId = "27010980724501", secondLocationId = "27010987857941"; - var endLocation = await curDb.Queryable().FirstAsync(it => it.id == secondLocationId); + BasLocation endLocation = await curDb.Queryable().FirstAsync(it => it.id == secondLocationId); - var setSortings = await curDb.Queryable() + List setSortings = await curDb.Queryable() .Where(a => a.status == WmsWareHouseConst.BILLSTATUS_ADD_ID) .Select() .OrderBy(a => a.seq) .ToListAsync(); - var items = await curDb.Queryable().Where(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).ToListAsync(); - var onFlag = items?.Count > 0; + List items = await curDb.Queryable().Where(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).ToListAsync(); + bool onFlag = items?.Count > 0; if (setSortings?.Count > 0 && !onFlag) { - var singleSorting = setSortings[0]; + WmsSetsortingH singleSorting = setSortings[0]; - var setSortingDList = await curDb.Queryable().Where(it => it.bill_id == singleSorting.id).ToListAsync(); + List setSortingDList = await curDb.Queryable().Where(it => it.bill_id == singleSorting.id).ToListAsync(); if (setSortingDList?.Count > 0) { List carryMats = new(); List carryCodes = new(); List carryIds = new(); - foreach (var os in setSortingDList) + foreach (WmsSetsortingD os in setSortingDList) { - var OutStockStrategyInput = new OutStockStrategyQuery + OutStockStrategyQuery OutStockStrategyInput = new() { material_id = os.material_id, warehouse_id = os.warehouse_id, code_batch = os.code_batch, }; - var outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); - var carryCodesPart = await curDb.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) + List outStkCarrys = await _wareHouseService.OutStockStrategy(OutStockStrategyInput); + List carryCodesPart = await curDb.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id) .Where((a, b) => outStkCarrys.Select(x => x.id).Contains(b.carry_id)) .Select() .ToListAsync(); @@ -139,7 +139,7 @@ namespace Tnb.WarehouseMgr if (carryCodesPart?.Count > 0) { carryCodes.AddRange(carryCodesPart); - var codeQty = carryCodes.Sum(x => x.codeqty); + decimal codeQty = carryCodes.Sum(x => x.codeqty); if (codeQty < os.pr_qty) { throw new AppFriendlyException($"需要出库[{os.pr_qty}],实际库存{codeQty},数量不足", 500); @@ -160,7 +160,7 @@ namespace Tnb.WarehouseMgr break; } } - var partCarryMats = curCarryCodes.Adapt>(); + List partCarryMats = curCarryCodes.Adapt>(); for (int i = 0; i < partCarryMats.Count; i++) { partCarryMats[i].need_qty = curCarryCodes[i].codeqty; @@ -175,17 +175,17 @@ namespace Tnb.WarehouseMgr carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch }) .Select(x => { - var arr = x.ToArray(); + WmsCarryMat[] arr = x.ToArray(); WmsCarryMat carryMat = arr[^arr.Length]; carryMat.need_qty = arr.Sum(d => d.need_qty); return carryMat; }) .ToList(); - await curDb.Insertable(carryMats).ExecuteCommandAsync(); + _ = await curDb.Insertable(carryMats).ExecuteCommandAsync(); carryIds = carryMats.Select(x => x.carry_id).Distinct().ToList(); - await curDb.Updateable() + _ = await curDb.Updateable() .SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.全部出).ToString(), @@ -201,24 +201,27 @@ namespace Tnb.WarehouseMgr //天益项目不需要 //await _db.Updateable().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.分拣出).ToString() }).Where(it => sortingOutIds.Contains(it.id)).ExecuteCommandAsync(); } - var carrys = await curDb.Queryable().Where(it => carryIds.Contains(it.id)).ToArrayAsync(); + WmsCarryH[] carrys = await curDb.Queryable().Where(it => carryIds.Contains(it.id)).ToArrayAsync(); if (carrys?.Length > 0) { if (setSortings?.Count > 0) { - var curCarry = carrys[^carrys.Length]; - var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, endLocation); - if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500); + WmsCarryH curCarry = carrys[^carrys.Length]; + bool isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, endLocation); + if (!isMatch) + { + throw new AppFriendlyException("库位与载具规格不匹配", 500); + } } List preTasks = new(); List locIds = new(); - var mid = 6; + int mid = 6; if (carrys.Length > mid) { - var leftCarrys = carrys[..mid]; - var rightCarrys = carrys[mid..]; + WmsCarryH[] leftCarrys = carrys[..mid]; + WmsCarryH[] rightCarrys = carrys[mid..]; await InnerGenPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation); await InnerGenPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation); } @@ -227,10 +230,10 @@ namespace Tnb.WarehouseMgr await InnerGenPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks, endLocation); } List pretaskCodes = new(); - foreach (var pt in preTasks) + foreach (WmsPretaskH pt in preTasks) { - var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); - var curPreTaskCodes = partCodes.Adapt>(); + List partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList(); + List curPreTaskCodes = partCodes.Adapt>(); curPreTaskCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -239,11 +242,13 @@ namespace Tnb.WarehouseMgr }); pretaskCodes.AddRange(curPreTaskCodes); } - await _wareHouseService.GenPreTask(preTasks, pretaskCodes); - await curDb.Updateable().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == singleSorting.id).ExecuteCommandAsync(); - GenPreTaskUpInput genPreTaskAfterUpInput = new(); - genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList(); - genPreTaskAfterUpInput.LocationIds = new HashSet(locIds).ToList(); + _ = await _wareHouseService.GenPreTask(preTasks, pretaskCodes); + _ = await curDb.Updateable().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == singleSorting.id).ExecuteCommandAsync(); + GenPreTaskUpInput genPreTaskAfterUpInput = new() + { + CarryIds = preTasks.Select(x => x.carry_id).ToList(), + LocationIds = new HashSet(locIds).ToList() + }; await _wareHouseService.GenInStockTaskHandleAfter(genPreTaskAfterUpInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套分拣).ToString() }, it => new BasLocation { is_use = ((int)EnumCarryStatus.齐套分拣).ToString(), is_lock = 1 }); } @@ -265,7 +270,7 @@ namespace Tnb.WarehouseMgr RequestMethod = App.HttpContext?.Request?.Method, userIdentity = await GetUserIdentity(_userManager.ToKen), }; - var timedTaskEx = ex.ToTimedTaskException(ei); + TimedTaskException timedTaskEx = ex.ToTimedTaskException(ei); //cts?.Cancel(); throw timedTaskEx; } @@ -279,14 +284,14 @@ namespace Tnb.WarehouseMgr private async Task InnerGenPreTask(WmsCarryH[] carrys, List locIds, string eLocationId, string requireId, string requireCode, List preTasks, BasLocation endLocation) { - foreach (var carry in carrys) + foreach (WmsCarryH carry in carrys) { WmsPointH sPoint = await _db.Queryable().FirstAsync(it => it.location_id == carry.location_id); WmsPointH ePoint = await _db.Queryable().FirstAsync(it => it.location_id == eLocationId); if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List? points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); if (points?.Count > 0) { locIds.AddRange(points.Select(x => x.location_id).ToList()!); @@ -294,11 +299,15 @@ namespace Tnb.WarehouseMgr //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); - var curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + if (points.Count <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } + + List curPreTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -340,20 +349,23 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } //根据载具更新明细表状态 try { await _db.Ado.BeginTranAsync(); - var carryId = input.carryIds[^input.carryIds.Count]; - var ssds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); - var carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); + string carryId = input.carryIds[^input.carryIds.Count]; + List? ssds = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + List carryCodes = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); - var sortingCoees = carryCodes.Adapt>(); + List sortingCoees = carryCodes.Adapt>(); sortingCoees.ForEach(x => { - var billDId = ssds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; + string? billDId = ssds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; if (billDId.IsNullOrEmpty()) { billDId = ssds?.Find(xx => xx.material_id == x.material_id)?.id; @@ -365,43 +377,36 @@ namespace Tnb.WarehouseMgr x.create_id = _userManager.UserId; x.create_time = DateTime.Now; }); - await _db.Insertable(sortingCoees).ExecuteCommandAsync(); - var detailIds = sortingCoees.Select(x => x.bill_d_id).ToList(); - var curSortingDetails = ssds.FindAll(x => detailIds.Contains(x.id)); - var dic = sortingCoees.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); - foreach (var osd in curSortingDetails) + _ = await _db.Insertable(sortingCoees).ExecuteCommandAsync(); + List detailIds = sortingCoees.Select(x => x.bill_d_id).ToList(); + List curSortingDetails = ssds.FindAll(x => detailIds.Contains(x.id)); + Dictionary> dic = sortingCoees.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); + foreach (WmsSetsortingD osd in curSortingDetails) { if (dic.ContainsKey(osd.id)) { osd.qty += dic[osd.id].Sum(d => d); - if (osd.qty >= osd.pr_qty) - { - osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; - } - else - { - osd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID; - } + osd.line_status = osd.qty >= osd.pr_qty ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ON_ID; } } - await _db.Updateable(curSortingDetails).ExecuteCommandAsync(); + _ = await _db.Updateable(curSortingDetails).ExecuteCommandAsync(); if (curSortingDetails.All(it => it.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID)) { - await _db.Updateable().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync(); } - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == carryId); if (carry != null) { if (carry.location_id?.IsNotEmptyOrNull() ?? false) { - await _db.Updateable().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString() }).Where(it => it.id == carry.location_id).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString() }).Where(it => it.id == carry.location_id).ExecuteCommandAsync(); } carry.out_status = ((int)EnumOutStatus.正常).ToString(); carry.carry_status = ((int)EnumCarryStatus.齐套).ToString(); carry.location_id = null; carry.location_code = null; - await _db.Updateable(carry).UpdateColumns(it => new { it.out_status, it.carry_status, it.location_id, it.location_code }).ExecuteCommandAsync(); - await _db.Deleteable().Where(it => it.carry_id == carryId).ExecuteCommandAsync(); + _ = await _db.Updateable(carry).UpdateColumns(it => new { it.out_status, it.carry_status, it.location_id, it.location_code }).ExecuteCommandAsync(); + _ = await _db.Deleteable().Where(it => it.carry_id == carryId).ExecuteCommandAsync(); } await _db.Ado.CommitTranAsync(); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index fccf6a02..c24b1456 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -41,7 +41,7 @@ namespace Tnb.WarehouseMgr [HttpGet] public async Task GetDisTasksByCarryId([FromRoute] string carryId) { - var item = await _db.Queryable().FirstAsync(it => it.carry_id == carryId && it.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && it.is_sign == 0); + WmsDistaskH item = await _db.Queryable().FirstAsync(it => it.carry_id == carryId && it.status == WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID && it.is_sign == 0); return item; } /// @@ -58,22 +58,16 @@ namespace Tnb.WarehouseMgr try { await _db.Ado.BeginTranAsync(); - WmsCarryH? carry = null; - if (!input.carryId.IsNullOrWhiteSpace()) - { - carry = await _db.Queryable().SingleAsync(it => it.id == input.carryId); - } - else - { - carry = await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); - } + WmsCarryH? carry = !input.carryId.IsNullOrWhiteSpace() + ? await _db.Queryable().SingleAsync(it => it.id == input.carryId) + : await _db.Queryable().SingleAsync(it => it.carry_code == input.carry_code); if (carry != null) { if (carry?.location_id?.IsNotEmptyOrNull() ?? false) { - var loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); + BasLocation loc = await _db.Queryable().SingleAsync(it => it.id == carry.location_id); loc.is_use = ((int)EnumCarryStatus.空闲).ToString(); - await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); + _ = await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync(); } WmsDistaskH? disTask = null; if (!input.disTaskId.IsNullOrEmpty()) @@ -103,7 +97,7 @@ namespace Tnb.WarehouseMgr await DoUpdate(upInput); //回更业务 } disTask.is_sign = 1; - await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync(); + _ = await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync(); } } await _db.Ado.CommitTranAsync(); @@ -122,10 +116,18 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task MESCarrySign(MESCarrySignInput input) { - var isSuccessFul = false; - if (input.IsNull()) throw new ArgumentNullException("input"); - var signInput = input.Adapt(); - if (signInput.carryId.IsNotEmptyOrNull()) signInput.carryId = ""; + if (input.IsNull()) + { + throw new ArgumentNullException("input"); + } + + SignForDeliveryInput signInput = input.Adapt(); + if (signInput.carryId.IsNotEmptyOrNull()) + { + signInput.carryId = ""; + } + + bool isSuccessFul; try { await SignForDelivery(signInput); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs index b96ebaa3..df16f071 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsStockReportService.cs @@ -29,7 +29,7 @@ namespace Tnb.WarehouseMgr private async Task GetListAsync(VisualDevModelListQueryInput input) { - var items = await _db.Queryable().InnerJoin((a, b) => a.material_id == b.id) + List items = await _db.Queryable().InnerJoin((a, b) => a.material_id == b.id) .InnerJoin((a, b, c) => b.id == c.material_id) .InnerJoin((a, b, c, d) => a.carry_id == d.id) .InnerJoin((a, b, c, d, e) => d.location_id == e.id) @@ -42,27 +42,29 @@ namespace Tnb.WarehouseMgr create_id = a.create_id, }, true) .ToListAsync(); - var carryCodes = await _db.Queryable().ToListAsync(); + List carryCodes = await _db.Queryable().ToListAsync(); var storeMap = items.DistinctBy(x => new { x.warehouse_id, x.material_id }).ToDictionary(x => new { x.warehouse_id, x.material_id }, x => x); - var result = items.GroupBy(g => new { g.warehouse_id, g.material_id }).Select(itGroup => + IEnumerable result = items.GroupBy(g => new { g.warehouse_id, g.material_id }).Select(itGroup => { - storeMap.TryGetValue(itGroup.Key, out var report); - WmsStockReportH stockReport = new(); - stockReport.material_code = report?.material_code ?? ""; - stockReport.mater_name = report?.mater_name ?? ""; - stockReport.existing_stock_qty = itGroup.Sum(d => d.codeqty); - stockReport.max_stock = report?.max_stock ?? 0; - stockReport.safe_stock = report?.safe_stock ?? 0; - stockReport.min_stock = report?.min_stock ?? 0; - stockReport.storage_valid_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.storage_valid_day; - stockReport.early_warn_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.early_warn_day; - stockReport.create_id = _userManager.UserId; - stockReport.create_time = DateTime.Now; + _ = storeMap.TryGetValue(itGroup.Key, out WmsStockReportH? report); + WmsStockReportH stockReport = new() + { + material_code = report?.material_code ?? "", + mater_name = report?.mater_name ?? "", + existing_stock_qty = itGroup.Sum(d => d.codeqty), + max_stock = report?.max_stock ?? 0, + safe_stock = report?.safe_stock ?? 0, + min_stock = report?.min_stock ?? 0, + storage_valid_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.storage_valid_day, + early_warn_day = items.Find(t => t.material_id == itGroup.Key.material_id)?.early_warn_day, + create_id = _userManager.UserId, + create_time = DateTime.Now + }; if (stockReport.storage_valid_day.HasValue) { decimal expired_warning_qty = 0; - foreach (var item in itGroup) + foreach (WmsStockReportH? item in itGroup) { if (DateTime.Now.Subtract(item.create_time.Value).TotalDays >= (item.storage_valid_day - item.early_warn_day)) { @@ -71,7 +73,7 @@ namespace Tnb.WarehouseMgr } stockReport.expired_warning_qty = expired_warning_qty; } - var curCarryCodes = carryCodes.FindAll(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id); + List curCarryCodes = carryCodes.FindAll(x => x.warehouse_id == itGroup.Key.warehouse_id && x.material_id == itGroup.Key.material_id); stockReport.Details = curCarryCodes.Adapt>(); stockReport.Details.ForEach(x => { @@ -82,7 +84,7 @@ namespace Tnb.WarehouseMgr }); - var pages = result.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList(); + List pages = result.Skip((input.currentPage - 1) * input.pageSize).Take(input.pageSize).ToList(); SqlSugarPagedList pagedList = new() { list = pages, diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs index ee047edd..b808943c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferService.cs @@ -78,33 +78,38 @@ namespace Tnb.WarehouseMgr } if (sPoint != null && ePoint != null) { - var points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); + List points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id); //根据获取的路径点生成预任务,生成顺序必须预路径算法返回的起终点的顺序一致(预任务顺序) if (points?.Count > 0) { - 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 <= 2) { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + throw new AppFriendlyException("该路径不存在", 500); + } - 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.startpoint_id = sPoint?.id!; - preTask.startpoint_code = sPoint?.point_code!; - preTask.endpoint_id = ePoint?.id!; - preTask.endpoint_code = ePoint?.point_code!; - preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(); - preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID; - preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID; - preTask.task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID; + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + { + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); + + WmsPretaskH preTask = new() + { + org_id = _userManager.User.OrganizeId, + startlocation_id = sPoint?.location_id!, + startlocation_code = sPoint?.location_code!, + endlocation_id = ePoint?.location_id!, + endlocation_code = ePoint?.location_code!, + start_floor = sPoint?.floor.ToString(), + end_floor = ePoint?.floor.ToString(), + startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, + endpoint_id = ePoint?.id!, + endpoint_code = ePoint?.point_code!, + bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(), + status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID, + biz_type = WmsWareHouseConst.BIZTYPE_WMSTRANSFER_ID, + task_type = WmsWareHouseConst.WMS_PRETASK_TRANSFER_TYPE_ID + }; preTask.carry_id = input.data[nameof(preTask.carry_id)]?.ToString()!; preTask.carry_code = input.data[nameof(preTask.carry_code)]?.ToString()!; preTask.area_id = sPoint?.area_id!; @@ -115,14 +120,14 @@ namespace Tnb.WarehouseMgr preTask.create_time = DateTime.Now; return preTask; }).ToList(); - var isOk = await _wareHouseService.GenPreTask(preTasks, null!); + bool isOk = await _wareHouseService.GenPreTask(preTasks, null!); if (isOk) { //查询库位表 - var location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString()); + BasLocation location = await _db.Queryable().SingleAsync(it => it.id == input.data[nameof(WmsTransfer.startlocation_id)].ToString()); { //载具加锁,增加库位信息 - await _db.Updateable().SetColumns(it => new WmsCarryH + _ = await _db.Updateable().SetColumns(it => new WmsCarryH { carry_status = ((int)EnumCarryStatus.占用).ToString(), is_lock = 1, @@ -132,9 +137,9 @@ namespace Tnb.WarehouseMgr } //所有库位加锁 - var ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() }; - await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); - await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); + string?[] ids = new[] { input.data[nameof(WmsTransfer.startlocation_id)].ToString(), input.data[nameof(WmsTransfer.endlocation_id)].ToString() }; + _ = await _db.Updateable().SetColumns(it => new BasLocation { is_lock = 1 }).Where(it => ids.Contains(it.id)).ExecuteCommandAsync(); + _ = await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data["ReturnIdentity"].ToString()).ExecuteCommandAsync(); } @@ -158,9 +163,16 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); - var isOk = await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + + bool isOk = await _db.Updateable().SetColumns(it => new WmsTransfer { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index f9f506d2..4345e405 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -68,48 +68,48 @@ namespace Tnb.WarehouseMgr //{ // ct?.ThrowIfCancellationRequested(); //} - var curDb = _db.CopyNew(); + SqlSugarClient curDb = _db.CopyNew(); try { await curDb.Ado.BeginTranAsync(); - var kittingOuts = await curDb.Queryable() + List kittingOuts = await curDb.Queryable() .Where(a => a.status == WmsWareHouseConst.BILLSTATUS_ADD_ID) .OrderBy(a => a.seq) .ToListAsync(); // 是否有已呼叫的齐套出库任务 // var set = true ; 如果有 把set修改为false - var items = await curDb.Queryable().Where(it => it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID).ToListAsync(); - var isCalled = items?.Count > 0; + List items = await curDb.Queryable().Where(it => it.status == WmsWareHouseConst.BILLSTATUS_CALLED_ID).ToListAsync(); + bool isCalled = items?.Count > 0; if (kittingOuts?.Count > 0) { - foreach (var ko in kittingOuts) + foreach (WmsKittingoutH ko in kittingOuts) { //a.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID Expression> whereExp = (ko.carry_id != null) ? a => a.id == ko.carry_id : a => a.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID; - var carrys = await curDb.Queryable() + List carrys = await curDb.Queryable() .InnerJoin((a, b) => a.collocation_scheme_id == b.id) .Where(whereExp.And(a => a.collocation_scheme_id == ko.collocation_scheme_id && a.is_lock == 0)) .OrderBy((a, b) => b.seq) .ToListAsync(); if (carrys?.Count > 0) { - var firstCarry = carrys.FirstOrDefault(); + WmsCarryH? firstCarry = carrys.FirstOrDefault(); GenPreTaskUpInput genPreTaskInput = new() { CarryId = firstCarry?.id }; await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, out_status = EnumOutStatus.全部出.ToString() }, null!); ko.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID; ko.carry_id = firstCarry?.id; ko.carry_code = firstCarry?.carry_code; - await _db.Updateable(ko).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync(); + _ = await _db.Updateable(ko).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync(); _ = KittingOutByIsToBeShipped(); if (firstCarry != null) { firstCarry.source_id = ko.source_id; firstCarry.source_code = ko.source_code; - await _db.Updateable(firstCarry).UpdateColumns(it => new { it.source_id, it.source_code }).ExecuteCommandAsync(); + _ = await _db.Updateable(firstCarry).UpdateColumns(it => new { it.source_id, it.source_code }).ExecuteCommandAsync(); } } else @@ -117,7 +117,7 @@ namespace Tnb.WarehouseMgr //if(false) 跳出 插入完一次齐套分拣 set 改为false if (!isCalled) { - var setSortingH = ko.Adapt(); + WmsSetsortingH setSortingH = ko.Adapt(); setSortingH.warehouse_id = WmsWareHouseConst.WAREHOUSE_ZC_ID; setSortingH.id = SnowflakeIdHelper.NextId(); setSortingH.kittingout_id = ko.id; @@ -125,10 +125,10 @@ namespace Tnb.WarehouseMgr setSortingH.org_id = _userManager.User.OrganizeId; setSortingH.create_id = _userManager.UserId; setSortingH.create_time = DateTime.Now; - await curDb.Insertable(setSortingH).ExecuteCommandAsync(); + _ = await curDb.Insertable(setSortingH).ExecuteCommandAsync(); - var kittingOutDetails = await curDb.Queryable().Where(it => it.bill_id == ko.id).ToListAsync(); - var setSortDetails = kittingOutDetails.Adapt>(); + List kittingOutDetails = await curDb.Queryable().Where(it => it.bill_id == ko.id).ToListAsync(); + List setSortDetails = kittingOutDetails.Adapt>(); setSortDetails.ForEach(x => { x.id = SnowflakeIdHelper.NextId(); @@ -138,9 +138,9 @@ namespace Tnb.WarehouseMgr x.create_id = _userManager.UserId; x.create_time = DateTime.Now; }); - await curDb.Insertable(setSortDetails).ExecuteCommandAsync(); + _ = await curDb.Insertable(setSortDetails).ExecuteCommandAsync(); ko.status = WmsWareHouseConst.BILLSTATUS_CALLED_ID; - await curDb.Updateable(ko).UpdateColumns(it => it.status).ExecuteCommandAsync(); + _ = await curDb.Updateable(ko).UpdateColumns(it => it.status).ExecuteCommandAsync(); isCalled = true; //await Publish(nameof(IWmsSetSortingService.PackSortingByAdd)); } @@ -161,7 +161,7 @@ namespace Tnb.WarehouseMgr RequestMethod = App.HttpContext?.Request?.Method, userIdentity = await GetUserIdentity(_userManager.ToKen), }; - var timedTaskEx = ex.ToTimedTaskException(ei); + TimedTaskException timedTaskEx = ex.ToTimedTaskException(ei); //cts?.Cancel(); throw timedTaskEx; } @@ -176,24 +176,24 @@ namespace Tnb.WarehouseMgr { //if (UserManager.AsscessToken.IsNullOrWhiteSpace()) return; //var curUser = await GetUserIdentity(); - var curDb = _db.CopyNew(); + SqlSugarClient curDb = _db.CopyNew(); try { - var kittingOuts = await curDb.Queryable() + List kittingOuts = await curDb.Queryable() .Where(a => a.status == WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID) .OrderBy(a => a.seq) .ToListAsync(); if (kittingOuts?.Count > 0) { - var grpList = kittingOuts.GroupBy(g => g.location_id).ToList(); - foreach (var koGrp in grpList) + List> grpList = kittingOuts.GroupBy(g => g.location_id).ToList(); + foreach (IGrouping? koGrp in grpList) { - var locs = await curDb.Queryable().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync(); + List locs = await curDb.Queryable().Where(it => it.id == koGrp.Key && it.is_use == ((int)EnumCarryStatus.空闲).ToString() && it.is_lock == 0).ToListAsync(); if (locs?.Count > 0) { - var arr = koGrp.ToArray(); - var ko = arr[^arr.Length]; - var carry = await curDb.Queryable().SingleAsync(it => it.id == ko.carry_id); + WmsKittingoutH[] arr = koGrp.ToArray(); + WmsKittingoutH ko = arr[^arr.Length]; + WmsCarryH carry = await curDb.Queryable().SingleAsync(it => it.id == ko.carry_id); if (carry != null) { @@ -202,15 +202,19 @@ namespace Tnb.WarehouseMgr if (sPoint != null && ePoint != null) { //判断目标库位是否自动签收 - var loc = await curDb.Queryable().SingleAsync(it => it.id == ePoint.location_id); - var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id); - if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500); + BasLocation loc = await curDb.Queryable().SingleAsync(it => it.id == ePoint.location_id); + List points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id); + if (points.Count <= 2) + { + throw new AppFriendlyException("该路径不存在", 500); + } + if (points?.Count > 0) { - var preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => + List preTasks = points.Where(it => !it.location_id.IsNullOrEmpty()).GroupBy(g => g.area_code).Select(it => { - var sPoint = it.FirstOrDefault(); - var ePoint = it.LastOrDefault(); + WmsPointH? sPoint = it.FirstOrDefault(); + WmsPointH? ePoint = it.LastOrDefault(); WmsPretaskH preTask = new() { @@ -246,12 +250,12 @@ namespace Tnb.WarehouseMgr { preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值 } - await _warehouseService.GenPreTask(preTasks, null!); - var subCarrys = await curDb.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(); + _ = await _warehouseService.GenPreTask(preTasks, null!); + List subCarrys = await curDb.Queryable().Where(it => it.carry_id == ko.carry_id).ToListAsync(); + List 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 curDb.Updateable().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == ko.id).ExecuteCommandAsync(); + _ = await curDb.Updateable().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == ko.id).ExecuteCommandAsync(); } } } @@ -271,7 +275,7 @@ namespace Tnb.WarehouseMgr RequestMethod = App.HttpContext?.Request?.Method, userIdentity = await GetUserIdentity(_userManager.ToKen), }; - var timedTaskEx = ex.ToTimedTaskException(ei); + TimedTaskException timedTaskEx = ex.ToTimedTaskException(ei); //cts?.Cancel(); throw timedTaskEx; @@ -285,29 +289,33 @@ namespace Tnb.WarehouseMgr public override async Task ModifyAsync(WareHouseUpInput input) { - if (input == null) throw new ArgumentNullException(nameof(input)); + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + try { await _db.Ado.BeginTranAsync(); - var carryId = input.carryIds[^input.carryIds.Count]; - var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); - var kods = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + string carryId = input.carryIds[^input.carryIds.Count]; + WmsCarryH carry = await _db.Queryable().SingleAsync(it => it.id == carryId); + List? kods = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); //载具为料架时,取所有料箱的条码 List mCarryIds = new(); if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID) { - var carryDs = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); + List carryDs = await _db.Queryable().Where(it => it.carry_id == carryId).ToListAsync(); mCarryIds = carryDs.Select(x => x.membercarry_id).ToList(); } //当前载具对应的所有条码插入 Expression> whereExp = mCarryIds?.Count > 0 ? a => mCarryIds.Contains(a.carry_id) : a => a.carry_id == carryId; - var carryCodes = await _db.Queryable().Where(whereExp).ToListAsync(); - var kittingoutCodes = carryCodes.Adapt>(); + List carryCodes = await _db.Queryable().Where(whereExp).ToListAsync(); + List kittingoutCodes = carryCodes.Adapt>(); kittingoutCodes.ForEach(x => { - var billDId = kods?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; + string? billDId = kods?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id; if (billDId.IsNullOrEmpty()) { billDId = kods?.Find(xx => xx.material_id == x.material_id)?.id; @@ -319,27 +327,20 @@ namespace Tnb.WarehouseMgr x.create_id = _userManager.UserId; x.create_time = DateTime.Now; }); - var row = await _db.Insertable(kittingoutCodes).ExecuteCommandAsync(); - var detailIds = kittingoutCodes.Select(x => x.bill_d_id).ToList(); - var curKittingoutDetails = kods.FindAll(x => detailIds.Contains(x.id)); - var dic = kittingoutCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); - foreach (var kod in curKittingoutDetails) + int row = await _db.Insertable(kittingoutCodes).ExecuteCommandAsync(); + List detailIds = kittingoutCodes.Select(x => x.bill_d_id).ToList(); + List curKittingoutDetails = kods.FindAll(x => detailIds.Contains(x.id)); + Dictionary> dic = kittingoutCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList()); + foreach (WmsKittingoutD kod in curKittingoutDetails) { if (dic.ContainsKey(kod.id)) { kod.qty += dic[kod.id].Sum(d => d); - if (kod.qty >= kod.pr_qty) - { - kod.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID; - } - else - { - kod.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID; - } + kod.line_status = kod.qty >= kod.pr_qty ? WmsWareHouseConst.BILLSTATUS_COMPLETE_ID : WmsWareHouseConst.BILLSTATUS_ON_ID; } } - await _db.Updateable(curKittingoutDetails).ExecuteCommandAsync(); - var isOk = await _db.Updateable().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); + _ = await _db.Updateable(curKittingoutDetails).ExecuteCommandAsync(); + bool isOk = await _db.Updateable().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync(); //if (carry != null) //{ // row = await _carryService.UpdateNullCarry(carry); @@ -348,18 +349,22 @@ namespace Tnb.WarehouseMgr //判断当前载具是否为料架,如果是料架 清空所有料架/料箱数据, if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIds?.Count > 0) { - var carrys = await _db.Queryable().Where(it => mCarryIds.Contains(it.id)).ToListAsync(); + List carrys = await _db.Queryable().Where(it => mCarryIds.Contains(it.id)).ToListAsync(); carrys.Add(carry); if (carrys?.Count > 0) { await _db.Ado.BeginTranAsync(); - var tasks = new List>>(); - Func>? upateNullCarryFunc = carryIt => Task.Run(() => _db.CopyNew().Updateable(carryIt).ExecuteCommandAsync()); - foreach (var carryIt in carrys) + List>> tasks = new(); + Task upateNullCarryFunc(WmsCarryH carryIt) + { + return Task.Run(() => _db.CopyNew().Updateable(carryIt).ExecuteCommandAsync()); + } + + foreach (WmsCarryH carryIt in carrys) { tasks.Add(_carryService.UpdateNullCarry(carryIt, upateNullCarryFunc)); } - var all = await Task.WhenAll(tasks.Select(t => t.Unwrap())); + int[] all = await Task.WhenAll(tasks.Select(t => t.Unwrap())); if (all.All(x => x > 0)) { isOk = all?.Length > 0; @@ -367,7 +372,10 @@ namespace Tnb.WarehouseMgr await _db.Ado.CommitTranAsync(); } } - if (!isOk) throw Oops.Oh(ErrorCode.COM1001); + if (!isOk) + { + throw Oops.Oh(ErrorCode.COM1001); + } await _db.Ado.CommitTranAsync(); } @@ -385,18 +393,22 @@ namespace Tnb.WarehouseMgr [HttpPost] public async Task MESKittingOutStk(List input) { - var isSuccessFul = false; - if (input.IsNull()) throw new ArgumentNullException(nameof(input)); + bool isSuccessFul = false; + if (input.IsNull()) + { + throw new ArgumentNullException(nameof(input)); + } + try { await _db.Ado.BeginTranAsync(); List kittingOutDs = new(); - var kittingOuts = input.Adapt>(); - var ids = input.Select(x => x.location_code).ToArray(); + List kittingOuts = input.Adapt>(); + string[] ids = input.Select(x => x.location_code).ToArray(); for (int i = 0; i < kittingOuts.Count; i++) { - var x = kittingOuts[i]; + WmsKittingoutH x = kittingOuts[i]; x.id = SnowflakeIdHelper.NextId(); x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_KITTINGOUTSTK_ENCODE).GetAwaiter().GetResult(); x.bill_date = DateTime.Now; @@ -404,7 +416,7 @@ namespace Tnb.WarehouseMgr x.status = WmsWareHouseConst.BILLSTATUS_ADD_ID; x.biz_type = WmsWareHouseConst.BIZTYPE_WMSKITTINGOUTSTK_ID; x.location_id = ids[i]; - var d = input[i]?.wmsKittingoutDs?.Adapt>(); + List? d = input[i]?.wmsKittingoutDs?.Adapt>(); d?.ForEach(it => { it.id = SnowflakeIdHelper.NextId(); @@ -419,8 +431,8 @@ namespace Tnb.WarehouseMgr } } - await _db.Insertable(kittingOuts).ExecuteCommandAsync(); - await _db.Insertable(kittingOutDs).ExecuteCommandAsync(); + _ = await _db.Insertable(kittingOuts).ExecuteCommandAsync(); + _ = await _db.Insertable(kittingOutDs).ExecuteCommandAsync(); await _db.Ado.CommitTranAsync(); await KittingOutByAdd();