![]() |
#11 |
Участник
|
Я думаю, каждый из нас встречает такой быдолкод.
![]() Не могу не поделиться. X++: void MaterialProcess(afcProdmaterial _Material, int lineNo) { RouteJobType _JType; boolean ppoOkToProcess = true; ; materialProcessError = false; if (_Material.JobType == 'Setup') _JType = str2enum(RouteJobType::Setup,_Material.JobType); else _JType = str2enum(RouteJobType::Process,_Material.JobType); try { ttsbegin; lineNo += 1; _progress.setCount(lineNo); _progress.setText(_material.RefNoID); _JobId = this.GetJobNum(_Material.RefNoID,_JType, _Material.OprNum,RouteOprPriority::Primary, _Material.ItemId); if (_Material.LotNum != '') _Batch = this.CheckBatchId(_Material.LotNum, _Material.ItemId,_Material); if (_material.TranType == 'OFF-FIN' && _material.SerialNum && _material.PQty > 0) { if (!ppoProdMatlTrace::findSerialNum(_material.SerialNum).Ply) { ppoOkToProcess = false; } } if (ppoOkToProcess) { if(this.PostMaterial(_Material)) { _Material.inventDimId = _dimId; _Material.ProcessedFlag = NoYes::Yes; _Material.update(); } else { throw(error("Update cancelled.")); } } ttscommit; } //try catch (Exception::Deadlock) { // ttsabort; retry; // _material.HasError = noYes::Yes; // _material.update(); } catch (Exception::Warning) { ttsabort; // retry; _material.HasError = noYes::Yes; _material.update(); } catch (Exception::Error) { ttsabort; //retry; _material.HasError = noYes::Yes; _material.update(); } }
__________________
// no comments |
|