/// <summary> /// 更新出入库的金额 /// </summary> /// <param name="invoiceTable">需要更新的数据集</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>更新成功True,更新失败False</returns> public bool UpdatePrice(DataTable invoiceTable, out string error) { error = null; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; OrdinaryInDepotBillServer serverOrdinaryBill = new OrdinaryInDepotBillServer(); MaterialRejectBill serverMaterialRejectBill = new MaterialRejectBill(); DateTime dtStart = new DateTime(); DateTime dtEnd = new DateTime(); //获得当前日期的月结起始日期与结束日期 ServerTime.GetMonthlyBalance(ServerTime.Time, out dtStart, out dtEnd); for (int i = 0; i <= invoiceTable.Rows.Count - 1; i++) { string code = invoiceTable.Rows[i]["GoodsCode"].ToString(); string name = invoiceTable.Rows[i]["GoodsName"].ToString(); string spec = invoiceTable.Rows[i]["Spec"].ToString(); View_F_GoodsPlanCost basicGoods = m_basicGoodsServer.GetGoodsInfo(code, name, spec, out error); if (!GlobalObject.GeneralFunction.IsNullOrEmpty(error)) { return(false); } #region 改变入库表的单价(普通入库或者报检入库) var varCheckOutInDepot = from a in dataContxt.S_CheckOutInDepotBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == basicGoods.序号 && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; //报检入库单单价修改 if (varCheckOutInDepot.Count() != 0) { S_CheckOutInDepotBill lnqCheckOutInDepotBill = varCheckOutInDepot.Single(); lnqCheckOutInDepotBill.UnitInvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqCheckOutInDepotBill.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqCheckOutInDepotBill.HavingInvoice = true; dataContxt.SubmitChanges(); } else { int intGoodsID = m_basicGoodsServer.GetGoodsID(invoiceTable.Rows[i]["GoodsCode"].ToString(), invoiceTable.Rows[i]["GoodsName"].ToString(), invoiceTable.Rows[i]["Spec"].ToString()); var varOrdinaryGoods = from a in dataContxt.S_OrdinaryInDepotGoodsBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == intGoodsID && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; //普通入库单单价修改 if (varOrdinaryGoods.Count() != 0) { S_OrdinaryInDepotGoodsBill lnqOrdinaryGoods = varOrdinaryGoods.Single(); lnqOrdinaryGoods.InvoiceUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqOrdinaryGoods.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqOrdinaryGoods.HavingInvoice = true; dataContxt.SubmitChanges(); int intFlag = serverOrdinaryBill.GetHavingInvoice(invoiceTable.Rows[i]["Bill_ID"].ToString(), out error); if (intFlag == 4) { return(false); } else { var varOrdinaryBill = from a in dataContxt.S_OrdinaryInDepotBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() select a; if (varOrdinaryBill.Count() != 0) { S_OrdinaryInDepotBill lnqOrdinaryBill = varOrdinaryBill.Single(); lnqOrdinaryBill.InvoiceStatus = intFlag; dataContxt.SubmitChanges(); } } }//采购退货单单价修改 else { intGoodsID = m_basicGoodsServer.GetGoodsID(invoiceTable.Rows[i]["GoodsCode"].ToString(), invoiceTable.Rows[i]["GoodsName"].ToString(), invoiceTable.Rows[i]["Spec"].ToString()); var varRejectList = from a in dataContxt.S_MaterialListRejectBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == intGoodsID && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; if (varRejectList.Count() != 0) { S_MaterialListRejectBill lnqMaterialList = varRejectList.Single(); lnqMaterialList.InvoiceUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqMaterialList.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqMaterialList.HavingInvoice = true; dataContxt.SubmitChanges(); int intFlag = serverMaterialRejectBill.SetHavingInvoiceReturn(invoiceTable.Rows[i]["Bill_ID"].ToString(), out error); if (intFlag == 4) { return(false); } else { var varReject = from a in dataContxt.S_MaterialRejectBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() select a; if (varReject.Count() != 0) { S_MaterialRejectBill lnqMaterialBill = varReject.Single(); lnqMaterialBill.InvoiceFlag = intFlag; dataContxt.SubmitChanges(); } } } else { intGoodsID = m_basicGoodsServer.GetGoodsID(invoiceTable.Rows[i]["GoodsCode"].ToString(), invoiceTable.Rows[i]["GoodsName"].ToString(), invoiceTable.Rows[i]["Spec"].ToString()); var varOutsourcing = from a in dataContxt.S_CheckOutInDepotForOutsourcingBill where a.Bill_ID == invoiceTable.Rows[i]["Bill_ID"].ToString() && a.GoodsID == intGoodsID && a.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select a; //委外报检入库单单价修改 if (varOutsourcing.Count() != 0) { S_CheckOutInDepotForOutsourcingBill lnqOutsourcing = varOutsourcing.Single(); lnqOutsourcing.UnitInvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqOutsourcing.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqOutsourcing.HavingInvoice = true; dataContxt.SubmitChanges(); } } } } #endregion #region 改变入库明细表金额 var varInDepotBill = from b in dataContxt.S_InDepotDetailBill where b.GoodsID == basicGoods.序号 && b.InDepotBillID == invoiceTable.Rows[i]["Bill_ID"].ToString() && b.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() select b; if (varInDepotBill.Count() == 1) { S_InDepotDetailBill lnqInDepotBill = varInDepotBill.Single(); lnqInDepotBill.InvoiceUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqInDepotBill.InvoicePrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); if (lnqInDepotBill.FactPrice != Convert.ToDecimal(invoiceTable.Rows[i]["Price"])) { //当查询的记录不在当月的结算日期范围内,插入红冲单据与对冲单据 if (lnqInDepotBill.BillTime < dtStart || lnqInDepotBill.BillTime > dtEnd) { var varDetail = from d in dataContxt.S_InDepotDetailBill where d.GoodsID == basicGoods.序号 && d.InDepotBillID.Contains(invoiceTable.Rows[i]["Bill_ID"].ToString()) && d.BatchNo == invoiceTable.Rows[i]["BatchNo"].ToString() && d.BillTime >= dtStart && d.BillTime <= dtEnd select d; //判断是否已经在当前结算日期范围内插入了红冲与对冲数据 if (varDetail.Count() != 0) { foreach (var item in varDetail) { //针对已经插入的对冲数据进行修改 if (item.InDepotBillID.Contains("(对冲单据)")) { item.FactPrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); item.FactUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); } } }//对没有插入的红冲与对冲的记录进行插入 else { //插一条原始的负记录(红冲单据) S_InDepotDetailBill lnqOldInDepotBill = new S_InDepotDetailBill(); lnqOldInDepotBill.ID = Guid.NewGuid(); lnqOldInDepotBill.InDepotBillID = lnqInDepotBill.InDepotBillID + "(红冲单据)"; lnqOldInDepotBill.BatchNo = lnqInDepotBill.BatchNo; lnqOldInDepotBill.BillTime = ServerTime.Time; lnqOldInDepotBill.Department = lnqInDepotBill.Department; lnqOldInDepotBill.FactUnitPrice = lnqInDepotBill.FactUnitPrice; lnqOldInDepotBill.FactPrice = -lnqInDepotBill.FactPrice; lnqOldInDepotBill.FillInPersonnel = lnqInDepotBill.FillInPersonnel; lnqOldInDepotBill.GoodsID = lnqInDepotBill.GoodsID; lnqOldInDepotBill.InDepotCount = -lnqInDepotBill.InDepotCount; lnqOldInDepotBill.Price = -lnqInDepotBill.Price; lnqOldInDepotBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.财务红冲; lnqOldInDepotBill.Provider = lnqInDepotBill.Provider; lnqOldInDepotBill.Remark = lnqInDepotBill.Remark; lnqOldInDepotBill.StorageID = lnqInDepotBill.StorageID; lnqOldInDepotBill.UnitPrice = lnqInDepotBill.UnitPrice; lnqOldInDepotBill.FillInDate = lnqInDepotBill.FillInDate; lnqOldInDepotBill.AffrimPersonnel = lnqInDepotBill.AffrimPersonnel; IFinancialDetailManagement serverDetail = ServerModule.ServerModuleFactory.GetServerModule <IFinancialDetailManagement>(); serverDetail.ProcessInDepotDetail(dataContxt, lnqOldInDepotBill, null); //插一条新的正记录(对冲单据) S_InDepotDetailBill lnqNewInDepotBill = new S_InDepotDetailBill(); lnqNewInDepotBill.ID = Guid.NewGuid(); lnqNewInDepotBill.InDepotBillID = lnqInDepotBill.InDepotBillID + "(对冲单据)"; lnqNewInDepotBill.BatchNo = lnqInDepotBill.BatchNo; lnqNewInDepotBill.BillTime = ServerTime.Time; lnqNewInDepotBill.Department = lnqInDepotBill.Department; lnqNewInDepotBill.FactUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); lnqNewInDepotBill.FactPrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqNewInDepotBill.FillInPersonnel = lnqInDepotBill.FillInPersonnel; lnqNewInDepotBill.GoodsID = lnqInDepotBill.GoodsID; lnqNewInDepotBill.InDepotCount = lnqInDepotBill.InDepotCount; lnqNewInDepotBill.Price = lnqInDepotBill.Price; lnqNewInDepotBill.OperationType = (int)GlobalObject.CE_SubsidiaryOperationType.财务对冲; lnqNewInDepotBill.Provider = lnqInDepotBill.Provider; lnqNewInDepotBill.Remark = lnqInDepotBill.Remark; lnqNewInDepotBill.StorageID = lnqInDepotBill.StorageID; lnqNewInDepotBill.UnitPrice = lnqInDepotBill.UnitPrice; lnqNewInDepotBill.FillInDate = lnqInDepotBill.FillInDate; lnqNewInDepotBill.AffrimPersonnel = lnqInDepotBill.AffrimPersonnel; serverDetail.ProcessInDepotDetail(dataContxt, lnqNewInDepotBill, null); } } else { lnqInDepotBill.FactPrice = Convert.ToDecimal(invoiceTable.Rows[i]["Price"]); lnqInDepotBill.FactUnitPrice = Convert.ToDecimal(invoiceTable.Rows[i]["UnitPrice"]); } } dataContxt.SubmitChanges(); } #endregion } return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 插入采购退货表 /// </summary> /// <param name="dataContxt">LINQ数据上下文</param> /// <param name="billList">扣货子表</param> /// <param name="billTable">扣货主表</param> /// <param name="billNo">单据号</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>操作成功返回True,操作失败返回False</returns> bool InsertMaterialRejectBill(DepotManagementDataContext dataContxt, DataTable billList, DataTable billTable, string billNo, out string error) { error = null; try { MaterialRejectBill serverRejectBill = new MaterialRejectBill(); string strCGBillNo = m_assignBill.AssignNewNo(serverRejectBill, "采购退货单"); //插入主表信息 S_MaterialRejectBill bill = new S_MaterialRejectBill(); if (billTable.Rows.Count > 0) { bill.Bill_ID = strCGBillNo; bill.Bill_Time = ServerTime.Time; bill.BillStatus = MaterialRejectBillBillStatus.已完成.ToString(); bill.Department = BasicInfo.DeptCode; bill.FillInPersonnel = BasicInfo.LoginName; bill.FillInPersonnelCode = BasicInfo.LoginID; bill.Provider = billList.Rows[0]["供应商"].ToString(); bill.Reason = billList.Rows[0]["扣货原因"].ToString(); bill.Remark = billList.Rows[0]["备注"].ToString() + "(根据物料扣货单【" + billNo + "】系统自动生成)"; bill.BillType = "总仓库退货单"; bill.StorageID = UniversalFunction.GetStorageID(billList.Rows[0]["库房名称"].ToString()); bill.OutDepotDate = ServerTime.Time; dataContxt.S_MaterialRejectBill.InsertOnSubmit(bill); } else { return(false); } for (int i = 0; i < billTable.Rows.Count; i++) { //插入业务明细信息 S_MaterialListRejectBill goods = new S_MaterialListRejectBill(); goods.Bill_ID = strCGBillNo; goods.GoodsID = Convert.ToInt32(billTable.Rows[i]["物品ID"].ToString()); goods.Provider = billTable.Rows[i]["供应商"].ToString(); goods.ProviderBatchNo = ""; goods.BatchNo = billTable.Rows[i]["批次号"].ToString(); goods.Amount = Convert.ToDecimal(billTable.Rows[i]["扣货数"].ToString()); goods.Remark = billTable.Rows[i]["备注"].ToString(); goods.AssociateID = billTable.Rows[i]["关联订单号"].ToString(); if (!new MaterialListRejectBill().SetPriceInfo(goods.AssociateID, goods, UniversalFunction.GetStorageID(billList.Rows[0]["库房名称"].ToString()), out error)) { return(false); } dataContxt.S_MaterialListRejectBill.InsertOnSubmit(goods); } serverRejectBill.OpertaionDetailAndStock(dataContxt, bill); return(true); } catch (Exception ex) { error = ex.Message; return(false); } }
/// <summary> /// 删除发票记录 /// </summary> /// <param name="invoiceCode">发票号</param> /// <param name="error">出错时返回错误信息,无错时返回null</param> /// <returns>删除成功返回True,删除失败返回False</returns> public bool DeleteInvoiceInfo(string invoiceCode, out string error) { error = null; string str = "0"; int count = 0; try { DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext; OrdinaryInDepotBillServer serverOrdinaryBill = new OrdinaryInDepotBillServer(); MaterialRejectBill serverMaterialRejectBill = new MaterialRejectBill(); string strSql = "select * from B_Invoice where InvoiceCode = '" + invoiceCode + "'"; DataTable dtInvoice = GlobalObject.DatabaseServer.QueryInfo(strSql); for (int i = 0; i <= dtInvoice.Rows.Count - 1; i++) { count = i; decimal dcOldUnitPrice = 0; if (!GlobalObject.GeneralFunction.IsNullOrEmpty(error)) { return(false); } str = "1"; #region 改变入库表的单价(普通入库或者报检入库) var varCheckOutInDepot = from a in dataContxt.S_CheckOutInDepotBill where a.Bill_ID == dtInvoice.Rows[i]["Bill_ID"].ToString() && a.GoodsID == Convert.ToInt32(dtInvoice.Rows[i]["GoodsID"].ToString()) && a.BatchNo == dtInvoice.Rows[i]["BatchNo"].ToString() select a; if (varCheckOutInDepot.Count() != 0) { S_CheckOutInDepotBill lnqCheckOutInDepot = varCheckOutInDepot.Single(); lnqCheckOutInDepot.UnitInvoicePrice = 0; lnqCheckOutInDepot.InvoicePrice = 0; lnqCheckOutInDepot.HavingInvoice = false; dcOldUnitPrice = lnqCheckOutInDepot.UnitPrice; dataContxt.SubmitChanges(); } else { var varOrdinaryGoods = from a in dataContxt.S_OrdinaryInDepotGoodsBill where a.Bill_ID == dtInvoice.Rows[i]["Bill_ID"].ToString() && a.GoodsID == Convert.ToInt32(dtInvoice.Rows[i]["GoodsID"].ToString()) && a.BatchNo == dtInvoice.Rows[i]["BatchNo"].ToString() select a; if (varOrdinaryGoods.Count() != 0) { S_OrdinaryInDepotGoodsBill lnqOrdinaryGoods = varOrdinaryGoods.Single(); lnqOrdinaryGoods.InvoiceUnitPrice = 0; lnqOrdinaryGoods.InvoicePrice = 0; lnqOrdinaryGoods.HavingInvoice = false; dcOldUnitPrice = lnqOrdinaryGoods.UnitPrice; dataContxt.SubmitChanges(); int intFlag = serverOrdinaryBill.GetHavingInvoice(dtInvoice.Rows[i]["Bill_ID"].ToString(), out error); if (intFlag == 4) { return(false); } else { var varOrdinaryBill = from a in dataContxt.S_OrdinaryInDepotBill where a.Bill_ID == dtInvoice.Rows[i]["Bill_ID"].ToString() select a; if (varOrdinaryBill.Count() != 0) { S_OrdinaryInDepotBill lnqOrdinaryBill = varOrdinaryBill.Single(); lnqOrdinaryBill.InvoiceStatus = intFlag; dataContxt.SubmitChanges(); } } } else { var varRejectList = from a in dataContxt.S_MaterialListRejectBill where a.Bill_ID == dtInvoice.Rows[i]["Bill_ID"].ToString() && a.GoodsID == Convert.ToInt32(dtInvoice.Rows[i]["GoodsID"].ToString()) && a.BatchNo == dtInvoice.Rows[i]["BatchNo"].ToString() select a; if (varRejectList.Count() != 0) { S_MaterialListRejectBill lnqMaterialList = varRejectList.Single(); lnqMaterialList.InvoiceUnitPrice = 0; lnqMaterialList.InvoicePrice = 0; lnqMaterialList.HavingInvoice = false; dcOldUnitPrice = lnqMaterialList.UnitPrice; dataContxt.SubmitChanges(); int intFlag = serverMaterialRejectBill.SetHavingInvoiceReturn(dtInvoice.Rows[i]["Bill_ID"].ToString(), out error); if (intFlag == 4) { return(false); } else { var varRejectBill = from a in dataContxt.S_MaterialRejectBill where a.Bill_ID == dtInvoice.Rows[i]["Bill_ID"].ToString() select a; if (varRejectBill.Count() != 0) { S_MaterialRejectBill lnqMaterialBill = varRejectBill.Single(); lnqMaterialBill.InvoiceFlag = intFlag; dataContxt.SubmitChanges(); } } } else { var varOutsourcing = from a in dataContxt.S_CheckOutInDepotForOutsourcingBill where a.Bill_ID == dtInvoice.Rows[i]["Bill_ID"].ToString() && a.GoodsID == Convert.ToInt32(dtInvoice.Rows[i]["GoodsID"].ToString()) && a.BatchNo == dtInvoice.Rows[i]["BatchNo"].ToString() select a; if (varOutsourcing.Count() != 0) { S_CheckOutInDepotForOutsourcingBill lnqOutsourcing = varOutsourcing.Single(); lnqOutsourcing.UnitInvoicePrice = 0; lnqOutsourcing.InvoicePrice = 0; lnqOutsourcing.HavingInvoice = false; dcOldUnitPrice = lnqOutsourcing.UnitPrice; dataContxt.SubmitChanges(); } } } } #endregion str = "2"; #region 改变入库明细表金额 var varInDepotDetail = from b in dataContxt.S_InDepotDetailBill where b.GoodsID == Convert.ToInt32(dtInvoice.Rows[i]["GoodsID"].ToString()) && b.InDepotBillID.Contains(dtInvoice.Rows[i]["Bill_ID"].ToString()) && b.BatchNo == dtInvoice.Rows[i]["BatchNo"].ToString() select b; if (varInDepotDetail.Count() != 0) { if (varInDepotDetail.Count() == 1) { S_InDepotDetailBill lnqInDepotDetailSingle = varInDepotDetail.Single(); lnqInDepotDetailSingle.InvoiceUnitPrice = 0; lnqInDepotDetailSingle.InvoicePrice = 0; lnqInDepotDetailSingle.FactUnitPrice = dcOldUnitPrice; lnqInDepotDetailSingle.FactPrice = Math.Round(dcOldUnitPrice * Convert.ToDecimal(lnqInDepotDetailSingle.InDepotCount), 2); } else { var varInDepotDetailList = from a in varInDepotDetail where a.InDepotBillID == dtInvoice.Rows[i]["Bill_ID"].ToString() select a; S_InDepotDetailBill lnqInDepotDetailData = varInDepotDetailList.Single(); lnqInDepotDetailData.InvoiceUnitPrice = 0; lnqInDepotDetailData.InvoicePrice = 0; lnqInDepotDetailData.FactUnitPrice = dcOldUnitPrice; lnqInDepotDetailData.FactPrice = Math.Round(dcOldUnitPrice * Convert.ToDecimal(lnqInDepotDetailData.InDepotCount), 2); var varData7 = from a in varInDepotDetail where a.InDepotBillID != dtInvoice.Rows[i]["Bill_ID"].ToString() select a; dataContxt.S_InDepotDetailBill.DeleteAllOnSubmit(varData7); } dataContxt.SubmitChanges(); } #endregion } var varInvoice = from a in dataContxt.B_Invoice where a.InvoiceCode == invoiceCode select a; if (varInvoice.Count() > 0) { dataContxt.B_Invoice.DeleteAllOnSubmit(varInvoice); dataContxt.SubmitChanges(); } return(true); } catch (Exception ex) { error = ex.Message + str + count.ToString(); 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)); }