/// <summary>
        /// 根据单据信息操作账务信息与库存信息
        /// </summary>
        /// <param name="dataContext">数据上下文</param>
        /// <param name="bill">单据信息</param>
        public void OpertaionDetailAndStock(DepotManagementDataContext dataContext, S_FrockInDepotBill bill)
        {
            MaterialRequisitionGoodsServer goodsService = new MaterialRequisitionGoodsServer();
            IFinancialDetailManagement     serverDetail =
                ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>();

            var result = from r in dataContext.S_FrockInDepotGoodsBill
                         where r.Bill_ID == bill.Bill_ID
                         select r;

            if (result == null || result.Count() == 0)
            {
                throw new Exception("获取单据信息失败");
            }

            foreach (var item in result)
            {
                S_InDepotDetailBill detailInfo = AssignDetailInfo(dataContext, bill, item);
                S_Stock             stockInfo  = AssignStockInfo(dataContext, bill, item);

                if (detailInfo == null || stockInfo == null)
                {
                    throw new Exception("获取账务信息或者库存信息失败");
                }

                serverDetail.ProcessInDepotDetail(dataContext, detailInfo, stockInfo);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 生成领料单明细
        /// </summary>
        /// <param name="dataContxt">LINQ数据上下文</param>
        /// <param name="antirust">防锈物品信息</param>
        /// <param name="billID">单据号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool CreateMaterialRequisitionGoods(DepotManagementDataContext dataContxt,
                                                   KF_GoodsAntirust antirust, string billID, out string error)
        {
            error = null;

            try
            {
                S_MaterialRequisitionGoods lnqMaterGoods = new S_MaterialRequisitionGoods();

                lnqMaterGoods.BasicCount   = 0;
                lnqMaterGoods.BatchNo      = antirust.BatchNo;
                lnqMaterGoods.Bill_ID      = billID;
                lnqMaterGoods.GoodsID      = (int)antirust.GoodsID;
                lnqMaterGoods.ProviderCode = antirust.Provider;
                lnqMaterGoods.RealCount    = Convert.ToDecimal(antirust.AntirustUnqualifiedCount);
                lnqMaterGoods.Remark       = "由防锈报废自动生成";
                lnqMaterGoods.RequestCount = Convert.ToDecimal(antirust.AntirustUnqualifiedCount);
                lnqMaterGoods.ShowPosition = 1;

                MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

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

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 插入领料单明细信息
        /// </summary>
        /// <param name="ctx">LINQ数据上下文</param>
        /// <param name="goodsTable">售后服务配件申请单分解的零件清单</param>
        /// <param name="storageID">库房ID</param>
        /// <param name="materialBillID">领料单单号</param>
        /// <param name="error">失败时返回的错误信息</param>
        /// <returns>返回TRUE表示成功,返回FALSE表示插入失败</returns>
        private bool InsertMaterialRequisitionList(DepotManagementDataContext ctx, ref DataTable goodsTable,
                                                   string storageID, string materialBillID, out string error)
        {
            error = null;
            string strOutMessage = "";

            try
            {
                for (int i = 0; i < goodsTable.Rows.Count; i++)
                {
                    List <View_S_Stock> lstStock = m_storeServer.GetGoodsStoreOnlyForSBW(goodsTable.Rows[i]["GoodsCode"].ToString(),
                                                                                         goodsTable.Rows[i]["GoodsName"].ToString(),
                                                                                         goodsTable.Rows[i]["Spec"].ToString(), storageID).ToList();

                    if (lstStock.Count > 0)
                    {
                        foreach (View_S_Stock item in lstStock)
                        {
                            S_MaterialRequisitionGoods lnqMaterialList = new S_MaterialRequisitionGoods();

                            lnqMaterialList.BasicCount   = 0;
                            lnqMaterialList.BatchNo      = item.批次号;
                            lnqMaterialList.Bill_ID      = materialBillID;
                            lnqMaterialList.GoodsID      = item.物品ID;
                            lnqMaterialList.ProviderCode = item.供货单位;

                            if (Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]) > item.库存数量)
                            {
                                lnqMaterialList.RequestCount = Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]);
                                lnqMaterialList.RealCount    = item.库存数量;
                            }
                            else
                            {
                                lnqMaterialList.RequestCount = Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]);
                                lnqMaterialList.RealCount    = Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]);
                            }

                            lnqMaterialList.Remark       = "";
                            lnqMaterialList.ShowPosition = 1;

                            MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

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

                            goodsTable.Rows[i]["RequestCount"] =
                                Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]) - lnqMaterialList.RealCount;

                            if (Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]) == 0)
                            {
                                break;
                            }
                        }
                    }

                    if (Convert.ToDecimal(goodsTable.Rows[i]["RequestCount"]) > 0)
                    {
                        strOutMessage = strOutMessage + "【图号型号】:" + goodsTable.Rows[i]["GoodsCode"].ToString()
                                        + " 【物品名称】:" + goodsTable.Rows[i]["GoodsName"].ToString()
                                        + " 【规格】:" + goodsTable.Rows[i]["Spec"].ToString()
                                        + " 【数量】:" + goodsTable.Rows[i]["RequestCount"].ToString() + "\r\n";
                    }
                }

                error = strOutMessage;
                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <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);
            }
        }
Ejemplo n.º 5
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);
            }
        }
        /// <summary>
        /// 批量生成明细
        /// </summary>
        /// <param name="selectType">单据类型 (“领料”,“领料退库”)</param>
        /// <param name="billID">单据号</param>
        /// <param name="billIDGather">数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool BatchCreateList(string selectType, string billID, string billIDGather, out string error)
        {
            error = null;

            try
            {
                DepotManagementDataContext dataContext = CommentParameter.DepotDataContext;

                if (BillIsFinish(dataContext, billID))
                {
                    throw new Exception("单据已完成,无法进行操作");
                }

                Hashtable paramTable = new Hashtable();

                paramTable.Add("@SelectType", selectType);
                paramTable.Add("@BillID", billIDGather);

                string strErr = "";

                DataTable dtBatchCreate =
                    GlobalObject.DatabaseServer.QueryInfoPro("KFYW_BatchCreateListFrom_RequisitionOrReturnedInTheDepot",
                                                             paramTable, out strErr);

                if (dtBatchCreate == null)
                {
                    error = strErr;
                    return(false);
                }

                if (selectType == "领料")
                {
                    var varReturn = from a in dataContext.S_MaterialListReturnedInTheDepot
                                    where a.Bill_ID == billID
                                    select a;

                    dataContext.S_MaterialListReturnedInTheDepot.DeleteAllOnSubmit(varReturn);

                    for (int i = 0; i < dtBatchCreate.Rows.Count; i++)
                    {
                        S_MaterialListReturnedInTheDepot lnqReturn = new S_MaterialListReturnedInTheDepot();

                        lnqReturn.BatchNo         = dtBatchCreate.Rows[i]["BatchNo"].ToString();
                        lnqReturn.Bill_ID         = billID;
                        lnqReturn.ColumnNumber    = dtBatchCreate.Rows[i]["ColumnNumber"].ToString();
                        lnqReturn.Depot           = dtBatchCreate.Rows[i]["Depot"].ToString();
                        lnqReturn.GoodsID         = Convert.ToInt32(dtBatchCreate.Rows[i]["GoodsID"].ToString());
                        lnqReturn.LayerNumber     = dtBatchCreate.Rows[i]["LayerNumber"].ToString();
                        lnqReturn.Provider        = dtBatchCreate.Rows[i]["Provider"].ToString();
                        lnqReturn.ProviderBatchNo = dtBatchCreate.Rows[i]["ProviderBatchNo"].ToString();
                        lnqReturn.Remark          = "由领料单" + billIDGather + "批量自动生成";
                        lnqReturn.ReturnedAmount  = Convert.ToDecimal(dtBatchCreate.Rows[i]["ReturnedAmount"].ToString());
                        lnqReturn.ShelfArea       = dtBatchCreate.Rows[i]["ShelfArea"].ToString();

                        dataContext.S_MaterialListReturnedInTheDepot.InsertOnSubmit(lnqReturn);
                    }
                }
                else
                {
                    var varRequisition = from a in dataContext.S_MaterialRequisitionGoods
                                         where a.Bill_ID == billID
                                         select a;

                    dataContext.S_MaterialRequisitionGoods.DeleteAllOnSubmit(varRequisition);

                    for (int i = 0; i < dtBatchCreate.Rows.Count; i++)
                    {
                        S_MaterialRequisitionGoods lnqRequisition = new S_MaterialRequisitionGoods();

                        lnqRequisition.BasicCount   = Convert.ToDecimal(dtBatchCreate.Rows[i]["BasicCount"].ToString());
                        lnqRequisition.BatchNo      = dtBatchCreate.Rows[i]["BatchNo"].ToString();
                        lnqRequisition.Bill_ID      = billID;
                        lnqRequisition.GoodsID      = Convert.ToInt32(dtBatchCreate.Rows[i]["GoodsID"].ToString());
                        lnqRequisition.ProviderCode = dtBatchCreate.Rows[i]["ProviderCode"].ToString();
                        lnqRequisition.RealCount    = Convert.ToDecimal(dtBatchCreate.Rows[i]["RealCount"].ToString());
                        lnqRequisition.Remark       = "由退库单" + billIDGather + "批量自动生成";
                        lnqRequisition.RequestCount = Convert.ToDecimal(dtBatchCreate.Rows[i]["RequestCount"].ToString());
                        lnqRequisition.ShowPosition = i + 1;

                        MaterialRequisitionGoodsServer serverMaterialGoods = new MaterialRequisitionGoodsServer();

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

                dataContext.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
Ejemplo n.º 7
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));
        }