public ActionResult GetCodeListByCodeType(string codeType) { var ev = FunctionHelp.GetEnum <CodeTypeEnum>(codeType); var data = dalCode.GetCodeList(ev); return(this.JsonFormat(data)); }
public override IMS_VC_DJT GetEntity(object id) { var entity = base.GetEntity(id); if (entity == null) { return(entity); } var currentState = FunctionHelp.GetEnum <EnumOrderFormState>(entity.DJZT); var canStatus = OrderStateWorkFlow.CanUseNextStepOrderFormStateList(currentState); // 下一步骤可用状态是修改过提交则,为可修改状态 if (canStatus.Exists(n => n == EnumOrderFormState.VHSTS_Ready || n == EnumOrderFormState.VHSTS_Submit)) { entity.CanModify = true; } else { entity.CanModify = false; } return(entity); }
public ActionResult EditOrderForm(long id) { var order = dalorderform.GetEntity(id); ViewBag.BizType = ""; ViewBag.DocumentStatus = new SelectList( GetDocumentStatusList(), "SZ", "MC", order.DJZT); if (order == null) { throw new JsMiracleException("单据不存在"); } var code = dalCode.GetCode(CodeTypeEnum.BusinessType, order.YWLX); if (code == null) { throw new JsMiracleException("业务类型不存在"); } var bizType = FunctionHelp.GetEnum <EnumBusinessType>(code.SZ); GetDJT(bizType, ref order); return(View(order)); }
/// <summary> /// 更新订单可操作的属性 /// </summary> /// <param name="entity">需更新属性的实例</param> public static void SetOrderFormProp(V_IMS_VC_DJT entity) { if (entity == null) { return; } var currentState = FunctionHelp.GetEnum <EnumOrderFormState>(entity.DJZT); var allNextStateList = CanUseNextStepOrderFormStateList(currentState); entity.CanCancel = false; entity.CanAudit = false; entity.CanClose = false; entity.CanComplete = false; entity.CanModify = false; foreach (var state in allNextStateList) { switch (state) { case EnumOrderFormState.VHSTS_New: case EnumOrderFormState.VHSTS_Submit: entity.CanModify = true; break; case EnumOrderFormState.VHSTS_Ready: entity.CanModify = true; entity.CanAudit = true; break; case EnumOrderFormState.VHSTS_Cancel: entity.CanCancel = true; break; case EnumOrderFormState.VHSTS_Completed: entity.CanComplete = true; break; case EnumOrderFormState.VHSTS_Closed: entity.CanClose = true; break; default: throw new JsMiracleException(string.Format("未处理的状态:{0}", state.ToString())); } } }
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)); } } }