Exemplo n.º 1
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();
                }
            }
        }
Exemplo n.º 2
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();
                }
            }
        }