/******************************************************************************* * Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential * 类的信息: * 1.程序名称:PublicModuleService.cs * 2.功能描述:公开查询模块服务 * 编辑履历: * 作者 日期 版本 修改内容 * 陈晓野 2015/11/03 1.00 新建 *******************************************************************************/ using System; using System.Data; using System.IO; using System.ServiceModel; using System.ServiceModel.Activation; using Dongke.IBOSS.PRD.Basics.Library; using Dongke.IBOSS.PRD.Service.DKIBOSSPRDLogic; using Dongke.IBOSS.PRD.Service.PublicModuleService; using Dongke.IBOSS.PRD.WCF.Contracts; using Dongke.IBOSS.PRD.WCF.DataModels; namespace Dongke.IBOSS.PRD.WCF.Services { /// /// 公开查询模块服务 /// // 服务实现类,继承服务声明接口 // 该标签声明该服务可以在ASP.NET下运行 [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] [ServiceBehavior(ConfigurationName = "PublicModuleService", InstanceContextMode = InstanceContextMode.PerCall, ConcurrencyMode = ConcurrencyMode.Multiple, UseSynchronizationContext = false)] public class PublicModuleService : IPublicModule { #region 客户端升级 /// /// 客户端升级判断 /// /// 客户端版本号 /// 客户端是否需要更新信息 public NeedUpgradeResultEntity IsNeedUpgrade(string version) { try { string serverVersion = INIUtility.Instance(INIUtility.IniFile.Config).ReadIniData("VersionSetting", "PublicClientVersion"); NeedUpgradeResultEntity result = new NeedUpgradeResultEntity(); result.ServerVersion = serverVersion; result.UpgradeState = false; result.GradeInfo = ""; string[] versions = version.Split('.'); string[] serverVersions = serverVersion.Split('.'); if (versions == null || serverVersions == null || versions.Length != 4 || serverVersions.Length != 4) { return result; } for (int j = 0; j < versions.Length; j++) { if (Convert.ToInt32(serverVersions[j]) > Convert.ToInt32(versions[j])) { result.UpgradeState = true; break; } } return result; } catch (Exception ex) { OutputLog.TraceLog(LogPriority.Error, this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), LocalPath.LogExePath); throw ex; } } /// /// 升级文件读取时,用的统一锁。 /// private static object _downloadUpgradeFile = new object(); /// /// 下载更新程序 /// /// 更新程序 public byte[] DownloadUpgradeFile() { try { string filePath = INIUtility.Instance(INIUtility.IniFile.Config).ReadIniData("PathSetting", "UpgradePublicDownLoadPath");//ConfigurationManager.AppSettings["UpgradeDownLoadPath"]; // 取得WEB服务器上的文件全路径 string fileFullPath = System.AppDomain.CurrentDomain.BaseDirectory + filePath; lock (_downloadUpgradeFile) { if (!Directory.Exists(fileFullPath)) { Directory.CreateDirectory(fileFullPath); } // zip 压缩 string zipPath = fileFullPath + @"-UpgradePublic.up"; if (!File.Exists(zipPath)) { ZipFileClass.DirectoryToZip(fileFullPath, zipPath); } // 文件存在,则将文件读入文件流中返回 if (File.Exists(zipPath)) { using (FileStream fileStream = new FileStream(zipPath, FileMode.Open, FileAccess.Read)) { BinaryReader binaryReader = new BinaryReader(fileStream); return binaryReader.ReadBytes((int)fileStream.Length); } } } return null; } catch (Exception ex) { OutputLog.TraceLog(LogPriority.Error, this.ToString(), System.Reflection.MethodBase.GetCurrentMethod().Name, ex.ToString(), LocalPath.LogExePath); throw ex; } } #endregion /// /// 取得FP00002画面(工号产量质量)的查询数据 /// /// 工号 /// 查询结果 public ServiceResultEntity GetFP00002Data(int accountID, string usercode, DateTime date) { return ServiceInvoker.Invoke(this, () => PublicModuleLogic.GetFP00002Data(accountID, usercode, date)); } public ServiceResultEntity GetRptProcedureModule(int accountID) { return ServiceInvoker.Invoke(this, () => PublicModuleLogic.GetRptProcedureModule(accountID)); } public ServiceResultEntity GetRptSourceProcedureModule(int accountid, int? RptProcedureID) { return ServiceInvoker.Invoke(this, () => PublicModuleLogic.GetRptSourceProcedureModule(accountid, RptProcedureID)); } } }