Example #1
0
        //public Server.Utility.CommonResult<QC_FindLeakDrumsSet> AddQCDrumsSet(string sessionId, QC_FindLeakDrumsSet model)
        //{
        //    try
        //    {
        //        return ForQCDrumsSet.GetInstance(sessionId).AddQCDrumsSet(model);
        //    }
        //    catch (Exception ex)
        //    {
        //        throw new FaultException<CustomFaultMessage>(new CustomFaultMessage()
        //        {
        //            ErrorCode = ex.HResult,
        //            Message = ex.Message,
        //            StackTrace = ex.StackTrace
        //        }, ex.Message);
        //    }
        //}

        /// 设定转漏转鼓保存
        /// <returns>返回处理结果</returns>

        public Server.Utility.CommonResult <bool> AddQCDrumsSet(string sessionId, QC_FindLeakDrumsSet model, List <QC_FindLeakDrumsSetDetail> detailList)
        {
            try
            {
                var result = ForQCDrumsSetServices.GetInstance(sessionId).AddQCDrumsSet(model, detailList);
                if (result.IsSuccess && result.Data)
                {
                    //启用排配单的检漏流程
                    detailList.ForEach(item =>
                    {
                        var ret = new CfPExecuteService().UpdateCraftsProcessExecute(sessionId, item.ArrangedVouchCode, 2, 1);
                    });
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw new FaultException <CustomFaultMessage>(new CustomFaultMessage()
                {
                    ErrorCode  = ex.HResult,
                    Message    = ex.Message,
                    StackTrace = ex.StackTrace
                }, ex.Message);
            }
        }
Example #2
0
        ///// <summary>
        ///// 增加
        /////
        ///// </summary>
        ///// <param name="model">设备接口对象</param>
        ///// <returns>返回处理结果</returns>
        //public CommonResult<QC_FindLeakDrumsSet> AddQCDrumsSet(QC_FindLeakDrumsSet model)
        //{
        //    var result = new CommonResult<QC_FindLeakDrumsSet>();
        //    try
        //    {
        //        //   CheckDeviceExecute(model, result);
        //        var dbSession = new DBService<QC_FindLeakDrumsSet>().DbSession;

        //        if (dbSession.GetQueryable(t => t.AutoId == model.AutoId).FirstOrDefault() != null)
        //        {
        //            result.IsSuccess = false;
        //            result.Message = "漏检单号不能重复!";
        //        }
        //        else
        //        {
        //            result.Data = dbSession.Insert(model);
        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        result.IsSuccess = false;
        //        result.Message = ex.Message;
        //        result.StackTrace = ex.StackTrace;
        //    }
        //    return result;
        //}


        /// <summary>
        ///
        /// 设定转漏转鼓保存
        /// </summary>
        /// <param name="model">设备接口对象</param>
        /// <returns>返回处理结果</returns>
        public CommonResult <bool> AddQCDrumsSet(QC_FindLeakDrumsSet model, List <QC_FindLeakDrumsSetDetail> detailList)
        {
            var result = new CommonResult <bool>();

            try
            {
                //   CheckDeviceExecute(model, result);
                var dbSession  = new DBService <QC_FindLeakDrumsSet>().DbSession;
                var dbSession1 = new DBService <QC_FindLeakDrumsSetDetail>().DbSession;
                //start 不为空判断

                //end

                if (result.IsSuccess)
                {
                    using (System.Transactions.TransactionScope ts = new System.Transactions.TransactionScope())
                    {
                        var currModel = dbSession.Insert(model);
                        detailList.ForEach(item =>
                        {
                            item.ID = currModel.ID;
                        });
                        dbSession1.Insert(detailList);

                        //更新工艺执行表进入检漏状态,开启检漏工艺
                        foreach (var item in detailList)
                        {
                            item.AutoID = currModel.ID;
                            //排配单操作日志
                            ForCfPExecuteServices.GetInstance(currUserSession.SessionId).InsertArrangedVouchLog(new ArrangedVouchLog()
                            {
                                ArrangedVouchCode = item.ArrangedVouchCode,
                                CraftsName        = "检漏",
                                OperatDesc        = "检漏开始",
                                Operator          = currUserSession.UserName,
                                OperatingTime     = DateTime.Now,
                                Frequency         = model.Frequency
                            });
                        }
                        ts.Complete();
                        result.Data = true;
                    }
                }
            }
            catch (Exception ex)
            {
                Utils.Logger.Error(ex.ToString());
                throw ex;
            }
            return(result);
        }