| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- /*******************************************************************************
- * 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
- {
- /// <summary>
- /// 公开查询模块服务
- /// </summary>
- // 服务实现类,继承服务声明接口
- // 该标签声明该服务可以在ASP.NET下运行
- [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
- [ServiceBehavior(ConfigurationName = "PublicModuleService",
- InstanceContextMode = InstanceContextMode.PerCall,
- ConcurrencyMode = ConcurrencyMode.Multiple,
- UseSynchronizationContext = false)]
- public class PublicModuleService : IPublicModule
- {
- #region 客户端升级
- /// <summary>
- /// 客户端升级判断
- /// </summary>
- /// <param name="version">客户端版本号</param>
- /// <returns>客户端是否需要更新信息</returns>
- 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;
- }
- }
- /// <summary>
- /// 升级文件读取时,用的统一锁。
- /// </summary>
- private static object _downloadUpgradeFile = new object();
- /// <summary>
- /// 下载更新程序
- /// </summary>
- /// <returns>更新程序</returns>
- 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
- /// <summary>
- /// 取得FP00002画面(工号产量质量)的查询数据
- /// </summary>
- /// <param name="usercode">工号</param>
- /// <returns>查询结果</returns>
- 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));
- }
- }
- }
|