using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Core.Mes.Client.Comm.Control;
using CoreFS.CA06;
using Pur.Entity.ck;
using Pur.Entity.configureEntity;
using Pur.Entity;
using com.hnshituo.pur.vo;
namespace Pur.Pop_upWindow
{
public partial class frmPopInStockQtyDetail : FrmPmsBase
{
private string itemUnique;
private string tabShow="0";
public frmPopInStockQtyDetail()
{
InitializeComponent();
}
public frmPopInStockQtyDetail(OpeBase OB,String strItemUnique,string TabShow)
{
this.ob = OB;
if (String.IsNullOrEmpty(strItemUnique))
{
MessageBox.Show("未选择物料!");
}
itemUnique = strItemUnique;
tabShow = TabShow;
InitializeComponent();
}
private void frmPopInStockQtyDetail_Load(object sender, EventArgs e)
{
init();
}
///
/// 初始化数据
///
private void init()//初始化数据
{
try
{
this.Cursor = Cursors.WaitCursor;
//默认选择的数tab
if (tabShow == "0")
{
ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[0];
}
else
{
ultraTabControl1.SelectedTab = ultraTabControl1.Tabs[1];
}
//查看库存
dataTable1.Clear();
CkStorage CkSto = new CkStorage();
CkSto.Validflag = "1";
CkSto.ItemUnique = itemUnique;
CkSto.InvOrigQty = 0.0;
DataTable dt = this.execute("com.hnshituo.pur.ck.service.CkStorageService", "find_Storage", new object[] { CkSto });
GridHelper.CopyDataToDatatable(dt, dataTable1, true);
//查看在途库存
dataTable2.Clear();
OrderC orderc = new OrderC();
orderc.ItemUnique = itemUnique;
orderc.Validflag = "1";
orderc.DeleteName = "1";//仅查询在途库存大于0的
DataTable dt11 = this.execute("com.hnshituo.pur.order.service.OrderCService", "doQueryOrderC", new object[] { orderc });
GridHelper.CopyDataToDatatable(dt11, dataTable2, true);
//查看物料
string[] str = itemUnique.Split('@');
String stritemCode = str[0];
string stritemAttrId = str[1];
string stritemstandardsId = str[2];
string stritemUomId = str[3];
if (!String.IsNullOrEmpty(stritemCode))
{
MatEntity mat = this.execute("com.hnshituo.pur.configure.service.MatService", "findById", new object[] { stritemCode });
if (mat != null)
{
txt_itemCode.Text = mat.ItemCode == null ? "" : mat.ItemCode;
txt_itemName.Text = mat.ItemName == null ? "" : mat.ItemName;
}
}
if (!string.IsNullOrEmpty(stritemAttrId))
{
PurMatAttrsEntity matAttr = this.execute("com.hnshituo.pur.configure.service.MatAttrsService", "findById", new object[] { stritemAttrId });
if (matAttr != null)
{
txt_itemAttr.Text = matAttr.ItemAttr == null ? "" : matAttr.ItemAttr;
txt_itemAttrId.Text = matAttr.ItemAttrId == null ? "" : matAttr.ItemAttrId;
}
}
if (!string.IsNullOrEmpty(stritemstandardsId))
{
PurStandardsEntity matStandards = this.execute("com.hnshituo.pur.configure.service.MatStandardsService", "findById", new object[] { stritemstandardsId });
if (matStandards != null)
{
txt_itemStandardsId.Text = matStandards.StandardsId == null ? "" : matStandards.StandardsId;
txt_itemStandCode.Text = matStandards.StandardsCode == null ? "" : matStandards.StandardsCode;
}
}
if (!string.IsNullOrEmpty(stritemUomId))
{
PurMatUomsEntity matUom = this.execute("com.hnshituo.pur.configure.service.MatUomsService", "findById", new object[] { stritemUomId });
if (matUom != null)
{
}
}
}
finally
{
this.Cursor = Cursors.Default;
}
}
///
/// 刷新数据
///
///
///
private void btn_refresh_Click(object sender, EventArgs e)//刷新数据
{
init();
}
}
}