/// <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="lcNum"></param> public void Add(Mod_TPP_LGPC_LSB current, int lcNum) { var grpJc = LSBList.Where(w => w.N_GROUP == current.N_GROUP).OrderByDescending(w => w.N_SORT).ToList(); foreach (var item in grpJc) { if (lcNum == 0 || item == current) { break; } // 炉次数据 var jcData = LCLSBList.Where(w => w.C_FK == item.C_ID).Where(w => w.C_STATE != "1"); foreach (var lcItem in jcData.OrderByDescending(w => w.N_SORT)) { if (lcNum == 0) { break; } LCLSBList.Remove(lcItem); AddOrdLc(current, lcItem); lcNum--; } AddFullLc(item, new List <Mod_TPP_LGPC_LCLSB> { }); RemoveEmptyJc(item); CountLs(item); } if (lcNum > 0) { AddLc(current, lcNum); } CountLs(current); }