合并
This commit is contained in:
@@ -5,7 +5,7 @@ using SqlSugar;
|
||||
namespace Tnb.ProductionMgr.Entities;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 自检报废记录表
|
||||
/// </summary>
|
||||
[SugarTable("prd_mo_task_defect_record")]
|
||||
public partial class PrdMoTaskDefectRecord : BaseEntity<string>
|
||||
|
||||
@@ -21,15 +21,14 @@ using Tnb.BasicData;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.EquipMgr.Entities;
|
||||
using Tnb.PerMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
||||
using Tnb.ProductionMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.QcMgr.Entities;
|
||||
using Tnb.QcMgr.Entities.Enums;
|
||||
using Tnb.QcMgr.Interfaces;
|
||||
// using Tnb.QcMgr.Entities;
|
||||
// using Tnb.QcMgr.Entities.Enums;
|
||||
// using Tnb.QcMgr.Interfaces;
|
||||
|
||||
// using Tnb.PerMgr.Entities;
|
||||
|
||||
@@ -54,7 +53,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IBillRullService _billRuleService;
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
private readonly IQcCheckPlanService _qcCheckPlanService;
|
||||
// private readonly IQcCheckPlanService _qcCheckPlanService;
|
||||
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
public PrdMoTaskService(
|
||||
@@ -64,8 +63,8 @@ namespace Tnb.ProductionMgr
|
||||
IRunService runService,
|
||||
IBillRullService billRullService,
|
||||
IPrdInstockService prdInstockService,
|
||||
IVisualDevService visualDevService,
|
||||
IQcCheckPlanService qcCheckPlanService
|
||||
// IQcCheckPlanService qcCheckPlanService,
|
||||
IVisualDevService visualDevService
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
@@ -78,7 +77,7 @@ namespace Tnb.ProductionMgr
|
||||
OverideFuncs.GetListAsync = GetList;
|
||||
_billRuleService = billRullService;
|
||||
_prdInstockService = prdInstockService;
|
||||
_qcCheckPlanService = qcCheckPlanService;
|
||||
// _qcCheckPlanService = qcCheckPlanService;
|
||||
}
|
||||
|
||||
#region Get
|
||||
@@ -384,7 +383,7 @@ namespace Tnb.ProductionMgr
|
||||
estimated_end_date = a.estimated_end_date == null ? null : a.estimated_end_date.Value.ToString(DbTimeFormat.SS),
|
||||
bom_id = d.id,
|
||||
bom_version = d.version,
|
||||
create_time = a.create_time==null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS)
|
||||
create_time = a.create_time == null ? "" : a.create_time.Value.ToString(DbTimeFormat.SS)
|
||||
})
|
||||
.Mapper(it => it.mo_task_status = dic.ContainsKey(it.mo_task_status) ? dic[it.mo_task_status].ToString()! : "")
|
||||
.ToListAsync();
|
||||
@@ -702,14 +701,14 @@ namespace Tnb.ProductionMgr
|
||||
row = await db.Insertable(moTask).ExecuteCommandAsync();
|
||||
#region 质检模块
|
||||
//质检
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = moTask.material_id,
|
||||
processid = moTask.process_id,
|
||||
workid = moTask.workstation_id,
|
||||
triggerevent = EnumTriggerEvent.首件检新的生产任务
|
||||
};
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = moTask.material_id,
|
||||
// processid = moTask.process_id,
|
||||
// workid = moTask.workstation_id,
|
||||
// triggerevent = EnumTriggerEvent.首件检新的生产任务
|
||||
// };
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
#endregion
|
||||
//根据工单号获取当前工单包含的已排产数
|
||||
int? schedQty = db.Queryable<PrdMoTask>().Where(it => it.mo_id == input.mo_id)?.Sum(d => d.scheduled_qty);
|
||||
@@ -843,14 +842,14 @@ namespace Tnb.ProductionMgr
|
||||
row = await _db.Insertable(moTask).ExecuteCommandAsync();
|
||||
#region 质检模块
|
||||
//质检
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = moTask.material_id,
|
||||
processid = moTask.process_id,
|
||||
workid = moTask.workstation_id,
|
||||
triggerevent = EnumTriggerEvent.首件检新的生产任务
|
||||
};
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = moTask.material_id,
|
||||
// processid = moTask.process_id,
|
||||
// workid = moTask.workstation_id,
|
||||
// triggerevent = EnumTriggerEvent.首件检新的生产任务
|
||||
// };
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1087,20 +1086,20 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
#region 质检模块
|
||||
//质检
|
||||
if (prdTaskList.Where(p => p.mo_task_status == "Pause").Count() > 0 && status == "InProgress")
|
||||
{
|
||||
foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "Pause").ToList())
|
||||
{
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = task.material_id,
|
||||
processid = task.process_id,
|
||||
workid = task.workstation_id,
|
||||
triggerevent = EnumTriggerEvent.首件检生产任务暂停
|
||||
};
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
}
|
||||
}
|
||||
// if (prdTaskList.Where(p => p.mo_task_status == "Pause").Count() > 0 && status == "InProgress")
|
||||
// {
|
||||
// foreach (PrdMoTask? task in prdTaskList.Where(p => p.mo_task_status == "Pause").ToList())
|
||||
// {
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = task.material_id,
|
||||
// processid = task.process_id,
|
||||
// workid = task.workstation_id,
|
||||
// triggerevent = EnumTriggerEvent.首件检生产任务暂停
|
||||
// };
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
// }
|
||||
// }
|
||||
#endregion
|
||||
|
||||
foreach (PrdMoTask item in prdTaskList)
|
||||
@@ -1503,13 +1502,13 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
throw Oops.Bah("载具不能为空");
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty((input.location_code)))
|
||||
{
|
||||
throw Oops.Bah("入库库位不能为空");
|
||||
}
|
||||
|
||||
if (input.reported_qty<=0)
|
||||
|
||||
if (input.reported_qty <= 0)
|
||||
{
|
||||
throw Oops.Bah("提报数量为正数");
|
||||
}
|
||||
@@ -1536,18 +1535,18 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
#region 质检模块
|
||||
//质检模块
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = prdMoTask.material_id,
|
||||
processid = prdMoTask.process_id,
|
||||
workid = prdMoTask.workstation_id
|
||||
};
|
||||
int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
entity.oldpronum = reported + scrap;
|
||||
entity.newpronum = input.reported_qty;
|
||||
entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = prdMoTask.material_id,
|
||||
// processid = prdMoTask.process_id,
|
||||
// workid = prdMoTask.workstation_id
|
||||
// };
|
||||
// int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
// int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
// entity.oldpronum = reported + scrap;
|
||||
// entity.newpronum = input.reported_qty;
|
||||
// entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
#endregion
|
||||
_ = prdMoTask.reported_work_qty == null
|
||||
? await db.Updateable<PrdMoTask>()
|
||||
@@ -1579,24 +1578,24 @@ 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();
|
||||
// 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();
|
||||
}
|
||||
}
|
||||
// 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))
|
||||
@@ -1752,7 +1751,7 @@ namespace Tnb.ProductionMgr
|
||||
// return resultMsg == "true" ? (dynamic)true : throw Oops.Bah(resultMsg);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (arr.Length > 0 && arr.Contains("CGJCJ"))//短管挤出件入库申请
|
||||
{
|
||||
string resultMsg = await _prdInstockService.InstockTubeThree(report);
|
||||
@@ -1831,18 +1830,18 @@ namespace Tnb.ProductionMgr
|
||||
#region 质检模块
|
||||
//质检模块
|
||||
|
||||
TriggerPlanEntity entity = new()
|
||||
{
|
||||
materialid = prdMoTask.material_id,
|
||||
processid = prdMoTask.process_id,
|
||||
workid = prdMoTask.workstation_id
|
||||
};
|
||||
int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
entity.oldpronum = reported + scrap;
|
||||
entity.newpronum = input.scrap_qty;
|
||||
entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
await _qcCheckPlanService.CreateTask(entity);
|
||||
// TriggerPlanEntity entity = new()
|
||||
// {
|
||||
// materialid = prdMoTask.material_id,
|
||||
// processid = prdMoTask.process_id,
|
||||
// workid = prdMoTask.workstation_id
|
||||
// };
|
||||
// int? reported = prdMoTask.reported_work_qty == null ? 0 : prdMoTask.reported_work_qty;
|
||||
// int? scrap = prdMoTask.scrap_qty == null ? 0 : prdMoTask.scrap_qty;
|
||||
// entity.oldpronum = reported + scrap;
|
||||
// entity.newpronum = input.scrap_qty;
|
||||
// entity.triggerevent = EnumTriggerEvent.生产检定量;
|
||||
// await _qcCheckPlanService.CreateTask(entity);
|
||||
#endregion
|
||||
_ = await db.Updateable<PrdMoTask>().SetColumns(it => new PrdMoTask { scrap_qty = scrapQty.Value }).Where(it => it.id == input.mo_task_id).ExecuteCommandAsync();
|
||||
}
|
||||
@@ -1879,24 +1878,24 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
// 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
|
||||
{
|
||||
@@ -2179,53 +2178,53 @@ namespace Tnb.ProductionMgr
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetEstimatedEndTime(CountEstimatedEndTimeInput input)
|
||||
{
|
||||
ISqlSugarClient db = _repository.AsSugarClient();
|
||||
if (input.type == 1)
|
||||
{
|
||||
PerProcessStandardsH processStandardsH = await db.Queryable<PerProcessStandardsH>()
|
||||
.Where(x => x.equip_id == input.equip_id && x.molds_id == input.molds_id &&
|
||||
x.output_material_id == input.material_id && x.enabled == 1)
|
||||
.OrderByDescending(x => x.create_time).FirstAsync();
|
||||
|
||||
ToolMolds toolMolds = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == input.molds_id);
|
||||
if (toolMolds == null)
|
||||
{
|
||||
throw Oops.Bah("没找到模具");
|
||||
}
|
||||
|
||||
if (toolMolds?.mold_cavity <= 0)
|
||||
{
|
||||
throw Oops.Bah("模穴数错误");
|
||||
}
|
||||
|
||||
if (processStandardsH == null)
|
||||
{
|
||||
throw Oops.Bah("工艺标准成型周期错误");
|
||||
}
|
||||
|
||||
if (processStandardsH?.moulding_cycle <= 0)
|
||||
{
|
||||
throw Oops.Bah("工艺标准成型周期错误");
|
||||
}
|
||||
|
||||
decimal? addTime = (((input.scheduled_qty * processStandardsH?.moulding_cycle) - 1) / toolMolds.mold_cavity) + 1;
|
||||
return input.estimated_start_date.AddSeconds((double)addTime.Value).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<BasStandardTime> list = await db.Queryable<BasMbomProcess>()
|
||||
.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);
|
||||
decimal? addTime = input.scheduled_qty * max;
|
||||
return input.estimated_start_date.AddSeconds((double)addTime.Value).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
|
||||
}
|
||||
// [HttpPost]
|
||||
// public async Task<dynamic> GetEstimatedEndTime(CountEstimatedEndTimeInput input)
|
||||
// {
|
||||
// ISqlSugarClient db = _repository.AsSugarClient();
|
||||
// if (input.type == 1)
|
||||
// {
|
||||
// PerProcessStandardsH processStandardsH = await db.Queryable<PerProcessStandardsH>()
|
||||
// .Where(x => x.equip_id == input.equip_id && x.molds_id == input.molds_id &&
|
||||
// x.output_material_id == input.material_id && x.enabled == 1)
|
||||
// .OrderByDescending(x => x.create_time).FirstAsync();
|
||||
//
|
||||
// ToolMolds toolMolds = await db.Queryable<ToolMolds>().SingleAsync(x => x.id == input.molds_id);
|
||||
// if (toolMolds == null)
|
||||
// {
|
||||
// throw Oops.Bah("没找到模具");
|
||||
// }
|
||||
//
|
||||
// if (toolMolds?.mold_cavity <= 0)
|
||||
// {
|
||||
// throw Oops.Bah("模穴数错误");
|
||||
// }
|
||||
//
|
||||
// if (processStandardsH == null)
|
||||
// {
|
||||
// throw Oops.Bah("工艺标准成型周期错误");
|
||||
// }
|
||||
//
|
||||
// if (processStandardsH?.moulding_cycle <= 0)
|
||||
// {
|
||||
// throw Oops.Bah("工艺标准成型周期错误");
|
||||
// }
|
||||
//
|
||||
// decimal? addTime = (((input.scheduled_qty * processStandardsH?.moulding_cycle) - 1) / toolMolds.mold_cavity) + 1;
|
||||
// return input.estimated_start_date.AddSeconds((double)addTime.Value).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// List<BasStandardTime> list = await db.Queryable<BasMbomProcess>()
|
||||
// .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);
|
||||
// decimal? addTime = input.scheduled_qty * max;
|
||||
// return input.estimated_start_date.AddSeconds((double)addTime.Value).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
|
||||
|
||||
/// <summary>
|
||||
@@ -2766,7 +2765,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
return prdMoTask;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据工位获取进行中待开工暂停的任务单信息
|
||||
/// </summary>
|
||||
@@ -2781,8 +2780,8 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah("工位错误");
|
||||
}
|
||||
|
||||
List<PrdMoTask> list = await _db.Queryable<PrdMoTask>().Where(x => x.workstation_id == station_id && x.parent_id != null && (x.mo_task_status == DictConst.InProgressEnCode || x.mo_task_status == DictConst.ToBeStartedEnCode || x.mo_task_status == DictConst.MoStatusPauseCode )).ToListAsync();
|
||||
if (list != null && list.Count>0)
|
||||
List<PrdMoTask> list = await _db.Queryable<PrdMoTask>().Where(x => x.workstation_id == station_id && x.parent_id != null && (x.mo_task_status == DictConst.InProgressEnCode || x.mo_task_status == DictConst.ToBeStartedEnCode || x.mo_task_status == DictConst.MoStatusPauseCode)).ToListAsync();
|
||||
if (list != null && list.Count > 0)
|
||||
{
|
||||
foreach (var prdMoTask in list)
|
||||
{
|
||||
@@ -2793,7 +2792,7 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 外包装根据工位id获取喷码数据
|
||||
/// </summary>
|
||||
@@ -2809,7 +2808,7 @@ namespace Tnb.ProductionMgr
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
|
||||
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && x.is_mark==null).AnyAsync())
|
||||
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == 0 && x.is_mark == null).AnyAsync())
|
||||
{
|
||||
await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
.SetColumns(x => x.is_mark == 0)
|
||||
@@ -2832,10 +2831,10 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
|
||||
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x => x.id == parent.material_id);
|
||||
|
||||
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch ?? ""}";
|
||||
|
||||
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
|
||||
|
||||
return code;
|
||||
}
|
||||
|
||||
@@ -2852,9 +2851,9 @@ namespace Tnb.ProductionMgr
|
||||
{ "station_id", input.station_id }
|
||||
});
|
||||
if (prdMoTask == null) throw Oops.Bah("没找到对应任务单");
|
||||
|
||||
|
||||
if (await _db.Queryable<PrdOutPackMarkLabel>().Where(x =>
|
||||
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark==0).AnyAsync())
|
||||
x.mo_task_code == prdMoTask.mo_task_code && x.status == "0" && x.is_label == null && x.is_mark == 0).AnyAsync())
|
||||
{
|
||||
await _db.Updateable<PrdOutPackMarkLabel>()
|
||||
.SetColumns(x => x.is_label == 0)
|
||||
@@ -2875,12 +2874,12 @@ namespace Tnb.ProductionMgr
|
||||
|
||||
await _db.Insertable<PrdOutPackMarkLabel>(prdOutPackMarkLabel).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x=>x.id==parent.material_id);
|
||||
|
||||
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch??""}";
|
||||
|
||||
PrdMoTask parent = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == prdMoTask.parent_id);
|
||||
BasMaterial basMaterial = await _db.Queryable<BasMaterial>().SingleAsync(x => x.id == parent.material_id);
|
||||
|
||||
string code = $"(01){basMaterial.di ?? ""}\\n(11){DateTime.Now.ToString("yyMMdd")}\\n(17){DateTime.Now.AddMonths(basMaterial.quality_guarantee_period ?? 0).ToString("yyMMdd")}\\n(10){parent.batch ?? ""}";
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Tnb.ProductionMgr
|
||||
private readonly IBillRullService _billRullService;
|
||||
public OverideVisualDevFunc OverideFuncs { get; } = new OverideVisualDevFunc();
|
||||
|
||||
public PrdOutstockService(ISqlSugarRepository<PrdOutstockH> repository, IOrganizeService organizeService, IBillRullService billRullService, IRunService runService, IUserManager userManager, IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService)
|
||||
public PrdOutstockService(ISqlSugarRepository<PrdOutstockH> repository, IOrganizeService organizeService, IBillRullService billRullService,IRunService runService, IUserManager userManager, IVisualDevService visualDevService, IDictionaryDataService dictionaryDataService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
_runService = runService;
|
||||
@@ -98,7 +98,7 @@ namespace Tnb.ProductionMgr
|
||||
string domain = _userManager.Domain;
|
||||
Dictionary<string, object> header = new()
|
||||
{
|
||||
["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
|
||||
Log.Information(sendResult);
|
||||
@@ -190,7 +190,7 @@ namespace Tnb.ProductionMgr
|
||||
string domain = _userManager.Domain;
|
||||
Dictionary<string, object> header = new()
|
||||
{
|
||||
["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
string sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
|
||||
Log.Information(sendResult);
|
||||
@@ -266,12 +266,12 @@ namespace Tnb.ProductionMgr
|
||||
MESCreateOutstockInput input = new MESCreateOutstockInput();
|
||||
input.outstock = new MESWmsOutstockHInput();
|
||||
input.outstockDs = new List<MESWmsOutstockDInput>();
|
||||
|
||||
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x => x.id == materialOutstockInput.mo_task_id);
|
||||
BasLocation location = await db.Queryable<BasLocation>().Where(x => x.location_code == materialOutstockInput.location_code).FirstAsync();
|
||||
|
||||
PrdMoTask prdMoTask = await db.Queryable<PrdMoTask>().SingleAsync(x=>x.id==materialOutstockInput.mo_task_id);
|
||||
BasLocation location = await db.Queryable<BasLocation>().Where(x=>x.location_code==materialOutstockInput.location_code).FirstAsync();
|
||||
if (location == null) throw Oops.Bah("未找到库位");
|
||||
string locationId = location.id;
|
||||
|
||||
|
||||
PrdOutstockH prdOutstockH = new()
|
||||
{
|
||||
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||
@@ -287,17 +287,17 @@ namespace Tnb.ProductionMgr
|
||||
input.outstock.source_code = prdOutstockH.bill_code;
|
||||
input.outstock.source_id = prdOutstockH.id;
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(materialOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||
|
||||
|
||||
List<string> materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList();
|
||||
List<BasMaterial> basMaterials = await db.Queryable<BasMaterial>().Where(x => materialIds.Contains(x.id)).ToListAsync();
|
||||
Dictionary<string, object> unitIdDic = await db.Queryable<BasMaterial>()
|
||||
List<BasMaterial> basMaterials = await db.Queryable<BasMaterial>().Where(x=>materialIds.Contains(x.id)).ToListAsync();
|
||||
Dictionary<string,object> unitIdDic = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c) => b.Id == c.DictionaryTypeId && a.unit_id == c.EnCode)
|
||||
.Where((a, b, c) => materialIds.Contains(a.id))
|
||||
.Select((a, b, c) => new
|
||||
.Where((a,b,c)=>materialIds.Contains(a.id))
|
||||
.Select((a, b, c) => new
|
||||
{
|
||||
key = a.id,
|
||||
value = c.Id
|
||||
value = c.Id
|
||||
})
|
||||
.ToDictionaryAsync(x => x.key, x => x.value);
|
||||
|
||||
@@ -306,18 +306,18 @@ namespace Tnb.ProductionMgr
|
||||
input.outstockDs.Add(new MESWmsOutstockDInput()
|
||||
{
|
||||
material_id = item.material_id,
|
||||
material_code = basMaterials.First(x => x.id == item.material_id).code,
|
||||
material_code = basMaterials.First(x=>x.id==item.material_id).code,
|
||||
pr_qty = item.num,
|
||||
unit_id = unitIdDic[item.material_id].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
string domain = _userManager.Domain;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
["Authorization"] = App.HttpContext!=null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK,JsonConvert.SerializeObject(input),header);
|
||||
Log.Information(sendResult);
|
||||
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
@@ -346,16 +346,16 @@ namespace Tnb.ProductionMgr
|
||||
prdOutstockDs.Add(new PrdOutstockD()
|
||||
{
|
||||
material_id = item.material_id,
|
||||
material_code = basMaterials.First(x => x.id == item.material_id).code,
|
||||
material_name = basMaterials.First(x => x.id == item.material_id).name,
|
||||
material_code = basMaterials.First(x=>x.id==item.material_id).code,
|
||||
material_name = basMaterials.First(x=>x.id==item.material_id).name,
|
||||
pr_qty = item.num,
|
||||
unit_id = unitIdDic[item.material_id].ToString(),
|
||||
outstock_id = prdOutstockH.id,
|
||||
source_id = prdMoTask.mo_task_code
|
||||
});
|
||||
}
|
||||
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdOutstockH);
|
||||
if (prdOutstockDs.Count > 0)
|
||||
@@ -379,132 +379,5 @@ namespace Tnb.ProductionMgr
|
||||
throw Oops.Bah(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> MaterialOutstockTest(MaterialOutstockInput materialOutstockInput)
|
||||
{
|
||||
try
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
string warehouse_id = "1";//一楼原材料仓
|
||||
|
||||
MESCreateOutstockInput input = new MESCreateOutstockInput();
|
||||
input.outstock = new MESWmsOutstockHInput();
|
||||
input.outstockDs = new List<MESWmsOutstockDInput>();
|
||||
|
||||
BasLocation location = await db.Queryable<BasLocation>().Where(x => x.location_code == materialOutstockInput.location_code).FirstAsync();
|
||||
if (location == null) throw new AppFriendlyException("未找到库位", 500);
|
||||
string locationId = location.id;
|
||||
|
||||
PrdOutstockH prdOutstockH = new()
|
||||
{
|
||||
bill_code = await _billRullService.GetBillNumber(CodeTemplateConst.PRDOUTSTOCK_CODE),
|
||||
};
|
||||
|
||||
input.outstock.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||
// input.outstock.bill_date = visualDevModelDataCrInput.data.ContainsKey("bill_date") ? Convert.ToDateTime(visualDevModelDataCrInput.data["bill_date"].ToString()) : DateTime.Now;
|
||||
input.outstock.bill_date = DateTime.Now;
|
||||
input.outstock.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
input.outstock.warehouse_id = warehouse_id;
|
||||
input.outstock.create_id = _userManager.UserId;
|
||||
input.outstock.location_code = location?.location_code ?? "";
|
||||
input.outstock.source_code = prdOutstockH.bill_code;
|
||||
input.outstock.source_id = prdOutstockH.id;
|
||||
OrganizeEntity workline = await _organizeService.GetAnyParentByWorkstationId(materialOutstockInput.workstation_id, DictConst.RegionCategoryWorklineCode);
|
||||
|
||||
List<string> materialIds = materialOutstockInput.details.Select(x => x.material_id).ToList();
|
||||
List<BasMaterial> basMaterials = await db.Queryable<BasMaterial>().Where(x => materialIds.Contains(x.id)).ToListAsync();
|
||||
Dictionary<string, object> unitIdDic = await db.Queryable<BasMaterial>()
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b) => b.EnCode == DictConst.MeasurementUnit)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b, c) => b.Id == c.DictionaryTypeId && a.unit_id == c.EnCode)
|
||||
.Where((a, b, c) => materialIds.Contains(a.id))
|
||||
.Select((a, b, c) => new
|
||||
{
|
||||
key = a.id,
|
||||
value = c.Id
|
||||
})
|
||||
.ToDictionaryAsync(x => x.key, x => x.value);
|
||||
|
||||
foreach (var item in materialOutstockInput.details)
|
||||
{
|
||||
input.outstockDs.Add(new MESWmsOutstockDInput()
|
||||
{
|
||||
material_id = item.material_id,
|
||||
material_code = basMaterials.First(x => x.id == item.material_id).code,
|
||||
pr_qty = item.num,
|
||||
unit_id = unitIdDic[item.material_id].ToString()
|
||||
});
|
||||
}
|
||||
|
||||
string domain = _userManager.Domain;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext != null ? App.HttpContext.Request.Headers["Authorization"] : ""
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_OUTSTOCK, JsonConvert.SerializeObject(input), header);
|
||||
Log.Information(sendResult);
|
||||
|
||||
AuthResponse authResponse = JsonConvert.DeserializeObject<AuthResponse>(sendResult);
|
||||
if (authResponse.code != 200)
|
||||
{
|
||||
throw new AppFriendlyException(authResponse.msg, 500);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
prdOutstockH.bill_type = DictConst.SHENGCHANLINGLIAO;
|
||||
prdOutstockH.type = "2";
|
||||
prdOutstockH.warehouse_id = warehouse_id;
|
||||
prdOutstockH.location_code = materialOutstockInput.location_code;
|
||||
prdOutstockH.create_id = _userManager.UserId;
|
||||
prdOutstockH.org_id = _userManager.GetUserInfo().Result.organizeId;
|
||||
prdOutstockH.bill_date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
||||
prdOutstockH.create_time = DateTime.Now;
|
||||
prdOutstockH.workstation_id = materialOutstockInput.workstation_id;
|
||||
prdOutstockH.workline = workline?.Id ?? "";
|
||||
prdOutstockH.status = DictConst.OUTSTOCKSTATUSADD;
|
||||
prdOutstockH.mo_task_id = "";
|
||||
|
||||
List<PrdOutstockD> prdOutstockDs = new List<PrdOutstockD>();
|
||||
foreach (var item in materialOutstockInput.details)
|
||||
{
|
||||
prdOutstockDs.Add(new PrdOutstockD()
|
||||
{
|
||||
material_id = item.material_id,
|
||||
material_code = basMaterials.First(x => x.id == item.material_id).code,
|
||||
material_name = basMaterials.First(x => x.id == item.material_id).name,
|
||||
pr_qty = item.num,
|
||||
unit_id = unitIdDic[item.material_id].ToString(),
|
||||
outstock_id = prdOutstockH.id,
|
||||
source_id = ""
|
||||
});
|
||||
}
|
||||
|
||||
DbResult<bool> result = await _repository.AsSugarClient().Ado.UseTranAsync(async () =>
|
||||
{
|
||||
await _repository.InsertAsync(prdOutstockH);
|
||||
if (prdOutstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdOutstockD>(prdOutstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
throw new AppFriendlyException(result.ErrorMessage, 500);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
return await Task.FromResult(true);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(e.Message);
|
||||
throw new AppFriendlyException(e.Message, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,7 +14,6 @@ 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.Entities.Entity;
|
||||
@@ -362,122 +361,122 @@ namespace Tnb.ProductionMgr
|
||||
return PageResult<PADPackageTaskPageOutput>.SqlSugarPageResult(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// pda端根据工位获取任务单列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task<dynamic> GetPadPrdMoTaskList(PrdMoTaskListOutput input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.stationId))
|
||||
{
|
||||
return new
|
||||
{
|
||||
pagination = new PageResult(),
|
||||
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();
|
||||
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";
|
||||
}
|
||||
|
||||
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)
|
||||
.LeftJoin<OrganizeEntity>((a, b, c, d) => a.workline_id == d.Id)
|
||||
.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)
|
||||
.LeftJoin<BasMaterialUnit>((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg")
|
||||
.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_point == "注塑空满箱请求")
|
||||
.Where((a, b) => a.workstation_id == input.stationId)
|
||||
.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
|
||||
{
|
||||
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,
|
||||
workline_id = a.workline_id,
|
||||
workline_name = d.FullName,
|
||||
bom_id = a.bom_id,
|
||||
mo_task_status = e.FullName,
|
||||
complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0),
|
||||
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(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,
|
||||
mbom_process_id = a.mbom_process_id,
|
||||
create_time = a.create_time,
|
||||
equip_id = a.eqp_id,
|
||||
equip_code = f.code,
|
||||
equip_name = f.name,
|
||||
mold_id = a.mold_id,
|
||||
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),
|
||||
minpacking = b.minpacking,
|
||||
main_num = k.number_of_primary_unit,
|
||||
deputy_num = k.number_of_auxiliary_unit,
|
||||
third_equip_code = l.equip_code,
|
||||
weight_name = l.label_name,
|
||||
category_id = b.category_id
|
||||
})
|
||||
.MergeTable()
|
||||
.OrderBy($"{input.sidx} {input.sort}")
|
||||
.ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
|
||||
return PageResult<PADPackageTaskPageOutput>.SqlSugarPageResult(result);
|
||||
|
||||
}
|
||||
// /// <summary>
|
||||
// /// pda端根据工位获取任务单列表
|
||||
// /// </summary>
|
||||
// /// <returns></returns>
|
||||
// [HttpPost]
|
||||
// public async Task<dynamic> GetPadPrdMoTaskList(PrdMoTaskListOutput input)
|
||||
// {
|
||||
// if (string.IsNullOrEmpty(input.stationId))
|
||||
// {
|
||||
// return new
|
||||
// {
|
||||
// pagination = new PageResult(),
|
||||
// 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();
|
||||
// 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";
|
||||
// }
|
||||
//
|
||||
// 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)
|
||||
// .LeftJoin<OrganizeEntity>((a, b, c, d) => a.workline_id == d.Id)
|
||||
// .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)
|
||||
// .LeftJoin<BasMaterialUnit>((a, b, c, d, e, f, g, h, i, j, k) => a.material_id == k.material_id && k.auxiliary_unit_id == "kg")
|
||||
// .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_point == "注塑空满箱请求")
|
||||
// .Where((a, b) => a.workstation_id == input.stationId)
|
||||
// .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
|
||||
// {
|
||||
// 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,
|
||||
// workline_id = a.workline_id,
|
||||
// workline_name = d.FullName,
|
||||
// bom_id = a.bom_id,
|
||||
// mo_task_status = e.FullName,
|
||||
// complete_qty = SqlFunc.IsNull(a.reported_work_qty, 0) + SqlFunc.IsNull(a.scrap_qty, 0),
|
||||
// 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(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,
|
||||
// mbom_process_id = a.mbom_process_id,
|
||||
// create_time = a.create_time,
|
||||
// equip_id = a.eqp_id,
|
||||
// equip_code = f.code,
|
||||
// equip_name = f.name,
|
||||
// mold_id = a.mold_id,
|
||||
// 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),
|
||||
// minpacking = b.minpacking,
|
||||
// main_num = k.number_of_primary_unit,
|
||||
// deputy_num = k.number_of_auxiliary_unit,
|
||||
// third_equip_code = l.equip_code,
|
||||
// weight_name = l.label_name,
|
||||
// category_id = b.category_id
|
||||
// })
|
||||
// .MergeTable()
|
||||
// .OrderBy($"{input.sidx} {input.sort}")
|
||||
// .ToPagedListAsync(input.currentPage, input.pageSize);
|
||||
//
|
||||
// return PageResult<PADPackageTaskPageOutput>.SqlSugarPageResult(result);
|
||||
//
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// 上模校验
|
||||
|
||||
@@ -1,62 +1,39 @@
|
||||
using System;
|
||||
using System.Data;
|
||||
using System.Dynamic;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Cache;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.FriendlyException;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using NetTaste;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Qiniu.Util;
|
||||
using SqlSugar;
|
||||
using Tnb.Common.Extension;
|
||||
using Tnb.Common.Redis;
|
||||
using Tnb.Common.Utils;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Entities.Enums;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Configs;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
//redis定时获取数采数据
|
||||
public class RedisBackGround : IHostedService, IDisposable
|
||||
{
|
||||
private Timer? Readtimer;
|
||||
private Timer? CheckGettimer;
|
||||
private Timer? Scantimer;
|
||||
private Timer? SSXcodetimer;
|
||||
private Timer? Readtimer;
|
||||
private readonly RedisData _redisData;
|
||||
private readonly IPrdInstockService _prdInstockService;
|
||||
private readonly ISqlSugarRepository<RedisReadConfig> _repository;
|
||||
private readonly IWmsPDAScanInStockService _wmsPDAScanInStock;
|
||||
private readonly ElevatorControlConfiguration _eleCtlCfg = App.Configuration.Build<ElevatorControlConfiguration>();
|
||||
public RedisBackGround(RedisData redisData, IPrdInstockService prdInstockService, ISqlSugarRepository<RedisReadConfig> repository, IWmsPDAScanInStockService wmsPDAScanInStock)
|
||||
public RedisBackGround(RedisData redisData, IPrdInstockService prdInstockService, ISqlSugarRepository<RedisReadConfig> repository)
|
||||
{
|
||||
_redisData = redisData;
|
||||
_prdInstockService = prdInstockService;
|
||||
_repository = repository;
|
||||
_wmsPDAScanInStock = wmsPDAScanInStock;
|
||||
_repository = repository;
|
||||
}
|
||||
//获取redis数据
|
||||
private void GetRedisData(object state)
|
||||
{
|
||||
var _redisReadConfigs = _repository.AsQueryable().Where(p => p.enabled == 1).ToList();
|
||||
var _redisReadConfigs = _repository.AsQueryable().Where(p => p.enabled == 1).ToList();
|
||||
foreach (var config in _redisReadConfigs)
|
||||
{
|
||||
try
|
||||
{
|
||||
var json = _redisData.GetHash(config.dev_name!, config.tag_name!).Result;
|
||||
var json= _redisData.GetHash(config.dev_name!, config.tag_name!).Result;
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(json);
|
||||
if (config.data_type == (int)DataType.INT)
|
||||
{
|
||||
@@ -74,7 +51,7 @@ namespace Tnb.ProductionMgr
|
||||
}
|
||||
else if (config.check_type == (int)CheckType.包含)
|
||||
{
|
||||
int[] ints = Array.ConvertAll(config.data!.Replace("[", "").Replace("]", "").Split(",", StringSplitOptions.RemoveEmptyEntries), int.Parse);
|
||||
int[] ints= Array.ConvertAll(config.data!.Replace("[","").Replace("]","").Split(",",StringSplitOptions.RemoveEmptyEntries),int.Parse);
|
||||
if (ints.Contains(res.Value<int>("Value")))
|
||||
{
|
||||
InstockInput instockInput = new()
|
||||
@@ -124,258 +101,126 @@ namespace Tnb.ProductionMgr
|
||||
break;
|
||||
}
|
||||
}
|
||||
//ctu取货
|
||||
private void CheckGet(object state)
|
||||
//获取注塑装箱状态
|
||||
private void GetZSPackStatus(object state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("SSX-021-005", new string[] { "YTCS", "AllowFullOut_CS05", "LiftCode" });
|
||||
getdic.Add("SSX-011-002", new string[] { "YTCS", "AllowAgvFullIn_CS02", "Code_CS02" });
|
||||
getdic.Add("SSX-011-004", new string[] { "YTCS", "AllowCtuFullOut_CS04", "Code_CS04" });
|
||||
|
||||
getdic.Add("SSX-011-008", new string[] { "东面提升机输送线", "入库输送线8允许出箱", "入库输送线7条码" });
|
||||
|
||||
getdic.Add("SSX-111-011", new string[] { "东面提升机输送线", "下升降机11允许出箱", "下升降机11条码" });
|
||||
getdic.Add("SSX-111-012", new string[] { "东面提升机输送线", "下升降机12允许出箱", "下升降机12条码" });
|
||||
getdic.Add("ZSSSXCTU02", new string[] { "YTCS", "AllowAgvEmptyOut_CS03", "" });
|
||||
getdic.Add("ZSSSXCTU01", new string[] { "YTCS", "AllowAgvEmptyOut_CS01", "" });
|
||||
|
||||
|
||||
foreach (var key in getdic.Keys)
|
||||
try
|
||||
{
|
||||
try
|
||||
string[] strs = new string[1] { "TY4C-ZHUSU1" };
|
||||
string sign = "agvMode";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
var strs = getdic.Where(p => p.Key == key).First().Value;
|
||||
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
|
||||
string data = _redisData.GetHash(strs[0], strs[1]).Result;
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
|
||||
if (result)
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(strs[2]))
|
||||
if (!kv.Key.Contains(sign))
|
||||
{
|
||||
string codedata = _redisData.GetHash(strs[0], strs[2]).Result;
|
||||
JObject? coderes = JsonConvert.DeserializeObject<JObject>(codedata);
|
||||
string coderesult = coderes != null && coderes["Value"] != null ? coderes.Value<string>("Value")! : "";
|
||||
coderesult = coderesult.Replace("\r", "");
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == coderesult && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
|
||||
if (DistaskH != null)
|
||||
{
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = coderesult;
|
||||
CancellationTokenSource Ctu = new();
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
DistaskH.extras = respBody;
|
||||
_repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
|
||||
Ctu.Dispose();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
else {
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.startlocation_code == key && p.status == WmsWareHouseConst.TASK_BILL_STATUS_YXD_ID && string.IsNullOrEmpty(p.extras)).First();
|
||||
if (DistaskH != null)
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (int.Parse(res["Value"]!.ToString()) is not ((int)Eagvmode.无请求) and not ((int)Eagvmode.收到请求))
|
||||
{
|
||||
dynamic reqBody = new ExpandoObject();
|
||||
reqBody.taskCode = DistaskH.bill_code;
|
||||
reqBody.slotCode = key;
|
||||
reqBody.containerCode = DistaskH.carry_code;
|
||||
CancellationTokenSource Ctu = new();
|
||||
dynamic respBody = HttpClientHelper.PostStreamAsync("http://192.168.11.104:1880/wcs/notify/cargo", reqBody, Ctu.Token).Result;
|
||||
DistaskH.extras = respBody;
|
||||
_repository.AsSugarClient().Updateable(DistaskH).ExecuteCommand();
|
||||
Ctu.Dispose();
|
||||
InstockInput instockInput = new()
|
||||
{
|
||||
equip_code = res["DevName"]!.ToString(),
|
||||
label_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly Dictionary<LogLevel, string> s_logLevelMap = new()
|
||||
//获取挤出装箱状态
|
||||
private void GetJCPackStatus(object state)
|
||||
{
|
||||
[LogLevel.Debug] = "DBG",
|
||||
[LogLevel.Information] = "INF",
|
||||
[LogLevel.Warning] = "WRN",
|
||||
[LogLevel.Error] = "ERR",
|
||||
};
|
||||
protected ILogger Logger => LoggerFactory.Create(builder => builder.AddFile($"{AppContext.BaseDirectory}/logs/custom{DateTime.Now:yyyyMMdd}.log", cfgOpts =>
|
||||
{
|
||||
|
||||
//cfgOpts.DateFormat = "yyyy-MM-dd HH:mm:ss.fff";
|
||||
cfgOpts.MessageFormat = (logMsg) =>
|
||||
try
|
||||
{
|
||||
var logLevel = s_logLevelMap[logMsg.LogLevel];
|
||||
var sb = new StringBuilder();
|
||||
_ = sb.Append($"[{logLevel}] ");
|
||||
_ = sb.Append($"{logMsg.LogName} ");
|
||||
_ = sb.Append($"{DateTime.Now:yyyy-MM-dd HH:mm:ss.fff} ");
|
||||
_ = sb.Append($"#{logMsg.EventId.Id} ");
|
||||
_ = sb.Append(logMsg.Message + " ");
|
||||
_ = sb.Append(logMsg.Exception?.ToString());
|
||||
return sb.ToString();
|
||||
};
|
||||
|
||||
})).CreateLogger(this.GetType());
|
||||
|
||||
|
||||
//扫码入库
|
||||
private void ScanInStock(object state)
|
||||
{
|
||||
Dictionary<string, string[]> getdic = new Dictionary<string, string[]>();
|
||||
getdic.Add("BGWRKYCL02", new string[] { "CP8", "AllowGetFullBox1", "code1", "PutDoneEmptyBox", "false" });
|
||||
getdic.Add("BGWRKYCL01", new string[] { "CP8", "AllowGetFullBox2", "code2", "PutDoneEmptyBox", "false" });
|
||||
foreach (var key in getdic.Keys)
|
||||
{
|
||||
try
|
||||
string[] strs = new string[1] { "TY4C-SHUSONG-JC" };
|
||||
string sign = "AGVFullCall";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
var strs = getdic.Where(p => p.Key == key).First().Value;
|
||||
bool flag = _redisData.HashExist(strs[0], strs[1]).Result;
|
||||
string data = _redisData.GetHash(strs[0], strs[1]).Result;
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
|
||||
|
||||
bool result = res != null && res["Value"] != null ? res.Value<bool>("Value") : false;
|
||||
if (result)
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
{
|
||||
Logger.LogInformation($"八工位扫到码发送入库请求:{res}");
|
||||
|
||||
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
if (!kv.Key.Contains(sign))
|
||||
{
|
||||
["DevName"] = strs[0],
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strs[3],
|
||||
["Value"] = strs[4],
|
||||
};
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand).Wait();
|
||||
string codedata = _redisData.GetHash(strs[0], strs[2]).Result;
|
||||
JObject? coderes = JsonConvert.DeserializeObject<JObject>(codedata);
|
||||
string coderesult = coderes != null && coderes["Value"] != null ? coderes.Value<string>("Value")! : "";
|
||||
WmsCarryH? carry = _repository.AsSugarClient().Queryable<WmsCarryH>().Single(it => it.carry_code == coderesult);
|
||||
if (carry != null)
|
||||
continue;
|
||||
}
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
if (_repository.AsSugarClient().Queryable<WmsPretaskH>().Where(p => p.carry_id == carry.id && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID ).Any())
|
||||
continue;
|
||||
var WmsCarryCode = _repository.AsSugarClient().Queryable<WmsCarryCode>().Single(it => it.carry_id == carry.id);
|
||||
if (WmsCarryCode != null)
|
||||
if (res.Value<bool>("Value"))
|
||||
{
|
||||
VisualDevModelDataCrInput input = new VisualDevModelDataCrInput();
|
||||
input.data = new Dictionary<string, object>();
|
||||
input.data.Add("barcode", coderesult);
|
||||
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
|
||||
input.data.Add("material_code", WmsCarryCode.material_code);
|
||||
input.data.Add("extras", key);//location_code
|
||||
input.data.Add("warehouse_id", "1");//TEST
|
||||
input.data.Add("bill_code", "");//采购收货单号
|
||||
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
|
||||
input.data.Add("material_specification", WmsCarryCode.material_specification!);//规格型号
|
||||
input.data.Add("container_no", WmsCarryCode.container_no!);//箱号
|
||||
input.data.Add("material_id", WmsCarryCode.material_id);
|
||||
input.data.Add("id", null);
|
||||
_wmsPDAScanInStock.ScanInStockByRedis(input).Wait();
|
||||
InstockInput instockInput = new()
|
||||
{
|
||||
equip_code = res["DevName"]!.ToString(),
|
||||
label_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_prdInstockService.InstockTypeOne(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
private void SSXcode(object state)
|
||||
//获取限位状态
|
||||
private void GetLimitStatus(object state)
|
||||
{
|
||||
Dictionary<string, string[]> dic = new Dictionary<string, string[]>();
|
||||
//有问题
|
||||
dic.Add("东面提升机输送线", new string[] { "下升降机判断请求", "下升降机判断条码", "下升降机判断完毕", "下升降机判断结果" });
|
||||
Dictionary<string, int> putdic = new Dictionary<string, int>();
|
||||
putdic.Add("SSX-111-011", 11);
|
||||
putdic.Add("SSX-111-012", 12);
|
||||
foreach (var key in dic.Keys)
|
||||
/*
|
||||
Console.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
|
||||
Console.WriteLine($"获取挤出装箱状态");
|
||||
string data = _redisData.GetHash("TY4C-SHUSONG-JC", "AGVFullCall").Result;
|
||||
Console.WriteLine(data);*/
|
||||
try
|
||||
{
|
||||
try
|
||||
string[] strs = new string[1] { "TY4C-WAIBAO" };
|
||||
string sign = "AGVCall";
|
||||
foreach (string s in strs)
|
||||
{
|
||||
var strs = dic.Where(p => p.Key == key).First().Value;
|
||||
string dataflag = _redisData.GetHash(key, strs[0]).Result;
|
||||
JObject? resflag = JsonConvert.DeserializeObject<JObject>(dataflag);
|
||||
bool re = resflag != null && resflag["Value"] != null ? resflag.Value<bool>("Value") : false;
|
||||
if (!re)
|
||||
continue;
|
||||
string data = _redisData.GetHash(key, strs[1]).Result;
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(data);
|
||||
string? result = res != null && res["Value"] != null ? res.Value<string>("Value") : "";
|
||||
if (!string.IsNullOrEmpty(result))
|
||||
Dictionary<string, string> dic = _redisData.HGetAll(s).Result;
|
||||
foreach (KeyValuePair<string, string> kv in dic)
|
||||
{
|
||||
if (result.Length < 5)
|
||||
if (!kv.Key.Contains(sign))
|
||||
{
|
||||
result = "LX" + result.Replace("\r", "");
|
||||
continue;
|
||||
}
|
||||
var DistaskH = _repository.AsSugarClient().Queryable<WmsDistaskH>().Where(p => p.carry_code == result && p.status != WmsWareHouseConst.TASK_BILL_STATUS_COMPLE_ID).OrderByDescending(p => p.create_time).First();
|
||||
if (DistaskH != null)
|
||||
JObject? res = JsonConvert.DeserializeObject<JObject>(kv.Value);
|
||||
if (res != null && res["Value"] != null)
|
||||
{
|
||||
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
|
||||
if (res.Value<bool>("Value"))
|
||||
{
|
||||
["DevName"] = key,
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strs[3],
|
||||
["Value"] = putdic.Keys.Contains(DistaskH.startlocation_code) ? putdic.Where(p => p.Key == DistaskH.startlocation_code).First().Value.ToString() : "13",
|
||||
};
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2).Wait();
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = key,
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strs[2],
|
||||
["Value"] = "true",
|
||||
};
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand).Wait();
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, string> dicCommand2 = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = key,
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strs[3],
|
||||
["Value"] = "13",
|
||||
};
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand2).Wait();
|
||||
Dictionary<string, string> dicCommand = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["DevName"] = key,
|
||||
["token"] = _eleCtlCfg.token,
|
||||
["TagName"] = strs[2],
|
||||
["Value"] = "true",
|
||||
};
|
||||
HttpClientHelper.GetRequestAsync(_eleCtlCfg.WriteTagUrl, dicCommand).Wait();
|
||||
InstockInput instockInput = new()
|
||||
{
|
||||
equip_code = res["DevName"]!.ToString(),
|
||||
label_code = res["TagName"]!.ToString()
|
||||
};
|
||||
_prdInstockService.InstockOutPack(instockInput);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Readtimer?.Dispose();
|
||||
CheckGettimer?.Dispose();
|
||||
Scantimer?.Dispose();
|
||||
SSXcodetimer?.Dispose();
|
||||
}
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
Readtimer = new Timer(GetRedisData, null, TimeSpan.Zero, TimeSpan.FromSeconds(300));
|
||||
CheckGettimer = new Timer(CheckGet, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
|
||||
Scantimer = new Timer(ScanInStock, null, TimeSpan.Zero, TimeSpan.FromSeconds(60));
|
||||
SSXcodetimer= new Timer(SSXcode, null, TimeSpan.Zero, TimeSpan.FromSeconds(10));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
|
||||
@@ -12,11 +12,9 @@
|
||||
<ProjectReference Include="..\..\BasicData\Tnb.BasicData.Interfaces\Tnb.BasicData.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\EquipMgr\Tnb.EquipMgr.Interfaces\Tnb.EquipMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\message\Tnb.Message\Tnb.Message.csproj" />
|
||||
<ProjectReference Include="..\..\PerMgr\Tnb.PerMgr.Entities\Tnb.PerMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\QcMgr\Tnb.QcMgr.Interfaces\Tnb.QcMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Interfaces\Tnb.WarehouseMgr.Interfaces.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user