diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs index e9a2cf48..e25142a3 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainRunUpInput.cs @@ -37,4 +37,10 @@ public string result { get; set; } } + public class MaintainItemResult + { + public string item_name { get; set; } + public string group_name { get; set; } + public string result { get; set; } + } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldStartWxInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldStartWxInput.cs new file mode 100644 index 00000000..2a861c76 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldStartWxInput.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.EquipMgr.Entities +{ + public class MoldStartWxInput + { + public string? id { get; set; } + } +} diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs index 30431bcc..85437eee 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadMainListOutput.cs @@ -16,5 +16,6 @@ public string plan_start_time { get; set; } public string starttime { get; set; } + public string finishtime { get; set; } } } diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs index 228f6286..d865e4e5 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs @@ -20,5 +20,6 @@ namespace Tnb.EquipMgr.Entities.Dto public string repairer_id { get; set; } public string repairer_id_id { get; set; } public string status { get; set; } + public string attachment { get; set; } } } \ No newline at end of file diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs index b077342b..e843dc6d 100644 --- a/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs +++ b/EquipMgr/Tnb.EquipMgr.Entities/Entity/ToolMoldMaintainTask.cs @@ -53,4 +53,12 @@ public partial class ToolMoldMaintainTask : BaseEntity /// public string status { get; set; } + public string? name { get; set; } + public string? attachment { get; set; } + public string? describe { get; set; } + + public int is_finish { get; set; } + public string? wxattachment { get; set; } + public string? wxdescribe { get; set; } + } diff --git a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs index 0617edca..9d92a6e5 100644 --- a/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs +++ b/EquipMgr/Tnb.EquipMgr/EqpRepairApplyService.cs @@ -397,7 +397,8 @@ namespace Tnb.EquipMgr repairer_id = c.RealName, repairer_id_id = c.Id, remark = a.remark, - status = f.FullName + status = f.FullName, + attachment=a.attachment }).ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs index 2ada52bb..63c0924d 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainRunService.cs @@ -196,33 +196,35 @@ namespace Tnb.EquipMgr else { input.sidx = "b." + input.sidx; + input.sort = "desc"; } List records = await _db.Queryable().Select(p => p.plan_id + p.mold_id).ToListAsync(); SqlSugarPagedList result = await _db.Queryable() .LeftJoin((a, b) => a.maintain_plan_id == b.id) .LeftJoin((a, b, c) => a.mold_id == c.id) .LeftJoin((a, b, c, d) => b.plan_code == d.plan_code && c.mold_code == d.mold_code) - .LeftJoin((a, b, c, d, e) => e.plan_id == b.id && e.mold_id == c.id) - .LeftJoin((a, b, c, d, e, f) => b.create_id == f.Id) - .LeftJoin((a, b, c, d, e, f, g) => c.mold_status == g.Id) + // .LeftJoin((a, b, c, d, e) => e.plan_id == b.id && e.mold_id == c.id) + .LeftJoin((a, b, c, d, e) => b.create_id == e.Id) + .LeftJoin((a, b, c, d, e, f) => c.mold_status == f.Id) .Where((a, b, c, d, e, f) => b.create_time != null) - .WhereIF(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f, g) => c.mold_code!.Contains(input.maintain_info) || c.mold_name!.Contains(input.maintain_info)) - .WhereIF(start_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time >= start_time) - .WhereIF(end_time != null, (a, b, c, d, e, f, g) => b.create_time != null && b.create_time <= end_time) - .WhereIF(input.status == "待保养", (a, b, c, d, e, f, g) => !records.Contains(a.maintain_plan_id + a.mold_id)) - .WhereIF(input.status == "已完成", (a, b, c, d, e, f, g) => records.Contains(a.maintain_plan_id + a.mold_id)) - .Select((a, b, c, d, e, f, g) => new PadMainListOutput + .WhereIF(!string.IsNullOrEmpty(input.maintain_info), (a, b, c, d, e, f) => c.mold_code!.Contains(input.maintain_info) || c.mold_name!.Contains(input.maintain_info)) + .WhereIF(start_time != null, (a, b, c, d, e, f) => b.create_time != null && b.create_time >= start_time) + .WhereIF(end_time != null, (a, b, c, d, e, f) => b.create_time != null && b.create_time <= end_time) + .WhereIF(input.status == "待保养", (a, b, c, d, e, f) => !records.Contains(a.maintain_plan_id + a.mold_id)) + .WhereIF(input.status == "已完成", (a, b, c, d, e, f) => records.Contains(a.maintain_plan_id + a.mold_id)) + .Select((a, b, c, d, e, f) => new PadMainListOutput { plan_id = b.id, mold_id = c.id, mold_code = c.mold_code!, mold_name = c.mold_name!, - mold_status = g.FullName!, + mold_status = f.FullName!, status = input.status, - createuser = f.RealName, + createuser = e.RealName, createtime = b.create_time == null ? "" : b.create_time.Value.ToString(DbTimeFormat.SS), plan_start_time = b.plan_start_date == null ? "" : b.plan_start_date.Value.ToString(DbTimeFormat.SS), starttime = d.plan_start_time == null ? "" : d.plan_start_time.Value.ToString(DbTimeFormat.SS), + finishtime= d.plan_end_time == null ? "" : d.plan_end_time.Value.ToString(DbTimeFormat.SS), }).OrderBy($"{input.sidx} {input.sort}").ToPagedListAsync(input?.currentPage ?? 1, input?.pageSize ?? 50); return PageResult.SqlSugarPageResult(result); } @@ -303,7 +305,23 @@ namespace Tnb.EquipMgr return items; } + [HttpPost] + public async Task GetMaintainItem(MoldMaintainRunUpInput input) + { + var data = await _db.Queryable() + .LeftJoin((a, b) => a.item_id == b.id) + .LeftJoin((a, b, c) => a.item_group_id == c.id) + .Where((a, b, c) => a.plan_id == input.plan_id && a.mold_id == input.mold_id) + .Select((a, b, c) => new MaintainItemResult + { + group_name = c.name!, + item_name = b.name!, + result = a.result, + }) + .ToListAsync(); + return data; + } /// /// 模具保养计划执行-开始模具保养 /// @@ -447,6 +465,11 @@ namespace Tnb.EquipMgr { throw new ArgumentException($"parameter {nameof(input.items)} not be null or empty"); } + var plan_code = _db.Queryable().Where(p => p.id == input.plan_id).Select(p=>p.plan_code).First(); + var mold_code = _db.Queryable().Where(p => p.id == input.mold_id).Select(p => p.mold_code).First(); + if (!string.IsNullOrEmpty(plan_code)&& !string.IsNullOrEmpty(mold_code)) { + _ = await _db.Updateable().SetColumns(it => new ToolMoldMaintainRunRecord { plan_end_time = DateTime.Now }).Where(it => it.plan_code == plan_code && it.mold_code== mold_code).ExecuteCommandAsync(); + } List records = new(); foreach (MaintainItemInfo item in input.items) @@ -505,6 +528,11 @@ namespace Tnb.EquipMgr } } + + + + + /// /// 模具保养计划执行-保养完成 /// diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs index 4979f99f..fcbe2d65 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainTaskService.cs @@ -1,4 +1,5 @@ -using JNPF.Common.Enums; +using JNPF.Common.Core.Manager; +using JNPF.Common.Enums; using JNPF.Common.Extension; using JNPF.DependencyInjection; using JNPF.DynamicApiController; @@ -29,16 +30,19 @@ namespace Tnb.EquipMgr private readonly IRunService _runService; private readonly IVisualDevService _visualDevService; private static Dictionary _dicMold = new(); + private readonly IUserManager _userManager; public ToolMoldMaintainTaskService( ISqlSugarRepository repository, IRunService runService, - IVisualDevService visualDevService + IVisualDevService visualDevService, + IUserManager userManager ) { _db = repository.AsSugarClient(); _runService = runService; _visualDevService = visualDevService; OverideFuncs.GetListAsync = GetList; + _userManager = userManager; //OverideFuncs.CreateAsync = Create; } public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc(); @@ -100,5 +104,23 @@ namespace Tnb.EquipMgr throw Oops.Oh(ErrorCode.COM1001); } } + + + /// + /// 开始维修 + /// + /// 输入参数 + /// + [HttpPost] + public async Task StartWx(MoldStartWxInput input) + { + DateTime? StartTime = DateTime.Now; + int row = await _db.Updateable().SetColumns(it => new ToolMoldMaintainTask { status = "WXZ", modify_strat_time = StartTime, modify_id = _userManager.UserId }) + .Where(it => input.id == it.id).ExecuteCommandAsync(); + if (row < 1) + { + throw Oops.Oh(ErrorCode.COM1001); + } + } } } diff --git a/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPdaListInput.cs b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPdaListInput.cs new file mode 100644 index 00000000..aaaf32af --- /dev/null +++ b/ProductionMgr/Tnb.ProductionMgr.Entities/Dto/PrdManage/AndonPdaListInput.cs @@ -0,0 +1,9 @@ +using JNPF.Common.Filter; +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace Tnb.ProductionMgr.Entities.Dto +{ + public class AndonPdaListInput : PageInputBase + { + } +} \ No newline at end of file diff --git a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs index 2f873ee0..1a350944 100644 --- a/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs +++ b/ProductionMgr/Tnb.ProductionMgr/AndonRecordService.cs @@ -68,17 +68,75 @@ namespace Tnb.ProductionMgr andon_info_name = b.name, promoter_name = d.RealName, repair_name = c.RealName, - promoter_time = a.create_time == null ? "" : a.create_time.Value.ToString("yyyy-MM-dd hh:mm:ss"), - response_time = a.response_time == null ? "" : a.response_time.Value.ToString("yyyy-MM-dd hh:mm:ss"), - start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString("yyyy-MM-dd hh:mm:ss"), - end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString("yyyy-MM-dd hh:mm:ss"), - confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString("yyyy-MM-dd hh:mm:ss"), + promoter_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + response_time = a.response_time == null ? "" : a.response_time.Value.ToString(DbTimeFormat.SS), + start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString(DbTimeFormat.SS), + end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString(DbTimeFormat.SS), + confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString(DbTimeFormat.SS), status = f.FullName, }).ToPagedListAsync(input.currentPage, input.pageSize); return PageResult.SqlSugarPageResult(result); } + + [HttpPost] + public async Task GetAndonPdaList(AndonPdaListInput input) + { + Dictionary queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary() : input.queryJson.ToObject>(); + string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : ""; + List statusList = new(); + if (!string.IsNullOrEmpty(status)) + { + switch (status) + { + case "1": + statusList.Add(DictConst.AndonStatusHJZ); + break; + case "2": + statusList.Add(DictConst.AndonStatusYXY); + statusList.Add(DictConst.AndonStatusCLZ); + break; + case "3": + statusList.Add(DictConst.AndonStatusDQR); + statusList.Add(DictConst.AndonStatusYWC); + break; + } + } + if (string.IsNullOrEmpty(input.sidx)) + { + input.sidx = "create_time"; + input.sort = "desc"; + } + + + SqlSugarPagedList result = await _db.Queryable() + .LeftJoin((a, b) => a.andon_info_id == b.id) + .LeftJoin((a, b, c) => a.repair_id == c.Id) + .LeftJoin((a, b, c, d) => a.create_id == d.Id) + .LeftJoin((a, b, c, d, e) => e.EnCode == DictConst.AndonStatus) + .LeftJoin((a, b, c, d, e, f) => a.status == f.EnCode && e.Id == f.DictionaryTypeId) + .WhereIF(statusList.Count > 0, a => statusList.Contains(a.status)) + .Select((a, b, c, d, e, f) => new AndonPadListOutput + { + id = a.id, + andon_info_name = b.name, + promoter_name = d.RealName, + repair_name = c.RealName, + promoter_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS), + response_time = a.response_time == null ? "" : a.response_time.Value.ToString(DbTimeFormat.SS), + start_repair_time = a.start_repair_time == null ? "" : a.start_repair_time.Value.ToString(DbTimeFormat.SS), + end_repair_time = a.end_repair_time == null ? "" : a.end_repair_time.Value.ToString(DbTimeFormat.SS), + confirm_time = a.confirm_time == null ? "" : a.confirm_time.Value.ToString(DbTimeFormat.SS), + status = f.FullName, + }) + .MergeTable() + .OrderBy($"{input.sidx} {input.sort}") + .ToPagedListAsync(input.currentPage, input.pageSize); + + return PageResult.SqlSugarPageResult(result); + + } [HttpPost] public async Task AddAndon(AddAndonInput input) @@ -247,19 +305,28 @@ namespace Tnb.ProductionMgr AndonRecords andonRecords = await _db.Queryable().SingleAsync(x => x.id == id); if (andonRecords != null) { - if (andonRecords.status != DictConst.AndonStatusYXY) + if (andonRecords.repair_id!=_userManager.UserId) { - throw Oops.Bah($"状态错误"); + UserEntity user = await _db.Queryable().SingleAsync(x => x.Id == andonRecords.repair_id); + throw Oops.Bah($"您不是处理人"); } else { - _ = await _db.Updateable() - .SetColumns(x => x.start_repair_time == DateTime.Now) - .Where(x => x.id == id) - .ExecuteCommandAsync(); - return true; + if (andonRecords.status != DictConst.AndonStatusYXY) + { + throw Oops.Bah($"状态错误"); + } + else + { + _ = await _db.Updateable() + .SetColumns(x => x.start_repair_time == DateTime.Now) + .Where(x => x.id == id) + .ExecuteCommandAsync(); + return true; + } } + } else { @@ -274,19 +341,28 @@ namespace Tnb.ProductionMgr AndonRecords andonRecords = await _db.Queryable().SingleAsync(x => x.id == id); if (andonRecords != null) { - if (andonRecords.status != DictConst.AndonStatusCLZ) + if (andonRecords.repair_id!=_userManager.UserId) { - throw Oops.Bah($"状态错误"); + UserEntity user = await _db.Queryable().SingleAsync(x => x.Id == andonRecords.repair_id); + throw Oops.Bah($"您不是处理人"); } else { - _ = await _db.Updateable() - .SetColumns(x => x.end_repair_time == DateTime.Now) - .Where(x => x.id == id) - .ExecuteCommandAsync(); - return true; + if (andonRecords.status != DictConst.AndonStatusCLZ) + { + throw Oops.Bah($"状态错误"); + } + else + { + _ = await _db.Updateable() + .SetColumns(x => x.end_repair_time == DateTime.Now) + .Where(x => x.id == id) + .ExecuteCommandAsync(); + return true; + } } + } else { @@ -301,19 +377,28 @@ namespace Tnb.ProductionMgr AndonRecords andonRecords = await _db.Queryable().SingleAsync(x => x.id == id); if (andonRecords != null) { - if (andonRecords.status != DictConst.AndonStatusYWC) + if (andonRecords.repair_id!=_userManager.UserId) { - throw Oops.Bah($"状态错误"); + UserEntity user = await _db.Queryable().SingleAsync(x => x.Id == andonRecords.repair_id); + throw Oops.Bah($"您不是处理人"); } else { - _ = await _db.Updateable() - .SetColumns(x => x.confirm_time == DateTime.Now) - .Where(x => x.id == id) - .ExecuteCommandAsync(); - return true; + if (andonRecords.status != DictConst.AndonStatusYWC) + { + throw Oops.Bah($"状态错误"); + } + else + { + _ = await _db.Updateable() + .SetColumns(x => x.confirm_time == DateTime.Now) + .Where(x => x.id == id) + .ExecuteCommandAsync(); + return true; + } } + } else { diff --git a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs index 08bf1185..e5c81b4e 100644 --- a/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs +++ b/WarehouseMgr/Tnb.WarehouseMgr/WmsOutStockService.cs @@ -609,6 +609,8 @@ namespace Tnb.WarehouseMgr .And((a, b, c) => a.status == (int)EnumCarryStatus.占用) .And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString()) .And((a, b, c) => b.material_id == os.material_id) + .AndIF(!string.IsNullOrEmpty(os.material_specification), (a, b, c) => b.material_specification == os.material_specification) + .AndIF(!string.IsNullOrEmpty(os.container_no), (a, b, c) => b.container_no == os.container_no) .AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch); List carryCodesPart = await _db.Queryable().InnerJoin((a, b) => a.id == b.carry_id).InnerJoin((a, b, c) => a.location_id == c.id)