Exemplo n.º 1
0
        /// <summary>
        /// 分页集合按主单分页
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <STK_StockTtlResult> GetPageList(STK_StockTtlParam param)
        {
            this.CheckSession();
            PageList <STK_StockTtlResult> ret = new PageList <STK_StockTtlResult>();

            try
            {
                List <Field> field = new List <Field>()
                {
                    Field.All
                };

                ret = this.SelectList <STK_StockTtlResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), STK_StockTtl._.CreatedTime.Desc);

                //foreach (STK_StockTtlResult stockTtl in ret.ResultList)
                //{
                //    List<STK_StockResult> stockList = this.SelectList<STK_StockResult>(STK_Stock._.TItemCode == stockTtl.TItemCode && STK_Stock._.InvQty != 0, STK_Stock._.CreatedTime.Desc);
                //    if (stockList != null && stockList.Count>0)
                //    {
                //        stockTtl.StockList = stockList;
                //    }
                //}
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(STK_StockTtlParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.TItemCode == null)
                {
                    throw new WarnException("请指定GUID!");
                }
                #endregion
                WhereClip          whereClip = GetWhereClip(param);
                STK_StockTtlResult info      = new STK_StockTtlResult();
                info.IsDeleted = true;
                affect         = this.Update <STK_StockTtlResult>(info, whereClip);
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 批量修改和插入
        /// </summary>
        /// <param name="paramList"></param>
        /// <returns></returns>
        public WCFAddUpdateResult UpdateOrInsertList(List <STK_StockTtlResult> list)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                #region 判断
                if (list.Count <= 0)
                {
                    throw new WarnException("没有需要操作的对象!");
                }
                #endregion
                int affect = 0;
                this.BatchInsertOrUpdate <STK_StockTtlResult>(list);
                affect = this.BatchExecute();
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(ret);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 添加和新增修改
        /// </summary>
        /// <param name="param">新增或修改的实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult AddOrUpdate(CRM_CompanyContactResult param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                int affect = 0;
                #region 判断
                if (!string.IsNullOrEmpty(param.ContactName.Trim()))
                {
                    throw new WarnException("请指定联系人!");
                }
                #endregion

                #region 判断重复
                WhereClip whereChk = CRM_CompanyContact._.IsDeleted == false && CRM_CompanyContact._.ContactName == param.ContactName;
                if (param.ContactID > 0)
                {
                    whereChk = whereChk & CRM_CompanyContact._.CompanyID != param.CompanyID;
                }
                int chkNum = this.Count <CRM_CompanyContactResult>(whereChk);
                if (chkNum > 0)
                {
                    throw new WarnException("存在重复的联系人!");
                }
                #endregion
                #region 系统默认值
                if (param.CompanyID > 0)
                {
                    WhereClip where = CRM_CompanyContact._.CompanyID == param.CompanyID;
                    affect          = this.Update <CRM_CompanyContactResult>(param, where);
                }
                else
                {
                    param.GCompanyID = this.SessionInfo.CompanyID;
                    param.IsDeleted  = false;
                    affect           = this.Insert <CRM_CompanyContactResult>(param);
                    param            = this.Select <CRM_CompanyContactResult>(new List <Field>()
                    {
                        CRM_CompanyContactResult._.ContactID
                    }, CRM_CompanyContact._.ContactName == param.ContactName);
                }
                #region 设置返回值
                ret.Key = param.ContactID;
                #endregion
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 批量修改和插入
        /// </summary>
        /// <param name="paramList"></param>
        /// <returns></returns>
        public WCFAddUpdateResult UpdateOrInsertList(List <STK_OutLineResult> list)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                #region 判断
                if (list.Count <= 0)
                {
                    throw new WarnException("没有需要操作的对象!");
                }
                if (list.Where(a => string.IsNullOrEmpty(a.InvType)).Count() > 0)
                {
                    throw new WarnException("请指定库存类型!");
                }
                if (list.Where(a => string.IsNullOrEmpty(a.Warehouse)).Count() > 0)
                {
                    throw new WarnException("请指定仓库");
                }
                if (list.Where(a => string.IsNullOrEmpty(a.Currency)).Count() > 0)
                {
                    throw new WarnException("请指定出库币种");
                }
                #endregion
                foreach (STK_OutLineResult stkStockResult in list)
                {
                    if (stkStockResult.ItemCode.ToGuid() != Guid.Empty)
                    {
                        stkStockResult.UpdatedEmpID   = this.SessionInfo.UserID;
                        stkStockResult.UpdatedEmpName = this.SessionInfo.UserName;
                        stkStockResult.UpdatedTime    = DateTime.Now;
                    }
                    else
                    {
                        stkStockResult.CreatedEmpID   = this.SessionInfo.UserID;
                        stkStockResult.CreatedEmpName = this.SessionInfo.UserName;
                        stkStockResult.CreatedTime    = DateTime.Now;
                        stkStockResult.IsDeleted      = false;
                    }
                }
                int affect = 0;
                this.BatchInsertOrUpdate <STK_OutLineResult>(list);
                affect = this.BatchExecute();
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加和新增修改
        /// </summary>
        /// <param name="param">新增或修改的实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult AddOrUpdate(ORD_SalesOrderLineResult param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                int affect = 0;
                #region 判断
                #endregion


                #region 系统默认值
                if (param.SOLineGuid != null)
                {
                    WhereClip where      = ORD_SalesOrderLine._.SOLineGuid == param.SOLineGuid;
                    param.UpdatedEmpID   = this.SessionInfo.UserID;
                    param.UpdatedEmpName = this.SessionInfo.UserName;
                    param.UpdatedTime    = DateTime.Now;
                    affect = this.Update <ORD_SalesOrderLineResult>(param, where);
                }
                else
                {
                    param.SOLineGuid = Guid.NewGuid();

                    param.GCompanyID = this.SessionInfo.CompanyID;

                    param.IsDeleted      = false;
                    param.CreatedEmpID   = this.SessionInfo.UserID;
                    param.CreatedEmpName = this.SessionInfo.UserName;
                    param.CreatedTime    = DateTime.Now;
                    affect = this.Insert <ORD_SalesOrderLineResult>(param);
                    param  = this.Select <ORD_SalesOrderLineResult>(new List <Field>()
                    {
                        ORD_SalesOrderLine._.All
                    }, ORD_SalesOrderLine._.SOLineGuid == param.SOLineGuid);
                }
                #region 设置返回值
                ret.KeyGuid        = param.SOLineGuid;
                ret.CreatedTime    = param.CreatedTime;
                ret.CreatedEmpID   = param.CreatedEmpID;
                ret.CreatedEmpName = param.CreatedEmpName;
                ret.UpdatedEmpID   = param.UpdatedEmpID;
                ret.UpdatedEmpName = param.UpdatedEmpName;
                ret.UpdatedTime    = param.UpdatedTime;
                #endregion
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 分页集合按明细分页
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <STK_StockTtlResult> GetPageListByDetail(STK_StockTtlParam param)
        {
            this.CheckSession();
            PageList <STK_StockTtlResult> stockTtlPgList = new PageList <STK_StockTtlResult>();
            PageList <STK_StockResult>    stockPgList    = new PageList <STK_StockResult>();

            try
            {
                List <Field> field = new List <Field>()
                {
                    Field.All
                };
                WhereClip clip = STK_Stock._.IsDeleted == 0 && STK_Stock._.InvQty != 0;
                if (!string.IsNullOrEmpty(param.Model))
                {
                    clip = clip && STK_Stock._.Model.Like(param.Model + "%");
                }
                if (!string.IsNullOrEmpty(param.Brand))
                {
                    clip = clip && STK_Stock._.Brand.Like(param.Brand + "%");
                }
                if (!string.IsNullOrEmpty(param.Batch))
                {
                    clip = clip && STK_Stock._.Brand.Like(param.Batch + "%");
                }
                if (!string.IsNullOrEmpty(param.Package))
                {
                    clip = clip && STK_Stock._.Brand.Like(param.Package + "%");
                }
                stockPgList = this.SelectList <STK_StockResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, clip, STK_Stock._.CreatedTime.Desc);
                List <STK_StockResult> stockList = stockPgList.ResultList;
                if (stockList != null && stockList.Count > 0)
                {
                    stockTtlPgList.TotalCount = stockPgList.TotalCount;
                    Guid?[] tItemCodes = stockList.Select(a => a.TItemCode).Distinct().ToArray();
                    List <STK_StockTtlResult> stockTtlList = this.SelectList <STK_StockTtlResult>(STK_StockTtl._.TItemCode.In(tItemCodes));
                    foreach (STK_StockTtlResult stockTtl in stockTtlList)
                    {
                        List <STK_StockResult> list = stockList.Where(a => a.TItemCode == stockTtl.TItemCode).ToList();
                        if (list != null && list.Count > 0)
                        {
                            stockTtl.StockList = list;
                        }
                    }
                    stockTtlPgList.ResultList = stockTtlList;
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(stockTtlPgList);
        }
Exemplo n.º 8
0
        public bool CancelPurchaseNotice(ORD_PurchaseNoticeParam param)
        {
            bool flag = true;

            try
            {
                ORD_PurchaseNoticeResult noticeResult = this.GetInfo(param);
                if (noticeResult != null)
                {
                    if (noticeResult.PurchaseQty > 0)
                    {
                        flag = false;
                        throw new WarnException("当前采购通知已存在关联的采购信息,不允许取消通知!");
                    }
                    this.DelInfo(param);//删除当前采购通知
                    //汇总采购通知所关联的销售明细下所有关联的有效的采购通知的数量
                    List <ORD_PurchaseNoticeResult> noticeList = this.GetList(new ORD_PurchaseNoticeParam()
                    {
                        SOLineGuid = noticeResult.SOLineGuid
                    });
                    int?noticeQty = 0;
                    if (noticeList != null && noticeList.Count > 0)
                    {
                        noticeQty = noticeList.Sum(a => a.NoticeQty);
                    }
                    ORD_SalesOrderLineBLL orderLineBLL = new ORD_SalesOrderLineBLL();
                    orderLineBLL.SessionInfo = this.SessionInfo;
                    ORD_SalesOrderLineResult orderLineResult = orderLineBLL.GetInfo(new ORD_SalesOrderLineParam()
                    {
                        SOLineGuid = noticeResult.SOLineGuid
                    });
                    orderLineResult.NotifyQty = noticeQty;
                    orderLineBLL.AddOrUpdate(orderLineResult);
                    ORD_SalesOrderBLL orderBLL = new ORD_SalesOrderBLL();
                    orderBLL.SessionInfo = this.SessionInfo;
                    orderBLL.UpdateStatus(new ORD_SalesOrderParam()
                    {
                        SOGuid = noticeResult.SOGuid
                    });                                                                              //更新销售明细的通知状态
                }
                else
                {
                    flag = false;
                    throw new WarnException("当前采购通知记录在系统中不存在!");
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }

            return(flag);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 获取集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <STK_StockReserveResult> GetList(STK_StockReserveParam param)
        {
            this.CheckSession();
            List <STK_StockReserveResult> ret = new List <STK_StockReserveResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);

                ret = this.SelectList <STK_StockReserveResult>(whereClip, STK_StockReserve._.CreatedTime.Asc);

                if (ret != null && ret.Count > 0)
                {
                    Guid?[]      ItemCodes = ret.Select(a => a.ItemCode).Distinct().ToArray();
                    STK_StockBLL stockBLL  = new STK_StockBLL();
                    stockBLL.SessionInfo = this.SessionInfo;
                    List <STK_StockResult> stockList = stockBLL.GetList(new STK_StockParam()
                    {
                        ItemCodes = ItemCodes
                    });
                    if (stockList != null && stockList.Count > 0)
                    {
                        foreach (STK_StockReserveResult sr in ret)
                        {
                            if (stockList != null && stockList.Count > 0)
                            {
                                STK_StockResult stockResult = stockList.FirstOrDefault(a => a.ItemCode == sr.ItemCode);
                                if (stockResult != null)
                                {
                                    sr.Unit      = stockResult.Unit;
                                    sr.Model     = stockResult.Model;
                                    sr.Brand     = stockResult.Brand;
                                    sr.Batch     = stockResult.Batch;
                                    sr.Package   = stockResult.Package;
                                    sr.Quality   = stockResult.Quality;
                                    sr.MPQ       = stockResult.MPQ;
                                    sr.MarkCode  = stockResult.MarkCode;
                                    sr.Warehouse = stockResult.Warehouse;
                                    sr.Location  = stockResult.Location;
                                    sr.InvType   = stockResult.InvType;
                                    sr.InBatchNo = stockResult.InBatchNo;
                                }
                            }
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 10
0
        public void OnException(ExceptionContext filterContext)
        {
            LogInfo log = CreateLogInfo(filterContext.RouteData, filterContext.HttpContext.Request);

            log.YCMS    = filterContext.Exception.Message;
            log.LogType = LogType.Exception;

            LogInfoBLL.Add(log);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 获取集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <ORD_SalesReturnLineResult> GetList(ORD_SalesReturnLineParam param)
        {
            this.CheckSession();
            List <ORD_SalesReturnLineResult> ret = new List <ORD_SalesReturnLineResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);
                ret = this.SelectList <ORD_SalesReturnLineResult>(whereClip, ORD_SalesReturnLine._.CreatedTime.Asc);
                if (ret != null)
                {
                    STK_InLineBLL stkInLineBLL = new STK_InLineBLL();
                    stkInLineBLL.SessionInfo = this.SessionInfo;
                    Guid?[] stkInLineGuids = ret.Select(a => a.StkInLineGuid).Distinct().ToArray();
                    List <STK_InLineResult> linkInLineResultList = stkInLineBLL.GetList(new STK_InLineParam()
                    {
                        StkInLineGuids = stkInLineGuids
                    });

                    ORD_SalesReturnBLL returnBLL = new ORD_SalesReturnBLL();
                    returnBLL.SessionInfo = this.SessionInfo;
                    Guid?[] SRGuids = ret.Select(a => a.SRGuid).Distinct().ToArray();
                    List <ORD_SalesReturnResult> returnResultList = returnBLL.GetList(new ORD_SalesReturnParam()
                    {
                        SRGuids = SRGuids
                    });
                    foreach (ORD_SalesReturnLineResult returnLineResult in ret)
                    {
                        ORD_SalesReturnResult returnResult = returnResultList.FirstOrDefault(a => a.SRGuid == returnLineResult.SRGuid);
                        if (returnResult != null)
                        {
                            returnLineResult.SRBillNo = returnResult.BillNo;
                        }
                        STK_InLineResult linkStkInLineResult = linkInLineResultList.FirstOrDefault(a => a.StkInLineGuid == returnLineResult.StkInLineGuid);
                        if (linkStkInLineResult != null)
                        {
                            returnLineResult.LinkStkInCurrency  = linkStkInLineResult.Currency;
                            returnLineResult.LinkStkInTaxRate   = linkStkInLineResult.TaxRate;
                            returnLineResult.LinkStkInUnitPrice = linkStkInLineResult.UnitPrice;
                            returnLineResult.LinkStkInFreight   = linkStkInLineResult.Freight;
                            returnLineResult.LinkStkInCostPrice = linkStkInLineResult.CostPrice;
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 分页集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <ORD_PurchaseOrderResult> GetPageList(ORD_PurchaseOrderParam param)
        {
            this.CheckSession();
            PageList <ORD_PurchaseOrderResult> ret = new PageList <ORD_PurchaseOrderResult>();

            try
            {
                List <Field> field = new List <Field>()
                {
                    Field.All
                };
                ret = this.SelectList <ORD_PurchaseOrderResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), ORD_PurchaseOrder._.CreatedTime.Desc);
                if (ret.ResultList != null && ret.ResultList.Count > 0)
                {
                    HR_OrgBLL orgBLL = new HR_OrgBLL();
                    orgBLL.SessionInfo = this.SessionInfo;
                    HR_OrgParam orgParam = new HR_OrgParam();
                    orgParam.OrgIDs = ret.ResultList.Where(a => a.PurOrgID != null).Select(a => a.PurOrgID).Distinct().ToArray();
                    List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam);

                    HR_DepartmentBLL deptBLL = new HR_DepartmentBLL();
                    deptBLL.SessionInfo = this.SessionInfo;
                    HR_DepartmentParam deptParam = new HR_DepartmentParam();
                    deptParam.DeptIDs = ret.ResultList.Where(a => a.PurDeptID != null).Select(a => a.PurDeptID).Distinct().ToArray();
                    List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam);
                    HR_Org findOrg = null;
                    HR_DepartmentResult findDept = null;

                    foreach (ORD_PurchaseOrderResult orderResult in ret.ResultList)
                    {
                        findOrg = orgList.Find(a => a.OrgID == orderResult.PurOrgID);
                        if (findOrg != null)
                        {
                            orderResult.PurOrgName = findOrg.OrgName;
                        }
                        findDept = deptList.Find(a => a.DeptID == orderResult.PurDeptID);
                        if (findDept != null)
                        {
                            orderResult.PurDeptName = findDept.DeptName;
                        }
                        orderResult.AllStatus = orderResult.StkInStatus + "->" + orderResult.StkOutStatus;
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 13
0
        public bool SubmitPurchaseOrderBill(ORD_PurchaseOrderParam param)
        {
            this.CheckSession();
            bool submitFlag = true;

            try
            {
                ORD_PurchaseOrderResult orderResult = this.GetInfo(param);

                if (orderResult != null)
                {
                    #region 判断是否可以提交

                    bool isAllowSubmit = true;

                    if (orderResult.ApproveStatus == "待审核")
                    {
                        isAllowSubmit = false;
                        throw new WarnException("采购单当前状态为:【已提交,待审核】,禁止重复提交!");
                    }
                    else if (orderResult.ApproveStatus == "审核完成")
                    {
                        isAllowSubmit = false;
                        throw new WarnException("采购单当前状态为:【审核完成】,撤单后才可以再次提交!");
                    }
                    if (isAllowSubmit)
                    {
                        orderResult.Status        = "Approve";
                        orderResult.ApproveStatus = "待审核";
                        WCFAddUpdateResult ret = this.AddOrUpdate(orderResult);
                        if (ret.KeyGuid.ToGuid() == Guid.Empty)
                        {
                            submitFlag = false;
                        }
                    }


                    #endregion
                }
                else
                {
                    throw new WarnException("要提交的采购单在系统中不存在!");
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(submitFlag);
        }
Exemplo n.º 14
0
        /// <summary>
        /// 添加和新增修改
        /// </summary>
        /// <param name="param">新增或修改的实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult AddOrUpdate(HR_OrgResult param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                int affect = 0;
                #region 判断
                if (param.OrgName.Trim() == "")
                {
                    throw new WarnException("请输入机构名称!");
                }
                if (param.OrgNo.Trim() == "")
                {
                    throw new WarnException("请输入机构编号!");
                }
                #endregion
                #region 系统默认值

                if (param.OrgGuID != Guid.Empty)
                {
                    WhereClip where = HR_Org._.OrgGuID == param.OrgGuID;
                    affect          = this.Update <HR_OrgResult>(param, where);
                }
                else
                {
                    param.OrgGuID    = Guid.NewGuid();
                    param.GCompanyID = this.SessionInfo.CompanyID;
                    param.IsDeleted  = false;
                    affect           = this.Insert <HR_OrgResult>(param);
                    param            = this.Select <HR_OrgResult>(new List <Field>()
                    {
                        HR_Org._.OrgID
                    }, HR_Org._.OrgGuID == param.OrgGuID);
                }
                #region 设置返回值
                ret.Key     = param.OrgID;
                ret.KeyGuid = param.OrgGuID;
                #endregion

                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 获取集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <STK_OutLineResult> GetList(STK_OutLineParam param)
        {
            this.CheckSession();
            List <STK_OutLineResult> ret = new List <STK_OutLineResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);
                ret = this.SelectList <STK_OutLineResult>(whereClip, STK_OutLine._.CreatedTime.Asc);
                if (ret != null && ret.Count > 0)
                {
                    Guid?[]    StkOutGuids = ret.Select(a => a.StkOutGuid).Distinct().ToArray();
                    Guid?[]    ItemCodes   = ret.Select(a => a.ItemCode).Distinct().ToArray();
                    STK_OutBLL stkOutBLL   = new STK_OutBLL();
                    stkOutBLL.SessionInfo = this.SessionInfo;
                    List <STK_OutResult> outResultList = stkOutBLL.GetList(new STK_OutParam()
                    {
                        StkOutGuids = StkOutGuids
                    });
                    STK_StockBLL stockBLL = new STK_StockBLL();
                    stockBLL.SessionInfo = this.SessionInfo;
                    List <STK_StockResult> stockResultList = stockBLL.GetList(new STK_StockParam()
                    {
                        ItemCodes = ItemCodes
                    });
                    foreach (STK_OutLineResult outLineResult in ret)
                    {
                        STK_OutResult outResult = outResultList.FirstOrDefault(a => a.StkOutGuid == outLineResult.StkOutGuid);
                        if (outResult != null)
                        {
                            outLineResult.StkOutBillNo = outResult.BillNo;
                            outLineResult.SourceBillNo = outResult.SourceBillNo;
                        }
                        STK_StockResult stockResult = stockResultList.FirstOrDefault(a => a.ItemCode == outLineResult.ItemCode);
                        if (stockResult != null)
                        {
                            outLineResult.BuyerID   = stockResult.BuyerID;
                            outLineResult.BuyerName = stockResult.BuyerName;
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 16
0
        private object GetSourceAuditStatus(WF_TableResult tableRst, Guid?sourceGuid)
        {
            object ret = null;

            try
            {
                this.CheckSession();
                #region 定义获取的参数
                WF_TableFieldsResult findGuidKeyFld = tableRst.WF_TableFieldList.Find(a => a.IsKeyGuid == true);
                if (findGuidKeyFld == null)
                {
                    throw new WarnException("系统定义的表未定义主键ID!");
                }
                string guidKeyField = findGuidKeyFld.WF_FieldEngName.ToStringHasNull();
                Type   typeParam    = Type.GetType(tableRst.GetParamPath + ",ZNLCRM.Entity");
                object param        = Activator.CreateInstance(typeParam);
                if (param == null)
                {
                    throw new WarnException("系统定义的表定义参数类路错误!");
                }
                typeParam.GetProperty(guidKeyField).SetValue(param, sourceGuid, null);
                #endregion
                #region BLL方法
                Type   typeBll = Type.GetType(tableRst.BillPath + ",ZNLCRM.BLL");
                object bll     = Activator.CreateInstance(typeBll);
                if (bll == null)
                {
                    throw new WarnException("系统定义的表逻辑类路错误!");
                }
                PropertyInfo sessionInfo = typeBll.GetProperty("SessionInfo");
                if (sessionInfo == null)
                {
                    throw new WarnException("系统定义的逻辑类未发现对话实体!");
                }
                sessionInfo.SetValue(bll, this.SessionInfo, null);
                ret = typeBll.GetMethod(tableRst.GetMethodName.ToStringHasNull()).Invoke(bll, new object[] { param });
                if (ret == null || ret.GetType().GetProperty(guidKeyField).GetValue(ret, null) == null)
                {
                    ret = null;
                }
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(ret);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 获取出库明细的分页信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <STK_OutLineResult> GetPageList(STK_OutLineParam param)
        {
            PageList <STK_OutLineResult> ret = new PageList <STK_OutLineResult>();

            try
            {
                STK_OutParam outParam = new STK_OutParam()
                {
                    SourceBillNo = param.SourceBillNo,
                    BillNo       = param.StkOutBillNo,
                    PageIndex    = 1,
                    PageSize     = 5000,
                    Status       = param.Status
                };
                STK_OutBLL outBLL = new STK_OutBLL();
                outBLL.SessionInfo = this.SessionInfo;
                PageList <STK_OutResult> outList = outBLL.GetPageList(outParam);
                if (outList != null && outList.ResultList.Count > 0)
                {
                    Guid?[] StkOutGuids = outList.ResultList.Select(a => (Guid?)a.StkOutGuid).Distinct().ToArray();
                    param.StkOutGuids = StkOutGuids;

                    ret = this.SelectList <STK_OutLineResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), new List <Field>()
                    {
                        Field.All
                    }, GetWhereClip(param), STK_OutLine._.CreatedTime.Desc);
                    if (ret != null && ret.ResultList.Count > 0)
                    {
                        foreach (STK_OutLineResult outLineResult in ret.ResultList)
                        {
                            //获取出库单号
                            STK_OutResult outResult = outList.ResultList.FirstOrDefault(a => a.StkOutGuid == outLineResult.StkOutGuid);
                            if (outResult != null)
                            {
                                outLineResult.StkOutBillNo = outResult.BillNo;
                                outLineResult.SourceBillNo = outResult.SourceBillNo;
                            }
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(HR_EmployeeParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.EmpGuid == null)
                {
                    throw new WarnException("请指定要删除的记录!");
                }
                #endregion
                HR_EmployeeResult info = new HR_EmployeeResult();
                info = this.Select <HR_EmployeeResult>(new List <Field>()
                {
                    HR_Employee._.EmpID
                }, HR_Employee._.IsDeleted == false && HR_Employee._.EmpGuid == param.EmpGuid);
                if (info == null)
                {
                    throw new WarnException("未找到员工信息");
                }
                if (this.Count <ORD_SalesOrder>((ORD_SalesOrder._.SalerID == info.EmpID || ORD_SalesOrder._.CreatedEmpID == info.EmpID) && ORD_SalesOrder._.IsDeleted == false) > 0 ||
                    this.Count <ORD_PurchaseOrder>((ORD_PurchaseOrder._.BuyerID == info.EmpID || ORD_PurchaseOrder._.CreatedEmpID == info.EmpID) && ORD_PurchaseOrder._.IsDeleted == false) > 0)
                {
                    throw new WarnException("存在业务引用,不允许删除!");
                }
                WhereClip where = GetWhereClip(param);
                info            = new HR_EmployeeResult();
                info.IsDeleted  = true;
                affect          = this.Update <HR_EmployeeResult>(info, where);
                this.Update <SYS_UserAccount>(new SYS_UserAccount()
                {
                    IsDeleted = true
                }, SYS_UserAccount._.EmpID == info.EmpID && SYS_UserAccount._.GCompanyID == this.SessionInfo.CompanyID && SYS_UserAccount._.IsDeleted == false);
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 获取集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <ORD_PurchaseNoticeResult> GetList(ORD_PurchaseNoticeParam param)
        {
            this.CheckSession();
            List <ORD_PurchaseNoticeResult> ret = new List <ORD_PurchaseNoticeResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);
                ret = this.SelectList <ORD_PurchaseNoticeResult>(whereClip, ORD_PurchaseNotice._.CreatedTime.Asc);
                if (ret != null && ret.Count > 0)
                {
                    Guid?[] SOLineGuids           = ret.Where(a => a.SOLineGuid.ToGuid() != Guid.Empty).Select(a => a.SOLineGuid).Distinct().ToArray();
                    ORD_SalesOrderLineBLL lineBLL = new ORD_SalesOrderLineBLL();
                    lineBLL.SessionInfo = this.SessionInfo;
                    ORD_SalesOrderLineParam lineParam = new ORD_SalesOrderLineParam();
                    lineParam.SOLineGuids = SOLineGuids;
                    List <ORD_SalesOrderLineResult> lineResultList = lineBLL.GetList(lineParam);
                    if (ret != null && ret.Count > 0 && lineResultList != null && lineResultList.Count > 0)
                    {
                        foreach (ORD_PurchaseNoticeResult noticeResult in ret)
                        {
                            ORD_SalesOrderLineResult lineResult = lineResultList.FirstOrDefault(a => a.SOLineGuid == noticeResult.SOLineGuid);
                            if (lineResult != null)
                            {
                                noticeResult.SOLineCode       = lineResult.SOLineCode;
                                noticeResult.SalePrice        = lineResult.UnitPrice;
                                noticeResult.Unit             = lineResult.Unit;
                                noticeResult.Model            = lineResult.Model;
                                noticeResult.Brand            = lineResult.Brand;
                                noticeResult.Batch            = lineResult.Batch;
                                noticeResult.Package          = lineResult.Package;
                                noticeResult.InvType          = lineResult.InvType;
                                noticeResult.NeedDeliveryDate = lineResult.NeedDeliveryDate;
                                noticeResult.SaleQty          = lineResult.Qty;
                            }
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 分页集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <STK_OutResult> GetPageList(STK_OutParam param)
        {
            this.CheckSession();
            PageList <STK_OutResult> ret = new PageList <STK_OutResult>();

            try
            {
                List <Field> field = new List <Field>()
                {
                    Field.All
                };
                ret = this.SelectList <STK_OutResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), field, GetWhereClip(param), STK_Out._.CreatedTime.Desc);
                if (ret.ResultList != null && ret.ResultList.Count > 0)
                {
                    HR_OrgBLL orgBLL = new HR_OrgBLL();
                    orgBLL.SessionInfo = this.SessionInfo;
                    HR_OrgParam orgParam = new HR_OrgParam();
                    orgParam.OrgIDs = ret.ResultList.Where(a => a.OperDeptID != null).Select(a => a.OperOrgID).Distinct().ToArray();
                    List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam);

                    HR_DepartmentBLL deptBLL = new HR_DepartmentBLL();
                    deptBLL.SessionInfo = this.SessionInfo;
                    HR_DepartmentParam deptParam = new HR_DepartmentParam();
                    deptParam.DeptIDs = ret.ResultList.Where(a => a.OperDeptID != null).Select(a => a.OperDeptID).Distinct().ToArray();
                    List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam);

                    foreach (STK_OutResult orderResult in ret.ResultList)
                    {
                        if (orderResult.OperOrgID != null)
                        {
                            orderResult.OperOrgName = orgList.FirstOrDefault(a => a.OrgID == orderResult.OperOrgID).OrgName;
                        }
                        if (orderResult.OperDeptID != null)
                        {
                            orderResult.OperDeptName = deptList.FirstOrDefault(a => a.DeptID == orderResult.OperDeptID).DeptName;
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 21
0
        public bool AuditSalesOrderBill(ORD_SalesOrderParam param)
        {
            bool auditFlag = true;

            try
            {
                ORD_SalesOrderResult orderResult = this.GetInfo(param);

                if (orderResult != null)
                {
                    bool isAllowAudit = true;

                    if (orderResult.ApproveStatus == "待提交")
                    {
                        isAllowAudit = false;
                        throw new WarnException("销售单当前状态为:【待提交】,请先提交!");
                    }
                    else if (orderResult.ApproveStatus == "审核完成")
                    {
                        isAllowAudit = false;
                        throw new WarnException("销售单当前状态为:【审核完成】,禁止重复审核!");
                    }
                    if (isAllowAudit)
                    {
                        orderResult.Status        = "Complete";
                        orderResult.ApproveStatus = "审核完成";
                        WCFAddUpdateResult ret = this.AddOrUpdate(orderResult);
                        if (ret.KeyGuid.ToGuid() == Guid.Empty)
                        {
                            auditFlag = false;
                        }
                    }
                }
                else
                {
                    throw new WarnException("要审核的销售单在系统中不存在!");
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(auditFlag);
        }
Exemplo n.º 22
0
        /// <summary>
        /// 批量修改和插入
        /// </summary>
        /// <param name="paramList"></param>
        /// <returns></returns>
        public WCFAddUpdateResult UpdateOrInsertList(List <STK_StockReserveResult> list)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                #region 判断
                if (list.Count <= 0)
                {
                    throw new WarnException("没有需要操作的对象!");
                }
                #endregion
                foreach (STK_StockReserveResult stk_StockReserveResult in list)
                {
                    if (stk_StockReserveResult.SRGuid.ToGuid() != Guid.Empty)
                    {
                        stk_StockReserveResult.UpdatedEmpID   = this.SessionInfo.UserID;
                        stk_StockReserveResult.UpdatedEmpName = this.SessionInfo.UserName;
                        stk_StockReserveResult.UpdatedTime    = DateTime.Now;
                    }
                    else
                    {
                        stk_StockReserveResult.SRGuid         = Guid.NewGuid();
                        stk_StockReserveResult.GCompanyID     = this.SessionInfo.CompanyID;
                        stk_StockReserveResult.CreatedEmpID   = this.SessionInfo.UserID;
                        stk_StockReserveResult.CreatedEmpName = this.SessionInfo.UserName;
                        stk_StockReserveResult.CreatedTime    = DateTime.Now;
                        stk_StockReserveResult.IsDeleted      = false;
                    }
                }
                int affect = 0;
                this.BatchInsertOrUpdate <STK_StockReserveResult>(list);
                affect = this.BatchExecute();
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 23
0
 /// <summary>
 /// 改变当前单据的审批状态
 /// </summary>
 /// <param name="tableRst">关联表字段名</param>
 /// <param name="sourceGuid">业务单据GUID</param>
 /// <param name="addEditInfo">要添加或修改的实体</param>
 /// <param name="approveStatus">审批状态中文说明</param>
 /// <param name="status">审批状态代码</param>
 private void ChangeSourceBllAuditStatus(WF_TableResult tableRst, string status, string approveStatus, object sourceInfo)
 {
     try
     {
         this.CheckSession();
         #region 获取相关方法
         Type   typeBll = Type.GetType(tableRst.BillPath + ",ZNLCRM.BLL");
         object bll     = Activator.CreateInstance(typeBll);
         #region 设置实体审批状态
         PropertyInfo statusField        = sourceInfo.GetType().GetProperty("Status");
         PropertyInfo approveStatusField = sourceInfo.GetType().GetProperty("ApproveStatus");
         if (statusField == null)
         {
             throw new WarnException("相关单据中不存在审批状态字段!");
         }
         if (approveStatusField == null)
         {
             throw new WarnException("相关单据中不存在审批状态说明字段!");
         }
         statusField.SetValue(sourceInfo, status, null);
         approveStatusField.SetValue(sourceInfo, approveStatus, null);
         #endregion
         //MethodInfo addMothod = typeBll.GetMethod(tableRst.AddMethodName.ToStringHasNull());
         MethodInfo updateMothod = typeBll.GetMethod(tableRst.UpdateMethodName.ToStringHasNull());
         //if (addMothod == null) throw new WarnException("系统定义的逻辑类添加方法错误!");
         if (updateMothod == null)
         {
             throw new WarnException("系统定义的逻辑类修改方法错误!");
         }
         if (sourceInfo == null)
         {
             throw new WarnException("请先保存当前单据新增数据!");
         }
         else
         {
             updateMothod.Invoke(bll, new object[] { sourceInfo });
         }
         #endregion
     }
     catch (WarnException exp)
     {
         throw exp;
     }
     catch (System.Exception exp)
     {
         LogInfoBLL.WriteLog(this.SessionInfo, exp);
     }
 }
Exemplo n.º 24
0
        public bool UpdateStatus(STK_InParam param)
        {
            bool flag = true;

            try
            {
                STK_InResult inResult = this.GetInfo(param);
                if (inResult != null)
                {
                    if (inResult.StkInLineList != null && inResult.StkInLineList.Count > 0)
                    {
                        //取消的明细需要排除
                        List <STK_InLineResult> lineList = inResult.StkInLineList;
                        if (lineList != null && lineList.Count > 0)
                        {
                            int?qty       = lineList.Where(a => a.Qty != null).Select(a => a.Qty).Sum();
                            int?stkOutQty = lineList.Where(a => a.StkOutQty != null).Select(a => a.StkOutQty).Sum();

                            if (stkOutQty == 0)
                            {
                                inResult.StkOutStatus = "待出库";
                            }
                            else if (stkOutQty >= qty)
                            {
                                inResult.StkOutStatus = "全部出库";
                            }
                            else
                            {
                                inResult.StkOutStatus = "部分出库";
                            }
                            this.AddOrUpdate(inResult);
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                flag = false;
                throw exp;
            }
            catch (System.Exception exp)
            {
                flag = false;
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(flag);
        }
Exemplo n.º 25
0
        public PageList <ORD_SalesOrderResult> GetSimplePageList(ORD_SalesOrderParam param, List <Field> fields)
        {
            PageList <ORD_SalesOrderResult> ret = new PageList <ORD_SalesOrderResult>();

            try
            {
                ret = this.SelectList <ORD_SalesOrderResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), fields, GetWhereClip(param), ORD_SalesOrder._.CreatedTime.Desc);
                if (ret.ResultList != null && ret.ResultList.Count > 0)
                {
                    HR_OrgBLL orgBLL = new HR_OrgBLL();
                    orgBLL.SessionInfo = this.SessionInfo;
                    HR_OrgParam orgParam = new HR_OrgParam();
                    orgParam.OrgIDs = ret.ResultList.Where(a => a.SalDeptID != null).Select(a => a.SalOrgID).Distinct().ToArray();
                    List <HR_OrgResult> orgList = orgBLL.GetOrgTree(orgParam);

                    HR_DepartmentBLL deptBLL = new HR_DepartmentBLL();
                    deptBLL.SessionInfo = this.SessionInfo;
                    HR_DepartmentParam deptParam = new HR_DepartmentParam();
                    deptParam.DeptIDs = ret.ResultList.Where(a => a.SalDeptID != null).Select(a => a.SalDeptID).Distinct().ToArray();
                    List <HR_DepartmentResult> deptList = deptBLL.GetDeptList(deptParam);



                    foreach (ORD_SalesOrderResult orderResult in ret.ResultList)
                    {
                        if (orderResult.SalOrgID != null)
                        {
                            orderResult.SalOrgName = orgList.FirstOrDefault(a => a.OrgID == orderResult.SalOrgID).OrgName;
                        }
                        if (orderResult.SalDeptID != null)
                        {
                            orderResult.SalDeptName = deptList.FirstOrDefault(a => a.DeptID == orderResult.SalDeptID).DeptName;
                        }
                        orderResult.AllStatus = orderResult.NotifyStatus + "->" + orderResult.PurchaseStatus + "->" + orderResult.StkInStatus + "->" + orderResult.StkOutStatus;
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 26
0
        public WCFAddUpdateResult UpdateOrInsertList(List <ORD_PurchaseReturnLineResult> list)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                #region 判断
                if (list.Count <= 0)
                {
                    throw new WarnException("没有需要操作的对象!");
                }
                #endregion
                foreach (ORD_PurchaseReturnLineResult lineResult in list)
                {
                    if (lineResult.PRLineGuid.ToGuid() != Guid.Empty)
                    {
                        lineResult.UpdatedEmpID   = this.SessionInfo.UserID;
                        lineResult.UpdatedEmpName = this.SessionInfo.UserName;
                        lineResult.UpdatedTime    = DateTime.Now;
                    }
                    else
                    {
                        lineResult.PRLineGuid     = Guid.NewGuid();
                        lineResult.CreatedEmpID   = this.SessionInfo.UserID;
                        lineResult.CreatedEmpName = this.SessionInfo.UserName;
                        lineResult.CreatedTime    = DateTime.Now;
                        lineResult.IsDeleted      = false;
                    }
                }
                int affect = 0;
                this.BatchInsertOrUpdate <ORD_PurchaseReturnLineResult>(list);
                affect = this.BatchExecute();
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Exemplo n.º 27
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param">条件实体</param>
        /// <returns></returns>
        public WF_AuditBillResult GetInfo(WF_AuditBillParam param)
        {
            WF_AuditBillResult rst = new WF_AuditBillResult();

            try
            {
                this.CheckSession();
                #region 判断
                if (param.WFAuditGuid == null &&
                    param.TableName.ToStringHasNull().Trim() == "")
                {
                    throw new WarnException("请指定获取审核单据的条件!");
                }
                #endregion
                #region 获取主单实体
                WhereClip where = WF_AuditBill._.GCompanyID == this.SessionInfo.CompanyID && WF_AuditBill._.IsDeleted == false && WF_AuditBill._.IsStop == false;
                if (param.WFAuditGuid != null)
                {
                    where = where && WF_AuditBill._.WFAuditGuid == param.WFAuditGuid;
                }
                if (param.TableName.ToStringHasNull().Trim() != "")
                {
                    where = where && WF_AuditBill._.TableName == param.TableName;
                }
                rst = this.Select <WF_AuditBillResult>(where);
                #endregion
                #region 获取明细实体
                if (rst != null && rst.WFAuditGuid != null)
                {
                    where = WF_AuditBillLine._.WFAuditGuid == rst.WFAuditGuid &&
                            WF_AuditBillLine._.GCompanyID == this.SessionInfo.CompanyID &&
                            WF_AuditBillLine._.IsDeleted == false;
                    List <WF_AuditBillLineResult> lineRst = new List <WF_AuditBillLineResult>();
                    lineRst = this.SelectList <WF_AuditBillLineResult>(where, WF_AuditBillLine._.StepNo.Asc);
                    rst.WF_AuditBillLineList = lineRst;
                }
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
            }
            return(rst);
        }
Exemplo n.º 28
0
        public bool UpdateStatus(ORD_SalesReturnParam param)
        {
            bool flag = true;

            try
            {
                ORD_SalesReturnResult orderResult = this.GetInfo(param);
                if (orderResult != null)
                {
                    if (orderResult.ReturnLineList != null && orderResult.ReturnLineList.Count > 0)
                    {
                        List <ORD_SalesReturnLineResult> lineList = orderResult.ReturnLineList;
                        if (lineList != null && lineList.Count > 0)
                        {
                            int?qty      = lineList.Where(a => a.Qty != null).Select(a => a.Qty).Sum();
                            int?stkInQty = lineList.Where(a => a.StkInQty != null).Select(a => a.StkInQty).Sum();
                            if (stkInQty == 0)
                            {
                                orderResult.StkInStatus = "待入库";
                            }
                            else if (stkInQty >= qty)
                            {
                                orderResult.StkInStatus = "全部入库";
                            }
                            else
                            {
                                orderResult.StkInStatus = "部分入库";
                            }
                            this.AddOrUpdate(orderResult);
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                flag = false;
                throw exp;
            }
            catch (System.Exception exp)
            {
                flag = false;
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(flag);
        }
Exemplo n.º 29
0
        /// <summary>
        /// 获取人员,部门,机构信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <HR_EmployeeResult> GetPageList(HR_EmployeeParam param)
        {
            this.CheckSession();
            PageList <HR_EmployeeResult> pagelist = new PageList <HR_EmployeeResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);
                if (!string.IsNullOrEmpty(param.DeptName))
                {
                    whereClip = whereClip && HR_Department._.DeptName.At("b") == param.DeptName;
                }
                if (!string.IsNullOrEmpty(param.OrgName))
                {
                    whereClip = whereClip && HR_Org._.OrgName.At("c") == param.OrgName;
                }

                List <Field> fiels = new List <Field>()
                {
                    HR_Employee._.EmpID,
                    HR_Employee._.EmpName,
                    HR_Employee._.EmpCode,
                    HR_Department._.DeptID.At("b"),
                    HR_Department._.DeptName.At("b"),
                    HR_Department._.DeptNo.At("b"),
                    HR_Org._.OrgID.At("c"),
                    HR_Org._.OrgNo.At("c"),
                    HR_Org._.OrgName.At("c")
                };
                WhereClip onWhereClip1 = HR_Employee._.DeptID == HR_Department._.DeptID.At("b");
                WhereClip onWhereClip2 = HR_Org._.OrgID.At("b") == HR_Department._.OrgID.At("c");
                pagelist = this.SelectList <HR_EmployeeResult, HR_Department, HR_Org>(JoinType.InnerJoin, onWhereClip1, JoinType.InnerJoin, onWhereClip2, param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(100), fiels, whereClip, HR_Employee._.EmpName.Asc, null, null);
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(pagelist);
        }
Exemplo n.º 30
0
        /// <summary>
        /// 批量修改和插入
        /// </summary>
        /// <param name="paramList"></param>
        /// <returns></returns>
        public WCFAddUpdateResult UpdateOrInsertList(List <STK_InOutLinkResult> list)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            try
            {
                #region 判断

                #endregion
                foreach (STK_InOutLinkResult linkResult in list)
                {
                    if (linkResult.StkLinkGuid.ToGuid() != Guid.Empty)
                    {
                        linkResult.UpdatedEmpID   = this.SessionInfo.UserID;
                        linkResult.UpdatedEmpName = this.SessionInfo.UserName;
                        linkResult.UpdatedTime    = DateTime.Now;
                    }
                    else
                    {
                        linkResult.CreatedEmpID   = this.SessionInfo.UserID;
                        linkResult.CreatedEmpName = this.SessionInfo.UserName;
                        linkResult.CreatedTime    = DateTime.Now;
                        linkResult.IsDeleted      = false;
                    }
                }
                int affect = 0;
                this.BatchInsertOrUpdate <STK_InOutLinkResult>(list);
                affect = this.BatchExecute();
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }