diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs index b8de7235..dd579252 100644 --- a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/PrdMoFromOneListOutput.cs @@ -142,7 +142,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage } - public class PrdMoReverseFromMaterialput + public class PrdMoReverseFromMaterialoutput { /// /// 物料ID @@ -153,6 +153,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// public string material_code { get; set; } /// + /// 物料名称 + /// + public string material_name { get; set; } + /// + /// 物料规格 + /// + public string material_standard { get; set; } + /// /// 批次 /// public string code_batch { get; set;} @@ -208,6 +216,12 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 已投数量 /// public decimal feeding_num { get; set; } + /// + /// 使用状态 + /// + public string use_status { get; set; } + public string supplier_name { get; set; } + public string unit_name { get; set; } } /// @@ -234,6 +248,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage /// 投料子表id /// public string feeding_detail_id { get; set; } + public string mo_task_code { get; set; } public string feeding_time { get; set; } public decimal num { get; set; } public string check_conclusion { get; set; } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs new file mode 100644 index 00000000..bc60501a --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Entity/AppPrdMoTaskOneListOutput.cs @@ -0,0 +1,26 @@ +namespace Tnb.ProductionMgr.Entities +{ + public class AppPrdMoTaskOneListOutput + { + public string id { get; set; } + public string mo_task_code { get; set; } + public string mo_task_status { get; set; } + public string material_id { get; set; } + public string material_id_id { get; set; } + public string material_code { get; set; } + public string material_name { get; set; } + public string mold_id { get; set; } + public string mold_id_id { get; set; } + public string mold_code { get; set; } + public string eqp_id { get; set; } + public string eqp_id_id { get; set; } + public string equip_code { get; set; } + public int? scheduled_qty { get; set; } + public int? reported_work_qty { get; set; } + public int? scrap_qty { get; set; } + + public string plan_start_date { get; set; } + + public string plan_end_date { get; set; } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs new file mode 100644 index 00000000..8f6b2219 --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskOneService.cs @@ -0,0 +1,97 @@ +using COSXML.Model.Tag; +using JNPF.Common.Core.Manager; +using JNPF.Common.Filter; +using JNPF.DependencyInjection; +using JNPF.DynamicApiController; +using JNPF.Systems.Entitys.System; +using JNPF.Systems.Interfaces.System; +using JNPF.VisualDev; +using JNPF.VisualDev.Entitys.Dto.VisualDevModelData; +using JNPF.VisualDev.Interfaces; +using Microsoft.AspNetCore.Mvc; +using SqlSugar; +using Tnb.ProductionMgr.Entities; +using Tnb.BasicData.Entities; +using Tnb.EquipMgr.Entities; +using Tnb.BasicData; + +namespace Tnb.ProductionMgr.APP +{ + /// + /// 移动端注塑挤出任务管理 + /// + [ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)] + [Route("api/[area]/[controller]/[action]")] + [OverideVisualDev(ModuleId)] + public class AppPrdMoTaskOneService : IOverideVisualDevService, IDynamicApiController, ITransient + { + private const string ModuleId = "27890354204949"; + private readonly ISqlSugarRepository _repository; + private readonly IUserManager _userManager; + private readonly IRunService _runService; + private readonly IVisualDevService _visualDevService; + private readonly ISqlSugarClient _db; + private readonly IBillRullService _billRuleService; + + public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); + public AppPrdMoTaskOneService( + ISqlSugarRepository repository, + IUserManager userManager, + IDictionaryDataService dictionaryDataService, + IRunService runService, + IBillRullService billRullService, + IVisualDevService visualDevService + ) + { + _repository = repository; + _userManager = userManager; + _runService = runService; + _visualDevService = visualDevService; + _db = _repository.AsSugarClient(); + OverideFuncs.GetListAsync = GetList; + _billRuleService = billRullService; + } + + private async Task GetList(VisualDevModelListQueryInput input) + { + var db = _repository.AsSugarClient(); + Dictionary queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject>(input.queryJson) : new Dictionary(); + string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : ""; + string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : ""; + string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : ""; + var result = await db.Queryable() + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a, b, c) => a.mold_id == c.id) + .LeftJoin((a, b, c, d) => a.eqp_id == d.id) + .LeftJoin((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId) + .WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code)) + .WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code)) + .WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code)) + .Where(a => a.schedule_type == 1) + .Where(a => (a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode || a.mo_task_status==DictConst.MoStatusExceptionCode || a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ComplatedEnCode)) + .OrderByDescending(a => a.create_time) + .Select((a, b, c, d, e) => new AppPrdMoTaskOneListOutput + { + id = a.id, + mo_task_code = a.mo_task_code, + mo_task_status = e.FullName, + material_id_id = a.material_id, + material_id = b.code, + material_code = b.code, + material_name = b.name, + mold_id_id = a.mold_id, + mold_id = c.mold_code, + mold_code = c.mold_code, + eqp_id_id = a.eqp_id, + eqp_id = d.code, + equip_code = d.code, + scheduled_qty = a.scheduled_qty, + reported_work_qty = a.reported_work_qty, + scrap_qty = a.scrap_qty, + plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"), + plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"), + }).ToPagedListAsync(input.currentPage, input.pageSize); + return PageResult.SqlSugarPageResult(result); + } + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs index baffc63b..4f4b9344 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoService.cs @@ -873,12 +873,24 @@ namespace Tnb.ProductionMgr } else { - PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter()); + PageResult output = JsonConvert.DeserializeObject>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter()); if (output.list != null && output.list.Count > 0) { + BasMaterial basMaterial = await _db.Queryable().SingleAsync(x=>x.id==output.list[0].material_id); + BasSupplier basSupplier = await _db.Queryable().SingleAsync(x=>x.id==output.list[0].supplier_id); + DictionaryDataEntity unit = await _db.Queryable() + .LeftJoin((a,b)=>a.Id==b.DictionaryTypeId) + .Where((a,b)=>a.EnCode==DictConst.MeasurementUnit && b.EnCode==output.list[0].unit_id) + .Select((a,b)=>b) + .FirstAsync(); output.list[0].feeding_num = await _db.Queryable() .LeftJoin((a, b) => a.id == b.material_receipt_detail_id) .Where((a, b) => a.barcode == barcode).SumAsync((a, b) => b.num); + output.list[0].material_name = basMaterial.name; + output.list[0].material_standard = basMaterial.material_standard; + output.list[0].supplier_name = basSupplier.supplier_name; + output.list[0].unit_name = unit.FullName; + return output.list[0]; } } diff --git a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs index 71dcbc55..53e42bfa 100644 --- a/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/PrdMoTaskService.cs @@ -2062,7 +2062,7 @@ namespace Tnb.ProductionMgr }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "延期成功" : result.ErrorMessage; + return result.IsSuccess ? "更换成功" : result.ErrorMessage; } @@ -2109,7 +2109,7 @@ namespace Tnb.ProductionMgr }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "延期成功" : result.ErrorMessage; + return result.IsSuccess ? "更换成功" : result.ErrorMessage; } @@ -2156,9 +2156,43 @@ namespace Tnb.ProductionMgr }); if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage); - return result.IsSuccess ? "延期成功" : result.ErrorMessage; + return result.IsSuccess ? "更换成功" : result.ErrorMessage; } + + /// + /// 根据id获取任务单相关信息 + /// + /// + [HttpPost] + public async Task GetPrdMoTaskInfoById(Dictionary dic) + { + string id = dic.ContainsKey("id") ? dic["id"] : ""; + if (string.IsNullOrEmpty(id)) return null; + var db = _repository.AsSugarClient(); + return await db.Queryable() + .LeftJoin((a, b) => a.material_id == b.id) + .LeftJoin((a, b, c) => a.mold_id == c.id) + .LeftJoin((a, b, c, d) => a.eqp_id == d.id) + .LeftJoin((a,b,c,d,e)=>e.EnCode==a.mo_task_status && e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId) + .Where((a, b, c, d) => a.id == id) + .Select((a, b, c, d,e) => new + { + id = a.id, + mo_task_code = a.mo_task_code, + mo_task_status = e.FullName, + material_id = a.material_id, + material_code = b.code, + material_name = b.name, + mold_id = a.mold_id, + mold_code = c.mold_code, + equip_code = d.code, + scheduled_qty = a.scheduled_qty, + reported_work_qty = a.reported_work_qty, + scrap_qty = a.scrap_qty, + }).FirstAsync(); + + } } }