From 16bb2f7b48cf2c3cfbb6a026c265d4e52d22eca4 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期六, 29 十月 2022 17:11:14 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 BaseSet/公用资料/其他基础资料/Gy_StdWorkTimesList.cs |  201 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 133 insertions(+), 68 deletions(-)

diff --git "a/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimesList.cs" "b/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimesList.cs"
index 5c8a9e7..50433e7 100644
--- "a/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimesList.cs"
+++ "b/BaseSet/\345\205\254\347\224\250\350\265\204\346\226\231/\345\205\266\344\273\226\345\237\272\347\241\200\350\265\204\346\226\231/Gy_StdWorkTimesList.cs"
@@ -7,7 +7,7 @@
 using System.Text;
 using System.Windows.Forms;
 
-namespace BaseSet.鍏敤璧勬枡.鍏朵粬鍩虹璧勬枡
+namespace BaseSet
 {
     public partial class Gy_StdWorkTimesList : Form
     {
@@ -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;
@@ -265,9 +263,9 @@
                 sr = CurNode.Text.Split(c);
                 HParentID = sr[0].ToString();
             }
-            //杩囨护鏉′欢
-            if (frmCondition.SqlStr.Trim().Length == 0)
+            if (frmCondition==null)
             {
+                //杩囨护鏉′欢
                 if (HParentID == "" || HParentID == "鐗╂枡璧勬枡" || HParentID == "宸ュ簭璧勬枡")
                 {
                     sSql = "Select top 10000 * from " + ViewName + " order by  HItemID Desc";
@@ -276,7 +274,7 @@
                 {
                     if (wl.Checked == false)
                     {
-                        sSql = "Select top 10000 * from " + ViewName + " where 宸ュ簭浠g爜 like '%" + HParentID.ToString() + "%' order by HItemID Desc" ;
+                        sSql = "Select top 10000 * from " + ViewName + " where 宸ュ簭浠g爜 like '%" + HParentID.ToString() + "%' order by HItemID Desc";
                     }
                     else
                     {
@@ -287,8 +285,9 @@
             }
             else
             {
-                sSql = frmCondition.SqlStr + sWhere + " order by  HItemID Desc";
-            }
+                sSql = frmCondition.SqlStr + sWhere + " order by " + ModName;
+            } 
+            
             //鎵цSQL
             DSet = SubCn.RunProcReturn(sSql, ViewName);
 
@@ -310,12 +309,12 @@
             oSumGrid.BuildTotalCols(sT);
             //  
             //鍐荤粨
-            int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
-            string s = frmCondition.cmbHComplete.Text;
-            DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
+            //int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
+            //string s = frmCondition.cmbHComplete.Text;
+            //DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
             //鐢荤嚎
             //
-            Total();
+            //Total();
         }
 
         //鍚堣 new
@@ -395,27 +394,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("瀹℃牳澶辫触!", "鎻愮ず");
+                        return;
+                    }
                 }
             }
-            MessageBox.Show("瀹℃牳鎴愬姛锛岃鍒锋柊锛�", "鎻愮ず");
+            MessageBox.Show("瀹℃牳鎴愬姛!", "鎻愮ず");
+            Display();
             return;
         }
         //鍙嶅鏍�
@@ -435,34 +431,103 @@
                 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("鍙嶅鏍稿け璐�!", "鎻愮ず");
+                        return;
+                    }
                 }
             }
-            MessageBox.Show("瀹℃牳鎴愬姛锛岃鍒锋柊锛�", "鎻愮ず");
+            MessageBox.Show("鍙嶅鏍告垚鍔�!", "鎻愮ず");
+            Display();
             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("绂佺敤鎴愬姛锛�", "鎻愮ず");
+            Display();
+            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("鍙嶇鐢ㄦ垚鍔燂紒", "鎻愮ず");
+            Display();
+            return;
+        }
+
+        //瀵煎嚭
+        private void dc_Click(object sender, EventArgs e)
+        {
+            DBUtility.Gy_BaseFun.DataToExcel(this.Text, grdMain);
+        }
     }
 }

--
Gitblit v1.9.1