Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -29,5 +29,12 @@ namespace Tnb.BasicData
|
||||
/// 生产齐套领料
|
||||
/// </summary>
|
||||
public const string PRDKITTINGOUTSTOCK_CODE = "PrdKittingOutStocK";
|
||||
|
||||
/// <summary>
|
||||
/// 设备维修单
|
||||
/// </summary>
|
||||
public const string EQPREPAIR_CODE = "EqpRepair";
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
15
BasicData/Tnb.BasicData.Entities/Consts/DbTimeFormat.cs
Normal file
15
BasicData/Tnb.BasicData.Entities/Consts/DbTimeFormat.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
public static class DbTimeFormat
|
||||
{
|
||||
/// <summary>
|
||||
/// 2024-10-27 10:10
|
||||
/// </summary>
|
||||
public const string MM = "yyyy-MM-dd HH:mi";
|
||||
|
||||
/// <summary>
|
||||
/// 2024-10-27 10:10:10
|
||||
/// </summary>
|
||||
public const string SS = "yyyy-MM-dd HH:mi:ss";
|
||||
}
|
||||
}
|
||||
@@ -217,8 +217,10 @@ public static class DictConst
|
||||
/// 设备维修状态
|
||||
/// </summary>
|
||||
public const string RepairStatus = "RepairStatus";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 设备保养类型
|
||||
/// </summary>
|
||||
public const string EqpMaintainType = "EqpMaintainType";
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -229,8 +229,8 @@ namespace Tnb.BasicData
|
||||
bom_id = a.id,
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
start_time = a.start_time.HasValue ? a.start_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : null,
|
||||
end_time = a.end_time.HasValue ? a.end_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : null,
|
||||
start_time = a.start_time.HasValue ? a.start_time.Value.ToString(DbTimeFormat.SS) : null,
|
||||
end_time = a.end_time.HasValue ? a.end_time.Value.ToString(DbTimeFormat.SS) : null,
|
||||
version = a.version,
|
||||
route_id = c.id,
|
||||
route_name = c.name,
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EqpMaintainRecordListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string equip_id_id { get; set; }
|
||||
public string status { get; set; }
|
||||
public string result { get; set; }
|
||||
public string result_remark { get; set; }
|
||||
public string repeat_result { get; set; }
|
||||
public string repeat_remark { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string execute_time { get; set; }
|
||||
public string repeat_user_id { get; set; }
|
||||
public string repeat_user_id_id { get; set; }
|
||||
public string execute_user_id{ get; set; }
|
||||
public string execute_user_id_id { get; set; }
|
||||
public string repeat_time { get; set; }
|
||||
public string last_execute_time { get; set; }
|
||||
|
||||
public DateTime? date_repeat_time { get; set; }
|
||||
public DateTime? date_create_time { get; set; }
|
||||
public DateTime? date_execute_time { get; set; }
|
||||
public DateTime? date_last_execute_time { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class EqpSpotInsRecordListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string equip_id_id { get; set; }
|
||||
public string status { get; set; }
|
||||
public string result { get; set; }
|
||||
public string repeat_result { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string spot_record_date_time { get; set; }
|
||||
public string repeat_user_id { get; set; }
|
||||
public string repeat_user_id_id { get; set; }
|
||||
public string spot_record_user_id{ get; set; }
|
||||
public string spot_record_user_id_id { get; set; }
|
||||
public string repeat_time { get; set; }
|
||||
|
||||
public DateTime? date_repeat_time { get; set; }
|
||||
public DateTime? date_create_time { get; set; }
|
||||
public DateTime? date_spot_record_date_time { get; set; }
|
||||
}
|
||||
}
|
||||
15
EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListInput.cs
Normal file
15
EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListInput.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using JNPF.Common.Filter;
|
||||
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class PadRepairListInput : PageInputBase
|
||||
{
|
||||
public string status { get; set; }
|
||||
|
||||
public string equip_info { get; set; }
|
||||
|
||||
public DateTime? start_time { get; set; }
|
||||
public DateTime? end_time { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
24
EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs
Normal file
24
EquipMgr/Tnb.EquipMgr.Entities/Dto/PadRepairListOutput.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
namespace Tnb.EquipMgr.Entities.Dto
|
||||
{
|
||||
public class PadRepairListOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
public string code { get; set; }
|
||||
|
||||
public string name { get; set; }
|
||||
public string equip_id { get; set; }
|
||||
public string equip_id_id { get; set; }
|
||||
public string apply_user_id { get; set; }
|
||||
public string apply_user_id_id { get; set; }
|
||||
public string expect_complete_time { get; set; }
|
||||
public string is_ugent { get; set; }
|
||||
public string description { get; set; }
|
||||
public string remark { get; set; }
|
||||
public string create_time { get; set; }
|
||||
public string complete_time { get; set; }
|
||||
public string repairer_id { get; set; }
|
||||
public string repairer_id_id { get; set; }
|
||||
public string status { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -59,5 +59,11 @@ namespace Tnb.EquipMgr.Interfaces
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetRepairRecordList(EquipQueryInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 看板端设备报修维修列表接口
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> GetPadRepairList(PadRepairListInput input);
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@ using SqlSugar;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -48,7 +49,7 @@ namespace Tnb.EquipMgr
|
||||
id = a.id,
|
||||
data_source = a.data_source,
|
||||
create_id = b.RealName,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
data_type = a.data_type,
|
||||
enabled = a.enabled==1 ? "是" : "否",
|
||||
equip_id = a.equip_id,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
@@ -6,9 +7,15 @@ using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -20,16 +27,61 @@ namespace Tnb.EquipMgr
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Tag = ModuleConsts.Tag, Area = ModuleConsts.Area, Order = 700)]
|
||||
[Route("api/[area]/[controller]/[action]")]
|
||||
public class EqpRepairApplyService : IEqpRepairApplyService, IDynamicApiController, ITransient
|
||||
[OverideVisualDev(ModuleId)]
|
||||
public class EqpRepairApplyService : IEqpRepairApplyService, IOverideVisualDevService, IDynamicApiController, ITransient
|
||||
{
|
||||
private const string ModuleId = "26165698078741";
|
||||
private readonly ISqlSugarRepository<EqpRepairApply> _repository;
|
||||
private readonly IVisualDevService _visualDevService;
|
||||
private readonly IRunService _runService;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public EqpRepairApplyService(ISqlSugarRepository<EqpRepairApply> repository,
|
||||
IVisualDevService visualDevService,
|
||||
IRunService runService,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager)
|
||||
{
|
||||
_repository = repository;
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
_billRuleService = billRullService;
|
||||
OverideFuncs.CreateAsync = Create;
|
||||
}
|
||||
|
||||
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
||||
{
|
||||
if (!input.data.ContainsKey("create_time"))
|
||||
{
|
||||
input.data.Add("create_time",DateTime.Now);
|
||||
}
|
||||
|
||||
if (!input.data.ContainsKey("create_id"))
|
||||
{
|
||||
input.data.Add("create_id",_userManager.UserId);
|
||||
}
|
||||
|
||||
if (!input.data.ContainsKey("apply_user_id"))
|
||||
{
|
||||
input.data.Add("apply_user_id",_userManager.UserId);
|
||||
}
|
||||
|
||||
if (!input.data.ContainsKey("org_id"))
|
||||
{
|
||||
input.data.Add("org_id",_userManager.GetUserInfo().Result.organizeId);
|
||||
}
|
||||
|
||||
if (!input.data.ContainsKey("code"))
|
||||
{
|
||||
input.data.Add("code",await _billRuleService.GetBillNumber(CodeTemplateConst.EQPREPAIR_CODE));
|
||||
}
|
||||
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleId, true);
|
||||
await _runService.Create(templateEntity, input);
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -49,7 +101,7 @@ namespace Tnb.EquipMgr
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
status = RepairApplyStatus.CLOSE
|
||||
status = RepairApplyStatus.CLOSE,
|
||||
}, x => x.id == id);
|
||||
return "关闭成功";
|
||||
}
|
||||
@@ -59,23 +111,48 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
string id = dic["id"];
|
||||
string repairerId = dic["repairerId"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBEEXECUTED ||
|
||||
eqpRepairApply.status == RepairApplyStatus.REFUSE)
|
||||
{
|
||||
repairer_id = repairerId,
|
||||
status = RepairApplyStatus.TOBERECEIVED,
|
||||
}, x => x.id == id);
|
||||
return "指派成功";
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
repairer_id = repairerId,
|
||||
status = RepairApplyStatus.TOBERECEIVED,
|
||||
}, x => x.id == id);
|
||||
return "指派成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<string> Receive(Dictionary<string, string> dic)
|
||||
{
|
||||
string id = dic["id"];
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
status = RepairApplyStatus.RECEIVED,
|
||||
}, x => x.id == id);
|
||||
return "接收成功";
|
||||
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("状态错误");
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -86,21 +163,37 @@ namespace Tnb.EquipMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
status = RepairApplyStatus.REFUSE,
|
||||
}, x => x.id == id);
|
||||
EqpRepairRefuse eqpRepairRefuse = new EqpRepairRefuse()
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
{
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
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();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("该任务没有指派给您,无法拒绝");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
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();
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
});
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
return "拒绝成功";
|
||||
}
|
||||
|
||||
@@ -114,23 +207,39 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<string> Register(RepairApplyRegisterInput input)
|
||||
{
|
||||
string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
EqpRepairApply eqpRepairApply = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBERECEIVED)
|
||||
{
|
||||
fault_id = input.fault_id,
|
||||
is_complete = input.is_complete,
|
||||
complete_time = input.complete_time,
|
||||
repair_take_time = input.repair_take_time,
|
||||
is_halt = input.is_halt,
|
||||
halt_take_time = input.halt_take_time,
|
||||
repair_description = input.repair_description,
|
||||
repair_img = input.repair_img,
|
||||
is_out_apply = input.is_out_apply,
|
||||
status = status,
|
||||
}, x => x.id == input.id);
|
||||
if (_userManager.UserId == eqpRepairApply.repairer_id)
|
||||
{
|
||||
string status = input.is_out_apply==1 ? RepairApplyStatus.TOBEOUTAPPLY : RepairApplyStatus.COMPLETED;
|
||||
await _repository.UpdateAsync(x => new EqpRepairApply()
|
||||
{
|
||||
fault_id = input.fault_id,
|
||||
is_complete = input.is_complete,
|
||||
complete_time = input.complete_time,
|
||||
repair_take_time = input.repair_take_time,
|
||||
is_halt = input.is_halt,
|
||||
halt_take_time = input.halt_take_time,
|
||||
repair_description = input.repair_description,
|
||||
repair_img = input.repair_img,
|
||||
is_out_apply = input.is_out_apply,
|
||||
status = status,
|
||||
}, x => x.id == input.id);
|
||||
return "登记成功";
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("您不是责任人");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
return "登记成功";
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -161,6 +270,7 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||
.Where(a=>a.equip_id==input.equip_id)
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a,b,c) => new EquipRepairRecordQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
@@ -171,11 +281,87 @@ namespace Tnb.EquipMgr
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
description = a.description,
|
||||
repair_description = a.repair_description,
|
||||
complete_time = a.complete_time==null ? null : a.complete_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
complete_time = a.complete_time==null ? null : a.complete_time.Value.ToString(DbTimeFormat.MM),
|
||||
repairer_id = c.RealName
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<EquipRepairRecordQueryOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetPadRepairList(PadRepairListInput input)
|
||||
{
|
||||
|
||||
DateTime? start_time = input.start_time;
|
||||
DateTime? end_time = input.end_time;
|
||||
List<string> statusList = new List<string>();
|
||||
if (!string.IsNullOrEmpty(input.status))
|
||||
{
|
||||
switch (input.status)
|
||||
{
|
||||
case "1" :
|
||||
statusList.Add(RepairApplyStatus.TOBEEXECUTED);
|
||||
statusList.Add(RepairApplyStatus.REFUSE);
|
||||
break;
|
||||
case "2" :
|
||||
statusList.Add(RepairApplyStatus.TOBERECEIVED);
|
||||
statusList.Add(RepairApplyStatus.RECEIVED);
|
||||
statusList.Add(RepairApplyStatus.OUTAPPLYAPPROVE);
|
||||
statusList.Add(RepairApplyStatus.APPROVEPASS);
|
||||
statusList.Add(RepairApplyStatus.APPROVENOTPASS);
|
||||
statusList.Add(RepairApplyStatus.TOBEOUTAPPLY);
|
||||
break;
|
||||
case "3" :
|
||||
statusList.Add(RepairApplyStatus.COMPLETED);
|
||||
statusList.Add(RepairApplyStatus.CLOSE);
|
||||
statusList.Add(RepairApplyStatus.REPEAL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "a.create_time";
|
||||
input.sort = "desc";
|
||||
}
|
||||
else
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
var result = await db.Queryable<EqpRepairApply>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.apply_user_id==b.Id)
|
||||
.LeftJoin<UserEntity>((a,b,c)=>a.repairer_id==c.Id)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d)=>a.equip_id==d.id)
|
||||
.LeftJoin<DictionaryTypeEntity>((a,b,c,d,e)=>e.EnCode==DictConst.RepairStatus)
|
||||
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e,f)=>e.Id==f.DictionaryTypeId && a.status==f.EnCode)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.equip_info),(a,b,c,d)=>d.code.Contains(input.equip_info) || d.name.Contains(input.equip_info))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.status),(a,b,c,d)=>statusList.Contains(a.status))
|
||||
.WhereIF(input.status=="3" && start_time!=null,a=>a.complete_time!=null && a.complete_time>=start_time)
|
||||
.WhereIF(input.status=="3" && end_time!=null,a=>a.complete_time!=null && a.complete_time<=end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a,b,c,d,e,f) => new PadRepairListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = d.code+"/"+d.name,
|
||||
equip_id_id = a.equip_id,
|
||||
code = a.code,
|
||||
name = a.name,
|
||||
apply_user_id =b.RealName,
|
||||
apply_user_id_id =b.Id,
|
||||
is_ugent = a.is_ugent==1 ? "是" : "否",
|
||||
description = a.description,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
complete_time = a.complete_time==null ? "" : a.complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
expect_complete_time = a.expect_complete_time==null ? "" : a.expect_complete_time.Value.ToString(DbTimeFormat.SS),
|
||||
repairer_id = c.RealName,
|
||||
repairer_id_id = c.Id,
|
||||
remark = a.remark,
|
||||
status = f.FullName
|
||||
}).ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<PadRepairListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,91 +51,66 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task<string> OutApply(RepairOutApplyInput input)
|
||||
{
|
||||
|
||||
var db = _repository.AsSugarClient();
|
||||
string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id;
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
EqpRepairApply eqpRepairApply = await _repository.AsSugarClient().Queryable<EqpRepairApply>().SingleAsync(x=>x.id==input.repair_apply_id);
|
||||
if (eqpRepairApply.status == RepairApplyStatus.TOBEOUTAPPLY ||
|
||||
eqpRepairApply.status == RepairApplyStatus.APPROVENOTPASS)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
var db = _repository.AsSugarClient();
|
||||
string id = string.IsNullOrEmpty(input.id) ? SnowflakeIdHelper.NextId() : input.id;
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
// await _repository.InsertAsync(new EqpRepairOutApply
|
||||
// {
|
||||
// id = id,
|
||||
// repair_apply_id = input.repair_apply_id,
|
||||
// equip_id = input.equip_id,
|
||||
// supplier_id = input.supplier_id,
|
||||
// estimated_cost = input.estimated_cost,
|
||||
// construction_period_requirement = input.construction_period_requirement,
|
||||
// out_apply_reason = input.out_apply_reason,
|
||||
// remark = input.remark,
|
||||
// create_id = _userManager.UserId,
|
||||
// create_time = DateTime.Now,
|
||||
// approve_status = RepairOutApplyStatus.TOBEAPPROVE,
|
||||
// });
|
||||
}
|
||||
else
|
||||
{
|
||||
// await _repository.UpdateAsync(x=>new EqpRepairOutApply
|
||||
// {
|
||||
// repair_apply_id = input.repair_apply_id,
|
||||
// equip_id = input.equip_id,
|
||||
// supplier_id = input.supplier_id,
|
||||
// estimated_cost = input.estimated_cost,
|
||||
// construction_period_requirement = input.construction_period_requirement,
|
||||
// out_apply_reason = input.out_apply_reason,
|
||||
// remark = input.remark,
|
||||
// create_id = _userManager.UserId,
|
||||
// create_time = DateTime.Now,
|
||||
// approve_status = RepairOutApplyStatus.TOBEAPPROVE,
|
||||
// },x=>x.id==input.id);
|
||||
}
|
||||
|
||||
await db.Updateable<EqpRepairApply>()
|
||||
.SetColumns(x=>x.status == RepairApplyStatus.OUTAPPLYAPPROVE)
|
||||
.Where(x=>x.id==input.repair_apply_id).ExecuteCommandAsync();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
await _flowTaskService.Create(new FlowTaskSubmitModel()
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
flowId = flowId,
|
||||
parentId = "0",
|
||||
formData = new JObject()
|
||||
{
|
||||
{"id",id},
|
||||
{"flowId",flowId},
|
||||
{"repair_apply_id",input.repair_apply_id},
|
||||
{"equip_id",input.equip_id},
|
||||
{"create_id",_userManager.UserId},
|
||||
{"supplier_id",input.supplier_id},
|
||||
{"estimated_cost",input.estimated_cost},
|
||||
{"construction_period_requirement",input.construction_period_requirement},
|
||||
{"out_apply_reason",input.out_apply_reason},
|
||||
{"remark",input.remark},
|
||||
{"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||
if (entity != null)
|
||||
// await _repository.InsertAsync(new EqpRepairOutApply
|
||||
// {
|
||||
// id = id,
|
||||
// repair_apply_id = input.repair_apply_id,
|
||||
// equip_id = input.equip_id,
|
||||
// supplier_id = input.supplier_id,
|
||||
// estimated_cost = input.estimated_cost,
|
||||
// construction_period_requirement = input.construction_period_requirement,
|
||||
// out_apply_reason = input.out_apply_reason,
|
||||
// remark = input.remark,
|
||||
// create_id = _userManager.UserId,
|
||||
// create_time = DateTime.Now,
|
||||
// approve_status = RepairOutApplyStatus.TOBEAPPROVE,
|
||||
// });
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
await _flowTaskService.Update("",new FlowTaskSubmitModel()
|
||||
// await _repository.UpdateAsync(x=>new EqpRepairOutApply
|
||||
// {
|
||||
// repair_apply_id = input.repair_apply_id,
|
||||
// equip_id = input.equip_id,
|
||||
// supplier_id = input.supplier_id,
|
||||
// estimated_cost = input.estimated_cost,
|
||||
// construction_period_requirement = input.construction_period_requirement,
|
||||
// out_apply_reason = input.out_apply_reason,
|
||||
// remark = input.remark,
|
||||
// create_id = _userManager.UserId,
|
||||
// create_time = DateTime.Now,
|
||||
// approve_status = RepairOutApplyStatus.TOBEAPPROVE,
|
||||
// },x=>x.id==input.id);
|
||||
}
|
||||
|
||||
await db.Updateable<EqpRepairApply>()
|
||||
.SetColumns(x=>x.status == RepairApplyStatus.OUTAPPLYAPPROVE)
|
||||
.Where(x=>x.id==input.repair_apply_id).ExecuteCommandAsync();
|
||||
|
||||
|
||||
|
||||
});
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.id))
|
||||
{
|
||||
await _flowTaskService.Create(new FlowTaskSubmitModel()
|
||||
{
|
||||
flowId = flowId,
|
||||
parentId = "0",
|
||||
id = entity?.flow_task_id??"",
|
||||
formData = new JObject()
|
||||
{
|
||||
{"id",id},
|
||||
@@ -153,9 +128,43 @@ namespace Tnb.EquipMgr
|
||||
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _repository.GetSingleAsync(x=>x.id==input.id);
|
||||
if (entity != null)
|
||||
{
|
||||
|
||||
await _flowTaskService.Update("",new FlowTaskSubmitModel()
|
||||
{
|
||||
flowId = flowId,
|
||||
parentId = "0",
|
||||
id = entity?.flow_task_id??"",
|
||||
formData = new JObject()
|
||||
{
|
||||
{"id",id},
|
||||
{"flowId",flowId},
|
||||
{"repair_apply_id",input.repair_apply_id},
|
||||
{"equip_id",input.equip_id},
|
||||
{"create_id",_userManager.UserId},
|
||||
{"supplier_id",input.supplier_id},
|
||||
{"estimated_cost",input.estimated_cost},
|
||||
{"construction_period_requirement",input.construction_period_requirement},
|
||||
{"out_apply_reason",input.out_apply_reason},
|
||||
{"remark",input.remark},
|
||||
{"approve_status",RepairOutApplyStatus.TOBEAPPROVE},
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
}
|
||||
return result.IsSuccess ? "操作成功" : result.ErrorMessage;
|
||||
else
|
||||
{
|
||||
throw Oops.Bah("状态错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
|
||||
@@ -2,16 +2,20 @@ using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Entitys.System;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
@@ -42,8 +46,70 @@ namespace Tnb.EquipMgr
|
||||
_visualDevService = visualDevService;
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
// OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
}
|
||||
|
||||
private async Task<object> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : "";
|
||||
string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : "";
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "a.create_time";
|
||||
input.sort = "desc";
|
||||
}else
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
var list = await db.Queryable<EqpMaintainRecordH, EqpEquipment, UserEntity,UserEntity>((a, b, c,d) => new object[]
|
||||
{
|
||||
JoinType.Left, a.equip_id == b.id,
|
||||
JoinType.Left, a.execute_user_id == c.Id,
|
||||
JoinType.Left, a.repeat_user_id == d.Id,
|
||||
})
|
||||
.WhereIF(!string.IsNullOrEmpty(status),(a,b,c)=>a.status==status)
|
||||
.WhereIF(!string.IsNullOrEmpty(equioInfo),(a,b,c)=>b.code.Contains(equioInfo)|| b.name.Contains(equioInfo))
|
||||
.WhereIF(status=="3" && start_time!=null,a=>a.execute_time>=start_time)
|
||||
.WhereIF(status=="3" && end_time!=null,a=>a.execute_time<=end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a, b, c,d) => new EqpMaintainRecordListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = b.code+"/"+b.name,
|
||||
equip_id_id = a.equip_id,
|
||||
status = a.status,
|
||||
result = a.result=="1" ? "合格" : "不合格",
|
||||
repeat_result = a.repeat_result=="1" ? "合格" : "不合格",
|
||||
date_create_time = a.create_time,
|
||||
date_execute_time = a.execute_time,
|
||||
date_repeat_time = a.repeat_time,
|
||||
execute_user_id = c.RealName,
|
||||
execute_user_id_id = a.execute_user_id,
|
||||
repeat_user_id = d.RealName,
|
||||
repeat_user_id_id = a.repeat_user_id,
|
||||
result_remark = a.result_remark,
|
||||
repeat_remark = a.repeat_remark,
|
||||
date_last_execute_time = SqlFunc.Subqueryable<EqpMaintainRecordH>().Where(x=>a.equip_id==x.equip_id && a.execute_time!=null).OrderByDesc(x=>x.execute_time).Select(x=>x.execute_time)
|
||||
})
|
||||
.Mapper(a =>
|
||||
{
|
||||
a.status = a.status=="1" ? "待执行" : a.status=="2" ? "待复核" : "已完成";
|
||||
a.create_time = a.date_create_time == null ? "" : a.date_create_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.execute_time = a.date_execute_time == null ? "" : a.date_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.last_execute_time = a.date_last_execute_time == null ? "" : a.date_last_execute_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
})
|
||||
.ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EqpMaintainRecordListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 执行设备保养计划
|
||||
@@ -105,6 +171,19 @@ namespace Tnb.EquipMgr
|
||||
EqpMaintainRecordH eqpSpotInsRecordH = await _repository.GetSingleAsync(x => x.id == id);
|
||||
List<EqpMaintainRecordD> eqpSpotInsRecordDs = await _repository.AsSugarClient().Queryable<EqpMaintainRecordD>()
|
||||
.Where(x => x.maintain_record_id == id).ToListAsync();
|
||||
Dictionary<string, object> typeDic = await _repository.AsSugarClient().Queryable<DictionaryTypeEntity>()
|
||||
.LeftJoin<DictionaryDataEntity>((a, b) => a.Id == b.DictionaryTypeId)
|
||||
.Where((a, b) => a.EnCode == DictConst.EqpMaintainType)
|
||||
.Select((a, b) => new
|
||||
{
|
||||
b.EnCode, b.FullName
|
||||
})
|
||||
.MergeTable()
|
||||
.ToDictionaryAsync(it => it.EnCode, it => it.FullName);
|
||||
eqpSpotInsRecordDs.ForEach(x =>
|
||||
{
|
||||
x.maintain_type = typeDic.ContainsKey(x.maintain_type) ? typeDic[x.maintain_type]+"" : x.maintain_type;
|
||||
});
|
||||
MaintainRecordRepeatOutput output = new MaintainRecordRepeatOutput()
|
||||
{
|
||||
model = eqpSpotInsRecordH,
|
||||
@@ -170,17 +249,17 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
equip_id = b.code,
|
||||
equip_id_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
repeat_result = a.repeat_result=="1"?"合格":"不合格",
|
||||
repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM),
|
||||
repeat_user_id = d.RealName,
|
||||
result = a.result=="1"?"合格":"不合格",
|
||||
result_remark = a.result_remark,
|
||||
maintain_tem_equip_id = a.maintain_tem_equip_id,
|
||||
execute_time = a.execute_time==null ? null : a.execute_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
execute_time = a.execute_time==null ? null : a.execute_time.Value.ToString(DbTimeFormat.MM),
|
||||
execute_user_id = c.RealName,
|
||||
status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("")
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
@@ -207,7 +286,7 @@ namespace Tnb.EquipMgr
|
||||
equip_id = a.equip_id,
|
||||
equip_code = b.code,
|
||||
equip_name = b.name,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
result_remark = a.result_remark,
|
||||
result = a.result,
|
||||
status = a.status,
|
||||
|
||||
@@ -2,19 +2,24 @@ using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Filter;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.VisualDev;
|
||||
using JNPF.VisualDev.Entitys;
|
||||
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||
using JNPF.VisualDev.Interfaces;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.EquipMgr.Entities.Dto;
|
||||
using Tnb.EquipMgr.Interfaces;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.EquipMgr
|
||||
{
|
||||
@@ -43,6 +48,65 @@ namespace Tnb.EquipMgr
|
||||
_runService = runService;
|
||||
_userManager = userManager;
|
||||
// OverideFuncs.UpdateAsync = ExecuteSpotIns;
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
}
|
||||
|
||||
private async Task<object> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object>? queryJson = (input==null || string.IsNullOrEmpty(input.queryJson)) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string equioInfo = queryJson.ContainsKey("query_info") ? (queryJson["query_info"].ToString() ?? "") : "";
|
||||
string status = queryJson.ContainsKey("status") ? (queryJson["status"].ToString() ?? "") : "";
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "a.create_time";
|
||||
input.sort = "desc";
|
||||
}
|
||||
else
|
||||
{
|
||||
input.sidx = "a." + input.sidx;
|
||||
}
|
||||
|
||||
var list = await db.Queryable<EqpSpotInsRecordH, EqpEquipment, UserEntity,UserEntity>((a, b, c,d) => new object[]
|
||||
{
|
||||
JoinType.Left, a.equip_id == b.id,
|
||||
JoinType.Left, a.spot_record_user_id == c.Id,
|
||||
JoinType.Left, a.repeat_user_id == d.Id,
|
||||
})
|
||||
.WhereIF(!string.IsNullOrEmpty(status),(a,b,c)=>a.status==status)
|
||||
.WhereIF(!string.IsNullOrEmpty(equioInfo),(a,b,c)=>b.code.Contains(equioInfo)|| b.name.Contains(equioInfo))
|
||||
.WhereIF(status=="3" && start_time!=null,a=>a.spot_record_date_time>=start_time)
|
||||
.WhereIF(status=="3" && end_time!=null,a=>a.spot_record_date_time<=end_time)
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.Select((a, b, c,d) => new EqpSpotInsRecordListOutput
|
||||
{
|
||||
id = a.id,
|
||||
equip_id = b.code+"/"+b.name,
|
||||
equip_id_id = a.equip_id,
|
||||
status = a.status,
|
||||
result = a.result=="1" ? "合格" : "不合格",
|
||||
repeat_result = a.repeat_result=="1" ? "合格" : "不合格",
|
||||
date_create_time = a.create_time,
|
||||
date_spot_record_date_time = a.spot_record_date_time,
|
||||
date_repeat_time = a.repeat_time,
|
||||
spot_record_user_id = c.RealName,
|
||||
spot_record_user_id_id = a.spot_record_user_id,
|
||||
repeat_user_id = d.RealName,
|
||||
repeat_user_id_id = a.repeat_user_id,
|
||||
})
|
||||
.Mapper(a =>
|
||||
{
|
||||
a.status = a.status=="1" ? "待执行" : a.status=="2" ? "待复核" : "已完成";
|
||||
a.create_time = a.date_create_time == null ? "" : a.date_create_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.spot_record_date_time = a.date_spot_record_date_time == null ? "" : a.date_spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
a.repeat_time = a.date_repeat_time == null ? "" : a.date_repeat_time.Value.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
})
|
||||
.ToPagedListAsync((input?.currentPage ?? 1), (input?.pageSize ?? 50));
|
||||
|
||||
return PageResult<EqpSpotInsRecordListOutput>.SqlSugarPageResult(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -146,16 +210,16 @@ namespace Tnb.EquipMgr
|
||||
{
|
||||
id = a.id,
|
||||
attachment = a.attachment,
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
create_time = a.create_time==null ? null : a.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
equip_id = a.equip_id,
|
||||
repeat_remark = a.repeat_remark,
|
||||
repeat_result = a.repeat_result=="1"?"合格":"不合格",
|
||||
repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
repeat_time = a.repeat_time==null ? null : a.repeat_time.Value.ToString(DbTimeFormat.MM),
|
||||
repeat_user_id = b.RealName,
|
||||
result = a.result=="1"?"合格":"不合格",
|
||||
result_remark = a.result_remark,
|
||||
spot_ins_tem_equip_id = a.spot_ins_tem_equip_id,
|
||||
spot_record_date_time = a.spot_record_date_time==null ? null :a.spot_record_date_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
spot_record_date_time = a.spot_record_date_time==null ? null :a.spot_record_date_time.Value.ToString(DbTimeFormat.MM),
|
||||
spot_record_user_id = a.spot_record_user_id,
|
||||
status = SqlFunc.IF(a.status.Equals("1")).Return("待执行").ElseIF(a.status.Equals("2")).Return("待复核").ElseIF(a.status.Equals("3")).Return("已完成").End("")
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
@@ -182,7 +246,7 @@ namespace Tnb.EquipMgr
|
||||
equip_id = a.equip_id,
|
||||
equip_code = b.code,
|
||||
equip_name = b.name,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
result_remark = a.result_remark,
|
||||
result = a.result,
|
||||
status = a.status,
|
||||
|
||||
@@ -4,6 +4,11 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
public string id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工单号号
|
||||
/// </summary>
|
||||
public string? mo_code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生产任务编号
|
||||
/// </summary>
|
||||
@@ -92,5 +97,34 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public string mold_code { get; set; }
|
||||
public string mold_name { get; set; }
|
||||
public DateTime? create_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 成型周期
|
||||
/// </summary>
|
||||
public decimal? moulding_cycle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 模穴数
|
||||
/// </summary>
|
||||
public int? mold_cavity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 标准工时
|
||||
/// </summary>
|
||||
public string? standard_time { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 实际开工日期
|
||||
/// </summary>
|
||||
public string? act_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预计结束时间
|
||||
/// </summary>
|
||||
public string? plan_end_date { get; set; }
|
||||
/// <summary>
|
||||
/// 实际完工日期
|
||||
/// </summary>
|
||||
public string? act_end_date { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using JNPF.Common.Filter;
|
||||
|
||||
namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
{
|
||||
public class PrdMoTaskListOutput : PageInputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 工位id
|
||||
/// </summary>
|
||||
public string stationId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -43,13 +43,27 @@ namespace Tnb.ProductionMgr.Entities.Dto
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? estimated_start_date { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Desc:预计结束时间
|
||||
/// Default:
|
||||
/// Nullable:True
|
||||
/// </summary>
|
||||
public DateTime? estimated_end_date { get; set; }
|
||||
|
||||
// /// <summary>
|
||||
// /// Desc:预计开始时间
|
||||
// /// Default:
|
||||
// /// Nullable:True
|
||||
// /// </summary>
|
||||
// public string? estimated_start_date { get; set; }
|
||||
//
|
||||
// /// <summary>
|
||||
// /// Desc:预计结束时间
|
||||
// /// Default:
|
||||
// /// Nullable:True
|
||||
// /// </summary>
|
||||
// public string? estimated_end_date { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -100,12 +100,12 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
public int? schedule_type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划开始时间
|
||||
/// 预计开始时间
|
||||
/// </summary>
|
||||
public DateTime? plan_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 计划结束时间
|
||||
/// 预计结束时间
|
||||
/// </summary>
|
||||
public DateTime? plan_end_date { get; set; }
|
||||
|
||||
@@ -150,12 +150,12 @@ public partial class PrdMoTask : BaseEntity<string>
|
||||
public int? prd_order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预计开始时间
|
||||
/// 计划开始时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_start_date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 预计结束时间
|
||||
/// 计划结束时间
|
||||
/// </summary>
|
||||
public DateTime? estimated_end_date { get; set; }
|
||||
|
||||
|
||||
@@ -167,8 +167,8 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
eqp_code = it.eqp_code,
|
||||
eqp_name = it.eqp_name,
|
||||
closedown_start_time = it.closedown_start_time.HasValue ? it.closedown_start_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : null,
|
||||
closedown_end_time = it.closedown_end_time.HasValue ? it.closedown_end_time.Value.ToString("yyyy-MM-dd HH:mm:ss") : null,
|
||||
closedown_start_time = it.closedown_start_time.HasValue ? it.closedown_start_time.Value.ToString(DbTimeFormat.SS) : null,
|
||||
closedown_end_time = it.closedown_end_time.HasValue ? it.closedown_end_time.Value.ToString(DbTimeFormat.SS) : null,
|
||||
closedown_time = it.closedown_time,
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
@@ -396,8 +396,8 @@ namespace Tnb.ProductionMgr
|
||||
id = x.id,
|
||||
mo_task_code = x.mo_task_code,
|
||||
mo_task_status = y.FullName,
|
||||
estimated_start_date = x.estimated_start_date==null ? "" : x.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_end_date = x.estimated_end_date==null ? "" : x.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_start_date = x.estimated_start_date==null ? "" : x.estimated_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
estimated_end_date = x.estimated_end_date==null ? "" : x.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
scheduled_qty = x.scheduled_qty,
|
||||
reported_work_qty = x.reported_work_qty,
|
||||
scrap_qty = x.scrap_qty,
|
||||
@@ -456,8 +456,8 @@ namespace Tnb.ProductionMgr
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
material_standard = b.material_standard,
|
||||
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS)
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<PrdMoFromOneListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
@@ -500,8 +500,8 @@ namespace Tnb.ProductionMgr
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
material_standard = b.material_standard,
|
||||
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
workshop_name = e.FullName,
|
||||
station_name = d.FullName,
|
||||
equip_code = f.code
|
||||
@@ -525,8 +525,8 @@ namespace Tnb.ProductionMgr
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
material_standard = b.material_standard,
|
||||
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
act_start_date = a.act_start_date == null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
act_end_date = a.act_end_date == null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
workline_name = c.FullName,
|
||||
mbom_version = d.version
|
||||
}).ToListAsync();
|
||||
@@ -751,8 +751,8 @@ namespace Tnb.ProductionMgr
|
||||
batch = a.batch,
|
||||
supplier_name = d.supplier_name,
|
||||
check_conclusion = c.check_conclusion,
|
||||
instock_time = c.instock_time.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
feeding_time = e.create_time == null ? "" : e.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
instock_time = c.instock_time.ToString(DbTimeFormat.SS),
|
||||
feeding_time = e.create_time == null ? "" : e.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
}).ToListAsync();
|
||||
|
||||
}
|
||||
@@ -984,7 +984,7 @@ namespace Tnb.ProductionMgr
|
||||
feeding_detail_id = x.id,
|
||||
feeding_time = y.create_time == null
|
||||
? ""
|
||||
: y.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
: y.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
num = x.num,
|
||||
check_conclusion = mp.check_conclusion,
|
||||
feeding_name = z.RealName,
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Tnb.ProductionMgr
|
||||
mo_task_status = d.FullName,
|
||||
plan_qty = f.plan_qty,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
}).OrderByDescending(a=>a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<PrdMoTaskIssueListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
@@ -320,13 +320,13 @@ namespace Tnb.ProductionMgr
|
||||
eqp_name = e.name,
|
||||
eqp_type_code = SqlFunc.Subqueryable<EqpEquipType>().Where(it => it.id == e.equip_type_id).Select(it => it.code),
|
||||
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
|
||||
estimated_start_date = a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_start_date = a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
estimated_end_date = a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
plan_qty = a.scheduled_qty,
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
|
||||
process_code = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_code),
|
||||
process_name = SqlFunc.Subqueryable<BasProcess>().Where(it => it.id == a.process_id).Select(it => it.process_name),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
@@ -353,11 +353,11 @@ namespace Tnb.ProductionMgr
|
||||
process_code = e.process_code,
|
||||
process_name = e.process_name,
|
||||
mo_task_qty = SqlFunc.Subqueryable<PrdMoTask>().Where(a => a.mo_id == moId).Count(),
|
||||
estimated_start_date = a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_start_date = a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
estimated_end_date = a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
plan_qty = a.scheduled_qty,
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS),
|
||||
})
|
||||
.Mapper(it =>
|
||||
{
|
||||
@@ -399,8 +399,8 @@ namespace Tnb.ProductionMgr
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
plan_qty = SqlFunc.Subqueryable<PrdMo>().Where(it => it.id == a.mo_id).Select(it => it.plan_qty),
|
||||
complete_qty = a.last_process_complete_qty,
|
||||
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM),
|
||||
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM),
|
||||
bom_id = d.id,
|
||||
bom_version = d.version
|
||||
})
|
||||
@@ -436,8 +436,8 @@ namespace Tnb.ProductionMgr
|
||||
plan_qty = d.plan_qty,
|
||||
process_task_qty = a.process_task_qty,
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty,0)+SqlFunc.IsNull(a.scrap_qty,0),
|
||||
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
estimated_start_date = a.estimated_start_date==null ? null : a.estimated_start_date.Value.ToString(DbTimeFormat.MM),
|
||||
estimated_end_date = a.estimated_end_date==null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.MM),
|
||||
process_name = e.process_name,
|
||||
bom_version = SqlFunc.Subqueryable<BasMbom>().Where(it => it.material_id == a.material_id).Select(it => it.version)
|
||||
})
|
||||
@@ -681,6 +681,7 @@ namespace Tnb.ProductionMgr
|
||||
moTask.scheduled_qty = input.scheduled_qty;
|
||||
moTask.unit_id = mo.unit_id;
|
||||
moTask.mbom_process_id = basMbomProcess?.id ?? "";
|
||||
moTask.process_id = basMbomProcess.process_id;
|
||||
|
||||
if (!string.IsNullOrEmpty(input.eqp_id))
|
||||
{
|
||||
@@ -1085,6 +1086,8 @@ namespace Tnb.ProductionMgr
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
var taskReportLogs = new List<PrdMoTask>();
|
||||
var prdTaskList = await db.Queryable<PrdMoTask>().Where(it => input.TaskIds.Contains(it.id)).ToListAsync();
|
||||
if (prdTaskList?.Count > 0)
|
||||
@@ -1104,7 +1107,66 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
foreach (var item in prdTaskList)
|
||||
{
|
||||
switch (behavior)
|
||||
{
|
||||
// case PrdTaskBehavior.Release:
|
||||
// if (item.mo_task_status == status)
|
||||
// {
|
||||
// throw Oops.Bah("已下发的不能再下发");
|
||||
// }
|
||||
// break;
|
||||
case PrdTaskBehavior.Start:
|
||||
if (item.mo_task_status == status)
|
||||
{
|
||||
throw Oops.Bah("已开始的不能再开始");
|
||||
}
|
||||
|
||||
if (item.mo_task_status!=DictConst.ToBeStartedEnCode && item.mo_task_status!=DictConst.MoStatusPauseCode)
|
||||
{
|
||||
throw Oops.Bah("状态错误无法开始");
|
||||
}
|
||||
break;
|
||||
case PrdTaskBehavior.Pause:
|
||||
if (item.mo_task_status == status)
|
||||
{
|
||||
throw Oops.Bah("已暂停的不能再暂停");
|
||||
}
|
||||
if (item.mo_task_status!=DictConst.InProgressEnCode)
|
||||
{
|
||||
throw Oops.Bah("状态错误无法暂停");
|
||||
}
|
||||
break;
|
||||
case PrdTaskBehavior.Compled:
|
||||
if (item.mo_task_status == status)
|
||||
{
|
||||
throw Oops.Bah("已完成的不能再完成");
|
||||
}
|
||||
if (item.mo_task_status!=DictConst.InProgressEnCode && item.mo_task_status!=DictConst.MoStatusPauseCode)
|
||||
{
|
||||
throw Oops.Bah("状态错误无法完成");
|
||||
}
|
||||
break;
|
||||
case PrdTaskBehavior.Closed:
|
||||
if (item.mo_task_status == status)
|
||||
{
|
||||
throw Oops.Bah("已关闭的不能再关闭");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
prdTaskList.ForEach(x => x.mo_task_status = status);
|
||||
if (behavior == PrdTaskBehavior.Start)
|
||||
{
|
||||
prdTaskList.ForEach(x => x.act_start_date = DateTime.Now);
|
||||
}
|
||||
if (behavior == PrdTaskBehavior.Compled)
|
||||
{
|
||||
prdTaskList.ForEach(x => x.act_end_date = DateTime.Now);
|
||||
}
|
||||
row = await db.Updateable(prdTaskList).ExecuteCommandAsync();
|
||||
foreach (var item in prdTaskList)
|
||||
{
|
||||
@@ -1494,6 +1556,25 @@ namespace Tnb.ProductionMgr
|
||||
.SetColumns(x => x.complete_qty == x.complete_qty + input.reported_qty)
|
||||
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
PerProcessStandardsH processStandardsH = await db.Queryable<PerProcessStandardsH>()
|
||||
.Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id &&
|
||||
x.output_material_id == prdMoTask.material_id && x.enabled == 1)
|
||||
.OrderByDescending(x => x.create_time).FirstAsync();
|
||||
|
||||
ToolMolds toolMolds = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
||||
if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null &&
|
||||
processStandardsH?.moulding_cycle > 0)
|
||||
{
|
||||
decimal? addTime = ((prdMoTask.scheduled_qty-input.reported_qty-(prdMoTask.scrap_qty??0)) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1;
|
||||
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
|
||||
{
|
||||
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prdMoTask.schedule_type == 2 && !string.IsNullOrEmpty(prdMoTask.mbom_process_id))
|
||||
@@ -1541,6 +1622,20 @@ namespace Tnb.ProductionMgr
|
||||
.Where(x => x.id == prdMo.id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var list = await db.Queryable<BasMbomProcess>()
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id && b.enabled==1)
|
||||
.Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync();
|
||||
|
||||
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
|
||||
decimal? addTime = (prdMoTask.scheduled_qty-input.reported_qty-(prdMoTask.scrap_qty??0)) * max;
|
||||
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
|
||||
{
|
||||
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
var master = await db.Queryable<PrdReportRecord>().FirstAsync(it => it.mo_task_id == input.mo_task_id);
|
||||
@@ -1753,6 +1848,44 @@ namespace Tnb.ProductionMgr
|
||||
await db.Updateable(reportMaster).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
if (prdMoTask.schedule_type == 1)
|
||||
{
|
||||
PerProcessStandardsH processStandardsH = await db.Queryable<PerProcessStandardsH>()
|
||||
.Where(x => x.equip_id == prdMoTask.eqp_id && x.molds_id == prdMoTask.mold_id &&
|
||||
x.output_material_id == prdMoTask.material_id && x.enabled == 1)
|
||||
.OrderByDescending(x => x.create_time).FirstAsync();
|
||||
|
||||
ToolMolds toolMolds = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == prdMoTask.mold_id);
|
||||
if (toolMolds != null && toolMolds?.mold_cavity > 0 && processStandardsH != null &&
|
||||
processStandardsH?.moulding_cycle > 0)
|
||||
{
|
||||
decimal? addTime = ((prdMoTask.scheduled_qty-prdMoTask.reported_work_qty-input.scrap_qty) * processStandardsH?.moulding_cycle - 1) / toolMolds.mold_cavity + 1;
|
||||
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
|
||||
{
|
||||
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var list = await db.Queryable<BasMbomProcess>()
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id && b.enabled==1)
|
||||
.Where((a,b)=>a.process_id==prdMoTask.process_id).Select((a,b)=>b).ToListAsync();
|
||||
|
||||
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
|
||||
decimal? addTime = (prdMoTask.scheduled_qty-prdMoTask.reported_work_qty-input.scrap_qty) * max;
|
||||
if (prdMoTask.act_start_date != null && addTime != null && addTime > 0)
|
||||
{
|
||||
DateTime cal_plan_end_date = prdMoTask.act_start_date.Value.AddSeconds((double)addTime);
|
||||
await db.Updateable<PrdMoTask>()
|
||||
.SetColumns(x => x.plan_end_date == cal_plan_end_date)
|
||||
.Where(x => x.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return result.IsSuccess;
|
||||
}
|
||||
@@ -1951,7 +2084,7 @@ namespace Tnb.ProductionMgr
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
eqp_id = a.eqp_id==null ? "" : h.code+"/"+h.name,
|
||||
eqp_id_id = a.eqp_id,
|
||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString("yyyy-MM-dd HH:mm:ss")
|
||||
create_time = a.create_time==null ? "" :a.create_time.Value.ToString(DbTimeFormat.SS)
|
||||
}).OrderByDescending(a => a.create_time).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
return PageResult<WorkOrderAdjustmentListOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
@@ -2018,7 +2151,7 @@ namespace Tnb.ProductionMgr
|
||||
else
|
||||
{
|
||||
var list = await db.Queryable<BasMbomProcess>()
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id)
|
||||
.LeftJoin<BasStandardTime>((a,b)=>a.process_id==b.process_id && b.enabled==1)
|
||||
.Where((a,b)=>a.mbom_id==input.mbom_id).Select((a,b)=>b).ToListAsync();
|
||||
|
||||
decimal max = list.Select(x => Convert.ToDecimal(x.standard_time)).Max(x => x);
|
||||
@@ -2027,6 +2160,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取这个产线生产中的任务单
|
||||
|
||||
@@ -12,6 +12,7 @@ using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.PerMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
@@ -275,8 +276,8 @@ namespace Tnb.ProductionMgr
|
||||
scrap_qty = a.scrap_qty,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
reported_work_qty = a.reported_work_qty,
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
parent_id = a.parent_id,
|
||||
process_id = a.process_id,
|
||||
process_name = c.process_name,
|
||||
@@ -331,8 +332,8 @@ namespace Tnb.ProductionMgr
|
||||
scrap_qty = a.scrap_qty,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
reported_work_qty = a.reported_work_qty,
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
parent_id = a.parent_id,
|
||||
process_id = a.process_id,
|
||||
process_name = c.process_name,
|
||||
@@ -347,9 +348,9 @@ namespace Tnb.ProductionMgr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetPadPrdMoTaskList(PrdPackReportQueryInput input)
|
||||
public async Task<dynamic> GetPadPrdMoTaskList(PrdMoTaskListOutput input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.stationId))
|
||||
if (string.IsNullOrEmpty(input.stationId))
|
||||
{
|
||||
return new
|
||||
{
|
||||
@@ -357,7 +358,38 @@ namespace Tnb.ProductionMgr
|
||||
list = Array.Empty<string>()
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
||||
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||
string status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
|
||||
DateTime? start_time = queryJson.ContainsKey("start_time") ? queryJson["start_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["start_time"]) : null;
|
||||
DateTime? end_time = queryJson.ContainsKey("end_time") ? queryJson["end_time"].ToString()=="" ? null : Convert.ToDateTime(queryJson["end_time"]) : null;
|
||||
List<string> statusList = new List<string>();
|
||||
if (!string.IsNullOrEmpty(status))
|
||||
{
|
||||
switch (status)
|
||||
{
|
||||
case "1":
|
||||
statusList.Add(DictConst.InProgressEnCode);
|
||||
statusList.Add(DictConst.MoStatusPauseCode);
|
||||
break;
|
||||
case "2":
|
||||
statusList.Add(DictConst.ToBeScheduledEncode);
|
||||
statusList.Add(DictConst.ToBeStartedEnCode);
|
||||
break;
|
||||
case "3":
|
||||
statusList.Add(DictConst.ComplatedEnCode);
|
||||
statusList.Add(DictConst.ClosedEnCode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// string mo_task_status = queryJson.ContainsKey("mo_task_status") ? queryJson["mo_task_status"].ToString() : "";
|
||||
if (string.IsNullOrEmpty(input.sidx))
|
||||
{
|
||||
input.sidx = "create_time";
|
||||
input.sort = "desc";
|
||||
}
|
||||
|
||||
var result = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<BasProcess>((a, b, c) => a.process_id == c.id)
|
||||
@@ -365,12 +397,21 @@ namespace Tnb.ProductionMgr
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId && a.mo_task_status == e.EnCode)
|
||||
.LeftJoin<EqpEquipment>((a,b,c,d,e,f)=>a.eqp_id==f.id)
|
||||
.LeftJoin<ToolMolds>((a,b,c,d,e,f,g)=>a.mold_id==g.id)
|
||||
.LeftJoin<PerProcessStandardsH>((a,b,c,d,e,f,g,h)=>a.material_id==h.output_material_id && a.eqp_id==h.equip_id && a.mold_id==h.molds_id && h.enabled==1)
|
||||
.LeftJoin<BasStandardTime>((a,b,c,d,e,f,g,h,i)=>a.process_id==i.process_id && i.enabled==1)
|
||||
.LeftJoin<PrdMo>((a,b,c,d,e,f,g,h,i,j)=>a.mo_id==j.id)
|
||||
.Where((a, b) => a.workstation_id == input.stationId && (a.mo_task_status == DictConst.ToBeStartedEnCode || a.mo_task_status == DictConst.MoStatusPauseCode || a.mo_task_status == DictConst.ComplatedEnCode || a.mo_task_status == DictConst.InProgressEnCode) )
|
||||
.Select((a, b, c, d, e,f,g) => new PADPackageTaskPageOutput
|
||||
.WhereIF(!string.IsNullOrEmpty(mo_task_code),a=>a.mo_task_code.Contains(mo_task_code))
|
||||
//.WhereIF(!string.IsNullOrEmpty(mo_task_status),a=>a.mo_task_status==mo_task_status)
|
||||
.WhereIF(statusList.Count>0,a=>statusList.Contains(a.mo_task_status))
|
||||
.WhereIF(status=="3" && start_time!=null,a=>a.act_end_date>=start_time)
|
||||
.WhereIF(status=="3" && end_time!=null,a=>a.act_end_date<=end_time)
|
||||
.Select((a, b, c, d, e,f,g,h,i,j) => new PADPackageTaskPageOutput
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
mo_id = a.mo_id,
|
||||
mo_code = j.mo_code,
|
||||
material_id = a.material_id,
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
@@ -382,8 +423,8 @@ namespace Tnb.ProductionMgr
|
||||
scrap_qty = a.scrap_qty,
|
||||
scheduled_qty = a.scheduled_qty,
|
||||
reported_work_qty = a.reported_work_qty,
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss"),
|
||||
estimated_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
estimated_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
parent_id = a.parent_id,
|
||||
process_id = a.process_id,
|
||||
process_name = c.process_name,
|
||||
@@ -396,10 +437,16 @@ namespace Tnb.ProductionMgr
|
||||
mold_code = g.mold_code,
|
||||
mold_name = g.mold_name,
|
||||
schedule_type = a.schedule_type,
|
||||
mold_cavity = g.mold_cavity,
|
||||
moulding_cycle = h.moulding_cycle,
|
||||
standard_time = i.standard_time,
|
||||
act_start_date = a.act_start_date==null ? "" : a.act_start_date.Value.ToString(DbTimeFormat.SS),
|
||||
act_end_date = a.act_end_date==null ? "" : a.act_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderByDescending((a) => a.create_time)
|
||||
.ToPagedListAsync(input.currentPage, int.MaxValue);
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<PADPackageTaskPageOutput>.SqlSugarPageResult(result);
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Tnb.ProductionMgr
|
||||
reported_qty = x.reported_qty,
|
||||
create_id = y.RealName,
|
||||
create_id_id = x.create_id,
|
||||
create_time = x.create_time==null ? "" : x.create_time.Value.ToString("yyyy-MM-dd HH:mm"),
|
||||
create_time = x.create_time==null ? "" : x.create_time.Value.ToString(DbTimeFormat.MM),
|
||||
batch = x.barcode
|
||||
})
|
||||
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
@@ -94,6 +94,8 @@ namespace Tnb.QcMgr.Entities
|
||||
public string? greaterThanValue { get; set; }
|
||||
public string? lessThanValue { get; set; }
|
||||
public string? excontentText { get; set; }
|
||||
|
||||
public string? value { get; set; }
|
||||
public List<ExcontentOption>? excontentOptions { get; set; }
|
||||
}
|
||||
public class ExcontentOption
|
||||
|
||||
@@ -284,6 +284,7 @@ namespace Tnb.QcMgr
|
||||
Result.checknum = QcCheckExecH.checknum!;
|
||||
Result.status = QcCheckExecH.status!;
|
||||
Result.checktypes = new List<List<Checktype>>();
|
||||
Result.result = QcCheckExecH.result;
|
||||
var groupkeys = QcCheckExecDs.Select(p=>p.checkindex).Distinct().ToList();
|
||||
foreach (var key in groupkeys)
|
||||
{
|
||||
@@ -304,6 +305,7 @@ namespace Tnb.QcMgr
|
||||
Item.itemdid = QcCheckExecD.id!;
|
||||
Item.code = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().code!;
|
||||
Item.name = QcCheckItems.Where(p => p.id == QcCheckExecD.itemid).First().name!;
|
||||
Item.result = QcCheckExecD.result;
|
||||
Item.setData = new ExecItemData();
|
||||
Item.setData.extype = QcCheckExecD.extype!;
|
||||
Item.setData.excontent = JSON.Deserialize<Excontent>(QcCheckExecD.excontent!);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF;
|
||||
using System.Globalization;
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Filter;
|
||||
using JNPF.Common.Options;
|
||||
using JNPF.EventHandler;
|
||||
@@ -48,7 +49,8 @@ public static class ConfigureMvcControllerExtensions
|
||||
options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
|
||||
|
||||
// 格式化json输出的日期格式为时间戳
|
||||
options.SerializerSettings.Converters.Add(new NewtonsoftDateTimeJsonConverter());
|
||||
// options.SerializerSettings.Converters.Add(new NewtonsoftDateTimeJsonConverter());
|
||||
options.SerializerSettings.Converters.Add(new MyNewtonsoftDateTimeJsonConverter());//zhoukeda 2023.10.24
|
||||
});
|
||||
|
||||
services.AddUnifyJsonOptions("special", new JsonSerializerSettings
|
||||
@@ -123,4 +125,41 @@ public static class ConfigureMvcControllerExtensions
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
public class MyNewtonsoftDateTimeJsonConverter : NewtonsoftDateTimeJsonConverter
|
||||
{
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
bool flag = NewtonsoftDateTimeJsonConverter.IsNullable(objectType);
|
||||
if (reader.TokenType == JsonToken.Null || string.IsNullOrEmpty(reader.Value.ToString()))
|
||||
{
|
||||
if (!flag)
|
||||
throw new JsonSerializationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Cannot convert null value to {0}.", (object) objectType));
|
||||
return (object) null;
|
||||
}
|
||||
long result = 0;
|
||||
if (reader.TokenType == JsonToken.Integer)
|
||||
result = (long) reader.Value;
|
||||
else if (reader.TokenType == JsonToken.String)
|
||||
{
|
||||
if (!long.TryParse((string) reader.Value, out result))
|
||||
return (object) Convert.ToDateTime(reader.Value.ToString());
|
||||
return reader.TokenType == JsonToken.Date ? reader.Value : throw new JsonSerializationException(string.Format((IFormatProvider) CultureInfo.InvariantCulture, "Unexpected token parsing date. Expected Integer or String, got {0}.", (object) reader.TokenType));
|
||||
}
|
||||
if (result < 0L)
|
||||
return (object) DateTime.Now;
|
||||
try
|
||||
{
|
||||
DateTime dt = Convert.ToDateTime(reader.Value.ToString());
|
||||
return dt;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DateTimeOffset dateTimeOffset = DateTimeOffset.FromUnixTimeMilliseconds(result);
|
||||
dateTimeOffset = dateTimeOffset.ToLocalTime();
|
||||
DateTime dateTime = dateTimeOffset.DateTime;
|
||||
return (flag ? Nullable.GetUnderlyingType(objectType) : objectType) == typeof (DateTimeOffset) ? (object) new DateTimeOffset(dateTime, TimeSpan.Zero) : (object) dateTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user