niva5171
(Nick Vaughan)
November 14, 2017, 2:04pm
21
Thank you for the code! I am having some issues with the “PartInfo” callout at the top of the function. Is there something that I need to do for this? getting a missing assembly reference error.
Chris_Conn
(Chris Conn)
November 14, 2017, 8:19pm
22
@niva5171 No that’s just a custom class I made. You could just as well change the IssuePart to use (PartNum, MtlSeq, etc) instead of a class. If I have to pass several related items, I tend to make a class to encapsulate them in.
In this case you just add:
class PartInfo
{
string PartNum;
int MtlSeq;
}
then create it and stuff some data into it:
PartInfo myPart = new PartInfo();
myPart.PartNum = "APartNum";
myPart.MtlSeq = 10;
IssuePart(myPart, 10);
Note that MtlSeq is from the BOM itself. That’s a whole different chunk of code.
niva5171
(Nick Vaughan)
November 17, 2017, 1:40pm
23
Chris_Conn:
probably
Okay, that makes more sense! I am self taught in c# (coding in general), so there a lot of things I haven’t picked up on. I finally got it up and working! thank you so much Chris. You are the man!
1 Like
EnguiD
(Eddi)
March 7, 2022, 12:10pm
24
Chris_Conn:
private void IssuePart(PartInfo thePart, decimal Qty)
{ //uses job, WH, BIN, previously entered
//PartInfo should have all relevant info
//if we try ISSUE material NOT on bom - has to be on a mtl seq that exists but can change the PN - does it consume proper?
//oTrans.PushStatusText("Issuing "+thePart.PartNum,true);
edvIM = (EpiDataView)oTrans.EpiDataViews["IM"];
DataRowView dRow = edvIM.dataView[edvIM.Row];
IssueReturnAdapter ia = new IssueReturnAdapter(oTrans);
ia.BOConnect();
string msg;
bool reqInput;
string lgl;
string partTran;
ia.GetNewIssueReturnToJob(dRow["ToJobNum"].ToString(), (int)dRow["ToAssemblySeq"], "STK-MTL", Guid.NewGuid(), out msg);
//ia.get
Erp.BO.IssueReturnDataSet.IssueReturnRow row = ia.IssueReturnData.IssueReturn[0];
row.FromWarehouseCode = dRow["FromWarehouseCode"].ToString();
row.FromBinNum = dRow["FromBinNum"].ToString();
row.ToBinNum = dRow["ToBinNum"].ToString();
//row.LotNum = dRow["LotNum"].ToString(); // -- You said they arent LOT tracked
row.ToJobNum = dRow["ToJobNum"].ToString(); //probably already set but why not try again
row.ToWarehouseCode = dRow["ToWarehouseCode"].ToString();
//all this below is NOT in the dataView but from our "special" part
row.ToJobPartNum = thePart.PartNum;
row.ToJobSeqPartNum = thePart.PartNum;
row.ToJobSeq = thePart.MtlSeq; //has to be valid seq
row.PartNum = thePart.PartNum;
row.FromAssemblyPartNum = dRow["FromAssemblyPartNum"].ToString();
row.PartIUM = thePart.UOM;
row.DimCode = thePart.UOM;
row.DUM = thePart.UOM;
row.UM = thePart.UOM;
row.TranQty = Qty;
row.RowMod = "U";
ia.PrePerformMaterialMovement(out reqInput);
ia.PerformMaterialMovement(true, out lgl, out partTran);
}
sorry to jump in, is this done with mes? is it possible to get a copy of xml export customization
Sorry, that was a lifetime ago. I no longer have access to the file. You can use this code from either the client or MES.
Obviously there are other bits of info you have to provide, like adding assembly’s and using statements.
1 Like