From 51b2b8b4340a71d9129e4e091a333eb68f0eff9c Mon Sep 17 00:00:00 2001
From: duhe <226547893@qq.com>
Date: 星期五, 30 六月 2023 16:53:51 +0800
Subject: [PATCH] 用户快捷方式图标设置

---
 WarM/仓库管理/Gy_BarCodeBill_ChaiMa.cs |  447 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 311 insertions(+), 136 deletions(-)

diff --git "a/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs" "b/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs"
index 2cd9c33..171d557 100644
--- "a/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs"
+++ "b/WarM/\344\273\223\345\272\223\347\256\241\347\220\206/Gy_BarCodeBill_ChaiMa.cs"
@@ -1,4 +1,5 @@
-锘縰sing Pub_Class;
+锘縰sing gregn6Lib;
+using Pub_Class;
 using System;
 using System.Collections.Generic;
 using System.ComponentModel;
@@ -6,9 +7,10 @@
 using System.Drawing;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Windows.Forms;
 
-namespace WarM.浠撳簱绠$悊
+namespace WarM
 {
     public partial class Gy_BarCodeBill_ChaiMa : Form
     {
@@ -40,9 +42,10 @@
         public const Int16 HMaterMould2 = 8;
         public const Int16 HBatchNo2 = 9;
 
-        public const string ModName = "";                   //鍗曟嵁绫诲瀷
+        public const string ModName = "3302";                   //鍗曟嵁绫诲瀷
         public const string ModCaption = "鏉$爜鎷嗙爜";          //鍗曟嵁鍚嶇О
         public const string ModRightName = "Gy_BarCodeBill_ChaiMa";
+        public DBUtility.ClsPub.Enum_BillStatus BillStatus;     //鍗曟嵁鐘舵�侊紙鏂板锛屼慨鏀癸紝娴忚锛屾洿鏂板崟浠凤紝鍙樻洿锛�
         ClsGridViewSum oSumGrid_Mater = new ClsGridViewSum();
         ClsGridViewSum oSumGrid_Pay = new ClsGridViewSum();
         public DAL.ClsGy_BarCodeBill_ChaiMa BillNew = new DAL.ClsGy_BarCodeBill_ChaiMa();   //瀵瑰簲鍗曟嵁绫�
@@ -56,14 +59,33 @@
             txtHMaker.Text = DBUtility.ClsPub.CurUserName;
             initGrid();
             initGrid_Pay();
+            oSumGrid_Mater.NoCol = HSnoCol;
+            oSumGrid_Pay.NoCol = HSnoCol2;
         }
 
-       #region 绐椾綋澶勭悊鏂规硶
+        #region 绐椾綋澶勭悊鏂规硶
+        //鍒濆鍖栭〉绛�1鏁版嵁
+        private void intoDate()
+        {
+            try
+            {
+                DataSet Ds;
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                Ds = oCn.RunProcReturn("select * from h_v_Gy_BarCodeBill_ChaiMa", "h_v_Gy_BarCodeBill_ChaiMa");
+                grdMain.DataSource = Ds.Tables[0].DefaultView;
+
+            }
+            catch (Exception ex )
+            {
+                MessageBox.Show(ex.Message.ToString());
+            }
+            
+        }
 
         //鍒濆鍖栭〉绛�1
         private void initGrid()
         {
-            grdMain.ColumnCount = 9;                       //鎬诲垪鏁�
+            grdMain.ColumnCount = 10;                       //鎬诲垪鏁�
             DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name + "1");
             grdMain.Columns[HSnoCol].HeaderText = "搴忓彿";
             grdMain.Columns[HInterID].HeaderText = "HInterID";
@@ -79,38 +101,51 @@
             ////闅愯棌鍒�
             grdMain.Columns[HTagCol].Visible = false;
             grdMain.Columns[HInterID].Visible = false;
-            //璁剧疆鍙紪杈戝垪
-            string sAllowCol = HNum.ToString();
-            //璁剧疆鍚堣鍒�
-            string sTotalCol = HTagCol.ToString() + "0";
+            //缃伆
+            grdMain.Columns[HSnoCol].ReadOnly = true;
+            grdMain.Columns[HBarCode].ReadOnly = true;
+            grdMain.Columns[HQty].ReadOnly = true;
+            grdMain.Columns[HMaterCol].ReadOnly = true;
+            grdMain.Columns[HMaterName].ReadOnly = true;
+            grdMain.Columns[HMaterMould].ReadOnly = true;
+            grdMain.Columns[HBatchNo].ReadOnly = true;
+            //intoDate();
             //鏍煎紡鍖栫綉鏍�
-            DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Mater);
+            //DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Mater);
         }
 
         //鍒濆鍖栭〉绛�2
         private void initGrid_Pay()
         {
-            grdMain.ColumnCount = 9;                       //鎬诲垪鏁�
-            DBUtility.Xt_BaseBillFun.initGridFst(grdMain, this.Name + "1");
-            grdMain.Columns[HSnoCol2].HeaderText = "搴忓彿";
-            grdMain.Columns[HInterID2].HeaderText = "HInterID";
-            grdMain.Columns[HBarCode2].HeaderText = "鏉$爜缂栧彿";
-            grdMain.Columns[HQty2].HeaderText = "鏉$爜鏁伴噺";
-            grdMain.Columns[HNum2].HeaderText = "鎷嗗垎鏁伴噺";
-            grdMain.Columns[HMaterCol2].HeaderText = "鐗╂枡浠g爜";
-            grdMain.Columns[HMaterName2].HeaderText = "鐗╂枡鍚嶇О";
-            grdMain.Columns[HMaterMould2].HeaderText = "瑙勬牸鍨嬪彿";
-            grdMain.Columns[HBatchNo2].HeaderText = "鎵瑰彿";
+            grdMain_Pay.ColumnCount = 10;                       //鎬诲垪鏁�
+            DBUtility.Xt_BaseBillFun.initGridFst(grdMain_Pay, this.Name + "1");
+            grdMain_Pay.Columns[HSnoCol2].HeaderText = "搴忓彿";
+            grdMain_Pay.Columns[HInterID2].HeaderText = "HInterID";
+            grdMain_Pay.Columns[HBarCode2].HeaderText = "鏉$爜缂栧彿";
+            grdMain_Pay.Columns[HQty2].HeaderText = "鏉$爜鏁伴噺";
+            grdMain_Pay.Columns[HNum2].HeaderText = "鎷嗗垎鏁伴噺";
+            grdMain_Pay.Columns[HMaterCol2].HeaderText = "鐗╂枡浠g爜";
+            grdMain_Pay.Columns[HMaterName2].HeaderText = "鐗╂枡鍚嶇О";
+            grdMain_Pay.Columns[HMaterMould2].HeaderText = "瑙勬牸鍨嬪彿";
+            grdMain_Pay.Columns[HBatchNo2].HeaderText = "鎵瑰彿";
             //=============================================================================
             ////闅愯棌鍒�
-            grdMain.Columns[HTagCol].Visible = false;
-            grdMain.Columns[HInterID].Visible = false;
+            grdMain_Pay.Columns[HTagCol].Visible = false;
+            grdMain_Pay.Columns[HInterID].Visible = false;
+            //缃伆
+            grdMain_Pay.Columns[HSnoCol].ReadOnly = true;
+            grdMain_Pay.Columns[HBarCode].ReadOnly = true;
+            grdMain_Pay.Columns[HQty].ReadOnly = true;
+            grdMain_Pay.Columns[HMaterCol].ReadOnly = true;
+            grdMain_Pay.Columns[HMaterName].ReadOnly = true;
+            grdMain_Pay.Columns[HMaterMould].ReadOnly = true;
+            grdMain_Pay.Columns[HBatchNo].ReadOnly = true;
             //璁剧疆鍙紪杈戝垪
             string sAllowCol = HNum2.ToString();
             //璁剧疆鍚堣鍒�
             string sTotalCol = HTagCol2.ToString() + "0";
             //鏍煎紡鍖栫綉鏍�
-            DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Pay);
+            //DBUtility.Xt_BaseBillFun.initGridLast(sAllowCol, sTotalCol, oSumGrid_Pay);
         }
 
         // 鍩烘湰涓嶅彉
@@ -128,141 +163,163 @@
             txtHBillNo.Text = "";
             txtNum.Text = "";
             txtHMaker.Text = DBUtility.ClsPub.CurUserName;
+            Sub_ClearBill();
         }
 
-        //鏁版嵁楠岃瘉
-        private bool Sub_AllowSave()
+        ////鏁版嵁楠岃瘉
+        //private bool Sub_AllowSave()
+        //{
+        //    for (int i = 0; i <= grdMain_Pay.RowCount - 1; i++)
+        //    {
+        //        if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
+        //        {
+        //            if (ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HNum2].Value) ==null)
+        //            {
+        //                MessageBox.Show("璇峰皢琛ㄦ牸鎷嗗垎鏁伴噺濉啓瀹屾暣", "鎻愮ず");
+        //                return false;
+        //            }
+        //        }
+        //        else
+        //        {
+        //            return true;
+        //        }
+        //    }
+        //    return true;
+        //}
+        
+        //鐢熸垚鎸夐挳
+        private void xz_Click(object sender, EventArgs e)
         {
-            int i = 0;
-            while (grdMain_Pay.Rows[i].Cells[HSnoCol].Value.ToString() != "")
-            {
-                if (grdMain_Pay.Rows[i].Cells[HNum2].Value.ToString() == "")
-                {
-                    MessageBox.Show("璇峰皢琛ㄦ牸鎷嗗垎鏁伴噺濉啓瀹屾暣", "鎻愮ず");
-                    return false;
-                }
-            }
-            return true;
+            this.SeverDate();
         }
         private bool SeverDate()
         {
             Int32 i;
             bool bResult;
             BillNew = new DAL.ClsGy_BarCodeBill_ChaiMa();
-
-            if (!Sub_AllowSave())//鍗曟嵁瀹屾暣鎬у垽鏂�
-                return false;
-            
-            //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
-            string s = "";
-            int sYear = 0;
-            int sPeriod = 0;
-            string HBillNo = txtHBillNo.Text;
-            DataSet Ds;
-            SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-            Ds = oCn.RunProcReturn("select top 1* from h_v_Gy_BarCodeBill_ChaiMa where HBarCode='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
-            
-            for (i = 0; i <= grdMain_Pay.RowCount - 1; i++)
-            {
-                if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HBarCode].Value) != 0)
+            //if (Sub_AllowSave())
+            //{
+                //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
+                string HBillNo = txtHBillNo.Text;
+                DataSet Ds;
+                double sum = 0.00000000;
+                SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
+                Ds = oCn.RunProcReturn("select top 1* from Gy_BarCodeBill where HBarCode='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
+                for (i = 0; i <= grdMain_Pay.RowCount - 1; i++)
                 {
-                    
-                    Model.ClsGy_BarCodeEdit_Model model = new Model.ClsGy_BarCodeEdit_Model();
-                    //鍥哄畾璧嬪��========================================
-                    model.HEntryID = i + 1;
-                    model.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
-                    model.HBarCode = DBUtility.ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HBarCode].Value);
-                    model.HQty = DBUtility.ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HQty].Value);
-                    model.HPieceQty = DBUtility.ClsPub.isInt(grdMain_Pay.Rows[i].Cells[HNum2].Value);
-                    model.HBatchNo = DBUtility.ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HBatchNo].Value);
-                    model.HMaterID = DBUtility.ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HMaterCol].Value);
-                    model.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"].ToString());
-                    model.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"].ToString());
-                    model.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"].ToString());
-                    model.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"].ToString());
-                    model.HBarCodeType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeType"].ToString());
-                    model.HItemSubID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemSubID"].ToString());
-                    model.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"].ToString());
-                    model.HSourceInterID= DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceInterID"].ToString());
-                    model.HSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceEntryID"].ToString());
-                    model.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"].ToString());
-                    model.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
-                    model.HUseFlag = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUseFlag"].ToString());
-                    model.HStopflag = DBUtility.ClsPub.isBool(Ds.Tables[0].Rows[0]["HStopflag"].ToString());
-                    model.HInitQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
-                    model.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
-                    model.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"].ToString());
-                    model.HSTOCKORGID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSTOCKORGID"].ToString());
-                    model.HOWNERID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOWNERID"].ToString());
-                    model.HBarCodeDate= DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeDate"].ToString());
-                    model.HInnerBillNo= DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString());
-                    model.HMZ= DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HMZ"].ToString());
-
-                    model.HMakeDate = DateTime.Now;
-                    model.HMaker = ClsPub.CurUserName;
-
-                    if (model.HPieceQty <= 0|| model.HPieceQty.ToString() =="")
+                    if (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
                     {
-                        MessageBox.Show("绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝鎷嗗垎鏁伴噺蹇呴』澶т簬0锛�");
+                        Model.ClsGy_BarCodeEdit_Model model = new Model.ClsGy_BarCodeEdit_Model();
+                        //鍥哄畾璧嬪��========================================
+                        model.HEntryID = i + 1;
+                        model.HInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInterID"].ToString());
+                        model.HBarCode = DBUtility.ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HBarCode].Value);
+                        model.HQty = DBUtility.ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HNum2].Value);
+                        model.HQty = DBUtility.ClsPub.isInt(grdMain_Pay.Rows[i].Cells[HNum2].Value);
+                        model.HBatchNo = DBUtility.ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HBatchNo].Value);
+                        model.HMaterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HMaterID"].ToString());
+                        model.HUnitID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HUnitID"].ToString());
+                        model.HSupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSupID"].ToString());
+                        model.HDeptID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HDeptID"].ToString());
+                        model.HEmpID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HEmpID"].ToString());
+                        model.HBarCodeType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HBarCodeType"].ToString());
+                        model.HItemSubID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HItemSubID"].ToString());
+                        model.HGroupID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HGroupID"].ToString());
+                        model.HSourceInterID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceInterID"].ToString());
+                        model.HSourceEntryID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSourceEntryID"].ToString());
+                        model.HSourceBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillNo"].ToString());
+                        model.HSourceBillType = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HSourceBillType"].ToString());
+                        model.HUseFlag = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HUseFlag"].ToString());
+                        model.HInitQty = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
+                        model.HSourceID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HInitQty"].ToString());
+                        model.HCusID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HCusID"].ToString());
+                        model.HSTOCKORGID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HSTOCKORGID"].ToString());
+                        model.HOWNERID = DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0]["HOWNERID"].ToString());
+                        model.HBarCodeDate = DBUtility.ClsPub.isDate(Ds.Tables[0].Rows[0]["HBarCodeDate"].ToString());
+                        model.HInnerBillNo = DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0]["HInnerBillNo"].ToString());
+                        model.HMZ = DBUtility.ClsPub.isDoule(Ds.Tables[0].Rows[0]["HMZ"].ToString());
+
+                        model.HMakeDate = DateTime.Now;
+                        model.HMaker = ClsPub.CurUserName;
+
+                        if (model.HQty <= 0 || model.HQty.ToString() == "")
+                        {
+                            MessageBox.Show("椤�2绗�" + ClsPub.isStrNull(i + 1) + "琛岋紝鎷嗗垎鏁伴噺蹇呴』澶т簬0锛�");
+                            return false;
+                        }
+                        sum += model.HQty;
+                        BillNew.DetailColl_Mater.Add(model);
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+                if (sum > DBUtility.ClsPub.isDoule(grdMain.Rows[0].Cells[HQty].Value))
+                {
+                     MessageBox.Show("椤�2鎷嗗垎鏁伴噺涔嬪拰蹇呴』灏忎簬鏉$爜鏁伴噺锛�");
+                    return false;
+                }
+                else
+                {
+                    //淇濆瓨
+                    bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo, HBillNo);
+                    //鎻愮ず
+                    if (bResult == true)
+                    {
+                        MessageBox.Show("鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + this.txtHBillNo.Text.Trim(), "鎻愮ず");
+                        return true;
+                    }
+                    else
+                    {
+                        MessageBox.Show("淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo, "鎻愮ず");
                         return false;
                     }
-                    BillNew.DetailColl_Mater.Add(model);
                 }
-            }
-            return true;
-            //淇濆瓨
-            bResult = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
-            //鎻愮ず
-            if (bResult == true)
-            {
-                MessageBox.Show("鍗曟嵁瀛樼洏瀹屾瘯!鍗曟嵁鍙�:" + this.txtHBillNo.Text.Trim(), "鎻愮ず");
-                return true;
-            }
-            else
-            {
-                MessageBox.Show("淇濆瓨澶辫触!鍘熷洜:" + ClsPub.sExeReturnInfo, "鎻愮ず");
-                return false;
-            }
-        }
-        //鐢熸垚鎸夐挳
-        private void xz_Click(object sender, EventArgs e)
-        {
-            this.SeverDate();
         }
         //纭畾鎸夐挳
         private void button1_Click(object sender, EventArgs e)
         {
-            if (DBUtility.ClsPub.isStrNull(txtHBillNo.Text) != ""|| DBUtility.ClsPub.isStrNull(txtNum.Text) != "")
+            if (DBUtility.ClsPub.isStrNull(txtHBillNo.Text) != ""&& DBUtility.ClsPub.isStrNull(txtNum.Text) != "")
             {
                 string HBillNo = txtHBillNo.Text;
-                int HNum = int.Parse(txtNum.Text);
+                int HNumCan = int.Parse(txtNum.Text);
                 DataSet Ds;
                 SQLHelper.ClsCN oCn = new SQLHelper.ClsCN();
-                Ds = oCn.RunProcReturn("select top 1* from h_v_Gy_BarCodeBill_ChaiMa where HBarCode='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
-                grdMain.Rows[0].Cells[HTagCol].Value = "*";
-                grdMain.Rows[0].Cells[HInterID].Value = Ds.Tables[0].Rows[0]["HInterID"].ToString();
-                grdMain.Rows[0].Cells[HBarCode].Value = Ds.Tables[0].Rows[0]["鏉$爜缂栧彿"].ToString();
-                grdMain.Rows[0].Cells[HQty].Value = Ds.Tables[0].Rows[0]["鏉$爜鏁伴噺"].ToString();
-                grdMain.Rows[0].Cells[HNum].Value = 0;
-                grdMain.Rows[0].Cells[HMaterCol].Value = Ds.Tables[0].Rows[0]["鐗╂枡浠g爜"].ToString();
-                grdMain.Rows[0].Cells[HMaterName].Value = Ds.Tables[0].Rows[0]["鐗╂枡鍚嶇О"].ToString();
-                grdMain.Rows[0].Cells[HMaterMould].Value = Ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
-                grdMain.Rows[0].Cells[HBatchNo].Value = Ds.Tables[0].Rows[0]["鎵瑰彿"].ToString();
-                for (int i = 0; i < HNum; i++)
+                Ds = oCn.RunProcReturn("select top 1* from h_v_Gy_BarCodeBill_ChaiMa where 鏉$爜缂栧彿='" + HBillNo + "'", "h_v_Gy_BarCodeBill_ChaiMa");
+                if (Ds == null || Ds.Tables[0].Rows.Count == 0)
                 {
-                    int Code = 65 + i;
-                    System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
-                    byte[] byteArray = new byte[] { (byte)Code };
-                    string A = asciiEncoding.GetString(byteArray);
-                    string No = Ds.Tables[0].Rows[0]["鏉$爜缂栧彿"].ToString();
-                    grdMain_Pay.Rows[i].Cells[HTagCol2].Value = "*";
-                    grdMain_Pay.Rows[0].Cells[HInterID2].Value = Ds.Tables[0].Rows[0]["HInterID"].ToString();
-                    grdMain_Pay.Rows[0].Cells[HBarCode2].Value = No + A;
-                    grdMain_Pay.Rows[0].Cells[HQty2].Value = Ds.Tables[0].Rows[0]["鏉$爜鏁伴噺"].ToString();
-                    grdMain_Pay.Rows[0].Cells[HMaterCol2].Value = Ds.Tables[0].Rows[0]["鐗╂枡浠g爜"].ToString();
-                    grdMain_Pay.Rows[0].Cells[HMaterName2].Value = Ds.Tables[0].Rows[0]["鐗╂枡鍚嶇О"].ToString();
-                    grdMain_Pay.Rows[0].Cells[HMaterMould2].Value = Ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
-                    grdMain_Pay.Rows[0].Cells[HBatchNo2].Value = Ds.Tables[0].Rows[0]["鎵瑰彿"].ToString();
+                    MessageBox.Show("鏉$爜缂栧彿涓嶅瓨鍦�", "鎻愮ず");
+                }
+                else
+                {
+                    grdMain.Rows[0].Cells[HTagCol].Value = "*";
+                    grdMain.Rows[0].Cells[HSnoCol].Value = 1;
+                    grdMain.Rows[0].Cells[HInterID].Value = Ds.Tables[0].Rows[0]["HInterID"].ToString();
+                    grdMain.Rows[0].Cells[HBarCode].Value = Ds.Tables[0].Rows[0]["鏉$爜缂栧彿"].ToString();
+                    grdMain.Rows[0].Cells[HQty].Value = Ds.Tables[0].Rows[0]["鏉$爜鏁伴噺"].ToString();
+                    grdMain.Rows[0].Cells[HNum].Value = 0;
+                    grdMain.Rows[0].Cells[HMaterCol].Value = Ds.Tables[0].Rows[0]["鐗╂枡浠g爜"].ToString();
+                    grdMain.Rows[0].Cells[HMaterName].Value = Ds.Tables[0].Rows[0]["鐗╂枡鍚嶇О"].ToString();
+                    grdMain.Rows[0].Cells[HMaterMould].Value = Ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
+                    grdMain.Rows[0].Cells[HBatchNo].Value = Ds.Tables[0].Rows[0]["鎵瑰彿"].ToString();
+                    for (int i = 0; i < HNumCan; i++)
+                    {
+                        int Code = 65 + i;
+                        System.Text.ASCIIEncoding asciiEncoding = new System.Text.ASCIIEncoding();
+                        byte[] byteArray = new byte[] { (byte)Code };
+                        string A = asciiEncoding.GetString(byteArray);
+                        string No = Ds.Tables[0].Rows[0]["鏉$爜缂栧彿"].ToString();
+                        grdMain_Pay.Rows[i].Cells[HTagCol2].Value = "*";
+                        grdMain_Pay.Rows[i].Cells[HSnoCol2].Value = HSnoCol2+i;
+                        grdMain_Pay.Rows[i].Cells[HInterID2].Value = Ds.Tables[0].Rows[0]["HInterID"].ToString();
+                        grdMain_Pay.Rows[i].Cells[HBarCode2].Value = No + A;
+                        grdMain_Pay.Rows[i].Cells[HQty2].Value = Ds.Tables[0].Rows[0]["鏉$爜鏁伴噺"].ToString();
+                        grdMain_Pay.Rows[i].Cells[HMaterCol2].Value = Ds.Tables[0].Rows[0]["鐗╂枡浠g爜"].ToString();
+                        grdMain_Pay.Rows[i].Cells[HMaterName2].Value = Ds.Tables[0].Rows[0]["鐗╂枡鍚嶇О"].ToString();
+                        grdMain_Pay.Rows[i].Cells[HMaterMould2].Value = Ds.Tables[0].Rows[0]["瑙勬牸鍨嬪彿"].ToString();
+                        grdMain_Pay.Rows[i].Cells[HBatchNo2].Value = Ds.Tables[0].Rows[0]["鎵瑰彿"].ToString();
+                    }
                 }
             }
             else
@@ -271,5 +328,123 @@
             }
             
         }
+
+        private void tc_Click(object sender, EventArgs e)
+        {
+            this.Close();
+        }
+
+        GridppReport Report;
+        private void yl_Click(object sender, EventArgs e)
+        {
+            //閫夋嫨鎵撳嵃妯℃澘
+            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+            oFrm.sBillName = ModName;
+            oFrm.sBillModel = "鏉$爜妗f鍒楄〃";
+            oFrm.ShowDialog();
+            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+            {
+                Sub_SetReport(oFrm.sOpenTmp);
+                Report.PrintPreview(false);
+                Thread.Sleep(1000);
+            }
+        }
+
+        private void dy_Click(object sender, EventArgs e)
+        {
+            //鎵撳嵃鍓嶅垽鏂潯鐮佹槸鍚﹀凡鎵撳嵃杩�
+            string sBarCode = "";
+            string sRelQty = "";
+            int i = 0;
+            DAL.ClsGy_BarCodeBill_Ctl oBar = new DAL.ClsGy_BarCodeBill_Ctl();
+
+            if (ClsPub.isLong(grdMain_Pay.Rows[0].Cells[HSnoCol2].Value) == 0)
+            {
+                MessageBox.Show("璇峰厛鐢熸垚鎷嗙爜鏉$爜锛�");
+            }
+
+            while (ClsPub.isLong(grdMain_Pay.Rows[i].Cells[HSnoCol2].Value) != 0)
+            {
+                sBarCode = sBarCode + "," + DBUtility.ClsPub.isStrNull(grdMain_Pay.Rows[i].Cells[HBarCode2].Value);
+                i++;
+            }
+           
+            //閫夋嫨鎵撳嵃妯℃澘
+            BLL.Gy_OpenTmp oFrm = new BLL.Gy_OpenTmp();
+            oFrm.sBillName = ModName;
+            oFrm.sBillModel = "鏉$爜妗f鍒楄〃";
+            oFrm.ShowDialog();
+            if (oFrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK)
+            {
+                Sub_SetReport(oFrm.sOpenTmp);
+                Report.Print(false);
+                //oBar.Set_PrintQty(DBUtility.ClsPub.isStrNull(grdMain.Rows[CurRows].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value));
+                Thread.Sleep(1000);
+            }
+
+            //鎵归噺鏇存柊鏉$爜鎵撳嵃娆℃暟
+            oBar.Set_EPrintQty(sBarCode.Substring(1));
+        }
+
+        private void Sub_SetReport(string sOpenTmp)
+        {
+            //鍒ゆ柇琛屾暟
+            for (int i = 0; i < grdMain_Pay.Rows.Count; i++)
+            {
+                grdMain_Pay.Rows[i].Cells[0].Value = "";
+            }
+            for (int i = 0; i < grdMain_Pay.SelectedRows.Count; i++)
+            {
+                grdMain_Pay.Rows[grdMain_Pay.SelectedRows[i].Index].Cells[0].Value = "*";
+            }
+            //
+            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
+        {
+            try
+            {
+                //Report.FieldByName("鐗╂枡浠g爜").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鐗╂枡浠g爜")].Value.ToString();
+                //Report.FieldByName("鐗╂枡鍚嶇О").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鐗╂枡鍚嶇О")].Value.ToString();
+                //Report.FieldByName("瑙勬牸鍨嬪彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("瑙勬牸鍨嬪彿")].Value.ToString();
+                //Report.FieldByName("鑷畾涔夎鏍�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鑷畾涔夎鏍�")].Value.ToString();
+                //Report.FieldByName("鏉$爜缂栧彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鏉$爜缂栧彿")].Value.ToString();
+                //Report.FieldByName("鏁伴噺").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鏁伴噺")].Value.ToString();
+                //Report.FieldByName("鎵规").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鎵瑰彿")].Value.ToString();
+                //Report.FieldByName("婧愬崟鍗曞彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("婧愬崟鍗曞彿")].Value.ToString();
+                //Report.FieldByName("閿�鍞鍗曞彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("閿�鍞鍗曞彿")].Value.ToString();
+                //Report.FieldByName("閲囪喘璁㈠崟鍙�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("閲囪喘璁㈠崟鍙�")].Value.ToString();
+                //Report.FieldByName("渚涘簲鍟�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("寰�鏉ュ崟浣�")].Value.ToString();
+                //Report.FieldByName("鐢熶骇杞﹂棿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鐢熶骇杞﹂棿")].Value.ToString();
+                //Report.FieldByName("澶囨敞").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("澶囨敞")].Value.ToString();
+                //Report.FieldByName("鎬绘墭鏁�").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鎬绘墭鏁�")].Value.ToString();
+                //Report.FieldByName("鎵樺彿").AsString = grdMain.Rows[CurRows].Cells[Fun_GetCol("鎵樺彿")].Value.ToString();
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show("鎵撳嵃澶辫触!琛ㄥご锛�" + e.Message);
+            }
+            //CurRows = CurRows + 1;
+        }
+        private void ReportFetchRecordByDataTable()
+        {
+            try
+            {
+                DataTable ds = new DataTable();
+                BLL.Utility.FillRecordToReport_Sel(Report, grdMain_Pay, ds, Fun_GetCol("搴忓彿"));
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show("鎵撳嵃澶辫触!琛ㄤ綋锛�" + e.Message);
+            }
+        }
+        private Int32 Fun_GetCol(string sCol)
+        {
+            return DBUtility.Xt_BaseBillFun.Fun_GetCol(sCol, grdMain_Pay);
+        }
     }
 }

--
Gitblit v1.9.1