From cba5adf5f3d1faf5f81f0f40e2a9f5718be40392 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 21 Jul 2023 10:31:19 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E9=BD=90=E5=A5=97=E6=90=AD=E9=85=8D?= =?UTF-8?q?=E6=96=B9=E6=A1=88=EF=BC=8C=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Inputs/MESCollocationSchemeQueryInput.cs | 3 ++- .../Dto/Outputs/CollocationSchemeOutput.cs | 6 ++++++ .../IWmsCollocationSchemeSevice.cs | 2 +- .../Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs | 14 ++++++++------ .../Tnb.WarehouseMgr/WmsSetSortingService.cs | 1 - .../Tnb.WarehouseMgr/WmskittingOutService.cs | 5 ++++- 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs index 9ad7c3c1..26ea874e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Inputs/MESCollocationSchemeQueryInput.cs @@ -3,10 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using JNPF.Common.Filter; namespace Tnb.WarehouseMgr.Entities.Dto.Inputs { - public class MESCollocationSchemeQueryInput + public class MESCollocationSchemeQueryInput : PageInputBase { /// /// 齐套出库主表 diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs index 6986be71..1a23c508 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; +using Org.BouncyCastle.Asn1.Mozilla; using SqlSugar; namespace Tnb.WarehouseMgr.Entities.Dto.Outputs @@ -64,7 +65,12 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 齐套明细输出 /// + [JsonIgnore] public List? CollocationSchemeDs { get; set; } + /// + /// 齐套明细Json + /// + public string CollocationSchemeDsJson { get; set; } [JsonIgnore] public List? list { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs index 9e25e026..06731b64 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Interfaces/IWmsCollocationSchemeSevice.cs @@ -17,6 +17,6 @@ namespace Tnb.WarehouseMgr.Interfaces /// /// /// - Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input); + Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input); } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs index 1a15b5d0..4c367e00 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCollocationSchemeSevice.cs @@ -7,6 +7,7 @@ using Aop.Api.Domain; using Aspose.Cells.Drawing; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Extension; +using JNPF.Common.Filter; using JNPF.DependencyInjection; using JNPF.DynamicApiController; using JNPF.FriendlyException; @@ -15,6 +16,7 @@ using JNPF.VisualDev.Entitys; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using SqlSugar; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Dto.Inputs; @@ -89,25 +91,25 @@ namespace Tnb.WarehouseMgr /// [HttpPost] //[NonUnify] - public async Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input) + public async Task MESCollocationSchemeQuery(MESCollocationSchemeQueryInput input) { if (input.IsNull()) throw new ArgumentNullException("input"); - var data = new List(); + SqlSugarPagedList pageData = new(); try { - data = await _db.Queryable() + pageData = await _db.Queryable() .Where(a => a.material_id == input.material_id) .Select(a => new CollocationSchemeOutput { list = SqlFunc.Subqueryable().Where(b => b.bill_id == a.id).ToList(), }, true) - .Mapper(it => it.CollocationSchemeDs = it.list?.Adapt>()) - .ToListAsync(); + .Mapper(it => it.CollocationSchemeDsJson = JsonConvert.SerializeObject(it.list)) + .ToPagedListAsync(input.currentPage, input.pageSize); } catch (Exception) { } - return data; + return pageData == null ? Enumerable.Empty() : PageResult.SqlSugarPageResult(pageData); } } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs index 079c898c..671d6354 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSetSortingService.cs @@ -314,7 +314,6 @@ namespace Tnb.WarehouseMgr 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(); } var carry = await _db.Queryable().SingleAsync(it => it.id == carryId); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 7a649a6b..4f4ad195 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Linq.Expressions; using System.Text; using System.Threading.Tasks; +using System.Transactions; using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; @@ -304,7 +305,7 @@ namespace Tnb.WarehouseMgr carrys.Add(carry); if (carrys?.Count > 0) { - await _db.Ado.BeginTranAsync(); + await _db.Ado.BeginTranAsync(); var tasks = new List>(); foreach (var carryIt in carrys) { @@ -313,7 +314,9 @@ namespace Tnb.WarehouseMgr var all = await Task.WhenAll(tasks); await _db.Ado.CommitTranAsync(); if (all.All(x => x > 0)) + { isOk = all?.Length > 0; + } } } if (!isOk) throw Oops.Oh(ErrorCode.COM1001); From 9b14c845e6010716736b492d85f53b9e1005d40b Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Fri, 21 Jul 2023 13:29:06 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E9=BD=90=E5=A5=97=E5=87=BA=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Consts/WebApiConst.cs | 3 + .../Entity/PrdKittingOutD.cs | 57 +++++++++ .../Entity/PrdKittingOutH.cs | 97 ++++++++++++++++ .../IPrdKittingOutService.cs | 10 ++ .../Tnb.ProductionMgr/PrdKittingOutService.cs | 108 ++++++++++++++++++ 5 files changed, 275 insertions(+) create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutD.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutH.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs create mode 100644 ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs diff --git a/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs b/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs index bc6ff7f8..c4488373 100644 --- a/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs +++ b/BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs @@ -12,6 +12,9 @@ namespace Tnb.BasicData //生产出库接口 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"; #endregion diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutD.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutD.cs new file mode 100644 index 00000000..d0245679 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutD.cs @@ -0,0 +1,57 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities; + +/// +/// mes齐套出库子表 +/// +[SugarTable("prd_kitting_out_d")] +public partial class PrdKittingOutD : BaseEntity +{ + public PrdKittingOutD() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 物料ID + /// + public string material_id { get; set; } = string.Empty; + + /// + /// 物料编号 + /// + public string? material_code { get; set; } + + /// + /// 单位ID + /// + public string? unit_id { get; set; } + + /// + /// 单位代码 + /// + public string? unit_code { get; set; } + + /// + /// 批次 + /// + public string? code_batch { get; set; } + + /// + /// 数量(件数) + /// + public decimal pr_qty { get; set; } + + /// + /// 箱数 + /// + public int box { get; set; } + + /// + /// q齐套出库id + /// + public string kitting_out_id { get; set; } = string.Empty; + +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutH.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutH.cs new file mode 100644 index 00000000..c5fd5cbc --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdKittingOutH.cs @@ -0,0 +1,97 @@ +using JNPF.Common.Contracts; +using JNPF.Common.Security; +using SqlSugar; + +namespace Tnb.ProductionMgr.Entities; + +/// +/// mes齐套出库主表 +/// +[SugarTable("prd_kitting_out_h")] +public partial class PrdKittingOutH : BaseEntity +{ + public PrdKittingOutH() + { + id = SnowflakeIdHelper.NextId(); + } + /// + /// 出库仓库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? worklinei_d { get; set; } + + /// + /// 任务单 + /// + public string? mo_task_id { get; set; } + +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs new file mode 100644 index 00000000..b86a0354 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdKittingOutService.cs @@ -0,0 +1,10 @@ +namespace Tnb.ProductionMgr.Interfaces +{ + /// + /// MES齐套出库接口 + /// + public interface IPrdKittingOutService + { + + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs new file mode 100644 index 00000000..598f9a33 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/PrdKittingOutService.cs @@ -0,0 +1,108 @@ +using JNPF; +using JNPF.Common.Core.Manager; +using JNPF.Common.Dtos.VisualDev; +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.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using SqlSugar; +using Tnb.BasicData; +using Tnb.BasicData.Entities; +using Tnb.ProductionMgr.Entities; +using Tnb.ProductionMgr.Interfaces; +using Tnb.WarehouseMgr.Entities.Dto.Inputs; + +namespace Tnb.ProductionMgr +{ + /// + /// 生产领料 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class PrdKittingOutService : IOverideVisualDevService, IPrdKittingOutService, IDynamicApiController, ITransient + { + private const string ModuleId = "27565198830357"; + private readonly ISqlSugarRepository _repository; + private readonly ISqlSugarClient _db; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + private readonly IDictionaryDataService _dictionaryDataService; + private readonly IUserManager _userManager; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + + public PrdKittingOutService(ISqlSugarRepository repository, IRunService runService, IUserManager userManager,IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService) + { + _db = repository.AsSugarClient(); + _runService = runService; + _visualDevService = visualDevService; + _dictionaryDataService = dictionaryDataService; + _repository = repository; + _userManager = userManager; + OverideFuncs.CreateAsync = Create; + } + + private async Task Create(VisualDevModelDataCrInput visualDevModelDataCrInput) + { + try + { + var db = _repository.AsSugarClient(); + + List input = new List(); + visualDevModelDataCrInput.data["code"] = "111"; + input.Add(new MESKittingOutStkInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + bill_date = DateTime.Now, + warehouse_id = visualDevModelDataCrInput.data.ContainsKey("warehouse_id") ? visualDevModelDataCrInput.data["warehouse_id"].ToString() : "", + location_code = visualDevModelDataCrInput.data.ContainsKey("location_code") ? visualDevModelDataCrInput.data["location_code"].ToString() : "", + material_id = visualDevModelDataCrInput.data.ContainsKey("material_id") ? visualDevModelDataCrInput.data["material_id"].ToString() : "", + material_code = visualDevModelDataCrInput.data.ContainsKey("material_code") ? visualDevModelDataCrInput.data["material_code"].ToString() : "", + collocation_scheme_id = visualDevModelDataCrInput.data.ContainsKey("collocation_scheme_id") ? visualDevModelDataCrInput.data["collocation_scheme_id"].ToString() : "", + collocation_scheme_code = visualDevModelDataCrInput.data.ContainsKey("collocation_scheme_code") ? visualDevModelDataCrInput.data["collocation_scheme_code"].ToString() : "", + source_id = visualDevModelDataCrInput.data.ContainsKey("code") ? visualDevModelDataCrInput.data["code"].ToString() : "", + // source_id = "123", + seq = visualDevModelDataCrInput.data.ContainsKey("seq") ? (int)visualDevModelDataCrInput.data["seq"] : 0, + create_id = _userManager.UserId, + wmsKittingoutDs = new List(), + }); + + input[0].wmsKittingoutDs = JsonConvert.DeserializeObject>(JsonConvert.SerializeObject(visualDevModelDataCrInput.data["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); + Log.Information(sendResult); + + AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); + if (authResponse.code != 200) + { + throw Oops.Bah(authResponse.msg); + } + else + { + VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true); + await _runService.Create(templateEntity, visualDevModelDataCrInput); + } + 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 87d4cb949bf4dcc7e15515059899d7275a8fe754 Mon Sep 17 00:00:00 2001 From: FanLian Date: Fri, 21 Jul 2023 14:16:57 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E8=BD=BD=E5=85=B7=E6=B8=85=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index 2e8b719b..c2d99f8a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -172,7 +172,8 @@ namespace Tnb.WarehouseMgr carryObj.collocation_scheme_code = null; carryObj.source_id = null; carryObj.source_code = null; - row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync(); + Task.Run(() => _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync()); + //row = await _db.CopyNew().Updateable(carryObj).ExecuteCommandAsync(); //删除对应明细表 //删除载具明细 await _db.CopyNew().Deleteable().Where(it => it.carry_id == carryObj.id).ExecuteCommandHasChangeAsync(); @@ -183,12 +184,13 @@ namespace Tnb.WarehouseMgr } catch (Exception ex) { - Log.Error("更新空载具出错",ex); + Log.Error("更新空载具出错", ex); throw; } return row; } + private async Task _updateSubCarry(ExChangeCarryInput input) where T : BaseEntity, IWmsCarryEntity, new() { var row = -1; From 843a3abeda69679854969cca83436d3016a0413c Mon Sep 17 00:00:00 2001 From: FanLian Date: Fri, 21 Jul 2023 14:17:07 +0800 Subject: [PATCH 4/8] 1 --- WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs index c2d99f8a..ad7988b0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCarryService.cs @@ -157,7 +157,7 @@ namespace Tnb.WarehouseMgr [NonAction] public async Task UpdateNullCarry(WmsCarryH carryObj) { - var row = -1; + var row = 1; try { carryObj.status = 0; @@ -184,6 +184,7 @@ namespace Tnb.WarehouseMgr } catch (Exception ex) { + row = 0; Log.Error("更新空载具出错", ex); throw; } From ddb5f7c826a3251abf5dc6405f7d1eb3c8ca2efb Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 21 Jul 2023 14:17:23 +0800 Subject: [PATCH 5/8] =?UTF-8?q?wms=20=E9=80=9A=E7=94=A8=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E9=A2=84=E4=BB=BB=E5=8A=A1=E6=89=A7=E8=A1=8C=EF=BC=8C=E7=BB=99?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E9=93=BE=E7=BB=84=E5=8F=B7=E8=B5=8B=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/Outputs/CollocationSchemeOutput.cs | 2 +- .../Tnb.WarehouseMgr/WareHouseService.cs | 44 +++++++++++++------ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs index 1a23c508..64ee7215 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Dto/Outputs/CollocationSchemeOutput.cs @@ -70,7 +70,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Outputs /// /// 齐套明细Json /// - public string CollocationSchemeDsJson { get; set; } + public string CollocationSchemeDsJson { get; set; }=string.Empty; [JsonIgnore] public List? list { get; set; } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index c2114d31..f38354e8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -25,6 +25,7 @@ using Mapster; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis; +using NPOI.HPSF; using NPOI.OpenXmlFormats.Wordprocessing; using Polly.Timeout; using Senparc.Weixin.Work.AdvancedAPIs.OaDataOpen; @@ -187,6 +188,7 @@ namespace Tnb.WarehouseMgr //任务链属性处理内部函数 async Task _taskChainAttrHandle(List items, List areaPreTasks, int moveNum) { + var groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); await Task.Run(() => { if (moveNum == 1 || (moveNum > areaPreTasks.Count && areaPreTasks.Count == 1)) @@ -194,19 +196,34 @@ namespace Tnb.WarehouseMgr items.ForEach(x => { x.is_chain = 0; - }); + items[^items.Count].groups = $"{groupCode}-1"; } else if ((moveNum > areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count) { items.ForEach(x => x.is_chain = 1); - //items[0].chain_type = "1"; - //for (int i = 0; i < items.Count; i++) - //{ - // if (i == 0 || i == items.Count - 1) continue; - // items[i].chain_type = "2"; - //} - //items[^1].chain_type = "3"; + var mod = items.Count % moveNum > 0 ? items.Count / moveNum + 1 : items.Count / moveNum; + int start = 0, end = moveNum; + var arrary = items.ToArray(); + var itemsCount = items.Count; + for (int i = 1; i <= mod; i++) + { + if (start >= itemsCount) break; + var subArray = arrary[start..end]; + for (int j = 0, arrLen = subArray.Length; j < arrLen; j++) + { + subArray[j].groups = $"{groupCode}-{i}"; + } + start = end; + if ((end + moveNum) >= arrary.Length) + { + end = arrary.Length; + } + else + { + end = end + moveNum; + } + } } }); @@ -234,12 +251,13 @@ namespace Tnb.WarehouseMgr { var moveNum = itGroup.First().move_num; var items = itGroup.Adapt>(); - items.ForEach(x => + for (int i = 0, cnt = items.Count; i < cnt; i++) { - x.id = SnowflakeIdHelper.NextId(); - x.status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; - x.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE).GetAwaiter().GetResult(); - }); + var num = i + 1; + items[i].id = SnowflakeIdHelper.NextId(); + items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; + items[i].bill_code = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); + } if (moveNum == 1) { From 8ac457c3393049533f11d9b05962b3a05b5376f6 Mon Sep 17 00:00:00 2001 From: FanLian Date: Fri, 21 Jul 2023 14:54:43 +0800 Subject: [PATCH 6/8] 1 --- .../Tnb.WarehouseMgr/WmskittingOutService.cs | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 4f4ad195..35b71c63 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -341,11 +341,21 @@ namespace Tnb.WarehouseMgr if (input.IsNull()) throw new ArgumentNullException(nameof(input)); try { - var kittingOut = input[^1]; - var curCarry = await _db.Queryable().SingleAsync(it => it.id == kittingOut.carry_id); - var endLocation = await _db.Queryable().SingleAsync(it => it.id == kittingOut.location_id); - var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, endLocation); - if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + //var kittingOut = input[^1]; + //if ((!kittingOut.carry_id.IsNullOrEmpty() || !kittingOut.carry_code.IsNullOrEmpty()) && !kittingOut.location_code.IsNullOrEmpty()) + //{ + // WmsCarryH? curCarry = null; + // if (!kittingOut.carry_id.IsNullOrEmpty()) + // curCarry = await _db.Queryable().SingleAsync(it => it.id == kittingOut.carry_id); + // else + // curCarry = await _db.Queryable().FirstAsync(it => it.carry_code == kittingOut.carry_code); + + // var endLocation = await _db.Queryable().SingleAsync(it => it.id == kittingOut.location_code); + // var isMatch = await IsCarryAndLocationMatchByCarryStd(curCarry, endLocation); + // if (!isMatch) throw new AppFriendlyException("该载具无法放置到目标库位", 500); + + //} + await _db.Ado.BeginTranAsync(); List kittingOutDs = new(); From 0cb51f68b5a270d85f21b70af57217756b622189 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 21 Jul 2023 14:57:44 +0800 Subject: [PATCH 7/8] 1 --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index f38354e8..11c847da 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -253,7 +253,6 @@ namespace Tnb.WarehouseMgr var items = itGroup.Adapt>(); for (int i = 0, cnt = items.Count; i < cnt; i++) { - var num = i + 1; items[i].id = SnowflakeIdHelper.NextId(); items[i].status = WmsWareHouseConst.TASK_BILL_STATUS_DZX_ID; items[i].bill_code = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); From bd4157609a59888ff84f578de44e831f25a084bb Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 21 Jul 2023 14:58:58 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E8=A7=A3=E5=86=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index 11c847da..eabdffe4 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -525,7 +525,7 @@ namespace Tnb.WarehouseMgr if (arr.Length > 1) { var subArr = arr[..^1]; - Array.ForEach(subArr, a => a.chain_type = "1"); + System.Array.ForEach(subArr, a => a.chain_type = "1"); } } }