zzr99
2022-04-21 0391bddfdda8f0b45a66d13f07ae87c0537a02c7
BaseSet/¹«ÓÃ×ÊÁÏ/ÆäËû»ù´¡×ÊÁÏ/Gy_StdWorkTimesList.cs
@@ -118,40 +118,45 @@
        //删除项目
        public void Delete()
        {
            Int64 lngBillKey = 0;
            if (grdMain.SelectedRows.Count == 0)
            {
                MessageBox.Show("请至少选择一行!", "提示");
                return;
            }
            //删除权限
            if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, true, DBUtility.ClsPub.CurUserName))
            {
                return;
            }
            //
            if (AllowRow())
            {
                if (MessageBox.Show("确定要删除当前项目?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    //得到HITEMID
                    long sItemID;
                    sItemID = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentCell.RowIndex].Cells[HItemIDCol].Value);
                    //判断存在性
                    if (oMatePrce.ShowBill(sItemID, ref DBUtility.ClsPub.sExeReturnInfo))
                    oCn.BeginTran();
                    for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
                    {
                        foreach (Model.ClsGy_StdWorkTimes_Model oSub in oMatePrce.DetailColl)
                        lngBillKey = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HItemID")].Value);
                        if (lngBillKey == 0)
                            return;
                        DAL.ClsGy_StdWorkTimes_Ctl oItem = new DAL.ClsGy_StdWorkTimes_Ctl();
                        //审核
                        //查看是否已审核,关闭,作废
                        DataSet DsSub = oCn.RunProcReturn("Select * from Gy_StdWorkTimes Where HitemID=" + lngBillKey.ToString(), "Gy_StdWorkTimes");
                        if (!string.IsNullOrEmpty(DsSub.Tables[0].Rows[0]["HChecker"].ToString()))
                        {
                            if (oSub.HChecker.Trim() != "")
                            {
                                MessageBox.Show("单据已审核!不能删除", "提示");
                                return;
                            }
                        }
                        if (oMatePrce.DeleteByID(sItemID))
                        {
                            MessageBox.Show("删除项目成功!", "提示");
                            Display();
                            oCn.RollBack();
                            MessageBox.Show("标准工时:"+ DsSub.Tables[0].Rows[0]["HStdWorkTimes"].ToString() + "的单据已审核,无法删除", "提示");
                            return;
                        }
                        else
                            MessageBox.Show("删除项目成功!", "提示");
                        {
                            oCn.RunProc(" delete Gy_StdWorkTimes where HItemID=" + lngBillKey.ToString());
                        }
                    }
                    oCn.Commit();
                    MessageBox.Show("删除成功,请刷新!", "提示");
                    return;
                }
            }
@@ -181,14 +186,7 @@
            if (oBillMain.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
            {
                oFrm = new Gy_StdWorkTimes();
                oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                foreach (Model.ClsGy_StdWorkTimes_Model oSub in oBillMain.DetailColl)
                {
                    if (oSub.HChecker.Trim() != "")
                    {
                        oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
                    }
                }
                oBill.HItemID = lngBillKey;
                oFrm.BillOld = oBill;
                oFrm.BillNew = oBillMain;
@@ -388,24 +386,24 @@
                DAL.ClsGy_StdWorkTimes_Ctl oItem = new DAL.ClsGy_StdWorkTimes_Ctl();
                //审核
                //查看是否已审核,关闭,作废
                if (oItem.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                DataSet DsSub = oCn.RunProcReturn("Select * from Gy_StdWorkTimes Where HitemID=" + lngBillKey.ToString(), "Gy_StdWorkTimes");
                if (!string.IsNullOrEmpty(DsSub.Tables[0].Rows[0]["HChecker"].ToString()))
                {
                    MessageBox.Show("单据已审核,无需审核", "提示");
                    return;
                }
                else
                {
                    MessageBox.Show("项目不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                    return;
                }
                //审核
                if (oItem.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                {
                    MessageBox.Show("审核成功!第"+i.ToString()+"行", "提示");
                }
                else
                {
                    MessageBox.Show("审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                    return;
                    //审核
                    if (oItem.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        MessageBox.Show("审核成功!", "提示");
                    }
                    else
                    {
                        MessageBox.Show("审核失败!", "提示");
                        return;
                    }
                }
            }
            MessageBox.Show("审核成功,请刷新!", "提示");
@@ -428,34 +426,96 @@
                DAL.ClsGy_StdWorkTimes_Ctl oItem = new DAL.ClsGy_StdWorkTimes_Ctl();
                //审核
                //查看是否已审核,关闭,作废
                if (oItem.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
                DataSet DsSub = oCn.RunProcReturn("Select * from Gy_StdWorkTimes Where HitemID=" + lngBillKey.ToString(), "Gy_StdWorkTimes");
                if (string.IsNullOrEmpty(DsSub.Tables[0].Rows[0]["HChecker"].ToString()))
                {
                    MessageBox.Show("单据未审核,无需反审核", "提示");
                    return;
                }
                else
                {
                    MessageBox.Show("项目不存在!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                    return;
                }
                //审核
                if (oItem.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                {
                    MessageBox.Show("审核成功!第"+i.ToString()+"行", "提示");
                }
                else
                {
                    MessageBox.Show("审核失败!原因:" + DBUtility.ClsPub.sExeReturnInfo, "提示");
                    return;
                    //审核
                    if (oItem.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
                    {
                        MessageBox.Show("审核成功!", "提示");
                    }
                    else
                    {
                        MessageBox.Show("审核失败!", "提示");
                        return;
                    }
                }
            }
            MessageBox.Show("审核成功,请刷新!", "提示");
            return;
        }
        //考贝
        private void yl_Click(object sender, EventArgs e)
        {
            DBUtility.Gy_BaseFun.DataToExcel(this.Text, grdMain);
        }
        private void jy_Click(object sender, EventArgs e)
        {
            Int64 lngBillKey = 0;
            if (grdMain.SelectedRows.Count == 0)
            {
                MessageBox.Show("请至少选择一行!", "提示");
                return;
            }
            for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
            {
                lngBillKey = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HItemID")].Value);
                if (lngBillKey == 0)
                    return;
                DAL.ClsGy_StdWorkTimes_Ctl oItem = new DAL.ClsGy_StdWorkTimes_Ctl();
                //审核
                //查看是否已审核,关闭,作废
                DataSet DsSub = oCn.RunProcReturn("Select * from Gy_StdWorkTimes Where HitemID=" + lngBillKey.ToString(), "Gy_StdWorkTimes");
                if (DsSub.Tables[0].Rows[0]["HStopflag"].ToString() == "1")
                {
                    MessageBox.Show("单据已禁用,无需禁用" , "提示");
                    return;
                }
                else
                {
                    oCn.RunProc(" Update Gy_StdWorkTimes set HStopflag=1 Where HItemID=" + lngBillKey.ToString());
                }
            }
            MessageBox.Show("禁用成功,请刷新!", "提示");
            return;
        }
        private void fjy_Click(object sender, EventArgs e)
        {
            Int64 lngBillKey = 0;
            if (grdMain.SelectedRows.Count == 0)
            {
                MessageBox.Show("请至少选择一行!", "提示");
                return;
            }
            for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
            {
                lngBillKey = DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HItemID")].Value);
                if (lngBillKey == 0)
                    return;
                DAL.ClsGy_StdWorkTimes_Ctl oItem = new DAL.ClsGy_StdWorkTimes_Ctl();
                //审核
                //查看是否已审核,关闭,作废
                DataSet DsSub = oCn.RunProcReturn("Select * from Gy_StdWorkTimes Where HitemID=" + lngBillKey.ToString(), "Gy_StdWorkTimes");
                if (DsSub.Tables[0].Rows[0]["HStopflag"].ToString() == "0")
                {
                    MessageBox.Show("单据暂未禁用,无需反禁用", "提示");
                    return;
                }
                else
                {
                    oCn.RunProc(" Update Gy_StdWorkTimes set HStopflag=0 Where HItemID=" + lngBillKey.ToString());
                }
            }
            MessageBox.Show("审核成功,请刷新!", "提示");
            return;
        }
    }
}