|
|
@@ -149,9 +149,9 @@ namespace Business.ResourceExamineManagement
|
|
|
IMongoDB<ic_bom_child> ic_bom_child,
|
|
|
IMongoDB<ic_item_stock> ic_item_stock,
|
|
|
IMongoDB<ic_check> ic_check,
|
|
|
- IMongoDB<ic_substitute> ic_substitute,
|
|
|
- IMongoDB<ic_substitute_all> ic_substitute_all,
|
|
|
- IMongoDB<ic_substitute_all_dtl> ic_substitute_all_dtl,
|
|
|
+ //IMongoDB<ic_substitute> ic_substitute,
|
|
|
+ //IMongoDB<ic_substitute_all> ic_substitute_all,
|
|
|
+ //IMongoDB<ic_substitute_all_dtl> ic_substitute_all_dtl,
|
|
|
IMongoDB<mes_morder> mes_morder,
|
|
|
IMongoDB<mes_mooccupy> mes_mooccupy,
|
|
|
IBasicRepository<ic_item, long> mysql_ic_item,
|
|
|
@@ -169,9 +169,9 @@ namespace Business.ResourceExamineManagement
|
|
|
_ic_bom_child = ic_bom_child;
|
|
|
_ic_item_stock = ic_item_stock;
|
|
|
_ic_check = ic_check;
|
|
|
- _ic_substitute = ic_substitute;
|
|
|
- _ic_substitute_all = ic_substitute_all;
|
|
|
- _ic_substitute_all_dtl = ic_substitute_all_dtl;
|
|
|
+ //_ic_substitute = ic_substitute;
|
|
|
+ //_ic_substitute_all = ic_substitute_all;
|
|
|
+ //_ic_substitute_all_dtl = ic_substitute_all_dtl;
|
|
|
_mes_morder = mes_morder;
|
|
|
_mysql_ic_item = mysql_ic_item;
|
|
|
_mysql_ic_bom = mysql_ic_bom;
|
|
|
@@ -223,40 +223,37 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
//测试代码
|
|
|
//await test();
|
|
|
- await ProductiveExamine(1733221167209762816, 100, 1000);
|
|
|
+ await ProductiveExamine(1733221167209762816,100);
|
|
|
return null;
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 产能计算
|
|
|
/// </summary>
|
|
|
/// <param name="tech_id">工艺路径主键</param>
|
|
|
/// <param name="packages">需要生产产品件数</param>
|
|
|
- /// <param name="quantity">需要生产数量</param>
|
|
|
- public async Task<DateTime> ProductiveExamine(long tech_id, int packages, int quantity)
|
|
|
+ public async Task<DateTime> ProductiveExamine(long tech_id, int packages)
|
|
|
{
|
|
|
- if (packages <= 0 || quantity <= 0)
|
|
|
+ if (packages <=0)
|
|
|
{
|
|
|
throw new NotImplementedException("产能计算参数有误!");
|
|
|
}
|
|
|
#region 1、数据准备
|
|
|
//1.1、获取工艺路径数据
|
|
|
- mes_technique tech = _mes_technique.GetOneByID(tech_id).Result;
|
|
|
+ mes_technique tech = await _mes_technique.GetOneByID(tech_id);
|
|
|
|
|
|
//1.2、获取工艺路径关联工序数据
|
|
|
- List<mes_tech_process> tech_Processes = _mes_tech_process.GetManyByCondition(x => x.tech_id == tech_id).Result;
|
|
|
+ List<mes_tech_process> tech_Processes = await _mes_tech_process.GetManyByCondition(x => x.tech_id == tech_id);
|
|
|
|
|
|
//1.3、获取当前工艺路径下的工序数据
|
|
|
FilterDefinition<mes_process> filter = Builders<mes_process>.Filter.In(s => s.Id, tech_Processes.Select(m => m.proc_id).ToList());
|
|
|
- List<mes_process> process = _mes_process.GetManyByIds(filter).Result;
|
|
|
+ List<mes_process> process = await _mes_process.GetManyByIds(filter);
|
|
|
|
|
|
//1.3、获取工艺工序关联工位信息
|
|
|
FilterDefinition<mes_tech_proc_workshop> filter1 = Builders<mes_tech_proc_workshop>.Filter.In(s => s.tech_proc_id, tech_Processes.Select(m => m.Id).ToList());
|
|
|
- List<mes_tech_proc_workshop> tech_Proc_Workshops = _mes_tech_proc_workshop.GetManyByIds(filter1).Result;
|
|
|
+ List<mes_tech_proc_workshop> tech_Proc_Workshops = await _mes_tech_proc_workshop.GetManyByIds(filter1);
|
|
|
|
|
|
//1.4、获取工位占用情况
|
|
|
//List<mes_schedule_occupy> schedule_Occupies = _mes_schedule_occupy.GetManyByCondition().Result;
|
|
|
@@ -308,8 +305,8 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
foreach (var chd in childs)
|
|
|
{
|
|
|
- //当前工序消耗时间
|
|
|
- time = quantity / item.uph.Value * 60 * item.effect_ratio.Value;
|
|
|
+ //当前工序消耗时间:件数*单位数量/uph*60*效率系数+前置准备时间
|
|
|
+ time = packages * chd.quantity / chd.uph.Value * 60 * chd.effect_ratio.Value + chd.readytime.Value;
|
|
|
if (time > maxTime)
|
|
|
{
|
|
|
maxTime = time;
|
|
|
@@ -333,8 +330,8 @@ namespace Business.ResourceExamineManagement
|
|
|
//2、两种计算模式UPH/节拍时间
|
|
|
if (item.type == 2)//uph
|
|
|
{
|
|
|
- //当前工序消耗时间
|
|
|
- sumTimes += quantity / item.uph.Value * 60 * item.effect_ratio.Value + item.readytime.Value;
|
|
|
+ //当前工序消耗时间:件数*单位数量/uph*60*效率系数+前置准备时间
|
|
|
+ sumTimes += packages * item.quantity / item.uph.Value * 60 * item.effect_ratio.Value + item.readytime.Value;
|
|
|
//计算完成,进行下一次循环
|
|
|
continue;
|
|
|
}
|