|
@@ -3768,7 +3768,7 @@ namespace Business.ResourceExamineManagement
|
|
|
var exm = exmResult.Find(s => s.morder_id == item.Id);
|
|
var exm = exmResult.Find(s => s.morder_id == item.Id);
|
|
|
if (exm != null)
|
|
if (exm != null)
|
|
|
{
|
|
{
|
|
|
- var childs = childExamineList.Where(s => s.examine_id == exm.Id).ToList();
|
|
|
|
|
|
|
+ var childs = childExamineList.Where(s => s.examine_id == exm.Id && s.is_use == true).ToList();
|
|
|
List<b_bom_child_examine> returnList = new List<b_bom_child_examine>();
|
|
List<b_bom_child_examine> returnList = new List<b_bom_child_examine>();
|
|
|
GetWorkDetalis(childs.Where(s => s.level == 2).ToList(), returnList, childs);
|
|
GetWorkDetalis(childs.Where(s => s.level == 2).ToList(), returnList, childs);
|
|
|
if (returnList.Any())
|
|
if (returnList.Any())
|
|
@@ -4000,7 +4000,7 @@ namespace Business.ResourceExamineManagement
|
|
|
{
|
|
{
|
|
|
return "已存在【" + dto.scode + "】替代方案。";
|
|
return "已存在【" + dto.scode + "】替代方案。";
|
|
|
}
|
|
}
|
|
|
- if (_ic_bom_child.GetListAsync(s => s.substitute_code == stt.substitute_code).Result.Count() > 0)
|
|
|
|
|
|
|
+ if (_mysql_ic_bom_child.GetListAsync(s => s.substitute_code == stt.substitute_code).Result.Count() > 0)
|
|
|
{
|
|
{
|
|
|
return "替代方案已被关联使用,不允许修改。";
|
|
return "替代方案已被关联使用,不允许修改。";
|
|
|
}
|
|
}
|
|
@@ -4084,11 +4084,17 @@ namespace Business.ResourceExamineManagement
|
|
|
return "替代方案最低存在两个优先级。";
|
|
return "替代方案最低存在两个优先级。";
|
|
|
}
|
|
}
|
|
|
//判断同一个优先级里,相同是否标准料
|
|
//判断同一个优先级里,相同是否标准料
|
|
|
- //dto.srows.GroupBy(i => new { i.field_f8988ed2955a264f8f762faaed2c5f6a.GetValueOrDefault(), i.field_83817a9f5a15a4f78686105c694b0a39.GetValueOrDefault(), })//.Where(g => g.Count() > 1).Count() > 0;
|
|
|
|
|
- if (dto.srows.GroupBy(s => new { s.field_f8988ed2955a264f8f762faaed2c5f6a, s.field_83817a9f5a15a4f78686105c694b0a39 }).Where(g => g.Count() > 1).Count() > 0)
|
|
|
|
|
|
|
+ foreach (var r in dto.srows)
|
|
|
{
|
|
{
|
|
|
- return "同优先级群组里不允许既有标准件又有替代件。";
|
|
|
|
|
|
|
+ if (dto.srows.Where(s => s.field_f8988ed2955a264f8f762faaed2c5f6a == r.field_f8988ed2955a264f8f762faaed2c5f6a && s.field_83817a9f5a15a4f78686105c694b0a39 != r.field_83817a9f5a15a4f78686105c694b0a39).Count() > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "同优先级群组里不允许既有标准件又有替代件。";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ /*if (dto.srows.GroupBy(s => new { s.field_f8988ed2955a264f8f762faaed2c5f6a, s.field_83817a9f5a15a4f78686105c694b0a39 }).Where(g => g.Count() > 1).Count() > 0)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "同优先级群组里不允许既有标准件又有替代件。";
|
|
|
|
|
+ }*/
|
|
|
return "ok";
|
|
return "ok";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -4155,5 +4161,55 @@ namespace Business.ResourceExamineManagement
|
|
|
await _productionScheduleAppService.DoProductSchedule(workOrds, domain, 2);
|
|
await _productionScheduleAppService.DoProductSchedule(workOrds, domain, 2);
|
|
|
return "ok";
|
|
return "ok";
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /// <summary>
|
|
|
|
|
+ /// BOM关联替代方案
|
|
|
|
|
+ /// </summary>
|
|
|
|
|
+ /// <param name="dto"></param>
|
|
|
|
|
+ /// <returns></returns>
|
|
|
|
|
+ public async Task<string> BindingSubstitute(BindingSubstituteDto dto)
|
|
|
|
|
+ {
|
|
|
|
|
+ var list = _mysql_ic_bom_child.GetListAsync(s => s.bom_id == dto.id && s.tenant_id == dto.tenant_id && s.company_id == dto.company_id && s.factory_id == dto.factory_id).Result;
|
|
|
|
|
+
|
|
|
|
|
+ if (dto.bomDetail.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ list.ForEach(s => { s.substitute_code = ""; s.haveicsubs = 0; });
|
|
|
|
|
+ var codeList = dto.bomDetail.Where(s => string.IsNullOrEmpty(s.substitute_code) == false).Select(x => x.substitute_code).Distinct().ToList();
|
|
|
|
|
+ if (codeList.Any())
|
|
|
|
|
+ {
|
|
|
|
|
+ var subGdtls = _mysql_ic_substitute_group.GetListAsync(s => s.tenant_id == dto.tenant_id && s.company_id == dto.company_id && s.factory_id == dto.factory_id && codeList.Contains(s.substitute_code)).Result;
|
|
|
|
|
+ var subDetalis = _mysql_ic_substitute_group_detail.GetListAsync(s => s.tenant_id == dto.tenant_id && s.company_id == dto.company_id && s.factory_id == dto.factory_id && codeList.Contains(s.substitute_code)).Result;
|
|
|
|
|
+ foreach (var code in codeList)
|
|
|
|
|
+ {
|
|
|
|
|
+ var g = subGdtls.Find(s => s.substitute_code == code && s.main_material == 1);
|
|
|
|
|
+ if (g != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ var dtls = subDetalis.Where(s => s.substitute_group_id == g.Id).ToList();
|
|
|
|
|
+ foreach (var dtl in dtls)
|
|
|
|
|
+ {
|
|
|
|
|
+ var l = list.Find(s => s.item_number == dtl.icitem_number && s.qty == dtl.replace_qty);
|
|
|
|
|
+ if (l == null)
|
|
|
|
|
+ {
|
|
|
|
|
+ return "当前替代方案【" + code + "】的标准件未找到相同数量相同物料的BOM明细。";
|
|
|
|
|
+ }
|
|
|
|
|
+ if (string.IsNullOrEmpty(l.substitute_code))
|
|
|
|
|
+ {
|
|
|
|
|
+ l.haveicsubs = 1;
|
|
|
|
|
+ l.substitute_code = code;
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ return "当前替代方案【" + code + "】的标准件【"+l.item_number+"】与替代方案【"+ l.substitute_code + "】冲突。";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ else {
|
|
|
|
|
+ return "当前替代方案【"+ code + "】未设置标准件。";
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ await _mysql_ic_bom_child.UpdateManyAsync(list);
|
|
|
|
|
+ }
|
|
|
|
|
+ return "ok";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|