WarM/±¨±í·ÖÎö/Sc_CJKB.cs
@@ -72,77 +72,100 @@
        {
            try
            {
                ClsCN SubCn = new ClsCN();
                string sSql = "";
                string sWhere = "";
                //过滤条件
                //if (frmCondition.SqlStr.Trim().Length == 0)
                //ClsCN SubCn = new ClsCN();
                //string sSql = "";
                //string sWhere = "";
                ////过滤条件
                ////if (frmCondition.SqlStr.Trim().Length == 0)
                ////    return;
                ////sSql = frmCondition.SqlStr + sWhere + " order by HStatus,HDate   ";
                //sSql = "exec h_p_CJKB ";
                ////
                //DSet = SubCn.RunProcReturn(sSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
                ////生成首行标题
                //if (DSet == null)
                //{
                //    //MessageBox.Show("没有返回任何结果,请在过滤框中点击【恢复】按钮,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
                //    return;
                //sSql = frmCondition.SqlStr + sWhere + " order by HStatus,HDate   ";
                sSql = "exec h_p_CJKB ";
                //
                DSet = SubCn.RunProcReturn(sSql, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
                //生成首行标题
                if (DSet == null)
                //}
                ////释放冻结
                //DBUtility.Xt_BaseBillFun.CancelFrozenCol(grdMain);
                ////
                //grdMain.DataSource = DSet.Tables[0].DefaultView;
                ////
                ////-----------预警状态
                ////开工时间小于当天时间,但是任务单状态还是 å¾…生产,系统自动黄色警示;
                ////完工时间小于当天时间,但是任务单还是待生产或者在执行的,系统自动红色警示;
                ////int HBDateCol = Fun_GetCol("开工时间");
                ////int HEDateCol = Fun_GetCol("完工时间");
                ////int HStatusCol = Fun_GetCol("生产状态");
                ////DateTime oNow = DateTime.Today.Date;
                ////for (int i = 0; i < grdMain.Rows.Count; i++)
                ////{
                ////    if (DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HBDateCol].Value) < oNow && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HStatusCol].Value) == "待生产")
                ////    {
                ////        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.Yellow;
                ////    }
                ////    if (DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HEDateCol].Value) < oNow && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HStatusCol].Value) == "待生产")
                ////    {
                ////        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                ////    }
                ////}
                ////设置合计列
                //string sTotalCol = "";
                //sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
                //string[] sT;
                //sT = sTotalCol.Split(Convert.ToChar(","));
                //oSumGrid.BuildTotalCols(sT);
                ////
                ////冻结
                //int FrCol = 10;
                //string s = "是";
                //DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
                ////画线
                ////GraphLine();
                ////Total();
                ////for (int i = 0; i < grdMain.Rows.Count; i++)
                ////{
                ////    if (i % 2 == 0)
                ////    {
                ////        grdMain.Rows[i].DefaultCellStyle.BackColor = Color.SteelBlue;
                ////        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.White;
                ////    }
                ////    else
                ////    {
                ////        grdMain.Rows[i].DefaultCellStyle.BackColor = Color.SlateGray;
                ////        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.White;
                ////    }
                ////}
                ////
                ///
                ClsCN clsCN = new ClsCN();
                ClsIni clsIni = new ClsIni();
                string text = ClsIni.ReadIni("Dept", "DeptID", Pub_Class.ClsPub.AppPath + "\\HXErp.ini");
                this.sDeptID = text;
                string procName = "exec h_p_CJKB " + this.sDeptID;
                this.DSet = clsCN.RunProcReturn(procName, this.ViewName, ref Pub_Class.ClsPub.sExeReturnInfo);
                bool flag = this.DSet == null;
                if (!flag)
                {
                    //MessageBox.Show("没有返回任何结果,请在过滤框中点击【恢复】按钮,尝试再次查询!" + DBUtility.ClsPub.sExeReturnInfo);
                    return;
                    Xt_BaseBillFun.CancelFrozenCol(this.grdMain);
                    this.grdMain.DataSource = this.DSet.Tables[0].DefaultView;
                    string totalCols = Gy_BaseFun.GetTotalCols(this.DSet);
                    string[] cols = totalCols.Split(new char[]
                    {
                        Convert.ToChar(",")
                    });
                    this.oSumGrid.BuildTotalCols(cols);
                    int frCol = 10;
                    string s = "是";
                    Xt_BaseBillFun.DisplayGrid(this.grdMain, base.Name, s, frCol);
                }
                //释放冻结
                DBUtility.Xt_BaseBillFun.CancelFrozenCol(grdMain);
                //
                grdMain.DataSource = DSet.Tables[0].DefaultView;
                //
                //-----------预警状态
                //开工时间小于当天时间,但是任务单状态还是 å¾…生产,系统自动黄色警示;
                //完工时间小于当天时间,但是任务单还是待生产或者在执行的,系统自动红色警示;
                //int HBDateCol = Fun_GetCol("开工时间");
                //int HEDateCol = Fun_GetCol("完工时间");
                //int HStatusCol = Fun_GetCol("生产状态");
                //DateTime oNow = DateTime.Today.Date;
                //for (int i = 0; i < grdMain.Rows.Count; i++)
                //{
                //    if (DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HBDateCol].Value) < oNow && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HStatusCol].Value) == "待生产")
                //    {
                //        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.Yellow;
                //    }
                //    if (DBUtility.ClsPub.isDate(grdMain.Rows[i].Cells[HEDateCol].Value) < oNow && DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HStatusCol].Value) == "待生产")
                //    {
                //        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.Red;
                //    }
                //}
                //设置合计列
                string sTotalCol = "";
                sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
                string[] sT;
                sT = sTotalCol.Split(Convert.ToChar(","));
                oSumGrid.BuildTotalCols(sT);
                //
                //冻结
                int FrCol = 10;
                string s = "是";
                DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
                //画线
                //GraphLine();
                //Total();
                //for (int i = 0; i < grdMain.Rows.Count; i++)
                //{
                //    if (i % 2 == 0)
                //    {
                //        grdMain.Rows[i].DefaultCellStyle.BackColor = Color.SteelBlue;
                //        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.White;
                //    }
                //    else
                //    {
                //        grdMain.Rows[i].DefaultCellStyle.BackColor = Color.SlateGray;
                //        grdMain.Rows[i].DefaultCellStyle.ForeColor = Color.White;
                //    }
                //}
                //
            } 
            catch (Exception e)
            {