/// <summary>
        /// 有检测废的物品直接生成领料单
        /// </summary>
        /// <param name="ctx">数据上下文</param>
        /// <param name="inDepotInfo">自制件入库单信息</param>
        /// <param name="mrBillNo">分配的领料单单号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool InsertIntoMaterialRequisition(DepotManagementDataContext ctx, S_HomemadePartBill inDepotInfo,
                                                  out string mrBillNo, out string error)
        {
            error    = null;
            mrBillNo = null;
            string billNo = null;
            MaterialRequisitionServer serverMaterialBill = new MaterialRequisitionServer();

            billNo = m_assignBill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

            mrBillNo = billNo;

            try
            {
                var varData = from a in ctx.S_MaterialRequisition
                              where a.Bill_ID == billNo
                              select a;

                S_MaterialRequisition lnqMaterial = null;

                if (varData.Count() != 0)
                {
                    error = string.Format("自动生成的报废物品领料单单号 {0} 已被占用,请尝试重新进行此操作,再三出现无法生成可用的单号时与管理员联系", billNo);
                    return(false);
                }
                else
                {
                    lnqMaterial = new S_MaterialRequisition();

                    lnqMaterial.Bill_ID             = billNo;
                    lnqMaterial.Bill_Time           = ServerModule.ServerTime.Time;
                    lnqMaterial.AssociatedBillNo    = "";
                    lnqMaterial.AssociatedBillType  = "";
                    lnqMaterial.BillStatus          = "已出库";
                    lnqMaterial.Department          = "ZK01";
                    lnqMaterial.DepartmentDirector  = "";
                    lnqMaterial.DepotManager        = "";
                    lnqMaterial.FetchCount          = 0;
                    lnqMaterial.FetchType           = "零星领料";
                    lnqMaterial.FillInPersonnel     = inDepotInfo.QualityInputer;
                    lnqMaterial.FillInPersonnelCode = UniversalFunction.GetPersonnelInfo(inDepotInfo.QualityInputer).工号;
                    lnqMaterial.ProductType         = "";
                    lnqMaterial.PurposeCode         = UniversalFunction.GetPurpose(CE_PickingPurposeProperty.破坏性检测).Code;
                    lnqMaterial.Remark    = "因入库零件进行了破坏性检测,由系统自动生成的破坏件领料单,对应单据号:" + inDepotInfo.Bill_ID;
                    lnqMaterial.StorageID = inDepotInfo.StorageID;

                    if (!serverMaterialBill.AutoCreateBill(ctx, lnqMaterial, out error))
                    {
                        return(false);
                    }
                    //ctx.S_MaterialRequisition.InsertOnSubmit(lnqMaterial);
                }

                var varDataList = from a in ctx.S_MaterialRequisitionGoods
                                  where a.Bill_ID == billNo
                                  select a;

                if (varDataList.Count() != 0)
                {
                    error = "此单据号已被占用";
                    return(false);
                }
                else
                {
                    S_MaterialRequisitionGoods lnqMaterialGoods = new S_MaterialRequisitionGoods();

                    lnqMaterialGoods.Bill_ID      = billNo;
                    lnqMaterialGoods.BasicCount   = 0;
                    lnqMaterialGoods.BatchNo      = inDepotInfo.BatchNo;
                    lnqMaterialGoods.GoodsID      = inDepotInfo.GoodsID;
                    lnqMaterialGoods.ProviderCode = inDepotInfo.Provider;
                    lnqMaterialGoods.RealCount    = Convert.ToDecimal(inDepotInfo.DeclareWastrelCount);
                    lnqMaterialGoods.Remark       = "";
                    lnqMaterialGoods.RequestCount = Convert.ToDecimal(inDepotInfo.DeclareWastrelCount);
                    lnqMaterialGoods.ShowPosition = 1;

                    MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

                    if (!serverMaterialGoods.AutoCreateGoods(ctx, lnqMaterialGoods, out error))
                    {
                        return(false);
                    }
                    //ctx.S_MaterialRequisitionGoods.InsertOnSubmit(lnqMaterialGoods);
                }

                ctx.SubmitChanges();

                if (!serverMaterialBill.FinishBill(ctx, lnqMaterial.Bill_ID, "", out error))
                {
                    throw new Exception(error);
                }

                ctx.SubmitChanges();

                return(m_assignBill.UseBillNo(CE_BillTypeEnum.领料单.ToString(), billNo));
            }
            catch (Exception ex)
            {
                serverMaterialBill.DeleteBill(billNo, out error);
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 自动生成领料单
        /// </summary>
        /// <param name="billID">售后服务配件申请单单号且为生成后的领料单的关联单据</param>
        /// <param name="storageID">库房ID</param>
        /// <param name="error">失败时返回的错误信息</param>
        /// <returns>True  自动生成成功,False 自动生成失败</returns>
        public bool AutogenerationMaterialRequisition(string billID, string storageID,
                                                      out string error)
        {
            error = null;
            string strMaterialBillID = "";
            string strOutMessage     = "";

            try
            {
                DataTable dtListOfStraogeID = GetListStorageID(billID);

                if (dtListOfStraogeID.Rows.Count == 0)
                {
                    throw new Exception("此物品无【领料清单】相关信息,无法生成领料单");
                }
                else
                {
                    DataTable tempGoodsTable = GetSumRequestCount(billID);

                    for (int k = 0; k < dtListOfStraogeID.Rows.Count; k++)
                    {
                        MaterialRequisitionServer serverMaterialBill = new MaterialRequisitionServer();

                        DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                        strMaterialBillID = m_Assignbill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

                        S_MaterialRequisition lnqMaterialBill = new S_MaterialRequisition();

                        lnqMaterialBill.AssociatedBillNo   = "";
                        lnqMaterialBill.AssociatedBillType = "";
                        lnqMaterialBill.Bill_ID            = strMaterialBillID;
                        lnqMaterialBill.Bill_Time          = ServerTime.Time;
                        lnqMaterialBill.BillStatus         = "新建单据";
                        lnqMaterialBill.Department         = m_serverDepartment.GetDeptInfoFromPersonnelInfo(
                            BasicInfo.LoginName).Rows[0]["DepartmentCode"].ToString();
                        lnqMaterialBill.DepartmentDirector  = "";
                        lnqMaterialBill.DepotManager        = "";
                        lnqMaterialBill.FetchCount          = 0;
                        lnqMaterialBill.FetchType           = "零星领料";
                        lnqMaterialBill.FillInPersonnel     = BasicInfo.LoginName;
                        lnqMaterialBill.FillInPersonnelCode = BasicInfo.LoginID;
                        lnqMaterialBill.ProductType         = "";
                        lnqMaterialBill.PurposeCode         = UniversalFunction.GetPurpose(CE_PickingPurposeProperty.包外装配).Code;
                        lnqMaterialBill.Remark    = "由系统自动生成  售后服务配件制造申请单【" + billID + "】";
                        lnqMaterialBill.StorageID = dtListOfStraogeID.Rows[k][0].ToString();

                        int rowCount = tempGoodsTable.Rows.Count;

                        if (!InsertMaterialRequisitionList(ctx, ref tempGoodsTable, lnqMaterialBill.StorageID,
                                                           strMaterialBillID, out error))
                        {
                            m_Assignbill.CancelBillNo("领料单", strMaterialBillID);
                            return(false);
                        }

                        if (error != null && error.Contains("【图号型号】"))
                        {
                            strOutMessage = "【领料单号】:" + strMaterialBillID + "\r\n" + error;
                        }

                        //tempGoodsTable = GlobalObject.DataSetHelper.SiftDataTable(tempGoodsTable, "RequestCount > 0", out error);

                        //if (rowCount == tempGoodsTable.Rows.Count)
                        //{
                        //    continue;
                        //}

                        if (!serverMaterialBill.AutoCreateBill(ctx, lnqMaterialBill, out error))
                        {
                            throw new Exception(error);
                        }
                        //ctx.S_MaterialRequisition.InsertOnSubmit(lnqMaterialBill);

                        ctx.SubmitChanges();
                    }
                }

                error = strOutMessage;
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                m_Assignbill.CancelBillNo("领料单", strMaterialBillID);
                return(false);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 自动生成领料单
        /// </summary>
        /// <param name="contxt">数据上下文</param>
        /// <param name="djh">单据号</param>
        void CreateMaterialRequisition(DepotManagementDataContext contxt, string djh)
        {
            MaterialRequisitionServer serverMaterialBill = new MaterialRequisitionServer();
            string error = null;

            try
            {
                string strBillID = m_assignBill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

                S_StorageCheck billInfo = GetBill(contxt, djh);
                List <View_S_StorageCheckList> listInfo           = (from a in GetList(contxt, djh) where a.盈亏数量 < 0 select a).ToList();
                S_MaterialRequisition          lnqRequisitionBill = new S_MaterialRequisition();

                if (listInfo.Count > 0)
                {
                    #region 领料单主表
                    lnqRequisitionBill.AssociatedBillNo    = djh;
                    lnqRequisitionBill.AssociatedBillType  = "盘点单";
                    lnqRequisitionBill.Bill_ID             = strBillID;
                    lnqRequisitionBill.Bill_Time           = ServerTime.Time;
                    lnqRequisitionBill.BillStatus          = "已出库";
                    lnqRequisitionBill.Department          = "ZZ05";
                    lnqRequisitionBill.DepartmentDirector  = UniversalFunction.GetPersonnelInfo(contxt, billInfo.SHRY).姓名;
                    lnqRequisitionBill.DepotManager        = BasicInfo.LoginName;
                    lnqRequisitionBill.FetchCount          = 0;
                    lnqRequisitionBill.FetchType           = "零星领料";
                    lnqRequisitionBill.FillInPersonnel     = UniversalFunction.GetPersonnelInfo(contxt, billInfo.BZRY).姓名;
                    lnqRequisitionBill.FillInPersonnelCode = billInfo.BZRY;
                    lnqRequisitionBill.OutDepotDate        = ServerTime.Time;
                    lnqRequisitionBill.ProductType         = "";
                    lnqRequisitionBill.PurposeCode         = UniversalFunction.GetPurpose(CE_PickingPurposeProperty.盘点).Code;
                    lnqRequisitionBill.Remark    = "库房盘点(盘亏)";
                    lnqRequisitionBill.StorageID = billInfo.StorageID;

                    if (!serverMaterialBill.AutoCreateBill(contxt, lnqRequisitionBill, out error))
                    {
                        throw new Exception(error);
                    }
                    #endregion

                    foreach (View_S_StorageCheckList listSingle in listInfo)
                    {
                        #region 领料单明细

                        S_MaterialRequisitionGoods lnqRequisitionGoods = new S_MaterialRequisitionGoods();

                        lnqRequisitionGoods.BasicCount   = 0;
                        lnqRequisitionGoods.BatchNo      = listSingle.批次号;
                        lnqRequisitionGoods.Bill_ID      = strBillID;
                        lnqRequisitionGoods.GoodsID      = (int)listSingle.物品ID;
                        lnqRequisitionGoods.ProviderCode = listSingle.供货单位;
                        lnqRequisitionGoods.RealCount    = -(decimal)listSingle.盈亏数量;
                        lnqRequisitionGoods.Remark       = "库房盘点(盘亏)";
                        lnqRequisitionGoods.RequestCount = -(decimal)listSingle.盈亏数量;
                        lnqRequisitionGoods.ShowPosition = 1;

                        MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

                        if (!serverMaterialGoods.AutoCreateGoods(contxt, lnqRequisitionGoods, out error))
                        {
                            throw new Exception(error);
                        }

                        #endregion
                    }
                    contxt.SubmitChanges();

                    serverMaterialBill.OpertaionDetailAndStock(contxt, lnqRequisitionBill);
                    contxt.SubmitChanges();

                    m_assignBill.UseBillNo(CE_BillTypeEnum.领料单.ToString(), strBillID);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 确认防锈
        /// </summary>
        /// <param name="goodsTable">需要执行的物品数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>True 成功 false  失败</returns>
        public bool AuthorizeAntirustInfo(DataTable goodsTable, out string error)
        {
            error = null;
            MaterialRequisitionServer  serverMaterialBill = new MaterialRequisitionServer();
            DepotManagementDataContext contxt             = CommentParameter.DepotDataContext;

            contxt.Connection.Open();
            contxt.Transaction = contxt.Connection.BeginTransaction();
            try
            {
                DataTable dtTemp = GlobalObject.DataSetHelper.SelectDistinct("", goodsTable, "库房ID");

                for (int k = 0; k < dtTemp.Rows.Count; k++)
                {
                    DataTable dtgoodsTable =
                        GlobalObject.DataSetHelper.SiftDataTable(goodsTable, "库房ID = '" + dtTemp.Rows[k][0].ToString() + "'", out error);

                    if (error != null)
                    {
                        throw new Exception(error);
                    }

                    string billID = m_assignBill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

                    for (int i = 0; i < dtgoodsTable.Rows.Count; i++)
                    {
                        var varStock = from a in contxt.S_Stock
                                       where a.GoodsID == (int)dtgoodsTable.Rows[i]["物品ID"] &&
                                       a.BatchNo == dtgoodsTable.Rows[i]["批次号"].ToString() &&
                                       a.StorageID == dtgoodsTable.Rows[i]["库房ID"].ToString() &&
                                       a.Provider == dtgoodsTable.Rows[i]["供应商"].ToString()
                                       select a;

                        var varAntirust = from a in contxt.KF_GoodsAntirust
                                          where a.GoodsID == (int)dtgoodsTable.Rows[i]["物品ID"] &&
                                          a.BatchNo == dtgoodsTable.Rows[i]["批次号"].ToString() &&
                                          a.StorageID == dtgoodsTable.Rows[i]["库房ID"].ToString() &&
                                          a.Provider == dtgoodsTable.Rows[i]["供应商"].ToString()
                                          select a;

                        if (varStock.Count() != 1)
                        {
                            error = "数据不唯一或者为空";
                            throw new Exception(error);
                        }
                        else
                        {
                            S_Stock lnqStock = varStock.Single();

                            KF_GoodsAntirust lnqAntirust = varAntirust.Single();

                            if (Convert.ToDecimal(lnqAntirust.AntirustUnqualifiedCount) > 0)
                            {
                                if (!CreateMaterialRequisitionGoods(contxt, lnqAntirust, billID, out error))
                                {
                                    throw new Exception(error);
                                }
                            }

                            lnqAntirust.AntirustUnqualifiedCount = 0;
                            lnqAntirust.AuthorizePersonnel       = BasicInfo.LoginName;

                            if (lnqAntirust.AntirustState.ToString() == "等待确认")
                            {
                                lnqAntirust.AntirustDate  = ServerTime.Time;
                                lnqAntirust.AntirustState = "未防锈";
                            }
                            else
                            {
                                error = "状态不符,请重新确认";
                                throw new Exception(error);
                            }
                        }
                    }

                    contxt.SubmitChanges();

                    var requistionVar = from a in contxt.S_MaterialRequisition
                                        where a.Bill_ID == billID
                                        select a;

                    IMaterialRequisitionServer requisitionService = ServerModule.ServerModuleFactory.GetServerModule <IMaterialRequisitionServer>();

                    requisitionService.OpertaionDetailAndStock(contxt, requistionVar.Single());

                    m_assignBill.UseBillNo(CE_BillTypeEnum.领料单.ToString(), billID);
                }

                contxt.SubmitChanges();
                contxt.Transaction.Commit();
                return(true);
            }
            catch (Exception ex)
            {
                contxt.Transaction.Rollback();
                error = ex.Message;
                return(false);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 自动生成领料单
        /// </summary>
        /// <param name="context">数据上下文</param>
        /// <param name="isolation">隔离单单据信息</param>
        /// <param name="flag">是否为废弃数,若为废弃数则用“废弃数”表示</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>自动生成成功返回True,自动生成失败返回False</returns>
        private bool CreateMeterialRequisition(DepotManagementDataContext context,
                                               S_IsolationManageBill isolation, string flag, out string error)
        {
            error = null;

            MaterialRequisitionServer serverMaterialBill = new MaterialRequisitionServer();

            try
            {
                string strBillID = m_assignBill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

                var varIsolation = from a in context.S_IsolationManageBill
                                   where a.DJH == isolation.DJH
                                   select a;

                S_IsolationManageBill lnqNewIsolation = new S_IsolationManageBill();

                if (varIsolation.Count() != 1)
                {
                    error = "数据不唯一或者为空";
                    return(false);
                }
                else
                {
                    lnqNewIsolation = varIsolation.Single();
                }

                #region 领料总单
                S_MaterialRequisition lnqMater = new S_MaterialRequisition();

                lnqMater.Bill_Time          = ServerTime.Time;
                lnqMater.Bill_ID            = strBillID;
                lnqMater.BillStatus         = "已出库";
                lnqMater.Department         = "ZK";
                lnqMater.DepartmentDirector = "";
                lnqMater.DepotManager       = "";
                lnqMater.FetchCount         = 0;
                lnqMater.FetchType          = "零星领料";
                lnqMater.FillInPersonnel    = flag == "废弃数" ? "陈岁年" : UniversalFunction.GetPersonnelName(lnqNewIsolation.JYRY);
                //质管部要求[废弃数]变更编制人为陈岁年 2012.3.15
                lnqMater.FillInPersonnelCode = flag == "废弃数" ? "0621" : lnqNewIsolation.JYRY;
                //质管部要求[废弃数]变更编制人为陈岁年 2012.3.15
                lnqMater.OutDepotDate = ServerTime.Time;
                lnqMater.ProductType  = "";
                lnqMater.PurposeCode  = UniversalFunction.GetPurpose(CE_PickingPurposeProperty.破坏性检测).Code;
                lnqMater.Remark       = flag == "废弃数" ?
                                        "不合格品隔离处置单废弃处理,关联的隔离单号:  " + isolation.DJH
                    : "不合格品隔离处置单检测报废,关联的隔离单号:  " + isolation.DJH;
                lnqMater.StorageID          = isolation.StorageID;
                lnqMater.AssociatedBillNo   = "";
                lnqMater.AssociatedBillType = "";

                if (!serverMaterialBill.AutoCreateBill(context, lnqMater, out error))
                {
                    return(false);
                }

                #endregion

                #region 领料单明细
                S_MaterialRequisitionGoods lnqMaterGoods = new S_MaterialRequisitionGoods();

                var varMaterialStock = from a in context.S_Stock
                                       where a.GoodsID == isolation.GoodsID &&
                                       a.BatchNo == isolation.BatchNo &&
                                       a.StorageID == isolation.StorageID &&
                                       a.Provider == isolation.Provider
                                       select a;

                S_Stock lnqStock = new S_Stock();

                if (varMaterialStock.Count() != 1)
                {
                    error = "数据不唯一或者为空";
                    return(false);
                }
                else
                {
                    lnqStock = varMaterialStock.Single();
                }

                lnqMaterGoods.BasicCount   = 0;
                lnqMaterGoods.BatchNo      = isolation.BatchNo;
                lnqMaterGoods.Bill_ID      = strBillID;
                lnqMaterGoods.GoodsID      = (int)isolation.GoodsID;
                lnqMaterGoods.ProviderCode = isolation.Provider;
                lnqMaterGoods.RealCount    = flag == "废弃数" ? isolation.QC_FQS : isolation.QC_BFS;
                lnqMaterGoods.Remark       = flag == "废弃数" ?
                                             "不合格品隔离处置单废弃处理,关联的隔离单号:  " + isolation.DJH
                    : "不合格品隔离处置单检测报废,关联的隔离单号:  " + isolation.DJH;
                lnqMaterGoods.RequestCount = flag == "废弃数" ? isolation.QC_FQS : isolation.QC_BFS;
                lnqMaterGoods.ShowPosition = 1;

                MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

                if (!serverMaterialGoods.AutoCreateGoods(context, lnqMaterGoods, out error))
                {
                    return(false);
                }

                context.SubmitChanges();

                #endregion

                serverMaterialBill.OpertaionDetailAndStock(context, lnqMater);
                context.SubmitChanges();

                m_assignBill.UseBillNo(CE_BillTypeEnum.领料单.ToString(), strBillID);

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 插入领料单
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="threePacketsOfTheRepairBill">三包外返修处置单主表信息</param>
        /// <param name="dtListOfStorageID">库房信息</param>
        /// <param name="threePacketsOfTheRepairList">三包外返修处置单明细信息</param>
        /// <param name="error">错误信息</param>
        /// <returns>成功返回True,失败返回False</returns>
        bool InsertMaterialRequisition(DepotManagementDataContext dataContext, YX_ThreePacketsOfTheRepairBill threePacketsOfTheRepairBill,
                                       DataTable dtListOfStorageID, DataTable threePacketsOfTheRepairList, out string error)
        {
            error = null;

            try
            {
                if (dtListOfStorageID == null || dtListOfStorageID.Rows.Count == 0)
                {
                    return(true);
                }
                else
                {
                    for (int k = 0; k < dtListOfStorageID.Rows.Count; k++)
                    {
                        //领表主表信息
                        MaterialRequisitionServer serverMaterialBill = new MaterialRequisitionServer();

                        string strBillID = m_serverAssignBill.AssignNewNo(serverMaterialBill, CE_BillTypeEnum.领料单.ToString());

                        S_MaterialRequisition lnqMaterial = new S_MaterialRequisition();

                        lnqMaterial.Bill_ID             = strBillID;
                        lnqMaterial.Bill_Time           = ServerModule.ServerTime.Time;
                        lnqMaterial.AssociatedBillNo    = threePacketsOfTheRepairBill.Bill_ID;
                        lnqMaterial.AssociatedBillType  = "三包外返修处置单";
                        lnqMaterial.BillStatus          = "已出库";
                        lnqMaterial.Department          = m_serverDepartment.GetDeptInfoFromPersonnelInfo(threePacketsOfTheRepairBill.WorkShopPersonnel).Rows[0]["DepartmentCode"].ToString();
                        lnqMaterial.DepartmentDirector  = threePacketsOfTheRepairBill.WorkshopManagerPersonnel;
                        lnqMaterial.DepotManager        = threePacketsOfTheRepairBill.StockPersonnel;
                        lnqMaterial.FetchCount          = 0;
                        lnqMaterial.FetchType           = "零星领料";
                        lnqMaterial.FillInPersonnel     = threePacketsOfTheRepairBill.WorkShopPersonnel;
                        lnqMaterial.FillInPersonnelCode = UniversalFunction.GetPersonnelCode(threePacketsOfTheRepairBill.WorkShopPersonnel);
                        lnqMaterial.ProductType         = "";
                        lnqMaterial.PurposeCode         = UniversalFunction.GetPurpose(CE_PickingPurposeProperty.包外维修).Code;
                        lnqMaterial.Remark       = "由三包外返修处置单自动生成,对应的三包外返修处置单号为" + threePacketsOfTheRepairBill.Bill_ID;
                        lnqMaterial.StorageID    = dtListOfStorageID.Rows[k][0].ToString();
                        lnqMaterial.OutDepotDate = ServerTime.Time;

                        if (!serverMaterialBill.AutoCreateBill(dataContext, lnqMaterial, out error))
                        {
                            return(false);
                        }

                        for (int i = 0; i < threePacketsOfTheRepairList.Rows.Count; i++)
                        {
                            if (!Convert.ToBoolean(threePacketsOfTheRepairList.Rows[i]["是否为客户责任"]) &&
                                threePacketsOfTheRepairList.Rows[i][13].ToString().Trim() == dtListOfStorageID.Rows[k][0].ToString().Trim())
                            {
                                var varStock = from a in dataContext.S_Stock
                                               where a.StorageID == dtListOfStorageID.Rows[k][0].ToString() &&
                                               a.GoodsID == Convert.ToInt32(threePacketsOfTheRepairList.Rows[i]["物品ID"]) &&
                                               a.BatchNo == threePacketsOfTheRepairList.Rows[i]["批次号"].ToString() &&
                                               a.Provider == threePacketsOfTheRepairList.Rows[i][14].ToString()
                                               select a;

                                if (varStock.Count() != 1)
                                {
                                    error = "库存信息不唯一或者为空";
                                    return(false);
                                }
                                else
                                {
                                    if (varStock.Single().GoodsStatus == 3)
                                    {
                                        error = "【" + varStock.Single().GoodsCode + "】 【" + varStock.Single().GoodsName + "】 【"
                                                + varStock.Single().Spec + "】【"
                                                + threePacketsOfTheRepairList.Rows[i]["批次号"].ToString()
                                                + "】物品库存状态为“隔离”不允许出库";

                                        return(false);
                                    }
                                }


                                S_MaterialRequisitionGoods lnqMaterialGoods = new S_MaterialRequisitionGoods();

                                lnqMaterialGoods.Bill_ID      = strBillID;
                                lnqMaterialGoods.BasicCount   = 0;
                                lnqMaterialGoods.BatchNo      = threePacketsOfTheRepairList.Rows[i]["批次号"].ToString();
                                lnqMaterialGoods.GoodsID      = Convert.ToInt32(threePacketsOfTheRepairList.Rows[i]["物品ID"]);
                                lnqMaterialGoods.ProviderCode = threePacketsOfTheRepairList.Rows[i][14].ToString();
                                lnqMaterialGoods.RealCount    = Convert.ToDecimal(threePacketsOfTheRepairList.Rows[i]["领用数量"]);
                                lnqMaterialGoods.Remark       = threePacketsOfTheRepairList.Rows[i]["备注"].ToString();
                                lnqMaterialGoods.RequestCount = Convert.ToDecimal(threePacketsOfTheRepairList.Rows[i]["领用数量"]);
                                lnqMaterialGoods.ShowPosition = 1;

                                MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

                                if (!serverMaterialGoods.AutoCreateGoods(dataContext, lnqMaterialGoods, out error))
                                {
                                    return(false);
                                }
                            }
                        }

                        dataContext.SubmitChanges();

                        new MaterialRequisitionServer().OpertaionDetailAndStock(dataContext, lnqMaterial);

                        dataContext.SubmitChanges();
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                error = error + ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 获取服务组件
        /// </summary>
        /// <returns>返回组件接口</returns>
        public static T GetServerModule <T>()
        {
            string name = typeof(T).ToString();

            m_hashTable = new Hashtable();

            //if (m_hashTable.ContainsKey(name))
            //{
            //    return (T)m_hashTable[name];
            //}

            if (typeof(T) == typeof(IProviderServer))
            {
                IProviderServer serverModule = new ProviderServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAccessoryDutyInfoManageServer))
            {
                IAccessoryDutyInfoManageServer serverModule = new AccessoryDutyInfoManageServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDepartmentServer))
            {
                IDepartmentServer serverModule = new DepartmentServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialTypeServer))
            {
                IMaterialTypeServer serverModule = new MaterialTypeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IStoreServer))
            {
                IStoreServer serverModule = new StoreServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICheckOutInDepotServer))
            {
                ICheckOutInDepotServer serverModule = new CheckOutInDepotServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IUnitServer))
            {
                IUnitServer serverModule = new UnitServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IClientServer))
            {
                IClientServer serverModule = new ClientServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductListServer))
            {
                IProductListServer serverModule = new ProductListServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBasicGoodsServer))
            {
                IBasicGoodsServer serverModule = SCM_Level01_ServerFactory.GetServerModule <IBasicGoodsServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAssemblyInfoServer))
            {
                IAssemblyInfoServer serverModule = PMS_ServerFactory.GetServerModule <IAssemblyInfoServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBarCodeServer))
            {
                IBarCodeServer serverModule = BasicServerFactory.GetServerModule <IBarCodeServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBomServer))
            {
                IBomServer serverModule = PMS_ServerFactory.GetServerModule <IBomServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBomMappingServer))
            {
                IBomMappingServer serverModule = PMS_ServerFactory.GetServerModule <IBomMappingServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAssemblingBom))
            {
                IAssemblingBom serverModule = PMS_ServerFactory.GetServerModule <IAssemblingBom>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IElectronFileServer))
            {
                IElectronFileServer serverModule = PMS_ServerFactory.GetServerModule <IElectronFileServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IChoseConfectServer))
            {
                IChoseConfectServer serverModule = PMS_ServerFactory.GetServerModule <IChoseConfectServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IWorkbenchService))
            {
                IWorkbenchService serverModule = PMS_ServerFactory.GetServerModule <IWorkbenchService>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IGoodsGradeServer))
            {
                IGoodsGradeServer serverModule = new GoodsGradeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBargainInfoServer))
            {
                IBargainInfoServer serverModule = new BargainInfoServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBargainGoodsServer))
            {
                IBargainGoodsServer serverModule = new BargainGoodsServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOrderFormInfoServer))
            {
                IOrderFormInfoServer serverModule = new OrderFormInfoServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOrderFormGoodsServer))
            {
                IOrderFormGoodsServer serverModule = new OrderFormGoodsServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOrdinaryInDepotBillServer))
            {
                IOrdinaryInDepotBillServer serverModule = new OrdinaryInDepotBillServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOrdinaryInDepotGoodsBill))
            {
                IOrdinaryInDepotGoodsBill serverModule = new OrdinaryInDepotGoodsBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductInfoServer))
            {
                IProductInfoServer serverModule = PMS_ServerFactory.GetServerModule <IProductInfoServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IBillTypeServer))
            {
                IBillTypeServer serverModule = BasicServerFactory.GetServerModule <IBillTypeServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAssignBillNoServer))
            {
                IAssignBillNoServer serverModule = BasicServerFactory.GetServerModule <IAssignBillNoServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialRequisitionServer))
            {
                IMaterialRequisitionServer serverModule = new MaterialRequisitionServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IPersonnelInfoServer))
            {
                IPersonnelInfoServer serverModule = SCM_Level01_ServerFactory.GetServerModule <IPersonnelInfoServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialRequisitionGoodsServer))
            {
                IMaterialRequisitionGoodsServer serverModule = new MaterialRequisitionGoodsServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDeclareWastrelType))
            {
                IDeclareWastrelType serverModule = new DeclareWastrelType();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IScrapBillServer))
            {
                IScrapBillServer serverModule = new ScrapBillServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IScrapGoodsServer))
            {
                IScrapGoodsServer serverModule = new ScrapGoodsServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialRequisitionPurposeServer))
            {
                IMaterialRequisitionPurposeServer serverModule = new MaterialRequisitionPurposeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IFieldWidthServer))
            {
                IFieldWidthServer serverModule = new FieldWidthServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IHomemadePartInDepotServer))
            {
                IHomemadePartInDepotServer serverModule = new HomemadePartInDepotServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialReturnedInTheDepot))
            {
                IMaterialReturnedInTheDepot serverModule = new MaterialReturnedInTheDepot();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialListReturnedInTheDepot))
            {
                IMaterialListReturnedInTheDepot serverModule = new MaterialListReturnedInTheDepot();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialRejectBill))
            {
                IMaterialRejectBill serverModule = new MaterialRejectBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialListRejectBill))
            {
                IMaterialListRejectBill serverModule = new MaterialListRejectBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDetailSummaryInfo))
            {
                IDetailSummaryInfo serverModule = new DetailSummaryInfo();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDepotTypeForPersonnel))
            {
                IDepotTypeForPersonnel serverModule = SCM_Level01_ServerFactory.GetServerModule <IDepotTypeForPersonnel>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IInvoiceServer))
            {
                IInvoiceServer serverModule = new InvoiceServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ISellIn))
            {
                ISellIn serverModule = new SellIn();
                m_hashTable.Add(name, serverModule);
            }
            //else if (typeof(T) == typeof(IProductOrder))
            //{
            //    IProductOrder serverModule = new ProductOrder();
            //    m_hashTable.Add(name, serverModule);
            //}
            else if (typeof(T) == typeof(ICannibalize))
            {
                ICannibalize serverModule = new Cannibalize();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICheckReturnRepair))
            {
                ICheckReturnRepair serverModule = new CheckReturnRepair();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IIsolationManageBill))
            {
                IIsolationManageBill serverModule = new IsolationManageBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMessMessageFeedback))
            {
                IMessMessageFeedback serverModule = new MessMessageFeedback();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITorqueConverterInfoServer))
            {
                ITorqueConverterInfoServer serverModule = new TorqueConverterInfoServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductPlan))
            {
                IProductPlan serverModule = new ProductPlan();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IStoreageCheck))
            {
                IStoreageCheck serverModule = new StoreageCheck();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ISafeStockServer))
            {
                ISafeStockServer serverModule = new SafeStockServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMusterAffirmBill))
            {
                IMusterAffirmBill serverModule = new MusterAffirmBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMusterUse))
            {
                IMusterUse serverModule = new MusterUse();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITempElectronFileServer))
            {
                ITempElectronFileServer serverModule = PMS_ServerFactory.GetServerModule <ITempElectronFileServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMultiBatchPartServer))
            {
                IMultiBatchPartServer serverModule = PMS_ServerFactory.GetServerModule <IMultiBatchPartServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITechnologyChange))
            {
                ITechnologyChange serverModule = new TechnologyChange();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IGoodsLeastPackAndStock))
            {
                IGoodsLeastPackAndStock serverModule = new GoodsLeastPackAndStock();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOrderFormAffrim))
            {
                IOrderFormAffrim serverModule = new OrderFormAffrim();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMarketingPlan))
            {
                IMarketingPlan serverModule = new MarketingPlan();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IPurcharsingPlan))
            {
                IPurcharsingPlan serverModule = new PurcharsingPlan();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IGeneratesCheckOutInDepotServer))
            {
                IGeneratesCheckOutInDepotServer serverModule = new GeneratesCheckOutInDepotServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IGoodsAntirust))
            {
                IGoodsAntirust serverModule = new GoodsAntirust();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IQuarantine))
            {
                IQuarantine serverModule = new Quarantine();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IAfterServiceMakePartsBill))
            {
                IAfterServiceMakePartsBill serverModule = new AfterServiceMakePartsBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IReparativePartInfoServer))
            {
                IReparativePartInfoServer serverModule = PMS_ServerFactory.GetServerModule <IReparativePartInfoServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IConvertCVTNumber))
            {
                IConvertCVTNumber serverModule = PMS_ServerFactory.GetServerModule <IConvertCVTNumber>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductBarcodeServer))
            {
                IProductBarcodeServer serverModule = PMS_ServerFactory.GetServerModule <IProductBarcodeServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICheckOutInDepotForOutsourcingServer))
            {
                ICheckOutInDepotForOutsourcingServer serverModule = new CheckOutInDepotForOutsourcingServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductChange))
            {
                IProductChange serverModule = new ProductChange();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IHomemadeRejectBill))
            {
                IHomemadeRejectBill serverModule = new HomemadeRejectBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IHomemadeRejectList))
            {
                IHomemadeRejectList serverModule = new HomemadeRejectList();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IFrockProvingReport))
            {
                IFrockProvingReport serverModule = new FrockProvingReport();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMaterialDetainBill))
            {
                IMaterialDetainBill serverModule = new MaterialDetainBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IPrintProductBarcodeInfo))
            {
                IPrintProductBarcodeInfo serverModule = PMS_ServerFactory.GetServerModule <IPrintProductBarcodeInfo>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IThreePacketsOfTheRepairBill))
            {
                IThreePacketsOfTheRepairBill serverModule = new ThreePacketsOfTheRepairBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IFrockIndepotBill))
            {
                IFrockIndepotBill serverModule = new FrockIndepotBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICommunicateReportBill))
            {
                ICommunicateReportBill serverModule = new CommunicateReportBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductCodeServer))
            {
                IProductCodeServer serverModule = SCM_Level02_ServerFactory.GetServerModule <IProductCodeServer>();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IHomemadePartInfoServer))
            {
                IHomemadePartInfoServer serverModule = new HomemadePartInfoServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IStorageInfo))
            {
                IStorageInfo serverModule = new StorageInfo();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductDeliveryInspectionServer))
            {
                IProductDeliveryInspectionServer serverModule = new ProductDeliveryInspectionServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICVTCustomerInformationServer))
            {
                ICVTCustomerInformationServer serverModule = new CVTCustomerInformationServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICVTTruckLoadingInformation))
            {
                ICVTTruckLoadingInformation serverModule = new CVTTruckLoadingInformation();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IQualityProblemRectificationDisposalBill))
            {
                IQualityProblemRectificationDisposalBill serverModule = new QualityProblemRectificationDisposalBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IGoodsShelfLife))
            {
                IGoodsShelfLife serverModule = new GoodsShelfLife();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IReport))
            {
                IReport serverModule = new Report();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMarqueeServer))
            {
                IMarqueeServer serverModule = new MarqueeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDeviceMaintenanceBill))
            {
                IDeviceMaintenanceBill serverModule = new DeviceMaintenanceBill();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ICBOMServer))
            {
                ICBOMServer serverModule = new CBOMServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ILogisticSafeStock))
            {
                ILogisticSafeStock serverModule = new LogisticSafeStock();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IUnProductTestingSingle))
            {
                IUnProductTestingSingle serverModule = new UnProductTestingSingle();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IDisposableGoodsServer))
            {
                IDisposableGoodsServer serverModule = new DisposableGoodsServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITCURepairInfoServer))
            {
                ITCURepairInfoServer serverModule = new TCURepairInfoServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ISalesOrderServer))
            {
                ISalesOrderServer serverModule = new SalesOrderServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ITechnologyAlteration))
            {
                ITechnologyAlteration serverModule = new TechnologyAlteration();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IMinorPurchaseBillServer))
            {
                IMinorPurchaseBillServer serverModule = new MinorPurchaseBillServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductLendService))
            {
                IProductLendService serverModule = new ProductLendService();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductLendReturnService))
            {
                IProductLendReturnService serverModule = new ProductLendReturnService();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IProductReturnService))
            {
                IProductReturnService serverModule = new ProductReturnService();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IStockLack))
            {
                IStockLack serverModule = new StockLack();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IOfflineFailSafeServer))
            {
                IOfflineFailSafeServer serverModule = new OfflineFailSafeServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(ISystemLogServer))
            {
                ISystemLogServer serverModule = new SystemLogServer();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IFinancialDetailManagement))
            {
                IFinancialDetailManagement serverModule = new FinancialDetailManagement();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IToolsManage))
            {
                IToolsManage serverModule = new ToolsManage();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IGaugeManage))
            {
                IGaugeManage serverModule = new GaugeManage();
                m_hashTable.Add(name, serverModule);
            }
            else if (typeof(T) == typeof(IQualitySystemDatabase))
            {
                IQualitySystemDatabase serverModule = new QualitySystemDatabase();
                m_hashTable.Add(name, serverModule);
            }

            if (m_hashTable.ContainsKey(name))
            {
                return((T)m_hashTable[name]);
            }

            return(default(T));
        }