Beispiel #1
0
        public bool Abandon(int sysNumber, VirtualRequestStatus status, string companyCode)
        {
            var command = DataCommandManager.GetDataCommand("UpdateVirtualStatus");

            command.SetParameterValue("@SysNo", sysNumber);
            command.SetParameterValue("@Status", (int)status);
            command.SetParameterValue("@CompanyCode", "8601");//[Mark][Alan.X.Luo 硬编码]
            return(command.ExecuteNonQuery() > 0);
        }
Beispiel #2
0
        /// <summary>
        /// 审核 - 拒绝
        /// </summary>
        public virtual void RejectRequest(VirtualRequestInfo info)
        {
            VirtualRequestInfo oldInfo = ObjectFactory <IVirtualRequestDA> .Instance.GetVirtualRequestInfoBySysNo(info.SysNo.Value);

            if (oldInfo.RequestStatus != VirtualRequestStatus.Origin)
            {
                throw new BizException("该单据不是原始状态的单据,不能进行审核操作!");
            }
            oldInfo.AuditNote  = info.AuditNote;
            info.RequestStatus = VirtualRequestStatus.Rejected;
            using (TransactionScope scope = new TransactionScope())
            {
                ObjectFactory <IVirtualRequestDA> .Instance.CheckVirtualQty(oldInfo.VirtualProduct.SysNo, oldInfo.VirtualQuantity, oldInfo.Stock.SysNo.Value, oldInfo.CompanyCode);

                ObjectFactory <IVirtualRequestDA> .Instance.UpdateProductExtension((int)oldInfo.VirtualType, oldInfo.VirtualProduct.SysNo, info.CompanyCode);

                bool Verify = ObjectFactory <IVirtualRequestDA> .Instance.Verify(info);

                #region (2011年6月20日新需求)审核通过后关闭之前的虚库申请单据
                if (Verify && info.RequestStatus == VirtualRequestStatus.Approved)
                {
                    List <VirtualRequestInfo> applySysNumberList = ObjectFactory <IVirtualRequestDA> .Instance.ExistNeedCloseRequestByStockAndItem(oldInfo.Stock.SysNo.Value, oldInfo.VirtualProduct.SysNo, oldInfo.CompanyCode);

                    if (applySysNumberList != null && applySysNumberList.Count > 0)
                    {
                        int closeResult        = 0;
                        int IsAdjustVirtualQty = 1;//是否调整库存
                        foreach (VirtualRequestInfo item in applySysNumberList)
                        {
                            if (item.SysNo == info.SysNo)//除过前申请单外,其他申请单据 全部进行关闭。
                            {
                                continue;
                            }
                            VirtualRequestStatus currentStatus = item.RequestStatus;

                            if (currentStatus == VirtualRequestStatus.Running || currentStatus == VirtualRequestStatus.Closing)
                            {
                                IsAdjustVirtualQty = 1;//运行中或关闭中的单据需要调整库存
                            }
                            else if (currentStatus == VirtualRequestStatus.Origin || currentStatus == VirtualRequestStatus.Approved)
                            {
                                IsAdjustVirtualQty = 0;//待审核或已审核单据不需要调整库存
                            }
                            closeResult = ObjectFactory <IVirtualRequestDA> .Instance.CloseRequest(item.SysNo.Value, currentStatus, IsAdjustVirtualQty, info.CompanyCode);
                        }
                    }
                }
                #endregion
                scope.Complete();
            }
        }
Beispiel #3
0
        public int CloseRequest(int StVirtualRequestSysNo, VirtualRequestStatus Status, int IsAdjustVirtualQty, string CompanyCode)
        {
            var command = DataCommandManager.GetDataCommand("CloseRequest");

            command.SetParameterValue("@StVirtualRequestSysNo", StVirtualRequestSysNo);
            command.SetParameterValue("@Status", Status);
            command.SetParameterValue("@IsAdjustVirtualQty", IsAdjustVirtualQty);
            command.SetParameterValueAsCurrentUserAcct("@InUser");
            command.SetParameterValue("@CompanyCode", "8601");      //[Mark][Alan.X.Luo 硬编码]
            command.SetParameterValue("@StoreCompanyCode", "8601"); //[Mark][Alan.X.Luo 硬编码]
            command.SetParameterValue("@LanguageCode", Thread.CurrentThread.CurrentCulture.Name);
            command.ExecuteNonQuery();
            object result = command.GetParameterValue("@ReturnValue");

            return(result == null ? 0 : Convert.ToInt32(result));
        }
Beispiel #4
0
        /// <summary>
        /// 审核  - 同意
        /// </summary>
        public virtual void ApproveRequest(VirtualRequestInfo info)
        {
            VirtualRequestInfo oldInfo = ObjectFactory <IVirtualRequestDA> .Instance.GetVirtualRequestInfoBySysNo(info.SysNo.Value);

            if (oldInfo.RequestStatus != VirtualRequestStatus.Origin)
            {
                throw new BizException("该单据不是原始状态的单据,不能进行审核操作!");
            }

            //if (oldInfo.CreateUser.SysNo == ServiceContext.Current.UserSysNo)
            //{
            //    throw new BizException("创建人和审核人不能相同");
            //}

            oldInfo.AuditNote  = info.AuditNote;
            info.RequestStatus = VirtualRequestStatus.Approved;
            using (TransactionScope scope = new TransactionScope())
            {
                int checkVirtualResult = ObjectFactory <IVirtualRequestDA> .Instance.CheckVirtualQty(oldInfo.VirtualProduct.SysNo, oldInfo.VirtualQuantity, oldInfo.Stock.SysNo.Value, oldInfo.CompanyCode);

                switch (checkVirtualResult)
                {
                case 1:
                    throw new BizException("审核失败!调整可用库存后不能使可卖数量变为负数,可卖数量=可用库存+虚拟库存+代销库存.");

                case 2:
                    throw new BizException("审核失败!该类商品中的混合型商品(即有可用库存又有虚拟库存)种类在该类所有商品种类中的比例已经超过限制.");

                case 3:
                    throw new BizException("审核失败!该类商品中的纯虚拟库存商品种类数量已经超过限制.");

                default:
                    break;
                }

                ObjectFactory <IVirtualRequestDA> .Instance.UpdateProductExtension((int)oldInfo.VirtualType, oldInfo.VirtualProduct.SysNo, info.CompanyCode);

                bool Verify = ObjectFactory <IVirtualRequestDA> .Instance.Verify(info);

                #region (2011年6月20日新需求)审核通过后关闭之前的虚库申请单据
                if (Verify && info.RequestStatus == VirtualRequestStatus.Approved)
                {
                    List <VirtualRequestInfo> applySysNumberList = ObjectFactory <IVirtualRequestDA> .Instance.ExistNeedCloseRequestByStockAndItem(oldInfo.Stock.SysNo.Value, oldInfo.VirtualProduct.SysNo, oldInfo.CompanyCode);

                    if (applySysNumberList != null && applySysNumberList.Count > 0)
                    {
                        int closeResult        = 0;
                        int IsAdjustVirtualQty = 1;//是否调整库存
                        foreach (VirtualRequestInfo item in applySysNumberList)
                        {
                            if (item.SysNo == info.SysNo)//除过前申请单外,其他申请单据 全部进行关闭。
                            {
                                continue;
                            }
                            VirtualRequestStatus currentStatus = item.RequestStatus;

                            if (currentStatus == VirtualRequestStatus.Running || currentStatus == VirtualRequestStatus.Closing)
                            {
                                IsAdjustVirtualQty = 1;//运行中或关闭中的单据需要调整库存
                            }
                            else if (currentStatus == VirtualRequestStatus.Origin || currentStatus == VirtualRequestStatus.Approved)
                            {
                                IsAdjustVirtualQty = 0;//待审核或已审核单据不需要调整库存
                            }
                            closeResult = ObjectFactory <IVirtualRequestDA> .Instance.CloseRequest(item.SysNo.Value, currentStatus, IsAdjustVirtualQty, info.CompanyCode);
                        }
                    }
                }
                #endregion
                scope.Complete();
            }
        }