不能实现就手工选择产品代码后,触发执行int cell_change()事件。 尽管已经加了grid_trigger_change('MG_Item','res_id',n); int main() { string fp,fn; int pos, len,a; fp=select_file_to_open('选择文件','Excel文档|*.xl*'); fn = fp; for(a=1;a<strlen(fn);a++) { pos = str_pos(fn, "\"); len = strlen(fn); fn = str_get_sub(fn, pos + 1, len - pos - 1); } pos=str_pos(fn,"."); len = strlen(fn); fn=str_get_sub(fn,0,len-pos+1) int trow,i,n; string sql; xls_open_book(fp); xls_select_sheet_by_title(fn); db_select_area(1); xls_sheet_to_dbio(); i=db_row_count(); gui_set_val("ComboBox_Ext_Eba_Id",db_res(3)); gui_set_val("DateTimePicker_Date_Lmt_Res",db_res(2)); gui_set_val("DateTimePicker_Voucher_Date",db_res(0)); for (n=1;n<=i;n++) { grid_set_v('MG_Item','res_id',n,str_trim(db_res(4))); grid_trigger_change('MG_Item','res_id',n); sql="select res_name from res where res_id='"+str_trim(db_res(4))+"'"; db_select_area(2); db_run(sql); grid_set_v('MG_Item','res_name',n,str_trim(db_res(0))); db_select_area(1); grid_trigger_change('MG_Item','attr.cap.1',n); grid_set_v('MG_Item','inp_num',n,str_trim(db_res(7))); grid_trigger_change('MG_Item','res_name',n); db_next(); } xls_close_book(fp); db_free_area(1); return 1; }; |