示例#1
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            if (dgProductCodes.SelectedRows.Count > 0)
            {
                List <string> all = new List <string>();
                //打印二维码
                foreach (DataGridViewRow item in dgProductCodes.SelectedRows)
                {
                    HashTable ht = ddc.HashTables.First(x => x.Id == new Guid(item.Cells[0].Value.ToString()));
                    all.Add(ht.Hash);
                }
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

                List <List <string> > ArrayList = all.Select((x, i) => new { Index = i, Value = x }).GroupBy(x => x.Index / 3).Select(x => x.Select(v => v.Value).ToList()).ToList();

                foreach (var items in ArrayList)
                {
                    string[] datas = new string[items.Count];
                    for (int i = 0; i < items.Count; i++)
                    {
                        datas[i] = Utilizity.CreateQRCodeStr(TableType.NP, items[0].ToString());
                    }

                    if (!printer.PrintQRCode(datas))
                    {
                        MessageBox.Show("打印错误,请重新生成成品代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
        }
示例#2
0
 public static IQRPrinter GetQRPrinter()
 {
     if (printer == null)
     {
         printer = new ArgoxQRPrinter();
     }
     return(printer);
 }
        private void btnMCPrintQR_Click(object sender, EventArgs e)
        {
            IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

            printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.MC, dataGridView4.SelectedRows[0].Cells[0].Value.ToString()),
                                dataGridView4.SelectedRows[0].Cells[1].Value.ToString()
                                + dataGridView4.SelectedRows[0].Cells[2].Value.ToString());
        }
示例#4
0
        private void btnStaffPrintQR_Click(object sender, EventArgs e)
        {
            IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

            if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.FI, dgFabircInventory.SelectedRows[0].Cells[0].Value.ToString()), dgFabircInventory.SelectedRows[0].Cells[1].Value.ToString() + Convert.ToDateTime(dgFabircInventory.SelectedRows[0].Cells[5].Value).ToShortDateString()))
            {
                MessageBox.Show("打印错误,请检查打印机", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
        private void btnPrint_Click(object sender, EventArgs e)
        {
            IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

            //打印二维码
            foreach (DataGridViewRow item in dgFabricCut.SelectedRows)
            {
                if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.FC, item.Cells[0].Value.ToString()), item.Cells[1].Value.ToString() + Convert.ToDateTime(item.Cells[5].Value).ToShortDateString()))
                {
                    MessageBox.Show("打印错误,请重新生成成品代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (dgRubberChips.SelectedRows.Count > 0)
     {
         IQRPrinter printer = QRPrinterFactory.GetQRPrinter();
         //打印二维码
         foreach (DataGridViewRow item in dgRubberChips.SelectedRows)
         {
             var t = ddc.橡胶薄片s.Single(x => x.Id == new Guid(item.Cells[0].Value.ToString()) && x.除 == false);
             var n = ddc.胶料入库s.Single(x => x.Id == new Guid(item.Cells[4].Value.ToString()) && x.除 == false);
             if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.RC, t.Id.ToString()), n.胶料牌号 + n.登记时间.ToShortDateString()))
             {
                 MessageBox.Show("打印错误,请重新生成胶片代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
     }
 }
        private void btnCreate_Click(object sender, EventArgs e)
        {
            if (cbTypeNo.Text.Trim() == "")
            {
                MessageBox.Show("请输入产品型号");
                return;
            }
            int num = 0;

            if (!CheckInput(tbNum, "请输入要生成的数量", ref num))
            {
                return;
            }
            float outrubberconsume = 0;

            if (!CheckInput(tbOutRubberConsume, "请输入要消耗的外层胶数量", ref outrubberconsume))
            {
                return;
            }
            float innerrubberconsume = 0;

            if (!CheckInput(tbInnerRubberConsume, "请输入要消耗的内层胶数量", ref innerrubberconsume))
            {
                return;
            }
            float fabricconsume = 0;

            if (!CheckInput(tbFabricConsume, "请输入要消耗的帘布数量", ref fabricconsume))
            {
                return;
            }
            if (dgOutRubber.SelectedRows.Count < 0)
            {
                MessageBox.Show("请选择胶料");
                return;
            }
            if (dgFabric.SelectedRows.Count < 0)
            {
                MessageBox.Show("请选择帘布卷");
                return;
            }

            List <string> all = new List <string>();

            using (TransactionScope scope = new TransactionScope())
            {
                产品消耗 consume = null;
                if (cbTypeNo.SelectedValue == null)
                {
                    consume        = null;
                    consume        = new 产品消耗();
                    consume.Id     = Guid.NewGuid();
                    consume.产品名称   = cbTypeNo.Text;
                    consume.内层胶消耗量 = innerrubberconsume;
                    consume.外层胶消耗量 = outrubberconsume;
                    consume.帘布消耗量  = fabricconsume;
                    consume.加入日期   = DateTime.Now;
                    ddc.产品消耗s.InsertOnSubmit(consume);
                }

                if (cbTypeNo.SelectedValue != null)
                {
                    consume        = ddc.产品消耗s.First(x => x.Id == new Guid(cbTypeNo.SelectedValue.ToString()));
                    consume.内层胶消耗量 = innerrubberconsume;
                    consume.外层胶消耗量 = outrubberconsume;
                    consume.帘布消耗量  = fabricconsume;
                }
                for (int i = 0; i < num; i++)
                {
                    皮囊成型 temp = new 皮囊成型();
                    temp.Id    = Guid.NewGuid();
                    temp.产品型号  = cbTypeNo.Text;
                    temp.外胶片批号 = new Guid(dgOutRubber.SelectedRows[0].Cells[0].Value.ToString());
                    temp.帘布批号  = new Guid(this.dgFabric.SelectedRows[0].Cells[0].Value.ToString());
                    temp.内胶片批号 = new Guid(dgInnerRubber.SelectedRows[0].Cells[0].Value.ToString());
                    temp.产品消耗  = consume.Id;
                    temp.登记时间  = DateTime.Now;
                    ddc.皮囊成型s.InsertOnSubmit(temp);


                    HashTable hash = new HashTable();
                    hash.Id    = temp.Id;
                    hash.Table = "NP";
                    hash.Hash  = Utilizity.GetCRC32Str(temp.Id.ToString());
                    ddc.HashTables.InsertOnSubmit(hash);
                    all.Add(hash.Hash);
                }
                ddc.SubmitChanges();
                scope.Complete();
            }
            //LoadData();
            //打印二维码
            if (DialogResult.Yes == MessageBox.Show("你需要立即打印吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

                List <List <string> > ArrayList = all.Select((x, i) => new { Index = i, Value = x }).GroupBy(x => x.Index / 3).Select(x => x.Select(v => v.Value).ToList()).ToList();

                foreach (var items in ArrayList)
                {
                    string[] datas = new string[items.Count];
                    for (int i = 0; i < items.Count; i++)
                    {
                        datas[i] = Utilizity.CreateQRCodeStr(TableType.NP, items[0].ToString());
                    }

                    if (!printer.PrintQRCode(datas))
                    {
                        MessageBox.Show("打印错误,请重新生成成品代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            LoadData();
        }
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string typeno = "";

            if (!CheckInput(tbTypeNo, "请输入橡胶牌号", ref typeno))
            {
                return;
            }
            string boxno = "";

            if (!CheckInput(tbBox, "请输入箱号", ref boxno))
            {
                return;
            }
            string assline = "";

            if (!CheckInput(tbAssLine, "请输入生产线号", ref assline))
            {
                return;
            }
            string sno = "";

            if (!CheckInput(tbSNo, "请输入批次号", ref sno))
            {
                return;
            }
            float weight = 0;

            if (!CheckInput(tbWeight, "请输入重量", ref weight))
            {
                return;
            }
            Data.胶料入库 temp;
            using (TransactionScope scope = new TransactionScope())
            {
                temp         = new Data.胶料入库();
                temp.Id      = Guid.NewGuid();
                temp.胶料牌号    = typeno;
                temp.箱号      = boxno;
                temp.生产线号    = assline;
                temp.生产日期    = dtpPDate.Value;
                temp.批次号     = sno;
                temp.重量      = weight;
                temp.供应商产品代号 = tbSupplyNo.Text;
                temp.出库时间    = DateTime.Now;
                temp.登记时间    = DateTime.Now;
                ddc.胶料入库s.InsertOnSubmit(temp);

                ddc.SubmitChanges();
                scope.Complete();
            }
            if (DialogResult.Yes == MessageBox.Show("你需要立即打印吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

                if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.RI, temp.Id.ToString()), temp.胶料牌号 + temp.生产日期.ToShortDateString()))
                {
                    MessageBox.Show("打印错误,请重新生成成品代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            LoadData();
        }
        private void btnCreate_Click(object sender, EventArgs e)
        {
            Guid typeno = new Guid();

            if (!CheckInput(tbTypeNo, "请输入帘布批号", ref typeno))
            {
                return;
            }
            int counter = 0;

            if (!CheckInput(tbCounter, "请输入要生成标签数量", ref counter))
            {
                return;
            }
            float width = 0;

            if (!CheckInput(tbWidth, "请输入要生成帘布宽度", ref width))
            {
                return;
            }
            float thick = 0;

            if (!CheckInput(tbThick, "请输入要生成帘布厚度", ref thick))
            {
                return;
            }
            float num = 0;

            if (!CheckInput(tbNum, "请输入要生成每卷帘布长度", ref num))
            {
                return;
            }
            float consume = 0;

            if (!CheckInput(tbConsume, "请输入要生成每卷帘布消耗的数量", ref consume))
            {
                return;
            }
            float ang = 0;

            if (!CheckInput(tbAng, "请输入要生成帘布角度", ref ang))
            {
                return;
            }
            string pno = "";

            if (!CheckInput(tbPNo, "请输入对应产品型号", ref pno))
            {
                return;
            }
            List <帘布流转> all = new List <帘布流转>();

            using (TransactionScope scope = new TransactionScope())
            {
                for (int i = 0; i < counter; i++)
                {
                    帘布流转 temp = new 帘布流转();
                    temp.Id   = Guid.NewGuid();
                    temp.帘布批号 = typeno;
                    temp.厚度   = thick;
                    temp.宽度   = width;
                    temp.角度   = ang;
                    temp.数量   = num;
                    temp.消耗数量 = consume;
                    temp.产品编号 = pno;
                    temp.使用期限 = DateTime.Now.AddDays(5);
                    temp.登记时间 = DateTime.Now;
                    temp.出库时间 = DateTime.Now;
                    temp.生产时间 = DateTime.Now;
                    ddc.帘布流转s.InsertOnSubmit(temp);
                    all.Add(temp);
                }

                //if(DialogResult.Yes == MessageBox.Show("是否已经用完本垛胶料?","询问", MessageBoxButtons.YesNo,MessageBoxIcon.Question))
                //{
                //    if (DialogResult.Yes == MessageBox.Show("以用完本垛胶料将?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                //}

                ddc.SubmitChanges();
                scope.Complete();
            }
            if (DialogResult.Yes == MessageBox.Show("你需要立即打印吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();
                foreach (var item in all)
                {
                    if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.FC, item.Id.ToString()), item.产品编号 + item.登记时间.ToShortDateString()))
                    {
                        MessageBox.Show("打印错误,请重新生成帘布代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            dgFabric_SelectionChanged(null, null);
        }
示例#10
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            string typeno = "";

            if (!CheckInput(tbTypeNo, "请输入橡胶牌号", ref typeno))
            {
                return;
            }
            string fabric = "";

            if (!CheckInput(tbFabricType, "请输入帘布代号", ref fabric))
            {
                return;
            }
            string length = "";
            float  dlength;

            if (!CheckInput(tbLength, "请输入长度", ref length))
            {
                return;
            }
            try
            {
                dlength = Convert.ToSingle(length);
            }
            catch (Exception)
            {
                MessageBox.Show("长度输入无效");
                return;
            }
            string sno = "";
            float  dsno;

            if (!CheckInput(tbSerialNo, "请输入批次号", ref sno))
            {
                return;
            }
            try
            {
                dsno = Convert.ToSingle(sno);
            }
            catch (Exception)
            {
                MessageBox.Show("生产序号输入无效");
                return;
            }
            float weight = 0;

            if (!CheckInput(tbWeight, "请输入重量", ref weight))
            {
                return;
            }
            Data.帘布入库 temp;
            using (TransactionScope scope = new TransactionScope())
            {
                temp      = new Data.帘布入库();
                temp.Id   = Guid.NewGuid();
                temp.胶料   = typeno;
                temp.帘布代号 = fabric;
                temp.帘布长度 = dlength;
                temp.生产日期 = dtpPDate.Value;
                temp.效日期  = dtpVDate.Value;
                temp.生产序号 = dsno;
                temp.重量   = weight;
                temp.出库时间 = DateTime.Now;
                temp.登记时间 = DateTime.Now;
                ddc.帘布入库s.InsertOnSubmit(temp);

                ddc.SubmitChanges();
                scope.Complete();
            }
            if (DialogResult.Yes == MessageBox.Show("你需要立即打印吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();

                if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.FI, temp.Id.ToString()), temp.帘布代号 + temp.生产日期.Date.ToShortDateString()))
                {
                    MessageBox.Show("打印错误,请重新生成成品代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            LoadData();
        }
        private void btnCreate_Click(object sender, EventArgs e)
        {
            Guid typeno = new Guid();

            if (!CheckInput(tbTypeNo, "请输入胶料批号", ref typeno))
            {
                return;
            }
            int counter = 0;

            if (!CheckInput(tbCounter, "请输入要生成标签数量", ref counter))
            {
                return;
            }
            float width = 0;

            if (!CheckInput(tbWidth, "请输入要生成胶片宽度", ref width))
            {
                return;
            }
            float thick = 0;

            if (!CheckInput(tbThick, "请输入要生成胶片厚度", ref thick))
            {
                return;
            }
            float num = 0;

            if (!CheckInput(tbNum, "请输入要生成胶片数量", ref num))
            {
                return;
            }
            float consume = 0;

            if (!CheckInput(tbNum, "请输入要生成胶片消耗数量", ref consume))
            {
                return;
            }
            List <橡胶薄片> all = new List <橡胶薄片>();

            using (TransactionScope scope = new TransactionScope())
            {
                for (int i = 0; i < counter; i++)
                {
                    橡胶薄片 temp = new 橡胶薄片();
                    temp.Id   = Guid.NewGuid();
                    temp.胶料批号 = typeno;
                    temp.厚度   = thick;
                    temp.宽度   = width;
                    temp.数量   = num;
                    temp.消耗重量 = consume;
                    temp.生产序号 = i;
                    temp.生产时间 = DateTime.Now;
                    temp.登记时间 = DateTime.Now;
                    temp.出库时间 = DateTime.Now;
                    ddc.橡胶薄片s.InsertOnSubmit(temp);
                    all.Add(temp);
                }

                //if(DialogResult.Yes == MessageBox.Show("是否已经用完本垛胶料?","询问", MessageBoxButtons.YesNo,MessageBoxIcon.Question))
                //{
                //    if (DialogResult.Yes == MessageBox.Show("以用完本垛胶料将?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
                //}

                ddc.SubmitChanges();
                scope.Complete();
            }
            if (DialogResult.Yes == MessageBox.Show("你需要立即打印吗?", "询问", MessageBoxButtons.YesNo, MessageBoxIcon.Question))
            {
                IQRPrinter printer = QRPrinterFactory.GetQRPrinter();
                foreach (var item in all)
                {
                    var t = ddc.橡胶薄片s.Single(x => x.Id == item.Id && x.除 == false);
                    var n = ddc.胶料入库s.Single(x => x.Id == item.胶料批号 && x.除 == false);
                    if (!printer.PrintQRCode(Utilizity.CreateQRCodeStr(TableType.RC, item.Id.ToString()), n.胶料牌号 + n.登记时间.ToShortDateString()))
                    {
                        MessageBox.Show("打印错误,请重新生成胶片代码", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }
            }
            dgOutRubber_SelectionChanged(null, null);
        }