在开发过程中,为了让功能,数据更加完善!
我们就要给与用户一个友好的界面提示!
以下是我今天在工作中常写的一个检查数据报错机制!
/** Add by xyf 20090923 Remark: Check TY SaleOrder(CustPurchId) of CSM_PackingListLine TableLine if CustPurchId is empty that Thorw Error User */ void checkPackingList() { CSM_PackingListLine _ListLine; CSM_PackingListTable _ListTable; Container _Con ; if(CSM_PackingListTable_ds.mark()) { _ListTable = CSM_PackingListTable_ds.getFirst(1); while(_ListTable) { while select _ListLine where _ListLine.PackingId == _ListTable.PackingId { if(_ListLine.CustPurchId == '') _Con += ["1"] + [strFmt("%1:%2 ; %3:%4","@YDT4197",_ListTable.PackingId,'@YDT3234',_ListLine.Seq)]; } _ListTable = CSM_PackingListTable_ds.getNext(); } } else while select _ListLine where _ListLine.PackingId == CSM_PackingListTable.PackingId { if(_ListLine.CustPurchId == '') _Con += ["1"] + [strFmt("%1:%2 ; %3:%4","@YDT4197",_ListLine.PackingId,'@YDT3234',_ListLine.Seq)]; } if(_con) { infolog.viewBuild(_con,true); throw Error("Sorry,It is stopping right now !" + "/n" + 'Because TY Sales Order is empty,Please Check It'); } }
Form中可多选,对数据给与检查,若发现数据异常,则中断程序运行,予以报错信息提示明细!
运行结果如下: