任务单排班 质量bug
This commit is contained in:
@@ -11,6 +11,7 @@ using JNPF.Systems.Entitys.System;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
@@ -21,6 +22,7 @@ using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Entities.Entity;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
@@ -413,7 +415,33 @@ namespace Tnb.ProductionMgr
|
||||
input.sidx = "create_time";
|
||||
input.sort = "desc";
|
||||
}
|
||||
|
||||
string userId = _userManager.UserId;
|
||||
string nowTime = DateTime.Now.ToString("HH:mm");
|
||||
BasFactoryConfig config = await _db.Queryable<BasFactoryConfig>().FirstAsync(x => x.enabled == 1 && x.key == FactoryConfigConst.DAYNIGHTWORKTIME);
|
||||
Dictionary<string,string> dayNightWorkTime = JsonConvert.DeserializeObject<Dictionary<string, string>>(config.value);
|
||||
string dayStime = dayNightWorkTime["白班"].Split("-")[0];
|
||||
string dayEtime = dayNightWorkTime["白班"].Split("-")[1];
|
||||
string nightStime = dayNightWorkTime["夜班"].Split("-")[0];
|
||||
string nightEtime = dayNightWorkTime["夜班"].Split("-")[1];
|
||||
string dayBeforeStime = dayNightWorkTime["白班前"].Split("-")[0];
|
||||
string dayBeforeEtime = dayNightWorkTime["白班前"].Split("-")[1];
|
||||
string dayAfterStime = dayNightWorkTime["白班后"].Split("-")[0];
|
||||
string dayAfterEtime = dayNightWorkTime["白班后"].Split("-")[1];
|
||||
string nightBeforeStime = dayNightWorkTime["夜班前"].Split("-")[0];
|
||||
string nightBeforeEtime = dayNightWorkTime["夜班前"].Split("-")[1];
|
||||
string nightAfterStime = dayNightWorkTime["夜班后"].Split("-")[0];
|
||||
string nightAfterEtime = dayNightWorkTime["夜班后"].Split("-")[1];
|
||||
|
||||
bool twoDayFlag = string.Compare(nowTime, dayStime) >= 0 && string.Compare(nowTime, dayEtime) <= 0;
|
||||
bool twoNightFlag = string.Compare(nowTime,nightStime)>=0 && string.Compare(nowTime,nightEtime)<=0;
|
||||
bool fourDayBeforeFlag = (string.Compare(nowTime,dayBeforeStime)>=0 && string.Compare(nowTime,dayBeforeEtime)<=0) ;
|
||||
bool fourDayAfterFlag = (string.Compare(nowTime,dayAfterStime)>=0 && string.Compare(nowTime,dayAfterEtime)<=0) ;
|
||||
bool fourNightBeforeFlag = (string.Compare(nowTime,nightBeforeStime)>=0 && string.Compare(nowTime,nightBeforeEtime)<=0) ;
|
||||
bool fourNightAfterFlag = (string.Compare(nowTime,nightAfterStime)>=0 && string.Compare(nowTime,nightAfterEtime)<=0) ;
|
||||
|
||||
//模具部门的人
|
||||
List<string> moldUserIds = await _db.Queryable<UserRelationEntity>().Where(x=>x.ObjectId=="35792898276629").Select(x=>x.UserId).ToListAsync();
|
||||
SqlSugarPagedList<PADPackageTaskPageOutput> result = await _db.Queryable<PrdMoTask>()
|
||||
.LeftJoin<BasMaterial>((a, b) => a.material_id == b.id)
|
||||
.LeftJoin<BasProcess>((a, b, c) => a.process_id == c.id)
|
||||
@@ -422,18 +450,30 @@ namespace Tnb.ProductionMgr
|
||||
.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 && a.schedule_type==1)
|
||||
.LeftJoin<PrdMo>((a, b, c, d, e, f, g, h, i, j) => a.mo_id == j.id)
|
||||
.LeftJoin<BasMaterialUnit>((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "KGM")
|
||||
.LeftJoin<EqpDaq>((a, b, c, d, e, f, g, h, i, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_name.Contains("允许称重"))//注塑空满箱请求
|
||||
//.LeftJoin<BasStandardTime>((a, b, c, d, e, f, g, h, i) => a.process_id == i.process_id && i.enabled == 1 && a.schedule_type==1)
|
||||
.LeftJoin<PrdMo>((a, b, c, d, e, f, g, h, j) => a.mo_id == j.id)
|
||||
.LeftJoin<BasMaterialUnit>((a, b, c, d, e, f, g, h, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "KGM")
|
||||
.LeftJoin<EqpDaq>((a, b, c, d, e, f, g, h, j, k, l) => a.eqp_id == l.equip_id && l.enabled == 1 && l.label_name.Contains("允许称重"))//注塑空满箱请求
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d, e, f, g, h, j, k, l,m)=>a.workstation_id==m.Id)
|
||||
// .Where((a, b) => a.workstation_id == input.stationId)
|
||||
.Where((a, b) => a.worker_id == _userManager.UserId && (a.schedule_type==1 || (a.schedule_type==2 && a.parent_id!=null)))
|
||||
// .Where((a, b) => a.worker_id == _userManager.UserId && (a.schedule_type==1 || (a.schedule_type==2 && a.parent_id!=null)))
|
||||
.Where((a, b) => a.schedule_type==1 || (a.schedule_type==2 && a.parent_id!=null))
|
||||
// .Where(a=>a.dayshift_worker_id==userId || a.dayshiftafter_worker_id==userId || a.nightshift_worker_id==userId || a.nightshiftafter_worker_id==userId)
|
||||
.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, k, l) => new PADPackageTaskPageOutput
|
||||
.Where((a, b, c, d, e, f, g, h, j, k, l,m)=>(m.ManagerId==userId)
|
||||
|| (a.schedule_type==1 && a.mo_task_status==DictConst.ToBeStartedEnCode && moldUserIds.Contains(userId))
|
||||
|| (a.scheduling_class_type=="1" && twoDayFlag && a.dayshift_worker_id==userId)
|
||||
|| (a.scheduling_class_type=="1" && twoNightFlag && a.nightshift_worker_id==userId)
|
||||
|| (a.scheduling_class_type=="2" && fourDayBeforeFlag && a.dayshift_worker_id==userId)
|
||||
|| (a.scheduling_class_type=="2" && fourDayAfterFlag && a.dayshiftafter_worker_id==userId)
|
||||
|| (a.scheduling_class_type=="2" && fourNightBeforeFlag && a.nightshift_worker_id==userId)
|
||||
|| (a.scheduling_class_type=="2" && fourNightAfterFlag && a.nightshiftafter_worker_id==userId)
|
||||
)
|
||||
.Select((a, b, c, d, e, f, g, h, j, k, l) => new PADPackageTaskPageOutput
|
||||
{
|
||||
id = a.id,
|
||||
mo_task_code = a.mo_task_code,
|
||||
@@ -442,7 +482,8 @@ namespace Tnb.ProductionMgr
|
||||
material_id = a.material_id,
|
||||
material_code = b.code,
|
||||
material_name = b.name,
|
||||
material_standard = b.material_specification,
|
||||
material_standard = b.material_standard,
|
||||
material_specification = b.material_specification,
|
||||
container_no = b.container_no,
|
||||
di = b.di,
|
||||
workline_id = a.workline_id,
|
||||
@@ -469,7 +510,7 @@ namespace Tnb.ProductionMgr
|
||||
schedule_type = a.schedule_type,
|
||||
mold_cavity = g.mold_cavity,
|
||||
moulding_cycle = h.moulding_cycle,
|
||||
standard_time = i.standard_time,
|
||||
// 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),
|
||||
@@ -521,6 +562,10 @@ namespace Tnb.ProductionMgr
|
||||
x.output_material_id == item.material_id && x.enabled == 1)
|
||||
.OrderByDescending(x => x.create_time).FirstAsync();
|
||||
item.standard_time = processStandardsH?.moulding_cycle?.ToString();
|
||||
}else if (item.schedule_type==1)
|
||||
{
|
||||
BasStandardTime basStandardTime = await _db.Queryable<BasStandardTime>().Where(x=>x.process_id==item.process_id && x.enabled==1).FirstAsync();
|
||||
item.standard_time = basStandardTime.standard_time;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user