Esempio n. 1
0
        public override IModel CreateModel(SqlDataReader dr)
        {
            StockName stockname = new StockName();

            int indexStockNameId = dr.GetOrdinal("StockNameId");
            stockname.StockNameId = Convert.ToInt32(dr[indexStockNameId]);

            int indexRefNo = dr.GetOrdinal("RefNo");
            if (dr["RefNo"] != DBNull.Value)
            {
                stockname.RefNo = Convert.ToString(dr[indexRefNo]);
            }

            return stockname;
        }
Esempio n. 2
0
        //public string stockJson = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            UserModel user = UserUtility.CurrentUser;
            ResultModel result = new ResultModel();
            string redirectUrl = string.Format("{0}WareHouse/PreToRealList.aspx", DefaultValue.NftmSiteName);

            this.hidBDStyleId.Value = ((int)StyleEnum.报关状态).ToString();

            if (!IsPostBack)
            {
                VerificationUtility ver = new VerificationUtility();
                ver.JudgeOperate(this.Page, 129, new List<OperateEnum>() { OperateEnum.录入 });

                this.navigation1.Routes.Add("预入库转正式库存列表", redirectUrl);
                this.navigation1.Routes.Add("预入库转正式库存新增", string.Empty);

                int stockId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out stockId) || stockId <= 0)
                    Response.Redirect(redirectUrl);

                StockBLL stockBLL = new StockBLL();
                result = stockBLL.Get(user, stockId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                stock = result.ReturnValue as Stock;
                if (stock == null)
                    Response.Redirect(redirectUrl);

                StockNameBLL stockNameBLL = new StockNameBLL();
                result = stockNameBLL.Get(user, stock.StockNameId);
                if (result.ResultStatus != 0)
                    Response.Redirect(redirectUrl);

                stockName = result.ReturnValue as StockName;
                if (stockName == null)
                    Response.Redirect(redirectUrl);

                //this.spStockStatus.InnerText = ((NFMT.WareHouse.StockStatusEnum)stock.StockStatus).ToString();

                //System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                //this.stockJson = serializer.Serialize(stock);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 数据撤返
        /// </summary>
        /// <param name="user">当前操作用户</param>
        /// <param name="pledge">Pledge对象</param>
        /// <returns></returns>
        public ResultModel GoBack(UserModel user, int pledgeId)
        {
            ResultModel result = new ResultModel();

            try
            {
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    result = this.Get(user, pledgeId);
                    if (result.ResultStatus != 0)
                        return result;
                    Model.Pledge pledge = result.ReturnValue as Pledge;

                    if (pledge == null)
                    {
                        result.ResultStatus = -1;
                        result.Message = "该数据不存在,不能撤返";
                        return result;
                    }

                    if (pledge.Status != StatusEnum.待审核 && pledge.Status != StatusEnum.已生效)
                    {
                        result.ResultStatus = -1;
                        result.Message = "非待审核或已生效状态的数据不允许撤返";
                        return result;
                    }

                    //获取质押申请实体
                    DAL.PledgeApplyDAL pledgeApplyDAL = new PledgeApplyDAL();
                    result = pledgeApplyDAL.Get(user, pledge.PledgeApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    Model.PledgeApply pledgeApply = result.ReturnValue as Model.PledgeApply;

                    //获取申请实体
                    NFMT.Operate.DAL.ApplyDAL applyDAl = new Operate.DAL.ApplyDAL();
                    result = applyDAl.Get(user, pledgeApply.ApplyId);
                    if (result.ResultStatus != 0)
                        return result;

                    NFMT.Operate.Model.Apply apply = result.ReturnValue as NFMT.Operate.Model.Apply;
                    if (apply.Status == Common.StatusEnum.已关闭 || apply.Status == Common.StatusEnum.已完成)
                    {
                        result.ResultStatus = -1;
                        result.Message = "质押对应的申请已完成或已关闭,不能进行撤返操作";
                        return result;
                    }

                    result = pledgeDAL.Goback(user, pledge);
                    if (result.ResultStatus != 0)
                        return result;

                    if (pledge.Status == StatusEnum.待审核)
                    {
                        //同步工作流状态
                        NFMT.WorkFlow.BLL.DataSourceBLL dataSourceBLL = new WorkFlow.BLL.DataSourceBLL();
                        result = dataSourceBLL.SynchronousStatus(user, pledge);
                        if (result.ResultStatus != 0)
                            return result;
                    }

                    NFMT.WareHouse.DAL.PledgeDetialDAL pledgeDetialDAL = new DAL.PledgeDetialDAL();
                    result = pledgeDetialDAL.GetStockId(user, pledgeId);
                    if (result.ResultStatus != 0)
                        return result;

                    if (!string.IsNullOrEmpty(result.ReturnValue.ToString()))
                    {
                        NFMT.WareHouse.DAL.StockDAL stockDAL = new StockDAL();
                        NFMT.WareHouse.DAL.StockNameDAL stockNameDAL = new StockNameDAL();
                        NFMT.WareHouse.DAL.StockLogDAL stockLogDAL = new StockLogDAL();

                        NFMT.WareHouse.Model.StockName stockName = new StockName();
                        NFMT.WareHouse.Model.Stock stock = new Stock();
                        NFMT.WareHouse.Model.StockLog stockLog = new StockLog();

                        foreach (string s in result.ReturnValue.ToString().Split(','))
                        {
                            result = stockDAL.Get(user, Convert.ToInt32(s));
                            if (result.ResultStatus != 0)
                                return result;
                            stock = result.ReturnValue as Model.Stock;

                            result = stockNameDAL.Get(user, stock.StockNameId);
                            if (result.ResultStatus != 0)
                                return result;
                            stockName = result.ReturnValue as Model.StockName;

                            ////创建stockLog对象
                            //stockLog = new StockLog()
                            //{
                            //    StockId = stock.StockId,
                            //    StockNameId = stock.StockNameId,
                            //    RefNo = stockName.RefNo,
                            //    //LogDirection =
                            //    LogType = LogEnum.质押冲销,
                            //    //ContractId = ,
                            //    //SubContractId = ,
                            //    LogDate = DateTime.Now,
                            //    OpPerson = user.EmpId,
                            //    Bundles = stock.Bundles,
                            //    GrossAmount = stock.GrossAmount,
                            //    NetAmount = stock.NetAmount,
                            //    MUId = stock.UintId,
                            //    BrandId = stock.BrandId,
                            //    DeliverPlaceId = stock.DeliverPlaceId,
                            //    PaperNo = stock.PaperNo,
                            //    PaperHolder = stock.PaperHolder,
                            //    CardNo = stock.CardNo,
                            //    Memo = stock.Memo,
                            //    LogStatus = StatusEnum.已生效,
                            //    LogSourceBase = "NFMT",
                            //    LogSource = "dbo.St_Pledge",
                            //    SourceId = pledgeId
                            //};

                            //result = stockLogDAL.Insert(user, stockLog);
                            //if (result.ResultStatus != 0)
                            //    return result;

                            result = stockDAL.UpdateStockStatusToPrevious(user, stock);
                            if (result.ResultStatus != 0)
                                return result;
                        }

                        scope.Complete();
                    }
                }
            }
            catch (Exception ex)
            {
                result.Message = ex.Message;
            }
            finally
            {
                if (result.ResultStatus != 0)
                    log.ErrorFormat("{0} {1},类型序号:{2}", user.EmpName, result.Message, result.ReturnValue);
                else if (log.IsInfoEnabled)
                    log.InfoFormat("{0} {1},类型序号:{2}", user.EmpName, result.Message, result.ReturnValue);
            }

            return result;
        }