天津投入产出系统后端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

762 lines
29 KiB

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
using System.Linq;
using QM.Common;
using QMAPP.Entity;
using QMAPP.FJC.Entity;
using QMAPP.FJC.Entity.Andon;
using QMAPP.FJC.Entity.Basic;
using QMAPP.FJC.Entity.ODS;
using QMAPP.FJC.Entity.Operation;
using QMAPP.ServicesAgent;
using QMAPP.FJC.Entity.Stocktaking;
using QMAPP.MD.Entity;
namespace QMAPP.WinForm.Common
{
public class BasicData
{
#region 获取班次下拉列表
/// <summary>
/// 获取班次下拉列表
/// </summary>
/// <returns></returns>
public List<ProduceShift> GetShiftComboxSource()
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
ProduceShift entity = new ProduceShift();
List<ProduceShift> list = new List<ProduceShift>();
try
{
//获取工序信息
list = agent.InvokeServiceFunction<List<ProduceShift>>("ProduceShiftBLL_GetWorkcenterShifts", "");
//是否带空项填充返回值
list.Insert(0, new ProduceShift());
return list;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
/// <summary>
/// 获取播放类型下拉列表
/// </summary>
/// <returns></returns>
public List<VideoTypeEntity> GetVideoInfoList()
{
//获取类别
VideoTypeEntity searchModel = new VideoTypeEntity();
//执行查询
List<VideoTypeEntity> list = new List<VideoTypeEntity>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<VideoTypeEntity>>("VideoTypeBLL_GetAllList");
//是否带空项填充返回值
list.Insert(0, new VideoTypeEntity());
return list;
}
/// <summary>
/// 获取设备下拉列表
/// </summary>
/// <returns></returns>
public List<MachineInfo> GetMachineInfoList(string[] processType, bool isWithEmpty)
{
//获取类别
MachineInfo searchModel = new MachineInfo();
if (processType.Length > 0)
{
searchModel.PROCESSTYPES = "'" + string.Join("','", processType) + "'";
}
searchModel.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
//执行查询
List<MachineInfo> list = new List<MachineInfo>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MachineInfo>>("MachineInfoBLL_GetAllList", searchModel);
list = list.OrderBy(p => p.MACHINENAME).ToList() ;
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MachineInfo());
}
return list;
}
/// <summary>
/// 获取设备下拉列表
/// </summary>
/// <returns></returns>
public List<MachineInfo> GetMachineInfoListPro(string[] processType, bool isWithEmpty)
{
//获取类别
MachineInfo searchModel = new MachineInfo();
if (processType.Length > 0)
{
searchModel.PROCESSTYPES = "'" + string.Join("','", processType) + "'";
}
searchModel.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
//执行查询
List<MachineInfo> list = new List<MachineInfo>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MachineInfo>>("MachineInfoBLL_GetAllList", searchModel);
list = list.OrderBy(p => p.MACHINENAME).ToList();
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MachineInfo());
}
return list;
}
/// <summary>
/// 获取设备下拉列表20171105
/// </summary>
/// <returns></returns>
public List<MachineInfo> GetMachineList(string ordertype, bool isWithEmpty)
{
//获取类别
MachineInfo searchModel = new MachineInfo();
searchModel.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
WorkCell info = new WorkCell();
info.WORKCELL_CODE = ordertype;
//执行查询
List<MachineInfo> list = new List<MachineInfo>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MachineInfo>>("MachineInfoBLL_GetMachineForOrderList", new MachineInfo(), info);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MachineInfo());
}
return list;
}
/// <summary>
/// 获取设备下拉列表
/// </summary>
/// <returns></returns>
public List<MachineInfo> GetMachineInfoAndModelList(string[] processType, bool isWithEmpty)
{
//获取类别
MachineInfo searchModel = new MachineInfo();
if (processType.Length > 0)
{
searchModel.PROCESSTYPES = string.Join(",", processType);
}
searchModel.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
//执行查询
List<MachineInfo> list = new List<MachineInfo>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MachineInfo>>(B9BasicService.MachineInfoBLL_GetAllListAndModels.ToString(), searchModel);
list = list.OrderBy(p => p.MACHINENAME).ToList();
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MachineInfo { MACHINENAME = "", MACHINECODDE = "" });
}
return list;
}
public List<MachineInfo> GetMachineInfoMachineCheck()
{
//获取类别
//执行查询
List<MachineInfo> list = new List<MachineInfo>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MachineInfo>>("MachineInfoBLL_GetMachineInfoMachineCheck");
list.Insert(0, new MachineInfo { MACHINENAME = "", MACHINECODDE = "" });
return list;
}
/// <summary>
/// 获取原材料下拉列表
/// </summary>
/// <returns></returns>
public List<MD.Entity.Material> GetMaterielInfoList(string materialType, bool isWithEmpty)
{
//获取类别
MD.Entity.Material searchModel = new MD.Entity.Material();
searchModel.MATERIAL_TYPE_CODE = materialType;
//searchModel.PRODUCELINE = EnumGeter.PRODUCELINE.B9.ToString();
//执行查询
List<MD.Entity.Material> list = new List<MD.Entity.Material>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MD.Entity.Material>>("MaterialBLL_GetMaterialList", searchModel);
list = list.OrderBy(p => p.MATERIAL_NAME).ToList();
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MD.Entity.Material());
}
return list;
}
/// <summary>
/// 获取操作人下拉列表
/// </summary>
/// <returns></returns>
public List<OperatorInfo> GetOperatorInfoList(string processType, bool isWithEmpty)
{
//获取类别
OperatorInfo searchModel = new OperatorInfo();
searchModel.PROCESSTYPE = processType;
//执行查询
List<OperatorInfo> list = new List<OperatorInfo>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<OperatorInfo>>(B9BasicService.OperatorInfoBLL_GetAllList.ToString(), searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new OperatorInfo());
}
return list;
}
/// <summary>
/// 获取操作人下拉列表
/// </summary>
/// <returns></returns>
public List<ListItem> GetOperatorInfoComboxSource(string processType, bool isWithEmpty)
{
List<ListItem> list = new List<ListItem>();
//获取类别
List<OperatorInfo> listEntity = GetOperatorInfoList(processType, isWithEmpty);
foreach (var item in listEntity)
{
list.Add(new ListItem(item.OPERATOR, item.OPERATORCODE));
}
return list;
}
/// <summary>
/// 获取发货料架下拉列表
/// </summary>
/// <returns></returns>
public List<MaterialShelfType> GetMaterialShelfTypeList(string productType, bool isWithEmpty)
{
//获取类别
MaterialShelfType searchModel = new MaterialShelfType();
if (!string.IsNullOrEmpty(productType))
{
searchModel.PRODUCTTYPE = productType;
}
//执行查询
List<MaterialShelfType> list = new List<MaterialShelfType>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MaterialShelfType>>(B9BasicService.MaterialShelfTypeBLL_GetAllList.ToString(), searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MaterialShelfType());
}
return list;
}
/// <summary>
/// 读取零件类别下拉列表
/// </summary>
/// <returns></returns>
public List<ProductBasic> GetProductBasicList(string productType, bool isWithEmpty)
{
//获取类别
ProductBasic searchModel = new ProductBasic();
if (!string.IsNullOrEmpty(productType))
{
searchModel.PRODUCTMAINTYPE = productType;
}
//执行查询
List<ProductBasic> list = new List<ProductBasic>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<ProductBasic>>(B9BasicService.ProductBasicBLL_GetAllList.ToString(), searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new ProductBasic());
}
return list;
}
/// <summary>
/// 读取零件类别下拉列表
/// </summary>
/// <returns></returns>
public List<ProductBasic> GetProductBasicList(ProductBasic searchModel, bool isWithEmpty)
{
//执行查询
List<ProductBasic> list = new List<ProductBasic>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<ProductBasic>>(B9BasicService.ProductBasicBLL_GetAllList.ToString(), searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new ProductBasic());
}
return list;
}
/// <summary>
/// 读取零件类别下拉列表
/// </summary>
/// <returns></returns>
public List<MaterialClass> GetMaterialTypeList(MaterialClass searchModel, bool isWithEmpty)
{
//执行查询
List<MaterialClass> list = new List<MaterialClass>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MaterialClass>>("MaterialClassBLL_GetAllList", searchModel);
list = list.OrderBy(p => p.MATERIAL_TYPE_NAME).ToList();
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MaterialClass());
}
return list;
}
/// <summary>
/// 读取产品项目下拉列表
/// </summary>
/// <returns></returns>
public List<Project> GetProjectList(bool isWithEmpty)
{
//执行查询
List<Project> list = new List<Project>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<Project>>("ProjectBLL_GetAllList", new Project { });
list = list.OrderBy(p => p.PROJECT_NAME).ToList();
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new Project());
}
return list;
}
/// <summary>
/// 读取Dictionary.xml下拉列表
/// </summary>
/// <returns></returns>
public List<ListItem> GetDictionaryList(string kind)
{
List<ListItem> listItem = new List<ListItem>();
Dictionary<string, string> dicts = null;
QMFrameWork.Common.Util.ModelDictionaryHandler.TryGetModelDictionary(kind.ToString(), out dicts);
foreach (string item in dicts.Keys)
{
listItem.Add(new ListItem(item, dicts[item]));
}
return listItem;
}
/// <summary>
/// 获取班次下拉列表
/// </summary>
/// <returns></returns>
public List<ListItem> GetProduceShiftComboxSource(ProduceShift condition, bool isWithEmpty)
{
//执行查询
List<ProduceShift> listEntity = new List<ProduceShift>();
List<ListItem> list = new List<ListItem>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
listEntity = agent.InvokeServiceFunction<List<ProduceShift>>(B9BasicService.ProduceShiftBLL_GetAllList.ToString(), condition);
//是否带空项填充返回值
if (isWithEmpty)
{
listEntity.Insert(0, new ProduceShift { PRODUCESHIFTNAME = string.Empty, PRODUCESHIFTTCODE = string.Empty });
}
foreach (var item in listEntity)
{
list.Add(new ListItem(item.PRODUCESHIFTNAME, item.PRODUCESHIFTTCODE));
}
return list;
}
public List<PrintModelCopy> GetPrintModelCopy(string formFlag)
{
//获取类别
//执行查询
List<PrintModelCopy> list = new List<PrintModelCopy>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<PrintModelCopy>>(B9IPCService.PrintModelCopyBLL_GetPrintModelCopyList.ToString(), formFlag);
//是否带空项填充返回值
return list;
}
/// <summary>
/// 读取物料类别下拉列表
/// </summary>
/// <returns></returns>
public List<MaterialClass> GetMaterialTypeList(string ordertype, bool isWithEmpty)
{
//执行查询
List<MaterialClass> list = new List<MaterialClass>();
WorkCell info = new WorkCell();
info.WORKCELL_CODE = ordertype;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MaterialClass>>("MaterialBLL_GetMaterialClassWithType", new MaterialClass(), info);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MaterialClass());
}
return list;
}
/// <summary>
/// 获取物料号下拉
/// </summary>
/// <returns></returns>
public List<QMAPP.MD.Entity.Material> GetmaterialCodeList(string materialType, bool isWithEmpty)
{
//获取类别
QMAPP.MD.Entity.Material searchModel = new QMAPP.MD.Entity.Material();
searchModel.MATERIAL_TYPE_CODE = materialType;
//执行查询
List<QMAPP.MD.Entity.Material> list = new List<QMAPP.MD.Entity.Material>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<QMAPP.MD.Entity.Material>>("MaterialBLL_GetAllList", searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new QMAPP.MD.Entity.Material());
}
return list;
}
/// <summary>
/// 批量报废读取物料类别下拉列表
/// </summary>
/// <returns></returns>
public List<MaterialClass> GetMaterialClassToMendRecorderWasteForm(bool isWithEmpty)
{
//执行查询
List<MaterialClass> list = new List<MaterialClass>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MaterialClass>>("MaterialBLL_GetMaterialClassToMendRecorderWasteForm");
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new MaterialClass());
}
return list;
}
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns></returns>
public List<WorkCell> GetWorkCellList(bool isWithEmpty)
{
//执行查询
List<WorkCell> list = new List<WorkCell>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<WorkCell>>("WorkCellBLL_GetAllList", new WorkCell());
list = list.OrderBy(p => p.WORKCELL_NAME).ToList();
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new WorkCell());
}
return list;
}
/// <summary>
/// 根据扫描条码获取之前工序下拉列表
/// 筛选工序
/// </summary>
/// <returns></returns>
public List<MainOperation> GetMainOperationWorkCell(string ProductCode)
{
//执行查询
List<MainOperation> list = new List<MainOperation>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<MainOperation>>("MainOperationBLL_GetMainOperationWorkCell", ProductCode, true);
if (list.Count > 0)
{
foreach (MainOperation item in list)
{
item.WORKCELL_NAME = item.WORKCELL_NAME + ":" + item.PRODUCTCODE;
}
list.Insert(0, new MainOperation());
}
//为空就是注塑件
else
{
list = agent.InvokeServiceFunction<List<MainOperation>>("MainOperationBLL_GetMainOperationWorkCell", ProductCode, false);
foreach (MainOperation item in list)
{
item.WORKCELL_NAME = "注塑机";
item.WORKCELL_CODE = "INJECTION";
}
}
return list;
}
/// <summary>
/// 获取出库原因
/// </summary>
/// <param name="isWithEmpty"></param>
/// <returns></returns>
public List<OutReason> GetOutReasonList(bool isWithEmpty)
{
//执行查询
List<OutReason> list = new List<OutReason>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<OutReason>>("ProductOutBLL_GetOutReasonList", new OutReason());
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new OutReason());
}
return list;
}
/// <summary>
/// 获取输入值
/// </summary>
/// <param name="isWithEmpty"></param>
/// <returns></returns>
public List<InputValue> GetInputValueList(string checkcode, bool isWithEmpty)
{
InputValue searchModel = new InputValue();
searchModel.CHECKITEMCODE = checkcode;
//执行查询
List<InputValue> list = new List<InputValue>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<InputValue>>("ProductCheckBLL_GetInputValueList", searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new InputValue { INPUTVALUE = string.Empty });
}
return list;
}
/// <summary>
/// 获取呼叫类型
/// </summary>
/// <returns></returns>
public List<ConfigDetail> GetConfigDetailComboxSource(string MainTypeCode, bool isWithEmpty)
{
//执行查询
List<ConfigDetail> list = new List<ConfigDetail>();
//List<ListItem> list = new List<ListItem>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<ConfigDetail>>("ConfigDetailBLL_GetAllList", MainTypeCode);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new ConfigDetail { DetailTypeName = string.Empty, DetailTypeCode = string.Empty });
}
//foreach (ConfigDetail item in list)
//{
// item.DetailTypeName = item.DetailTypeCode + "/" + item.DetailTypeName;
//}
return list;
}
//自定义ComboBox下拉内容的宽度
public void AdjustComboBoxDropDownListWidth(object comboBox)
{
Graphics g = null;
Font font = null;
try
{
ComboBox senderComboBox = null;
if (comboBox is ComboBox)
senderComboBox = (ComboBox)comboBox;
else if (comboBox is ToolStripComboBox)
senderComboBox = ((ToolStripComboBox)comboBox).ComboBox;
else
return;
int width = senderComboBox.Width;
g = senderComboBox.CreateGraphics();
font = senderComboBox.Font;
//checks if a scrollbar will be displayed.
//If yes, then get its width to adjust the size of the drop down list.
int vertScrollBarWidth =
(senderComboBox.Items.Count > senderComboBox.MaxDropDownItems)
? SystemInformation.VerticalScrollBarWidth : 0;
int newWidth;
foreach (object s in senderComboBox.Items) //Loop through list items and check size of each items.
{
if (s != null)
{
newWidth = (int)g.MeasureString(s.ToString().Trim(), font).Width
+ vertScrollBarWidth;
if (width < newWidth)
width = newWidth; //set the width of the drop down list to the width of the largest item.
}
}
senderComboBox.DropDownWidth = width;
}
catch
{ }
finally
{
if (g != null)
g.Dispose();
}
}
#region 获取全部工作中心下拉列表
/// <summary>
/// 获取工作中心下拉列表
/// </summary>
/// <returns>数据源</returns>
public List<WorkCenter> GetAllWorkCenterComboxSource()
{
var workCenter = new WorkCenter();
QMAPP.ServicesAgent.ServiceAgent wcfAgent = ClientContext.GetServiceAgent();
//ServiceAgent wcfAgent = this.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", workCenter);
return dataResult.Result;
}
catch (Exception ex)
{
throw ex;
}
}
public List<WorkCenter> GetFactoryWorkCenterComboxSource(string factoryCode)
{
ServiceAgent wcfAgent = ClientContext.GetServiceAgent();
try
{
var dataResult = wcfAgent.InvokeServiceFunction<DataResult<List<WorkCenter>>>
("WorkCenterBLL_GetWorkCenterList", new WorkCenter { FACTORY_CODE = factoryCode });
return dataResult.Result;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取工位下拉列表(联动)
/// <summary>
/// 获取工序下拉列表
/// </summary>
/// <returns>数据源</returns>
public List<WorkLoc> GetWorkLocComboxSource(string workCenterCode)
{
List<WorkLoc> list = new List<WorkLoc>();
ServiceAgent wcfAgent = ClientContext.GetServiceAgent();
try
{
if (string.IsNullOrEmpty(workCenterCode) == false)
{
list = wcfAgent.InvokeServiceFunction<List<WorkLoc>>
("WorkLocBLL_GetWorkLocFromWorkCenterCodeList", workCenterCode);
//foreach (WorkLoc item in dataResult)
//{
// item.WORKLOC_NAME = item.WORKLOC_NAME;
// list.Add(item);
//}
}
return list;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
#region 获取原材料信息,根据T_PP_ORDERENTITY MATERIALTYPE 过滤
/// <summary>
/// 获取原材料信息,根据T_PP_ORDERENTITY MATERIALTYPE 过滤
/// </summary>
/// <returns></returns>
public List<QMAPP.MD.Entity.Material> GetMaterialInfoByType(string OrderType, bool isWithEmpty)
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
OrderIndentity OrderSearch = new OrderIndentity();
if (!string.IsNullOrEmpty(OrderType))
{
OrderSearch.ORDER_TYPE = OrderType;
OrderSearch = agent.InvokeServiceFunction<OrderIndentity>("MaterialBLL_GetOrderInfo", OrderSearch);
}
//获取类别
QMAPP.MD.Entity.Material searchModel = new QMAPP.MD.Entity.Material();
if (!string.IsNullOrEmpty(OrderSearch.MATERIALTYPE))
{
string str = string.Join(",", OrderSearch.MATERIALTYPE);
searchModel.MATERIALTYPES = "'" + str.Replace(",", "','") + "'";
}
//执行查询
List<QMAPP.MD.Entity.Material> list = new List<QMAPP.MD.Entity.Material>();
list = agent.InvokeServiceFunction<List<QMAPP.MD.Entity.Material>>("MaterialBLL_GetAllList", searchModel);
//是否带空项填充返回值
if (isWithEmpty)
{
list.Insert(0, new QMAPP.MD.Entity.Material());
}
return list;
}
#endregion
/// <summary>
/// 获取物料信息
/// </summary>
/// <param name="materialCode"></param>
/// <param name="p"></param>
/// <returns></returns>
public List<QMAPP.MD.Entity.Material> GetMaterialInfoList(string materialCode, bool isWithEmpty)
{
QMAPP.MD.Entity.Material searchModel = new QMAPP.MD.Entity.Material();
searchModel.MATERIAL_CODE = materialCode;
//执行查询
List<QMAPP.MD.Entity.Material> list = new List<QMAPP.MD.Entity.Material>();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
list = agent.InvokeServiceFunction<List<QMAPP.MD.Entity.Material>>("MaterialBLL_GetMaterialInfoListBy", searchModel);
//是否带空项填充返回值
if (list.Count > 0)
{
foreach (QMAPP.MD.Entity.Material item in list)
{
item.MATERIAL_NAME = item.MATERIAL_NAME + ":" + item.MATERIAL_CODE;
}
}
if (isWithEmpty)
{
list.Insert(0, new QMAPP.MD.Entity.Material { MATERIAL_NAME = "", MATERIAL_CODE = "" });
}
return list;
}
/// <summary>
///
/// </summary>
/// <param name="materialCode"></param>
/// <param name="isWithEmpty"></param>
/// <returns></returns>
public QMAPP.MD.Entity.Material GetMaterialInfo(string materialCode)
{
QMAPP.MD.Entity.Material searchModel = new QMAPP.MD.Entity.Material();
searchModel.MATERIAL_CODE = materialCode;
//执行查询
QMAPP.MD.Entity.Material MaterialInfo = new QMAPP.MD.Entity.Material();
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
MaterialInfo = agent.InvokeServiceFunction<QMAPP.MD.Entity.Material>("MaterialBLL_GetMaterialInfo", searchModel);
return MaterialInfo;
}
}
}