zzr99
2022-04-22 b32fe2ce5c1a29313a853535ed4a171256e7faf7
BaseSet/¹«ÓÃ×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/Gy_StdWorkTimes.cs
@@ -32,6 +32,8 @@
        public const Int16 HLowerlimit = 11;
        public const Int16 HUSEORGID = 12;
        public const Int16 HRemarkCol = 13;
        public const Int16 HStdPiece = 14;
        public const Int16 HStdPric = 15;
        public bool BillChange;   //
        public DBUtility.ClsPub.Enum_OKTag OkTag;
        public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -242,29 +244,44 @@
        {
            try
            {
                if (int.Parse(txtHStdWorkTimes.Text)<=0)
                if (Convert.ToDecimal(txtHStdWorkTimes.Text.ToString())<=0)
                {
                    MessageBox.Show("标准工时必须大于0", "提示");
                    return;
                }
                if (int.Parse(txtHUpperlimit.Text) <= 0)
                if (Convert.ToDecimal(txtHUpperlimit.Text) <= 0)
                {
                    MessageBox.Show("上限比例必须大于0", "提示");
                    return;
                }
                if (int.Parse(txtHLowerlimit.Text) <= 0)
                if (Convert.ToDecimal(txtHLowerlimit.Text) <= 0)
                {
                    MessageBox.Show("下线比例必须大于0", "提示");
                    return;
                }
                oCn.BeginTran();
                if (Convert.ToDecimal(txtHStdPiece.Text) <= 0)
                {
                    MessageBox.Show("标准计件必须大于0", "提示");
                    return;
                }
                if (Convert.ToDecimal(txtHStdPric.Text) <= 0)
                {
                    MessageBox.Show("标准计价必须大于0", "提示");
                    return;
                }
                string sql = string.Format(@"Update Gy_StdWorkTimes set" +
                            " HMaterID=" + textBox1.Text +
                            ",HProcID=" + textBox2.Text +
                            ",HStdWorkTimes=" + txtHStdWorkTimes.Text +
                            ",HUpperlimit=" + txtHUpperlimit.Text +
                            ",HLowerlimit=" + txtHLowerlimit.Text +
                            ",HStdPiece=" + txtHStdPiece.Text +
                            ",HStdPric=" + txtHStdPric.Text +
                            ",HMaker='" + DBUtility.ClsPub.CurUserName + "'" +
                            ",HMakeDate='" + DateTime.Now + "'" +
                            ",HUSEORGID=" + DBUtility.ClsPub.HOrgID +
                             " where HItemID=" + BillOld.HItemID);
                oCn.BeginTran();
                oCn.RunProc(sql);
                oCn.Commit();
                MessageBox.Show("修改成功,请退出并刷新", "提示");
@@ -334,7 +351,7 @@
        {
            timer1.Enabled = false;
            Sub_ControlLocation();
            if (BillOld.HItemID.ToString()!=null)//|| BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Viewonly
            if (BillOld.HItemID.ToString()!=null&& BillOld.HItemID.ToString() !="0")//|| BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Viewonly
            {
                this.Sub_ShowBill();
            }
@@ -368,10 +385,8 @@
                case DBUtility.ClsPub.Enum_BillStatus.BillStatus_View:
                    //case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Viewonly:
                    //浏览状态
                    yl.Enabled = true;
                    xz.Enabled = true;
                    xg.Enabled = true;
                    sc.Enabled = true;
                    AddRow.Enabled = false;
                    DelRow.Enabled = false;
                    bc.Enabled = false;
@@ -380,22 +395,17 @@
                    if (txtHChecker.Text.Trim() == "")
                    {
                        xg.Enabled = true;
                        sc.Enabled = true;
                    }
                    else
                    {
                        xg.Enabled = false;
                        sc.Enabled = false;
                    }
                    Sub_LrtextStatus(false);
                    grdStatus = false;
                    break;
                case DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew:
                    //新增状态
                    yl.Enabled = false;
                    xz.Enabled = false;
                    xg.Enabled = false;
                    sc.Enabled = false;
                    AddRow.Enabled = true;
                    DelRow.Enabled = true;
                    bc.Enabled = true;
@@ -405,10 +415,7 @@
                    break;
                case DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify:
                    //修改状态
                    yl.Enabled = false;
                    xz.Enabled = false;
                    xg.Enabled = false;
                    sc.Enabled = false;
                    AddRow.Enabled = true;
                    DelRow.Enabled = true;
                    bc.Enabled = true;
@@ -445,48 +452,10 @@
            this.txtHStdWorkTimes.Text = dr["标准工时"].ToString();
            this.txtHUpperlimit.Text = dr["上线比例"].ToString();
            this.txtHLowerlimit.Text = dr["下线比例"].ToString();
            this.txtHStdPiece.Text = dr["标准计件"].ToString();
            this.txtHStdPric.Text = dr["标准计价"].ToString();
            //加载表体
            //initGrid();
            //int i = 0;
            //foreach (Model.ClsGy_StdWorkTimes_Model oSub in BillNew.DetailColl)
            //{
            //    //
            //    if (i >= grdMain1.RowCount - 1)
            //        grdMain1.Rows.Add();
            //    grdMain1.Rows[i].Cells[HTagCol].Value = "*";
            //    grdMain1.Rows[i].Cells[HMaterIDCol].Value = oSub.HMaterID.ToString();
            //    if (oMater.GetInfoByID(oSub.HMaterID))
            //    {
            //        grdMain1.Rows[i].Cells[HMaterNumberCol].Value = oMater.omodel.HNumber;
            //        grdMain1.Rows[i].Cells[HMaterNameCol].Value = oMater.omodel.HName;
            //        grdMain1.Rows[i].Cells[HMaterModelCol].Value = oMater.omodel.HModel;
            //    }
            //    else
            //    {
            //        grdMain1.Rows[i].Cells[HMaterNumberCol].Value = "";
            //        grdMain1.Rows[i].Cells[HMaterNameCol].Value = "";
            //        grdMain1.Rows[i].Cells[HMaterModelCol].Value = "";
            //    }
            //    grdMain1.Rows[i].Cells[HProcIDCol].Value = oSub.HProcID.ToString();
            //    if (oProc.GetInfoByID(oSub.HProcID))
            //    {
            //        grdMain1.Rows[i].Cells[HProcNumberCol].Value = oProc.omodel.HNumber;
            //        grdMain1.Rows[i].Cells[HProcNameCol].Value = oProc.omodel.HName;
            //    }
            //    else
            //    {
            //        grdMain1.Rows[i].Cells[HProcNumberCol].Value = "";
            //        grdMain1.Rows[i].Cells[HProcNameCol].Value = "";
            //    }
            //    grdMain1.Rows[i].Cells[HStdWorkTimes].Value = oSub.HStdWorkTimes.ToString();
            //    grdMain1.Rows[i].Cells[HUpperlimit].Value = oSub.HUpperlimit.ToString();
            //    grdMain1.Rows[i].Cells[HLowerlimit].Value = oSub.HLowerlimit.ToString();
            //    grdMain1.Rows[i].Cells[HUSEORGID].Value = oSub.HUSEORGID.ToString();
            //    grdMain1.Rows[i].Cells[HRemarkCol].Value = oSub.HRemark;
            //    i = i + 1;
            //}
            //GRID允许刷新
            DBUtility.Xt_BaseBillFun.SetSumGrid(oSumGrid);
            //合计
@@ -544,7 +513,7 @@
            {
                if (DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HMaterIDCol].Value) != 0 && DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HProcIDCol].Value) != 0)
                {
                    if (DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HStdWorkTimes].Value)>0&& DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HUpperlimit].Value) > 0&& DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HLowerlimit].Value) > 0)
                    if (DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HStdWorkTimes].Value)>0&& DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HUpperlimit].Value) > 0&& DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HLowerlimit].Value) > 0 && DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HStdPiece].Value) > 0 && DBUtility.ClsPub.isLong(grdMain1.Rows[i].Cells[HStdPric].Value) > 0)
                    {
                        Model.ClsGy_StdWorkTimes_Model oSub = new Model.ClsGy_StdWorkTimes_Model();
                        oSub.HMaterID = ClsPub.isLong(grdMain1.Rows[i].Cells[HMaterIDCol].Value);
@@ -552,6 +521,8 @@
                        oSub.HStdWorkTimes = ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdWorkTimes].Value);
                        oSub.HUpperlimit = ClsPub.isDoule(grdMain1.Rows[i].Cells[HUpperlimit].Value);
                        oSub.HLowerlimit = ClsPub.isDoule(grdMain1.Rows[i].Cells[HLowerlimit].Value);
                        oSub.HStdPiece = ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdPiece].Value);
                        oSub.HStdPric = ClsPub.isDoule(grdMain1.Rows[i].Cells[HStdPric].Value);
                        oSub.HUSEORGID = ClsPub.HOrgID;
                        oSub.HStopflag = false;
                        oSub.HMaker = ClsPub.CurUserName;
@@ -561,7 +532,7 @@
                    }
                    else
                    {
                        MessageBox.Show("第" + (i+1) + "行,标准工时,上限比例和下限比例都应大于0", "提示");
                        MessageBox.Show("第" + (i+1) + "行,标准工时,上限比例,下限比例,标准计件和标准计价都应大于0", "提示");
                        return false;
                    }
                }
@@ -632,6 +603,9 @@
            grdMain1.Columns[HStdWorkTimes].HeaderText = "标准工时";
            grdMain1.Columns[HUpperlimit].HeaderText = "上限比例";
            grdMain1.Columns[HLowerlimit].HeaderText = "下限比例";
            grdMain1.Columns[HStdPiece].HeaderText = "标准计件";
            grdMain1.Columns[HStdPric].HeaderText = "标准计价";
            grdMain1.Columns[HUSEORGID].HeaderText = "组织ID";
            grdMain1.Columns[HRemarkCol].HeaderText = "备注";
            //
@@ -646,6 +620,8 @@
                            "," + HStdWorkTimes.ToString() +
                            "," + HUpperlimit.ToString() +
                            "," + HLowerlimit.ToString() +
                            "," + HStdPiece.ToString() +
                            "," + HStdPric.ToString() +
                            "," + HRemarkCol.ToString();
            //合计列
            string sTotalCol = "";