From fa089e543f2c843c1e3f32067d76b191eba9f01b Mon Sep 17 00:00:00 2001
From: yusijie <ysj@hz-kingdee.com>
Date: 星期四, 06 六月 2024 14:43:52 +0800
Subject: [PATCH] Merge branch 'master' of http://101.37.171.70:10101/r/MES-WEB-API

---
 WorkM/流转卡管理/MES_StationInBill.cs |  173 ++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 150 insertions(+), 23 deletions(-)

diff --git "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationInBill.cs" "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationInBill.cs"
index cd5e636..e30106e 100644
--- "a/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationInBill.cs"
+++ "b/WorkM/\346\265\201\350\275\254\345\215\241\347\256\241\347\220\206/MES_StationInBill.cs"
@@ -17,6 +17,7 @@
         {
             InitializeComponent();
         }
+        public DBUtility.frmBillQueryCondition_New frmCondition;
         public string ModName = "3790";
         public string ModCaption = "杩涚珯鎺ユ敹鍗�";
         public const string ModRightName = "MES_StationInBill";
@@ -30,8 +31,9 @@
         public DAL.ClsSc_StationInBill BillNew = new DAL.ClsSc_StationInBill();
         public DAL.ClsSc_StationInBill BillOld = new DAL.ClsSc_StationInBill();
 
-        public Int64 lngBillKey;
-        public Int64 lngBillSubKey;
+        public Int64 HInterID;//涓诲唴鍚�
+        public Int64 lngBillKey; //娴佽浆鍗D
+        public Int64 lngBillSubKey; //娴佽浆鍗″瓙ID
 
         public Int64 lngICMOEntryID;
         //-------------------------------------------------------------------------
@@ -137,6 +139,7 @@
         //鍙栨秷鎸夐挳
         private void cmdCancel_Click(object sender, EventArgs e)
         {
+            ClsPub.SaveGridView(grdSub, Name+"grdSub", ClsPub.AppPath);//璁剧疆鍒楀
             this.Close();
         }
         //鎺т欢浣嶇疆
@@ -150,6 +153,7 @@
         //绐椾綋鍔犺浇
         private void Sc_StationInBill_Load(object sender, EventArgs e)
         {
+            frmCondition = new DBUtility.frmBillQueryCondition_New();
             //鎵撳嵃鍒濆鍖�       
             this.Text = ModCaption;
             this.lblCaption.Text = ModCaption;
@@ -177,7 +181,7 @@
         private void Sc_StationInBill_FormClosing(object sender, FormClosingEventArgs e)
         {
             BillStatus = DBUtility.ClsPub.Enum_BillStatus.BillStatus_AddNew;
-            //DBUtility.Xt_BaseBillFun.SaveGrid(grdMain, this.Name);
+            //DBUtility.Xt_BaseBillFun.SaveGrid(grdSub, this.Name);
             DBUtility.Xt_BaseBillFun.SaveGrid(grdCardList, this.Name + "grdCardList");
         }
         //鏂板鍗曟嵁
@@ -191,11 +195,11 @@
             this.txtHStationInTime.Text = DBUtility.ClsPub.GetServerDate(-1);
 
             this.txtHBillNo.Text = ClsPub.CreateBillCode(BillNew.BillType, ref ClsPub.sExeReturnInfo, true);//寰楀埌鏂板崟鍙�
-
-            if (lngBillKey != 0 )
-            {
-                //LotShow();
-            }
+            this.HInterID = DBUtility.ClsPub.CreateBillID(this.ModName, ref DBUtility.ClsPub.sExeReturnInfo);
+            //if (lngBillKey != 0 )
+            //{
+            //    //LotShow();
+            //}
 
         }
         private void LotShow() //鑷姩杞藉叆 娴佽浆鍗¤繘绔欑晫闈㈠姛鑳�
@@ -413,7 +417,8 @@
             txtHProcNo.Enabled = false;
 
             //鍔犺浇 閰嶄欢缁戝畾娓呭崟
-
+            HInterID = BillOld.omodel.HInterID;
+            DisplaySub();
 
 
 
@@ -561,7 +566,13 @@
                 return false;
             //璧嬪�糏D
             if (BillStatus == DBUtility.ClsPub.Enum_BillStatus.BillStatus_Modify)
+            {
                 BillNew.omodel.HInterID = BillOld.omodel.HInterID;
+            }
+            else
+            {
+                BillNew.omodel.HInterID = HInterID;
+            }
             //涓荤被璧嬪��
             //鍒ゆ柇浼氳鏈熸槸鍚﹀悎鐞�
             string s = "";
@@ -1034,9 +1045,14 @@
                     Sub_WriteInForm_SM2(Ds.Tables[0], i);
                 }
                 //濡傛灉绯荤粺鍙傛暟鍚敤浜� 杩涚珯鍗曠粦瀹氶厤浠舵竻鍗曞垯 浠庣敓浜х敤鏂欐竻鍗曚腑鑾峰彇宸ュ簭BOM鍐欏叆 涓存椂琛紝骞跺姞杞借〃鏍�
-
-                //鍒锋柊琛ㄤ綋缃戞牸鏁版嵁 
-
+                Pub_Class.ClsXt_SystemParameter oParam = new ClsXt_SystemParameter();
+                string sIsBingLine = oParam.GetSingleSystemParameter("MES_StationInBill_LineBindCtl",ref DBUtility.ClsPub.sExeReturnInfo );
+                if (sIsBingLine.Trim() == "Y")
+                {
+                    oCn.RunProc("exec h_p_MES_StationInBillSubBindSource_Insert " + lngBillKey.ToString() + " , " + lngBillSubKey.ToString() + "," + HInterID.ToString() + " ");
+                    //鍒锋柊琛ㄤ綋缃戞牸鏁版嵁
+                    DisplaySub();
+                }
                 //
                 txtHGroupID.Focus();
             }
@@ -1452,18 +1468,129 @@
         //閰嶄欢鏉″舰鐮� 鍥炶溅浜嬩欢
         private void txtHBarCode_Mater_KeyDown(object sender, KeyEventArgs e)
         {
-            if (e.KeyCode == Keys.Return)
+            try
             {
-                //鍏堝垽鏂� 涓存椂琛ㄤ腑鏄惁鏈夋暟鎹�
-
-                //鍒ゆ柇鏉″舰鐮佹槸鍚﹀湪鏉$爜妗f涓�
-
-                //鍒ゆ柇鏉″舰鐮佹槸鍚﹀悎鐞�
-
-                //鍐欏叆 鎵爜璁板綍琛�
-
-                //鍒锋柊琛ㄤ綋缃戞牸鏁版嵁
-
+                if (e.KeyCode == Keys.Return)
+                {
+                    if (txtHBarCode_Mater.Text.Trim() == "")
+                    {
+                        MessageBox.Show("璇疯緭鍏ユ潯褰㈢爜锛�");
+                        return;
+                    }
+                    string sBarCode = txtHBarCode_Mater.Text.Trim();
+                    txtHBarCode_Mater.Text = "";
+                    //鍒ゆ柇鏉″舰鐮佹槸鍚﹀湪鏉$爜妗f涓紝鍒ゆ柇鏉″舰鐮佹槸鍚﹀悎鐞� 
+                    //鍏堝垽鏂� 涓存椂琛ㄤ腑鏄惁鏈夋暟鎹紝鏉″舰鐮佺殑鐗╂枡鏄惁鍦ㄦ竻鍗曚腑锛屽啓鍏� 鎵爜璁板綍琛�
+                    //寰楀埌淇℃伅
+                    SQLHelper.ClsCN oCn = new ClsCN();
+                    DataSet Ds;
+                    Ds = oCn.RunProcReturn("exec h_p_MES_StationInBillSub_BindBarCode   " + HInterID.ToString() + " ,'" + sBarCode + "'", "h_p_MES_StationInBillSub_BindBarCode");
+                    //鍐欏叆淇℃伅
+                    if (Ds == null || Ds.Tables[0].Rows.Count == 0)
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌鏉″舰鐮佷俊鎭紒");
+                        return;
+                    }
+                    else if (DBUtility.ClsPub.isLong(Ds.Tables[0].Rows[0][0]) == 2)
+                    {
+                        MessageBox.Show("閿欒锛�" + DBUtility.ClsPub.isStrNull(Ds.Tables[0].Rows[0][1]));
+                        return;
+                    }
+                    //鍒锋柊琛ㄤ綋缃戞牸鏁版嵁锛堟渶濂介鑹叉樉绀猴級
+                    DisplaySub();
+                }
             }
+            catch (Exception e1)
+            {
+                MessageBox.Show(e1.Message + "txtHBarCode_Mater_KeyDown");
+            }
+        }
+        
+        private void DisplaySub()
+        {
+            try
+            {
+                SQLHelper.ClsCN oCn = new ClsCN();
+                DataSet Dsplay;
+                Dsplay = oCn.RunProcReturn("exec h_p_MES_StationInBillSub_BindDisplay   " + HInterID.ToString() + "  ", "h_p_MES_StationInBillSub_BindDisplay");
+                //鍐欏叆淇℃伅
+                if (Dsplay == null )
+                {
+                    MessageBox.Show("鍒锋柊澶辫触锛�");
+                    return;
+                }
+                else if(Dsplay.Tables[0].Rows.Count == 0)
+                {
+                    return;
+                }
+                else
+                {
+                    //閲婃斁鍐荤粨
+                    DBUtility.Xt_BaseBillFun.CancelFrozenCol(grdSub);
+                    //
+                    grdSub.DataSource = Dsplay.Tables[0].DefaultView;
+                    //璁剧疆鍚堣鍒�
+                    //string sTotalCol = "";
+                    //sTotalCol = DBUtility.Gy_BaseFun.GetTotalCols(DSet);
+                    //string[] sT;
+                    //sT = sTotalCol.Split(Convert.ToChar(","));
+                    //oSumGrid.BuildTotalCols(sT);
+                    //  
+                    //鍐荤粨
+                    int FrCol = DBUtility.ClsPub.isInt(frmCondition.txtFrozenCol.Text);
+                    string s = frmCondition.cmbHComplete.Text;
+                    DBUtility.Xt_BaseBillFun.DisplayGrid(grdSub, this.Name, s, FrCol);
+                    //鐢荤嚎
+                    GraphLine();
+                    //鍐荤粨
+                    //int FrCol = 0;
+                    //string s = "鏄�";
+                    //DBUtility.Xt_BaseBillFun.DisplayGrid(grdSub, this.Name + "grdSub", s, FrCol);
+                }
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show(e.Message + "DisplaySub");
+            }
+        }
+        private void GraphLine()
+        {
+            int MainIDCol = 0;
+            int SubIDCol = 0;
+            string s = frmCondition.cmbHComplete.Text;
+            long n = 0;
+            DBUtility.Xt_BaseBillFun.GraphLine(grdSub, MainIDCol, SubIDCol, s, ref n);
+        }
+
+        private void cmdDelLine_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                //鏍规嵁閫夋嫨鐨勬潯褰㈢爜 鏉ュ垹闄�
+                if (grdSub.CurrentRow == null)
+                    return;
+                string sBarCode = DBUtility.ClsPub.isStrNull(grdSub.Rows[grdSub.CurrentRow.Index].Cells[Fun_GetCol("鏉″舰鐮�")].Value);
+                SQLHelper.ClsCN oCn = new ClsCN();
+                oCn.RunProc(" delete from Sc_StationInBillSub_BindBarCodeTemp " + 
+                    "Where  HInterID = "+ HInterID.ToString() +" and HBarCode = '"+ sBarCode + "'");
+                DisplaySub();
+            }
+            catch (Exception e1)
+            {
+                MessageBox.Show("鍒犻櫎琛屽け璐ワ紒"+e1.Message);
+            }
+
+        }
+
+        private void cmdHbclk_Click(object sender, EventArgs e)
+        {
+            //淇濆瓨鍒楀
+            DBUtility.Xt_BaseBillFun.SaveGrid(grdSub, this.Name);
+        }
+
+        private void cmdHmrlk_Click(object sender, EventArgs e)
+        {
+            DBUtility.Xt_BaseBillFun.DefaultGridView(grdSub, this.Name);
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1