|
|
@@ -1049,7 +1049,6 @@ namespace Business.ResourceExamineManagement
|
|
|
//throw new bu
|
|
|
}
|
|
|
List<BomChildExamineDto> returnlist = new List<BomChildExamineDto>();
|
|
|
- //var query = (await _ic_bom.GetQueryableAsync()).WhereIf(true, a => a.bom_id == BomId).ToList();
|
|
|
|
|
|
var bom = bomlist.Find(s => s.Id == BomId);
|
|
|
if (bom == null)
|
|
|
@@ -1112,14 +1111,14 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
//var bdto = ObjectMapper.Map<ic_bom,BomChildExamineDto>(bom);
|
|
|
returnlist.Add(dto);
|
|
|
- var childlist = bomchildlist.WhereIf(true, a => a.bom_id == bom.Id).ToList();
|
|
|
+ var childlist = bomchildlist.Where(a => a.bom_id == bom.Id).ToList();
|
|
|
|
|
|
int idx = 1;
|
|
|
foreach (var c in childlist)
|
|
|
{
|
|
|
string childNum = dto.num + "." + idx.ToString();
|
|
|
- var icitem = icitemlist.WhereIf(true, a => a.Id == c.icitem_id).FirstOrDefault();
|
|
|
- var childBom = bomlist.WhereIf(true, a => a.icitem_id == c.icitem_id).FirstOrDefault();
|
|
|
+ var icitem = icitemlist.Where(a => a.Id == c.icitem_id).FirstOrDefault();
|
|
|
+ var childBom = bomlist.Where(a => a.icitem_id == c.icitem_id).FirstOrDefault();
|
|
|
//如果此明细查的到BOM信息,则代表此child是一个子BOM。
|
|
|
if (childBom != null)
|
|
|
{
|
|
|
@@ -1158,8 +1157,8 @@ namespace Business.ResourceExamineManagement
|
|
|
childDto.num = childNum;
|
|
|
childDto.model = icitem.model;
|
|
|
childDto.unit = c.unit;
|
|
|
- childDto.erp_cls = item.erp_cls;
|
|
|
- childDto.erp_cls_name = item.erp_cls_name;
|
|
|
+ childDto.erp_cls = icitem.erp_cls;
|
|
|
+ childDto.erp_cls_name = icitem.erp_cls_name;
|
|
|
childDto.backflush = c.backflush;
|
|
|
childDto.qty = c.qty.Value;
|
|
|
childDto.isbom = 0;
|
|
|
@@ -1267,7 +1266,7 @@ namespace Business.ResourceExamineManagement
|
|
|
|
|
|
//List<BomChildExamineDto> returnlist = new List<BomChildExamineDto>();
|
|
|
var dto = new BomChildExamineDto();
|
|
|
- var bom = bomlist.WhereIf(true, s => s.icitem_id == dtl.icitem_id).FirstOrDefault();
|
|
|
+ var bom = bomlist.Where(s => s.icitem_id == dtl.icitem_id).FirstOrDefault();
|
|
|
var icitem = icitemlist.Find(s => s.Id == dtl.icitem_id);
|
|
|
if (icitem == null)
|
|
|
{
|
|
|
@@ -1393,9 +1392,27 @@ namespace Business.ResourceExamineManagement
|
|
|
//returnlist[0].kz = childList.Min(s => s.kz);//得到最小可制数量。
|
|
|
//再加个循环,来根据替代关系里的检查结果,根据规则明确使用和生成占用关系。
|
|
|
|
|
|
+ CalcIcitem(childList, returnlist, bangid, orderid, input, sklist, plan_date);
|
|
|
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 循环计算物料情况
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="childList"></param>
|
|
|
+ /// <param name="returnlist"></param>
|
|
|
+ /// <param name="bangid"></param>
|
|
|
+ /// <param name="orderid"></param>
|
|
|
+ /// <param name="input"></param>
|
|
|
+ /// <param name="sklist"></param>
|
|
|
+ /// <param name="plan_date"></param>
|
|
|
+ public void CalcIcitem(List<BomChildExamineDto> childList, List<BomChildExamineDto> returnlist, long bangid, long orderid, SeorderentryDto input, List<ic_item_stockoccupy> sklist, DateTime
|
|
|
+ ? plan_date)
|
|
|
+ {
|
|
|
foreach (var item in childList)
|
|
|
{
|
|
|
+ var cilList = returnlist.Where(s => s.parent_id == item.id && s.type == 0).ToList();
|
|
|
+
|
|
|
if (item.haveicsubs == 1)
|
|
|
{
|
|
|
//如果有替代关系,根据群组来明确使用哪个群组的替代料。按整批和混用逻辑来算
|
|
|
@@ -1408,12 +1425,17 @@ namespace Business.ResourceExamineManagement
|
|
|
ic_item_stockoccupy itemStockoccupyDto = new ic_item_stockoccupy();
|
|
|
itemStockoccupyDto.bang_id = bangid;
|
|
|
itemStockoccupyDto.icitem_id = item.item_id;
|
|
|
+ //修改:根据是否缺料判断使用库存,还是使用需要数量needcount
|
|
|
itemStockoccupyDto.quantity = item.sqty;
|
|
|
sklist.Add(itemStockoccupyDto);
|
|
|
item.is_use = true;
|
|
|
+ CalcIcitem(cilList, returnlist, bangid, orderid, input, sklist, plan_date);
|
|
|
+
|
|
|
if (item.erp_cls == 1)
|
|
|
{
|
|
|
//走自制
|
|
|
+ //走子物料
|
|
|
+ //foreach()
|
|
|
}
|
|
|
else if (item.erp_cls == 2 || item.erp_cls == 3)
|
|
|
{
|
|
|
@@ -1425,6 +1447,10 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
//生成委外工单
|
|
|
CreateMesOOder(item, input.tenantId, input.factoryId, bangid, leadTimeList, supplierList, plan_date.Value);
|
|
|
+ //1.先生成委外工单。
|
|
|
+ //2.再根据委外工单需要检查库存材料,然后提供给第三方组装。
|
|
|
+ //3.如果委外工单的物料库存不够,先生成物料采购申请单,再生成物料的采购订单,到货后再走委外流程。
|
|
|
+ //4.再生成委外的采购申请单。
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -1536,6 +1562,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
|
RecalculationStock(s, returnlist, sklist);
|
|
|
}
|
|
|
+ //可制计算:需要对list进行可制计算,按主料来算辅料
|
|
|
if (list.Where(s => s.stock_state != 1).Count() == 0)
|
|
|
{
|
|
|
//只满足充足或可制
|
|
|
@@ -1623,7 +1650,8 @@ namespace Business.ResourceExamineManagement
|
|
|
itemStockoccupyDto.quantity = slt.needCount;
|
|
|
if (parent != null)
|
|
|
{ //如果不缺料的情况下,则占用掉父级缺料乘以当前子集使用料数量
|
|
|
- itemStockoccupyDto.quantity = parent.lack_qty * slt.qty - slt.sqty;
|
|
|
+ //itemStockoccupyDto.quantity = parent.lack_qty * slt.qty - slt.sqty;
|
|
|
+ itemStockoccupyDto.quantity = parent.lack_qty * slt.qty;
|
|
|
}
|
|
|
}
|
|
|
sklist.Add(itemStockoccupyDto);
|