From bd739b3060185e607a578aea6e42a75e4dc92400 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 8 Nov 2023 14:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=BD=90=E5=A5=97=E5=87=BA=E5=BA=93=20?= =?UTF-8?q?=E4=B8=80=E8=88=AC=E5=87=BA=E5=BA=93=20=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E6=B7=BB=E5=8A=A0=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/DictConst.cs | 35 ++++++++++++++++ .../PrdKittingOutChangeStatusInput.cs | 20 +++++++++ .../IPrdKittingOutService.cs | 9 +++- .../Tnb.ProductionMgr/PrdFeedingService.cs | 38 ++++++++++++++--- .../Tnb.ProductionMgr/PrdKittingOutService.cs | 40 +++++++++++++++++- .../Tnb.ProductionMgr/PrdOutstockService.cs | 42 ++++++++++++------- 6 files changed, 159 insertions(+), 25 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs diff --git a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs index ab3fad04..8fa89a1b 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/DictConst.cs @@ -179,6 +179,41 @@ public static class DictConst /// public const string SHENGCHANBULIAO = "24"; + /// + /// 出入库单据状态code + /// + public const string DOCUMENTSTATU = "DocumentStatu"; + + /// + /// 出库单据状态新增 + /// + public const string OUTSTOCKSTATUSADD = "1"; + + /// + /// 出库单据状态作业中 + /// + public const string OUTSTOCKSTATUSWORKING = "2"; + + /// + /// 出库单据状态已呼叫 + /// + public const string OUTSTOCKSTATUSCALLED = "3"; + + /// + /// 出库单据状态待配送 + /// + public const string OUTSTOCKSTATUSTOBEDELIVERED = "4"; + + /// + /// 出库单据状态取消 + /// + public const string OUTSTOCKSTATUSCANCEL = "7"; + + /// + /// 出库单据状态完成 + /// + public const string OUTSTOCKSTATUSCOMPLETED = "8"; + #endregion diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs new file mode 100644 index 00000000..94cfd047 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdKittingOutChangeStatusInput.cs @@ -0,0 +1,20 @@ +namespace Tnb.ProductionMgr.Entities.Dto +{ + public class PrdKittingOutChangeStatusInput + { + /// + /// 来源单号 + /// + public string code { get; set; } + + /// + /// 0 齐套出库 1 一般出库 2 物料出库 + /// + public string type { get; set; } + + /// + /// 状态 + /// + public string status { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs index a9e6babd..91b17a8c 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs @@ -1,3 +1,5 @@ +using Tnb.ProductionMgr.Entities.Dto; + namespace Tnb.ProductionMgr.Interfaces { /// @@ -5,6 +7,11 @@ namespace Tnb.ProductionMgr.Interfaces /// public interface IPrdKittingOutService { - + /// + /// 齐套出库 一般出库 物料出库 改状态 + /// + /// + /// + public Task ChangeStatusById(List inputs); } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 842c6e30..4087a392 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -528,12 +528,35 @@ namespace Tnb.ProductionMgr input.sidx = "create_time"; input.sort = "desc"; } + + List statusList = new(); + if (!string.IsNullOrEmpty(status)) + { + switch (status) + { + case "1": + statusList.Add(DictConst.OUTSTOCKSTATUSADD); + statusList.Add(DictConst.OUTSTOCKSTATUSCALLED); + break; + case "2": + statusList.Add(DictConst.OUTSTOCKSTATUSTOBEDELIVERED); + statusList.Add(DictConst.OUTSTOCKSTATUSWORKING); + break; + case "3": + statusList.Add(DictConst.OUTSTOCKSTATUSCANCEL); + statusList.Add(DictConst.OUTSTOCKSTATUSCOMPLETED); + break; + } + } var queryable1 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) + .LeftJoin((a,b,c)=>a.id==c.source_id) + .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU) + .LeftJoin((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id) .Where((a,b)=>a.workstation_id==input.stationId) - .WhereIF(!string.IsNullOrEmpty(status),a=>a.status==status) - .Select((a, b) => new FeedingRecordListOutput() + .WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode)) + .Select((a, b,c,d,e) => new FeedingRecordListOutput() { id = a.id, code = a.code, @@ -541,14 +564,17 @@ namespace Tnb.ProductionMgr type = "0", create_name = b.RealName, create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - status = a.status + status = e.FullName }); var queryable2 = db.Queryable() .LeftJoin((a, b) => a.create_id == b.Id) + .LeftJoin((a,b,c)=>a.id==c.source_id) + .LeftJoin((a,b,c,d)=>d.EnCode==DictConst.DOCUMENTSTATU) + .LeftJoin((a,b,c,d,e)=>e.DictionaryTypeId==d.Id && c.status==e.Id) .Where((a,b)=>a.workstation_id==input.stationId) - .WhereIF(!string.IsNullOrEmpty(status),a=>a.status==status) - .Select((a, b) => new FeedingRecordListOutput() + .WhereIF(statusList.Count>0,(a,b,c,d,e)=>statusList.Contains(e.EnCode)) + .Select((a, b,c,d,e) => new FeedingRecordListOutput() { id = a.id, code = a.bill_code, @@ -556,7 +582,7 @@ namespace Tnb.ProductionMgr type = a.type, create_name = b.RealName, create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), - status = a.status + status = e.FullName }); var result = await db.UnionAll(queryable1,queryable2) .MergeTable() diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs index cbff6ef9..7bc067f5 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs @@ -165,6 +165,7 @@ namespace Tnb.ProductionMgr public async Task KittingOut(KittingOutInput kittingOutInput) { PrdKittingOutH prdKittingOutH = new(); + prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); try { ISqlSugarClient db = _repository.AsSugarClient(); @@ -184,6 +185,7 @@ namespace Tnb.ProductionMgr collocation_scheme_id = kittingOutInput.collocation_scheme_id, collocation_scheme_code = kittingOutInput.collocation_scheme_code, source_id = prdKittingOutH.id, + source_code = prdKittingOutH.code, create_id = _userManager.UserId, wmsKittingoutDs = new List(), } @@ -205,7 +207,6 @@ namespace Tnb.ProductionMgr } else { - prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); prdKittingOutH.warehouse_id = kittingOutInput.warehouse_id; prdKittingOutH.location_code = kittingOutInput.location_code; prdKittingOutH.material_id = kittingOutInput.material_id; @@ -274,6 +275,7 @@ namespace Tnb.ProductionMgr public async Task KittingOutNew(KittingOutNewInput kittingOutInput) { PrdKittingOutH prdKittingOutH = new(); + prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); string warehouse_id = "26103348825381";//二楼缓存仓 try { @@ -310,6 +312,7 @@ namespace Tnb.ProductionMgr collocation_scheme_id = kittingOutInput.collocation_scheme_id, collocation_scheme_code = wmsCollocationSchemeH.bill_code, source_id = prdKittingOutH.id, + source_code = prdKittingOutH.code, create_id = _userManager.UserId, wmsKittingoutDs = new List(), } @@ -344,7 +347,6 @@ namespace Tnb.ProductionMgr } else { - prdKittingOutH.code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDKITTINGOUTSTOCK_CODE); prdKittingOutH.warehouse_id = warehouse_id; prdKittingOutH.location_code = kittingOutInput.location_code; prdKittingOutH.material_id = basMaterial.id; @@ -358,6 +360,7 @@ namespace Tnb.ProductionMgr prdKittingOutH.create_id = _userManager.UserId; prdKittingOutH.create_time = DateTime.Now; prdKittingOutH.org_id = _userManager.GetUserInfo().Result.organizeId; + prdKittingOutH.status = DictConst.OUTSTOCKSTATUSADD; List prdKittingOutDs = new(); foreach (WmsCollocationSchemeD item in wmsCollocationSchemeDs) { @@ -401,5 +404,38 @@ namespace Tnb.ProductionMgr } } + + /// + /// 齐套出库 一般出库 物料出库 改状态 + /// + /// + /// + [HttpPost] + public async Task ChangeStatusById(List inputs) + { + // if(string.IsNullOrEmpty(input.code) || string.IsNullOrEmpty(input.type) || string.IsNullOrEmpty(input.status)) + // throw Oops.Bah("参数错误"); + if (inputs == null || inputs.Count <= 0) + { + throw Oops.Bah("参数错误"); + } + + ISqlSugarClient db = _repository.AsSugarClient(); + + foreach (var input in inputs) + { + if (input.type == "0") + { + await db.Updateable().SetColumns(x => x.status == input.status) + .Where(x => x.code == input.code).ExecuteCommandAsync(); + }else if (input.type == "1" || input.type == "2") + { + await db.Updateable().SetColumns(x => x.status == input.status) + .Where(x => x.bill_code == input.code).ExecuteCommandAsync(); + } + } + + return true; + } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs index afa9dd37..d677dcf0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdOutstockService.cs @@ -147,6 +147,11 @@ namespace Tnb.ProductionMgr string locationId = location.id; + PrdOutstockH prdOutstockH = new() + { + bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE), + }; + 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; @@ -154,6 +159,8 @@ namespace Tnb.ProductionMgr input.outstock.warehouse_id = warehouse_id; input.outstock.create_id = _userManager.UserId; input.outstock.location_code = location?.location_code ?? ""; + input.outstock.source_code = prdOutstockH.bill_code; + input.outstock.source_id = prdOutstockH.id; OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(generalOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); List materialIds = generalOutstockInput.details.Select(x => x.material_id).ToList(); @@ -195,20 +202,17 @@ namespace Tnb.ProductionMgr } else { - PrdOutstockH prdOutstockH = new() - { - bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE), - bill_type = DictConst.SHENGCHANLINGLIAO, - type = "1", - 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"), - create_time = DateTime.Now, - workstation_id = generalOutstockInput.workstation_id, - workline = workline?.Id ?? "" - }; + prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO; + prdOutstockH.type = "1"; + 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.create_time = DateTime.Now; + prdOutstockH.workstation_id = generalOutstockInput.workstation_id; + prdOutstockH.workline = workline?.Id ?? ""; + prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD; List prdOutstockDs = new(); foreach (GeneralOutstockDInput item in generalOutstockInput.details) @@ -266,6 +270,11 @@ namespace Tnb.ProductionMgr BasLocation location = await db.Queryable().Where(x=>x.location_code==materialOutstockInput.location_code).FirstAsync(); if (location == null) throw Oops.Bah("未找到库位"); string locationId = location.id; + + PrdOutstockH prdOutstockH = new() + { + bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE), + }; input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO; // input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now; @@ -274,6 +283,8 @@ namespace Tnb.ProductionMgr input.outstock.warehouse_id = warehouse_id; input.outstock.create_id = _userManager.UserId; input.outstock.location_code = location?.location_code ?? ""; + input.outstock.source_code = prdOutstockH.bill_code; + input.outstock.source_id = prdOutstockH.id; OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(materialOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode); List materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList(); @@ -315,8 +326,6 @@ namespace Tnb.ProductionMgr } else { - PrdOutstockH prdOutstockH = new PrdOutstockH(); - prdOutstockH.bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE); prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO; prdOutstockH.type = "2"; prdOutstockH.warehouse_id = warehouse_id; @@ -327,6 +336,7 @@ namespace Tnb.ProductionMgr prdOutstockH.create_time = DateTime.Now; prdOutstockH.workstation_id = materialOutstockInput.workstation_id; prdOutstockH.workline = workline?.Id ?? ""; + prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD; List prdOutstockDs = new List(); foreach (var item in materialOutstockInput.details)