Exemplo n.º 1
0
        /// <summary>
        /// 增加
        ///
        /// </summary>
        /// <param name="model">设备接口对象</param>
        /// <returns>返回处理结果</returns>
        public CommonResult <QC_DrumsFindLeakReport> AddQCDrumsFindLeakReport(QC_DrumsFindLeakReport model)
        {
            var result = new CommonResult <QC_DrumsFindLeakReport>();

            try
            {
                var dbSession  = new DBService <QC_DrumsFindLeakReport>().DbSession;
                var dbSession1 = new DBService <QC_FindLeakDrumsSetDetail>(dbSession.Context).DbSession;

                string strConnn = dbSession.Context.Database.Connection.ConnectionString;

                using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
                {
                    model.FLVCode = PubRepository.GetAutomaticNumber(strConnn, "QCDF", 5, "FLVCode", "QC_DrumsFindLeakReport", model.CreateDate);
                    var newModel = dbSession.Insert(model);
                    //更新已检状态
                    var CurrQCDetail = dbSession1.GetQueryable(t => t.ArrangedVouchCode == newModel.SourceCode).FirstOrDefault();
                    if (CurrQCDetail != null)
                    {
                        CurrQCDetail.IsLeak = 1;
                        dbSession1.Update(CurrQCDetail);
                    }
                    ForCfPExecuteServices.GetInstance(currUserSession.SessionId).InsertArrangedVouchLog(new ArrangedVouchLog()
                    {
                        ArrangedVouchCode = newModel.SourceCode,
                        CraftsName        = "检漏",
                        OperatDesc        = "检漏完成",
                        Operator          = currUserSession.UserName,
                        OperatingTime     = DateTime.Now,
                        Frequency         = newModel.Frequency
                    });
                    ts.Complete();
                    result.Data = newModel;
                }
            }
            catch (Exception ex)
            {
                Utils.Logger.Error(ex.ToString());
                throw ex;
            }
            return(result);
        }
Exemplo n.º 2
0
        public Server.Utility.CommonResult <QC_DrumsFindLeakReport> AddQCDrumsFindLeakReport(string sessionId, QC_DrumsFindLeakReport model)
        {
            try
            {
                var result = ForQCDFindLeakServices.GetInstance(sessionId).AddQCDrumsFindLeakReport(model);

                if (result.IsSuccess)
                {
                    var srv = new CfPExecuteService();
                    srv.UpdateCraftsProcessExecute(sessionId, result.Data.SourceCode, 2, 2);

                    if (result.Data.FLResult.Equals("不合格")) //不合格,将排配单设定为设备故障,将工艺空鼓设定完成。
                    {
                        var ret = new ArrangedVService().UdateArrUserStatusByArrCode(sessionId, result.Data.SourceCode, 99);
                        srv.UpdateCraftsProcessExecute(sessionId, result.Data.SourceCode, 8, 2);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new FaultException <CustomFaultMessage>(new CustomFaultMessage()
                {
                    ErrorCode  = ex.HResult,
                    Message    = ex.Message,
                    StackTrace = ex.StackTrace
                }, ex.Message);
            }
        }