From 1257b4e7eecb18a6db8f6c2591d82b5ef0d7fc61 Mon Sep 17 00:00:00 2001 From: zhou keda <1315948824@qq.com> Date: Wed, 28 Aug 2024 17:18:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96=20?= =?UTF-8?q?=E6=88=90=E5=93=81=E8=B0=83=E6=8B=A8=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Tnb.EquipMgr/EqpRepairApplyService.cs | 30 ++++- .../PackSechelToBeIssueListOutput.cs | 10 ++ .../Dto/PrdManage/PrdMoListTreeOutput.cs | 9 +- .../Dto/PrdManage/PrdMoTaskIssueListOutput.cs | 9 ++ .../PrdManage/PrdRawMaterialBarcodeListDto.cs | 10 ++ .../Entity/PrdRawMaterialBarcode.cs | 5 + .../Entity/PrdRawMaterialBarcodeRecord.cs | 4 + .../PrdFeedingRecordUpServicecs.cs | 2 + .../PrdMaterialReceiptRecordUpServicecs.cs | 2 + .../PrdMoTaskIssueService.cs | 2 + .../Tnb.ProductionMgr/PrdMoTaskService.cs | 12 +- .../PrdRawMaterialBarcodeRecordService.cs | 110 +++++++++++++++ .../PrdRawMaterialBarcodeRecordTwoService.cs | 2 + .../PrdRawMaterialBarcodeService.cs | 4 +- .../PrdRawMaterialBarcodeTwoService.cs | 2 + QcMgr/Tnb.QcMgr/QcCheckTaskService.cs | 7 +- .../Consts/WmsWareHouseConst.cs | 5 + .../Tnb.WarehouseMgr/WmsPrdInstockHService.cs | 1 - .../WmsRawmatTransferinstockService.cs | 3 +- .../WmsTransferInstockService.cs | 126 ++++++++++++++++++ 20 files changed, 339 insertions(+), 16 deletions(-) create mode 100644 ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs index 9d92a6e5..2a3a7c83 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -170,22 +170,44 @@ namespace Tnb.EquipMgr [HttpPost] public async Task Receive(Dictionary dic) { + // string id = dic["id"]; + // EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); + // if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED) + // { + // if (_userManager.UserId == eqpRepairApply.repairer_id) + // { + // _ = await _repository.UpdateAsync(x => new EqpRepairApply() + // { + // status = RepairApplyStatus.RECEIVED, + // }, x => x.id == id); + // return "接收成功"; + // } + // else + // { + // throw Oops.Bah("该任务没有指派给您,无法接收"); + // } + // } + // else + // { + // throw Oops.Bah("状态错误"); + // } + string id = dic["id"]; EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x => x.id == id); if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED) { - if (_userManager.UserId == eqpRepairApply.repairer_id) + if (await _repository.AsSugarClient().Queryable().AnyAsync(x => x.UserId == _userManager.UserId && x.ObjectId == "26586914497557")) { _ = await _repository.UpdateAsync(x => new EqpRepairApply() { status = RepairApplyStatus.RECEIVED, }, x => x.id == id); return "接收成功"; - } - else + }else { - throw Oops.Bah("该任务没有指派给您,无法接收"); + throw Oops.Bah("不是设备管理部的,无法接收"); } + } else { diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs index a4c7475a..1fc9976f 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PackSechelToBeIssueListOutput.cs @@ -103,6 +103,16 @@ /// 夜班后人员id/ /// public string nightshiftafter_worker_id { get; set; } + + /// + /// 物料规格 + /// + public string? material_specification { get; set; } + + /// + /// 物料型号 + /// + public string? material_standard { get; set; } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs index 5e2f9f03..b8b43e83 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoListTreeOutput.cs @@ -27,9 +27,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// public string material_name { get; set; } = string.Empty; /// - /// 物料规格型号 + /// 物料规格 /// - public string? material_standard { get; set; } = string.Empty; + public string? material_specification { get; set; } + + /// + /// 物料型号 + /// + public string? material_standard { get; set; } /// /// 工单类型:1-正常工单、2-返工工单、3-试制工单 diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs index d7bd3437..79b029a5 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoTaskIssueListOutput.cs @@ -33,5 +33,14 @@ namespace Tnb.ProductionMgr.Entities.Dto /// 夜班后人员id/ /// public string nightshiftafter_worker_id { get; set; } + /// + /// 物料规格 + /// + public string? f_flowtaskid { get; set; } + + /// + /// 物料型号 + /// + public string? f_flowid { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs index 58a22755..08574107 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdRawMaterialBarcodeListDto.cs @@ -94,5 +94,15 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage public string material_id_id { get; set; } public string f_flowid { get; set; } + + /// + /// 物料规格 + /// + public string? f_flowtaskid { get; set; } + + /// + /// 物料型号 + /// + public string extras { get; set; } } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcode.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcode.cs index d18baa73..e0f58138 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcode.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcode.cs @@ -98,5 +98,10 @@ public partial class PrdRawMaterialBarcode : BaseEntity /// 所属组织 /// public string? org_id { get; set; } + + /// + /// 扩展字段 + /// + public string extras { get; set; } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcodeRecord.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcodeRecord.cs index b6310261..1252f321 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcodeRecord.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/PrdRawMaterialBarcodeRecord.cs @@ -99,4 +99,8 @@ public partial class PrdRawMaterialBarcodeRecord : BaseEntity /// public string? org_id { get; set; } + /// + /// 扩展字段 + /// + public string extras { get; set; } } \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingRecordUpServicecs.cs b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingRecordUpServicecs.cs index cb882800..3dfb2db8 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdFeedingRecordUpServicecs.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdFeedingRecordUpServicecs.cs @@ -51,6 +51,7 @@ namespace Tnb.ProductionMgr Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string mo_code = queryJson.ContainsKey("mo_id") ? queryJson["mo_id"].ToString() : ""; + string workstation_id = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : ""; // string workstation_id_str = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : ""; // string workstation_id = ""; // if (!string.IsNullOrEmpty(workstation_id_str)) @@ -81,6 +82,7 @@ namespace Tnb.ProductionMgr .LeftJoin((a,b,c,d,e,f)=>a.workline_id==f.Id) .WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code)) .WhereIF(!string.IsNullOrEmpty(mo_code),(a,b,c,d,e)=>d.mo_code.Contains(mo_code)) + .WhereIF(!string.IsNullOrEmpty(workstation_id),(a,b,c,d,e)=>workstation_id.Contains(a.workstation_id)) .Where(a=>a.act_start_date!=null) .OrderBy($"{input.sidx} {input.sort}") .Select((a, b, c, d,e,f) => new PrdFeedingRecordUpListOutPut() diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptRecordUpServicecs.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptRecordUpServicecs.cs index 3de5b470..361d759e 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptRecordUpServicecs.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMaterialReceiptRecordUpServicecs.cs @@ -51,6 +51,7 @@ namespace Tnb.ProductionMgr Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; string mo_code = queryJson.ContainsKey("mo_id") ? queryJson["mo_id"].ToString() : ""; + string workstation_id = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : ""; // string workstation_id_str = queryJson.ContainsKey("workstation_id") ? queryJson["workstation_id"].ToString() : ""; // string workstation_id = ""; // if (!string.IsNullOrEmpty(workstation_id_str)) @@ -81,6 +82,7 @@ namespace Tnb.ProductionMgr .LeftJoin((a,b,c,d,e,f)=>a.workline_id==f.Id) .WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code)) .WhereIF(!string.IsNullOrEmpty(mo_code),(a,b,c,d,e)=>d.mo_code.Contains(mo_code)) + .WhereIF(!string.IsNullOrEmpty(workstation_id),(a,b,c,d,e)=>workstation_id.Contains(a.workstation_id)) .Where(a=>a.act_start_date!=null) .OrderBy($"{input.sidx} {input.sort}") .Select((a, b, c, d,e,f) => new PrdMaterialReceiptRecordUpListOutPut() diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs index 123204c6..5a6e4dda 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskIssueService.cs @@ -116,6 +116,8 @@ namespace Tnb.ProductionMgr id = a.id, mo_task_code = a.mo_task_code, material_id = b.code + "/" + b.name, + f_flowtaskid = b.material_specification, + f_flowid = b.material_standard, mold_id = e.mold_code + "/" + e.mold_name, eqp_id = g.code + "/" + g.name, mo_task_status = d.FullName, diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 724c7c3f..bb8d4e55 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -402,16 +402,19 @@ namespace Tnb.ProductionMgr .LeftJoin((a, b) => a.workline_id == b.Id) .LeftJoin((a, b, c) => a.mo_id == c.id) .LeftJoin((a, b, c, d) => a.bom_id == d.id) + .LeftJoin((a,b,c,d,e)=>a.material_id==e.id) .WhereIF(!string.IsNullOrEmpty(input.mo_task_code), (a, b, c, d) => a.mo_task_code.Contains(input.mo_task_code)) .Where((a, b, c, d) => a.schedule_type == 2 && string.IsNullOrEmpty(a.parent_id)) .OrderByDescending(a => a.create_time) - .Select((a, b, c, d) => new PackSechelToBeIssueListOutput + .Select((a, b, c, d,e) => new PackSechelToBeIssueListOutput { mo_task_id = a.id, mo_task_code = a.mo_task_code, material_id = a.material_id, - material_code = SqlFunc.Subqueryable().Where(it => it.id == a.material_id).Select(it => it.code), - material_name = SqlFunc.Subqueryable().Where(it => it.id == a.material_id).Select(it => it.name), + material_code = e.code, + material_name = e.name, + material_specification = e.material_specification, + material_standard = e.material_standard, workline_id = a.workline_id, workline_code = b.EnCode, workline_name = b.FullName, @@ -629,7 +632,8 @@ namespace Tnb.ProductionMgr mo_code = a.mo_code, material_code = b.code, material_name = b.name, - material_standard = b.material_specification, + material_specification = b.material_specification, + material_standard = b.material_standard, mo_type = c.FullName, mo_status = d.FullName, plan_qty = a.plan_qty.Value.ToString(), diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs new file mode 100644 index 00000000..ed778212 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordService.cs @@ -0,0 +1,110 @@ +using JNPF; +using JNPF.Common.Core.Manager; +using JNPF.Common.Dtos.VisualDev; +using JNPF.Common.Extension; +using JNPF.Common.Filter; +using JNPF.Common.Security; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.FriendlyException; +using JNPF.Logging; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; +using Mapster; +using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using Senparc.CO2NET.HttpUtility; +using SqlSugar; +using Tnb.BasicData; +using Tnb.BasicData.Entities; +using Tnb.Common.Extension; +using Tnb.EquipMgr.Entities; +using Tnb.ProductionMgr.Entities; +using Tnb.WarehouseMgr.Entities.Configs; +using Tnb.Common.Utils; +using Tnb.WarehouseMgr.Entities.Consts; +using HttpClientHelper = Tnb.Common.Utils.HttpClientHelper; +using Tnb.Common.Redis; +using Tnb.ProductionMgr.Entities.Dto.PrdManage; + +namespace Tnb.ProductionMgr +{ + /// + /// 料仓原料条码服务 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class PrdRawMaterialBarcodeRecordService: IOverideVisualDevService,IDynamicApiController, ITransient + { + private const string ModuleId = "36014705051669"; + private readonly ISqlSugarClient _db; + private readonly IDictionaryDataService _dictionaryDataService; + private readonly IUserManager _userManager; + private static Dictionary> _dicWorkLine = new(); + private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build(); + private readonly IBillRullService _billRuleService; + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + private readonly IVisualDevService _visualDevService; + private readonly IRunService _runService; + private readonly RedisData _redisData; + + public PrdRawMaterialBarcodeRecordService(ISqlSugarRepository repository, + IUserManager userManager, + IBillRullService billRuleService, + IVisualDevService visualDevService, + RedisData redisData, + IRunService runService, + IDictionaryDataService dictionaryDataService) + { + _db = repository.AsSugarClient(); + _userManager = userManager; + _billRuleService = billRuleService; + _dictionaryDataService = dictionaryDataService; + _visualDevService = visualDevService; + _runService = runService; + _redisData = redisData; + OverideFuncs.GetListAsync = GetList; + } + + private async Task GetList(VisualDevModelListQueryInput input) + { + Dictionary? queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string billCode = queryJson.ContainsKey("bill_code") ? queryJson["bill_code"].ToString() : ""; + string equipTypeId = queryJson.ContainsKey("f_flowid") ? queryJson["f_flowid"].ToString() : ""; + string isUpdate = queryJson.ContainsKey("is_update") ? queryJson["is_update"].ToString() : ""; + + SqlSugarPagedList result = await _db.Queryable() + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a, b,c) => a.equip_id == c.id) + .LeftJoin((a,b,c,d)=>c.equip_type_id==d.id) + .WhereIF(!string.IsNullOrEmpty(billCode),(a,b,c)=>a.bill_code.Contains(billCode)) + .WhereIF(!string.IsNullOrEmpty(equipTypeId),(a,b,c)=>c.equip_type_id==equipTypeId) + .WhereIF(!string.IsNullOrEmpty(isUpdate),(a,b,c)=>a.is_update.ToString()==isUpdate) + .Where((a,b,c)=>a.type=="1") + .Select((a, b, c,d) => new PrdRawMaterialBarcodeListDto + { + id = a.id, + bill_code = a.bill_code, + equip_id = c.name, + material_id = b.name, + absorb_material_finish = a.absorb_material_finish==1 ? "是" : "否", + is_update = a.is_update==1 ? "是" : "否", + start_time = a.start_time!=null ? a.start_time.ToString(DbTimeFormat.SS) : "", + end_time = a.end_time!=null ? a.end_time.ToString(DbTimeFormat.SS) : "", + remark = a.remark, + f_flowid = d.name, + equip_id_id = c.id, + material_id_id = b.id, + f_flowtaskid = b.material_specification, + extras = b.material_standard + }).ToPagedListAsync(input.currentPage, int.MaxValue); + return PageResult.SqlSugarPageResult(result); + } + + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs index ca13c53b..aac145c3 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeRecordTwoService.cs @@ -96,6 +96,8 @@ namespace Tnb.ProductionMgr bill_code = a.bill_code, equip_id = c.name, material_id = b.name, + f_flowtaskid = b.material_specification, + extras = b.material_standard, absorb_material_finish = a.absorb_material_finish==1 ? "是" : "否", is_update = a.is_update==1 ? "是" : "否", piping_status = a.piping_status == 1 ? "开" : "关", diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs index fc9bfcce..4037bc03 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeService.cs @@ -100,7 +100,9 @@ namespace Tnb.ProductionMgr remark = a.remark, f_flowid = d.name, equip_id_id = c.id, - material_id_id = b.id + material_id_id = b.id, + f_flowtaskid = b.material_specification, + extras = b.material_standard }).ToPagedListAsync(input.currentPage, int.MaxValue); return PageResult.SqlSugarPageResult(result); } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs index 8eb03053..cd9935e5 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdRawMaterialBarcodeTwoService.cs @@ -92,6 +92,8 @@ namespace Tnb.ProductionMgr bill_code = a.bill_code, equip_id = c.name, material_id = b.name, + f_flowtaskid = b.material_specification, + extras = b.material_standard, absorb_material_finish = a.absorb_material_finish==1 ? "是" : "否", is_update = a.is_update==1 ? "是" : "否", piping_status = a.piping_status == 1 ? "开" : "关", diff --git a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs index 567ecc44..b50b55b5 100644 --- a/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs +++ b/QcMgr/Tnb.QcMgr/QcCheckTaskService.cs @@ -387,16 +387,17 @@ namespace Tnb.QcMgr check_result = ((EnumCheckConclusion)dic[CheckTaskInput.result]).ToString(), },prdReport,db); } - }else if (QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID) + }else if (QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID || QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID || QcCheckExecH.checktype == WmsWareHouseConst.MOJIAN_ID ) { if (CheckTaskInput.result == "no") { PrdMoTask prdMoTask = await db.Queryable().Where(x=>x.mo_task_code==QcCheckExecH.mo_task_code && x.id!=null).FirstAsync(); - await _prdMoTaskService.PrdTaskRelease(new PrdTaskReleaseUpInput() + string pauseReason = QcCheckExecH.checktype == WmsWareHouseConst.XUNJIAN_ID ? "巡检不合格" : QcCheckExecH.checktype == WmsWareHouseConst.SHOUJIAN_ID ? "首检不合格" : "末检不合格"; + await _prdMoTaskService.PrdTaskRelease(new PrdTaskReleaseUpInput() { TaskIds = NPOI.Util.Arrays.AsList(prdMoTask.id), Behavior = "Pause", - PauseReeson = "巡检不合格" + PauseReeson = pauseReason }); List carryCodes = await db.Queryable().Where(x=>x.mo_task_id==prdMoTask.id).Select(x=>x.material_box_code).Distinct().ToListAsync(); await db.Updateable() diff --git a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs index cadb7618..8d2ce037 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr.Entities/Consts/WmsWareHouseConst.cs @@ -661,5 +661,10 @@ /// public const string FULLREVIEW_CODE = "FullReview"; + /// + /// 设备管理部id + /// + public const string EQUIPMANAGERORG_ID = "26586914497557"; + } } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs index 755fbb68..c637a41a 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsPrdInstockHService.cs @@ -335,7 +335,6 @@ namespace Tnb.WarehouseMgr //todo 产成品入库 List allInstockDetails = await _db.Queryable().Where(it => it.prd_instock_id == instock.id).ToListAsync(); - List materialIds = Arrays.AsList(instock.material_id); List unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList(); List unitDatas = await _db.Queryable() diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs index 4b93db57..4edc22b7 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsRawmatTransferinstockService.cs @@ -69,12 +69,12 @@ namespace Tnb.WarehouseMgr { throw new ArgumentNullException(nameof(input)); } + Logger.Information($"进入原材料调拨入库单上传BIP逻辑"); List wmsCarryCodes = await _db.Queryable().Where(r => r.carry_id == input.carryIds[0]).ToListAsync(); await _db.Updateable().SetColumns(it => new WmsRawmatTransferinstockD { actual_qty = it.actual_qty + wmsCarryCodes.Sum(r => r.codeqty) }) .Where(it => it.id == input.wmsDistaskH.source_id).ExecuteCommandHasChangeAsync(); - Logger.Information($"进入原材料调拨入库单上传BIP逻辑"); WmsInstockH instock = await _db.Queryable().SingleAsync(x => x.id == input.requireId); List allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); @@ -188,6 +188,7 @@ namespace Tnb.WarehouseMgr thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save"; thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData); thirdWebapiRecord.create_time = DateTime.Now; + thirdWebapiRecord.remark = "原材料调拨入库"; await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync(); Logger.Information($"完成原材料调拨入库单上传BIP逻辑"); } diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferInstockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferInstockService.cs index f0a56d27..40ed29c0 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferInstockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsTransferInstockService.cs @@ -7,21 +7,28 @@ using Aop.Api.Domain; using JNPF.Common.Core.Manager; using JNPF.Common.Dtos.VisualDev; using JNPF.Common.Enums; +using JNPF.Common.Security; using JNPF.FriendlyException; +using JNPF.Systems.Entitys.Permission; +using JNPF.Systems.Entitys.System; using JNPF.Systems.Interfaces.System; using JNPF.VisualDev; using JNPF.VisualDev.Interfaces; using Mapster; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using Newtonsoft.Json; using SqlSugar; using Tnb.BasicData.Entities; using Tnb.WarehouseMgr.Entities; using Tnb.WarehouseMgr.Entities.Attributes; using Tnb.WarehouseMgr.Entities.Consts; +using Tnb.WarehouseMgr.Entities.Dto; using Tnb.WarehouseMgr.Entities.Dto.Inputs; using Tnb.WarehouseMgr.Entities.Entity; using Tnb.WarehouseMgr.Interfaces; +using Tnb.BasicData; +using Tnb.ProductionMgr.Entities.Entity; namespace Tnb.WarehouseMgr { @@ -56,6 +63,125 @@ namespace Tnb.WarehouseMgr _wmsPDAScanInStock = wmsPDAScanInStock; } + public override async Task ModifyAsync(WareHouseUpInput input) + { + if (input == null) + { + throw new ArgumentNullException(nameof(input)); + } + Logger.Information($"进入成品调拨入库单上传BIP逻辑"); + + WmsInstockH instock = await _db.Queryable().SingleAsync(x => x.id == input.requireId); + List allInstockDetails = await _db.Queryable().Where(it => it.bill_id == input.requireId).ToListAsync(); + + string rawmatTransferinstockDId = input.source_id; + WmsRawmatTransferinstockD wmsRawmatTransferinstockD = await _db.Queryable().SingleAsync(x => x.id == rawmatTransferinstockDId); + string rawmatTransferinstockHId = wmsRawmatTransferinstockD?.bill_id ?? ""; + WmsRawmatTransferinstockH wmsRawmatTransferinstockH = await _db.Queryable().SingleAsync(x => x.id == rawmatTransferinstockHId); + + List materialIds = allInstockDetails.Select(x => x.material_id).Distinct().ToList(); + List unitCodes = allInstockDetails.Select(x => x.unit_id).Distinct().ToList(); + List unitDatas = await _db.Queryable() + .LeftJoin((x, y) => x.Id == y.DictionaryTypeId) + .Where((x, y) => x.EnCode == DictConst.MeasurementUnit && unitCodes.Contains(y.EnCode)) + .Select((x, y) => y) + .ToListAsync(); + List erpWarehouserelaHs = await _db.Queryable().Where(x=>x.id!=null).ToListAsync(); + BasWarehouse basWarehouse = await _db.Queryable().SingleAsync(x=>x.id==instock.warehouse_id); + string userAccount = wmsRawmatTransferinstockH?.biller ?? ""; + string deptCode = wmsRawmatTransferinstockH?.dept_code ?? ""; + UserEntity userEntity = await _db.Queryable().Where(x=>x.Account==userAccount).FirstAsync(); + string userId = userEntity?.Id ?? WmsWareHouseConst.AdministratorUserId; + + string supplierId = WmsWareHouseConst.TIANYIGONGYINGSHANG_ID; + List tableIds = new List(); + tableIds.Add(userId); + tableIds.Add(WmsWareHouseConst.AdministratorOrgId); + tableIds.Add(instock.warehouse_id); + tableIds.AddRange(materialIds); + tableIds.Add(supplierId); + tableIds.AddRange(unitDatas.Select(x => x.Id).ToList()); + + List erpExtendFields = await _db.Queryable().Where(x => tableIds.Contains(x.table_id)).ToListAsync(); + string erpCreateId = erpExtendFields.Find(x => x.table_id == userId)?.user_id ?? ""; + ErpExtendField erpOrg = erpExtendFields.Find(x => x.table_id == (WmsWareHouseConst.AdministratorOrgId)); + string nowStr = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + + List> requestData = new List>(); + Dictionary erpRequestData = new Dictionary(); + erpRequestData.Add("billmaker", erpCreateId); + erpRequestData.Add("cbiztype", ""); + erpRequestData.Add("cdptid","1001A1100000000JRLI1");//部门先写死 + erpRequestData.Add("cdptvid","0001A11000000007GGO8");//部门先写死 + erpRequestData.Add("corpoid", erpOrg.corpoid); + erpRequestData.Add("corpvid", erpOrg.corpvid); + erpRequestData.Add("creationtime", nowStr); + erpRequestData.Add("creator", erpCreateId); + // erpRequestData.Add("cwarehouseid", erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "");//类型视图里取 + erpRequestData.Add("cwarehouseid", erpWarehouserelaHs.Find(x => x.erp_warehousecode == basWarehouse.whcode)?.erp_warehouseid ?? "");//类型视图里取 + erpRequestData.Add("dbilldate", nowStr); + erpRequestData.Add("dmakedate", nowStr); + erpRequestData.Add("fbillflag", 1); + erpRequestData.Add("ntotalnum", allInstockDetails.Sum(x => x.qty)); + erpRequestData.Add("pk_org", erpOrg.pk_org); + erpRequestData.Add("pk_org_v", erpOrg.pk_org_v); + erpRequestData.Add("pk_group", erpOrg.pk_group); + erpRequestData.Add("vdef1", null); + erpRequestData.Add("vbillcode", instock.bill_code); + erpRequestData.Add("ctrantypeid", "0001H11000000000D31E");//先写死 + erpRequestData.Add("vtrantypecode", "4E-01");//先写死 + erpRequestData.Add("csourcebillhid", wmsRawmatTransferinstockH?.erp_pk ?? ""); + + + List> erpRequestDataDetails = new List>(); + foreach (WmsInstockD item in allInstockDetails) + { + erpRequestDataDetails.Add(new Dictionary() + { + ["cbodytranstypecode"] = "4E-01", + // ["cbodywarehouseid"] = erpExtendFields.Find(x => x.table_id == instock.warehouse_id)?.cotherwhid ?? "", + ["cbodywarehouseid"] = erpWarehouserelaHs.Find(x => x.erp_warehousecode == basWarehouse.whcode)?.erp_warehouseid ?? "", + ["cmaterialoid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialoid ?? "", + ["cmaterialvid"] = erpExtendFields.Find(x => x.table_id == item.material_id)?.cmaterialvid ?? "", + ["corpoid"] = erpOrg.corpoid, + ["corpvid"] = erpOrg.corpvid, + ["crowno"] = (allInstockDetails.FindIndex(x => x.id == item.id) + 1) * 10, + ["csourcebillhid"] = wmsRawmatTransferinstockH?.erp_pk ?? "", + ["csourcebillbid"] = wmsRawmatTransferinstockD?.erp_line_pk ?? "", + ["cunitid"] = erpExtendFields.Find(x => x.table_id == (unitDatas.Find(x => x.EnCode == item.unit_id)?.Id ?? ""))?.cunitid ?? "", + ["cvendorid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_id ?? "", + ["cvendorvid"] = erpExtendFields.Find(x => x.table_id == supplierId)?.supplier_vid ?? "", + ["dbizdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"), + ["dplanarrivedate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"), + ["dplanoutdate"] = instock.create_time.ToString("yyyy-MM-dd HH:mm:ss"), + // ["nnum"] = item.qty, + // ["nshouldnum"] = item.pr_qty, + ["nnum"] = wmsRawmatTransferinstockD.actual_qty, + ["nshouldnum"] = wmsRawmatTransferinstockD.actual_qty, + ["pk_group"] = erpOrg.pk_group, + ["pk_org"] = erpOrg.pk_org, + ["pk_org_v"] = erpOrg.pk_org_v, + ["vbatchcode"] = item.code_batch, + ["coutcalbodyoid"] = wmsRawmatTransferinstockH.outstockorg_code, + ["coutcalbodyvid"] = wmsRawmatTransferinstockH.outstockorg_id, + }); + } + erpRequestData.Add("dtls", erpRequestDataDetails); + requestData.Add(erpRequestData); + BasFactoryConfig config = await _db.Queryable().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.BIPURL); + ThirdWebapiRecord thirdWebapiRecord = new ThirdWebapiRecord(); + thirdWebapiRecord.id = SnowflakeIdHelper.NextId(); + thirdWebapiRecord.third_name = WmsWareHouseConst.BIP; + thirdWebapiRecord.name = "调拨入库"; + thirdWebapiRecord.method = "POST"; + // thirdWebapiRecord.url = config.value + "uapws/rest/transIn/save"; + thirdWebapiRecord.url = WmsWareHouseConst.BIP_DOMAIN + "uapws/rest/transIn/save"; + thirdWebapiRecord.request_data = JsonConvert.SerializeObject(requestData); + thirdWebapiRecord.create_time = DateTime.Now; + thirdWebapiRecord.remark = "成品调拨入库"; + await _db.Insertable(thirdWebapiRecord).ExecuteCommandAsync(); + Logger.Information($"完成成品调拨入库单上传BIP逻辑"); + } } }