/*******************************************************************************
* Copyright(c) 2016 DongkeSoft All rights reserved. / Confidential
* 类的信息:
* 1.程序名称:F_SAP_HEGII_0108.cs
* 2.功能描述:半成品库存
* 编辑履历:
* 作者 日期 版本 修改内容
* xiacm 2022/11/09 1.00 新建
*******************************************************************************/
using System;
using System.Data;
using System.Windows.Forms;
using Dongke.IBOSS.PRD.Basics.BaseControls;
using Dongke.IBOSS.PRD.Basics.BaseResources;
using Dongke.IBOSS.PRD.Client.Controls;
using Dongke.IBOSS.PRD.WCF.DataModels;
using Dongke.IBOSS.PRD.WCF.Proxys;
namespace Dongke.IBOSS.PRD.Client.SAPDataModule.Hegii
{
public partial class F_SAP_HEGII_0108 : DKDockPanelBase
{
#region 成员变量
private static F_SAP_HEGII_0108 _instance = null;
#endregion
#region 单例模式
///
/// 单例模式,防止重复创建窗体
///
public static F_SAP_HEGII_0108 Instance
{
get
{
if (_instance == null)
{
_instance = new F_SAP_HEGII_0108();
}
return _instance;
}
}
#endregion
#region 构造函数
///
/// 成品SAP日志
///
public F_SAP_HEGII_0108()
{
InitializeComponent();
this.Text = "半成品库存";
this.tsbtnAdaptive.Text = ButtonText.TSBTN_ADAPTIVE;
this.tsbtnClose.Text = ButtonText.TSBTN_CLOSE;
this.dgvSemi.AutoGenerateColumns = false;
}
#endregion
#region 控件事件
///
/// 页面加载
///
///
///
private void F_SAP_HEGII_0108_Load(object sender, EventArgs e)
{
dgvSemi.AutoGenerateColumns = false;
DataTable DataCodeDt = new DataTable();
DataCodeDt.Columns.Add("DataCodeName", typeof(string));
DataCodeDt.Columns.Add("DataCode", typeof(string));
DataRow dr = DataCodeDt.NewRow();
dr["DataCodeName"] = "";
dr["DataCode"] = "-1";
DataCodeDt.Rows.InsertAt(dr, 0);
//dr = DataCodeDt.NewRow();
//dr["DataCodeName"] = "模具";
//dr["DataCode"] = "10";
//DataCodeDt.Rows.InsertAt(dr, 1);
dr = DataCodeDt.NewRow();
dr["DataCodeName"] = "湿坯";
dr["DataCode"] = "20";
DataCodeDt.Rows.InsertAt(dr, 2);
dr = DataCodeDt.NewRow();
dr["DataCodeName"] = "精坯";
dr["DataCode"] = "30";
DataCodeDt.Rows.InsertAt(dr, 3);
dr = DataCodeDt.NewRow();
dr["DataCodeName"] = "釉坯";
dr["DataCode"] = "40";
DataCodeDt.Rows.InsertAt(dr, 4);
dr = DataCodeDt.NewRow();
dr["DataCodeName"] = "烧成";
dr["DataCode"] = "50";
DataCodeDt.Rows.InsertAt(dr, 5);
dr = DataCodeDt.NewRow();
dr["DataCodeName"] = "成品";
dr["DataCode"] = "60";
DataCodeDt.Rows.InsertAt(dr, 6);
this.CBDataCode.DisplayMember = "DataCodeName";
this.CBDataCode.ValueMember = "DataCode";
this.CBDataCode.DataSource = DataCodeDt;
this.CBDataCode.SelectedValue = "-1";
}
///
/// 关闭
///
///
///
private void F_SAP_HEGII_0108_FormClosed(object sender, FormClosedEventArgs e)
{
_instance = null;
}
///
/// 自适应列宽
///
///
///
private void tsbtnAdaptive_Click(object sender, EventArgs e)
{
this.dgvSemi.AutoResizeColumns();
}
///
/// 关闭按钮
///
///
///
private void tsbtnClose_Click(object sender, EventArgs e)
{
this.Close();
}
///
/// 清空条件
///
///
///
private void tsbtnClearCondition_Click(object sender, EventArgs e)
{
this.CTxtMaterialCode.Clear();
this.CTxtWorkshop.Clear();
this.CBDataCode.SelectedValue = "-1";
}
///
/// 查询
///
///
///
private void tsbtnSearch_Click(object sender, EventArgs e)
{
this.QueryDataFromOther();
tsbtnAdaptive_Click(null, null);
}
#endregion
#region 私有方法
///
/// 查询数据
///
private void QueryDataFromOther()
{
try
{
this.dgvSemi.DataSource = null;
this.tsrToolStrip1.Focus();
string Workshop = this.CTxtWorkshop.Text.Trim();
string CTxtMaterialCode = this.CTxtMaterialCode.Text.Trim();
string datacode = this.CBDataCode.SelectedValue.ToString();//数据节点
ClientRequestEntity cre = new ClientRequestEntity();
cre.Properties["WORKSHOP"] = Workshop;
cre.Properties["MATERIALCODE"] = CTxtMaterialCode;
cre.Properties["datacode"] = datacode;
cre.NameSpace = "Hegii";
cre.Name = "GetDataIVITotal_BC";
ServiceResultEntity sre = DoAsync(() =>
{
return SAPDataModuleProxy.Service.DoRequest(cre);
});
if (sre.Status == Constant.ServiceResultStatus.Success)
{
// 查询成功
this.dgvSemi.DataSource = sre.Data.Tables[0];
if (this.dgvSemi.RowCount == 0)
{
DKMessageBox.ShowDialog(this, DKMessageCode.I_CMN_S_001);
}
}
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
}
}