From 88e6fb700e6b12a0911be263f6bf4aa1c17b9e55 Mon Sep 17 00:00:00 2001 From: zhoukeda <1315948824@qq.com> Date: Wed, 22 Nov 2023 17:33:12 +0800 Subject: [PATCH] 1 --- .../Tnb.ProductionMgr/PrdInstockService.cs | 15 +++++++++------ .../Tnb.ProductionMgr/PrdMoTaskService.cs | 3 ++- .../Tnb.ProductionMgr/RedisBackGround.cs | 2 +- .../Tnb.WarehouseMgr/WmsInStockService.cs | 12 ++++++------ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs index 94e4ef29..047513d0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -310,6 +310,8 @@ namespace Tnb.ProductionMgr .Where(x => x.equip_id == equipment.id && x.status == 0).OrderByDescending(x => x.create_time) .FirstAsync(); string create_id = prdReport.create_id; + UserEntity user = await db.Queryable().SingleAsync(x => x.Id == create_id); + string org_id = user.OrganizeId; if (prdReport == null) { throw Oops.Bah("未找到提报记录"); @@ -335,7 +337,7 @@ namespace Tnb.ProductionMgr station_id = prdReport.station, workline_id = workline?.Id ?? "", workshop_id = workshop?.Id ?? "", - // org_id = _userManager.GetUserInfo().Result.organizeId, + org_id = org_id, // warehouse_id = basLocation?.wh_id, warehouse_id = warehouse_id, status = 0, @@ -349,7 +351,7 @@ namespace Tnb.ProductionMgr material_code = basMaterial.code, unit_id = prdReport.unit_id, barcode = prdReport.barcode, - code_batch = prdReport.barcode + "0001", + code_batch = prdReport.mo_task_code, quantity = (int)prdReport.reported_qty, }); }); @@ -360,7 +362,7 @@ namespace Tnb.ProductionMgr { instock = new MESWmsInstockHInput() { - // org_id = _userManager.GetUserInfo().Result.organizeId, + org_id = org_id, bill_date = DateTime.Now, bill_type = DictConst.CHANCHENGPINRUKUDAN, // warehouse_id = basLocation?.wh_id, @@ -379,7 +381,7 @@ namespace Tnb.ProductionMgr material_id = prdReport.material_id, material_code = basMaterial.code, unit_id = prdReport.unit_id, - code_batch = prdReport.barcode, + code_batch = prdReport.mo_task_code, pr_qty = (int)prdReport.reported_qty, }); @@ -389,10 +391,11 @@ namespace Tnb.ProductionMgr material_code = basMaterial.code, unit_id = prdReport.unit_id, barcode = prdReport.barcode, - code_batch = prdReport.barcode + "0001", + code_batch = prdReport.mo_task_code, codeqty = (int)prdReport.reported_qty, }); // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + // string domain = "http://localhost:9232"; string domain = "http://tnb.tuotong-tech.com"; Dictionary header = new() { @@ -401,7 +404,7 @@ namespace Tnb.ProductionMgr string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK, JsonConvert.SerializeObject(mesCreateInstockInput), header); Log.Information(sendResult); AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - result2 = authResponse.code != 200 || !authResponse.data.ObjToBool() + result2 = authResponse.code != 200 || !(bool)authResponse.data ? throw Oops.Bah(authResponse.msg) : await db.Ado.UseTranAsync(async () => { diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index e066aff7..54907b70 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1503,7 +1503,8 @@ namespace Tnb.ProductionMgr report.create_id = _userManager.UserId; report.create_time = DateTime.Now; // report.batch = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString(); - report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString(); + // report.barcode = input.mo_task_code + DateTimeOffset.Now.ToUnixTimeSeconds().ToString(); + report.barcode = input.mo_task_code+"0001"; report.equip_id = prdMoTask.eqp_id; report.mbom_process_id = prdMoTask.mbom_process_id; report.station = input.station; diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index c1147aa9..26f84823 100644 --- a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs +++ b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs @@ -220,7 +220,7 @@ namespace Tnb.ProductionMgr } public Task StartAsync(CancellationToken cancellationToken) { - Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(60)); + Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300)); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index 8f7d7e26..3572aee8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -349,7 +349,7 @@ namespace Tnb.WarehouseMgr instockCOdes.Add(c); } } - string orgId = _userManager.User.OrganizeId; + string orgId = _userManager.User?.OrganizeId ?? input.instock.org_id; _ = await _db.Insertable(instockCOdes).CallEntityMethod(it => it.Create(orgId)).ExecuteCommandAsync(); //生成预任务申请 @@ -372,7 +372,7 @@ namespace Tnb.WarehouseMgr WmsPretaskH preTask = new() { - org_id = _userManager.User.OrganizeId, + org_id = orgId, startlocation_id = sPoint?.location_id ?? string.Empty, startlocation_code = sPoint?.location_code ?? string.Empty, endlocation_id = ePoint?.location_id ?? string.Empty, @@ -389,7 +389,7 @@ namespace Tnb.WarehouseMgr area_code = it.Key, require_id = instock?.id ?? string.Empty, require_code = instock?.bill_code ?? string.Empty, - create_id = _userManager.UserId, + create_id = instock.create_id, create_time = DateTime.Now }; return preTask; @@ -448,16 +448,16 @@ namespace Tnb.WarehouseMgr { WmsHandleCode handleCode = jo.Adapt(); handleCode.id = SnowflakeIdHelper.NextId(); - handleCode.org_id = _userManager.User.OrganizeId; + handleCode.org_id = orgId; handleCode.bill_id = operBillId; - handleCode.create_id = _userManager.UserId; + handleCode.create_id = instock.create_id; handleCode.create_time = DateTime.Now; preTaskUpInput.PreTaskHandleCodes.Add(handleCode); } } //生成载具条码记录 List carryCodes = preTaskUpInput.PreTaskHandleCodes.Adapt>(); - + carryCodes.ForEach(x => { x.id = SnowflakeIdHelper.NextId();