Beispiel #1
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(ORD_SalesOrderParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.SOGuid == null)
                {
                    throw new WarnException("请指定要删除的销售单ID!");
                }
                #endregion
                WhereClip            whereClip = GetWhereClip(param);
                ORD_SalesOrderResult info      = new ORD_SalesOrderResult();
                info.IsDeleted = true;
                affect         = this.Update <ORD_SalesOrderResult>(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);
        }
Beispiel #2
0
 /// <summary>
 /// 分页集合
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 public PageList <ORD_SalesOrderResult> GetPageList(ORD_SalesOrderParam param)
 {
     this.CheckSession();
     return(GetSimplePageList(param, new List <Field> {
         Field.All
     }));
 }
Beispiel #3
0
        public bool AuditSalesOrderBill(ORD_SalesOrderParam param)
        {
            bool      ret = true;
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesOrderBLL", "AuditSalesOrderBill", param);
            ret = (rst == null ? false : (bool)rst.Result);
            return(ret);
        }
Beispiel #4
0
        public WCFAddUpdateResult DelInfo(ORD_SalesOrderParam param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            ExeResult          rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesOrderBLL", "DelInfo", param);
            ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult);
            return(ret);
        }
Beispiel #5
0
        public ORD_SalesOrderResult GetInfo(ORD_SalesOrderParam param)
        {
            ORD_SalesOrderResult ret = new ORD_SalesOrderResult();
            ExeResult            rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesOrderBLL", "GetInfo", param);
            ret = rst == null ? new ORD_SalesOrderResult() : rst.Result as ORD_SalesOrderResult;
            return(ret);
        }
Beispiel #6
0
        public PageList <ORD_SalesOrderResult> GetPageList(ORD_SalesOrderParam param)
        {
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.SPM.ORD_SalesOrderBLL", "GetPageList", param);
            PageList <ORD_SalesOrderResult> pageList = new PageList <ORD_SalesOrderResult>();

            pageList = (rst == null ? new PageList <ORD_SalesOrderResult>() : rst.Result as PageList <ORD_SalesOrderResult>);
            return(pageList);
        }
Beispiel #7
0
        private void BindDataGridView(int pageIndex)
        {
            ORD_SalesOrderParam param = new ORD_SalesOrderParam();

            param.BillNo    = txtBillNo.Text;
            param.PageIndex = pageIndex;
            param.PageSize  = 100;
            PageList <ORD_SalesOrderResult> pageList = this.AsyncExecute <PageList <ORD_SalesOrderResult>, ORD_SalesOrderParam>(param, orderLogic.GetPageList, a =>
            {
                dgvSalesOrder.DataSource = a.ResultList;
                pgSalesOrder.RecordCount = a.TotalCount;
            });
        }
Beispiel #8
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);
        }
Beispiel #9
0
        private void BindDataGridView(int pageIndex)
        {
            ORD_SalesOrderParam param = new ORD_SalesOrderParam();

            param.PageIndex  = pageIndex;
            param.PageSize   = 100;
            param.CustomerID = CustomerID;
            param.BillNo     = txtBillNo.Text.Trim();
            PageList <ORD_SalesOrderResult> lstRst = orderLogic.GetPageList(param);

            dgvSalesOrder.DataSource = lstRst.ResultList;
            pgSalesOrder.RecordCount = lstRst.TotalCount;
            this.SetDataSource <ORD_SalesOrderResult>(lstRst.ResultList);
            SetGridCheck(this.dgvSalesOrder, _idColName, _chkColName);
        }
Beispiel #10
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);
        }
Beispiel #11
0
 /// <summary>
 /// 查询条件
 /// </summary>
 /// <param name="param"></param>
 /// <returns></returns>
 WhereClip GetWhereClip(ORD_SalesOrderParam param)
 {
     this.CheckSession();
     WhereClip where = ORD_SalesOrder._.IsDeleted == 0;
     if (param.SOID > 0)
     {
         where = where && ORD_SalesOrder._.SOID == param.SOID;
     }
     if (param.SOGuid != null)
     {
         where = where && ORD_SalesOrder._.SOGuid == param.SOGuid;
     }
     if (!string.IsNullOrEmpty(param.BillNo))
     {
         where = where && ORD_SalesOrder._.BillNo.Like("%" + param.BillNo + "%");
     }
     if (!string.IsNullOrEmpty(param.BillType))
     {
         where = where && ORD_SalesOrder._.BillType.Like("%" + param.BillType + "%");
     }
     if (param.CompanyID != null)
     {
         where = where && ORD_SalesOrder._.CustomerID == param.CustomerID;
     }
     if (!string.IsNullOrEmpty(param.CustomerName))
     {
         where = where && ORD_SalesOrder._.CustomerName.Like("%" + param.CustomerName + "%");
     }
     if (!string.IsNullOrEmpty(param.Contact))
     {
         where = where && ORD_SalesOrder._.Contact.Like("%" + param.Contact + "%");
     }
     if (!string.IsNullOrEmpty(param.ClearingForm))
     {
         where = where && ORD_SalesOrder._.ClearingForm.Like("%" + param.ClearingForm + "%");
     }
     if (!string.IsNullOrEmpty(param.SalerName))
     {
         where = where && ORD_SalesOrder._.SalerName.Like("%" + param.SalerName + "%");
     }
     return(where);
 }
Beispiel #12
0
        private void tsbDel_Click(object sender, EventArgs e)
        {
            ORD_SalesOrderParam param = new ORD_SalesOrderParam();

            param.SOID = soid;

            ORD_SalesOrderResult rst = orderLogic.GetInfo(param);

            if (rst != null)
            {
                if (MessageBox.Show("请确认是否要删除销售单:【" + rst.BillNo + "】", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, ORD_SalesOrderParam>(param, orderLogic.DelInfo, a => { BindDataGridView(pgSalesOrder.PageIndex); });
                }
            }
            else
            {
                this.ShowMessage("请选择需要删除的销售明细!");
            }
        }
Beispiel #13
0
        /// <summary>
        /// 获取集合
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List <ORD_SalesOrderResult> GetList(ORD_SalesOrderParam param)
        {
            this.CheckSession();
            List <ORD_SalesOrderResult> ret = new List <ORD_SalesOrderResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);
                ret = this.SelectList <ORD_SalesOrderResult>(whereClip, ORD_SalesOrder._.CreatedTime.Desc);
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Beispiel #14
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ORD_SalesOrderResult GetInfo(ORD_SalesOrderParam param)
        {
            this.CheckSession();
            ORD_SalesOrderResult rst = new ORD_SalesOrderResult();

            #region 判断
            if (param.SOGuid == null)
            {
                throw new WarnException("请指定销售单GUID!");
            }
            #endregion
            #region 获取实体

            rst = this.Select <ORD_SalesOrderResult>(GetWhereClip(param));
            if (rst != null)
            {
                string[] statusArr = new string[] { rst.NotifyStatus, rst.PurchaseStatus, rst.StkTakeStatus,
                                                    rst.StkInStatus, rst.StkOutStatus, rst.ShipmentStatus, rst.ReturnStatus, rst.ReceivableStatus };
                rst.AllStatus = string.Join(",", statusArr);

                ORD_SalesOrderLineBLL lineBLL = new ORD_SalesOrderLineBLL();
                lineBLL.SessionInfo = this.SessionInfo;
                rst.OrderLineList   = lineBLL.GetList(new ORD_SalesOrderLineParam()
                {
                    SOGuid = rst.SOGuid
                });
                //this.SelectList<ORD_SalesOrderLineResult>(ORD_SalesOrderLine._.SOGuid == rst.SOGuid);

                HR_DepartmentBLL deptBLL = new HR_DepartmentBLL();
                deptBLL.SessionInfo = this.SessionInfo;
                HR_DepartmentResult deptResult = deptBLL.GetInfo(new HR_DepartmentParam()
                {
                    DeptID = rst.SalDeptID
                });
                rst.SalDeptName = deptResult.DeptName;
            }
            #endregion
            return(rst);
        }
Beispiel #15
0
        public PageList <ORD_PurchaseNoticeResult> GetPageList(ORD_PurchaseNoticeParam param)
        {
            PageList <ORD_PurchaseNoticeResult> ret = new PageList <ORD_PurchaseNoticeResult>();

            try
            {
                ORD_SalesOrderBLL orderBLL = new ORD_SalesOrderBLL();
                orderBLL.SessionInfo = this.SessionInfo;
                ORD_SalesOrderParam orderParam = new ORD_SalesOrderParam()
                {
                    BillNo    = param.SOBillNo,
                    SalerName = param.SalerName,
                    PageIndex = 1,
                    PageSize  = 5000
                };

                PageList <ORD_SalesOrderResult> orderList = orderBLL.GetPageList(orderParam);
                if (orderList.ResultList != null && orderList.ResultList.Count > 0)
                {
                    Guid?[] SOGuids = orderList.ResultList.Select(a => a.SOGuid).Distinct().ToArray();
                    ORD_SalesOrderLineBLL lineBLL = new ORD_SalesOrderLineBLL();
                    lineBLL.SessionInfo = this.SessionInfo;
                    ORD_SalesOrderLineParam lineParam = new ORD_SalesOrderLineParam()
                    {
                        Model      = param.Model,
                        SOLineCode = param.SOLineCode,
                        SOGuids    = SOGuids,
                        PageIndex  = 1,
                        PageSize   = 5000,
                        IsCancel   = false
                    };
                    PageList <ORD_SalesOrderLineResult> lineList = lineBLL.GetPageList(lineParam);
                    if (lineList.ResultList != null && lineList.ResultList.Count > 0)
                    {
                        Guid?[] SOLineGuIds = lineList.ResultList.Select(a => (Guid?)a.SOLineGuid).Distinct().ToArray();
                        param.SOLineGuids = SOLineGuIds;
                        ret = this.SelectList <ORD_PurchaseNoticeResult>(param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), new List <Field>()
                        {
                            Field.All
                        }, GetWhereClip(param), ORD_PurchaseNotice._.CreatedTime.Desc);
                        foreach (ORD_PurchaseNoticeResult noticeResult in ret.ResultList)
                        {
                            ORD_SalesOrderResult orderResult = orderList.ResultList.FirstOrDefault(a => a.SOGuid == noticeResult.SOGuid);
                            if (orderResult != null)
                            {
                                noticeResult.SOBillNo     = orderResult.BillNo;
                                noticeResult.SalerName    = orderResult.SalerName;
                                noticeResult.SaleCurrency = orderResult.Currency;
                            }
                            ORD_SalesOrderLineResult lineResult = lineList.ResultList.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;
                            }
                            if (noticeResult.PurchaseQty.ToInt32() == 0)
                            {
                                noticeResult.PurStatus = "未采购";
                            }
                            else if (noticeResult.NoticeQty.ToInt32() <= noticeResult.PurchaseQty.ToInt32())
                            {
                                noticeResult.PurStatus = "采购完成";
                            }
                            else
                            {
                                noticeResult.PurStatus = "部分采购";
                            }
                        }
                    }
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
Beispiel #16
0
        public bool SubmitSalesOrderBill(ORD_SalesOrderParam param)
        {
            this.CheckSession();
            bool submitFlag = true;

            try
            {
                ORD_SalesOrderResult 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;
                        }
                        else
                        {
                            //STK_InLineBLL inLineBLL=new STK_InLineBLL ();
                            //inLineBLL.SessionInfo=this.SessionInfo;
                            //List<ORD_SalesOrderLineResult> salesOrderLineList = orderResult.OrderLineList;
                            //if(salesOrderLineList!=null && salesOrderLineList.Count>0 && orderResult.BillType=="现货单")
                            //{
                            //    Guid?[] _ItemCodes=salesOrderLineList.Where(a=>a.ItemCode!=null).Select(a=>a.ItemCode).Distinct().ToArray();
                            //    List<STK_InLineResult> inLineResultList = inLineBLL.GetList(new STK_InLineParam() { ItemCodes = _ItemCodes });
                            //    #region 预留库存
                            //    foreach (ORD_SalesOrderLineResult orderLineResult in salesOrderLineList)
                            //    {
                            //        if (orderLineResult.ItemCode != null)
                            //        {

                            //        }

                            //    }
                            //    #endregion
                            //}
                        }
                    }


                    #endregion
                }
                else
                {
                    throw new WarnException("要提交的销售单在系统中不存在!");
                }
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(submitFlag);
        }
Beispiel #17
0
        public bool UpdateStatus(ORD_SalesOrderParam param)
        {
            bool flag = true;

            try
            {
                ORD_SalesOrderResult orderResult = this.GetInfo(param);
                if (orderResult != null)
                {
                    if (orderResult.OrderLineList != null && orderResult.OrderLineList.Count > 0)
                    {
                        //取消的明细需要排除
                        List <ORD_SalesOrderLineResult> lineList = orderResult.OrderLineList.Where(a => a.IsCancel == false).ToList();
                        if (lineList != null && lineList.Count > 0)
                        {
                            int?qty          = lineList.Where(a => a.Qty != null).Select(a => a.Qty).Sum();
                            int?notifyQty    = lineList.Where(a => a.NotifyQty != null).Select(a => a.NotifyQty).Sum();
                            int?purchaseQty  = lineList.Where(a => a.PurchaseQty != null).Select(a => a.PurchaseQty).Sum();
                            int?stkInQty     = lineList.Where(a => a.StkInQty != null).Select(a => a.StkInQty).Sum();
                            int?stkOutOccQty = lineList.Where(a => a.StkOutOccQty != null).Select(a => a.StkOutOccQty).Sum();
                            int?stkOutQty    = lineList.Where(a => a.StkOutQty != null).Select(a => a.StkOutQty).Sum();
                            int?returnOccQty = lineList.Where(a => a.ReturnOccQty != null).Select(a => a.ReturnOccQty).Sum();
                            int?returnQty    = lineList.Where(a => a.ReturnQty != null).Select(a => a.ReturnQty).Sum();
                            if (notifyQty == 0)
                            {
                                orderResult.NotifyStatus = "待通知";
                            }
                            else if (notifyQty >= qty)
                            {
                                orderResult.NotifyStatus = "全部通知";
                            }
                            else
                            {
                                orderResult.NotifyStatus = "部分通知";
                            }
                            if (purchaseQty == 0)
                            {
                                orderResult.PurchaseStatus = "待采购";
                            }
                            else if (purchaseQty >= qty)
                            {
                                orderResult.PurchaseStatus = "全部采购";
                            }
                            else
                            {
                                orderResult.PurchaseStatus = "部分采购";
                            }
                            if (stkInQty == 0)
                            {
                                orderResult.StkInStatus = "待入库";
                            }
                            else if (stkInQty >= qty)
                            {
                                orderResult.StkInStatus = "全部入库";
                            }
                            else
                            {
                                orderResult.StkInStatus = "部分入库";
                            }
                            if (stkOutOccQty == 0)
                            {
                                orderResult.StkOutOccStatus = "待占有";
                            }
                            else if (stkOutOccQty >= qty)
                            {
                                orderResult.StkOutOccStatus = "全部占有";
                            }
                            else
                            {
                                orderResult.StkOutOccStatus = " 部分占有";
                            }
                            if (stkOutQty == 0)
                            {
                                orderResult.StkOutStatus = "待出库";
                            }
                            else if (stkOutQty >= qty)
                            {
                                orderResult.StkOutStatus = "全部出库";
                            }
                            else
                            {
                                orderResult.StkOutStatus = " 部分出库";
                            }
                            if (returnOccQty == 0)
                            {
                                orderResult.ReturnOccStatus = "待占有";
                            }
                            else if (returnOccQty >= qty)
                            {
                                orderResult.ReturnOccStatus = "全部占有";
                            }
                            else
                            {
                                orderResult.ReturnOccStatus = " 部分占有";
                            }
                            if (returnQty == 0)
                            {
                                orderResult.ReturnStatus = "待退货";
                            }
                            else if (returnQty >= qty)
                            {
                                orderResult.ReturnStatus = "全部退货";
                            }
                            else
                            {
                                orderResult.ReturnStatus = " 部分退货";
                            }
                            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);
        }