duhe
2024-04-30 8392ea7db9ad3d7cbddba1b880bb133e4f7aa5c0
托盘条码自动生成:临时组托
2个文件已修改
204 ■■■■■ 已修改文件
WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/条码打印/Gy_PackBarCodeBill_automaticallyByPLC.cs 189 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/ÌõÂë´òÓ¡/Gy_PackBarCodeBill_automaticallyByPLC.Designer.cs
@@ -34,6 +34,7 @@
            this.tabControl_MainInfo = new System.Windows.Forms.TabControl();
            this.tabPage_BillInfo = new System.Windows.Forms.TabPage();
            this.gbUp = new System.Windows.Forms.GroupBox();
            this.button_produceTemp = new System.Windows.Forms.Button();
            this.label_sBillNo = new System.Windows.Forms.Label();
            this.textBox_sBillNo = new System.Windows.Forms.TextBox();
            this.label_sBillID = new System.Windows.Forms.Label();
@@ -121,6 +122,7 @@
            // gbUp
            // 
            this.gbUp.BackColor = System.Drawing.Color.Transparent;
            this.gbUp.Controls.Add(this.button_produceTemp);
            this.gbUp.Controls.Add(this.label_sBillNo);
            this.gbUp.Controls.Add(this.textBox_sBillNo);
            this.gbUp.Controls.Add(this.label_sBillID);
@@ -149,6 +151,16 @@
            this.gbUp.Size = new System.Drawing.Size(1374, 310);
            this.gbUp.TabIndex = 33;
            this.gbUp.TabStop = false;
            //
            // button_produceTemp
            //
            this.button_produceTemp.Location = new System.Drawing.Point(829, 215);
            this.button_produceTemp.Name = "button_produceTemp";
            this.button_produceTemp.Size = new System.Drawing.Size(158, 70);
            this.button_produceTemp.TabIndex = 123;
            this.button_produceTemp.Text = "临时组托";
            this.button_produceTemp.UseVisualStyleBackColor = true;
            this.button_produceTemp.Click += new System.EventHandler(this.button_produceTemp_Click);
            // 
            // label_sBillNo
            // 
@@ -287,11 +299,11 @@
            // textBox_HPackBarCode
            // 
            this.textBox_HPackBarCode.BackColor = System.Drawing.SystemColors.ScrollBar;
            this.textBox_HPackBarCode.Enabled = false;
            this.textBox_HPackBarCode.Location = new System.Drawing.Point(122, 81);
            this.textBox_HPackBarCode.Name = "textBox_HPackBarCode";
            this.textBox_HPackBarCode.Size = new System.Drawing.Size(280, 28);
            this.textBox_HPackBarCode.TabIndex = 43;
            this.textBox_HPackBarCode.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox_HPackBarCode__KeyPress);
            // 
            // dtpHDate
            // 
@@ -744,5 +756,6 @@
        private System.Windows.Forms.ToolStripSeparator toolStripSeparator10;
        private System.Windows.Forms.ToolStripButton tc;
        private System.Windows.Forms.ToolStripButton toolStripButton_Delete;
        private System.Windows.Forms.Button button_produceTemp;
    }
}
WarM/ÌõÂë´òÓ¡/Gy_PackBarCodeBill_automaticallyByPLC.cs
@@ -1163,9 +1163,196 @@
            }
        }
        #endregion
        #region ä¸´æ—¶ç»„托
        #region ä¸´æ—¶ç»„托 æŒ‰é’®ç‚¹å‡»äº‹ä»¶
        private void button_produceTemp_Click(object sender, EventArgs e)
        {
            if (HQty == 0)
            {
                MessageBox.Show("请扫码子条码!");
                return;
            }
            this.produceTemp();
            //设置打印模板,打印
            grdSub.Rows[0].Cells[0].Value = "*";
            Report = new GridppReport();
            Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + "_Temp" + ".grf");  //here .
            Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord);
            Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable);
            Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd);
            if (comboBox_PrinterParams.Text != "")
            {
                Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(默认)", "");
            }
            Report.Print(false);
        }
        #endregion
        #region ä¸´æ—¶ç»„托
        private void produceTemp()
        {
            //判断条码档案中是否已经存在该托条码,若存在,则不需要再创建。重新加载界面即可。
            DataSet ds_getPackBarCode;
            string sql_getPackBarCode = "select * from Gy_BarCodeBill where HBarCode = '" + textBox_HPackBarCode.Text + "'";
            ds_getPackBarCode = oCn.RunProcReturn(sql_getPackBarCode, "Gy_BarCodeBill");
            if (ds_getPackBarCode != null && ds_getPackBarCode.Tables[0].Rows.Count > 0)
            {
                //重新加载界面
                getDisplay_grdSub();
                setPackBarCodeBillData();
                getDisplay_GrdMain();
                return;
            }
            //获取组织信息
            HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
            HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
            //验证组织
            if (HOrgID == -1)
            {
                MessageBox.Show("选择组织有错误!");
                return;
            }
            //单据完整性判断
            if (!Sub_AllowSave())
            {
                return;
            }
            //获取当前产线及产线内码
            long HSourceID = 0;
            string sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "' ";
            DataSet ds = oCn.RunProcReturn(sql, "Gy_Source");
            if (ds != null && ds.Tables[0].Rows.Count > 0)
            {
                HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
            }
            //拼接临时组托时,托条码的生成语句
            sSQLMul = new string[2];
            sSQLMul[0] = "insert into Gy_BarCodeBill (HBarCode,HBarCodeType,HMaterID,HUnitID,HQty" +
                            ",HBatchNo,HSupID,HGroupID,HMaker,HMakeDate,HPrintQty,HinitQty" +
                            ",HSourceInterID,HSourceEntryID,HSourceBillNo,HSourceBillType,HEndQty " +
                            ",HBarcodeQtys,HBarcodeNo,HDeptID,HWhID,HSPID,HRemark " +
                            ",HCusID,HCusType,HEndDate,HWorkLineName,HJiaYe " +
                            ",HPressModel,HCusModel,HMaterialModel,HColor,HBarCodeDate " +
                            ",HLogo,HPackageSize,HMaterialJQty,HMaterialMQty,HCustomBatchNo " +
                            ",HSTOCKORGID,HOWNERID,HBeginDate,HSeOrderBillNo,HGBBarCode " +
                            ",POOrderBillNo,HInterID,HInitSourceEntryID,HBarCode_Pack " +
                            ",HMaterName,HMaterModel,HPinfan,HAuxPropID,HMTONo " +
                            ",HCustomQty1,HLayerNumber,HCusBarCode,HBarCodeStatus,HSourceID " +
                            ") values ("
                            + "'" + textBox_HPackBarCode.Text + "','" + HBarCodeType + "',0,0,1"
                            + ",'',0,0,'" + ClsPub.CurUserName + "',getdate(),0,1"
                            + ",0,0,'','',''"
                            + "," + HQty.ToString() + ",1,0,0,0,''"
                            + ",0,'','','',''"
                            + ",'','','','','" + sDate + "'"
                            + ",'','',0,0,''"
                            + "," + HOrgID.ToString() + "," + HOrgID.ToString() + ",'','',''"
                            + ",''," + HInterID.ToString() + ",0,'" + textBox_HPackBarCode.Text + "'"
                            + ",'','','',0,''"
                            + ",0,0,'',''," + HSourceID +
                            ")";
            //拼接 æ›´æ–° æ‰˜æ¡ç æµæ°´å· çš„sql语句
            sSQLMul[1] = " exec h_p_WMS_SetMaxNo_QTY '" + sTMNumber + "'," + HQty.ToString() + " ";
            if (sSQLMul.Length > 0)
            {
                //执行托条码的生成语句与托条码流水号的更新语句
                for (int i = 0; i < 1; i++)
                {
                    oCn.RunProc(sSQLMul[i]);
                }
                //重新加载界面
                getDisplay_grdSub();
                setPackBarCodeBillData();
                getDisplay_GrdMain();
            }
            else
            {
                MessageBox.Show("没有数据!");
                return;
            }
        }
        #endregion
        #region æ‰˜æ¡ç  æ‰«ç 
        private void textBox_HPackBarCode__KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)Keys.Return)
            {
                //获取扫描的托条码
                string HPackBarCode = textBox_HPackBarCode.Text;
                //条码类型
                HBarCodeType = ClsPub.isStrNull(cmbHBarCodeType.Text);
                //获取组织信息
                HOrgID = get_ORGANIZATIONSIDByName(cmbHOrgID.Text);
                HOrgNumber = get_ORGANIZATIONSNOByName(cmbHOrgID.Text);
                //声明用于数据库查询的变量
                string sql = "";
                DataSet ds;
                //判断 æ‰˜æ¡ç æ˜¯å¦å·²ç»ç”Ÿæˆç»„托单
                sql = "select * from Sc_PackUnionBillMain where HBarCode_Pack = '" + HPackBarCode + "'";
                ds = oCn.RunProcReturn(sql, "Sc_PackUnionBillMain");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    MessageBox.Show("托条码[" + HPackBarCode + "]已经组托!");
                    return;
                }
                //获取当前产线
                long HSourceID = 0;
                sql = "select * from Gy_Source where HName = '" + comboBox_SourceNameParams.Text + "'";
                ds = oCn.RunProcReturn(sql, "Gy_Source");
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    HSourceID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HItemID"].ToString());
                }
                //获取缓存列表中 æ‰˜æ¡ç  å¯¹åº”çš„ ç»„托记录
                sql = "select top(1) a.* from Sc_PackUnionBill_Temp as a inner join Gy_BarCodeBill as b on a.HBarCode = b.HBarCode where a.HBarCode_Pack = '" + HPackBarCode + "' and b.HSourceID = " + HSourceID + " and a.HStockorgID = " + HOrgID;
                ds = oCn.RunProcReturn(sql, "Sc_PackUnionBill_Temp");
                if (ds == null || ds.Tables[0].Rows.Count == 0)
                {
                    MessageBox.Show("缓存列表中未查询到该托条码与子条码的组托记录!");
                    return;
                }
                else
                {
                    string HBarCode_Pack = ds.Tables[0].Rows[0]["HBarCode_Pack"].ToString();
                    long HBillID = DBUtility.ClsPub.isLong(ds.Tables[0].Rows[0]["HInterID"].ToString());
                    string HBillNo = ds.Tables[0].Rows[0]["HBillNo"].ToString();
                    textBox_HPackBarCode.Text = HBarCode_Pack;
                    textBox_sBillID.Text = HBillID.ToString();
                    textBox_sBillNo.Text = HBillNo;
                    getDisplay_GrdMain();
                }
            }
        }
        #endregion
        #endregion
    }
}