示例#1
0
        /// <summary>
        /// 标签打印
        /// </summary>
        /// <param name="kpdesc">描述</param>
        /// <param name="trsn">唯一序列号</param>
        /// <param name="partstorehousehadmodel">记录物料信息的实体</param>
        private void PrinterLable(string kpdesc,
                                  string trsn,
                                  WebServices.tPartStorehousehad.tPartStorehousehad1 partstorehousehadmodel)
        {
            if (this.isprinter)
            {
                Document doc = lbl.ActiveDocument;

                ShowMsg(LogMsgType.Incoming, "清空模板变量...");
                for (int i = 0; i < doc.Variables.FormVariables.Count; i++)
                {
                    doc.Variables.FormVariables.Item(doc.Variables.FormVariables.Item(i + 1).Name).Value = "";
                }
                ShowMsg(LogMsgType.Incoming, string.Format("模板变量清空完成,共计{0}个...", doc.Variables.FormVariables.Count));


                doc.Variables.FormVariables.Item("PN").Value          = partstorehousehadmodel.KpNumber;       // edt_pn.Text.Trim(); //给参数传值
                doc.Variables.FormVariables.Item("VENDER_CODE").Value = partstorehousehadmodel.VenderCode;     // edt_vc.Text.Trim();
                doc.Variables.FormVariables.Item("DATECODE").Value    = partstorehousehadmodel.DateCode;       // edt_dc.Text.Trim();
                doc.Variables.FormVariables.Item("LOT_ID").Value      = partstorehousehadmodel.LotId;          // edt_lot.Text.Trim();
                doc.Variables.FormVariables.Item("UNIT_SIZE").Value   = partstorehousehadmodel.QTY.ToString(); // edt_qty.Text.Trim();
                doc.Variables.FormVariables.Item("EMP_NO").Value      = ShowMP.gUserInfo.userId;
                doc.Variables.FormVariables.Item("REMARK").Value      = kpdesc;
                doc.Variables.FormVariables.Item("TR_SN").Value       = trsn;
                doc.Variables.FormVariables.Item("STORLOC").Value     = partstorehousehadmodel.storehouseId + "-" + partstorehousehadmodel.LocId;
                doc.PrintDocument(1);//打印
                this.ShowMsg(LogMsgType.Outgoing, string.Format("编号:{1}; 料号:{0}; 打印成功",
                                                                partstorehousehadmodel.KpNumber, trsn));
            }
            else
            {
                throw new Exception("没有发现条码文档..");
            }
        }
示例#2
0
        /// <summary>
        /// 正常打印和重复打印及记录入库打印记录
        /// </summary>
        /// <param name="repeatprt">是否重复打印</param>
        /// <param name="printNum">打印数量</param>
        /// <param name="kpdesc">物料描述</param>
        /// <param name="partstorehousehadmodel">记录物料信息的实体</param>
        private void ZPLPrinter(bool repeatprt, int printNum, string kpdesc,
                                WebServices.tPartStorehousehad.tPartStorehousehad1 partstorehousehadmodel)
        {
            string prtCmd;

            FrmBLL.PrintControls ZplPrt;// = new FrmBLL.PrintControls();
            if (Directory.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "LableFile"))
            {
                ZplPrt = new FrmBLL.PrintControls();
                StreamReader sr = new StreamReader(System.AppDomain.CurrentDomain.BaseDirectory + @"LableFile\FEIXUN_LOT.TXT",
                                                   Encoding.GetEncoding("gb2312"));
                prtCmd = sr.ReadToEnd();
                sr.Close();
            }
            string kpdesclast = "";
            string kpdescnext = "";

            try
            {
                kpdesclast = kpdesc.Substring(0, (kpdesc.Length / 2) + 1);
                kpdescnext = kpdesc.Substring((kpdesc.Length / 2) + 1, kpdesc.Length - ((kpdesc.Length / 2) + 1));
            }
            catch
            {
            }
            for (int i = 0; i < printNum; i++)
            {
                string _trsn = this.mTrsn;//= RefWebService_BLL.refWebtPartStorehousehad.Instance.GetSeqTrSn();
                if (!repeatprt)
                {
                    _trsn = RefWebService_BLL.refWebtPartStorehousehad.Instance.GetSeqTrSn();
                    partstorehousehadmodel.Tr_Sn = _trsn;
                    RefWebService_BLL.refWebtPartStorehousehad.Instance.MaterialPrint(
                        partstorehousehadmodel, kpdesc, partgroup, vendername, po);
                    this.ShowTrSn(_trsn);
                }

                if (false)
                {
                    ZplPrt.Write(string.Format(prtCmd,
                                               partstorehousehadmodel.KpNumber,
                                               partstorehousehadmodel.VenderCode,
                                               partstorehousehadmodel.DateCode,
                                               partstorehousehadmodel.LotId,
                                               partstorehousehadmodel.QTY.ToString(),
                                               System.DateTime.Now.ToString("yyyy/MM/dd hh:mm"),
                                               _trsn,
                                               "1",
                                               kpdesclast,
                                               kpdescnext));
                    ClearTextBox();
                }
                else
                {
                    PrinterLable(kpdesc, _trsn, partstorehousehadmodel);
                    ClearEdtQty();
                }
            }
        }
示例#3
0
        /// <summary>
        /// 物料拆分打印
        /// </summary>
        /// <param name="ls">拆分数量集合</param>
        /// <param name="kpdesc">物料描述</param>
        /// <param name="partstorehousehadmodel">记录物料信息的实体</param>
        private void SplitPrint(List <int> ls, string kpdesc,
                                WebServices.tPartStorehousehad.tPartStorehousehad1 partstorehousehadmodel)
        {
            string prtCmd;

            FrmBLL.PrintControls ZplPrt;// = new FrmBLL.PrintControls();
            if (Directory.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "LableFile"))
            {
                ZplPrt = new FrmBLL.PrintControls();
                StreamReader sr = new StreamReader(System.AppDomain.CurrentDomain.BaseDirectory + @"LableFile\FEIXUN_LOT.TXT",
                                                   Encoding.GetEncoding("gb2312"));
                prtCmd = sr.ReadToEnd();
                sr.Close();
            }
            string kpdesclast = "";
            string kpdescnext = "";

            try
            {
                kpdesclast = kpdesc.Substring(0, (kpdesc.Length / 2) + 1);
                kpdescnext = kpdesc.Substring((kpdesc.Length / 2) + 1, kpdesc.Length - ((kpdesc.Length / 2) + 1));
            }
            catch
            {
            }

            foreach (int item in ls)
            {
                string _trsn = RefWebService_BLL.refWebtPartStorehousehad.Instance.GetSeqTrSn();
                this.ShowTrSn(_trsn);
                partstorehousehadmodel.Tr_Sn = _trsn;
                partstorehousehadmodel.QTY   = item;
                string sRes = RefWebService_BLL.refWebtPartStorehousehad.Instance.InsertPartStorehousehad(partstorehousehadmodel);
                ShowMP.ShowPrgMsg(sRes, MainParent.MsgType.Incoming);

                if (false)
                {
                    ZplPrt.Write(string.Format(prtCmd,
                                               partstorehousehadmodel.KpNumber,
                                               partstorehousehadmodel.VenderCode,
                                               partstorehousehadmodel.DateCode,
                                               partstorehousehadmodel.LotId,
                                               partstorehousehadmodel.QTY.ToString(),
                                               System.DateTime.Now.ToString("yyyy/MM/dd hh:mm"),
                                               _trsn,
                                               "1",
                                               kpdesclast,
                                               kpdescnext));
                    ClearTextBox();
                }
                else
                {
                    PrinterLable(kpdesc, _trsn, partstorehousehadmodel);
                    ClearTextBox();
                }
            }
        }