From 096f0a528fc003ad60d50155af11a40d14b9f0d9 Mon Sep 17 00:00:00 2001
From: yangle <admin@YINMOU>
Date: 星期二, 12 十二月 2023 13:34:14 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 PlanM/计划管理/Gy_RoutingBill.cs |  224 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 210 insertions(+), 14 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 5ee8641..9d76bd3 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"
@@ -82,20 +82,27 @@
         public const Int16 HSumPassRateCol = 52;
         public const Int16 HRemarkCol = 53;
 
-        public const Int16 HSourceInterIDCol = 53;
-        public const Int16 HSourceEntryIDCol = 54;
-        public const Int16 HSourceBillNoCol = 55;
-        public const Int16 HSourceBillTypeCol = 56;
-        public const Int16 HRelationQtyCol = 57;
-        public const Int16 HRelationMoneyCol = 58;
-        public const Int16 HTechnologyParameterCol = 59;
-        public const Int16 HPicNumCol = 60;
-        public const Int16 HProcCheckNoteCol = 61;
-        public const Int16 HProcWorkNumCol = 62;
+        public const Int16 HSourceInterIDCol = 54;
+        public const Int16 HSourceEntryIDCol = 55;
+        public const Int16 HSourceBillNoCol = 56;
+        public const Int16 HSourceBillTypeCol = 57;
+        public const Int16 HRelationQtyCol = 58;
+        public const Int16 HRelationMoneyCol = 59;
+        public const Int16 HTechnologyParameterCol = 60;
+        public const Int16 HPicNumCol = 61;
+        public const Int16 HProcCheckNoteCol = 62;
+        public const Int16 HProcWorkNumCol = 63;
+        public const Int16 HWorkTimes_SCol = 64;
 
         //
         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 +111,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 +170,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 +279,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 +311,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,8 +378,22 @@
         //瀹℃牳鍗曟嵁
         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;
                 txtHChecker.Text = ClsPub.CurUserName;
                 txtHCheckDate.Text = BillOld.omodel.HCheckDate;
@@ -341,6 +407,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 +433,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 +459,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 +485,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 +511,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 +757,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 +983,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)
@@ -972,6 +1112,7 @@
                 grdMain.Rows[i].Cells[HPassRateCol].Value = oSub.HPassRate.ToString();
                 grdMain.Rows[i].Cells[HSumPassRateCol].Value = oSub.HSumPassRate.ToString();
                 grdMain.Rows[i].Cells[HOverRateCol].Value = oSub.HOverRate.ToString();
+                grdMain.Rows[i].Cells[HWorkTimes_SCol].Value = oSub.HWorkTimes_S.ToString();
                 //涓嬮亾娴佽浆宸ュ簭
                 grdMain.Rows[i].Cells[HNextProcFlagCol].Value = DBUtility.ClsPub.isBool(oSub.HNextProcFlag);
                 grdMain.Rows[i].Cells[HFlowProcCol].Value = DBUtility.ClsPub.isBool(oSub.HFlowProc);
@@ -997,6 +1138,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 +1208,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 +1255,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>();
@@ -1169,6 +1353,7 @@
                     oSub.HStdFlag = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HStdFlagCol].Value);
                     oSub.HAutoTrunFlag = DBUtility.ClsPub.isBool(grdMain.Rows[i].Cells[HAutoTrunFlagCol].Value);
                     oSub.HProcType = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcTypeCol].Value);
+                    oSub.HWorkTimes_S = DBUtility.ClsPub.isDoule(grdMain.Rows[i].Cells[HWorkTimes_SCol].Value);
 
                     oSub.HProcWorkNum = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HProcWorkNumCol].Value);
                     if (DBUtility.ClsPub.isSingle(grdMain.Rows[i].Cells[HPassRateCol].Value) > 0)
@@ -1243,7 +1428,7 @@
         private void initGrid()
         {
             //
-            grdMain.ColumnCount = 63;                       //鎬诲垪鏁�
+            grdMain.ColumnCount = 65;                       //鎬诲垪鏁�
             DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name);
             //
             grdMain.RowsDefaultCellStyle.WrapMode = DataGridViewTriState.True;
@@ -1307,6 +1492,7 @@
             grdMain.Columns[HNextProcFlagCol].HeaderText = "涓嬮亾娴佽浆宸ュ簭";
             grdMain.Columns[HFlowProcCol].HeaderText = "娴佽浆宸ュ簭";
             grdMain.Columns[HOverRateCol].HeaderText = "瓒呴姣斾緥";
+            grdMain.Columns[HWorkTimes_SCol].HeaderText = "浜у搧鍗曚欢宸ユ椂";
             ////鍥哄畾璧嬪��=====================================================
             grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             grdMain.Columns[HRemarkCol].HeaderText = "澶囨敞";
@@ -1373,7 +1559,8 @@
                             "," + HRemarkCol.ToString() +
                             "," + HTechnologyParameterCol.ToString() +
                              "," + HPicNumCol.ToString() +
-                             "," + HProcCheckNoteCol.ToString()+
+                             "," + HProcCheckNoteCol.ToString() +
+                             "," + HWorkTimes_SCol.ToString() +
                             "," + HOverRateCol.ToString();
             //璁剧疆鍚堣鍒�
             string sTotalCol = HTimeUnitCol.ToString();
@@ -1418,6 +1605,7 @@
             }
             //
             DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol,oSumGrid);
+            DBUtility.Xt_BaseBillFun.GetGrid(grdMain, this.Name);
             //================== 
             DBUtility.ClsPub.HideGridView(grdMain, Name, ClsPub.AppPath);//璁剧疆闅愯棌鍒�
         }
@@ -1578,6 +1766,8 @@
                                     grdMain.Rows[sRow].Cells[HProcNameCol].Value = oProc.oModel.HName;
                                     grdMain.Rows[sRow].Cells[HTimeUnitCol].Value = "灏忔椂";
                                     grdMain.Rows[sRow].Cells[HUnitTimeCol].Value = "1";
+                                    grdMain.Rows[sRow].Cells[HPassRateCol].Value = "100";
+                                    grdMain.Rows[sRow].Cells[HWorkQtyCol].Value = "1";
                                     if (oProc.GetInfoByID(oProc.oModel.HItemID))
                                     {
                                         grdMain.Rows[sRow].Cells[HProcCheckNoteCol].Value = oProc.omodel.HProcCheckNote.ToString();
@@ -2009,6 +2199,12 @@
                 MessageBox.Show("浣跨敤澶辫触!褰撳墠宸ヨ壓璺嚎涓嶆槸娴忚鐘舵��!");
                 return;
             }
+            //鍒ゆ柇鏉冮檺
+            if (!ClsPub.Security_Log(ModRightNameCheck, 1, true, DBUtility.ClsPub.CurUserName))
+            {
+                return;
+            }
+
             if (BillOld.Sub_RoutingCheckAndUsed(BillOld.omodel.HInterID))
             {
                 MessageBox.Show("浣跨敤鎴愬姛锛�");

--
Gitblit v1.9.1