Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Tnb.EquipMgr.Entities.Dto
|
||||||
|
{
|
||||||
|
public class EquipRepairRefuseInput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string reason { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
52
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairRefuse.cs
Normal file
52
EquipMgr/Tnb.EquipMgr.Entities/Entity/EqpRepairRefuse.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设备维修拒绝表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("eqp_repair_refuse")]
|
||||||
|
public partial class EqpRepairRefuse : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public EqpRepairRefuse()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 拒绝理由
|
||||||
|
/// </summary>
|
||||||
|
public string reason { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 报修id
|
||||||
|
/// </summary>
|
||||||
|
public string repair_apply_id { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程任务Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowtaskid { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 流程引擎Id
|
||||||
|
/// </summary>
|
||||||
|
public string? f_flowid { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
15
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairRefuseService.cs
Normal file
15
EquipMgr/Tnb.EquipMgr.Interfaces/IEqpRepairRefuseService.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
namespace Tnb.EquipMgr.Interfaces
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 维修拒绝服务
|
||||||
|
/// </summary>
|
||||||
|
public interface IEqpRepairRefuseService
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 根据维修id获取拒绝列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public Task<dynamic> GetRepairRefuseByRepairApplyId(Dictionary<string, string> dic);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -82,10 +82,25 @@ namespace Tnb.EquipMgr
|
|||||||
public async Task<string> Refuse(Dictionary<string, string> dic)
|
public async Task<string> Refuse(Dictionary<string, string> dic)
|
||||||
{
|
{
|
||||||
string id = dic["id"];
|
string id = dic["id"];
|
||||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
string reason = dic["reason"];
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||||
{
|
{
|
||||||
status = RepairApplyStatus.REFUSE,
|
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||||
}, x => x.id == id);
|
{
|
||||||
|
status = RepairApplyStatus.REFUSE,
|
||||||
|
}, x => x.id == id);
|
||||||
|
EqpRepairRefuse eqpRepairRefuse = new EqpRepairRefuse()
|
||||||
|
{
|
||||||
|
repair_apply_id = id,
|
||||||
|
reason = reason,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now,
|
||||||
|
org_id = _userManager.GetUserInfo().Result.organizeId
|
||||||
|
};
|
||||||
|
await db.Insertable<EqpRepairRefuse>(eqpRepairRefuse).ExecuteCommandAsync();
|
||||||
|
});
|
||||||
|
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||||
return "拒绝成功";
|
return "拒绝成功";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
36
EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs
Normal file
36
EquipMgr/Tnb.EquipMgr/EqpRepairRefuseService.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.EquipMgr.Entities.Dto;
|
||||||
|
using Tnb.EquipMgr.Interfaces;
|
||||||
|
|
||||||
|
namespace Tnb.EquipMgr
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 设备维修拒绝
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
public class EqpRepairRefuseService : IEqpRepairRefuseService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private readonly ISqlSugarRepository<EqpRepairRefuse> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
|
public EqpRepairRefuseService(ISqlSugarRepository<EqpRepairRefuse> repository,
|
||||||
|
IUserManager userManager)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetRepairRefuseByRepairApplyId(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
string repairApplyId = dic["repairApplyId"];
|
||||||
|
return await _repository.GetListAsync(x => x.repair_apply_id == repairApplyId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,5 +14,22 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
/// 生产任务编号
|
/// 生产任务编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string mo_task_code { get; set; }
|
public string mo_task_code { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 开始时间
|
||||||
|
/// </summary>
|
||||||
|
public long[] estimated_start_date { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 结束时间
|
||||||
|
/// </summary>
|
||||||
|
public long[] estimated_end_date { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 产线
|
||||||
|
/// </summary>
|
||||||
|
public string workline { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 工序
|
||||||
|
/// </summary>
|
||||||
|
public string process { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1070,8 +1070,7 @@ namespace Tnb.ProductionMgr
|
|||||||
record.masterial_name = material?.name;
|
record.masterial_name = material?.name;
|
||||||
record.plan_start_date = taskInfo.estimated_start_date;
|
record.plan_start_date = taskInfo.estimated_start_date;
|
||||||
record.plan_end_date = taskInfo.estimated_end_date;
|
record.plan_end_date = taskInfo.estimated_end_date;
|
||||||
// record.plan_qty = taskInfo.plan_qty;
|
record.plan_qty = taskInfo.plan_qty;
|
||||||
record.plan_qty = taskInfo.scheduled_qty;
|
|
||||||
record.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskInfo.eqp_id))?.code;
|
record.eqp_code = (await db.Queryable<EqpEquipment>().FirstAsync(it => it.id == taskInfo.eqp_id))?.code;
|
||||||
record.mo_task_type = mo?.mo_type;
|
record.mo_task_type = mo?.mo_type;
|
||||||
record.status = taskInfo.mo_task_status;
|
record.status = taskInfo.mo_task_status;
|
||||||
|
|||||||
@@ -51,14 +51,35 @@ namespace Tnb.ProductionMgr
|
|||||||
if (input == null) throw new ArgumentNullException("input");
|
if (input == null) throw new ArgumentNullException("input");
|
||||||
List<PackReportTreeOutput> trees = new();
|
List<PackReportTreeOutput> trees = new();
|
||||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||||
|
var list = await _db.Queryable<OrganizeEntity>().Where(it => it.Category == "workline").ToListAsync();
|
||||||
if (_dicWorkLine.Count < 1)
|
if (_dicWorkLine.Count < 1)
|
||||||
{
|
{
|
||||||
var list = await _db.Queryable<OrganizeEntity>().Where(it => it.Category == "workline").ToListAsync();
|
|
||||||
_dicWorkLine = list.ToDictionary(x => x.Id, x => Tuple.Create<string, string>(x.EnCode, x.FullName));
|
_dicWorkLine = list.ToDictionary(x => x.Id, x => Tuple.Create<string, string>(x.EnCode, x.FullName));
|
||||||
}
|
}
|
||||||
|
bool start = false;
|
||||||
|
bool end=false;
|
||||||
|
DateTime[] startTimes = new DateTime[2];
|
||||||
|
DateTime[] endTimes = new DateTime[2];
|
||||||
|
if (input.estimated_start_date != null && input.estimated_start_date.Count() == 2)
|
||||||
|
{
|
||||||
|
start=true;
|
||||||
|
startTimes[0] = GetDateTimeMilliseconds(input.estimated_start_date![0]);
|
||||||
|
startTimes[1] = GetDateTimeMilliseconds(input.estimated_start_date![1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
if (input.estimated_end_date != null && input.estimated_end_date.Count() == 2)
|
||||||
|
{
|
||||||
|
end = true;
|
||||||
|
endTimes[0] = GetDateTimeMilliseconds(input.estimated_end_date![0]);
|
||||||
|
endTimes[1] = GetDateTimeMilliseconds(input.estimated_end_date![1]);
|
||||||
|
|
||||||
|
}
|
||||||
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||||
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
|
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
|
||||||
|
.WhereIF(start, a => startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date)
|
||||||
|
.WhereIF(end, a => endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!))
|
||||||
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
|
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
|
||||||
.Select((a, b, c) => new PrdMoTask
|
.Select((a, b, c) => new PrdMoTask
|
||||||
{
|
{
|
||||||
@@ -101,6 +122,23 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var treeList = trees.ToTree();
|
var treeList = trees.ToTree();
|
||||||
|
if (!string.IsNullOrEmpty(input.process))
|
||||||
|
{
|
||||||
|
foreach (var item in treeList)
|
||||||
|
{
|
||||||
|
bool flag = false;
|
||||||
|
if (item.process_id != null && item.process_id.Contains(input.process))
|
||||||
|
flag = true;
|
||||||
|
if (item.children != null)
|
||||||
|
{
|
||||||
|
List<PackReportTreeOutput> childs = (List<PackReportTreeOutput>)(Object)item.children;
|
||||||
|
if (childs.Where(p => p.process_id.Contains(input.process)).Any())
|
||||||
|
flag = true;
|
||||||
|
}
|
||||||
|
if (!flag)
|
||||||
|
treeList.Remove(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
SqlSugarPagedList<PackReportTreeOutput> pagedList = new()
|
SqlSugarPagedList<PackReportTreeOutput> pagedList = new()
|
||||||
{
|
{
|
||||||
list = treeList,
|
list = treeList,
|
||||||
@@ -113,15 +151,24 @@ namespace Tnb.ProductionMgr
|
|||||||
};
|
};
|
||||||
return PageResult<PackReportTreeOutput>.SqlSugarPageResult(pagedList);
|
return PageResult<PackReportTreeOutput>.SqlSugarPageResult(pagedList);
|
||||||
}
|
}
|
||||||
|
private static DateTime GetDateTimeMilliseconds(long timestamp)
|
||||||
|
{
|
||||||
|
long begtime = timestamp * 10000;
|
||||||
|
DateTime dt_1970 = new DateTime(1970, 1, 1, 8, 0, 0);
|
||||||
|
long tricks_1970 = dt_1970.Ticks;//1970年1月1日刻度
|
||||||
|
long time_tricks = tricks_1970 + begtime;//日志日期刻度
|
||||||
|
DateTime dt = new DateTime(time_tricks);//转化为DateTime
|
||||||
|
return dt;
|
||||||
|
|
||||||
|
}
|
||||||
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic)
|
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic)
|
||||||
{
|
{
|
||||||
var items = await _db.Queryable<PrdMoTask>()
|
var items = await _db.Queryable<PrdMoTask>()
|
||||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||||
.LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
.LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||||
.LeftJoin<BasMbomProcess>((a,b,c,d)=>a.mbom_process_id==d.id)
|
.LeftJoin<BasMbomProcess>((a, b, c, d) => a.mbom_process_id == d.id)
|
||||||
.Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled")
|
.Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled")
|
||||||
.OrderBy((a,b,c,d)=>d.ordinal)
|
.OrderBy((a, b, c, d) => d.ordinal)
|
||||||
.Select((a, b, c) => new PrdMoTask
|
.Select((a, b, c) => new PrdMoTask
|
||||||
{
|
{
|
||||||
id = a.id,
|
id = a.id,
|
||||||
@@ -134,7 +181,7 @@ namespace Tnb.ProductionMgr
|
|||||||
plan_end_date = a.estimated_end_date,
|
plan_end_date = a.estimated_end_date,
|
||||||
plan_qty = c.scheduled_qty,
|
plan_qty = c.scheduled_qty,
|
||||||
//complete_qty = SqlFunc.Subqueryable<PrdReport>().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
|
//complete_qty = SqlFunc.Subqueryable<PrdReport>().Where(it => it.mo_task_code == a.mo_task_code).Sum(it => it.reported_work_qty),
|
||||||
complete_qty = a.reported_work_qty+a.scrap_qty,
|
complete_qty = a.reported_work_qty + a.scrap_qty,
|
||||||
mo_task_status = a.mo_task_status,
|
mo_task_status = a.mo_task_status,
|
||||||
|
|
||||||
}).ToListAsync();
|
}).ToListAsync();
|
||||||
|
|||||||
@@ -278,7 +278,6 @@ namespace Tnb.ProductionMgr
|
|||||||
// reported_qty = a.reported_qty,
|
// reported_qty = a.reported_qty,
|
||||||
// prd_qty = a.prd_qty,
|
// prd_qty = a.prd_qty,
|
||||||
eqp_code = d.code,
|
eqp_code = d.code,
|
||||||
mbom_process_id = a.mbom_process_id,
|
|
||||||
}).FirstAsync();
|
}).FirstAsync();
|
||||||
|
|
||||||
return prdTask;
|
return prdTask;
|
||||||
|
|||||||
@@ -61,11 +61,9 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </param>
|
/// </param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
/// <exception cref="ArgumentNullException"></exception>
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
[HttpPost]
|
|
||||||
public async Task<dynamic> WmsPDAFeedingRecord(VisualDevModelDataCrInput input)
|
private async Task<dynamic> WmsPDAFeedingRecord(VisualDevModelDataCrInput input)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
var isOk = false;
|
var isOk = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user