From 4ff37d6fe8333e2da2cfc2c50d6770e217f67e7c Mon Sep 17 00:00:00 2001
From: yxj <1qaz@123>
Date: 星期四, 23 十二月 2021 10:04:57 +0800
Subject: [PATCH] 条码生成模块新增输入源单单号按回车返回源单信息功能,客户为博日且条码类型为批次条码时,最小包装数量默认取源单数量

---
 DAL/源单/Cls_S_Xt_BaseBill.cs          |   57 ++++++++++++++
 WarM/条码打印/Gy_BarCodeBill.designer.cs |   61 +++++++-------
 WarM/条码打印/Gy_BarCodeBill.cs          |  118 +++++++++++++++++++++++++++++
 3 files changed, 203 insertions(+), 33 deletions(-)

diff --git "a/DAL/\346\272\220\345\215\225/Cls_S_Xt_BaseBill.cs" "b/DAL/\346\272\220\345\215\225/Cls_S_Xt_BaseBill.cs"
index 2c3f12d..027945d 100644
--- "a/DAL/\346\272\220\345\215\225/Cls_S_Xt_BaseBill.cs"
+++ "b/DAL/\346\272\220\345\215\225/Cls_S_Xt_BaseBill.cs"
@@ -25,7 +25,8 @@
         public string sOrderSql2 = "";
         public string sKeyCol2 = "";
         public string sShowItemSql2 = "";
-        public DAL.frmHlpBillList oFrm = new DAL.frmHlpBillList();
+        public frmHlpBillList oFrm;
+        //public DAL.frmHlpBillList oFrm = new DAL.frmHlpBillList();
         public List<DBUtility.BillSelect> oBillSelectColl = new List<DBUtility.BillSelect>();
         public List<DBUtility.BillSelect_A3> oBillSelectColl2 = new List<DBUtility.BillSelect_A3>();
         //
@@ -53,6 +54,7 @@
             tSQL = sWhere + sCondtion + sOrderSql;
             try
             {
+                oFrm = new frmHlpBillList();
                 oFrm.sPrimaryCol = sKeyCol;
                 oFrm.Text = mvarReportTitle;
                 oFrm.lblCaption.Text = mvarReportTitle;
@@ -112,6 +114,7 @@
             tSQL = sWhere + sCondtion2 + sOrderSql2;
             try
             {
+                oFrm = new frmHlpBillList();
                 oFrm.sPrimaryCol = sKeyCol2;
                 oFrm.Text = mvarReportTitle2;
                 oFrm.lblCaption.Text = mvarReportTitle2;
@@ -168,6 +171,7 @@
             tSQL = sWhere + sCondtion2 + sOrderSql2;
             try
             {
+                oFrm = new frmHlpBillList();
                 oFrm.sPrimaryCol = sKeyCol2;
                 oFrm.Text = mvarReportTitle2;
                 oFrm.lblCaption.Text = mvarReportTitle2;
@@ -257,6 +261,7 @@
             tSQL = sWhere + sCondtion + sOrderSql;
             try
             {
+                oFrm = new frmHlpBillList();
                 oFrm.sPrimaryCol = sKeyCol;
                 oFrm.Text = mvarReportTitle;
                 oFrm.lblCaption.Text = mvarReportTitle;
@@ -295,6 +300,56 @@
             return true;
         }
 
+        //鏍规嵁婧愬崟鍙� 妯℃嫙鏌ヨ鏁版嵁
+        /// <summary>
+        /// 鏄剧ず鏁版嵁
+        /// </summary>
+        /// <param name="sWhere">涓籗QL</param>
+        /// <param name="sCondtion">杩囨护鏉′欢</param>
+        /// <param name="sOrderSql">鎺掑簭鏉′欢</param>
+        /// <param name="sKeyCol">涓嶅彲閲嶅鍒�</param>
+        /// <returns></returns>
+        public virtual bool RefreshBySourceBillNo(string sWhere)
+        {
+            string sErr = "";
+            string tSQL;
+            ClsCN oCn = new ClsCN();
+            tSQL = " select hmainid,hsubid,鍗曟嵁鍙� from " + ViewName + sWhere + sOrderSql;
+            try
+            {
+                DataSet ds = oCn.RunProcReturn(tSQL, ViewName, ref DBUtility.ClsPub.sExeReturnInfo);
+                if (ds == null || ds.Tables[0].Rows.Count == 0)
+                {
+                    return false;
+                }
+                //杩斿洖鏁版嵁鍒伴泦鍚堜腑
+                oBillSelectColl.Clear();
+
+                //寰幆 閫変腑琛�
+                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
+                {
+                    BillSelect oSelect = new BillSelect();
+                    oSelect.BillNo = ClsPub.isStrNull(ds.Tables[0].Rows[i]["鍗曟嵁鍙�"]);
+                    oSelect.BillMainID = ClsPub.isLong(ds.Tables[0].Rows[i]["hmainid"]);
+                    oSelect.BillSubID = ClsPub.isLong(ds.Tables[0].Rows[i]["hsubid"]);
+                    oSelect.BillTitle = mvarReportTitle;
+                    oSelect.BillType = mvarItemKey;
+                    oBillSelectColl.Add(oSelect);
+                }
+                //
+                if (oBillSelectColl.Count > 0)
+                    return true;
+                else
+                    return false;
+            }
+            catch (Exception e)
+            {
+                sErr = e.Message;
+            }
+            return true;
+        }
+
+
 
     }
 }
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
index bf863fe..7987c2b 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.cs"
@@ -1832,7 +1832,14 @@
             //grdMain.Rows[i].Cells[HSourceNumberCol].Value = oTable.Rows[0]["鐢熶骇绾夸唬鐮�"].ToString();
             grdMain.Rows[i].Cells[HSourceNameCol].Value = oTable.Rows[0]["鐢熶骇绾�"].ToString();
             grdMain.Rows[i].Cells[HEndDateCol].Value = oTable.Rows[0]["璁″垝瀹屽伐鏃ユ湡"].ToString();
-            grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString();
+            if (cmbHBarCodeType.Text == "鎵规鏉$爜" && CampanyName == "鍗氭棩绉戞妧")
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["鏈敓鎴愭潯鐮佹暟閲�"]);
+            }
+            else
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString();
+            }
             //--
             //璁剧疆鍙紪杈戝垪
             string sAllowCol = HQtyCol.ToString() +
@@ -1882,7 +1889,14 @@
             grdMain.Rows[i].Cells[HUnitNameCol].Value = oTable.Rows[0]["璁¢噺鍗曚綅"].ToString();
             grdMain.Rows[i].Cells[HRemarkCol].Value = oTable.Rows[0]["澶囨敞"].ToString();
             grdMain.Rows[i].Cells[HMTONoCol].Value = oTable.Rows[0]["璁″垝璺熻釜鍙�"].ToString();
-            grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString(); 
+            if (cmbHBarCodeType.Text == "鎵规鏉$爜" && CampanyName == "鍗氭棩绉戞妧")
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = ClsPub.isDoule(oTable.Rows[0]["鏈敓鎴愭潯鐮佹暟閲�"]);
+            }
+            else
+            {
+                grdMain.Rows[i].Cells[HMinQtyCol].Value = oTable.Rows[0]["鏈�灏忓寘瑁呮暟"].ToString();
+            }
             grdMain.Rows[i].Cells[HMakerCol].Value = ClsPub.CurUserName;
             if (cmbSourceBillType.Text.Trim() == "鏀舵枡閫氱煡鍗�"|| cmbSourceBillType.Text.Trim() == "閲囪喘璁㈠崟"
                 || cmbSourceBillType.Text.Trim() == "濮斿璁㈠崟" || cmbSourceBillType.Text.Trim() == "閲囪喘鍏ュ簱鍗�")
@@ -2505,6 +2519,106 @@
             }
         }
 
+        private void txtHSourceBillNo_KeyPress(object sender, KeyPressEventArgs e)
+        {
+            if (e.KeyChar == (char)Keys.Return)//鍥炶溅甯﹀嚭婧愬崟淇℃伅
+            {
+                long sHOrgID = -1;
+                DAL.ClsGy_ORGANIZATIONS_View oClsGy_ORGANIZATIONS_View = new DAL.ClsGy_ORGANIZATIONS_View();
+                if (oClsGy_ORGANIZATIONS_View.GetInfoByName(cmbHOrgID.Text))
+                {
+                    sHOrgID = oClsGy_ORGANIZATIONS_View.omodel.HItemID;
+                }
+
+                if (txtHSourceBillNo.Text.Length < 4)
+                {
+                    MessageBox.Show("璇疯緭鍏�4浣嶄互涓婃暟鎹紒");
+                    return;
+                }
+                //鏍规嵁婧愬崟绫诲瀷 鍜屾簮鍗曞彿 鑾峰彇淇℃伅
+                if (cmbSourceBillType.Text.Trim() == "鐢熶骇璁㈠崟")
+                {
+                    DAL.Cls_S_IFCLD_ICMOList oIFCLD_ICMOList = new DAL.Cls_S_IFCLD_ICMOList();
+                    if (oIFCLD_ICMOList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' and HOrgID =" + sHOrgID.ToString()))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIFCLD_ICMOList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "鐢熶骇姹囨姤鍗�")
+                {
+                    DAL.Cls_S_IF_ICMOReportBillList oIF_ICMOReportBillList = new DAL.Cls_S_IF_ICMOReportBillList();
+                    if (oIF_ICMOReportBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_ICMOReportBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "鏀舵枡閫氱煡鍗�")
+                {
+                    DAL.Cls_S_IF_POInStockBillList oIF_POInStockBillList = new DAL.Cls_S_IF_POInStockBillList();
+                    if (oIF_POInStockBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_POInStockBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "閲囪喘璁㈠崟")
+                {
+                    DAL.Cls_S_IF_POOrderBillList oIF_POOrderBillList = new DAL.Cls_S_IF_POOrderBillList();
+                    if (oIF_POOrderBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_POOrderBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else if (cmbSourceBillType.Text.Trim() == "濮斿璁㈠崟")
+                {
+                    DAL.Cls_S_IF_EntrustOrderBillList oIF_EntrustOrderBillList = new DAL.Cls_S_IF_EntrustOrderBillList();
+                    if (oIF_EntrustOrderBillList.RefreshBySourceBillNo(" Where 鍗曟嵁鍙� like '%" + txtHSourceBillNo.Text + "' "))  //閫夋嫨鍘熷崟
+                    {
+                        FillSelectData(oIF_EntrustOrderBillList.oBillSelectColl);
+                        txtHSourceBillNo.Text = "";
+                    }
+                    else
+                    {
+                        MessageBox.Show("鏈煡璇㈠埌浠诲姟鏁版嵁锛岃纭鎵�閫夌粍缁囥�佹簮鍗曠被鍨嬩笌婧愬崟鍗曞彿鏄惁姝g‘锛�");
+                        return;
+                    }
+                }
+                else
+                {
+                    MessageBox.Show("鎵�閫夋簮鍗曠被鍨嬶紝涓嶆敮鎸佹鍔熻兘锛�");
+                    return;
+                }
+
+            }
+        }
+
+
+
+
+
 
     }
 }
\ No newline at end of file
diff --git "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.designer.cs" "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.designer.cs"
index c63493e..167abf2 100644
--- "a/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.designer.cs"
+++ "b/WarM/\346\235\241\347\240\201\346\211\223\345\215\260/Gy_BarCodeBill.designer.cs"
@@ -51,6 +51,8 @@
             this.tb = new System.Windows.Forms.ToolStripButton();
             this.toolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
             this.gl = new System.Windows.Forms.ToolStripButton();
+            this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
+            this.BatchNo = new System.Windows.Forms.ToolStripButton();
             this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
             this.tc = new System.Windows.Forms.ToolStripButton();
             this.lblCaption = new System.Windows.Forms.Label();
@@ -67,7 +69,7 @@
             this.label1 = new System.Windows.Forms.Label();
             this.cmdHEmpID = new System.Windows.Forms.Button();
             this.cmdSourceBillNo = new System.Windows.Forms.Button();
-            this.textBox2 = new System.Windows.Forms.TextBox();
+            this.txtHSourceBillNo = new System.Windows.Forms.TextBox();
             this.label14 = new System.Windows.Forms.Label();
             this.cmbSourceBillType = new System.Windows.Forms.ComboBox();
             this.label10 = new System.Windows.Forms.Label();
@@ -104,8 +106,6 @@
             this.grdSub = new System.Windows.Forms.DataGridView();
             this.tabPage3 = new System.Windows.Forms.TabPage();
             this.grdList = new System.Windows.Forms.DataGridView();
-            this.BatchNo = new System.Windows.Forms.ToolStripButton();
-            this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
             this.Tool.SuspendLayout();
             this.P1.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.pic1)).BeginInit();
@@ -374,6 +374,25 @@
             this.gl.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
             this.gl.Click += new System.EventHandler(this.gl_Click);
             // 
+            // toolStripSeparator7
+            // 
+            this.toolStripSeparator7.Name = "toolStripSeparator7";
+            this.toolStripSeparator7.Size = new System.Drawing.Size(6, 50);
+            // 
+            // BatchNo
+            // 
+            this.BatchNo.AutoSize = false;
+            this.BatchNo.Image = ((System.Drawing.Image)(resources.GetObject("BatchNo.Image")));
+            this.BatchNo.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.BatchNo.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+            this.BatchNo.ImageTransparentColor = System.Drawing.Color.White;
+            this.BatchNo.Name = "BatchNo";
+            this.BatchNo.Size = new System.Drawing.Size(36, 47);
+            this.BatchNo.Text = "鎵规";
+            this.BatchNo.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
+            this.BatchNo.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
+            this.BatchNo.Click += new System.EventHandler(this.BatchNo_Click);
+            // 
             // toolStripSeparator3
             // 
             this.toolStripSeparator3.Name = "toolStripSeparator3";
@@ -438,7 +457,7 @@
             this.gbUp.Controls.Add(this.label1);
             this.gbUp.Controls.Add(this.cmdHEmpID);
             this.gbUp.Controls.Add(this.cmdSourceBillNo);
-            this.gbUp.Controls.Add(this.textBox2);
+            this.gbUp.Controls.Add(this.txtHSourceBillNo);
             this.gbUp.Controls.Add(this.label14);
             this.gbUp.Controls.Add(this.cmbSourceBillType);
             this.gbUp.Controls.Add(this.label10);
@@ -547,13 +566,14 @@
             this.cmdSourceBillNo.UseVisualStyleBackColor = true;
             this.cmdSourceBillNo.Click += new System.EventHandler(this.cmdSourceBillNo_Click);
             // 
-            // textBox2
+            // txtHSourceBillNo
             // 
-            this.textBox2.ImeMode = System.Windows.Forms.ImeMode.NoControl;
-            this.textBox2.Location = new System.Drawing.Point(394, 46);
-            this.textBox2.Name = "textBox2";
-            this.textBox2.Size = new System.Drawing.Size(166, 21);
-            this.textBox2.TabIndex = 41;
+            this.txtHSourceBillNo.ImeMode = System.Windows.Forms.ImeMode.NoControl;
+            this.txtHSourceBillNo.Location = new System.Drawing.Point(394, 46);
+            this.txtHSourceBillNo.Name = "txtHSourceBillNo";
+            this.txtHSourceBillNo.Size = new System.Drawing.Size(166, 21);
+            this.txtHSourceBillNo.TabIndex = 41;
+            this.txtHSourceBillNo.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtHSourceBillNo_KeyPress);
             // 
             // label14
             // 
@@ -965,25 +985,6 @@
             this.grdList.Size = new System.Drawing.Size(929, 288);
             this.grdList.TabIndex = 46;
             // 
-            // BatchNo
-            // 
-            this.BatchNo.AutoSize = false;
-            this.BatchNo.Image = ((System.Drawing.Image)(resources.GetObject("BatchNo.Image")));
-            this.BatchNo.ImageAlign = System.Drawing.ContentAlignment.BottomCenter;
-            this.BatchNo.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
-            this.BatchNo.ImageTransparentColor = System.Drawing.Color.White;
-            this.BatchNo.Name = "BatchNo";
-            this.BatchNo.Size = new System.Drawing.Size(36, 47);
-            this.BatchNo.Text = "鎵规";
-            this.BatchNo.TextAlign = System.Drawing.ContentAlignment.BottomCenter;
-            this.BatchNo.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText;
-            this.BatchNo.Click += new System.EventHandler(this.BatchNo_Click);
-            // 
-            // toolStripSeparator7
-            // 
-            this.toolStripSeparator7.Name = "toolStripSeparator7";
-            this.toolStripSeparator7.Size = new System.Drawing.Size(6, 50);
-            // 
             // Gy_BarCodeBill
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@@ -1068,7 +1069,7 @@
         private System.Windows.Forms.Label label10;
         private System.Windows.Forms.ComboBox cmbSourceBillType;
         private System.Windows.Forms.Button cmdSourceBillNo;
-        private System.Windows.Forms.TextBox textBox2;
+        private System.Windows.Forms.TextBox txtHSourceBillNo;
         private System.Windows.Forms.Label label14;
         private System.Windows.Forms.ToolStripButton tc;
         private System.Windows.Forms.ToolStripSeparator toolStripSeparator12;

--
Gitblit v1.9.1