jgehling
(Jeff Gehling)
November 5, 2025, 3:23pm
1
Hello Friends!
I’m writing a function to add ops/mtls to a part revision via the EngWorkBench service. All goes well, except when I attempt to use the CheckInAndRefresh method. I’ve followed the trace and everything.
Here is my code:
var engTable = new Erp.Tablesets.EngWorkBenchTableset();
string myPartNum = " CA-M-706870-1-FP";
string opCheckedOutRevisionNum = "";
string altMethodMsg = "";
bool altMethodFlg;
string refreshMessage = "";
string opMessage = "";
Action CheckOutPart = () =>
{
CallService<Erp.Contracts.EngWorkBenchSvcContract>(engSvc =>
{
engTable = engSvc.CheckOut("DMT", myPartNum, "A", "", "", DateTime.UtcNow, false, true, false, true, false, out opCheckedOutRevisionNum, out altMethodMsg, out altMethodFlg);
engSvc.GetNewECOOpr(ref engTable, "DMT", myPartNum, "A", "", "");
engSvc.ChangeECOOprOpCode("X-PD150", out refreshMessage, ref engTable);
engSvc.Update(ref engTable);
var currentRevRecord = engTable.ECORev.FirstOrDefault();
currentRevRecord.Approved = true;
currentRevRecord.RowMod = "U";
engSvc.ChangeECORevApproved(true, ref engTable);
engSvc.Update(ref engTable);
engTable = engSvc.CheckInAndRefresh("DMT", myPartNum, "A", "", "", false, "ECO Group Integration Import", out opMessage);
});
};
CheckOutPart();
And here is the resulting error when running the check in method:
Any ideas on what the culprit could be?
jgehling
(Jeff Gehling)
November 5, 2025, 3:56pm
2
Found the solution here:
From a suggestion per Jim Kinneman:
Erp.Contracts.EngWorkBenchSvcContract **engWorkBench** = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.EngWorkBenchSvcContract>(this.Db, true);
Erp.Contracts.EngWorkBenchSvcContract **engWorkBenchCheckIn** = Ice.Assemblies.ServiceRenderer.GetService<Erp.Contracts.EngWorkBenchSvcContract>(this.Db, true);
I defined a different service to execute the CheckIn method. Worked great.
Thanks, Jim!
Joe
Wild I have to call service renderer again just to check in.
Final code:
var engTable = new Erp.Tablesets.EngWorkBenchTableset();
var returnEngTable = new Erp.Tablesets.EngWorkBenchTableset();
string myPartNum = " CA-M-706870-1-FP";
string opCheckedOutRevisionNum = "";
string altMethodMsg = "";
bool altMethodFlg;
string refreshMessage = "";
string opMessage = "";
Action CheckOutPart = () =>
{
CallService<Erp.Contracts.EngWorkBenchSvcContract>(engSvc =>
{
engTable = engSvc.CheckOut("DMT", myPartNum, "A", "", "", DateTime.UtcNow, false, true, false, true, false, out opCheckedOutRevisionNum, out altMethodMsg, out altMethodFlg);
engSvc.GetNewECOOpr(ref engTable, "DMT", myPartNum, "A", "", "");
engSvc.ChangeECOOprOpCode("X-PD150", out refreshMessage, ref engTable);
engSvc.Update(ref engTable);
var currentRevRecord = engTable.ECORev.FirstOrDefault();
currentRevRecord.Approved = true;
currentRevRecord.RowMod = "U";
engSvc.ChangeECORevApproved(true, ref engTable);
engSvc.Update(ref engTable);
//returnEngTable = engSvc.CheckInAndRefresh("DMT", myPartNum, "A", "", "", false, "ECO Group Integration Import", out opMessage);
});
CallService<Erp.Contracts.EngWorkBenchSvcContract>(engSvc1 =>
{
returnEngTable = engSvc1.CheckInAndRefresh("DMT", myPartNum, "A", "", "", false, "ECO Group Integration Import", out opMessage);
});
};
CheckOutPart();