コード例 #1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            Boolean blnRtnValue = false;

            blnRtnValue = IsValidate();

            if (blnRtnValue == false)
            {
                return;
            }

            //// print QR Code
            _QRCode qRCode = new _QRCode();

            qRCode.Spot1  = string.Format("{0:0.00}", Convert.ToDecimal(txtSpotDisp1.EditValue.ToString()));
            qRCode.Spot3  = string.Format("{0:0.00}", Convert.ToDecimal(txtSpotDisp3.EditValue.ToString()));
            qRCode.Spot5  = string.Format("{0:0.00}", Convert.ToDecimal(txtSpotDisp5.EditValue.ToString()));
            qRCode.Spot6  = string.Format("{0:0.00}", Convert.ToDecimal(txtSpotDisp6.EditValue.ToString()));
            qRCode.Spot11 = string.Format("{0:0.00}", Convert.ToDecimal(txtSpotDisp11.EditValue.ToString()));


            //qRCode.Spot1 = string.Format("{0:0.00}", Int32(txtSpotDisp1.EditValue.ToString()));
            //qRCode.Spot3 = string.Format("{0:0.00}", txtSpotDisp3.EditValue.ToString());
            //qRCode.Spot5 = string.Format("{0:0.00}", txtSpotDisp5.EditValue.ToString());
            //qRCode.Spot6 = string.Format("{0:0.00}", txtSpotDisp6.EditValue.ToString());
            //qRCode.Spot11 = string.Format("{0:0.00}", txtSpotDisp11.EditValue.ToString());
            qRCode.Grade = txtGrade.EditValue.ToString();

            blnRtnValue = PrintQRCodeLabel(Properties.Settings.Default.PrintQRCode_Meas, qRCode);

            if (blnRtnValue == true)
            {
                btnReset.PerformClick();
            }
        }
コード例 #2
0
        public Boolean PrintQRCodeLabel(string lptPort, _QRCode qRCode)
        {
            try
            {
                string zpl = "";
                string nl  = Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString();
                string QRCode;

                QRCode = string.Format("{0}|{1}|{2}|{3}|{4}|{5}"
                                       , qRCode.Spot1
                                       , qRCode.Spot3
                                       , qRCode.Spot5
                                       , qRCode.Spot6
                                       , qRCode.Spot11
                                       , qRCode.Grade);

                zpl = zpl + "^XA";
                //zpl = zpl + Environment.NewLine + "^MMT";
                //zpl = zpl + Environment.NewLine + "^PW203";
                //zpl = zpl + Environment.NewLine + "^LL0102";
                //zpl = zpl + Environment.NewLine + "^LH10,5";
                //zpl = zpl + Environment.NewLine + "^LS10";
                zpl = zpl + Environment.NewLine + "^FO350,020^BQN,2,2^FDQA," + QRCode + "^FS";
                zpl = zpl + Environment.NewLine + "^FO440,030^A0N,75,75^FD" + qRCode.Grade + "^FS";
                zpl = zpl + Environment.NewLine + "^XZ";
                zpl = zpl + Environment.NewLine;
                Print2LPT.Print(zpl, lptPort);
            }
            catch (SystemException ex)
            {
                MessageBox.Show("QR Code printing is not working!" + Environment.NewLine + ex.Message.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }
コード例 #3
0
        private void barBtnQRCode_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            try
            {
                string strShipStatusType = gvList.GetRowCellValue(gvList.FocusedRowHandle, "ShippingStatus").ToString().Substring(0, 1);
                if (strShipStatusType != "G")
                {
                    return;
                }
                DialogResult result = XtraMessageBox.Show("Do you want reprint to QR Code?", "Question!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (result == DialogResult.No)
                {
                    return;
                }

                string strShipBoxNo = gvList.GetRowCellValue(gvList.FocusedRowHandle, "ShipBoxNo").ToString();
                var    qryShipment  = (from obj in db.POShipments
                                       where obj.ShipBoxNo == strShipBoxNo &&
                                       obj.ShippingStatus.StartsWith("G")
                                       select obj).FirstOrDefault();
                if (qryShipment == null)
                {
                    return;
                }
                _QRCode qRCode = new _QRCode();
                qRCode.PONumber       = qryShipment.PONumber;
                qRCode.LineNumber     = Convert.ToInt16(qryShipment.POLineNumber.ToString());
                qRCode.ItemCode       = qryShipment.ItemNumber;
                qRCode.ItemQuantity   = Convert.ToInt16(qryShipment.ShippedQty.ToString());
                qRCode.ProductionDate = Convert.ToDateTime(qryShipment.ShippedDate.ToString()).ToString("yyMMdd");
                qRCode.ShipDate       = Convert.ToDateTime(qryShipment.ShippedDate.ToString()).ToString("yyMMdd");
                qRCode.SerialNumber   = Convert.ToInt16(qryShipment.StartNo.ToString());
                qRCode.SupplierID     = "EG2";
                qRCode.MaterialSource = "R";

                //            QRCode = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}"
                //, qRCode.PONumber
                //, qRCode.SupplierID
                //, qRCode.ItemCode
                //, qRCode.ItemQuantity.ToString()
                //, qRCode.FactoryCode
                //, qRCode.ProductionDate
                //, qRCode.ShipDate
                //, qRCode.SerialNumber.ToString()
                //, qRCode.MaterialSource
                //, qRCode.CVEReserved1
                //, qRCode.CVEReserved2
                //, qRCode.SupplierSection);

                Boolean blnReturn = PrintQRCodeLabel(Properties.Settings.Default.PrintQRCode, qRCode);
            }
            catch
            { }
        }
コード例 #4
0
        public Boolean PrintQRCodeLabel(string lptPort, _QRCode qRCode)
        {
            try
            {
                string zpl = "";
                string nl  = Convert.ToChar(13).ToString() + Convert.ToChar(10).ToString();
                string QRCode;

                for (int i = 1; i <= Convert.ToInt16(qRCode.ItemQuantity); i++)
                {
                    QRCode = string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}"
                                           , qRCode.PONumber
                                           , qRCode.SupplierID
                                           , qRCode.ItemCode
                                           , qRCode.ItemQuantity.ToString()
                                           , qRCode.FactoryCode
                                           , qRCode.ProductionDate
                                           , qRCode.ShipDate
                                           , qRCode.SerialNumber.ToString()
                                           , qRCode.MaterialSource
                                           , qRCode.CVEReserved1
                                           , qRCode.CVEReserved2
                                           , qRCode.SupplierSection);

                    if (qRCode.SerialNumber == 0)
                    {
                        qRCode.SerialNumber = 1;
                    }

                    zpl = zpl + "^XA";
                    zpl = zpl + Environment.NewLine + "^MMT";
                    zpl = zpl + Environment.NewLine + "^PW203";
                    zpl = zpl + Environment.NewLine + "^LL0102";
                    zpl = zpl + Environment.NewLine + "^LH10,5";
                    zpl = zpl + Environment.NewLine + "^LS10";
                    zpl = zpl + Environment.NewLine + "^FT20,100^BQ,2,2^FDMA," + QRCode + "^FS";
                    zpl = zpl + Environment.NewLine + "^FO90,20^A0N,12,12^FD" + qRCode.ItemCode + "^FS";
                    zpl = zpl + Environment.NewLine + "^FO90,40^A0N,12,12^FD" + qRCode.PONumber + "^FS";
                    zpl = zpl + Environment.NewLine + "^FO90,60^A0N,12,12^FD" + qRCode.ShipDate + "^FS";
                    zpl = zpl + Environment.NewLine + "^FO90,80^A0N,12,12^FD" + qRCode.SerialNumber + "^FS";
                    zpl = zpl + Environment.NewLine + "^XZ";
                    zpl = zpl + Environment.NewLine;

                    qRCode.SerialNumber = qRCode.SerialNumber + 1;
                }
                Print2LPT.Print(zpl, lptPort);
            }
            catch (SystemException ex)
            {
                MessageBox.Show("QR Code printing is not working!" + Environment.NewLine + ex.Message.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
            return(true);
        }