|
|
@@ -361,9 +361,10 @@ namespace Business.ResourceExamineManagement
|
|
|
&& x.morder_icitem_type != "相关委外工单") && x.IsDeleted == false;
|
|
|
var morderList = await _mes_morder.GetManyByCondition(filter);
|
|
|
|
|
|
- //TODO:获取销售订单信息
|
|
|
+ //获取销售订单信息
|
|
|
//var seorder = await _crm_seorder.FindAsync(x => x.Id == OrderId);
|
|
|
var seorderentry = await _crm_seorderentry.FindAsync(x => x.seorder_id == OrderId);
|
|
|
+ //获取物料详情
|
|
|
var mysql_ic_item = await _mysql_ic_item.FindAsync(x => x.number == bomNumber);
|
|
|
|
|
|
//工单已被占用后要与占用表关联查询...减去占用量后 剩下生产数量可供下个销售工单使用。
|
|
|
@@ -407,25 +408,6 @@ namespace Business.ResourceExamineManagement
|
|
|
}
|
|
|
}
|
|
|
return morderList;
|
|
|
- #region 注释
|
|
|
- /* var morderList = _mes_morder.GetAll().Result;
|
|
|
- //查询生产工单类型为计划工单并且工单类型为备库工单 并且BOM编码一致数据,订单状态为 初始或下达工单
|
|
|
- var morderTypeList = morderList.Where(x => x.work_order_type == "备库工单" && x.morder_type == "计划工单" &&
|
|
|
- x.bom_number == bomNumber && (x.morder_state == "初始" || x.morder_state == "下达")).ToList();
|
|
|
-
|
|
|
- //计划数量-需求数量=剩余可用数量 -->使用计划结束时间排序取第一条满足条件工单
|
|
|
- // List =>数量满足Quantity && 生成工单结束日期最早
|
|
|
- var SatisfyQuantityList = morderTypeList.Where(x => (x.morder_production_number.Value - x.need_number.Value) >= Quantity).
|
|
|
- ToList().OrderBy(x => x.moentry_etime).FirstOrDefault();
|
|
|
- if (SatisfyQuantityList == null)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
-
|
|
|
- }*/
|
|
|
- #endregion
|
|
|
}
|
|
|
/// <summary>
|
|
|
/// 拼接工单占用表
|
|
|
@@ -462,7 +444,7 @@ namespace Business.ResourceExamineManagement
|
|
|
mes_Mooccupy.moo_cbr = string.Empty;
|
|
|
//mes_Mooccupy.moo_ctime = ;
|
|
|
mes_Mooccupy.moo_creason = string.Empty;
|
|
|
- mes_Mooccupy.tenant_id = 0;
|
|
|
+ mes_Mooccupy.tenant_id = 0;//TODO:企业ID =集团 或公司ID
|
|
|
return mes_Mooccupy;
|
|
|
}
|
|
|
/// <summary>
|
|
|
@@ -512,7 +494,7 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="icitemlist"></param>
|
|
|
/// <param name="dto"></param>
|
|
|
/// <param name="returnlist"></param>
|
|
|
- public void GetBomList(List<ic_bom> bomlist, List<ic_bom_child> bomchildlist, List<ic_item> icitemlist, BomChildExamineDto dto, List<BomChildExamineDto> returnlist,int type)
|
|
|
+ public void GetBomList(List<ic_bom> bomlist, List<ic_bom_child> bomchildlist, List<ic_item> icitemlist, BomChildExamineDto dto, List<BomChildExamineDto> returnlist, int type)
|
|
|
{
|
|
|
int level = dto.level++;//初始化定义level层级
|
|
|
var help = new SnowFlake();
|
|
|
@@ -630,7 +612,7 @@ namespace Business.ResourceExamineManagement
|
|
|
foreach (var dtl in sadl)
|
|
|
{
|
|
|
//递归将替代关系组装出来。
|
|
|
- SubstitutePretreatment(sl, sal, dtl, item, returnlist, icitemlist, bomlist, bomchildlist,type);
|
|
|
+ SubstitutePretreatment(sl, sal, dtl, item, returnlist, icitemlist, bomlist, bomchildlist, type);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -649,12 +631,12 @@ namespace Business.ResourceExamineManagement
|
|
|
/// <param name="icitemlist"></param>
|
|
|
/// <param name="bomlist"></param>
|
|
|
/// <param name="bomchildlist"></param>
|
|
|
- public void SubstitutePretreatment(ic_substitute sl, ic_substitute_all sal, ic_substitute_all_dtl dtl,BomChildExamineDto toDto,List<BomChildExamineDto> returnlist, List<ic_item> icitemlist, List<ic_bom> bomlist, List<ic_bom_child> bomchildlist,int type)
|
|
|
+ public void SubstitutePretreatment(ic_substitute sl, ic_substitute_all sal, ic_substitute_all_dtl dtl, BomChildExamineDto toDto, List<BomChildExamineDto> returnlist, List<ic_item> icitemlist, List<ic_bom> bomlist, List<ic_bom_child> bomchildlist, int type)
|
|
|
{
|
|
|
//循环生成dtl层级dto,明细
|
|
|
//如果dtl对应的icitem是BOM,还需要向下继续展开。
|
|
|
var help = new SnowFlake();
|
|
|
-
|
|
|
+
|
|
|
//List<BomChildExamineDto> returnlist = new List<BomChildExamineDto>();
|
|
|
var dto = new BomChildExamineDto();
|
|
|
var bom = bomlist.WhereIf(true, s => s.icitem_id == dtl.icitem_id).FirstOrDefault();
|
|
|
@@ -687,7 +669,7 @@ namespace Business.ResourceExamineManagement
|
|
|
if (bom != null)
|
|
|
{
|
|
|
dto.bom_id = bom.Id;
|
|
|
-
|
|
|
+
|
|
|
dto.qty = dtl.replace_amount.Value;
|
|
|
dto.isbom = 1;
|
|
|
dto.is_replace = 0;
|
|
|
@@ -696,7 +678,8 @@ namespace Business.ResourceExamineManagement
|
|
|
dto.icitem_ids = "";
|
|
|
GetBomList(bomlist, bomchildlist, icitemlist, dto, returnlist, type);
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
dto.bom_id = null;
|
|
|
dto.isbom = 0;
|
|
|
returnlist.Add(dto);
|