From 681c617b48ddbc556fdbe6a251161a3b9584adab Mon Sep 17 00:00:00 2001
From: YL <YL@LAPTOP-SE03PLUR>
Date: 星期三, 19 一月 2022 21:55:51 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WarM/报表分析/Kf_ICInventory_BarCode.cs |  768 ++++++++++++++++------------------------------------------
 1 files changed, 220 insertions(+), 548 deletions(-)

diff --git "a/WarM/\346\212\245\350\241\250\345\210\206\346\236\220/Kf_ICInventory_BarCode.cs" "b/WarM/\346\212\245\350\241\250\345\210\206\346\236\220/Kf_ICInventory_BarCode.cs"
index 9ffb714..55b3f29 100644
--- "a/WarM/\346\212\245\350\241\250\345\210\206\346\236\220/Kf_ICInventory_BarCode.cs"
+++ "b/WarM/\346\212\245\350\241\250\345\210\206\346\236\220/Kf_ICInventory_BarCode.cs"
@@ -23,25 +23,140 @@
         public string ViewName = "h_v_KF_ICInventoryList_WMS";
         public string ModCaption = "鏉$爜搴撳瓨鏌ヨ";
         public const string ModName = "3302";
-        public const string ModRightName = "Gy_BarCodeBillList";
-        //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 ModRightNamePrint = ModRightName + "_Print";
-        //DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
-        //public  Gy_ICBomBill oFrm;
         public string sDlgWhere = "";  //澶栫獥浣撻�掑叆
         public int selectRow = 0;
         Pub_Class.ClsGridListSum oSumGrid = new Pub_Class.ClsGridListSum();
-        //
+
+
+        #region  鍥哄畾浠g爜
+
+        private void Kf_ICInventory_BarCode_Load(object sender, EventArgs e)
+        {
+            frmCondition = new frmBillQueryCondition_New();
+            this.Text = ModCaption;
+            oSumGrid.ogrdMain = grdMain;  //鍒濆鍖� new
+            oSumGrid.oGridsum = grdSum;
+            lblCaption.Text = ModCaption;
+            initGrid();
+        }
+
         private void initGrid()
         {
-            DBUtility.Xt_BaseBillFun.initGridList(grdMain,this.Name);
-
+            DBUtility.Xt_BaseBillFun.initGridList(grdMain, this.Name);
             grdMain.ReadOnly = false;
         }
-        //
+
+        private void timer1_Tick(object sender, EventArgs e)
+        {
+            timer1.Enabled = false;
+            initGrid();
+        }
+
+        private void timer2_Tick(object sender, EventArgs e)
+        {
+            timer2.Enabled = false;
+            if (sDlgWhere == "")
+            {
+            }
+            else
+            {
+                timer1.Enabled = true;
+            }
+        }
+
+        private void grdMain_Paint(object sender, PaintEventArgs e)
+        {
+            GraphicsGrid();
+        }
+
+        private void GraphicsGrid()
+        {
+            DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
+        }
+
+        //鍚堣 new
+        private void grdMain_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
+        {
+            Total();
+        }
+
+        //鍚堣 new
+        private void grdMain_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
+        {
+            Total();
+        }
+
+        //鍚堣 new
+        private void Total()
+        {
+            if (grdMain.Rows.Count > 0 && grdMain.ColumnCount > 0)
+            {
+                oSumGrid.SetGridsum();
+                oSumGrid.Total();
+            }
+        }
+
+        private void GraphLine()
+        {
+            //int MainIDCol = Fun_GetCol("hmainid");
+            //int SubIDCol = Fun_GetCol("hsubid");
+            //string s = frmCondition.cmbHComplete.Text;
+            //long n=0;
+            //DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s,ref n);
+            ////鏄剧ず
+            //lbldj.Text = "鏌ヨ鍑� " + n.ToString() + " 寮犲崟鎹�";
+            //lbljl.Text = "鍏辨湁 " + grdMain.RowCount.ToString() + " 鏉¤褰�";
+        }
+
+        private Int32 Fun_GetCol(string sCol)
+        {
+            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
+        }
+
+        private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
+        {
+            int sHQtyCol = Fun_GetCol("鏁伴噺");
+            int i = grdMain.CurrentCell.ColumnIndex;
+            if (i != sHQtyCol)
+            {
+                e.Cancel = true;
+            }
+        }
+
+        //淇濆瓨鍒楀
+        private void bclk_Click(object sender, EventArgs e)
+        {
+            DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
+        }
+
+        //榛樿鍒楀
+        private void mrlk_Click(object sender, EventArgs e)
+        {
+            DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
+        }
+
+        #endregion
+
+        #region  鏌ヨ鍔熻兘
+
+        //鏌ヨ
+        private void cx_Click(object sender, EventArgs e)
+        {
+            frmCondition = new frmBillQueryCondition_New();
+            SetCondition(frmCondition, ViewName, this.Name);
+            frmCondition.ShowDialog();
+            if (frmCondition.Tag.ToString() == "OK")
+            {
+                Display();
+            }
+        }
+
+        public void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name)
+        {
+            frmCondition.Tag = "";
+            frmCondition.ViewName = ViewName;
+            frmCondition.ModName = Name;
+        }
 
         private void Display()
         {
@@ -79,551 +194,26 @@
             //鍐荤粨
             int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
             string s = frmCondition.cmbHComplete.Text;
-            DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s,FrCol);
+            DBUtility.Xt_BaseBillFun.DisplayGrid(grdMain, this.Name, s, FrCol);
             //鐢荤嚎
             GraphLine();
 
-
             Total();
-            // 
-        }
-        //
-        private void timer1_Tick(object sender, EventArgs e)
-        {
-            timer1.Enabled = false;
-            initGrid();
-            //Sub_FastQuery();
-        }
-
-        private void tc_Click(object sender, EventArgs e)
-        {
-            this.Close();
-        }
-
-        private void sx_Click(object sender, EventArgs e)
-        {
-            timer1.Enabled = true;
-        }
-
-        private void dj_Click(object sender, EventArgs e)
-        {
-            Sub_ShowBill();
-        }
-        //鏄剧ず鍗曟嵁
-        private void Sub_ShowBill()
-        {
-            //Int64 lngBillKey = 0;
-            //if (grdMain.CurrentRow == null)
-            //    return;
-            //lngBillKey =DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
-            //if (lngBillKey == 0)
-            //    return;
-            //DAL.ClsGy_ICBomBill oBill = new DAL.ClsGy_ICBomBill();
-            //if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
-            //{
-            //    oFrm = new Gy_ICBomBill();
-            //    oFrm.BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_View;
-            //    oFrm.BillOld = oBill;
-            //    oFrm.ShowDialog();
-            //    if (oFrm.BillChange)
-            //    {
-            //        if (MessageBox.Show("鍗曟嵁鍒楄〃宸茬粡鍙戠敓鍙樺寲,鏄惁鍒锋柊", "鎻愮ず", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
-            //        {
-            //            timer1.Enabled = true;
-            //        }
-            //    }
-            //}
-            //else 
-            //{
-            //    MessageBox.Show("鍗曟嵁鏈壘鍒�", "鎻愮ず");
-            //}
-            //oBill = null;
-        }
-        //
-        private Int32 Fun_GetCol(string sCol)
-        {
-            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain);
-        }
-        //
-        private void Kf_ICInventory_BarCode_Load(object sender, EventArgs e)
-        {
-            //
-            frmCondition = new frmBillQueryCondition_New();
-            this.Text = ModCaption;
-            oSumGrid.ogrdMain = grdMain;  //鍒濆鍖� new
-            oSumGrid.oGridsum = grdSum;
-            lblCaption.Text = ModCaption;
-            initGrid();
-            //鍒濆鍖栧揩閫熻繃婊�
-            //dtpHBDate.Checked = false;
-            //dtpHEDate.Checked = false;
-            cmbHStatus.SelectedIndex = 0;
-        }
-
-        private void grdMain_DblClick(object sender, EventArgs e)
-        {
-            Sub_ShowBill();
-        }
-
-        private void cx_Click(object sender, EventArgs e)
-        {
-            frmCondition = new frmBillQueryCondition_New();
-            SetCondition(frmCondition, ViewName, this.Name);
-            frmCondition.ShowDialog();
-            if (frmCondition.Tag.ToString() == "OK")
-            {
-                Display();
-                //Sub_FastQuery();
-            }
-        }
-
-        public void SetCondition(frmBillQueryCondition_New frmCondition, string ViewName, string Name)
-        {
-            frmCondition.Tag = "";
-            frmCondition.ViewName = ViewName;
-            frmCondition.ModName = Name;
-        }
-
-        private void xz_Click(object sender, EventArgs e)
-        {
-            //
-            //oFrm = new Gy_ICBomBill();
-            //oFrm.ShowDialog();
-        }
-
-        private void sc_Click(object sender, EventArgs e)
-        {
-            Sub_DeleteBill();
-        }
-        //鍒犻櫎
-        private void Sub_DeleteBill()
-        {
-        //    //缂栬緫鏉冮檺
-        //    if (!DBUtility.ClsPub.Security_Log(ModRightNameEdit, 1, true,DBUtility.ClsPub.CurUserName))
-        //    {
-        //        return;
-        //    }
-        //    //
-        //    Int64 lngBillKey = 0;
-        //    if (grdMain.CurrentRow == null)
-        //        return;
-        //    lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
-        //    if (lngBillKey == 0)
-        //        return;
-        //    DAL.ClsGy_ICBomBill  oBill = new DAL.ClsGy_ICBomBill();
-        //    if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
-        //    {
-        //        if (MessageBox.Show("纭畾瑕佸垹闄ゅ綋鍓嶅崟鎹紵", "鎻愮ず", MessageBoxButtons.OKCancel)==DialogResult.OK)
-        //        {
-        //            if (oBill.omodel.HChecker != "")
-        //            {
-        //                MessageBox.Show("鍗曟嵁宸茬粡瀹℃牳,涓嶈兘鍒犻櫎锛�", "鎻愮ず");
-        //                return;
-        //            }
-        //            if (!oBill.DeleteBill(oBill.omodel.HInterID, ref DBUtility.ClsPub.sExeReturnInfo))
-        //            {
-        //                MessageBox.Show(DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず");
-        //                return;
-        //            }
-        //            else
-        //            {
-        //                Display();
-        //            }
-
-        //        }
-        //    }
-        //    else
-        //    {
-        //        MessageBox.Show("鍗曟嵁鏈壘鍒�", "鎻愮ず");
-        //    }
-        }
-
-        private void timer2_Tick(object sender, EventArgs e)
-        {
-            timer2.Enabled = false;
-            if (sDlgWhere == "")
-            {
-                //frmCondition = new frmBillQueryCondition_New();
-                //SetCondition(frmCondition, ViewName, this.Name);
-                //frmCondition.ShowDialog();
-                //if (frmCondition.Tag.ToString() == "OK")
-                //{
-                //    timer1.Enabled = true;
-                //}
-                //Sub_FastQuery();
-            }
-            else
-            {
-                timer1.Enabled = true;
-            }
-        }
-
- 
-
-        private void bclk_Click(object sender, EventArgs e)
-        {
-            //淇濆瓨鍒楀
-            DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
-        }
-
-        private void mrlk_Click(object sender, EventArgs e)
-        {
-            DBUtility.Xt_BaseBillFun.DefaultGridView(grdMain, this.Name);
-        }
-        // 
-        private void GraphLine()
-        {
-            //int MainIDCol = Fun_GetCol("hmainid");
-            //int SubIDCol = Fun_GetCol("hsubid");
-            //string s = frmCondition.cmbHComplete.Text;
-            //long n=0;
-            //DBUtility.Xt_BaseBillFun.GraphLine(grdMain, MainIDCol, SubIDCol, s,ref n);
-            ////鏄剧ず
-            //lbldj.Text = "鏌ヨ鍑� " + n.ToString() + " 寮犲崟鎹�";
-            //lbljl.Text = "鍏辨湁 " + grdMain.RowCount.ToString() + " 鏉¤褰�";
-        }
-        //瀹℃牳
-        private void sh_Click(object sender, EventArgs e)
-        {
-            ////this.Sub_CheckBill();
-            //if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
-            //{
-            //    return;
-            //}
-            //if (grdMain.CurrentRow == null)
-            //    return;
-            //DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
-            //if (MessageBox.Show("纭畾瑕佸弽浣滃簾鎵�閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
-            //{
-            //    return;
-            //}
-            //for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-            //{
-            //    if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0)
-            //    {
-            //        if (!oBar.UnCancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)))
-            //        {
-            //            MessageBox.Show("鍙嶄綔搴熷け璐ワ紒", "鎻愮ず");
-            //            return;
-            //        }
-            //    }
-            //}
-            //MessageBox.Show("鍙嶄綔搴熸垚鍔燂紒", "鎻愮ず");
-            //Sub_FastQuery();
-        }
-
-        //瀹℃牳鍗曟嵁
-        private void Sub_CheckBill()
-        {
-            //瀹℃牳鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true,DBUtility.ClsPub.CurUserName))
-            //{
-            //    return;
-            //}
-            //
-            Int64 lngBillKey = 0;
-            if (grdMain.CurrentRow == null)
-                return;
-            lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
-            if (lngBillKey == 0)
-                return;
-            DAL.ClsGy_ICBomBill  oBill = new DAL.ClsGy_ICBomBill();
-            //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
-            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
-            {
-                if (oBill.omodel.HChecker.Trim() != "")
-                {
-                    MessageBox.Show("鍗曟嵁宸插鏍�!涓嶈兘鍐嶆瀹℃牳", "鎻愮ず");
-                    return;
-                }
-            }
-            else
-            {
-                MessageBox.Show("鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず");
-                return;
-            }
-            //瀹℃牳
-            if (oBill.CheckBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
-            {
-                MessageBox.Show("瀹℃牳鎴愬姛!", "鎻愮ず");
-                return;
-            }
-            else
-            {
-                MessageBox.Show("瀹℃牳澶辫触!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず");
-                return;
-            }
-        }
-        //鍙嶅鍗曟嵁
-        private void Sub_AbandonCheck()
-        {
-            //瀹℃牳鏉冮檺
-            //if (!DBUtility.ClsPub.Security_Log(ModRightNameCheck, 1, true,DBUtility.ClsPub.CurUserName))
-            //{
-            //    return;
-            //}
-            //
-            Int64 lngBillKey = 0;
-            if (grdMain.CurrentRow == null)
-                return;
-            lngBillKey = DBUtility.ClsPub.isLong(grdMain.Rows[grdMain.CurrentRow.Index].Cells[Fun_GetCol("hmainid")].Value);
-            if (lngBillKey == 0)
-                return;
-            DAL.ClsGy_ICBomBill  oBill = new DAL.ClsGy_ICBomBill();
-            //鏌ョ湅鏄惁宸插鏍�,鍏抽棴,浣滃簾
-            if (oBill.ShowBill(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo))
-            {
-                if (oBill.omodel.HChecker.Trim() == "")
-                {
-                    MessageBox.Show("鍗曟嵁鏈鏍�!涓嶉渶瑕佸弽瀹℃牳!", "鎻愮ず");
-                    return;
-                }
-            }
-            else
-            {
-                MessageBox.Show("鍗曟嵁涓嶅瓨鍦�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず");
-                return;
-            }
-            //鍙嶅鏍�
-            if (oBill.AbandonCheck(lngBillKey, ref DBUtility.ClsPub.sExeReturnInfo) == true)
-            {
-                MessageBox.Show("鍙嶅鏍告垚鍔�!", "鎻愮ず");
-                return;
-            }
-            else
-            {
-                MessageBox.Show("鍙嶅鏍稿け璐�!鍘熷洜:" + DBUtility.ClsPub.sExeReturnInfo, "鎻愮ず");
-                return;
-            }
-        }
-        //浣滃簾
-        private void qsh_Click(object sender, EventArgs e)
-        {
-            ////Sub_AbandonCheck();
-            //if (!ClsPub.Security_Log(ModRightNameDelete, 1, true, DBUtility.ClsPub.CurUserName))
-            //{
-            //    return;
-            //}
-            //if (grdMain.CurrentRow == null)
-            //    return;
-            //DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
-            //if (MessageBox.Show("纭畾瑕佷綔搴熸墍閫夋潯鐮侊紵", "鎻愮ず", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
-            //{
-            //    return;
-            //}
-            //for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-            //{
-            //    if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("HMaterID")].Value) != 0)
-            //    {
-            //        if (!oBar.Cancelltion(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value)))
-            //        {
-            //            MessageBox.Show("浣滃簾澶辫触锛�", "鎻愮ず");
-            //            return;
-            //        }
-            //    }
-            //}
-            //MessageBox.Show("浣滃簾鎴愬姛锛�", "鎻愮ず");
-            //Sub_FastQuery();
-        }
-
-        private void GraphicsGrid()
-        {
-            DBUtility.Xt_BaseBillFun.GraphicsGrid(grdMain);
-        }
-
-        #region  //鎵撳嵃璁剧疆
-
-        GridppReport Report;
-        //棰勮
-        private void yl_Click(object sender, EventArgs e)
-        {
-            for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-            {
-                if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("鎵撳嵃娆℃暟")].Value) > 0)
-                {
-                    //鍒ゆ柇鏉冮檺
-                    if (!ClsPub.Security_Log(ModRightNamePrint, 1, false, DBUtility.ClsPub.CurUserName))
-                    {
-                        MessageBox.Show("鎵�閫夋潯鐮佸凡缁忔墦鍗帮紝鎮ㄦ病鏈夋潈闄愶紝涓嶈兘閲嶅鎵撳嵃锛�");
-                        return;
-                    }
-                }
-            }
-            //閫夋嫨鎵撳嵃妯℃澘
-            string sErr = "";
-            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
-            oFrm.sBillName = ModName;
-            oFrm.sBillModel = ModCaption;
-            oFrm.ShowDialog();
-            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
-            {
-                for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-                {
-                    selectRow = i;
-                    Sub_SetReport(oFrm.sOpenTmp);
-                    Report.PrintPreview(false);
-                    //oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
-                    //
-                }
-            }
-        }
-
-        private void Sub_SetReport(string sOpenTmp)
-        {
-            //鍒ゆ柇琛屾暟
-            //
-            Report = new GridppReport();
-            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
-            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
-            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
-        }
-
-        //濉叆鍗曟嵁琛ㄥご淇℃伅
-        private void ReportBeforePostRecord()//your report?kao
-        {
-            Report.FieldByName("鏉$爜缂栧彿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value);
-            Report.FieldByName("鏁伴噺").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鏁伴噺")].Value);
-            Report.FieldByName("鍗曚綅").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("璁¢噺鍗曚綅")].Value);
-            Report.FieldByName("鍏ュ簱鏃ユ湡").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鏃ユ湡")].Value);
-            //鎴愬搧
-            Report.FieldByName("瀹㈡埛鍚嶇О").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("寰�鏉ュ崟浣�")].Value);
-            Report.FieldByName("浜у搧浠g爜").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
-            Report.FieldByName("浜у搧鍥惧彿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
-            Report.FieldByName("浜у搧鍚嶇О").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
-            Report.FieldByName("鍖呰鏂瑰紡").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鍖呰鏂瑰紡")].Value);
-            Report.FieldByName("鐢熶骇璁″垝").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("婧愬崟鍗曞彿")].Value);
-            Report.FieldByName("鎴愬搧鎵规").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鎵瑰彿")].Value);
-            Report.FieldByName("鐢熶骇杞﹂棿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐢熶骇杞﹂棿")].Value);
-            Report.FieldByName("鐢熶骇鍛ㄦ湡").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐢熶骇鍛ㄦ湡")].Value);
-            //鍘熸枡
-            Report.FieldByName("渚涘簲鍟嗗悕绉�").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("寰�鏉ュ崟浣�")].Value);
-            Report.FieldByName("鐗╂枡浠g爜").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value);
-            Report.FieldByName("鐗屽彿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value);
-            Report.FieldByName("鍨嬪彿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value);
-            Report.FieldByName("鐐夊彿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鐐夊彿")].Value);
-            Report.FieldByName("鐗╂枡鎵规").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鎵瑰彿")].Value);
-            if (DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("灏炬暟")].Value) == "灏炬暟")
-            {
-                Report.FieldByName("灏炬暟").AsString = "/////////////////////////";
-            }
-            else
-            {
-                Report.FieldByName("灏炬暟").AsString = "";
-            }
-        }
-
-        private void ReportFetchRecordByDataTable()
-        {
-            BLL.Utility.FillRecordToReport(Report, grdMain, grdPrint, Fun_GetCol("鏉$爜缂栧彿"));
         }
 
         #endregion
-        //
-        private void grdMain_Paint(object sender, PaintEventArgs e)
-        {
-            GraphicsGrid();
-        }
 
-        //鍚堣 new
-        private void Total()
-        {
-            if (grdMain.Rows.Count > 0 && grdMain.ColumnCount > 0)
-            {
-                oSumGrid.SetGridsum();
-                oSumGrid.Total();
-            }
-        }
-        //鍚堣 new
-        private void grdMain_ColumnWidthChanged(object sender, DataGridViewColumnEventArgs e)
-        {
-            Total();
-        }
-        //鍚堣 new
-        private void grdMain_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
-        {
-            Total();
-        }
-
-        private void dy_Click(object sender, EventArgs e)
-        {
-            //閫夋嫨鎵撳嵃妯℃澘
-            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
-            DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
-            oFrm.sBillName = ModName;
-            oFrm.sBillModel = ModCaption;
-            oFrm.ShowDialog();
-            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
-            {
-                //
-                for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-                {
-                    selectRow = i;
-                    Sub_SetReport(oFrm.sOpenTmp);
-                    Report.Print(false);
-                    oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
-                }
-            }
-        }
-
-        private void dy2_Click(object sender, EventArgs e)
-        {
-            for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-            {
-                if (DBUtility.ClsPub.isLong(grdMain.SelectedRows[i].Cells[Fun_GetCol("鎵撳嵃娆℃暟")].Value) > 0)
-                {
-                    //鍒ゆ柇鏉冮檺
-                    if (!ClsPub.Security_Log(ModRightNamePrint, 1, false, DBUtility.ClsPub.CurUserName))
-                    {
-                        MessageBox.Show("鎵�閫夋潯鐮佸凡缁忔墦鍗帮紝鎮ㄦ病鏈夋潈闄愶紝涓嶈兘閲嶅鎵撳嵃锛�");
-                        return;
-                    }
-                }
-            }
-            //
-            //閫夋嫨鎵撳嵃妯℃澘
-            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
-            DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
-            oFrm.sBillName = ModName;
-            oFrm.sBillModel = ModCaption;
-            oFrm.ShowDialog();
-            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
-            {
-                //
-                for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
-                {
-                    selectRow = i;
-                    Sub_SetReport(oFrm.sOpenTmp);
-                    Report.Print(false);
-                    oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[i].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
-                    //
-                    //Thread.Sleep(300);
-                }
-            }
-        }
-
-        private void grdMain_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
-        {
-            int sHQtyCol = Fun_GetCol("鏁伴噺");
-            int i = grdMain.CurrentCell.ColumnIndex;
-            if (i != sHQtyCol)
-            {
-                e.Cancel = true;
-            }
-        }
+        #region  蹇�熸煡璇�
 
         //蹇�熻繃婊�
+        private void btnOK_Click(object sender, EventArgs e)
+        {
+            Sub_FastQuery();
+        }
+
         private void Sub_FastQuery()
         {
             string sFastSQL = "";
-            //鐗╂枡
-            //if (cmbHStatus.Text.Trim() == "姝e父")
-            //{
-            //    sFastSQL = sFastSQL + " and hstopflag=0 ";
-            //}
-            //else
-            //{
-            //    sFastSQL = sFastSQL + " and hstopflag=1 ";
-            //}
             //鐗╂枡
             if (txtHMater.Text.Trim() != "")
             {
@@ -659,11 +249,11 @@
             sDlgWhere = "";
         }
 
-        private void btnOK_Click(object sender, EventArgs e)
-        {
-            Sub_FastQuery();
-        }
+        #endregion
 
+        #region  瀵煎嚭鍔熻兘
+
+        //寮曞嚭
         private void yc_Click(object sender, EventArgs e)
         {
             //BLL.ClsPub_BLL.DataGridViewToExcel2(grdMain, this.Text);
@@ -756,6 +346,88 @@
             }
         }
 
+        //瀵煎嚭
+        private void dc_Click(object sender, EventArgs e)
+        {
+            DBUtility.Gy_BaseFun.DataToExcel(this.Text, grdMain);
+        }
+
+        #endregion
+
+        #region  閫�鍑哄姛鑳�
+
+        //閫�鍑哄姛鑳�
+        private void tc_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+
+        #endregion
+
+        #region  鎵撳嵃鍔熻兘
+
+        GridppReport Report;
+
+        //棰勮
+        private void yl_Click(object sender, EventArgs e)
+        {
+            //閫夋嫨鎵撳嵃妯℃澘
+            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+            oFrm.sBillName = ModName;
+            oFrm.sBillModel = ModCaption;
+            oFrm.ShowDialog();
+            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+            {
+                for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
+                {
+                    selectRow = i;
+                    Sub_SetReport(oFrm.sOpenTmp);
+                    Report.PrintPreview(false);
+                }
+            }
+        }
+
+        //鎵撳嵃
+        private void dy_Click(object sender, EventArgs e)
+        {
+            //閫夋嫨鎵撳嵃妯℃澘
+            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+            oFrm.sBillName = ModName;
+            oFrm.sBillModel = ModCaption;
+            oFrm.ShowDialog();
+            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+            {
+                for (int i = 0; i <= grdMain.SelectedRows.Count - 1; i++)
+                {
+                    selectRow = i;
+                    Sub_SetReport(oFrm.sOpenTmp);
+                    Report.Print(false);
+                }
+            }
+        }
+
+        private void Sub_SetReport(string sOpenTmp)
+        {
+            //鍒ゆ柇琛屾暟
+            Report = new GridppReport();
+            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + sOpenTmp + ".grf");  //here .
+            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
+            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
+        }
+
+        //濉叆鍗曟嵁琛ㄥご淇℃伅
+        private void ReportBeforePostRecord()
+        {
+            //Report.FieldByName("鏉$爜缂栧彿").AsString = DBUtility.ClsPub.isStrNull(grdMain.SelectedRows[selectRow].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value);
+        }
+
+        private void ReportFetchRecordByDataTable()
+        {
+            BLL.Utility.FillRecordToReport(Report, grdMain, grdPrint, Fun_GetCol("鏉$爜缂栧彿"));
+        }
+
+        #endregion
+
 
 
 

--
Gitblit v1.9.1