Esempio n. 1
0
        /// <summary>
        /// 获取单个打印配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <PrintConfigEntity> GetSinglePrintConfig(QueryPrintConfigParam model)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryPrintConfigParam>(namespaceName, "GetSinglePrintConfig", model);

            try
            {
                #region 验证
                if (model == null || string.IsNullOrEmpty(model.printType))
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception));
                }
                #endregion
                var retModel = printConfigBLL.GetModel(model.printType.ToString());
                if (retModel == null)
                {
                    exception.exceptionMsg = "没有找到数据";
                    return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.FAILURE, exception.exceptionMsg, exception));
                }
                return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <PrintConfigEntity>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 2
0
        private string namespaceName = "WIP_Test.TestService";//命名空间



        /// <summary>
        /// 加解密数据
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ReturnBody <string> GetEncryptData(GetEncryptData param)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <GetEncryptData>(namespaceName, "GetEncryptData", param);

            try
            {
                string result = "";
                if (param.isEncrypt == "0")
                {//加密
                    result = DESEncryptHelper.Encrypt(param.value);
                }
                else if (param.isEncrypt == "1")
                { //解密
                    result = DESEncryptHelper.Decrypt(param.value);
                }
                else
                {
                    return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, "是否解密值错误"));
                }
                return(BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS, result));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception, "出现错误:" + ex.Message));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 查询用户登录记录列表
        /// </summary>
        /// <param name="userName">用户名</param>
        /// <returns>用户登录记录列表</returns>
        public ReturnBody <List <UserLoginLogEntity> > GetUserLoginLogList(string userName)
        {
            ReturnBody <List <UserLoginLogEntity> > ret = null;
            //请求信息没记录下来
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName,
                                                                                   "GetUserLoginLogList", userName,
                                                                                   "", "");

            try
            {//校验
                IValidateFactory factory  = new UserLoginLogValiFactory();
                IValidate        validate = factory.CreateValidate();
                ret = validate.Validate <string, List <UserLoginLogEntity> >(userName, ref exception);
                if (ret != null)
                {
                    return(ret);
                }

                ret         = new ReturnBody <List <UserLoginLogEntity> >();
                ret.resCode = ResCode.SUCCESS;
                ret.resData = IOCContainer.Container.GetExport <IUserLoginLogBLL>("UserLoginLog").Value.GetUserLoginLogList(userName);
            }
            catch (Exception ex)
            {//异常信息没有记录下来
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                WipLogHelper.WriteExceptionInfo(exception);

                ret.resCode = ResCode.FAILURE;
                ret.resMsg  = ex.Message;
            }
            return(ret);
        }
Esempio n. 4
0
        public ReturnBody <AuthorizationUserModel> GetAuthorizationuser(AuthorizationUserModel model)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <AuthorizationUserModel>(namespaceName, "GetAuthorizationuser", model);

            try
            {
                #region 验证
                if (model == null || string.IsNullOrEmpty(model.s95id))
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg));
                }
                #endregion
                var retModel = Authorizationbll.GetAuthorization(model.s95id);
                if (retModel == null)
                {
                    exception.exceptionMsg = "没有找到相关用户";
                    return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.FAILURE, exception.exceptionMsg));
                }
                return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <AuthorizationUserModel>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 获取单个代码项表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <CodeItemsEntity> GetSingleCodeItems(QueryCodeItemsModel model)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeItemsModel>(namespaceName, "GetSingleCodeItems", model);

            try
            {
                #region 验证
                if (model == null || string.IsNullOrEmpty(model.setCode) || string.IsNullOrEmpty(model.code))
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception));
                }
                #endregion
                var retModel = codeItemsBLL.GetModel(model.setCode, model.code);
                if (retModel == null)
                {
                    exception.exceptionMsg = "没有找到数据";
                    return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.FAILURE, exception.exceptionMsg, exception));
                }
                return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.SUCCESS, ResMsg.SUCCESS, retModel));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <CodeItemsEntity>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// 获取代码集表列表
        /// </summary>
        /// <returns></returns>
        public ReturnBody <List <CodeSetsModel> > GetAllCodeSets()
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetAllCodeSets", "");

            try
            {
                List <CodeSetsModel> list = codeSetsBLL.GetModelList();
                return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 获取打印配置列表(分页)
        /// </summary>
        /// <returns></returns>
        public ReturnBody <PageResultModel <PrintConfigModel> > GetPrintConfigList(QueryPrintConfigParam queryModel)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryPrintConfigParam>(namespaceName, "GetPrintConfigList", queryModel);

            try
            {
                PageResultModel <PrintConfigModel> list = printConfigBLL.GetModelListForPage(queryModel);
                return(BLLHelpler.GetReturnBody <PageResultModel <PrintConfigModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <PageResultModel <PrintConfigModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 8
0
        /// <summary>
        /// 生成token
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public ReturnBody <string> GenerateToken(GenerateTokenParam user)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <GenerateTokenParam>(namespaceName, "GenerateToken", user);

            try
            {
                string token = JwtHelp.GenerateToken(user.Name, null, user.ExpDays);
                return(BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS, token));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception, "出现错误:" + ex.Message));
            }
        }
Esempio n. 9
0
        /// <summary>
        /// 获取邮件类别列表
        /// </summary>
        /// <returns></returns>
        public ReturnBody <List <MailRuleEntity> > GetMailRuleList()
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetMailRuleList", "", "", "");

            try
            {
                List <MailRuleEntity> list = MailRuleBLL.GetInstance().GetMailRuleList();
                return(BLLHelpler.GetReturnBody <List <MailRuleEntity> >(ResCode.SUCCESS, ResMsg.SUCCESS, list));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <List <MailRuleEntity> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 10
0
        /// <summary>
        /// 获取指定代码集的代码项表列表
        /// </summary>
        /// <returns></returns>
        public ReturnBody <List <CodeSetsModel> > GetAllCodeItemsByCodeSet(GetAllCodeItemsByCodeSetParam param)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <GetAllCodeItemsByCodeSetParam>(namespaceName, "GetAllCodeItemsByCodeSet", param);

            try
            {
                string strWhere           = " codeItems.setCode='" + param.codeSet + "' ";
                List <CodeSetsModel> list = codeItemsBLL.GetAllModelList(strWhere);
                return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <List <CodeSetsModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 11
0
        /// <summary>
        /// 打印操作
        /// </summary>
        /// <param name="workbook"></param>
        /// <param name="printInfo"></param>
        /// <returns></returns>
        public void Print(string json_cellList, PrintInfoModel printInfo, PageOrientationType orientation)
        {
            IDictionary <string, object> logDict = new Dictionary <string, object>();

            logDict.Add("json_cellList", json_cellList);
            logDict.Add("printInfo", printInfo);
            logDict.Add("orientation", orientation);
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "Print", logDict
                                                                                                          , "", printInfo == null ? "" : printInfo.processCardNumber, ExceptionSource.WIPPost, ExceptionLevel.BusinessError, wipSource);

            try
            {
                //创建文件
                List <ExcelSheetModel> sheetModelList = new List <ExcelSheetModel>();
                List <ExcelCellModel>  cellModelList  = JsonConvert.DeserializeObject <List <ExcelCellModel> >(json_cellList);
                ExcelSheetModel        sheetModel     = new ExcelSheetModel()
                {
                    sheetName = this.workbook.GetSheetAt(0).SheetName,
                    dataList  = cellModelList,
                    sheetType = "",
                };
                sheetModelList.Add(sheetModel);
                byte[] bytes = ExcelUtil.writeExcelToFile(this.workbook, sheetModelList, printInfo.tempName);

                //修改为“打印中”
                var result = UpdatePrintStatusToPrinting(printInfo.id);
                if (!result)
                {
                    throw new Exception("更新状态为打印中失败,printInfo.id:" + printInfo.id.ToString());
                }

                PrintHelper.PrintExcel(bytes, printInfo.printerName, orientation);

                //打印成功
                this.DoByPrintResultSuccess(printInfo);
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                WipLogHelper.WriteExceptionInfo(exception);

                //打印失败
                this.DoByPrintResultFailure(printInfo, ex);
            }
        }
Esempio n. 12
0
        //*/

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ReturnBody <bool> SendMail(MailParam param)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <MailParam>(namespaceName, "SendMail", param);

            try
            {
                param.describe = "<p class=\"MsoNormal\"><span lang=\"EN-US\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>上汽项目<span lang=\"EN-US\">,ECM</span>联调问题很多<span lang=\"EN-US\">,</span>项目已经红色预警<span lang=\"EN-US\">,</span>我们将在周末继续配合法方修正各个关键点<span lang=\"EN-US\">.<o:p></o:p></span></p>";

                IMail _mail = new Mail(MailCategory.缺省);
                _mail.MailSending(param.mailSubject, param.describe, param.file_Path);
                return(BLLHelpler.GetReturnBody <bool>(ResCode.SUCCESS, ResMsg.SUCCESS, true));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <bool>(ResCode.FAILURE, ResMsg.FAILURE, exception, false));
            }
        }
Esempio n. 13
0
        /// <summary>
        /// 更新权限到Redis
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ReturnBody <string> UpdateAuth()
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "UpdateAuth", "", "", "");

            try
            {
                JwtHelp.UpdateAuthToRedis();

                ReturnBody <string> ret = new ReturnBody <string>();
                ret.resCode = ResCode.SUCCESS;
                return(ret);
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 14
0
        /// <summary>
        /// 获取邮件人员列表
        /// </summary>
        /// <returns></returns>
        public ReturnBody <List <MailPersonModel> > GetMailPersonList(QueryMailPersonParam param)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetMailPersonList", "", "", "");

            try
            {
                if (param == null || string.IsNullOrEmpty(param.categoryId))
                {
                    return(BLLHelpler.GetReturnBody <List <MailPersonModel> >(ResCode.PARAMETERNOEMPTY, ResMsg.PARAMETERNOEMPTY, null));
                }
                List <MailPersonModel> list = MailRuleBLL.GetInstance().GetMailPersonList(param.categoryId);
                return(BLLHelpler.GetReturnBody <List <MailPersonModel> >(ResCode.SUCCESS, ResMsg.SUCCESS, list));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <List <MailPersonModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 获取权限
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ReturnBody <List <RedisModel> > GetAuth()
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <string>(namespaceName, "GetAuth", "", "", "");

            try
            {
                List <RedisModel> redisModelList = new List <RedisModel>();
                redisModelList = JwtHelp.GetAuthFormRedis();

                ReturnBody <List <RedisModel> > ret = new ReturnBody <List <RedisModel> >();
                ret.resCode = ResCode.SUCCESS;
                ret.resData = redisModelList;
                return(ret);
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <List <RedisModel> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 获取代码项表列表(分页)
        /// </summary>
        /// <returns></returns>
        public ReturnBody <PageResultModel <CodeItemsEntity> > GetCodeItemsList(QueryCodeItemsModel queryModel)
        {
            var strOrderBy = " codeItems.lastModifyTime DESC";
            var strWhere   = "";
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeItemsModel>(namespaceName, "GetCodeItemsList", queryModel);

            try
            {
                if (queryModel != null)
                {
                    if (!string.IsNullOrEmpty(queryModel.code))
                    {
                        strWhere += " codeItems.code LIKE '%" + queryModel.code + "%',";
                    }
                    if (!string.IsNullOrEmpty(queryModel.name))
                    {
                        strWhere += " codeItems.name LIKE '%" + queryModel.name + "%',";
                    }
                    if (!string.IsNullOrEmpty(queryModel.setCode))
                    {
                        strWhere += " codeItems.setCode LIKE '%" + queryModel.setCode + "%',";
                    }
                    if (!string.IsNullOrEmpty(queryModel.delFlag))
                    {
                        strWhere += " codeItems.delFlag ='" + queryModel.delFlag + "',";
                    }
                    if (!string.IsNullOrEmpty(strWhere))
                    {
                        strWhere = strWhere.Substring(0, strWhere.Length - 1);
                    }
                }
                PageResultModel <CodeItemsEntity> list = codeItemsBLL.GetModelListForPage(strOrderBy, strWhere, queryModel);
                return(BLLHelpler.GetReturnBody <PageResultModel <CodeItemsEntity> >(ResCode.SUCCESS, ResMsg.SUCCESS, list));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <PageResultModel <CodeItemsEntity> >(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 更新邮箱人员
        /// </summary>
        /// <returns></returns>
        public ReturnBody <string> UpdateMailPerson(UpdateMailPersonParam param)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <UpdateMailPersonParam>(namespaceName, "UpdateMailPerson", param, "", "");

            try
            {
                MethodReturnResultModel ret = MailRuleBLL.GetInstance().UpdateMailPerson(param, JwtHelp.GetCurUserName());
                if (ret != null && ret.IsSuccess)
                {
                    return(BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS, ""));
                }
                else
                {
                    return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, ""));
                }
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 18
0
        /// <summary>
        /// 删除代码项表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <bool> EnableCodeItems(QueryCodeItemsModel model)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeItemsModel>(namespaceName, "DelCodeItems", model);

            try
            {
                #region 验证
                if (model == null || model.id == 0)
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    return(BLLHelpler.GetReturnBody <bool>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception));
                }
                #endregion
                var result = codeItemsBLL.Enable(model.id.ToString(), model.delFlag, JwtHelp.GetCurUserName());
                return(BLLHelpler.GetReturnBody <bool>(ResCode.SUCCESS, ResMsg.SUCCESS, result));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <bool>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 19
0
        /// <summary>
        /// 禁启用代码集表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <bool> EnableCodeSets(QueryCodeSetsModel model)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <QueryCodeSetsModel>(namespaceName, "EnableCodeSets", model);

            try
            {
                #region 验证
                if (model == null || string.IsNullOrEmpty(model.code))
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    return(BLLHelpler.GetReturnBody <bool>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception));
                }
                #endregion

                string lastModifier = JwtHelp.GetCurUserName();
                var    result       = codeSetsBLL.Enable(model.code.ToString(), model.delFlag, lastModifier);
                return(BLLHelpler.GetReturnBody <bool>(ResCode.SUCCESS, ResMsg.SUCCESS, result));
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <bool>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 20
0
        /// <summary>
        /// 插入打印配置
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <string> InsertPrintConfig(PrintConfigEntity model)
        {
            ReturnBody <string> retBody   = null;
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <PrintConfigEntity>(namespaceName, "InsertPrintConfig", model);

            try
            {
                #region 验证
                if (model == null)
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.PARAMETERNOEMPTY, ResMsg.PARAMETERNOEMPTY, exception);
                    return(retBody);
                }
                List <ColumnsModel> columnsList = new List <ColumnsModel>()
                {
                    new ColumnsModel()
                    {
                        ChinaName = "打印类型", PropertyName = "printType"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "打印类型描述", PropertyName = "printTypeName"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "打印机名称", PropertyName = "printerName"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "打印模板", PropertyName = "printTemplete"
                    }
                };

                ValidateResModel res = ValidateDataHelper.ValidateNullOrEmpty <PrintConfigEntity>(columnsList, model);
                if (res != null && !res.IsValidate)
                {
                    exception.exceptionMsg = res.ValidateMsg;
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.PARAMETERNOEMPTY, res.ValidateMsg, exception);
                    return(retBody);
                }
                //验证重复
                if (printConfigBLL.Exists(model.printType.ToString()))
                {
                    exception.exceptionMsg = "数据已经存在";
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, exception.exceptionMsg, exception);
                    return(retBody);
                }
                #endregion

                model.delFlag    = false;
                model.createTime = model.lastModifyTime = DateTime.Now;

                if (printConfigBLL.Add(model) > 0)
                {
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS);
                }
                else
                {//失败
                    exception.exceptionMsg = "保存数据失败";
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, exception.exceptionMsg, exception);
                }
                return(retBody);
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE + ":" + ex.Message, exception);
                return(retBody);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// 基础数据同步
        /// </summary>
        /// <param name="basedataList"></param>
        /// <returns></returns>
        public ReturnBody <BaseDataSynResultModel> datasyn(List <BaseDataSynParamModel> basedataList)
        {
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <List <BaseDataSynParamModel> >(namespaceName, "datasyn", basedataList, "", "");

            try
            {
                #region  验证
                if (basedataList == null)
                {
                    exception.exceptionMsg = "要同步的基础数据为空";
                    return(BLLHelpler.GetReturnBody <BaseDataSynResultModel>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception));
                }
                List <ColumnsModel> columnsList = null;
                ValidateResModel    res         = null;
                int i = 0;
                List <BaseDataSynParamModel> newBasedataList = new List <BaseDataSynParamModel>();
                List <string> successMaterial = new List <string>();
                List <FailureSaveMaterial> failureMaterialList = new List <FailureSaveMaterial>();
                FailureSaveMaterial        failureSaveMaterial = null;
                BaseDataSynResultModel     baseModel           = new BaseDataSynResultModel();
                foreach (var item in basedataList)
                {
                    i++;
                    //必填项验证
                    columnsList = new List <ColumnsModel>()
                    {
                        new ColumnsModel()
                        {
                            ChinaName = "标识", PropertyName = "UID"
                        },
                        new ColumnsModel()
                        {
                            ChinaName = "出热MES物料号", PropertyName = "heatingOutCode"
                        },
                        new ColumnsModel()
                        {
                            ChinaName = "物料编码", PropertyName = "materialCode"
                        },

                        /*
                         * new ColumnsModel(){ChinaName="1号线装炉数量",PropertyName="ECM_LINE1"},
                         * new ColumnsModel(){ChinaName="2号线装炉数量",PropertyName="ECM_LINE2"},
                         * new ColumnsModel(){ChinaName="3号线装炉数量",PropertyName="ECM_LINE3"},
                         * new ColumnsModel(){ChinaName="4号线装炉数量",PropertyName="ECM_LINE4"},
                         * new ColumnsModel(){ChinaName="5号线装炉数量",PropertyName="ECM_LINE5"},
                         * //*/
                        new ColumnsModel()
                        {
                            ChinaName = "类型", PropertyName = "classification"
                        },
                        new ColumnsModel()
                        {
                            ChinaName = "物料出ECM后的去向", PropertyName = "directionHeating"
                        }
                    };
                    res = ValidateDataHelper.ValidateNullOrEmpty <BaseDataSynParamModel>(columnsList, item);
                    if (res != null && !res.IsValidate)
                    {
                        failureSaveMaterial = new FailureSaveMaterial();
                        failureSaveMaterial.failureReason = "第" + i.ToString() + "个" + res.ValidateMsg;
                        failureSaveMaterial.failureCode   = failureCode.empty;
                        failureSaveMaterial.materialCode  = item.materialCode;
                        failureSaveMaterial.UID           = item.UID;
                        failureMaterialList.Add(failureSaveMaterial);
                        baseModel.FailureCount++;
                        continue;
                    }
                    else
                    {
                        //验证产线装炉量
                        if (item.ECM_LINE1 == 0 && item.ECM_LINE2 == 0 &&
                            item.ECM_LINE3 == 0 && item.ECM_LINE4 == 0 && item.ECM_LINE5 == 0)
                        {
                            failureSaveMaterial = new FailureSaveMaterial();
                            failureSaveMaterial.failureReason = "第" + i.ToString() + "个五条产线的装炉量不能全是0";
                            failureSaveMaterial.failureCode   = failureCode.empty;
                            failureSaveMaterial.materialCode  = item.materialCode;
                            failureSaveMaterial.UID           = item.UID;
                            failureMaterialList.Add(failureSaveMaterial);
                            baseModel.FailureCount++;
                            continue;
                        }

                        newBasedataList.Add(item);
                    }
                }

                #endregion

                List <Dictionary <string, string> > modelList = JsonConvert.DeserializeObject <List <Dictionary <string, string> > >(JsonConvert.SerializeObject(newBasedataList));



                WIP_PFMD.GEBF.BrilliantFactoryClient bfclient = PFMDHelper.GetInstance().GetPfmdCommObject().bfclient;



                Dictionary <string, string> propDict = null;
                bool result = false;

                List <string> materialCodeList = new List <string>();
                foreach (var model in modelList)
                {
                    var new_materialCode = model["materialCode"];
                    materialCodeList.Add(new_materialCode);

                    propDict = new Dictionary <string, string>();
                    foreach (var item in model)
                    {
                        if (item.Key == "materialCode" || item.Key == "UID")
                        {
                            continue;
                        }
                        propDict.Add(item.Key, item.Value);
                    }
                    propDict.Add("heatingInCode", new_materialCode);//进热物料号 【EditBy shaocx,2018-12-13】

                    Dictionary <string, string> dict = bfclient.GetAllProperty(new_materialCode);
                    if (dict != null && dict.Count > 0)
                    {//存在
                        result = bfclient.batchWriteProperty(new_materialCode, propDict);
                        if (!result)
                        {//失败
                            failureSaveMaterial = new FailureSaveMaterial();
                            failureSaveMaterial.failureReason = "第" + i.ToString() + "个修改物料信息失败";
                            failureSaveMaterial.failureCode   = failureCode.savefail;
                            failureSaveMaterial.materialCode  = model["materialCode"];
                            failureMaterialList.Add(failureSaveMaterial);
                            baseModel.FailureCount++;
                        }
                        else
                        {//成功
                            baseModel.SuccessCount++;
                            successMaterial.Add(model["materialCode"]);
                        }
                    }
                    else
                    {                                 //不存在
                        //逻辑删除标记记为0
                        propDict.Add("delFlag", "0"); //逻辑删除为不删除
                        result = bfclient.createMaterial(new_materialCode, "");
                        if (result)
                        {
                            result = bfclient.batchWriteProperty(new_materialCode, propDict);
                        }
                        if (result)
                        {
                            baseModel.SuccessCount++;
                            successMaterial.Add(model["materialCode"]);
                        }
                        else
                        {
                            failureSaveMaterial = new FailureSaveMaterial();
                            failureSaveMaterial.failureReason = "第" + i.ToString() + "个修改物料信息失败";
                            failureSaveMaterial.failureCode   = failureCode.savefail;
                            failureSaveMaterial.materialCode  = model["materialCode"];
                            failureMaterialList.Add(failureSaveMaterial);
                            baseModel.FailureCount++;
                        }
                    }
                }


                //去掉这里的逻辑 【EditBy shaocx,2019-01-22】

                /*
                 * //获取所有物料号
                 * //如果所有的物料号大于同步的物料号,那么多余出来的物料号要修改删除标记为1,表示已删除
                 * string[] allMaterials = bfclient.getAllMaterials();
                 * if (allMaterials != null && allMaterials.Length > 0)
                 * {
                 *  if (modelList.Count < allMaterials.Length)
                 *  {
                 *      foreach (var item in allMaterials)
                 *      {
                 *          if (!materialCodeList.Contains(item))
                 *          {//数据库里有,但是推送的内容里没有
                 *              bfclient.writeProperty(item, "delFlag", "1");//逻辑删除
                 *          }
                 *      }
                 *  }
                 * }
                 *
                 * //*/

                baseModel.SuccessMaterial = successMaterial;
                baseModel.FailureMaterial = failureMaterialList;

                if (baseModel.FailureCount > 0)
                {
                    exception.exceptionMsg  = ResMsg.FAILURE;
                    exception.exceptionData = JsonConvert.SerializeObject(baseModel);
                    return(BLLHelpler.GetReturnBody <BaseDataSynResultModel>(ResCode.FAILURE, ResMsg.FAILURE, exception, baseModel));
                }
                else
                {
                    return(BLLHelpler.GetReturnBody <BaseDataSynResultModel>(ResCode.SUCCESS, ResMsg.SUCCESS));
                }
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                return(BLLHelpler.GetReturnBody <BaseDataSynResultModel>(ResCode.FAILURE, ResMsg.FAILURE, exception));
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 更新代码集表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <string> UpdateCodeSets(CodeSetsEntity model)
        {
            ReturnBody <string> retBody   = null;
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <CodeSetsEntity>(namespaceName, "UpdateCodeSets", model);

            try
            {
                #region 验证
                if (model == null || model.id == 0)
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception);
                    return(retBody);
                }
                List <ColumnsModel> columnsList = new List <ColumnsModel>()
                {
                    new ColumnsModel()
                    {
                        ChinaName = "代码编码", PropertyName = "code"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "代码名称", PropertyName = "name"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "说明", PropertyName = "note"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "创建时间", PropertyName = "createTime", DataType = typeof(DateTime), IsNullable = true
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "修改时间", PropertyName = "lastModifyTime", DataType = typeof(DateTime), IsNullable = true
                    },
                };

                ValidateResModel res = ValidateDataHelper.ValidateNullOrEmpty <CodeSetsEntity>(columnsList, model);
                if (res != null && !res.IsValidate)
                {
                    exception.exceptionMsg = res.ValidateMsg;
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.PARAMETERNOEMPTY, exception.exceptionMsg, exception);
                    return(retBody);
                }
                //验证重复
                if (codeSetsBLL.Exists(model.code.ToString(), model.id))
                {
                    exception.exceptionMsg = "数据已经存在";
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, exception.exceptionMsg, exception);
                    return(retBody);
                }

                #endregion

                bool result = codeSetsBLL.Update(model);
                if (result)
                {
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS);
                }
                else
                {
                    exception.exceptionMsg = "更新失败";
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, exception.exceptionMsg, exception);
                }
                return(retBody);
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE + ":" + ex.Message, exception);
                return(retBody);
            }
        }
Esempio n. 23
0
        /// <summary>
        /// 处理打印结果
        /// </summary>
        /// <param name="printResult">打印结果</param>
        /// <param name="printInfo">打印信息</param>
        /// <param name="errMsg">错误信息</param>
        /// <returns></returns>
        public virtual bool DoByPrintResult(bool printResult, PrintInfoModel printInfo, string errMsg = "")
        {
            var retResult = false;//返回结果
            IDictionary <string, object> logDict = new Dictionary <string, object>();

            logDict.Add("printResult", printResult);
            logDict.Add("printInfo", printInfo);
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <IDictionary <string, object> >(namespaceName, "DoByPrintResult", logDict
                                                                                                          , "", printInfo == null ? "" : printInfo.processCardNumber, ExceptionSource.WIPPost, ExceptionLevel.BusinessError, wipSource);

            try
            {
                #region 准备数据

                SqlParameter[] parameters_UpdatePrintResult = this.GetSqlParamForUpdatePrintResult(printResult, printInfo, errMsg);

                #endregion

                #region 事务处理

                using (SqlConnection conn = new SqlConnection(SQLServerHelper.connectionString))
                {
                    conn.Open();
                    using (SqlTransaction trans = conn.BeginTransaction())
                    {
                        TransactionModel transModel = new TransactionModel()
                        {
                            conn  = conn,
                            trans = trans
                        };
                        try
                        {
                            var execResult = WIPDataAccess.CreateDAL <IPrintInfoDAL>("PrintInfoDAL").UpdatePrintResult(parameters_UpdatePrintResult, transModel);
                            if (execResult != 1)
                            {//返回1代表执行成功,返回-1代表失败
                                throw new Exception("处理打印结果失败,parameters:" + JsonConvert.SerializeObject(parameters_UpdatePrintResult)
                                                    + ",execResult:" + execResult.ToString());
                            }

                            trans.Commit();
                            retResult = true;
                        }
                        catch
                        {
                            retResult = false;
                            trans.Rollback();
                            throw;
                        }
                    }
                }

                #endregion
            }
            catch (Exception ex)
            {
                retResult = false;
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                WipLogHelper.WriteExceptionInfo(exception);
            }
            return(retResult);
        }
Esempio n. 24
0
        /// <summary>
        /// 插入代码项表
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public ReturnBody <string> InsertCodeItems(CodeItemsEntity model)
        {
            ReturnBody <string> retBody   = null;
            ExceptionInfoEntity exception = WipLogHelper.GetExceptionInfo <CodeItemsEntity>(namespaceName, "InsertCodeItems", model);

            try
            {
                #region 验证
                if (model == null)
                {
                    exception.exceptionMsg = ResMsg.PARAMETERNOEMPTY;
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.PARAMETERNOEMPTY, ResMsg.PARAMETERNOEMPTY, exception);
                    return(retBody);
                }
                List <ColumnsModel> columnsList = new List <ColumnsModel>()
                {
                    new ColumnsModel()
                    {
                        ChinaName = "代码项编码", PropertyName = "code"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "代码项名称", PropertyName = "name"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "代码编码", PropertyName = "setCode"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "说明", PropertyName = "note"
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "创建时间", PropertyName = "createTime", DataType = typeof(DateTime), IsNullable = true
                    },
                    new ColumnsModel()
                    {
                        ChinaName = "修改时间", PropertyName = "lastModifyTime", DataType = typeof(DateTime), IsNullable = true
                    },
                };

                ValidateResModel res = ValidateDataHelper.ValidateNullOrEmpty <CodeItemsEntity>(columnsList, model);
                if (res != null && !res.IsValidate)
                {
                    exception.exceptionMsg = res.ValidateMsg;
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.PARAMETERNOEMPTY, res.ValidateMsg, exception);
                    return(retBody);
                }
                //验证重复
                if (codeItemsBLL.Exists(model.setCode, model.code))
                {
                    exception.exceptionMsg = "数据已经存在";
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, exception.exceptionMsg, exception);
                    return(retBody);
                }
                #endregion

                model.delFlag    = false;
                model.createTime = model.lastModifyTime = DateTime.Now;

                if (codeItemsBLL.Add(model) > 0)
                {
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.SUCCESS, ResMsg.SUCCESS);
                }
                else
                {//失败
                    exception.exceptionMsg = "保存数据失败";
                    retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, exception.exceptionMsg, exception);
                }
                return(retBody);
            }
            catch (Exception ex)
            {
                WipLogHelper.GetExceptionInfoForError(ex, ref exception);
                retBody = BLLHelpler.GetReturnBody <string>(ResCode.FAILURE, ResMsg.FAILURE + ":" + ex.Message, exception);
                return(retBody);
            }
        }