diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs index 334e96a3..047513d0 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdInstockService.cs @@ -198,7 +198,8 @@ namespace Tnb.ProductionMgr codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"), }); } - string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + string domain = "http://tnb.tuotong-tech.com"; Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] @@ -264,22 +265,31 @@ namespace Tnb.ProductionMgr string equip_code = input.equip_code; string label_code = input.label_code; string warehouse_id = "2"; - if (!string.IsNullOrEmpty(equip_code)) + if (string.IsNullOrEmpty(equip_code)) { throw Oops.Bah("请传机台号"); } - if (!string.IsNullOrEmpty(label_code)) + if (string.IsNullOrEmpty(label_code)) { throw Oops.Bah("请传标签号"); } ISqlSugarClient db = _repository.AsSugarClient(); - EqpEquipment equipment = await db.Queryable() - .LeftJoin((x,y)=>x.id==y.equip_id) - .Where((x,y) => y.equip_code==equip_code && y.label_name==label_code && y.label_point=="提报装箱称重点位") - .Select((x,y)=>x) - .FirstAsync(); + EqpEquipment equipment = null; + try + { + equipment = await db.Queryable() + .LeftJoin((x,y)=>x.id==y.equip_id) + .Where((x,y) => y.equip_code==equip_code && y.label_name==label_code && y.label_point=="提报装箱称重点位") + .Select((x,y)=>x) + .FirstAsync(); + } + catch (Exception e) + { + Console.WriteLine(e); + throw; + } if (equipment == null) { throw Oops.Bah("未找到机台"); @@ -299,6 +309,9 @@ namespace Tnb.ProductionMgr PrdReport prdReport = await db.Queryable() .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("未找到提报记录"); @@ -317,14 +330,14 @@ namespace Tnb.ProductionMgr { bill_type = DictConst.CHANCHENGPINRUKUDAN, bill_date = DateTime.Now, - create_id = _userManager.UserId, + create_id = create_id, location_code = basLocation.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, + org_id = org_id, // warehouse_id = basLocation?.wh_id, warehouse_id = warehouse_id, status = 0, @@ -338,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, }); }); @@ -349,13 +362,13 @@ 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, warehouse_id = warehouse_id, source_id = prdInstockH.id, - create_id = _userManager.UserId, + create_id = create_id, carry_code = prdReport.material_box_code, location_code = basLocation.location_code, is_check = 1, @@ -368,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, }); @@ -378,18 +391,20 @@ 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 = (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() { - ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] + // ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] }; 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 () => { @@ -488,7 +503,8 @@ namespace Tnb.ProductionMgr code_batch = prdReport.barcode + "0001", codeqty = (int)prdReport.reported_qty, }); - string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + string domain = "http://tnb.tuotong-tech.com"; Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] @@ -598,7 +614,8 @@ namespace Tnb.ProductionMgr code_batch = prdReport.barcode + "0001", codeqty = (int)prdReport.reported_qty, }); - string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + string domain = "http://tnb.tuotong-tech.com"; Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] @@ -782,7 +799,8 @@ namespace Tnb.ProductionMgr }); } - string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + // string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host; + string domain = "http://tnb.tuotong-tech.com"; Dictionary header = new() { ["Authorization"] = App.HttpContext.Request.Headers["Authorization"] diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index e066aff7..68c9993b 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -1500,10 +1500,12 @@ namespace Tnb.ProductionMgr report = input.Adapt(); report.id = SnowflakeIdHelper.NextId(); report.reported_qty = input.reported_qty; + report.material_box_code = input.material_box_qrcode; 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+"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/PrdPackReportService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs index 28c0ada2..98fd2342 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdPackReportService.cs @@ -421,7 +421,7 @@ namespace Tnb.ProductionMgr .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)) + .Where((a, b) => a.workstation_id == input.stationId) .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)) diff --git a/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs b/ProductionMgr/Tnb.ProductionMgr/RedisBackGround.cs index d675772a..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(5)); + Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300)); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs index fcf87c52..1e68aef0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WareHouseService.cs @@ -318,7 +318,7 @@ namespace Tnb.WarehouseMgr x.bill_code = $"{groupCode}-1"; } } - else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum < areaPreTasks.Count) + else if ((moveNum >= areaPreTasks.Count && areaPreTasks.Count > 1) || moveNum <= areaPreTasks.Count) { string groupCode = await _billRullService.GetBillNumber(WmsWareHouseConst.WMS_TASK_EXECUTE_ENCODE); items.ForEach(x => x.is_chain = 1); diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs index d2df50e3..4a7c9c3c 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsCheckTaskService.cs @@ -243,6 +243,7 @@ namespace Tnb.WarehouseMgr endlocation_id = ePoint?.location_id!, endlocation_code = ePoint?.location_code!, startpoint_id = sPoint?.id!, + startpoint_code = sPoint?.point_code!, endpoint_id = ePoint?.id!, endpoint_code = ePoint?.point_code!, start_floor = sPoint?.floor.ToString(), @@ -391,7 +392,7 @@ namespace Tnb.WarehouseMgr var carryCodes = await _db.Queryable().InnerJoin((a, b) => a.id == b.location_id) .InnerJoin((a, b, c) => b.carry_id == c.id) .Where(filterExp) - .Select((a, b, c) => new WmsCarryCode { carry_code = c.carry_code }, true) + .Select() .ToListAsync(); List outputs = carryCodes.GroupBy(g => new { g.material_code, g.code_batch, g.location_code, g.carry_id }).Select(x => new WmsCheckstockD diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs index ce05775b..6e52bfdb 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsInStockService.cs @@ -6,6 +6,7 @@ using JNPF.EventBus; using JNPF.FriendlyException; using JNPF.Systems.Interfaces.System; using Mapster; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -267,6 +268,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] + [AllowAnonymous] public async Task MESCreateInstock(MESCreateInstockInput input) { bool isSuccessFul = false; @@ -308,8 +310,8 @@ namespace Tnb.WarehouseMgr instock.location_id = loc.id; instock.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID; instock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_INSTOCK_ENCODE).GetAwaiter().GetResult(); - instock.generate_type = "1";// 自动 - instock.sync_status = WmsWareHouseConst.SYNC_STATUS__NOTSYNC;//未同步 + instock.generate_type = "0";// 人工 + instock.sync_status = WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC;//无需同步 instock.print_status = WmsWareHouseConst.PRINT_STATUS_PRINTCOMPLETE;//已打印 instock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增 instock.create_time = DateTime.Now; @@ -347,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(); //生成预任务申请 @@ -370,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, @@ -387,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; @@ -446,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(); @@ -498,6 +500,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] + [AllowAnonymous] public async Task MesFetchInOutStockInfoByBarCode(MaterialLabelQuery input) { if (input.IsNull()) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 1ef4e5e4..804bdde7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -13,6 +13,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.Linq; using SqlSugar; @@ -551,6 +552,7 @@ namespace Tnb.WarehouseMgr /// [HttpPost] //[NonUnify] + [AllowAnonymous] public async Task MESCreateOutstock(MESCreateOutstockInput input) { bool isSuccessful = true; @@ -574,8 +576,8 @@ namespace Tnb.WarehouseMgr outstock.location_id = location.id; outstock.biz_type = WmsWareHouseConst.BIZTYPE_WMSOUTSTOCK_ID; outstock.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_OUTSTOCK_ENCODE).GetAwaiter().GetResult(); - outstock.generate_type = "1";// 自动 - outstock.sync_status = WmsWareHouseConst.SYNC_STATUS__NOTSYNC;//未同步 + outstock.generate_type = "0";// 自动 + outstock.sync_status = WmsWareHouseConst.SYNC_STATUS_NONEEDSYNC;//未同步 outstock.status = WmsWareHouseConst.BILLSTATUS_ADD_ID;// 新增 outstock.create_id = _userManager.UserId; outstock.create_time = DateTime.Now; diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs index c24b1456..e49d74db 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsSignForDeliveryService.cs @@ -2,6 +2,7 @@ using JNPF.Common.Extension; using JNPF.Systems.Interfaces.System; using Mapster; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -114,6 +115,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] + [AllowAnonymous] public async Task MESCarrySign(MESCarrySignInput input) { if (input.IsNull()) diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs index 4345e405..c0c22bc8 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmskittingOutService.cs @@ -12,6 +12,7 @@ using JNPF.LinqBuilder; using JNPF.Logging; using JNPF.Systems.Interfaces.System; using Mapster; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using SqlSugar; using Tnb.BasicData.Entities; @@ -391,6 +392,7 @@ namespace Tnb.WarehouseMgr /// /// [HttpPost] + [AllowAnonymous] public async Task MESKittingOutStk(List input) { bool isSuccessFul = false; diff --git a/apihost/Tnb.API.Entry/Startup.cs b/apihost/Tnb.API.Entry/Startup.cs index 1efe0fb4..3dbfefd2 100644 --- a/apihost/Tnb.API.Entry/Startup.cs +++ b/apihost/Tnb.API.Entry/Startup.cs @@ -57,7 +57,7 @@ public class Startup : AppStartup //定时任务 services.AddHostedService(); - //services.AddHostedService(); + services.AddHostedService(); }