排产至工位 pc端注塑挤出任务管理 组装包装任务管理添加工位过滤
This commit is contained in:
@@ -31,5 +31,9 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// 工序
|
||||
/// </summary>
|
||||
public string process { get; set; }
|
||||
/// <summary>
|
||||
/// 工位id
|
||||
/// </summary>
|
||||
public string stationId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -678,6 +678,13 @@ namespace Tnb.ProductionMgr
|
||||
moTask.scheduled_qty = input.scheduled_qty;
|
||||
moTask.unit_id = mo.unit_id;
|
||||
|
||||
if (!string.IsNullOrEmpty(input.eqp_id))
|
||||
{
|
||||
OrganizeRelationEntity organizeRelationEntity = await db.Queryable<OrganizeRelationEntity>()
|
||||
.Where(x => x.ObjectId == input.eqp_id && x.ObjectType == "Eqp").FirstAsync();
|
||||
moTask.workstation_id = organizeRelationEntity?.OrganizeId ?? "";
|
||||
}
|
||||
|
||||
var moCode = mo?.mo_code;
|
||||
var taskCode = await _billRuleService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.PRDMOTASK_CODE);
|
||||
moTask.mo_task_code = taskCode;
|
||||
@@ -944,10 +951,19 @@ namespace Tnb.ProductionMgr
|
||||
.ToListAsync();
|
||||
if (subTaskList?.Count > 0)
|
||||
{
|
||||
List<string> workstationIds = await _db.Queryable<OrganizeEntity>().Where(x =>
|
||||
x.Category == DictConst.RegionCategoryStationCode &&
|
||||
x.OrganizeIdTree.Contains(input.workline_id)).Select(x=>x.Id).ToListAsync();
|
||||
|
||||
|
||||
List<PrdMoTask> subMoTasks = new();
|
||||
List<PrdTaskLog> subMoTaskLogs = new();
|
||||
foreach (var item in subTaskList)
|
||||
{
|
||||
BasMbomProcess basMbomProcess = await _db.Queryable<BasMbomProcess>().SingleAsync(x=>x.id==item.mbom_process_id);
|
||||
List<string> mbomProcessStationIds = JsonConvert.DeserializeObject<string[][]>(basMbomProcess.station).Select(x=>x[x.Length-1]).ToList();
|
||||
List<string>? resultList = workstationIds.Intersect(mbomProcessStationIds).ToList();
|
||||
|
||||
PrdMoTask subMoTask = new();
|
||||
subMoTask.mo_id = input.mo_id;
|
||||
subMoTask.material_id = item.material_id;
|
||||
@@ -956,6 +972,7 @@ namespace Tnb.ProductionMgr
|
||||
subMoTask.bom_id = input.bom_id;
|
||||
subMoTask.process_id = item.process_id;
|
||||
subMoTask.mbom_process_id = item.mbom_process_id;
|
||||
subMoTask.workstation_id = resultList?.FirstOrDefault() ?? "";
|
||||
subMoTask.mo_task_status = DictConst.ToBeScheduledEncode;
|
||||
subMoTask.workroute_id = item.route_id;
|
||||
subMoTask.workline_id = input.workline_id;
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace Tnb.ProductionMgr
|
||||
public async Task<dynamic> GetList(PrdPackReportQueryInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
if (string.IsNullOrEmpty(input.stationId)) return Array.Empty<string>();
|
||||
|
||||
List<PackReportTreeOutput> trees = new();
|
||||
var dic = await _dictionaryDataService.GetDicByTypeId(DictConst.PrdTaskStatusTypeId);
|
||||
var list = await _db.Queryable<OrganizeEntity>().Where(it => it.Category == "workline").ToListAsync();
|
||||
@@ -75,13 +77,17 @@ namespace Tnb.ProductionMgr
|
||||
endTimes[1] = GetDateTimeMilliseconds(input.estimated_end_date![1]);
|
||||
|
||||
}
|
||||
var items = await _db.Queryable<PrdMoTask>().LeftJoin<BasProcess>((a, b) => a.process_id == b.id).LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||
var items = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||
.LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||
.LeftJoin<PrdMoTask>((a,b,c,d)=>a.id==d.parent_id)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.mo_task_code), a => a.mo_task_code == input.mo_task_code.Trim())
|
||||
// .WhereIF(start, a => a.estimated_start_date != null&& startTimes[0] <= a.estimated_start_date && startTimes[1] >= a.estimated_start_date)
|
||||
// .WhereIF(end, a => a.estimated_end_date != null && endTimes[0] <= a.estimated_end_date && endTimes[1] >= a.estimated_end_date)
|
||||
.WhereIF(!string.IsNullOrEmpty(input.workline), a => list.Where(p => p.EnCode.Contains(input.workline) || p.FullName.Contains(input.workline)).Select(p => p.Id).ToList().Contains(a.workline_id!))
|
||||
.Where(a => string.IsNullOrEmpty(a.parent_id) && a.schedule_type == 2 && a.mo_task_status != "ToBeScheduled")
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Where((a,b,c,d)=>d.workstation_id==input.stationId)
|
||||
.OrderByDescending(a=>a.create_time)
|
||||
.Select((a, b, c) => new PrdMoTask
|
||||
{
|
||||
id = a.id,
|
||||
@@ -122,7 +128,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
node.plan_start_date = item.plan_start_date.HasValue ? item.plan_start_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
|
||||
node.plan_end_date = item.plan_end_date.HasValue ? item.plan_end_date.Value.ToString("yyyy-MM-dd HH:mm:ss") : "";
|
||||
await GetChild(item.id, trees, dic);
|
||||
await GetChild(item.id, trees, dic,input.stationId);
|
||||
trees.Add(node);
|
||||
}
|
||||
}
|
||||
@@ -170,13 +176,13 @@ namespace Tnb.ProductionMgr
|
||||
return dt;
|
||||
|
||||
}
|
||||
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic)
|
||||
private async Task GetChild(string parentId, List<PackReportTreeOutput> nodes, Dictionary<string, object> dic,string stationId)
|
||||
{
|
||||
var items = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||
.LeftJoin<PrdMo>((a, b, c) => a.mo_id == c.id)
|
||||
.LeftJoin<BasMbomProcess>((a, b, c, d) => a.mbom_process_id == d.id)
|
||||
.Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled")
|
||||
.Where(a => a.parent_id == parentId && a.mo_task_status != "ToBeScheduled" && a.workstation_id==stationId)
|
||||
.OrderBy((a, b, c, d) => d.ordinal)
|
||||
.Select((a, b, c) => new PrdMoTask
|
||||
{
|
||||
@@ -222,7 +228,7 @@ namespace Tnb.ProductionMgr
|
||||
nodes.AddRange(nsChild);
|
||||
foreach (var item in items)
|
||||
{
|
||||
await GetChild(item.id, nodes, dic);
|
||||
await GetChild(item.id, nodes, dic,stationId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,13 @@ namespace Tnb.ProductionMgr
|
||||
var db = _repository.AsSugarClient();
|
||||
Dictionary<string, object> queryJson = !string.IsNullOrEmpty(input.queryJson) ? JsonConvert.DeserializeObject<Dictionary<string, object>>(input.queryJson) : new Dictionary<string, object>();
|
||||
string moTaskCode = queryJson!=null && queryJson.ContainsKey("mo_task_code") ? queryJson["mo_task_code"].ToString() : "";
|
||||
string stationId = queryJson!=null && queryJson.ContainsKey("stationId") ? queryJson["stationId"].ToString() : "";
|
||||
|
||||
if (string.IsNullOrEmpty(stationId))
|
||||
{
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
|
||||
Dictionary<string, object> dic = await _dictionaryDataService.GetDicByKey(DictConst.TaskStatus);
|
||||
|
||||
DateTime[] planStartDateArr = null;
|
||||
@@ -142,6 +149,7 @@ namespace Tnb.ProductionMgr
|
||||
.WhereIF(!string.IsNullOrEmpty(moTaskCode),(a,b,c,d)=>a.mo_task_code.Contains(moTaskCode))
|
||||
.WhereIF(planStartDateArr!=null, (a, b, c, d) => a.estimated_start_date>=planStartDateArr[0] && a.estimated_start_date<=planStartDateArr[1])
|
||||
.WhereIF(planEndDateArr!=null, (a, b, c, d) => a.estimated_end_date>=planEndDateArr[0] && a.estimated_end_date<=planEndDateArr[1])
|
||||
.Where((a,b,c,d)=>a.workstation_id==stationId)
|
||||
.OrderByDescending((a, b, c, d) => a.create_time)
|
||||
.Select((a, b, c, d) => new PrdTaskManageListOutput()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user