From 9ae6aa786445d49dc3e93ead5a8ee4b92006304e Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期一, 07 八月 2023 08:08:15 +0800
Subject: [PATCH] 1

---
 PlanM/计划管理/Gy_RoutingBill.cs |  183 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 181 insertions(+), 2 deletions(-)

diff --git "a/PlanM/\350\256\241\345\210\222\347\256\241\347\220\206/Gy_RoutingBill.cs" "b/PlanM/\350\256\241\345\210\222\347\256\241\347\220\206/Gy_RoutingBill.cs"
index 14e6889..98307aa 100644
--- "a/PlanM/\350\256\241\345\210\222\347\256\241\347\220\206/Gy_RoutingBill.cs"
+++ "b/PlanM/\350\256\241\345\210\222\347\256\241\347\220\206/Gy_RoutingBill.cs"
@@ -96,6 +96,12 @@
         //
         public  string ModName = "3301";
         public  string ModCaption = "宸ヨ壓璺嚎";
+        public const string ModRightName = "Gy_RoutingBill";
+        public const string ModRightNameEdit = ModRightName + "_Edit";      //缂栬緫
+        public const string ModRightNameCheck = ModRightName + "_Check";    //瀹℃牳
+        public const string ModRightNameClose = ModRightName + "_Close";    //鍏抽棴
+        public const string ModRightNameDelete = ModRightName + "_Delete";  //浣滃簾
+        public const string ModRightNameDrop = ModRightName + "_Drop";      //鍒犻櫎
         public bool BillChange;   //
         
         public DBUtility.ClsPub.Enum_BillStatus BillStatus;
@@ -104,15 +110,30 @@
         public DAL.ClsGy_RoutingBill BillNew =new  DAL.ClsGy_RoutingBill();
         public DAL.ClsGy_RoutingBill BillOld = new DAL.ClsGy_RoutingBill();
         ClsGridViewSum oSumGrid = new ClsGridViewSum();
+        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+        public string CampanyName = ""; //绯荤粺鍙傛暟 瀹㈡埛
+        public Int64 HOrgID = -1;       //缁勭粐鍐呯爜
         //-------------------------------------------------------------------------
         #region 鍥哄畾浠g爜
 
-         
+
         //娓呯┖鐣岄潰
         public void Sub_ClearBill()
         {
             DBUtility.Xt_BaseBillFun.Sub_ClearBill(gbUp);
-            //
+
+            //鑾峰彇绯荤粺鍙傛暟 瀹㈡埛
+            ClsXt_SystemParameter oClsXt_SystemParameter = new ClsXt_SystemParameter();
+            CampanyName = oClsXt_SystemParameter.GetSingleSystemParameter("WMS_CampanyName", ref DBUtility.ClsPub.sExeReturnInfo);
+
+            //鑾峰彇缁勭粐淇℃伅
+            DataSet Ds1 = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HItemID=" + ClsPub.HOrgID, "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
+            if (Ds1.Tables[0].Rows.Count != 0)
+            {
+                cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds1.Tables[0].Rows[0]["HName"]);
+                cmbHOrgID.Enabled = false;
+            }
+
             txtHMaker.Text = ClsPub.CurUserName;
             txtHMakeDate.Text = "";
             txtHChecker.Text = "";
@@ -148,6 +169,12 @@
         //鍒犻櫎鍗曟嵁
         private void Sub_DeleteBill()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameDrop, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
             string s = "";
             if (BillOld.ShowBill(BillOld.omodel.HInterID, ref s) == false)
             {
@@ -251,6 +278,9 @@
             g.DrawLine(p, new Point(txtHChecker.Left, txtHChecker.Top + txtHChecker.Height), new Point(txtHChecker.Left + txtHChecker.Width, txtHChecker.Top + txtHChecker.Height));
             g.DrawLine(p, new Point(txtHCheckDate.Left, txtHCheckDate.Top + txtHCheckDate.Height), new Point(txtHCheckDate.Left + txtHCheckDate.Width, txtHCheckDate.Top + txtHCheckDate.Height));
             //
+            g.DrawLine(p, new Point(txtHUseMan.Left, txtHUseMan.Top + txtHUseMan.Height), new Point(txtHUseMan.Left + txtHUseMan.Width, txtHUseMan.Top + txtHUseMan.Height));
+            g.DrawLine(p, new Point(txtHUseDate.Left, txtHUseDate.Top + txtHUseDate.Height), new Point(txtHUseDate.Left + txtHUseDate.Width, txtHUseDate.Top + txtHUseDate.Height));
+            //
             g.DrawLine(p, new Point(txtHCloseMan.Left, txtHCloseMan.Top + txtHCloseMan.Height), new Point(txtHCloseMan.Left + txtHCloseMan.Width, txtHCloseMan.Top + txtHCloseMan.Height));
             g.DrawLine(p, new Point(txtHCloseDate.Left, txtHCloseDate.Top + txtHCloseDate.Height), new Point(txtHCloseDate.Left + txtHCloseDate.Width, txtHCloseDate.Top + txtHCloseDate.Height));
             //
@@ -280,7 +310,28 @@
             oSumGrid.oGridsum = grdSum;
             this.Text = ModCaption;
             this.lblCaption.Text = ModCaption;
+            //鍔犺浇缁勭粐淇℃伅
+            Sub_AddOrdList();
         }
+
+        //鍔犺浇缁勭粐淇℃伅
+        private void Sub_AddOrdList()
+        {
+            DataSet ds;
+            DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
+            ds = oClsGy_ORGANIZATIONS_View.GetList();
+            if (ds == null || ds.Tables[0].Rows.Count == 0)
+            {
+                MessageBox.Show("鑾峰彇缁勭粐澶辫触");
+                return;
+            }
+            cmbHOrgID.Items.Clear();
+            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+            {
+                cmbHOrgID.Items.Add(DBUtility.ClsPub.isStrNull(ds.Tables[0].Rows[i]["HName"]));
+            }
+        }
+
         //棣栧紶
         private void Sub_First()
         {
@@ -326,6 +377,17 @@
         //瀹℃牳鍗曟嵁
         private void Sub_CheckBill()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
+            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
+            {
+                MessageBox.Show("鏂板鐘舵�佷笉鍏佽瀹℃牳鍗曟嵁锛岃鍏堜繚瀛樺崟鎹紒", "鎻愮ず");
+            }
+
             if (BillOld.CheckBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
             {
                 BillChange = true;
@@ -341,6 +403,17 @@
         //鍙嶅鍗曟嵁
         private void Sub_AbandonCheck()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
+            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
+            {
+                MessageBox.Show("鏂板鐘舵�佷笉鍏佽鍙嶅鏍稿崟鎹紝璇峰厛淇濆瓨鍗曟嵁锛�", "鎻愮ず");
+            }
+
             if (BillOld.AbandonCheck(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
             {
                 BillChange = true;
@@ -356,6 +429,17 @@
         //鍏抽棴鍗曟嵁
         private void Sub_CloseBill()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameClose, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
+            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
+            {
+                MessageBox.Show("鏂板鐘舵�佷笉鍏佽鍏抽棴鍗曟嵁锛岃鍏堜繚瀛樺崟鎹紒", "鎻愮ず");
+            }
+
             if (BillOld.CloseBill(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
             {
                 BillChange = true;
@@ -371,6 +455,17 @@
         //鍙嶅叧闂崟鎹�
         private void Sub_Cancel()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameClose, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
+            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
+            {
+                MessageBox.Show("鏂板鐘舵�佷笉鍏佽鍙嶅叧闂崟鎹紝璇峰厛淇濆瓨鍗曟嵁锛�", "鎻愮ず");
+            }
+
             if (BillOld.CancelClose(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
             {
                 BillChange = true;
@@ -386,6 +481,17 @@
         //浣滃簾鍗曟嵁
         private void Sub_Cancelltion()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
+            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
+            {
+                MessageBox.Show("鏂板鐘舵�佷笉鍏佽浣滃簾鍗曟嵁锛岃鍏堜繚瀛樺崟鎹紒", "鎻愮ず");
+            }
+
             if (BillOld.Cancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
             {
                 BillChange = true;
@@ -401,6 +507,17 @@
         //鍙嶄綔搴�
         private void Sub_AbandonCancelltion()
         {
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
+            if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew)
+            {
+                MessageBox.Show("鏂板鐘舵�佷笉鍏佽鍙嶄綔搴熷崟鎹紝璇峰厛淇濆瓨鍗曟嵁锛�", "鎻愮ず");
+            }
+
             if (BillOld.AbandonCancelltion(BillOld.omodel.HInterID, ref ClsPub.sExeReturnInfo) == true)
             {
                 BillChange = true;
@@ -636,6 +753,18 @@
                         pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Closed.jpg");
                         //
                     }
+                    if (txtHCloseMan.Text.Trim() != "")
+                    {
+                        sh.Enabled = false;
+                        qsh.Enabled = false;
+                        //gb.Enabled = false;
+                        //hf.Enabled = true;
+                        xg.Enabled = false;
+                        sc.Enabled = false;
+                        //
+                        pic1.Visible = true;
+                        pic1.Image = System.Drawing.Image.FromFile(ClsPub.AppPath + @"/Pic/Closed.jpg");
+                    }
                     if (txtHDeleteMan.Text.Trim() == "")
                     {
                         //zf.Enabled = true;
@@ -850,6 +979,13 @@
             this.textHProductNum.Text = BillOld.omodel.HProductNum.ToString();
             this.textHVerNum.Text = BillOld.omodel.HVerNum.ToString();
 
+            //鑾峰彇缁勭粐淇℃伅
+            DataSet Ds1 = oCn.RunProcReturn("select * from Xt_ORGANIZATIONS with(nolock) where HItemID=" + BillOld.omodel.HORGID.ToString(), "Xt_ORGANIZATIONS", ref DBUtility.ClsPub.sExeReturnInfo);
+            if (Ds1.Tables[0].Rows.Count != 0)
+            {
+                cmbHOrgID.Text = DBUtility.ClsPub.isStrNull(Ds1.Tables[0].Rows[0]["HName"]);
+            }
+
             //鍔犺浇琛ㄤ綋
             int i = 0;
             foreach (Model.ClsGy_RoutingBillSub oSub in BillOld.DetailColl)
@@ -997,6 +1133,35 @@
                 MessageBox.Show("鍗曚綅娌℃湁閫夋嫨锛�", "鎻愮ず");
                 return false;
             }
+            if (CampanyName == "鍑礉濂堢壒") //绯荤粺鍙傛暟 瀹㈡埛
+            {
+                if (DBUtility.ClsPub.isStrNull(textHPicNumVer.Text) == "")
+                {
+                    MessageBox.Show("鍥惧彿鐗堟湰娌℃湁褰曞叆锛�", "鎻愮ず");
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(textHPicNumAssemble.Text) == "")
+                {
+                    MessageBox.Show("鎬昏鍥惧彿娌℃湁褰曞叆锛�", "鎻愮ず");
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(textHMaterTexture.Text) == "")
+                {
+                    MessageBox.Show("鏉愯川娌℃湁褰曞叆锛�", "鎻愮ず");
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(textHProductNum.Text) == "")
+                {
+                    MessageBox.Show("鎴愬搧缂栧彿娌℃湁褰曞叆锛�", "鎻愮ず");
+                    return false;
+                }
+                if (DBUtility.ClsPub.isStrNull(textHVerNum.Text) == "")
+                {
+                    MessageBox.Show("鐗堟湰娌℃湁褰曞叆锛�", "鎻愮ず");
+                    return false;
+                }
+            }
+
             //鍗曟嵁鍙锋槸鍚﹂噸澶�
             if (BillNew.IsExistBillNo(ref ClsPub.sExeReturnInfo, txtHBillNo.Text.Trim(), BillStatus, BillOld.omodel.HInterID))
             {
@@ -1038,6 +1203,19 @@
             lblCaption.Focus();
             if (!Sub_AllowSave())//鍗曟嵁瀹屾暣鎬у垽鏂�
                 return false;
+
+            // 鑾峰彇缁勭粐鍐呯爜
+            DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
+            if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text))
+            {
+                HOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID;
+            }
+            if (HOrgID == -1)
+            {
+                MessageBox.Show("閫夋嫨缁勭粐鏈夐敊璇紒");
+                return false;
+            }
+
             //璧嬪�糏D
             if (BillStatus ==DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
                 BillNew.omodel.HInterID = BillOld.omodel.HInterID;
@@ -1072,6 +1250,7 @@
             BillNew.omodel.HMaterTexture = ClsPub.isStrNull(this.textHMaterTexture.Text);
             BillNew.omodel.HProductNum = ClsPub.isStrNull(this.textHProductNum.Text);
             BillNew.omodel.HVerNum = ClsPub.isStrNull(this.textHVerNum.Text);
+            BillNew.omodel.HORGID = HOrgID;
 
             //鏄庣粏绫昏祴鍊�
             BillNew.DetailColl=new List<Model.ClsGy_RoutingBillSub>();

--
Gitblit v1.9.1