//计划长铸坯块数信息添加 bcls_ret->Tables[0].Columns.Add(DT_DECIMAL,"PLAN_LSLAB_NUM"); //Log::Trace("", __FUNCTION__, "count=[{0}]", bcls_ret->Tables[0].Rows.get_Count()); //循环 for (int i = 0; i < bcls_ret->Tables[0].Rows.get_Count(); i++) { pono = bcls_ret->Tables[0].Rows[i]["PONO"].ToString().Trim(); //未产出 sqlstr = "SELECT(SELECT COUNT(*) FROM TPSSM03 WHERE SLAB_PROD_FLAG <> ‘1‘ AND PONO = ‘" + pono + "‘) + " "(SELECT COUNT(*) FROM TMMSM02 WHERE PONO = ‘" + pono + "‘ ) FROM SYSIBM.SYSDUMMY1"; Log::Trace("", __FUNCTION__, "sqlstr=[{0}]", sqlstr); cmd_inq.SetCommandText(sqlstr); cmd_inq.Parameters.Set("pono", tpssm11.PONO); cmd_inq.ExecuteReader(); if (cmd_inq.Read()){ count = cmd_inq.GetDecimal(1).ToInt32(); } cmd_inq.Close(); Log::Trace("", __FUNCTION__, "pono=[{0}]", tpssm11.PONO); Log::Trace("", __FUNCTION__, "count=[{0}]", count); bcls_ret->Tables[0].Rows[i]["PLAN_LSLAB_NUM"] = count; }
基本方法是在返回块中加入参数,若表中有该字段则使用以下方式定义,后面赋值一致,若表中不存在该字段则强制添加与EPED54功能号保持一致
bcls_ret->Tables[0].Columns.Add(DT_STRING, "CC_DIV");
后面的统计块数代码将两个count语句拼接起来,定义为空表