diff --git a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs index 17e095c4..7f9ea3db 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Interfaces/IPrdFeedingService.cs @@ -3,7 +3,7 @@ using Tnb.ProductionMgr.Entities.Dto; namespace Tnb.ProductionMgr.Interfaces { /// - /// 物料签收服务接口 + /// 物料投料服务接口 /// public interface IPrdFeedingService { diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs index 32bc5917..6ecc1bdf 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingService.cs @@ -27,7 +27,7 @@ using Tnb.BasicData; namespace Tnb.ProductionMgr { /// - /// 业务实现:物料签收 + /// 业务实现:物料投料 /// [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] [Route("api/[area]/[controller]/[action]")] @@ -159,7 +159,7 @@ namespace Tnb.ProductionMgr } if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage); - return result.IsSuccess ? "签收成功" : result.ErrorMessage; + return result.IsSuccess ? "投料成功" : result.ErrorMessage; } [HttpPost] @@ -272,34 +272,34 @@ namespace Tnb.ProductionMgr // carry_code = input.carry_code ?? "", // }); - var mesCarrySignInput = new MESCarrySignInput() - { - org_id = _userManager.GetUserInfo().Result.organizeId, - 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); - Log.Information(sendResult); - AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); - if (authResponse.code != 200) - { - throw Oops.Bah(authResponse.msg); - } - else - { - result2 = await db.Ado.UseTranAsync(async () => - { - await db.Insertable(prdFeedingH).ExecuteCommandAsync(); - await db.Insertable(list).ExecuteCommandAsync(); - }); - - } + // var mesCarrySignInput = new MESCarrySignInput() + // { + // org_id = _userManager.GetUserInfo().Result.organizeId, + // 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); + // Log.Information(sendResult); + // AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); + // if (authResponse.code != 200) + // { + // throw Oops.Bah(authResponse.msg); + // } + // else + // { + // result2 = await db.Ado.UseTranAsync(async () => + // { + // await db.Insertable(prdFeedingH).ExecuteCommandAsync(); + // await db.Insertable(list).ExecuteCommandAsync(); + // }); + // + // } } if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage); diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs index bf6d721d..bdb2348f 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptService.cs @@ -1,11 +1,16 @@ +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.Interfaces.System; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.ProductionMgr.Entities; @@ -14,6 +19,13 @@ 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; namespace Tnb.ProductionMgr { @@ -71,6 +83,9 @@ namespace Tnb.ProductionMgr public async Task SaveData(MaterialReceiptInput input) { var db = _repository.AsSugarClient(); + DbResult result2 = new DbResult(); + PrdMaterialReceiptH prdMaterialReceiptH = null; + List list = new List(); DbResult result = await db.Ado.UseTranAsync(async () => { var moTask = await db.Queryable().FirstAsync(x => x.id == input.mo_task_id); @@ -80,7 +95,7 @@ namespace Tnb.ProductionMgr .ToListAsync(); string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE); - PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH() + prdMaterialReceiptH = new PrdMaterialReceiptH() { code = code, station_id = input.station_id, @@ -125,13 +140,54 @@ namespace Tnb.ProductionMgr } - 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.Oh(result.ErrorMessage); - return result.IsSuccess ? "签收成功" : result.ErrorMessage; + + if (result.IsSuccess) + { + //签收后调用载具签收接口 + // await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput() + // { + // org_id = _userManager.GetUserInfo().Result.organizeId, + // create_id = _userManager.UserId, + // carry_code = input.carry_code ?? "", + // }); + + var mesCarrySignInput = new MESCarrySignInput() + { + org_id = _userManager.GetUserInfo().Result.organizeId, + 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); + Log.Information(sendResult); + AuthResponse authResponse = JsonConvert.DeserializeObject(sendResult); + if (authResponse.code != 200) + { + throw Oops.Bah(authResponse.msg); + } + else + { + result2 = await db.Ado.UseTranAsync(async () => + { + await db.Insertable(prdMaterialReceiptH).ExecuteCommandAsync(); + await db.Insertable(list).ExecuteCommandAsync(); + }); + + } + } + + if(!result2.IsSuccess) throw Oops.Oh(result2.ErrorMessage); + return result2.IsSuccess ? "签收成功" : result2.ErrorMessage; } } } \ No newline at end of file