/// <summary> /// 移除炉次计划将移除的订单炉次计划添加到最后浇次中,考虑浇次最大炉数 /// </summary> /// <param name="current"></param> /// <param name="lcNum"></param> private void RemoveLcWithLessOrd(Mod_TPP_LGPC_LSB current, int lcNum) { // 浇次炉次数据 var jcData = LCLSBList.Where(w => w.C_FK == current.C_ID); var removeLcData = GetLast(current, lcNum); RemoveLcWithMoreOrd(current, lcNum); removeLcData.RemoveAll(x => x.C_STATE == "1"); // 将炉次计划添加到最后浇次中,或新增浇次并满足最低炉次 var lastJc = LSBList.Where(w => w.N_GROUP == current.N_GROUP).OrderBy(w => w.N_SORT).LastOrDefault(); if (lastJc == current) { // 如果当前浇次就是最后一个浇次,新增浇次 lastJc = current.Clone(); LSBList.Add(lastJc); } ReplaceLc(lastJc, removeLcData); }
/// <summary> /// 递归替换炉次计划 /// 满足最小炉次,如果超过最大炉次新增浇次计划 /// </summary> /// <param name="current"></param> /// <param name="replaceLcData"></param> private void ReplaceLc(Mod_TPP_LGPC_LSB current, List <Mod_TPP_LGPC_LCLSB> replaceLcData) { // 浇次炉次数据 var jcData = LCLSBList.Where(w => w.C_FK == current.C_ID); // 替换的不是订单类型的炉次 Replace(current, replaceLcData); if (replaceLcData.Count > 0) { // 添加最少浇次炉次数据 AddFullLc(current, replaceLcData); } if (replaceLcData.Count > 0) { // 新增浇次递归,满足最低炉次 var addJc = current.Clone(); LSBList.Add(addJc); ReplaceLc(addJc, replaceLcData); } CountLs(current); }