コード例 #1
0
        public static bool PrintSNLabel(List <string> serialNumbers)
        {
            EndpointAddress address = new EndpointAddress("http://*****:*****@"<![CDATA[<?xml version=""1.0"" standalone='no'?><nice_commands quit=""false""><label name=""SNLabel"" close=""true""><session_print_job skip=""0"" job_name=""JOBNAME1""><session quantity=""n""><variable name=""ProductionLineId"">Linea1</variable><variable name=""FinalProductCode"">JET50xyz</variable><variable name=""ERPOrderId"">Order123456</variable><variable name=""SerialNumbers"">SN1,SN2,SN3,..,SNn</variable></session></session_print_job></label></nice_commands>]]>";
            string          error;

            using (var client = new WebSrviTrgClient(binding, address))
            {
                client.ExecuteTrigger(text, false, out error);
            }

            return(string.IsNullOrEmpty(error));
        }
コード例 #2
0
        private static Error PrintLabel(List <string> serialNumbers, string productCode, string workArea, string labelType, int quantity)
        {
            try
            {
                XmlDocument     doc = new XmlDocument();
                XmlCDataSection CData;

                string text = "";
                text = text + startXml();

                if (serialNumbers.Count < 1)
                {
                    serialNumbers.Add("");
                }

                foreach (string serialNumber in serialNumbers)
                {
                    text = text + "<item>";
                    text = text + string.Format("<Codice_prodotto>{0}</Codice_prodotto>", productCode);
                    text = text + string.Format("<Numero_seriale>{0}</Numero_seriale>", serialNumber);
                    text = text + string.Format("<Tipologia_etichetta>{0}</Tipologia_etichetta>", labelType);
                    text = text + string.Format("<Linea>{0}</Linea>", workArea);
                    text = text + string.Format("<Quantita_copie>{0}</Quantita_copie>", quantity);
                    text = text + "</item>";
                }

                text = text + endXml();
                Console.WriteLine(quantity);
                CData = doc.CreateCDataSection(text);
                string error;
                using (var client = new WebSrviTrgClient(NiceLabelWebSrviTrgConfig))
                {
                    client.ExecuteTrigger(text, false, out error);
                }
                Error er = new Error();

                if (!string.IsNullOrEmpty(error))
                {
                    er.setError(false, error);
                }
                return(er);
            }
            catch (Exception e)
            {
                Error er = new Error();
                er.setError(true, e.Message);
                return(er);
            }
        }