Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -142,7 +142,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PrdMoReverseFromMaterialput
|
public class PrdMoReverseFromMaterialoutput
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 物料ID
|
/// 物料ID
|
||||||
@@ -153,6 +153,14 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string material_code { get; set; }
|
public string material_code { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 物料名称
|
||||||
|
/// </summary>
|
||||||
|
public string material_name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 物料规格
|
||||||
|
/// </summary>
|
||||||
|
public string material_standard { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// 批次
|
/// 批次
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string code_batch { get; set;}
|
public string code_batch { get; set;}
|
||||||
@@ -208,6 +216,12 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
/// 已投数量
|
/// 已投数量
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public decimal feeding_num { get; set; }
|
public decimal feeding_num { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 使用状态
|
||||||
|
/// </summary>
|
||||||
|
public string use_status { get; set; }
|
||||||
|
public string supplier_name { get; set; }
|
||||||
|
public string unit_name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -234,6 +248,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
|||||||
/// 投料子表id
|
/// 投料子表id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string feeding_detail_id { get; set; }
|
public string feeding_detail_id { get; set; }
|
||||||
|
public string mo_task_code { get; set; }
|
||||||
public string feeding_time { get; set; }
|
public string feeding_time { get; set; }
|
||||||
public decimal num { get; set; }
|
public decimal num { get; set; }
|
||||||
public string check_conclusion { get; set; }
|
public string check_conclusion { get; set; }
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities.Entity
|
||||||
|
{
|
||||||
|
public class AppPrdMoTaskLogListOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string mo_task_code { get; set; }
|
||||||
|
public string mo_task_status { get; set; }
|
||||||
|
public string material_id { get; set; }
|
||||||
|
public string material_id_id { get; set; }
|
||||||
|
public string material_code { get; set; }
|
||||||
|
public string material_name { get; set; }
|
||||||
|
public string mold_id { get; set; }
|
||||||
|
public string mold_id_id { get; set; }
|
||||||
|
public string mold_code { get; set; }
|
||||||
|
public string eqp_id { get; set; }
|
||||||
|
public string eqp_id_id { get; set; }
|
||||||
|
public string equip_code { get; set; }
|
||||||
|
|
||||||
|
public string process_id { get; set; }
|
||||||
|
public string process_id_id { get; set; }
|
||||||
|
public string process_code { get; set; }
|
||||||
|
public string mbom_process_id { get; set; }
|
||||||
|
public int? scheduled_qty { get; set; }
|
||||||
|
public int? reported_work_qty { get; set; }
|
||||||
|
public int? scrap_qty { get; set; }
|
||||||
|
|
||||||
|
public string plan_start_date { get; set; }
|
||||||
|
|
||||||
|
public string plan_end_date { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
namespace Tnb.ProductionMgr.Entities
|
||||||
|
{
|
||||||
|
public class AppPrdMoTaskOneListOutput
|
||||||
|
{
|
||||||
|
public string id { get; set; }
|
||||||
|
public string mo_task_code { get; set; }
|
||||||
|
public string mo_task_status { get; set; }
|
||||||
|
public string material_id { get; set; }
|
||||||
|
public string material_id_id { get; set; }
|
||||||
|
public string material_code { get; set; }
|
||||||
|
public string material_name { get; set; }
|
||||||
|
public string mold_id { get; set; }
|
||||||
|
public string mold_id_id { get; set; }
|
||||||
|
public string mold_code { get; set; }
|
||||||
|
public string eqp_id { get; set; }
|
||||||
|
public string eqp_id_id { get; set; }
|
||||||
|
public string equip_code { get; set; }
|
||||||
|
|
||||||
|
public string process_id { get; set; }
|
||||||
|
public string process_id_id { get; set; }
|
||||||
|
public string process_code { get; set; }
|
||||||
|
public string mbom_process_id { get; set; }
|
||||||
|
public int? scheduled_qty { get; set; }
|
||||||
|
public int? reported_work_qty { get; set; }
|
||||||
|
public int? scrap_qty { get; set; }
|
||||||
|
|
||||||
|
public string plan_start_date { get; set; }
|
||||||
|
|
||||||
|
public string plan_end_date { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -73,5 +73,15 @@ public partial class PrdMoTaskLog : BaseEntity<string>
|
|||||||
/// 任务单编号
|
/// 任务单编号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? mo_task_code { get; set; }
|
public string? mo_task_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工位编号
|
||||||
|
/// </summary>
|
||||||
|
public string? station_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 工序编号
|
||||||
|
/// </summary>
|
||||||
|
public string? process_code { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
125
ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs
Normal file
125
ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskLogService.cs
Normal file
@@ -0,0 +1,125 @@
|
|||||||
|
using COSXML.Model.Tag;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.APP
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 移动端任务单操作记录
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
[OverideVisualDev(ModuleId)]
|
||||||
|
public class AppPrdMoTaskLogService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "28491200142101";
|
||||||
|
private readonly ISqlSugarRepository<PrdMoTask> _repository;
|
||||||
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IBillRullService _billRuleService;
|
||||||
|
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
public AppPrdMoTaskLogService(
|
||||||
|
ISqlSugarRepository<PrdMoTask> repository,
|
||||||
|
IDictionaryDataService dictionaryDataService,
|
||||||
|
IUserManager userManager,
|
||||||
|
IRunService runService,
|
||||||
|
IBillRullService billRullService,
|
||||||
|
IVisualDevService visualDevService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_db = _repository.AsSugarClient();
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
_dictionaryDataService = dictionaryDataService;
|
||||||
|
_billRuleService = billRullService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||||
|
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||||
|
string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : "";
|
||||||
|
string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : "";
|
||||||
|
var result = await db.Queryable<PrdMoTask>()
|
||||||
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
|
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||||
|
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId)
|
||||||
|
.LeftJoin<BasProcess>((a,b,c,d,e,f)=>a.process_id==f.id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code))
|
||||||
|
.OrderByDescending(a => a.create_time)
|
||||||
|
.Select((a, b, c, d, e,f) => new AppPrdMoTaskOneListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
mo_task_code = a.mo_task_code,
|
||||||
|
mo_task_status = e.FullName,
|
||||||
|
material_id_id = a.material_id,
|
||||||
|
material_id = b.code+"/"+b.name,
|
||||||
|
material_code = b.code,
|
||||||
|
material_name = b.name,
|
||||||
|
mold_id_id = a.mold_id,
|
||||||
|
mold_id = c.mold_code,
|
||||||
|
mold_code = c.mold_code,
|
||||||
|
eqp_id_id = a.eqp_id,
|
||||||
|
eqp_id = d.code,
|
||||||
|
equip_code = d.code,
|
||||||
|
process_id_id = a.process_id,
|
||||||
|
process_id = f.process_name,
|
||||||
|
process_code = f.process_code,
|
||||||
|
mbom_process_id = a.mbom_process_id,
|
||||||
|
scheduled_qty = a.scheduled_qty,
|
||||||
|
reported_work_qty = a.reported_work_qty,
|
||||||
|
scrap_qty = a.scrap_qty,
|
||||||
|
plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
return PageResult<AppPrdMoTaskOneListOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据任务单id获取操作记录
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dic"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetLogById(Dictionary<string, string> dic)
|
||||||
|
{
|
||||||
|
string mo_task_id = dic.ContainsKey("mo_task_id") ? dic["mo_task_id"] : "";
|
||||||
|
if (string.IsNullOrEmpty(mo_task_id)) return Array.Empty<string>();
|
||||||
|
Dictionary<string,object> statsDic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||||
|
return await _db.Queryable<PrdMoTaskLog>().Where(x=>x.mo_task_id==mo_task_id)
|
||||||
|
.OrderBy(x=>x.create_time)
|
||||||
|
.Mapper(x =>
|
||||||
|
{
|
||||||
|
if (statsDic.ContainsKey(x.status))
|
||||||
|
{
|
||||||
|
x.status = statsDic[x.status].ToString();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
using COSXML.Model.Tag;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.APP
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 移动端注塑挤出任务管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
[OverideVisualDev(ModuleId)]
|
||||||
|
public class AppPrdMoTaskOneService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "27890354204949";
|
||||||
|
private readonly ISqlSugarRepository<PrdMoTask> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IBillRullService _billRuleService;
|
||||||
|
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
public AppPrdMoTaskOneService(
|
||||||
|
ISqlSugarRepository<PrdMoTask> repository,
|
||||||
|
IUserManager userManager,
|
||||||
|
IRunService runService,
|
||||||
|
IBillRullService billRullService,
|
||||||
|
IVisualDevService visualDevService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_db = _repository.AsSugarClient();
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
_billRuleService = billRullService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||||
|
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||||
|
string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : "";
|
||||||
|
string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : "";
|
||||||
|
var result = await db.Queryable<PrdMoTask>()
|
||||||
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
|
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||||
|
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code))
|
||||||
|
.Where(a => a.schedule_type == 1)
|
||||||
|
.Where(a => (a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode || a.mo_task_status==DictConst.MoStatusExceptionCode || a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ComplatedEnCode))
|
||||||
|
.OrderByDescending(a => a.create_time)
|
||||||
|
.Select((a, b, c, d, e) => new AppPrdMoTaskOneListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
mo_task_code = a.mo_task_code,
|
||||||
|
mo_task_status = e.FullName,
|
||||||
|
material_id_id = a.material_id,
|
||||||
|
material_id = b.code+"/"+b.name,
|
||||||
|
material_code = b.code,
|
||||||
|
material_name = b.name,
|
||||||
|
mold_id_id = a.mold_id,
|
||||||
|
mold_id = c.mold_code,
|
||||||
|
mold_code = c.mold_code,
|
||||||
|
eqp_id_id = a.eqp_id,
|
||||||
|
eqp_id = d.code,
|
||||||
|
equip_code = d.code,
|
||||||
|
scheduled_qty = a.scheduled_qty,
|
||||||
|
reported_work_qty = a.reported_work_qty,
|
||||||
|
scrap_qty = a.scrap_qty,
|
||||||
|
plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
return PageResult<AppPrdMoTaskOneListOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
101
ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs
Normal file
101
ProductionMgr/Tnb.ProductionMgr/APP/AppPrdMoTaskTwoService.cs
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
using COSXML.Model.Tag;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
|
using JNPF.Common.Filter;
|
||||||
|
using JNPF.DependencyInjection;
|
||||||
|
using JNPF.DynamicApiController;
|
||||||
|
using JNPF.Systems.Entitys.System;
|
||||||
|
using JNPF.Systems.Interfaces.System;
|
||||||
|
using JNPF.VisualDev;
|
||||||
|
using JNPF.VisualDev.Entitys.Dto.VisualDevModelData;
|
||||||
|
using JNPF.VisualDev.Interfaces;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.ProductionMgr.Entities;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
|
using Tnb.EquipMgr.Entities;
|
||||||
|
using Tnb.BasicData;
|
||||||
|
|
||||||
|
namespace Tnb.ProductionMgr.APP
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 移动端组装包装任务管理
|
||||||
|
/// </summary>
|
||||||
|
[ApiDescriptionSettings(Tag = ModuleConst.Tag, Area = ModuleConst.Area, Order = 700)]
|
||||||
|
[Route("api/[area]/[controller]/[action]")]
|
||||||
|
[OverideVisualDev(ModuleId)]
|
||||||
|
public class AppPrdMoTaskTwoService : IOverideVisualDevService, IDynamicApiController, ITransient
|
||||||
|
{
|
||||||
|
private const string ModuleId = "28486997557781";
|
||||||
|
private readonly ISqlSugarRepository<PrdMoTask> _repository;
|
||||||
|
private readonly IUserManager _userManager;
|
||||||
|
private readonly IRunService _runService;
|
||||||
|
private readonly IVisualDevService _visualDevService;
|
||||||
|
private readonly ISqlSugarClient _db;
|
||||||
|
private readonly IBillRullService _billRuleService;
|
||||||
|
|
||||||
|
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||||
|
public AppPrdMoTaskTwoService(
|
||||||
|
ISqlSugarRepository<PrdMoTask> repository,
|
||||||
|
IUserManager userManager,
|
||||||
|
IRunService runService,
|
||||||
|
IBillRullService billRullService,
|
||||||
|
IVisualDevService visualDevService
|
||||||
|
)
|
||||||
|
{
|
||||||
|
_repository = repository;
|
||||||
|
_userManager = userManager;
|
||||||
|
_runService = runService;
|
||||||
|
_visualDevService = visualDevService;
|
||||||
|
_db = _repository.AsSugarClient();
|
||||||
|
OverideFuncs.GetListAsync = GetList;
|
||||||
|
_billRuleService = billRullService;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||||
|
{
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
Dictionary<string, string> queryJson = !string.IsNullOrEmpty(input.queryJson) ? Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(input.queryJson) : new Dictionary<string, string>();
|
||||||
|
string mo_task_code = queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||||
|
string material_code = queryJson.ContainsKey("material_id") ? queryJson["material_id"].ToString() : "";
|
||||||
|
string equip_code = queryJson.ContainsKey("eqp_id") ? queryJson["eqp_id"].ToString() : "";
|
||||||
|
var result = await db.Queryable<PrdMoTask>()
|
||||||
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
|
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||||
|
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a, b, c, d, e) => e.EnCode == a.mo_task_status && e.DictionaryTypeId == DictConst.PrdTaskStatusTypeId)
|
||||||
|
.LeftJoin<BasProcess>((a,b,c,d,e,f)=>a.process_id==f.id)
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(mo_task_code), (a, b, c, d, e) => a.mo_task_code.Contains(mo_task_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(material_code), (a, b, c, d, e) => b.code.Contains(material_code) || b.name.Contains(material_code))
|
||||||
|
.WhereIF(!string.IsNullOrEmpty(equip_code), (a, b, c, d, e) => d.code.Contains(equip_code) || d.name.Contains(equip_code))
|
||||||
|
.Where(a => a.schedule_type == 2)
|
||||||
|
.Where(a => (a.mo_task_status==DictConst.ToBeStartedEnCode || a.mo_task_status==DictConst.InProgressEnCode || a.mo_task_status==DictConst.MoStatusExceptionCode || a.mo_task_status==DictConst.MoStatusPauseCode || a.mo_task_status==DictConst.ComplatedEnCode))
|
||||||
|
.OrderByDescending(a => a.create_time)
|
||||||
|
.Select((a, b, c, d, e,f) => new AppPrdMoTaskOneListOutput
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
mo_task_code = a.mo_task_code,
|
||||||
|
mo_task_status = e.FullName,
|
||||||
|
material_id_id = a.material_id,
|
||||||
|
material_id = b.code+"/"+b.name,
|
||||||
|
material_code = b.code,
|
||||||
|
material_name = b.name,
|
||||||
|
mold_id_id = a.mold_id,
|
||||||
|
mold_id = c.mold_code,
|
||||||
|
mold_code = c.mold_code,
|
||||||
|
eqp_id_id = a.eqp_id,
|
||||||
|
eqp_id = d.code,
|
||||||
|
equip_code = d.code,
|
||||||
|
process_id_id = a.process_id,
|
||||||
|
process_id = f.process_name,
|
||||||
|
process_code = f.process_code,
|
||||||
|
mbom_process_id = a.mbom_process_id,
|
||||||
|
scheduled_qty = a.scheduled_qty,
|
||||||
|
reported_work_qty = a.reported_work_qty,
|
||||||
|
scrap_qty = a.scrap_qty,
|
||||||
|
plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
plan_end_date = a.plan_end_date==null ? "" : a.plan_end_date.Value.ToString("yyyy-MM-dd"),
|
||||||
|
}).ToPagedListAsync(input.currentPage, input.pageSize);
|
||||||
|
return PageResult<AppPrdMoTaskOneListOutput>.SqlSugarPageResult(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -873,12 +873,24 @@ namespace Tnb.ProductionMgr
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PageResult<PrdMoReverseFromMaterialput> output = JsonConvert.DeserializeObject<PageResult<PrdMoReverseFromMaterialput>>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter());
|
PageResult<PrdMoReverseFromMaterialoutput> output = JsonConvert.DeserializeObject<PageResult<PrdMoReverseFromMaterialoutput>>(authResponse.data.ToString(),new Tnb.Common.Utils.DateTimeJsonConverter());
|
||||||
if (output.list != null && output.list.Count > 0)
|
if (output.list != null && output.list.Count > 0)
|
||||||
{
|
{
|
||||||
|
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==output.list[0].material_id);
|
||||||
|
BasSupplier basSupplier = await _db.Queryable<BasSupplier>().SingleAsync(x=>x.id==output.list[0].supplier_id);
|
||||||
|
DictionaryDataEntity unit = await _db.Queryable<DictionaryTypeEntity>()
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a,b)=>a.Id==b.DictionaryTypeId)
|
||||||
|
.Where((a,b)=>a.EnCode==DictConst.MeasurementUnit && b.EnCode==output.list[0].unit_id)
|
||||||
|
.Select((a,b)=>b)
|
||||||
|
.FirstAsync();
|
||||||
output.list[0].feeding_num = await _db.Queryable<PrdMaterialReceiptD>()
|
output.list[0].feeding_num = await _db.Queryable<PrdMaterialReceiptD>()
|
||||||
.LeftJoin<PrdFeedingD>((a, b) => a.id == b.material_receipt_detail_id)
|
.LeftJoin<PrdFeedingD>((a, b) => a.id == b.material_receipt_detail_id)
|
||||||
.Where((a, b) => a.barcode == barcode).SumAsync((a, b) => b.num);
|
.Where((a, b) => a.barcode == barcode).SumAsync((a, b) => b.num);
|
||||||
|
output.list[0].material_name = basMaterial.name;
|
||||||
|
output.list[0].material_standard = basMaterial.material_standard;
|
||||||
|
output.list[0].supplier_name = basSupplier.supplier_name;
|
||||||
|
output.list[0].unit_name = unit.FullName;
|
||||||
|
|
||||||
return output.list[0];
|
return output.list[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2062,7 +2062,7 @@ namespace Tnb.ProductionMgr
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
return result.IsSuccess ? "更换成功" : result.ErrorMessage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2109,7 +2109,7 @@ namespace Tnb.ProductionMgr
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
return result.IsSuccess ? "更换成功" : result.ErrorMessage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2156,9 +2156,53 @@ namespace Tnb.ProductionMgr
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
if (!result.IsSuccess) throw Oops.Bah(result.ErrorMessage);
|
||||||
return result.IsSuccess ? "延期成功" : result.ErrorMessage;
|
return result.IsSuccess ? "更换成功" : result.ErrorMessage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 根据id获取任务单相关信息
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task<dynamic> GetPrdMoTaskInfoById(Dictionary<string,string> dic)
|
||||||
|
{
|
||||||
|
string id = dic.ContainsKey("id") ? dic["id"] : "";
|
||||||
|
if (string.IsNullOrEmpty(id)) return null;
|
||||||
|
var db = _repository.AsSugarClient();
|
||||||
|
return await db.Queryable<PrdMoTask>()
|
||||||
|
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||||
|
.LeftJoin<ToolMolds>((a, b, c) => a.mold_id == c.id)
|
||||||
|
.LeftJoin<EqpEquipment>((a, b, c, d) => a.eqp_id == d.id)
|
||||||
|
.LeftJoin<DictionaryDataEntity>((a,b,c,d,e)=>e.EnCode==a.mo_task_status && e.DictionaryTypeId==DictConst.PrdTaskStatusTypeId)
|
||||||
|
.LeftJoin<BasProcess>((a,b,c,d,e,f)=>a.process_id==f.id)
|
||||||
|
.LeftJoin<OrganizeEntity>((a,b,c,d,e,f,g)=>a.workstation_id==g.Id)
|
||||||
|
.Where((a, b, c, d) => a.id == id)
|
||||||
|
.Select((a, b, c, d,e,f,g) => new
|
||||||
|
{
|
||||||
|
id = a.id,
|
||||||
|
mo_task_code = a.mo_task_code,
|
||||||
|
mo_task_status = e.FullName,
|
||||||
|
material_id = a.material_id,
|
||||||
|
material_code = b.code,
|
||||||
|
material_name = b.name,
|
||||||
|
mold_id = a.mold_id,
|
||||||
|
mold_code = c.mold_code,
|
||||||
|
mold_name = c.mold_name,
|
||||||
|
schedule_type = a.schedule_type,
|
||||||
|
equip_code = d.code,
|
||||||
|
equip_name = d.name,
|
||||||
|
workstation_id = a.workstation_id,
|
||||||
|
workstation_code = g.EnCode,
|
||||||
|
workstation_name = g.FullName,
|
||||||
|
scheduled_qty = a.scheduled_qty,
|
||||||
|
reported_work_qty = a.reported_work_qty,
|
||||||
|
scrap_qty = a.scrap_qty,
|
||||||
|
process_id = a.process_id,
|
||||||
|
process_name = f.process_name,
|
||||||
|
}).FirstAsync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,4 +107,34 @@ namespace Tnb.QcMgr.Entities
|
|||||||
public float? clmr { get; set; }
|
public float? clmr { get; set; }
|
||||||
public float? lclmr { get; set; }
|
public float? lclmr { get; set; }
|
||||||
}
|
}
|
||||||
|
public class Pchart
|
||||||
|
{
|
||||||
|
public float? p { get; set; }
|
||||||
|
public float? n { get; set; }
|
||||||
|
public float? ucl { get; set; }
|
||||||
|
public float? cl { get; set; }
|
||||||
|
public float? lcl { get; set; }
|
||||||
|
}
|
||||||
|
public class Uchart
|
||||||
|
{
|
||||||
|
public float? u { get; set; }
|
||||||
|
public float? n { get; set; }
|
||||||
|
public float? ucl { get; set; }
|
||||||
|
public float? cl { get; set; }
|
||||||
|
public float? lcl { get; set; }
|
||||||
|
}
|
||||||
|
public class NPchart
|
||||||
|
{
|
||||||
|
public float? np { get; set; }
|
||||||
|
public float? ucl { get; set; }
|
||||||
|
public float? cl { get; set; }
|
||||||
|
public float? lcl { get; set; }
|
||||||
|
}
|
||||||
|
public class Cchart
|
||||||
|
{
|
||||||
|
public float? c { get; set; }
|
||||||
|
public float? ucl { get; set; }
|
||||||
|
public float? cl { get; set; }
|
||||||
|
public float? lcl { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,15 +16,15 @@ namespace Tnb.QcMgr.Entities.Enums
|
|||||||
}
|
}
|
||||||
public enum EnumTriggerEvent
|
public enum EnumTriggerEvent
|
||||||
{
|
{
|
||||||
[Remark("首件检", "换模具")]
|
[Remark("首检", "换模具")]
|
||||||
首件检换模具 = 1,
|
首件检换模具 = 1,
|
||||||
[Remark("首件检", "换物料批号")]
|
[Remark("首检", "换物料批号")]
|
||||||
首件检换物料批号 = 2,
|
首件检换物料批号 = 2,
|
||||||
[Remark("首件检", "换物料编号")]
|
[Remark("首检", "换物料编号")]
|
||||||
首件检换物料编号 = 3,
|
首件检换物料编号 = 3,
|
||||||
[Remark("首件检", "新的生产任务")]
|
[Remark("首检", "新的生产任务")]
|
||||||
首件检新的生产任务 = 4,
|
首件检新的生产任务 = 4,
|
||||||
[Remark("首件检", "生产任务暂停")]
|
[Remark("首检", "生产任务暂停")]
|
||||||
首件检生产任务暂停 = 5,
|
首件检生产任务暂停 = 5,
|
||||||
[Remark("出厂检", "按入厂频次")]
|
[Remark("出厂检", "按入厂频次")]
|
||||||
出厂检按入厂频次 = 6,
|
出厂检按入厂频次 = 6,
|
||||||
|
|||||||
@@ -292,11 +292,12 @@ namespace Tnb.QcMgr
|
|||||||
{
|
{
|
||||||
var DictionaryData = _repository.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>
|
var DictionaryData = _repository.AsSugarClient().Queryable<DictionaryDataEntity, DictionaryTypeEntity>
|
||||||
((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
|
((a, b) => new object[] { JoinType.Left, a.DictionaryTypeId == b.Id, })
|
||||||
.Where((a, b) => b.FullName == "质量方案类型").ToList();
|
.Where((a, b) => b.FullName == "质检类型选择").ToList();
|
||||||
var TriggerEvent = new QcTriggerEvent();
|
var TriggerEvent = new QcTriggerEvent();
|
||||||
var enumTriggerEvent = entity.triggerevent;
|
var enumTriggerEvent = entity.triggerevent;
|
||||||
var remark = RemarkAttribute.GetRemark(enumTriggerEvent);
|
var remark = RemarkAttribute.GetRemark(enumTriggerEvent);
|
||||||
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id && p.name == remark.CheckContent).First();
|
var type = DictionaryData.Where(p => p.FullName == remark.CheckType).First().Id;
|
||||||
|
TriggerEvent = _repository.AsSugarClient().Queryable<QcTriggerEvent>().Where(p => p.type == type && p.name == remark.CheckContent).First();
|
||||||
Query = Query.Where((a, b, c, d, e) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id));
|
Query = Query.Where((a, b, c, d, e) => b.triggertype == "3" && b.content!.Contains(TriggerEvent.id));
|
||||||
}
|
}
|
||||||
private void Filter(List<QcCheckPlanH> QcCheckPlanHs, TriggerPlanEntity entity)
|
private void Filter(List<QcCheckPlanH> QcCheckPlanHs, TriggerPlanEntity entity)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ using JNPF.DependencyInjection;
|
|||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.FriendlyException;
|
using JNPF.FriendlyException;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Spire.Xls.Core;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.QcMgr.Entities;
|
using Tnb.QcMgr.Entities;
|
||||||
using Tnb.QcMgr.Entities.Entity;
|
using Tnb.QcMgr.Entities.Entity;
|
||||||
@@ -255,6 +256,84 @@ namespace Tnb.QcMgr
|
|||||||
});
|
});
|
||||||
return XMRchart;
|
return XMRchart;
|
||||||
}
|
}
|
||||||
|
if (QcSpcH.graphtype == "P图")
|
||||||
|
{
|
||||||
|
List<Pchart> pcharts = new List<Pchart>();
|
||||||
|
foreach (var QcSpcD in QcSpcDs)
|
||||||
|
{
|
||||||
|
Pchart pchart = new Pchart();
|
||||||
|
pchart.p = QcSpcD.defectivenum / QcSpcD.checknum;
|
||||||
|
pchart.n = QcSpcD.checknum;
|
||||||
|
|
||||||
|
pcharts.Add(pchart);
|
||||||
|
}
|
||||||
|
var pAverage = (pcharts.Select(p => p.n * p.p).Sum()) / (pcharts.Select(p => p.n).Sum());
|
||||||
|
var nAverage = pcharts.Select(p => p.n).Average();
|
||||||
|
pcharts.ForEach(p =>
|
||||||
|
{
|
||||||
|
p.cl = pAverage;
|
||||||
|
p.ucl = pAverage + (float)(3 * Math.Sqrt((double)(pAverage * (1 - pAverage))!) / Math.Sqrt((double)nAverage!));
|
||||||
|
p.lcl = pAverage - (float)(3 * Math.Sqrt((double)(pAverage * (1 - pAverage))!) / Math.Sqrt((double)nAverage!)) < 0 ? 0 : pAverage - (float)(3 * Math.Sqrt((double)(pAverage * (1 - pAverage))!) / Math.Sqrt((double)nAverage!));
|
||||||
|
});
|
||||||
|
return pcharts;
|
||||||
|
}
|
||||||
|
if (QcSpcH.graphtype == "U图")
|
||||||
|
{
|
||||||
|
List<Uchart> ucharts = new List<Uchart>();
|
||||||
|
foreach (var QcSpcD in QcSpcDs)
|
||||||
|
{
|
||||||
|
Uchart uchart = new Uchart();
|
||||||
|
uchart.u = QcSpcD.defectivenum / QcSpcD.checknum;
|
||||||
|
uchart.n = QcSpcD.checknum;
|
||||||
|
ucharts.Add(uchart);
|
||||||
|
}
|
||||||
|
var uAverage = (ucharts.Select(p => p.u).Sum()) / (ucharts.Count());
|
||||||
|
var nAverage = ucharts.Select(p => p.n).Average();
|
||||||
|
ucharts.ForEach(p =>
|
||||||
|
{
|
||||||
|
p.cl = uAverage;
|
||||||
|
p.ucl = uAverage + (float)(3 * Math.Sqrt((double)(uAverage / nAverage)!));
|
||||||
|
p.lcl = uAverage - (float)(3 * Math.Sqrt((double)(uAverage / nAverage)!)) < 0 ? 0 : uAverage - (float)(3 * Math.Sqrt((double)(uAverage / nAverage)!));
|
||||||
|
});
|
||||||
|
return ucharts;
|
||||||
|
}
|
||||||
|
if (QcSpcH.graphtype == "nP图")
|
||||||
|
{
|
||||||
|
List<NPchart> npcharts = new List<NPchart>();
|
||||||
|
foreach (var QcSpcD in QcSpcDs)
|
||||||
|
{
|
||||||
|
NPchart npchart = new NPchart();
|
||||||
|
npchart.np = QcSpcD.defectivenum;
|
||||||
|
npcharts.Add(npchart);
|
||||||
|
}
|
||||||
|
var npAverage = (npcharts.Select(p => p.np).Sum()) / (npcharts.Count());
|
||||||
|
var pAverage = npcharts.Select(p => p.np).Sum() / (npcharts.Count() * QcSpcH.subcapacity);
|
||||||
|
npcharts.ForEach(p =>
|
||||||
|
{
|
||||||
|
p.cl = npAverage;
|
||||||
|
p.ucl = npAverage + (float)(3 * Math.Sqrt((double)(npAverage * (1 - pAverage))!));
|
||||||
|
p.lcl = npAverage - (float)(3 * Math.Sqrt((double)(npAverage * (1 - pAverage))!)) < 0 ? 0 : npAverage - (float)(3 * Math.Sqrt((double)(npAverage * (1 - pAverage))!));
|
||||||
|
});
|
||||||
|
return npcharts;
|
||||||
|
}
|
||||||
|
if (QcSpcH.graphtype == "C图")
|
||||||
|
{
|
||||||
|
List<Cchart> ccharts = new List<Cchart>();
|
||||||
|
foreach (var QcSpcD in QcSpcDs)
|
||||||
|
{
|
||||||
|
Cchart cchart = new Cchart();
|
||||||
|
cchart.c = QcSpcD.defectivenum;
|
||||||
|
ccharts.Add(cchart);
|
||||||
|
}
|
||||||
|
var cAverage = (ccharts.Select(p => p.c).Sum()) / (ccharts.Count());
|
||||||
|
ccharts.ForEach(p =>
|
||||||
|
{
|
||||||
|
p.cl = cAverage;
|
||||||
|
p.ucl = cAverage + (float)(3 * Math.Sqrt((double)cAverage!));
|
||||||
|
p.lcl = cAverage - (float)(3 * Math.Sqrt((double)cAverage!)) < 0 ? 0 : cAverage - (float)(3 * Math.Sqrt((double)cAverage!));
|
||||||
|
});
|
||||||
|
return ccharts;
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
//标准差计算
|
//标准差计算
|
||||||
|
|||||||
Reference in New Issue
Block a user