/*******************************************************************************
* Copyright(c) 2014 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:PDAModuleService.cs
* 2.功能描述:PDA模块WCF服务
* 编辑履历:
* 作者 日期 版本 修改内容
* 陈晓野 2014/09/16 1.00 新建
*******************************************************************************/
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.ServiceModel;
using System.ServiceModel.Activation;
using Curtain.Log;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Basics.Library;
using Dongke.IBOSS.PRD.Service.BarcodePrintService;
using Dongke.IBOSS.PRD.Service.CommonModuleLogic;
using Dongke.IBOSS.PRD.Service.DataModels;
using Dongke.IBOSS.PRD.Service.DKIBOSSPRDLogic;
using Dongke.IBOSS.PRD.Service.PCModuleLogic;
using Dongke.IBOSS.PRD.Service.PDAModuleLogic;
using Dongke.IBOSS.PRD.Service.PMModuleLogic;
using Dongke.IBOSS.PRD.Service.PublicModuleService;
using Dongke.IBOSS.PRD.Service.ReportModuleLogic;
using Dongke.IBOSS.PRD.Service.SmartDeviceService;
using Dongke.IBOSS.PRD.Service.SystemModuleLogic;
using Dongke.IBOSS.PRD.WCF.Contracts;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.DataModels.ConfigModule;
using Dongke.IBOSS.PRD.WCF.DataModels.HRModule;
using Dongke.IBOSS.PRD.WCF.DataModels.PCModule;
using Dongke.IBOSS.PRD.WCF.DataModels.PMModule;
namespace Dongke.IBOSS.PRD.WCF.Services
{
// 服务实现类,继承服务声明接口
// 该标签声明该服务可以在ASP.NET下运行
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
[ServiceBehavior(ConfigurationName = "PDAModuleService",
InstanceContextMode = InstanceContextMode.PerCall,
ConcurrencyMode = ConcurrencyMode.Multiple,
UseSynchronizationContext = false)]
public partial class PDAModuleService : IPDAModule
{
#region 属性
///
/// 用户登陆的信息
///
SUserInfo sUserInfo
{
get;
set;
}
#endregion
#region 构造函数
///
/// 构造函数
///
public PDAModuleService()
: base()
{
}
#endregion
#region 验证
///
/// 验证访问头
///
/// 帐套编码
/// 用户编码
/// 用户密码
/// 访问密钥
///
private ActionResult DoPDACheck(string accountCode, string userCode, string userPassword, string sessionKey)
{
try
{
ActionResult actionResult = new ActionResult();
LoginRequestEntity requestEntity = new LoginRequestEntity();
requestEntity.AccountCode = accountCode;
requestEntity.UserCode = userCode;
requestEntity.Password = userPassword;
requestEntity.SessionKey = sessionKey;
SUserInfo userInfo = null;
string loginStatus = DKIBOSSPRDLogic.AuthenticateRepeatLogin(requestEntity, out userInfo);
// 用户登录信息错误
if (Constant.INT_IS_ONE.ToString().Equals(loginStatus))
{
actionResult.Status = (int)Constant.PDAResult.LoginInfoError;
actionResult.Message = Constant.PDA_RESULT_LOGININFOERROR;
}
// 用户在其它终端登陆
else if (Constant.INT_IS_TWO.ToString().Equals(loginStatus))
{
actionResult.Status = (int)Constant.PDAResult.RepeatLogin;
actionResult.Message = Constant.PDA_RESULT_REPEATLOGIN;
}
// Lic错误
else if ("3".Equals(loginStatus))
{
actionResult.Status = (int)Constant.PDAResult.LicInfoError;
actionResult.Message = "授权信息错误,请联系管理员。";
}
else
{
actionResult.Status = (int)Constant.PDAResult.Success;
}
sUserInfo = userInfo;
return actionResult;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region WCF服务
///
/// 测试PDA连接WCF服务
///
/// 测试文本
/// 返回文本
public string TestConnectionEx(string value)
{
return "连接成功!" + value;
}
public string TestConnection()
{
return "连接成功!";
}
#endregion
#region 系统登录
///
/// 系统登录
///
///
///
///
///
///
///
///
///
///
///
///
public PDALoginResult DoPDALogin(string accountCode, string userCode, string userPassword,
string macAddress, string ipAddress, string phoneCode, string phoneType,
string appVersion, string systemType, string systemVersion)
{
try
{
LoginRequestEntity requestEntity = new LoginRequestEntity();
requestEntity.AccountCode = accountCode;
requestEntity.UserCode = userCode;
requestEntity.Password = userPassword;
requestEntity.ComputerName = phoneCode;
requestEntity.IPAddress = ipAddress;
requestEntity.MACAddress = macAddress;
PDALoginResult result = ServiceInvoker.Invoke(this,
() => PDAModuleLogic.DoPDALogin(requestEntity));
return result;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
PDALoginResult result = new PDALoginResult();
result.Status = (int)Constant.PDAResult.Exception;
result.Message = Constant.PDA_RESULT_EXCEPTION;
return result;
}
}
///
/// 退出
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
///
public ActionResult DoPDAOut(string accountCode, string userCode, string userPassword, string sessionKey)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
bool result = DKIBOSSPRDLogic.Logout(sUserInfo.UserID, "3", sUserInfo);
actionResult.Result = JsonHelper.ToJson(result);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 修改密码
///
///
///
///
///
///
public ActionResult ChangeUserPassword(string accountCode, string userCode, string userPassword, string sessionKey,
string newPassWord)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
string result = ServiceInvoker.Invoke(this,
() => SystemModuleDAL.SaveUserPassWord(newPassWord, userCode, null, sUserInfo));
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
#endregion
#region 取得展示数据
///
/// 获得生产线菜单
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
///
///
/// 陈冰 2014.09.18 新建
///
public ActionResult GetProductionLineMenu(string accountCode, string userCode, string userPassword, string sessionKey)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
// 查询菜单
DataTable dtPLM = ServiceInvoker.Invoke(this,
() => PDAModuleLogic.GetProductionLineMenu(sUserInfo));
PDAFunctionResult pdaFunction = new PDAFunctionResult();
pdaFunction.MenuCode = "Root";
DataRow[] navigationRows = dtPLM.Select("LEN(MenuCode) = " + Constant.INT_IS_TWO.ToString(), "MenuCode ASC"); // 编号2为一级菜单
foreach (DataRow newRow in navigationRows)
{
#region 插入子节点数据
int? intProcedureID = null;
int? intModelType = null;
if (!string.IsNullOrEmpty(newRow["ProcedureID"].ToString()))
{
intProcedureID = Convert.ToInt32(newRow["ProcedureID"]);
}
if (!string.IsNullOrEmpty(newRow["ModelType"].ToString()))
{
intModelType = Convert.ToInt32(newRow["ModelType"]);
}
PDAFunctionResult pdaFunctionChild = new PDAFunctionResult();
pdaFunctionChild.MenuCode = newRow["MenuCode"].ToString();
pdaFunctionChild.MenuName = newRow["MenuName"].ToString();
pdaFunctionChild.ProcedureID = intProcedureID;
pdaFunctionChild.ProcedureModel = newRow["ProcedureModel"].ToString();
pdaFunctionChild.ModelType = intModelType;
pdaFunction.PDAFunctions.Add(pdaFunctionChild);
#endregion
InitTreeView(dtPLM, newRow["MenuCode"].ToString(), pdaFunctionChild);
}
//actionResult.Result = JsonHelper.ToJson(dtPLM);
actionResult.Result = JsonHelper.ToJson(pdaFunction);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 初始化树形控件
///
/// 菜单数据表
/// 待处理的菜单集合
/// 当前树节点
private void InitTreeView(DataTable treeTable, string pFuncCode, PDAFunctionResult pFunctions)
{
string filterExpression = "MenuCode LIKE '" + pFuncCode + "%' AND LEN(MenuCode) = "
+ (pFuncCode.Length + Constant.INT_IS_TWO);
DataRow[] subRows = treeTable.Select(filterExpression, "MenuCode ASC");
//DataRow[] subRows = treeTable.Select(filterExpression, "ProcedureCode ASC");
foreach (DataRow newRow in subRows)
{
#region 插入子节点数据
int? intProcedureID = null;
int? intModelType = null;
if (!string.IsNullOrEmpty(newRow["ProcedureID"].ToString()))
{
intProcedureID = Convert.ToInt32(newRow["ProcedureID"]);
}
if (!string.IsNullOrEmpty(newRow["ModelType"].ToString()))
{
intModelType = Convert.ToInt32(newRow["ModelType"]);
}
PDAFunctionResult pdaFunctionChild = new PDAFunctionResult();
pdaFunctionChild.MenuCode = newRow["MenuCode"].ToString();
pdaFunctionChild.MenuName = newRow["MenuName"].ToString();
pdaFunctionChild.ProcedureID = intProcedureID;
pdaFunctionChild.ProcedureModel = newRow["ProcedureModel"].ToString();
pdaFunctionChild.ModelType = intModelType;
pFunctions.PDAFunctions.Add(pdaFunctionChild);
#endregion
// 递归方法
InitTreeView(treeTable, newRow["MenuCode"].ToString(), pdaFunctionChild);
}
}
#endregion
#region 获得工序信息
///
/// 获得工序信息
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 工序ID
///
///
/// 陈冰 2014.09.18 新建
///
public ActionResult GetProcedureByID(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
ProcedureEntity procedureEntity = ServiceInvoker.Invoke(this,
() => PMModuleLogic.GetProcedureDataEntityByID(procedureID, sUserInfo));
actionResult.Result = JsonHelper.ToJson(procedureEntity);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
#endregion
#region 校验
///
/// 校验产品条码是否可以走到该工序
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 工序ID
/// 条码
///
///
/// 陈冰 2014.09.18 新建
///
public ActionResult CheckBarcode(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID, string barcode)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
DataSet barcodeDataSet = ServiceInvoker.Invoke(this,
() => PMModuleLogic.CheckBarcodePDA(procedureID, barcode, sUserInfo));
if (barcodeDataSet != null && barcodeDataSet.Tables.Count > Constant.INT_IS_ZERO)
{
actionResult.Result = JsonHelper.ToJson(barcodeDataSet.Tables[0]);
actionResult.Status = (int)Constant.PDAResult.Success;
}
else
{
actionResult.Status = (int)Constant.PDAResult.Fail;
actionResult.Message = Constant.PDA_RESULT_UNKNOWN_ERR;
}
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 校验产品条码是否可以进行干补
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 工序ID
/// 条码
///
///
/// 袁新成 2015.4.1 新建
///
public ActionResult CheckDryRepairBarcode(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID, string barcode)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
DataSet barcodeDataSet = ServiceInvoker.Invoke(this,
() => PMModuleLogic.CheckDryRepairBarcode(procedureID, barcode, sUserInfo));
if (barcodeDataSet != null && barcodeDataSet.Tables.Count > Constant.INT_IS_ZERO)
{
actionResult.Result = JsonHelper.ToJson(barcodeDataSet.Tables[0]);
actionResult.Status = (int)Constant.PDAResult.Success;
}
else
{
actionResult.Status = (int)Constant.PDAResult.Fail;
actionResult.Message = Constant.PDA_RESULT_UNKNOWN_ERR;
}
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 检验生产工号
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 工序ID
/// 生产工号
///
/// 陈冰 2014.09.18 新建
///
public ActionResult CheckProcedureUser(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID, string procedureUserCode)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
CheckProcedureUserResult checkProcedureUserResult = ServiceInvoker.Invoke(this,
() => PMModuleLogic.CheckProcedureUser(procedureID, procedureUserCode, sUserInfo));
actionResult.Result = JsonHelper.ToJson(checkProcedureUserResult);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 校验窑车是否可装车并返回窑车信息
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 窑车号
/// 工序类别
///
///
/// 陈冰 2014.10.04 新建
///
public ActionResult CheckKilnCar(string accountCode, string userCode, string userPassword, string sessionKey, int pProcedureId, string kilnCarCode, int modelType)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
CheckKilnCarResultEntity checkKilnCarResultEntity = ServiceInvoker.Invoke(this,
() => PMModuleLogic.CheckKilnCar(pProcedureId, kilnCarCode, modelType, sUserInfo));
actionResult.Result = JsonHelper.ToJson(checkKilnCarResultEntity);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
#endregion
#region 保存条码信息
///
/// 保存条码信息
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 工序ID
/// 条码信息
public ActionResult AddWorkPiece(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID, ProductionDataEntity[] productionDataEntitys)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
DataTable dtProductionData = DataConvert.ObjectConvertToTable(productionDataEntitys);
if (!dtProductionData.Columns.Contains("IsPDA"))
{
dtProductionData.Columns.Add("IsPDA");
}
ProcedureEntity procedureInfo = null;
DataTable resultDT = ServiceInvoker.Invoke(this,
() => PMModuleLogicDAL.AddWorkPiece(procedureID, dtProductionData, sUserInfo, out procedureInfo));
actionResult.Result = JsonHelper.ToJson(resultDT);
actionResult.Status = (int)Constant.PDAResult.Success;
if (resultDT != null)
{
DataRow[] drs = resultDT.Select("out_errMsg is not null and out_errMsg <> ''");
if (drs != null && drs.Length > 0)
{
return actionResult;
}
}
#region PDA条码打印
if (procedureInfo != null && procedureInfo.BarCodePrintCopies > 0 &&
procedureInfo.ModelType == (int)Constant.ProcedureModelType.Normal)
{
try
{
if (procedureInfo.CollectType == 1)
{
//foreach (DataRow item in dtProductionData.Rows)
//{
// ServiceResultEntity sre = BarcodePrintLogic.PrintBarcode(item["barcode"].ToString(),
// procedureInfo.BarCodePrintCopies, null, sUserInfo);
// if (sre.Status != Constant.ServiceResultStatus.Success)
// {
// actionResult.Status = (int)Constant.ServiceResultStatus.Other;
// actionResult.Message = sre.Message;
// return actionResult;
// }
//}
}
else
{
//ServiceResultEntity sre = BarcodePrintLogic.PrintBarcode(dtProductionData.Rows[0]["barcode"].ToString(),
// procedureInfo.BarCodePrintCopies, null, sUserInfo);
ServiceResultEntity sre = BarcodePrintLogic.PrintBarcode_3C(dtProductionData.Rows[0]["barcode"].ToString(),
procedureInfo.BarCodePrintCopies, null, sUserInfo, 0);
if (sre.Status != Constant.ServiceResultStatus.Success)
{
actionResult.Status = (int)Constant.ServiceResultStatus.Other;
actionResult.Message = sre.Message;
return actionResult;
}
}
}
catch (Exception ex)
{
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.ServiceResultStatus.Other;
actionResult.Message = "条码打印异常";
return actionResult;
}
}
#endregion PDA条码打印
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
try
{
string ss = JsonHelper.ToJson(productionDataEntitys);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
$" userCode:{userCode} procedureID:{procedureID} " + ss,
LocalPath.LogExePath);
}
catch
{
}
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
#endregion
#region 获得系统/基数数据
///
/// 获得数据字典
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 字典类型
///
public ActionResult GetDataDictionaryByType(string accountCode, string userCode, string userPassword, string sessionKey, string dicType)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
DataTable dicDataTable = ServiceInvoker.Invoke(this,
() => CommonModuleLogic.GetDataDictionaryByType(sUserInfo, dicType));
actionResult.Result = JsonHelper.ToJson(dicDataTable);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
#endregion
#region 检验工序接口
///
/// 获得检验标识
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
///
///
/// 陈冰 2014.10.04 新建
///
public ActionResult GetDefectFlagData(string accountCode, string userCode, string userPassword, string sessionKey)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
#region 构造缺陷标识的数据源
DataTable dtDefectFlag = CreateDataSource.GetDefectFlagTable();
#endregion
actionResult.Result = JsonHelper.ToJson(dtDefectFlag);
actionResult.Status = (int)Constant.PDAResult.Success;
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 由条码和当前检验工序获取返工工序
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 当前检验工序ID
/// 条码
///
///
/// 陈冰 2014.10.04 新建
///
public ActionResult GetReworkProcedureByBarcode(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID, string barcode)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
DataSet reworkDs = ServiceInvoker.Invoke(this,
() => PMModuleLogic.GetReworkProcedureByBarcode(procedureID, barcode));
if (reworkDs != null && reworkDs.Tables.Count > Constant.INT_IS_ZERO)
{
actionResult.Result = JsonHelper.ToJson(reworkDs.Tables[0]);
actionResult.Status = (int)Constant.PDAResult.Success;
}
else
{
actionResult.Status = (int)Constant.PDAResult.Fail;
actionResult.Message = Constant.PDA_RESULT_UNKNOWN_ERR;
}
}
catch (Exception ex)
{
//LogFileOperation.Error(DataManager.LogFileName, ex.Message);
OutputLog.TraceLog(LogPriority.Error,
this.ToString(),
System.Reflection.MethodBase.GetCurrentMethod().Name,
ex.ToString(),
LocalPath.LogExePath);
actionResult.Status = (int)Constant.PDAResult.Exception;
actionResult.Message = Constant.PDA_RESULT_EXCEPTION;
}
return actionResult;
}
///
/// 由当前检验工序获取缺陷列表
///
/// 帐套code
/// 用户code
/// 用户密码
/// 本次登陆密钥
/// 当前检验工序ID
/// 缺陷编码
///
///
/// 陈冰 2014.10.04 新建
///
public ActionResult GetDefectByProcedureIDAndDefectCode(string accountCode, string userCode, string userPassword, string sessionKey, int procedureID, string defectCode)
{
ActionResult actionResult = new ActionResult();
try
{
// 验证请求头信息
actionResult = this.DoPDACheck(accountCode, userCode, userPassword, sessionKey);
// 验证失败
if (actionResult.Status != (int)Constant.PDAResult.Success)
{
return actionResult;
}
object defectDs = ServiceInvoker.Invoke