How to Customize Part check Primary Warehouse (PrimWhse) by Site (Plant)

Event PartPlant_BeforeFieldChange:
How to code get Primary Warehouse (PrimWhse) by Stite (Plant)
private void PartPlant_BeforeFieldChange(object sender, DataColumnChangeEventArgs args)
{
// ** Argument Properties and Uses **
// args.Row[“FieldName”]
// args.Column, args.ProposedValue, args.Row
// Add Event Handler Code
EpiDataView viewPartPlant = ((EpiDataView) (this.oTrans.EpiDataViews[“PartPlant”]));
EpiDataView viewPart = ((EpiDataView) (this.oTrans.EpiDataViews[“Part”]));
EpiDataView warehseSearch = ((EpiDataView) (this.oTrans.EpiDataViews[“WarehseSearch”]));
switch (args.Column.ColumnName)
{
case “Plant”:
MessageBox.Show(“test: dgdf”,“thông báo”,MessageBoxButtons.YesNo,
MessageBoxIcon.Information,MessageBoxDefaultButton.Button1);
break;
case “PrimWhse”:
string partPlant = viewPartPlant.dataView[viewPartPlant.Row][“Plant”].ToString();
if(partPlant != null)
{
MessageBox.Show("test: "+ partPlant,“thông báo”,MessageBoxButtons.YesNo,
MessageBoxIcon.Information,MessageBoxDefaultButton.Button1);
}
break;
}
}


image

Is this providing a solution to a problem you had, or a question? Want to make sure we can help if you need it.

I want to check Primary Warehouse (PrimWhse) by Stite (Plant) by PartPlant_BeforeFieldChange event in Part setup screen
I want the code to retrieve the Primary Warehouse (PrimWhse) by Stite (Plant) in the Warehse table.

select WarehouseCode, Plant from Warehse

Thank you very much!

I guess I’m not understanding. Can you first describe the problem you are trying to solve? I see the solution your are trying to implement, but don’t know why you are doing it.

Here, my company found an error when I created a Stite on the Part screen, if the Primary Warehouse (PrimWhse) is not selected with the Primary Warehouse (PrimWhse) of that Stite, an error will occur in some screens linked with other Partnumber so the solution is that we have to catch when people choose Warehouse (PrimWhse) must be true for Stite (Palnt) these two are related through the Warehse table
EX:

Would making the PartPlant.PrimWhse field required via the Extended Properties screen be an easier solution?

1 Like