Пример #1
0
        private void 查询ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string strErrMsg = "";
            string serialno  = txtVoucherNo.Text.Trim();

            if (!new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$").IsMatch(txtQty.Text))
            {
                MessageBox.Show("数量必须是正整数");
                return;
            }
            if (WMS.Common.WMSWebService.service.RePrintByBarcode(chkOuter.Checked, serialno, Convert.ToInt16(txtQty.Text), ref label_lst, ref strErrMsg))
            {
                reportViewer1.LocalReport.EnableExternalImages = true;
                reportViewer1.LocalReport.DataSources.Clear();
                reportViewer1.LocalReport.DataSources.Clear();
                bool isDifferent = false;
                foreach (WebService.ProductLabel_Model labelModel in label_lst)
                {
                    if (labelModel.prdversion != null && labelModel.prdversion != "")
                    {
                        if (labelModel.prdversion.Equals("0"))
                        {
                            labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.barcode));
                            labelModel.smallQR   = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.BarcodeExpress));
                        }
                        else if (labelModel.prdversion.Equals("1"))
                        {
                            labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.BarcodeExpress));
                        }
                        else
                        {
                            labelModel.smallQR   = Print_Func.ConvertImageToString(new BarCode128().EncodeBarcode(labelModel.BarcodeExpress, 300, 50, false));//Print_Func.CreateQRCode(labelModel.BarcodeExpress)
                            labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(@"http://www.shimge-pump.com/?sn=" + labelModel.BarcodeExpress));
                        }
                    }
                    else
                    {
                        labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.barcode));
                    }

                    //labelModel.smallQR = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.BarcodeExpress));
                    if (!isDifferent && label_lst[0].invstd.Equals(labelModel.invstd) && label_lst[0].ordercode.Equals(labelModel.ordercode))
                    {
                        isDifferent = false;
                    }
                    else
                    {
                        isDifferent = true;
                    }
                    if (labelModel.outpackqty.Equals("1") || labelModel.outpackqty.Equals("0001"))
                    {
                        labelModel.outpackqty = "";
                    }
                }
                if (isDifferent)
                {
                    txtcinvstd.Text      = "";
                    txtcinvstd.Enabled   = false;
                    txtOrderCode.Text    = "";
                    txtOrderCode.Enabled = false;
                    //txtSupCode.Text = "";
                    //txtSupCode.Enabled = false;
                    MessageBox.Show("该批条码不是同一批次");
                }
                else
                {
                    txtcinvstd.Text      = label_lst[0].invstd;
                    txtcinvstd.Enabled   = true;
                    txtOrderCode.Text    = label_lst[0].ordercode;
                    txtOrderCode.Enabled = true;
                    //txtSupCode.Text = label_lst[0].CUName;
                    //txtSupCode.Enabled = true;
                    //if(label_lst[0].Remark.Equals("内部使用"))
                    //{
                    //    chkRemark.Checked = true;
                    //}
                    //else
                    //{
                    //    chkRemark.Checked = false;
                    //}
                }
                ReportDataSource rds = new ReportDataSource("DataSet1", label_lst);

                reportViewer1.LocalReport.DataSources.Add(rds);
                if (label_lst[0].prdversion != null && label_lst[0].prdversion != "")
                {
                    if (label_lst[0].prdversion.Equals("0"))
                    {
                        reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report3.rdlc";
                    }
                    else if (label_lst[0].prdversion.Equals("1"))
                    {
                        reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report5.rdlc";
                    }
                    else
                    {
                        reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report5.rdlc";
                    }
                    //reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report4.rdlc";
                }
                else
                {
                    reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report2.rdlc";
                }
                reportViewer1.LocalReport.Refresh();
                this.reportViewer1.RefreshReport();
                this.reportViewer1.RefreshReport();
            }
            else
            {
                MessageBox.Show(strErrMsg);
                label_lst = null;
            }
        }
Пример #2
0
 void PrintStock(int model)
 {
     if (currentDetail != null)
     {
         try
         {
             if (model == 0)
             {
                 //验证
                 if (new System.Text.RegularExpressions.Regex(@"[\u4e00-\u9fa5]").IsMatch(txtcinvstd.Text))
                 {
                     MessageBox.Show("规格型号中包含有中文");
                     txtcinvstd.SelectAll();
                     txtcinvstd.Focus();
                     return;
                 }
             }
             if (!new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$").IsMatch(txtOutPackQty.Text))
             {
                 MessageBox.Show("外箱包装量必须是正整数");
                 return;
             }
             if (!new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$").IsMatch(txtPrintQty.Text))
             {
                 MessageBox.Show("打印份数必须是正整数");
                 return;
             }
             if (!new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$").IsMatch(txtBatchQty.Text))
             {
                 MessageBox.Show("打印数量必须是正整数");
                 return;
             }
             //生成条码
             string strErrMsg = "";
             List <WebService.ProductLabel_Model> label_lst = null;
             WebService.ProductLabel_Model        label     = new WebService.ProductLabel_Model();
             label.invstd       = txtcinvstd.Text;
             label.Remark       = "内部使用";
             label.labeltype    = "15";//国内的成品外箱
             label.outpackqty   = txtOutPackQty.Text;
             label.materialno   = txtMaterialNo.Text;
             label.materialdesc = txtMaterialDesc.Text;
             Stock_Model stockmodel = new Stock_Model();
             stockmodel.AreaNo       = currentDetail.AreaNo;
             stockmodel.MaterialNo   = currentDetail.MaterialNo;
             stockmodel.MaterialDesc = currentDetail.MaterialDesc;
             stockmodel.MaterialStd  = currentDetail.MaterialStd;
             stockmodel.WarehouseNo  = currentDetail.WarehouseNo;
             stockmodel.HouseNo      = currentDetail.HouseNo;
             if (!WMS.Common.WMSWebService.service.CreateInitialProductBarcode(stockmodel, label, Convert.ToInt16(txtBatchQty.Text), ref label_lst, ref strErrMsg))
             {
                 MessageBox.Show("生成条码失败:" + strErrMsg);
                 return;
             }
             int printqty = Convert.ToInt16(txtPrintQty.Text);
             List <WebService.ProductLabel_Model> list = new List <WebService.ProductLabel_Model>();
             for (int i = 0; i < label_lst.Count; i++)
             {
                 label_lst[i].qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(label_lst[i].barcode));
                 for (int j = 0; j < printqty; j++)
                 {
                     list.Add(label_lst[i]);
                 }
             }
             FrmStockLabelPrint frm = new FrmStockLabelPrint(model, list);
             frm.ShowDialog();
             txtWhereMaterialNo.Text  = "";
             txtWhereWarehouseNo.Text = "";
             txtWhereHouseNo.Text     = "";
             txtWhereAreaNo.Text      = "";
             btnSearch_Click(null, null);
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Пример #3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtcinvstd.Enabled)
            {
                reportViewer1.LocalReport.EnableExternalImages = true;
                reportViewer1.LocalReport.DataSources.Clear();
                reportViewer1.LocalReport.DataSources.Clear();

                foreach (WebService.ProductLabel_Model labelModel in label_lst)
                {
                    labelModel.invstd    = txtcinvstd.Text;
                    labelModel.ordercode = txtOrderCode.Text;
                    labelModel.smallQR   = Print_Func.ConvertImageToString(new BarCode128().EncodeBarcode(labelModel.BarcodeExpress, 300, 50, false));//Print_Func.CreateQRCode(labelModel.BarcodeExpress)
                    if (labelModel.outpackqty.Equals(""))
                    {
                        labelModel.barcode = labelModel.labeltype + "@" + labelModel.materialno + "@" + labelModel.ordercode + "@" + labelModel.POCode + "@0001@" + labelModel.BarcodeExpress;
                    }
                    else
                    {
                        labelModel.barcode = labelModel.labeltype + "@" + labelModel.materialno + "@" + labelModel.ordercode + "@" + labelModel.POCode + "@" + Convert.ToInt16(labelModel.outpackqty).ToString().PadLeft(4, '0') + "@" + labelModel.BarcodeExpress;
                    }
                    //labelModel.CUName = txtSupCode.Text;
                    //if (chkRemark.Checked)
                    //{
                    //    labelModel.Remark = "内部使用";
                    //}
                    //else
                    //{
                    //    labelModel.Remark = "";
                    //}
                    if (labelModel.prdversion != null && labelModel.prdversion != "")
                    {
                        if (labelModel.prdversion.Equals("0"))
                        {
                            labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.barcode));
                            labelModel.smallQR   = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.BarcodeExpress));
                        }
                        else if (labelModel.prdversion.Equals("1"))
                        {
                            labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.BarcodeExpress));
                        }
                        else
                        {
                            labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(@"http://www.shimge-pump.com/?sn=" + labelModel.BarcodeExpress));
                        }
                    }
                    else
                    {
                        labelModel.qrbarcode = Print_Func.ConvertImageToString(Print_Func.CreateQRCode(labelModel.barcode));
                    }
                }

                string strErrMsg = "";
                if (!WMS.Common.WMSWebService.service.RePrintChangeSave(label_lst, ref strErrMsg))
                {
                    MessageBox.Show(strErrMsg);
                }
                foreach (WebService.ProductLabel_Model labelModel in label_lst)
                {
                    if (labelModel.outpackqty.Equals("1") || labelModel.outpackqty.Equals("0001"))
                    {
                        labelModel.outpackqty = "";
                    }
                }
                ReportDataSource rds = new ReportDataSource("DataSet1", label_lst);

                reportViewer1.LocalReport.DataSources.Add(rds);
                if (label_lst[0].prdversion != null && label_lst[0].prdversion != "")
                {
                    if (label_lst[0].prdversion.Equals("0"))
                    {
                        reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report3.rdlc";
                    }
                    else if (label_lst[0].prdversion.Equals("1"))
                    {
                        reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report5.rdlc";
                    }
                    else
                    {
                        reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report5.rdlc";
                    }
                    //reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report4.rdlc";
                }
                else
                {
                    reportViewer1.LocalReport.ReportEmbeddedResource = @"JingXinWMS.Print.Report2.rdlc";
                }
                reportViewer1.LocalReport.Refresh();
                this.reportViewer1.RefreshReport();
                this.reportViewer1.RefreshReport();
            }
        }