示例#1
0
        private void btnNotice_Click(object sender, EventArgs e)
        {
            GridPanel panel = usgNoNoticed.PrimaryGrid;
            List <ORD_PurchaseNoticeResult> noticeList   = new List <ORD_PurchaseNoticeResult>();
            ORD_PurchaseNoticeResult        noticeResult = null;

            foreach (GridRow row in panel.Rows)
            {
                if (row.Cells["colCurrentQty"].Value.ToInt32() > 0)
                {
                    noticeResult            = new ORD_PurchaseNoticeResult();
                    noticeResult.SOGuid     = SOGuid;
                    noticeResult.SOLineGuid = row.Cells["colSOLineGuid"].Value.ToGuid();
                    noticeResult.NoticeQty  = row.Cells["colCurrentQty"].Value.ToInt32();
                    noticeResult.BuyerID    = row.Cells["colBuyer"].Value.ToInt32();
                    noticeResult.BuyerName  = empList.FirstOrDefault(a => a.EmpID == noticeResult.BuyerID).EmpName;
                    noticeResult.Demands    = row.Cells["colDemands"].Value.ToStringHasNull();
                    noticeList.Add(noticeResult);
                }
            }
            if (noticeList != null && noticeList.Count > 0)
            {
                WCFAddUpdateResult result = this.AsyncExecute <WCFAddUpdateResult, List <ORD_PurchaseNoticeResult> >(noticeList, noticeLogic.UpdateOrInsertList, (a) =>
                {
                    if (a.Key > 0)
                    {
                        BindSuperGrid();
                        if (RefreshParentForm != null)
                        {
                            RefreshParentForm();
                        }
                    }
                });
            }
        }
示例#2
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(ORD_PurchaseNoticeParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.NoticeGuid == null)
                {
                    throw new WarnException("请指定GUID!");
                }
                #endregion
                WhereClip whereClip           = GetWhereClip(param);
                ORD_PurchaseNoticeResult info = new ORD_PurchaseNoticeResult();
                info.IsDeleted = true;
                affect         = this.Update <ORD_PurchaseNoticeResult>(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);
        }
示例#3
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);
        }
示例#4
0
        public ORD_PurchaseNoticeResult GetInfo(ORD_PurchaseNoticeParam param)
        {
            ORD_PurchaseNoticeResult ret = new ORD_PurchaseNoticeResult();
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.SPM.ORD_PurchaseNoticeBLL", "GetInfo", param);
            ret = rst == null ? new ORD_PurchaseNoticeResult() : rst.Result as ORD_PurchaseNoticeResult;
            return(ret);
        }
示例#5
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ORD_PurchaseOrderResult GetInfo(ORD_PurchaseOrderParam param)
        {
            this.CheckSession();
            ORD_PurchaseOrderResult rst = new ORD_PurchaseOrderResult();

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

            rst = this.Select <ORD_PurchaseOrderResult>(GetWhereClip(param));
            if (rst != null)
            {
                string[] statusArr = new string[] { rst.StkInStatus, rst.StkOutStatus, rst.ReturnStatus, rst.PaymentStatus };
                rst.AllStatus = string.Join(",", statusArr);
                ORD_PurchaseOrderLineBLL lineBLL = new ORD_PurchaseOrderLineBLL();
                lineBLL.SessionInfo = this.SessionInfo;
                rst.OrderLineList   = lineBLL.GetList(new ORD_PurchaseOrderLineParam()
                {
                    POGuid = rst.POGuid
                });
                Guid?[] NoticeGuids             = rst.OrderLineList.Where(a => a.NoticeGuid != null).Select(a => a.NoticeGuid).Distinct().ToArray();
                ORD_PurchaseNoticeBLL noticeBLl = new ORD_PurchaseNoticeBLL();
                noticeBLl.SessionInfo = this.SessionInfo;
                ORD_PurchaseNoticeParam noticeParam = new ORD_PurchaseNoticeParam();
                noticeParam.NoticeGuids = NoticeGuids;
                List <ORD_PurchaseNoticeResult> noticeList = noticeBLl.GetList(noticeParam);

                foreach (ORD_PurchaseOrderLineResult lineResult in rst.OrderLineList)
                {
                    ORD_PurchaseNoticeResult noticeResult = noticeList.FirstOrDefault(a => a.NoticeGuid == lineResult.NoticeGuid);
                    if (noticeResult != null)
                    {
                        lineResult.SOLineCode         = noticeResult.SOLineCode;
                        lineResult.SOModel            = noticeResult.Model;
                        lineResult.SOBrand            = noticeResult.Brand;
                        lineResult.SOBatch            = noticeResult.Batch;
                        lineResult.SOPackage          = noticeResult.Package;
                        lineResult.SOQty              = noticeResult.SaleQty;
                        lineResult.SONeedDeliveryDate = noticeResult.NeedDeliveryDate;
                    }
                }
                rst.HR_DepartmentResult = this.Select <HR_DepartmentResult>(new List <Field>()
                {
                    HR_Department._.DeptID, HR_Department._.DeptName
                }, HR_Department._.DeptID == rst.PurDeptID);
            }



            #endregion
            return(rst);
        }
示例#6
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public ORD_PurchaseNoticeResult GetInfo(ORD_PurchaseNoticeParam param)
        {
            this.CheckSession();
            ORD_PurchaseNoticeResult rst = new ORD_PurchaseNoticeResult();

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

            rst = this.Select <ORD_PurchaseNoticeResult>(GetWhereClip(param));

            #endregion
            return(rst);
        }
示例#7
0
 public void SetOrderLineObjectValue(ORD_PurchaseOrderLineResult purLineRst, ORD_PurchaseNoticeResult noticeResult)
 {
     purLineRst.SOGuid             = noticeResult.SOGuid;
     purLineRst.SOBillNo           = noticeResult.SOBillNo;
     purLineRst.SOLineGuid         = noticeResult.SOLineGuid;
     purLineRst.SOLineCode         = noticeResult.SOLineCode;
     purLineRst.SOModel            = noticeResult.Model;
     purLineRst.SOBrand            = noticeResult.Brand;
     purLineRst.SOBatch            = noticeResult.Batch;
     purLineRst.SOPackage          = noticeResult.Package;
     purLineRst.SOQty              = noticeResult.SaleQty;
     purLineRst.SONeedDeliveryDate = noticeResult.NeedDeliveryDate;
     purLineRst.NoticeGuid         = noticeResult.NoticeGuid;
     purLineRst.Model              = noticeResult.Model;
     purLineRst.Brand              = noticeResult.Brand;
     purLineRst.Package            = noticeResult.Package;
     purLineRst.Batch              = noticeResult.Batch;
     purLineRst.InvType            = string.IsNullOrEmpty(noticeResult.InvType) ? "补货库存" : noticeResult.InvType;
     purLineRst.Unit             = noticeResult.Unit;
     purLineRst.Qty              = noticeResult.NoticeQty.ToInt32() - noticeResult.PurchaseQty.ToInt32();
     purLineRst.Amount           = purLineRst.UnitPrice * purLineRst.Qty;
     purLineRst.NeedDeliveryDate = string.IsNullOrEmpty(txtNeedDeliveryDate.Text) ? null : (DateTime?)txtNeedDeliveryDate.Value;
     purLineRst.NeedPayAmtDate   = string.IsNullOrEmpty(txtNeedPayAmtDate.Text) ? null : (DateTime?)txtNeedPayAmtDate.Value;
 }