/// <summary>
        /// 添加客户
        /// </summary>
        /// <param name="clientInfo">客户信息</param>
        /// <param name="returnClient">客户信息结果集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功添加客户信息</returns>
        public bool AddClient(Client clientInfo,
                              out IQueryable <View_Client> returnClient, out string error)
        {
            returnClient = null;
            error        = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <Client> table = dataContxt.GetTable <Client>();

                var varClient = from c in table
                                where c.ClientCode == clientInfo.ClientCode
                                select c;

                int sameNoteCount = varClient.Count <Client>();

                if (sameNoteCount == 0)
                {
                    Table <Out_StockInfo> tableOut = dataContxt.GetTable <Out_StockInfo>();
                    var result = from c in tableOut
                                 where c.SecStorageID == clientInfo.ClientCode
                                 select c;

                    int count = result.Count <Out_StockInfo>();

                    if (count == 0)
                    {
                        if (clientInfo.IsSecStorage)
                        {
                            Out_StockInfo stock = new Out_StockInfo();

                            stock.SecStorageID   = clientInfo.ClientCode;
                            stock.SecStorageName = clientInfo.ClientName;
                            stock.Remark         = clientInfo.Remark;

                            dataContxt.Out_StockInfo.InsertOnSubmit(stock);
                        }
                    }

                    dataContxt.Client.InsertOnSubmit(clientInfo);

                    dataContxt.SubmitChanges();

                    return(GetAllClient(out returnClient, out error));
                }
                else
                {
                    error = "该单据已提交,系统不允许重复提交相同编号的供应商!";
                    return(false);
                }
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnClient, out error));
            }
        }
        /// <summary>
        /// 删除AB类零件表信息
        /// </summary>
        /// <param name="id">序号</param>
        /// <param name="returnTable">返回的AB零件表</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool DeleteGoodsGrade(int id, out IQueryable <View_Q_GoodsGradeTable> returnTable, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <Q_GoodsGradeTable> table = dataContxt.GetTable <Q_GoodsGradeTable>();

                var delRow = from c in table
                             where c.ID == id
                             select c;

                foreach (var ei in delRow)
                {
                    table.DeleteOnSubmit(ei);
                }

                dataContxt.SubmitChanges();

                GetAllGoodsGradeTable(out returnTable, out error);
                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnTable, out error));
            }
        }
Exemple #3
0
        /// <summary>
        /// 删除Bom附属表
        /// </summary>
        /// <param name="id">序号</param>
        /// <param name="productType">产品类型</param>
        /// <param name="assemblyFlag">总成标志</param>
        /// <param name="returnTable">返回BOM附属表的信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>删除成功返回True,删除失败返回False</returns>
        public bool DeletePertainProductBomInfo(string id, string productType, int assemblyFlag,
                                                out DataTable returnTable, out string error)
        {
            returnTable = null;
            error       = null;

            try
            {
                DepotManagementDataContext  dataContxt = CommentParameter.DepotDataContext;
                Table <P_PertainProductBom> table      = dataContxt.GetTable <P_PertainProductBom>();
                P_PertainProductBom         delRow     = (from c in table where c.ID.ToString() == id select c).First();

                table.DeleteOnSubmit(delRow);
                dataContxt.SubmitChanges();

                if (assemblyFlag == 0)
                {
                    GetPertainProductBomInfo("False", productType, out returnTable, out error);
                }
                else if (assemblyFlag == 1)
                {
                    GetPertainProductBomInfo("True", productType, out returnTable, out error);
                }
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnTable, out error));
            }

            return(true);
        }
        /// <summary>
        /// 删除领料退库单
        /// </summary>
        /// <param name="billNo">领料退库单号</param>
        /// <param name="returnBill">返回更新后重新查询的领料退库单数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除领料退库单号</returns>
        public bool DeleteBill(string billNo, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext ctx = CommentParameter.DepotDataContext;

                Table <S_MaterialReturnedInTheDepot> table = ctx.GetTable <S_MaterialReturnedInTheDepot>();
                var delRow = from c in table where c.Bill_ID == billNo select c;

                m_assignBill.CancelBillNo(ctx, "领料退库单", billNo);

                table.DeleteAllOnSubmit(delRow);

                //对于营销的总称领料的删除
                var varData = from a in ctx.ProductsCodes
                              where a.DJH == billNo
                              select a;

                ctx.ProductsCodes.DeleteAllOnSubmit(varData);

                ctx.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #5
0
        /// <summary>
        /// 获取订单信息
        /// </summary>
        /// <param name="listRole">角色列表</param>
        /// <param name="loginName">登录名</param>
        /// <param name="returnOrderFormInfo">返回查询到的订单信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool GetAllOrderFormInfo(List <string> listRole, string loginName, out IQueryable <View_B_OrderFormInfo> returnOrderFormInfo,
                                        out string error)
        {
            returnOrderFormInfo = null;
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <View_B_OrderFormInfo> table = dataContxt.GetTable <View_B_OrderFormInfo>();

                var orderFormInfo = (from a in table
                                     join b in dataContxt.ProviderPrincipal on a.供货单位 equals b.Provider
                                     where b.PrincipalWorkId == loginName
                                     select a).Distinct().OrderByDescending(r => r.订货日期);
                returnOrderFormInfo = orderFormInfo.AsQueryable <View_B_OrderFormInfo>();
                //returnOrderFormInfo = from c in table where c.权限控制用登录名 == loginName select c;

                if (returnOrderFormInfo.Count() == 0 ||
                    listRole.Contains(CE_RoleEnum.采购账务管理员.ToString()) ||
                    listRole.Contains(CE_RoleEnum.采购主管.ToString()))
                {
                    returnOrderFormInfo = (from c in table select c).OrderByDescending(r => r.订货日期);
                }

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 删除某一供应商
        /// </summary>
        /// <param name="providerCode">供应商编码</param>
        /// <param name="persnonnelCode">工号</param>
        /// <param name="returnBill">操作成功后返回的查询信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除某一供应商</returns>
        public bool DeleteProvider(string providerCode, string persnonnelCode, out IQueryable <View_Provider> returnBill, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                #region  除 关系表的信息

                Table <ProviderPrincipal> tablePp = dataContxt.GetTable <ProviderPrincipal>();
                var delRowPp = from c in tablePp where c.Provider == providerCode && c.PrincipalWorkId == persnonnelCode select c;

                foreach (var eiPp in delRowPp)
                {
                    tablePp.DeleteOnSubmit(eiPp);
                }
                #endregion

                dataContxt.SubmitChanges();

                GetAllProvider(out returnBill, out error);

                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError1(err, out returnBill, out error));
            }
        }
        /// <summary>
        /// 删除某一部门
        /// </summary>
        /// <param name="departmentCode">部门编码</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除某一部门</returns>
        public bool DeleteDepartment(string departmentCode, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <Department> table = dataContxt.GetTable <Department>();

                var delRow = from c in table
                             where c.DepartmentCode == departmentCode
                             select c;

                foreach (var ei in delRow)
                {
                    table.DeleteOnSubmit(ei);
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #8
0
        /// <summary>
        /// 更新产品信息
        /// </summary>
        /// <param name="productInfo">更新后的产品信息</param>
        /// <param name="returnProductInfo">返回重新查询到的产品信息</param>
        /// <param name="error">出错时返回的错误信息</param>
        /// <returns>操作是否成功的标志</returns>
        public bool UpdateProductInfo(P_ProductInfo productInfo, out IQueryable <View_P_ProductInfo> returnProductInfo, out string error)
        {
            returnProductInfo = null;
            error             = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <P_ProductInfo> table = dataContxt.GetTable <P_ProductInfo>();

                var result = from c in table
                             where c.ProductType == productInfo.ProductType
                             select c;

                if (result.Count() != 0)
                {
                    P_ProductInfo updateInfo = result.Single();

                    updateInfo.ProductCode = productInfo.ProductCode;
                    updateInfo.ProductName = productInfo.ProductName;
                    updateInfo.IsReturn    = productInfo.IsReturn;
                    updateInfo.Remark      = productInfo.Remark;

                    dataContxt.SubmitChanges();
                }

                return(GetAllProductInfo(out returnProductInfo, out error));
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnProductInfo, out error));
            }
        }
        /// <summary>
        /// 删除材料类别编码表记录
        /// </summary>
        /// <param name="szLid">关系ID</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool DeleteDepotForPersonnel(string szLid, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <S_DepotTypeForPersonnel> table = dataContxt.GetTable <S_DepotTypeForPersonnel>();

                var delRow = from c in table
                             where c.ZlID == szLid
                             select c;

                foreach (var ei in delRow)
                {
                    table.DeleteOnSubmit(ei);
                }

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #10
0
        /// <summary>
        /// 添加产品信息
        /// </summary>
        /// <param name="productInfo">产品信息</param>
        /// <param name="returnProductInfo">返回重新查询到的产品信息</param>
        /// <param name="error">出错时返回的错误信息</param>
        /// <returns>操作是否成功的标志</returns>
        public bool AddProductInfo(P_ProductInfo productInfo, out IQueryable <View_P_ProductInfo> returnProductInfo, out string error)
        {
            returnProductInfo = null;
            error             = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <P_ProductInfo> table = dataContxt.GetTable <P_ProductInfo>();

                var billGather = from c in table
                                 where c.ProductType == productInfo.ProductType
                                 select c;

                int intSameNoteCount = billGather.Count <P_ProductInfo>();

                if (intSameNoteCount == 0)
                {
                    dataContxt.P_ProductInfo.InsertOnSubmit(productInfo);
                    dataContxt.SubmitChanges();

                    return(GetAllProductInfo(out returnProductInfo, out error));
                }
                else
                {
                    error = "数据库中已存在该编码的产品信息!";
                    return(false);
                }
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnProductInfo, out error));
            }
        }
        /// <summary>
        /// 删除采购退货单
        /// </summary>
        /// <param name="billNo">退货单号</param>
        /// <param name="returnBill">返回更新后重新查询的采购退货单数据集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除退货单号</returns>
        public bool DeleteBill(string billNo, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                IsolationManageBill          serverIsolation = new IsolationManageBill();
                DepotManagementDataContext   dataContxt      = CommentParameter.DepotDataContext;
                Table <S_MaterialRejectBill> table           = dataContxt.GetTable <S_MaterialRejectBill>();

                var delRow = from c in table
                             where c.Bill_ID == billNo
                             select c;

                m_assignBill.CancelBillNo(dataContxt, "采购退货单", billNo);

                if (!serverIsolation.ClearBillDate(dataContxt, billNo, out error))
                {
                    return(false);
                }

                table.DeleteAllOnSubmit(delRow);

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #12
0
        /// <summary>
        /// 删除主表信息
        /// </summary>
        /// <param name="billID">单据号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>删除成功返回True,否则返回False</returns>
        public bool DeleteBill(string billID, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <S_MaterialDetainBill> table = dataContxt.GetTable <S_MaterialDetainBill>();

                var delRow = from c in table
                             where c.Bill_ID == billID
                             select c;

                if (DeleteList(billID, out error))
                {
                    table.DeleteAllOnSubmit(delRow);
                }
                else
                {
                    return(false);
                }

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                return(false);
            }
        }
        /// <summary>
        /// 添加/修改供应商信息表
        /// </summary>
        /// <param name="providerCode">供应商编码</param>
        /// <param name="providerName">供应商名称</param>
        /// <param name="remark">备注</param>
        /// <param name="returnBill">操作成功后返回的查询信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功添加/修改供应商信息表</returns>
        public bool UpdataNewProvider(string providerCode, string providerName, string remark,
                                      out IQueryable <View_B_NewProvider> returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <B_NewProvider> table = dataContxt.GetTable <B_NewProvider>();

                var varProvider = from c in table where c.NewProviderCode == providerCode select c;

                foreach (var ei in varProvider)
                {
                    ei.NewProviderName = providerName;
                    ei.Remark          = remark;
                }

                dataContxt.SubmitChanges();

                GetAllNewProvider(out returnBill, out error);

                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError2(err, out returnBill, out error));
            }
        }
        /// <summary>
        /// 删除某一供应商
        /// </summary>
        /// <param name="providerCode">供应商编码</param>
        /// <param name="returnBill">操作成功后返回的查询信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除某一供应商</returns>
        public bool DeleteNewProvider(string providerCode, out IQueryable <View_B_NewProvider> returnBill, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <B_NewProvider> table = dataContxt.GetTable <B_NewProvider>();

                var delRow = from c in table where c.NewProviderCode == providerCode select c;

                foreach (var ei in delRow)
                {
                    table.DeleteOnSubmit(ei);
                }

                dataContxt.SubmitChanges();

                GetAllNewProvider(out returnBill, out error);

                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError2(err, out returnBill, out error));
            }
        }
        /// <summary>
        /// 删除普通入库单
        /// </summary>
        /// <param name="billNo">入库单号</param>
        /// <param name="returnInfo">普通入库单</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除普通入库单号</returns>
        public bool DeleteBill(string billNo, out IQueryResult returnInfo, out string error)
        {
            returnInfo = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <S_OrdinaryInDepotBill> table = dataContxt.GetTable <S_OrdinaryInDepotBill>();

                var delRow = from c in table
                             where c.Bill_ID == billNo
                             select c;

                table.DeleteAllOnSubmit(delRow);

                m_assignBill.CancelBillNo(dataContxt, "普通入库单", billNo);

                if (!m_serverFrockStandingBook.DeleteFrockOrdinaryInDepotBill(dataContxt, billNo, out error))
                {
                    return(false);
                }

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #16
0
        /// <summary>
        /// 通过员工编号删除
        /// </summary>
        /// <param name="workID">员工编号</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>成功返回true,失败返回False</returns>
        public bool DeleteAttendanceSetting(List <string> workID, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <HR_AttendanceSetting> table = dataContxt.GetTable <HR_AttendanceSetting>();

                for (int i = 0; i < workID.Count; i++)
                {
                    var delRow = from c in table
                                 where c.WorkID == workID[i].ToString()
                                 select c;

                    foreach (var item in delRow)
                    {
                        table.DeleteOnSubmit(item);
                    }
                }

                dataContxt.SubmitChanges();
                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #17
0
        /// <summary>
        /// 获得分工位总成
        /// </summary>
        /// <param name="queryAssemblingBom">操作后查询返回的产品信息</param>
        /// <param name="error">错误信息</param>
        /// <returns>获取成功返回True,获取失败返回False</returns>
        public bool GetAssemblingBom(
            out IQueryable <P_AssemblingBom> queryAssemblingBom, out string error)
        {
            error = "";

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <P_AssemblingBom> table = dataContxt.GetTable <P_AssemblingBom>();

                queryAssemblingBom = (from c in table
                                      where c.ParentName != null
                                      orderby c.ParentName
                                      select c).Distinct();

                return(true);
            }
            catch (Exception ex)
            {
                error = ex.Message;
                queryAssemblingBom = null;

                return(false);
            }
        }
        /// <summary>
        /// 删除客户
        /// </summary>
        /// <param name="clientCode">客户编码</param>
        /// <param name="returnClient">客户信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除客户信息</returns>
        public bool DeleteClient(string clientCode, out IQueryable <View_Client> returnClient, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <Client> table = dataContxt.GetTable <Client>();

                var delRow = from c in table
                             where c.ClientCode == clientCode
                             select c;

                foreach (var ei in delRow)
                {
                    table.DeleteOnSubmit(ei);
                }

                var delInfo = from a in dataContxt.Out_StockInfo
                              where a.SecStorageID == clientCode
                              select a;

                dataContxt.Out_StockInfo.DeleteAllOnSubmit(delInfo);

                dataContxt.SubmitChanges();

                return(GetAllClient(out returnClient, out error));
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnClient, out error));
            }
        }
        /// <summary>
        /// 获取订单物品信息
        /// </summary>
        /// <param name="listRole">角色列表</param>
        /// <param name="loginName">登录名</param>
        /// <param name="returnOrderFormGoods">返回查询到的信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool GetAllOrderFormGoods(List <string> listRole, string loginName,
                                         out IQueryable <View_B_OrderFormGoods> returnOrderFormGoods, out string error)
        {
            returnOrderFormGoods = null;
            error = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <View_B_OrderFormGoods> table = dataContxt.GetTable <View_B_OrderFormGoods>();

                if (listRole.Contains(CE_RoleEnum.采购账务管理员.ToString()) || listRole.Contains(CE_RoleEnum.SQE组长.ToString()) ||
                    listRole.Contains(CE_RoleEnum.采购主管.ToString()) || listRole.Contains(CE_RoleEnum.会计.ToString()))
                {
                    returnOrderFormGoods = from c in table select c;
                }
                else
                {
                    var orderForm = from r in dataContxt.View_B_OrderFormInfo
                                    where r.权限控制用登录名 == loginName
                                    select r.订单号;

                    returnOrderFormGoods = from c in table where orderForm.Contains(c.订单号) select c;
                }

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 删除自制件入库单
        /// </summary>
        /// <param name="billNo">入库单号</param>
        /// <param name="returnBill">返回的单据查询结果集</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除自制件入库单号</returns>
        public bool DeleteBill(string billNo, out IQueryResult returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <S_HomemadePartBill> table = dataContxt.GetTable <S_HomemadePartBill>();

                var delRow = from c in table
                             where c.Bill_ID == billNo
                             select c;

                table.DeleteAllOnSubmit(delRow);

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnBill, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 删除材料类型关系记录
        /// </summary>
        /// <param name="szLid">关系ID</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool DeleteDtp(string szLid, out string error)
        {
            try
            {
                error = null;

                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

                Table <S_DepotForDtp> S_table = dataContxt.GetTable <S_DepotForDtp>();

                var S_delRow = from a in S_table
                               where a.DtpCode == szLid
                               select a;

                foreach (var S_ei in S_delRow)
                {
                    S_table.DeleteOnSubmit(S_ei);
                }

                dataContxt.SubmitChanges();

                return(true);
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #22
0
        /// <summary>
        /// 删除合同信息
        /// </summary>
        /// <param name="bargainNumber">合同编号</param>
        /// <param name="returnBargainInfo">返回查询到的合同信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool DeleteBargainInfo(string bargainNumber, out IQueryResult returnBargainInfo, out string error)
        {
            error             = null;
            returnBargainInfo = null;

            try
            {
                DepotManagementDataContext       dataContxt  = CommentParameter.DepotDataContext;
                IBargainGoodsServer              goodsServer = ServerModuleFactory.GetServerModule <IBargainGoodsServer>();
                IQueryable <View_B_BargainGoods> returnBargainGoods;

                if (!goodsServer.GetBargainGoods(bargainNumber, out returnBargainGoods, out error))
                {
                    return(false);
                }

                #region 检查此合同的订单信息

                IOrderFormInfoServer orderFormServer = ServerModuleFactory.GetServerModule <IOrderFormInfoServer>();

                if (orderFormServer.GetOrderFormCollection(bargainNumber).Count() > 0)
                {
                    error = string.Format("合同 [{0}] 还包含有订单信息无法进行删除,请将所有此合同包含的订单信息全部删除后才能进行此操作!",
                                          bargainNumber);
                    return(false);
                }

                #endregion

                if (returnBargainGoods != null && returnBargainGoods.Count() > 0)
                {
                    error = string.Format("合同 [{0}] 还包含有零件信息无法进行删除,请将所有此合同包含的零件信息全部删除后才能进行此操作!",
                                          bargainNumber);
                    return(false);
                }

                Table <B_BargainInfo> table = dataContxt.GetTable <B_BargainInfo>();

                var delRow = from c in table
                             where c.BargainNumber == bargainNumber
                             select c;

                table.DeleteAllOnSubmit(delRow);
                dataContxt.SubmitChanges();

                return(GetAllBargainInfo(out returnBargainInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
Exemple #23
0
        /// <summary>
        /// 获取订单综合查询结果
        /// </summary>
        /// <param name="listRole">用户角色列表</param>
        /// <param name="loginName">用户登录名</param>
        /// <returns>合同综合查询结果</returns>
        public IQueryable <View_B_OrderFormAnalyzer> GetOrderFormAnalyzer(List <string> listRole, string loginName)
        {
            DepotManagementDataContext       dataContxt = CommentParameter.DepotDataContext;
            Table <View_B_OrderFormAnalyzer> table      = dataContxt.GetTable <View_B_OrderFormAnalyzer>();

            if (listRole.Contains(CE_RoleEnum.业务系统管理员.ToString()) || listRole.Contains(CE_RoleEnum.采购账务管理员.ToString()) ||
                listRole.Contains(CE_RoleEnum.采购主管.ToString()) || listRole.Contains(CE_RoleEnum.会计.ToString()))
            {
                return(from c in table select c);
            }
            else
            {
                return(from c in table where c.权限控制用登录名 == loginName select c);
            }
        }
Exemple #24
0
        /// <summary>
        /// 删除合同物品信息
        /// </summary>
        /// <param name="bargainNumber">合同号</param>
        /// <param name="goodsID">物品ID</param>
        /// <param name="returnBargainGoods">返回查询到的合同物品信息</param>
        /// <param name="error">错误信息, 没有则为null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool DeleteBargainGoods(string bargainNumber, int goodsID,
                                       out IQueryable <View_B_BargainGoods> returnBargainGoods, out string error)
        {
            returnBargainGoods = null;
            error = null;

            try
            {
                DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;
                Table <B_BargainGoods>     table      = dataContxt.GetTable <B_BargainGoods>();

                var result = from r in dataContxt.B_BargainGoods
                             where r.GoodsID == goodsID &&
                             r.BargainNumber == bargainNumber
                             select r;

                if (result.Count() == 0)
                {
                    error = "找不到指定物品信息,无法进行此操作!";
                    return(false);
                }

                dataContxt.B_BargainGoods.DeleteAllOnSubmit(result);

                var temp = from a in dataContxt.B_BargainGoods
                           where a.BargainNumber == bargainNumber
                           select a;

                if (temp == null || temp.Count() == 0)
                {
                    var temp1 = from a in dataContxt.B_BargainInfo
                                where a.BargainNumber == bargainNumber
                                select a;

                    temp1.Single().MinorPurchaseBillNo = null;
                }

                dataContxt.SubmitChanges();

                return(GetBargainGoods(bargainNumber, out returnBargainGoods, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 获取客户信息
        /// </summary>
        /// <param name="returnClient">客户信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功获取客户信息</returns>
        public bool GetAllClient(out IQueryable <View_Client> returnClient, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <View_Client> table = dataContxt.GetTable <View_Client>();

                returnClient = from c in table select c;
                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnClient, out error));
            }
        }
        /// <summary>
        /// 获取AB类零件表信息
        /// </summary>
        /// <param name="returnTable">返回的AB零件表</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作成功返回True,操作失败返回False</returns>
        public bool GetAllGoodsGradeTable(out IQueryable <View_Q_GoodsGradeTable> returnTable, out string error)
        {
            returnTable = null;
            error       = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <View_Q_GoodsGradeTable> table = dataContxt.GetTable <View_Q_GoodsGradeTable>();

                returnTable = from c in table orderby c.类别, c.图号型号 select c;
                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnTable, out error));
            }
        }
        /// <summary>
        /// 删除自制件工装报检
        /// </summary>
        /// <param name="billNo">单据号号</param>
        /// <param name="returnInfo">自制件工装报检</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除自制件工装报检</returns>
        public bool DeleteBill(string billNo, out IQueryResult returnInfo, out string error)
        {
            returnInfo = null;

            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <S_FrockInDepotBill> table = dataContxt.GetTable <S_FrockInDepotBill>();

                var delRow = from c in table
                             where c.Bill_ID == billNo
                             select c;

                table.DeleteAllOnSubmit(delRow);

                if (!m_serverFrockStandingBook.DeleteFrockOrdinaryInDepotBill(dataContxt, billNo, out error))
                {
                    return(false);
                }

                var result = from r in dataContxt.S_FrockInDepotGoodsBill
                             where r.Bill_ID == billNo
                             select r;

                if (result.Count() > 0)
                {
                    dataContxt.S_FrockInDepotGoodsBill.DeleteAllOnSubmit(result);
                }

                dataContxt.SubmitChanges();

                return(GetAllBill(out returnInfo, out error));
            }
            catch (Exception exce)
            {
                error = exce.Message;
                return(false);
            }
        }
        /// <summary>
        /// 获取供应商信息表
        /// </summary>
        /// <param name="returnBill">供应商信息表</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功获取供应商信息表</returns>
        public bool GetAllProvider(out IQueryable <View_Provider> returnBill, out string error)
        {
            returnBill = null;
            error      = null;

            try
            {
                DepotManagementDataContext depotMangaeDataContext = CommentParameter.DepotDataContext;
                IQueryable <View_Provider> providerTable          = depotMangaeDataContext.GetTable <View_Provider>();

                returnBill = from c in providerTable orderby c.供应商编码 select c;
            }
            catch (Exception err)
            {
                error = err.ToString();
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// 删除单位
        /// </summary>
        /// <param name="id">序号</param>
        /// <param name="returnUnit">单位信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>返回是否成功删除单位信息</returns>
        public bool DeleteUnit(int id, out IQueryable <View_S_Unit> returnUnit, out string error)
        {
            error = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                var varData = from a in dataContxt.F_GoodsPlanCost
                              where a.UnitID == id
                              select a;

                if (varData.Count() > 0)
                {
                    error = "基础信息表内已经使用此单位,不能删除!";
                    GetAllUnit(out returnUnit, out error);
                    return(false);
                }

                Table <S_Unit> table = dataContxt.GetTable <S_Unit>();

                var delRow = from c in table
                             where c.ID == id
                             select c;

                foreach (var ei in delRow)
                {
                    table.DeleteOnSubmit(ei);
                }

                dataContxt.SubmitChanges();

                GetAllUnit(out returnUnit, out error);

                return(true);
            }
            catch (Exception err)
            {
                return(SetReturnError(err, out returnUnit, out error));
            }
        }
        /// <summary>
        /// 获取所有材料类别信息
        /// </summary>
        /// <param name="materialTypes">查询到的材料类别信息</param>
        /// <param name="error">出错时返回错误信息,无错时返回null</param>
        /// <returns>操作是否成功的标志</returns>
        public bool GetAllMaterialType(out IQueryable <View_S_Depot> materialTypes, out string error)
        {
            materialTypes = null;
            error         = null;

            DepotManagementDataContext dataContxt = CommentParameter.DepotDataContext;

            try
            {
                Table <View_S_Depot> depotTable = dataContxt.GetTable <View_S_Depot>();

                materialTypes = from c in depotTable orderby c.仓库编码 select c;

                return(true);
            }
            catch (Exception err)
            {
                error = err.ToString();
                return(false);
            }
        }