From f3e1b2eac8a806b3ae8d5a8854d694204e2468ad Mon Sep 17 00:00:00 2001
From: zzr99 <1940172413@qq.com>
Date: 星期五, 25 三月 2022 10:58:44 +0800
Subject: [PATCH] 墙咔装箱2.0

---
 WarM/条码打印/Sc_ICMOToBarCode.cs |  124 +++++++++++++++++++++++++++++++++--------
 1 files changed, 100 insertions(+), 24 deletions(-)

diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
index 5f5cfa8..0129631 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Sc_ICMOToBarCode.cs"
@@ -111,8 +111,21 @@
                 MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,璇峰湪杩囨护妗嗕腑鐐瑰嚮銆愭仮澶嶃�戞寜閽�,灏濊瘯鍐嶆鏌ヨ锛�" + DBUtility.ClsPub.sExeReturnInfo);
                 return;
             }
+            else 
+            {
+                grdMain.DataSource = DSet.Tables[0].DefaultView;
+                //鎶婂綋鍓嶅崟鎹甀D 瀛樺埌涓�涓寜閽噷闈�   鍒锋柊鏃舵瘡娆″瓨涓�閬�
+                if (DSet.Tables[0].Rows.Count > 0)
+                {
+                    txtHMaterID.Tag = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells["HInterID"].Value);
+                }
+                else
+                {
+                    
+                }
+            }
             //
-            grdMain.DataSource = DSet.Tables[0].DefaultView;
+            
 
             //鏍囧噯瑁呯
             //for (int i = 0; i < grdMain.SelectedRows.Count; i++)
@@ -482,13 +495,13 @@
         private void Sub_SetReport(string sOpenTmp)
         {
             //鍒ゆ柇琛屾暟
-            for (int i = 0; i < grdMain.Rows.Count; i++)
+            for (int i = 0; i < grdList.Rows.Count; i++)
             {
-                grdMain.Rows[i].Cells[0].Value = "";
+                grdList.Rows[i].Cells[0].Value = "";
             }
-            for (int i = 0; i < grdMain.SelectedRows.Count; i++)
+            for (int i = 0; i < grdList.SelectedRows.Count; i++)
             {
-                grdMain.Rows[grdMain.SelectedRows[i].Index].Cells[0].Value = "*";
+                grdList.Rows[grdMain.SelectedRows[i].Index].Cells[0].Value = "*";
             }
             //
             Report = new GridppReport();
@@ -529,7 +542,7 @@
             try
             {
                 DataTable ds = new DataTable();
-                BLL.Utility.FillRecordToReport_Sel(Report, grdMain, ds, Fun_GetCol("閫夋嫨"));
+                BLL.Utility.FillRecordToReport_Sel(Report, grdList, ds, Fun_GetCol("閫夋嫨"));
             }
             catch (Exception e)
             {
@@ -818,13 +831,24 @@
                 //鐢熸垚涓�涓绠辩爜
                 string sPackStr = "ZXM" + HYear + HPeriod + HDay; //澶栫鐮� 鍓嶇紑
                 DataSet  DsTM = oCn.RunProcReturn("exec h_p_WMS_GetMaxNo '" + sPackStr + "'", "h_p_WMS_GetMaxNo");    //鑾峰彇鏈�澶ф祦姘村彿                                                                                          //oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sTMNumber + "'");
-                Int64 TTM_LSH = ClsPub.isLong(DsTM.Tables[0].Rows[0][0]) + 1;
-                string sPackBarCode = sPackStr + LSH.ToString();
+                Int64 TTM_LSH = ClsPub.isInt(DsTM.Tables[0].Rows[0][0]) + 1;
+                string sPackBarCode = sPackStr + TTM_LSH.ToString();
                 oCn.RunProc("exec h_p_WMS_SetMaxNo '" + sPackStr + "'");
-                
+
+
+                //MessageBox.Show("11");
+                oCn.RunProc("insert into Sc_PackUnionBillMain (HYear,HPeriod,HBillType,HInterID,HDate" +
+                                   ",HBillNo,HBillStatus,HICMOBillNo,HBarCode_Pack,HMaterID,HUnitID,HWeight" +
+                                   ",HPWeight,HProdOrgID,HDeptID,HEmpID,HSNum,HPackNum,HBarCode_Cus,HBatchNo " +
+                                   ") values ("
+                                   + HYear + "," + HPeriod + ",'3783'," + HInterID_TTM + ",'" + HDate + "'"
+                                   + ", '" + sPackBarCode.ToString() + "',1,'','" + sPackBarCode.ToString() + "',0,0,0"
+                                   + ",0,1,0,0,0,0,'','')");
+                //MessageBox.Show("12");
+           
                 //1.寰幆缃戞牸锛屾牴鎹� 鏈鏁伴噺 鍒�  鐢熸垚 鍞竴鐮�
-               
-                for (int j = 0; j < grdMain.Rows.Count; j++)
+
+            for (int j = 0; j < grdMain.Rows.Count; j++)
                 {
                     if (DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鏈鏁伴噺")].Value) > 0)
                     {
@@ -836,7 +860,7 @@
 
                         //HBQty = HBQty + ClsPub.isInt(txtHBQty.Text);
                         HZXQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鏈鏁伴噺")].Value);
-                        HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("璁㈠崟鏁伴噺")].Value);
+                        HDDQty = DBUtility.ClsPub.isDoule(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鏁伴噺")].Value);
                         HICMOBillNo = DBUtility.ClsPub.isStrNull(grdMain.Rows[j].Cells[Fun_GetCol("鐢熶骇璁㈠崟鍙�")].Value);
 
                         HTMNumber = HOrgNumber + HMaterNumber + HYear + HPeriod + HDay;
@@ -932,6 +956,7 @@
                                             + ",'" + HMaterName + "','" + HMaterModel + "','" + HPinfan + "'," + HAuxPropID.ToString() + ",'" + HMTONo + "','" + HInnerBillNo + "')");
 
                         oCn.RunProc("exec h_p_WMS_SetMaxNo '" + HTMNumber + "'");
+                        DisplayTM();
                     }
                 }
                 //2.寰幆缁撴潫鍚庯紝鏍规嵁 鏈鐢熸垚鐨� 涓诲唴鐮侊紝浠庡悗鍙版暟鎹簱鑾峰彇 鏉$爜鍒楄〃锛岀敓鎴� 缁勬墭鍗� 鍜� 鎵樻潯鐮侊紝 鐩存帴璋冪敤瀛樺偍杩囩▼ 
@@ -942,9 +967,22 @@
 
 
 
-
-
+                sPackBarCode = "";
+                DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " and 鏉$爜绫诲瀷 = '鎵樼洏鏉$爜' order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo);
+                //鐢熸垚棣栬鏍囬
+                if (DSet == null)
+                {
+                    MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
+                    return;
+                }
+                //
+                grdList.DataSource = DSet.Tables[0].DefaultView;
+                //鍐荤粨
+                int FrCol = 0;
+                string s = "鏄�";
+                DBUtility.Xt_BaseBillFun.DisplayGrid(grdList, this.Name + "grdList", s, FrCol);
                 oCn.Commit();
+                //DisplayTM();
                 MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
                
 
@@ -958,9 +996,10 @@
 
                 //
                 Display();
+               
 
             }
-            catch(Exception e )
+            catch (Exception e )
             {
                 //鍥炴粴浜嬪姟
 
@@ -971,6 +1010,7 @@
 
         private void button4_Click(object sender, EventArgs e)
         {
+            
             //鏍规嵁鏈鏁伴噺 鏉� 鍒嗛厤鍒� 姣忎釜鐢熶骇璁㈠崟涓婏紙鍒嗛厤鏃� 瑕佽�冭檻 璁㈠崟鍓╀綑鏁伴噺宸茬粡鏄� 璐熸暟鐨勬儏鍐碉級
             //1.鍒ゆ柇鏈鏁伴噺 蹇呴』澶т簬0
             double HZXQty = 0;//鏁寸鏁伴噺
@@ -1461,10 +1501,21 @@
                                         + ",'3710'," + HMaterID1.ToString() + "," + HUnitID.ToString() + "," + HQty2.ToString() + ",0,0,0"
                                         + ", 0,getdate(),'" + HBarCode + "','" + TTM + "',0,0)");
 
+                    DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HInterID=" + HInterID.ToString() + " and HBarCode like '%ZXM&' order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo);
+                    //鐢熸垚棣栬鏍囬
+                    if (DSet == null)
+                    {
+                        MessageBox.Show("娌℃湁杩斿洖浠讳綍缁撴灉,鏉$爜涓嶅瓨鍦紒" + DBUtility.ClsPub.sExeReturnInfo);
+                        return;
+                    }
+                    //
+                    grdList.DataSource = DSet.Tables[0].DefaultView;
+
                     oCn.Commit();
                     MessageBox.Show("鏉$爜鐢熸垚瀹屾瘯锛�");
                     //grdSub.RowCount = 0;
-                    DisplayTM();
+                    //DisplayTM();
+                   
                 }
                 catch (Exception e1)
                 {
@@ -1478,7 +1529,8 @@
 
         private void DisplayTM()
         {
-            DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo);
+            //HInterID = DBUtility.ClsPub.isInt(txtHMaterID.Tag);
+            DataSet DSet = oCn.RunProcReturn("select * from h_v_IF_BarCodeBillList Where HinterID=" + HInterID.ToString() + " and 鏉$爜绫诲瀷 = '鎵樼洏鏉$爜' order by HItemID", "h_v_IF_BarCodeBillList", ref DBUtility.ClsPub.sExeReturnInfo);
             //鐢熸垚棣栬鏍囬
             if (DSet == null)
             {
@@ -1649,19 +1701,32 @@
 
         private void cmdHSourceID_Click(object sender, EventArgs e)
         {
-            DAL.ClsGy_WorkCenter_View oWork = new DAL.ClsGy_WorkCenter_View();
-            if (oWork.RefreshView())
+            DAL.ClsGy_Source_View oSource = new DAL.ClsGy_Source_View();
+            if (oSource.RefreshView())
             {
-                this.txtHSourceID.Text = oWork.oModel.HName;
-                this.txtHSourceID.Tag = oWork.oModel.HItemID.ToString();
+                this.txtHSourceID.Text = oSource.oModel.HName;
+                this.txtHSourceID.Tag = oSource.oModel.HItemID.ToString();
                 //
                 Display();
-                //
             }
             else
             {
                 this.txtHSourceID.Text = "";
             }
+
+            //DAL.ClsGy_WorkCenter_View oWork = new DAL.ClsGy_WorkCenter_View();
+            //if (oWork.RefreshView())
+            //{
+            //    this.txtHSourceID.Text = oWork.oModel.HName;
+            //    this.txtHSourceID.Tag = oWork.oModel.HItemID.ToString();
+            //    //
+            //    Display();
+            //    //
+            //}
+            //else
+            //{
+            //    this.txtHSourceID.Text = "";
+            //}
         }
 
         private void cmdHEmpID_Click(object sender, EventArgs e)
@@ -1838,20 +1903,31 @@
         {
             //鑾峰彇缃戞牸绗竴琛孒InterID鐨勫��
             Int64 HInterID = 0;
-            HInterID = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells[Fun_GetCol("HInterID")].Value);
+            HInterID = DBUtility.ClsPub.isInt(txtHMaterID.Tag);
             DataSet DSBefore;
             DSBefore =  SubCn.RunProcReturn("exec h_p_PreviousMater "+ HInterID, "h_p_PreviousMater", ref DBUtility.ClsPub.sExeReturnInfo);
             grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+            if (DSBefore.Tables[0].Rows.Count > 0)
+            {
+                txtHMaterID.Tag = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells["HInterID"].Value);
+            }
+            else
+            {
+
+            }
         }
 
         private void button3_Click(object sender, EventArgs e)
         {
             //鏍规嵁
             Int64 HInterID = 0;
-            HInterID = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells[Fun_GetCol("HInterID")].Value);
+            //HInterID = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells[Fun_GetCol("HInterID")].Value);
+            HInterID = DBUtility.ClsPub.isInt(txtHMaterID.Tag);
             DataSet DSBefore;
             DSBefore = SubCn.RunProcReturn("exec h_p_NextMater " + HInterID, "h_p_NextMater", ref DBUtility.ClsPub.sExeReturnInfo);
             grdMain.DataSource = DSBefore.Tables[0].DefaultView;
+            txtHMaterID.Tag = DBUtility.ClsPub.isInt(grdMain.Rows[0].Cells["HInterID"].Value);
+            txtHMaterID.Text = DBUtility.ClsPub.isStrNull(grdMain.Rows[0].Cells["HInterID"].Value);
         }
 
         //瓒呴鎵撳嵃

--
Gitblit v1.9.1