예제 #1
0
        private string NewFile_Service(string reporter, string productSN, string docType, string fileName, string filePath, string Ext, string Time)
        {
            string             ret         = "ERROR";
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);
            string             filePathAll = filePath + fileName;

            using (FileStream fileStream = new FileStream(filePathAll, FileMode.Open, FileAccess.Read, FileShare.Read))
            {
                // 读取文件的 byte[]
                byte[] bytes = new byte[fileStream.Length];
                fileStream.Read(bytes, 0, bytes.Length);
                fileStream.Close();

                /*
                 *          // 把 byte[] 转换成 Stream
                 *          Stream stream = new MemoryStream(bytes);
                 *          byte[] bytes = new byte[stream.Length];
                 *          stream.Read(bytes, 0, bytes.Length);
                 *      // 设置当前流的位置为流的开始
                 *          stream.Seek(0, SeekOrigin.Begin);
                 */
                try
                {
                    ret = test1.CollectDevice_MES_Doc_New(reporter, deviceInfo.deviceCode, productType, productSN, docType, deviceInfo.folderId, fileName, bytes, Ext, Time);
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
            }
            return(ret);
        }
예제 #2
0
        private string NewData_Service(string reporter, string productSN, string propertyName, string propertyValue, string Ext, string Time)
        {
            string             ret         = "ERROR";
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);

            try
            {
                ret = test1.CollectDevice_MES_ProcessData_New(reporter, deviceInfo.deviceCode, productType, productSN, propertyName, propertyValue, Ext, Time);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(ret);
        }
예제 #3
0
        private string EndJob_Service(string reporter, string productSN, string Ext, string Time)
        {
            string             ret;
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);

            try
            {
                if (jobNew > 0)
                {
                    jobNew--;
                    string ret1 = test1.CollectDevice_MES_ControlJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, "1", Time);
                }
                ret = test1.CollectDevice_MES_EndJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, Time);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ret);
        }
예제 #4
0
        private string StartJob_Service(string reporter, string productSN, string Ext, string Time)
        {
            deviceInfo         devInfo     = new deviceInfo();
            Service1SoapClient test1       = new Service1SoapClient();
            string             productType = devInfo.GetProductType(productSN);

            jobNew++;
            string ret;

            try
            {
                ret = test1.CollectDevice_MES_StartJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, Time);
                if (ret == "OK")
                {
                    string ret1 = test1.CollectDevice_MES_ControlJob_New(reporter, deviceInfo.deviceCode, productType, productSN, deviceInfo.operationGroup, Ext, "0", Time);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(ret);
        }