andon呼叫 aql 模具保养
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
public class AndonRecordInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 关联工单
|
||||
/// </summary>
|
||||
public string? mo_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障
|
||||
/// </summary>
|
||||
public string? breakdown { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
[SugarTable("andon_breakdown")]
|
||||
public partial class AndonBreakDown : BaseEntity<string>
|
||||
{
|
||||
public AndonBreakDown()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
public string? name { get; set; }
|
||||
public string? code { get; set; }
|
||||
public string? description { get; set; }
|
||||
|
||||
public string? type_id { get; set; }
|
||||
public string? remark { get; set; }
|
||||
public string? create_id { get; set; }
|
||||
public DateTime? create_time { get; set; }
|
||||
public string? modify_id { get; set; }
|
||||
public DateTime? modify_time { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.Common.Contracts;
|
||||
using JNPF.Common.Security;
|
||||
using SqlSugar;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities
|
||||
{
|
||||
[SugarTable("andon_records")]
|
||||
public partial class AndonRecords : BaseEntity<string>
|
||||
{
|
||||
public AndonRecords()
|
||||
{
|
||||
id = SnowflakeIdHelper.NextId();
|
||||
}
|
||||
/// <summary>
|
||||
/// 关联工单
|
||||
/// </summary>
|
||||
public string? mo_id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障类别
|
||||
/// </summary>
|
||||
public string? breakdown_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 故障
|
||||
/// </summary>
|
||||
public string? breakdown { get; set; }
|
||||
|
||||
public string? create_id { get; set; }
|
||||
public DateTime? create_time { get; set; }
|
||||
public string? modify_id { get; set; }
|
||||
public DateTime? modify_time { get; set; }
|
||||
public string? remark { get; set; }
|
||||
}
|
||||
}
|
||||
16
ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs
Normal file
16
ProductionMgr/Tnb.ProductionMgr.Interfaces/IAndonService.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
public interface IAndonService
|
||||
{
|
||||
public Task<dynamic> GetPrdTask(string stationId);
|
||||
|
||||
public Task SaveData(AndonRecordInput AndonRecordInput);
|
||||
}
|
||||
}
|
||||
86
ProductionMgr/Tnb.ProductionMgr/AndonService.cs
Normal file
86
ProductionMgr/Tnb.ProductionMgr/AndonService.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Reactive.Joins;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using Aspose.Cells.Drawing;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Message.Service;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.TaskScheduler;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Entities.Entity;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class AndonService : IAndonService, IDynamicApiController, ITransient
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IUserManager _userManager;
|
||||
public AndonService(ISqlSugarRepository<AndonRecords> repository,IUserManager userManager)
|
||||
{
|
||||
_userManager = userManager;
|
||||
_db = repository.AsSugarClient();
|
||||
}
|
||||
[HttpGet]
|
||||
public async Task<dynamic> GetPrdTask(string stationId)
|
||||
{
|
||||
Dictionary<string, string> dic = new Dictionary<string, string>();
|
||||
dic.Add("ToBeStarted", "待开工");
|
||||
dic.Add("InProgress", "进行中");
|
||||
dic.Add("Closed", "关闭");
|
||||
dic.Add("Complated", "完工");
|
||||
dic.Add("ToBeScheduled", "待下发");
|
||||
dic.Add("Pause", "暂停");
|
||||
dic.Add("Exception", "异常");
|
||||
dic.Add("Revoke", "撤销");
|
||||
List<dynamic> result = new();
|
||||
var List = await _db.Queryable<PrdMoTask>()
|
||||
.WhereIF(!string.IsNullOrEmpty(stationId), p => p.workstation_id == stationId)
|
||||
.ToListAsync();
|
||||
var materials = await _db.Queryable<BasMaterial>().ToListAsync();
|
||||
foreach (var data in List)
|
||||
{
|
||||
dynamic info = new ExpandoObject();
|
||||
info.id = data.id;
|
||||
info.material_id = materials.Where(p => p.id == data.material_id).Any() ? materials.Where(p => p.id == data.material_id).First().name : "";
|
||||
info.material_id_id = data.material_id;
|
||||
info.status = dic.Where(p => p.Key == data.mo_task_status).Any() ? dic.Where(p => p.Key == data.mo_task_status).First().Value : "";
|
||||
info.mo_code = data.mo_task_code;
|
||||
info.mo_type = data.schedule_type == 1 ? "注塑工单" : "组装工单";
|
||||
info.plan_gty = data.plan_qty;
|
||||
info.plan_start_date = data.estimated_start_date == null ? "" : ((DateTime)data.estimated_start_date!).ToString("yyyy-MM-dd");
|
||||
info.plan_end_date = data.estimated_end_date == null ? "" : ((DateTime)data.estimated_end_date!).ToString("yyyy-MM-dd");
|
||||
result.Add(info);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
[HttpPost]
|
||||
public async Task SaveData(AndonRecordInput AndonRecordInput)
|
||||
{
|
||||
var list = _db.Queryable<AndonBreakDown>().ToList();
|
||||
AndonRecords andonRecord = new AndonRecords();
|
||||
andonRecord.mo_id = AndonRecordInput.mo_id;
|
||||
andonRecord.breakdown_type = list.Where(p => p.id == AndonRecordInput.breakdown).Any() ? list.Where(p => p.id == AndonRecordInput.breakdown).First().type_id : "";
|
||||
andonRecord.breakdown = AndonRecordInput.breakdown;
|
||||
andonRecord.create_time = DateTime.Now;
|
||||
andonRecord.create_id = _userManager.UserId;
|
||||
await _db.Insertable(andonRecord).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user