/// <summary> /// 进行切料处理 /// </summary> /// <param name="pieceLabels">待出料标签,如"3231H"</param> /// <param name="pieceDemandValues">待出料个数</param> /// <param name="pieceLengthes">长度</param> /// <param name="stockLabels">原料标签</param> /// <param name="stockLengthes">原料长度</param> /// <param name="stockSupportValues">原料个数</param> /// <param name="cuttingLength">切割宽度</param> /// <param name="holdingLength">夹持余量</param> /// <param name="stockMargin">料端余量</param> /// <param name="cutcutingLimitInOneStock">每原料可容纳切料类型数,设置打印标签上线</param> /// <param name="arrangedAllstocks"></param> /// <param name="cuttingInfo"></param> /// <returns></returns> public int CreateCuttingStockMode(string[] pieceLabels, uint[] pieceDemandValues, decimal[] pieceLengthes, string[] stockLabels, decimal[] stockLengthes, uint[] stockSupportValues, decimal cuttingLength, decimal holdingLength, decimal stockMargin, int cutcutingLimitInOneStock, out List <Stock> arrangedAllstocks, out CuttingInfo cuttingInfo) { try { CuttingStockProblem cuttingStockProblem = new CuttingStockProblem(); //创建allpiece列表 List <Piece> pieceList = cuttingStockProblem.CreatePieceList(pieceLabels, pieceDemandValues, pieceLengthes, cuttingLength); //按长度降序排序 pieceList = pieceList.OrderByDescending((Piece => Piece.Length)).ToList(); //创建allstock列表 List <Stock> stockList = CreateStockList(stockLabels, stockSupportValues, stockLengthes, holdingLength, stockMargin); //按长度降序排序 stockList = stockList.OrderByDescending((Stock => Stock.Length)).ToList(); //进行切料计算 arrangedAllstocks = cuttingStockProblem.CuttingStockArrangeFFDLR(pieceList, stockList, cutcutingLimitInOneStock); //切割信息 cuttingInfo = cuttingStockProblem.GetCuttingInfo(arrangedAllstocks); return(0); } catch { throw new Exception("出现错误"); } }
/// <summary> /// 进行切料处理 /// </summary> /// <param name="pieceLabels">待出料标签,如"3231H"</param> /// <param name="pieceDemandValues">待出料个数</param> /// <param name="pieceLengthes">长度</param> /// <param name="stockLabels">原料标签</param> /// <param name="stockLengthes">原料长度</param> /// <param name="stockSupportValues">原料个数</param> /// <param name="cuttingLength">切割宽度</param> /// <param name="holdingLength">夹持余量</param> /// <param name="stockMargin">料端余量</param> /// <param name="cutcutingLimitInOneStock">每原料可容纳切料类型数,设置打印标签上线</param> /// <param name="arrangedAllstocks"></param> /// <param name="cuttingInfo"></param> /// <returns></returns> public int CreateCuttingStockMode(string[] pieceLabels, uint[] pieceDemandValues, decimal[] pieceLengthes, string[] stockLabels, decimal[] stockLengthes, uint[] stockSupportValues, decimal cuttingLength, decimal holdingLength, decimal stockMargin, int cutcutingLimitInOneStock, out List <Stock> arrangedAllstocks, out CuttingInfo cuttingInfo) { //生成切料问题解决实例 CuttingStockProblem cuttingStockProblem = new CuttingStockProblem(); return(cuttingStockProblem.CreateCuttingStockMode(pieceLabels, pieceDemandValues, pieceLengthes, stockLabels, stockLengthes, stockSupportValues, cuttingLength, holdingLength, stockMargin, cutcutingLimitInOneStock, out arrangedAllstocks, out cuttingInfo)); }