• 递归方法


    public void ShowBOM(IList<CBF.Model.BOM> boms, IList<CBF.Model.BOMDisplay> listBoms,int parentId)
    {
    foreach (var b in boms)
    {
    BOMDisplay bOMToBOMDisplay = BOMToBOMDisplay(b, listBoms,parentId);
    listBoms.Add(bOMToBOMDisplay);

    //ICriteria criteria = this._session.CreateCriteria(typeof(CBF.Model.BOM));

    //criteria.Add(Expression.In("ParentId", new List<string>() { b.Id.ToString() }));
    string strSQL = string.Format(@"if exists(select * from mes_bom where parentid ='{0}')
    begin
    select * from mes_bom where parentid ='{1}'
    end
    else if exists(select * from MES_BOM where ItemNO = '{2}' and ParentID = 0)
    begin
    select * from MES_BOM where ParentID in(select ID from MES_BOM where ItemNO = '{3}' and ParentID = 0)
    end
    else
    select * from mes_bom where parentid ='{4}'

    ", b.Id, b.Id, b.ItemNO, b.ItemNO,b.Id);

    IList<CBF.Model.BOM> iboms = _session.CreateSQLQuery(strSQL).AddEntity(typeof(BOM)).List<BOM>();

    if (iboms.Count > 0)
    {
    ShowBOM(iboms, listBoms, bOMToBOMDisplay.IId);
    }

    }
    }

  • 相关阅读:
    JS加密库
    异常处理
    uva 10673 Play with Floor and Ceil
    执⾏ Python 程序的三种⽅式----pycharm安装
    第⼀个 Python 程序
    认识 Python
    svg的使用
    elementUI中el-image显示不出来图片?img与el-image的区别
    类型转化与变量
    liunx
  • 原文地址:https://www.cnblogs.com/chengjun/p/5274726.html
Copyright © 2020-2023  润新知