天津投入产出系统后端
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.

763 lines
29 KiB

3 years ago
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;
}
}
}