/// <summary> /// <para>获取仓库区域列表</para> /// <para>单据只有一个交易步骤时,可以只传入<paramref name="orderTypeCode"/>获取仓库区域列表</para> /// <para>如果单据有多个交易步骤需要选择库房区域,必须先在界面让用户选择具体的交易类型,然后根据交易类型代码<paramref name="transTypeCode"/>获取可以选择的库房区域</para> /// </summary> /// <param name="session"></param> /// <param name="orderTypeCode">单据类型代码</param> /// <param name="transTypeCode">交易类型代码</param> /// <param name="transTypeCode">仓储地代码,可以不用给</param> /// <returns>仓库区域列表</returns> public static IList <WHArea> GetWHArea(ISession session, string orderTypeCode, string transTypeCode, string locationCode) { if (!string.IsNullOrEmpty(transTypeCode) && transTypeCode.Trim().Length > 0) { return(ERPUtil.GetWHAreaByTransType(session, transTypeCode, locationCode)); } if (string.IsNullOrEmpty(orderTypeCode) || orderTypeCode.Trim().Length <= 0) { throw new Exception("Empty parameters while retrieving WHArea list"); } IList <OrderTransDef> transDefs = session.CreateEntityQuery <OrderTransDef>() .Where( Exp.Eq("OrderTypeCode", orderTypeCode) & Exp.Eq("StepType", TransStepType.Single) //为MultiSelect时,界面让用户选择交易类型,根据交易类型再取库房区域 & Exp.Eq("TransLocationFrom", TransLocationFrom.InterfaceValue) //为ConfigValue时,一般配置中只出现一个库房区域,不需要选择 ).List <OrderTransDef>(); if (transDefs == null || transDefs.Count != 1) { throw new Exception(string.Format("Order type {0} has mutiple transaction steps, the trans type code is required in this case", orderTypeCode)); } if (string.IsNullOrEmpty(transDefs[0].TransTypeCode) || transDefs[0].TransTypeCode.Trim().Length <= 0) { throw new Exception(string.Format("Trans type code for order type {0} is empty", orderTypeCode)); } return(ERPUtil.GetWHAreaByTransType(session, transDefs[0].TransTypeCode, locationCode)); }
/// <summary> /// <para>获取仓库区域列表</para> /// <para>单据只有一个交易步骤时,可以只传入<paramref name="orderTypeCode"/>获取仓库区域列表</para> /// <para>如果单据有多个交易步骤需要选择库房区域,必须先在界面让用户选择具体的交易类型,然后根据交易类型代码<paramref name="transTypeCode"/>获取可以选择的库房区域</para> /// </summary> /// <param name="session"></param> /// <param name="orderTypeCode">单据类型代码</param> /// <param name="transTypeCode">交易类型代码</param> /// <returns>仓库区域列表</returns> public static IList <WHArea> GetWHArea(ISession session, string orderTypeCode, string transTypeCode) { return(ERPUtil.GetWHArea(session, orderTypeCode, transTypeCode, null)); }