Пример #1
0
        /// <summary>
        /// 下一步骤可使用的订单行状态
        /// </summary>
        /// <param name="currentState"></param>
        /// <returns></returns>
        public static List <EnumOrderDataState> CanUseNextStepOrderDataStateList(EnumOrderDataState currentState)
        {
            List <EnumOrderDataState> allNextStateList = new List <EnumOrderDataState>();

            switch (currentState)
            {
            case EnumOrderDataState.VLSTS_New:
                allNextStateList.Add(EnumOrderDataState.VLSTS_Ready);
                break;

            case EnumOrderDataState.VLSTS_Ready:
                allNextStateList.Add(EnumOrderDataState.VLSTS_Released);
                break;

            case EnumOrderDataState.VLSTS_Released:
                allNextStateList.Add(EnumOrderDataState.VLSTS_Completed);
                allNextStateList.Add(EnumOrderDataState.VLSTS_Cancel);
                break;

            case EnumOrderDataState.VLSTS_Cancel:
            case EnumOrderDataState.VLSTS_Completed:
                // 没有后续状态
                break;

            default:
                throw new Exception("未知状态" + currentState.ToString());
            }

            return(allNextStateList);
        }
Пример #2
0
        /// <summary>
        /// 根据单据头的状态得到可用于更新单据行的状态
        /// </summary>
        /// <param name="currentState">当前状态</param>
        /// <returns></returns>
        public static EnumOrderDataState GetOrderDataStateByOrderFormState(EnumOrderFormState currentState)
        {
            // 默认为无需状态更新的值
            EnumOrderDataState state = EnumOrderDataState.None;

            switch (currentState)
            {
            case EnumOrderFormState.VHSTS_New:
                state = EnumOrderDataState.VLSTS_New;
                break;

            case EnumOrderFormState.VHSTS_Submit:
            case EnumOrderFormState.VHSTS_Ready:
                state = EnumOrderDataState.VLSTS_Ready;
                break;

            case EnumOrderFormState.VHSTS_Cancel:
            case EnumOrderFormState.VHSTS_Completed:
            case EnumOrderFormState.VHSTS_Closed:
                // 无需状态更新,保持原状态
                break;

            default:
                throw new Exception("未知状态" + currentState.ToString());
            }

            return(state);
        }
Пример #3
0
        /// <summary>
        /// 是否包含订单行下一步状态
        /// </summary>
        /// <param name="currentState">当前状态</param>
        /// <param name="nextState">下一状态</param>
        /// <returns></returns>
        public static bool ContainNextOrderDataState(
            EnumOrderDataState currentState, EnumOrderDataState nextState)
        {
            List <EnumOrderDataState> allNextStateList = CanUseNextStepOrderDataStateList(currentState);

            // 输入的下一步是否在可操作的步骤内
            return(allNextStateList.Exists(n => n == nextState));
        }
        public ActionResult OrderDataState(long id, EnumOrderDataState state)
        {
            ExtResult ret = new ExtResult();

            try
            {
                var userid = CurrentUser.GetCurrentUser().UserInfo.YHID;
                dalorderdata.UpdateOrderData(id, userid, state);
                ret.success = true;
            }
            catch (Exception ex)
            {
                ret.success = false;
                ret.msg     = ex.Message;
            }

            return(this.JsonFormat(ret));
        }
        /// <summary>
        /// 是否包含订单行下一步状态
        /// </summary>
        /// <param name="currentState">当前状态</param>
        /// <param name="nextState">下一状态</param>
        /// <returns></returns>
        public static bool ContainNextOrderDataState(
            EnumOrderDataState currentState, EnumOrderDataState nextState)
        {
            List<EnumOrderDataState> allNextStateList = CanUseNextStepOrderDataStateList(currentState);

            // 输入的下一步是否在可操作的步骤内
            return (allNextStateList.Exists(n => n == nextState));
        }
        /// <summary>
        /// 下一步骤可使用的订单行状态
        /// </summary>
        /// <param name="currentState"></param>
        /// <returns></returns>
        public static List<EnumOrderDataState> CanUseNextStepOrderDataStateList(EnumOrderDataState currentState)
        {
            List<EnumOrderDataState> allNextStateList = new List<EnumOrderDataState>();

            switch (currentState)
            {
                case EnumOrderDataState.VLSTS_New:
                    allNextStateList.Add(EnumOrderDataState.VLSTS_Ready);
                    break;

                case EnumOrderDataState.VLSTS_Ready:
                    allNextStateList.Add(EnumOrderDataState.VLSTS_Released);
                    break;

                case EnumOrderDataState.VLSTS_Released:
                    allNextStateList.Add(EnumOrderDataState.VLSTS_Completed);
                    allNextStateList.Add(EnumOrderDataState.VLSTS_Cancel);
                    break;

                case EnumOrderDataState.VLSTS_Cancel:
                case EnumOrderDataState.VLSTS_Completed:
                    // 没有后续状态
                    break;

                default:
                    throw new Exception("未知状态" + currentState.ToString());
            }

            return allNextStateList;
        }
Пример #7
0
 public void UpdateOrderData(long id, string userid, EnumOrderDataState nextState)
 {
     base.RequestAction <object[]>("UpdateOrderData", new object[] { id, userid, nextState });
 }
Пример #8
0
        public void UpdateOrderData(long id, string userid, EnumOrderDataState nextState)
        {
            var ent = GetEntity(id);

            var currentState = FunctionHelp.GetEnum <EnumOrderDataState>(ent.ZT);

            if (!OrderStateWorkFlow.ContainNextOrderDataState(currentState, nextState))
            {
                throw new JsMiracleException(string.Format("当前状态:{0},下一状态不得是:{1}", currentState, nextState));
            }

            ent.ZT = (int)nextState;

            // 单据释放时需要把单据行信息加入业务任务中 
            IMS_WT_YWRW bizTask = null;

            if (nextState == EnumOrderDataState.VLSTS_Released)
            {
                bizTask = DbContext.IMS_WT_YWRW_S.Where(n => n.DJH_ID == ent.ID).FirstOrDefault();

                if (bizTask == null)
                {
                    bizTask = new IMS_WT_YWRW()
                    {
                        DJBH   = ent.DJBH,
                        CJR    = userid,
                        DJH_ID = ent.ID,
                        CJSJ   = System.DateTime.Now,
                        DJSL   = ent.DJSL,
                        HXW    = ent.HXW,
                        HH     = ent.HH,
                        LYD    = ent.LYD,
                        LYSYZ  = ent.LYSYZ,
                        MDD    = ent.MDD,
                        MDSYZ  = ent.MDSYZ,
                        PCBH   = ent.PCBH,
                        SKU    = ent.SKU,
                        ZT     = (int)EnumWorkTaskState.WTSTS_New,
                    };
                }
                else
                {
                    bizTask.LYD   = ent.LYD;
                    bizTask.LYSYZ = ent.LYSYZ;
                    bizTask.MDSYZ = ent.MDSYZ;
                    bizTask.MDD   = ent.MDD;
                    bizTask.PCBH  = ent.PCBH;
                    bizTask.SKU   = ent.SKU;
                }
            }

            using (var tran = new System.Transactions.TransactionScope())
            {
                try
                {
                    if (bizTask != null)
                    {
                        if (bizTask.ID == 0)
                        {
                            DbContext.IMS_WT_YWRW_S.Add(bizTask);
                        }

                        DbContext.SaveChanges();
                    }

                    SaveOrUpdate(ent);

                    tran.Complete();
                }
                catch (Exception ex)
                {
                    throw new JsMiracleException(string.Format("单据更新失败:{0}", ex.Message));
                }
            }
        }
        public ActionResult OrderDataState(long id, EnumOrderDataState state)
        {
            ExtResult ret = new ExtResult();

            try
            {
                var userid = CurrentUser.GetCurrentUser().UserInfo.YHID;
                dalorderdata.UpdateOrderData(id,userid, state);
                ret.success = true;
            }
            catch (Exception ex)
            {
                ret.success = false;
                ret.msg = ex.Message;
            }

            return this.JsonFormat(ret);
        }