Browse Source

工单界面信息

master
忱 沈 5 months ago
parent
commit
532e37aa84
  1. 53
      applications/lvgl/guider/custom/custom.c
  2. 4
      applications/lvgl/guider/custom/custom.h
  3. 7
      applications/lvgl/guider/generated/gui_guider.h
  4. 135
      applications/lvgl/guider/generated/setup_scr_screen.c
  5. 46
      applications/lvgl/ui_data_csv.c
  6. 1
      applications/lvgl/ui_data_csv.h
  7. 54
      applications/lvgl/ui_data_labels.c
  8. 17
      applications/lvgl/ui_data_labels.h

53
applications/lvgl/guider/custom/custom.c

@ -17,6 +17,7 @@
#include <guider/generated/events_init.h> #include <guider/generated/events_init.h>
#include <guider/generated/gui_guider.h> #include <guider/generated/gui_guider.h>
#include <guider/generated/widgets_init.h> #include <guider/generated/widgets_init.h>
#include <ui_data_labels.h>
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
@ -36,7 +37,8 @@
/** /**
* Create a demo application * Create a demo application
*/ */
int16_t g_selected_row = -1; int16_t Work_row = -1;
int16_t Work_step_row = -1;
// 绘图回调 // 绘图回调
static void table_style_cb(lv_event_t *e) static void table_style_cb(lv_event_t *e)
{ {
@ -45,45 +47,37 @@ static void table_style_cb(lv_event_t *e)
if (code == LV_EVENT_DRAW_PART_BEGIN) { if (code == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_part_dsc_t *dsc = lv_event_get_param(e); lv_obj_draw_part_dsc_t *dsc = lv_event_get_param(e);
// 检查是否是单元格绘制 // 检查是否是单元格绘制
if (dsc->part == LV_PART_ITEMS && dsc->id < LV_TABLE_CELL_NONE) { if (dsc->part == LV_PART_ITEMS && dsc->id < LV_TABLE_CELL_NONE) {
uint16_t row = dsc->id / lv_table_get_col_cnt(table); uint16_t row = dsc->id / lv_table_get_col_cnt(table);
//uint16_t col = dsc->id % lv_table_get_col_cnt(table); //uint16_t col = dsc->id % lv_table_get_col_cnt(table);
if (row == 0) { // 表头 if (row == 0) { // 表头
dsc->rect_dsc->bg_opa = LV_OPA_COVER; dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->rect_dsc->bg_color = lv_color_hex(0xd5dee6); dsc->rect_dsc->bg_color = lv_color_hex(0xd5dee6);
dsc->label_dsc->color = lv_color_hex(0x000000); dsc->label_dsc->color = lv_color_hex(0x000000);
dsc->label_dsc->font = &lv_font_simsun_30; dsc->label_dsc->font = &lv_font_simsun_30;
}// 如果是选中行,绘制蓝色背景 }// 如果是选中行,绘制蓝色背景
else if (row == g_selected_row) { else if ((row == Work_row)&&(table == guider_ui.screen_list_inf)) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
}
else if ((table == guider_ui.screen_w_list)&&(row == Work_step_row)) {
dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景 dsc->rect_dsc->bg_color = lv_color_hex(0x007185); // 蓝色背景
dsc->rect_dsc->bg_opa = LV_OPA_COVER; dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字 dsc->label_dsc->color = lv_color_hex(0xFFFFFF); // 白色文字
} }
} }
} }
/* lv_obj_draw_part_dsc_t *dsc = lv_event_get_draw_part_dsc(e);
if (dsc->part != LV_PART_ITEMS) return;
uint16_t row = dsc->id / lv_table_get_col_cnt(lv_event_get_target(e));
if (row == 0) { // 表头
dsc->rect_dsc->bg_opa = LV_OPA_COVER;
dsc->rect_dsc->bg_color = lv_color_hex(0xd5dee6);
dsc->label_dsc->color = lv_color_hex(0x000000);
dsc->label_dsc->font = &lv_font_simsun_30;
}*/
} }
//点击事件回调 //点击事件回调
char value_W[32] = {0};
static void table_click_event_cb(lv_event_t *e) { static void table_click_event_cb(lv_event_t *e) {
lv_obj_t *table = lv_event_get_target(e); lv_obj_t *table = lv_event_get_target(e);
lv_indev_t *indev = lv_indev_get_act(); lv_indev_t *indev = lv_indev_get_act();
if (indev == NULL) return; if (indev == NULL) return;
char sql[64] = {0};
// 获取点击坐标 // 获取点击坐标
lv_point_t point; lv_point_t point;
@ -104,22 +98,33 @@ static void table_click_event_cb(lv_event_t *e) {
int32_t border_width = lv_obj_get_style_border_width(table, LV_PART_MAIN); int32_t border_width = lv_obj_get_style_border_width(table, LV_PART_MAIN);
int32_t pad_top = lv_obj_get_style_pad_top(table, LV_PART_MAIN); int32_t pad_top = lv_obj_get_style_pad_top(table, LV_PART_MAIN);
int32_t pad_bottom = lv_obj_get_style_pad_bottom(table, LV_PART_MAIN); int32_t pad_bottom = lv_obj_get_style_pad_bottom(table, LV_PART_MAIN);
int32_t content_h = table_area.y2 - table_area.y1 - border_width * 2 - pad_top - pad_bottom; int32_t content_h = table_area.y2 - table_area.y1 - border_width * 2 - pad_top - pad_bottom;
// 计算行高 // 计算行高
int32_t row_h = content_h / row_cnt; int32_t row_h = content_h / row_cnt;
if (row_h <= 0) return; if (row_h <= 0) return;
// 计算行号 // 计算行号
int16_t row = rel_y / row_h; int16_t row = rel_y / row_h;
if (row >= 0 && row < row_cnt) { if (row >= 0 && row < row_cnt) {
g_selected_row = row;
lv_obj_invalidate(table); lv_obj_invalidate(table);
//rt_kprintf("row: %d", row); //rt_kprintf("row: %d", row);
} }
Work_row=-1;
Work_step_row=-1;
//获得来源表
if(table == guider_ui.screen_list_inf)//总览信息/工艺信息
{
Work_row = row;// 写入行号
rt_snprintf(value_W, sizeof(value_W),lv_table_get_cell_value(guider_ui.screen_list_inf, row, 0));
Work_Program_step_ui(value_W);
}
else if(table == guider_ui.screen_w_list){//步骤信息
Work_step_row = row;// 写入行号
if(value_W[0] == '\0') return;
rt_snprintf(sql, sizeof(sql),"%s' AND Step = '%s'",value_W,lv_table_get_cell_value(guider_ui.screen_w_list, row, 0));
Work_Program_stepINF_ui(sql);
}
} }
// 初始化样式 // 初始化样式
@ -195,6 +200,12 @@ void custom_init(lv_ui *ui)
guider_ui.screen_list_inf = lv_table_create(guider_ui.screen_inf_list); guider_ui.screen_list_inf = lv_table_create(guider_ui.screen_inf_list);
table_style_init(guider_ui.screen_list_inf); table_style_init(guider_ui.screen_list_inf);
lv_table_set_col_cnt(guider_ui.screen_list_inf,6);
guider_ui.screen_w_list = lv_table_create(guider_ui.screen_step_list);
table_style_init(guider_ui.screen_w_list);
lv_table_set_col_cnt(guider_ui.screen_w_list,2);
lv_table_set_row_cnt(guider_ui.screen_w_list,6);
/* Add your codes here */ /* Add your codes here */
} }

4
applications/lvgl/guider/custom/custom.h

@ -15,7 +15,9 @@ extern "C" {
#include "guider/generated/gui_guider.h" #include "guider/generated/gui_guider.h"
extern int16_t g_selected_row; extern int16_t Work_row;
extern int16_t Work_step_row;
void custom_init(lv_ui *ui); void custom_init(lv_ui *ui);
#ifdef __cplusplus #ifdef __cplusplus

7
applications/lvgl/guider/generated/gui_guider.h

@ -49,8 +49,8 @@ typedef struct
lv_obj_t *screen_w_w; lv_obj_t *screen_w_w;
lv_obj_t *screen_w_w_label; lv_obj_t *screen_w_w_label;
lv_obj_t *screen_w_text; lv_obj_t *screen_w_text;
lv_obj_t *screen_text_inf;
lv_obj_t *screen_step_list; lv_obj_t *screen_step_list;
lv_obj_t *screen_w_list;
lv_obj_t *screen_inf_list; lv_obj_t *screen_inf_list;
lv_obj_t *screen_cont_p; lv_obj_t *screen_cont_p;
lv_obj_t *screen_table_1; lv_obj_t *screen_table_1;
@ -441,6 +441,8 @@ typedef struct
lv_obj_t *screen_set_Save; lv_obj_t *screen_set_Save;
lv_obj_t *screen_set_Save_label; lv_obj_t *screen_set_Save_label;
lv_obj_t *screen_step_; lv_obj_t *screen_step_;
lv_obj_t *screen_cont_2;
lv_obj_t *screen_cont_1;
lv_obj_t *screen_w_5; lv_obj_t *screen_w_5;
lv_obj_t *screen_machine_name_rt; lv_obj_t *screen_machine_name_rt;
lv_obj_t *screen_sys_name; lv_obj_t *screen_sys_name;
@ -450,6 +452,7 @@ typedef struct
lv_obj_t *screen_sys_save; lv_obj_t *screen_sys_save;
lv_obj_t *screen_sys_save_label; lv_obj_t *screen_sys_save_label;
lv_obj_t *g_kb_top_layer; lv_obj_t *g_kb_top_layer;
lv_obj_t *screen_w_list;
lv_obj_t *screen_list_inf; lv_obj_t *screen_list_inf;
}lv_ui; }lv_ui;
@ -487,6 +490,8 @@ LV_IMG_DECLARE(_IconParkPlay_alpha_40x40);
LV_FONT_DECLARE(lv_font_simsun_30) LV_FONT_DECLARE(lv_font_simsun_30)
LV_FONT_DECLARE(lv_font_simsun_16) LV_FONT_DECLARE(lv_font_simsun_16)
LV_FONT_DECLARE(lv_font_simsun_24) LV_FONT_DECLARE(lv_font_simsun_24)
LV_FONT_DECLARE(lv_font_montserratMedium_12)
LV_FONT_DECLARE(lv_font_Alatsi_Regular_18)
LV_FONT_DECLARE(lv_font_simsun_14) LV_FONT_DECLARE(lv_font_simsun_14)
LV_FONT_DECLARE(lv_font_simsun_26) LV_FONT_DECLARE(lv_font_simsun_26)
LV_FONT_DECLARE(lv_font_simsun_28) LV_FONT_DECLARE(lv_font_simsun_28)

135
applications/lvgl/guider/generated/setup_scr_screen.c

@ -344,7 +344,7 @@ void setup_scr_screen(lv_ui *ui)
ui_init_style(&style_screen_tabview_extra_btnm_items_checked); ui_init_style(&style_screen_tabview_extra_btnm_items_checked);
lv_style_set_text_color(&style_screen_tabview_extra_btnm_items_checked, lv_color_hex(0x2195f6)); lv_style_set_text_color(&style_screen_tabview_extra_btnm_items_checked, lv_color_hex(0x2195f6));
lv_style_set_text_font(&style_screen_tabview_extra_btnm_items_checked, &lv_font_simsun_14); lv_style_set_text_font(&style_screen_tabview_extra_btnm_items_checked, &lv_font_montserratMedium_12);
lv_style_set_text_opa(&style_screen_tabview_extra_btnm_items_checked, 255); lv_style_set_text_opa(&style_screen_tabview_extra_btnm_items_checked, 255);
lv_style_set_border_width(&style_screen_tabview_extra_btnm_items_checked, 4); lv_style_set_border_width(&style_screen_tabview_extra_btnm_items_checked, 4);
lv_style_set_border_opa(&style_screen_tabview_extra_btnm_items_checked, 255); lv_style_set_border_opa(&style_screen_tabview_extra_btnm_items_checked, 255);
@ -431,30 +431,49 @@ void setup_scr_screen(lv_ui *ui)
lv_obj_set_style_text_align(ui->screen_w_w, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_w_w, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_w_text //Write codes screen_w_text
ui->screen_w_text = lv_label_create(ui->screen_tabview_tab_1); ui->screen_w_text = lv_obj_create(ui->screen_tabview_tab_1);
lv_label_set_text(ui->screen_w_text, "信息");
lv_label_set_long_mode(ui->screen_w_text, LV_LABEL_LONG_WRAP);
lv_obj_set_pos(ui->screen_w_text, 305, 265); lv_obj_set_pos(ui->screen_w_text, 305, 265);
lv_obj_set_size(ui->screen_w_text, 550, 230); lv_obj_set_size(ui->screen_w_text, 550, 230);
lv_obj_set_scrollbar_mode(ui->screen_w_text, LV_SCROLLBAR_MODE_OFF);
//Write style for screen_w_text, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. //Write style for screen_w_text, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_radius(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui->screen_w_text, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_w_text, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_w_text, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_letter_space(ui->screen_w_text, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_line_space(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_w_text, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_w_text, 255, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->screen_w_text, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_w_text, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_color(ui->screen_w_text, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_w_text, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_bg_grad_dir(ui->screen_w_text, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_top(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_bottom(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_w_text, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_text_inf
ui->screen_text_inf = lv_label_create(ui->screen_w_text);
lv_label_set_text(ui->screen_text_inf, "信息");
lv_label_set_long_mode(ui->screen_text_inf, LV_LABEL_LONG_WRAP);
lv_obj_set_pos(ui->screen_text_inf, 0, 0);
lv_obj_set_size(ui->screen_text_inf, 550, 230);
lv_obj_add_flag(ui->screen_text_inf, LV_OBJ_FLAG_SCROLLABLE);
//Write style for screen_text_inf, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui->screen_text_inf, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_text_inf, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_text_inf, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_letter_space(ui->screen_text_inf, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_line_space(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_text_inf, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_text_inf, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_text_inf, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_text_inf, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_text_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_list //Write codes screen_step_list
ui->screen_step_list = lv_obj_create(ui->screen_tabview_tab_1); ui->screen_step_list = lv_obj_create(ui->screen_tabview_tab_1);
lv_obj_set_pos(ui->screen_step_list, 0, 0); lv_obj_set_pos(ui->screen_step_list, 0, 0);
@ -473,41 +492,6 @@ void setup_scr_screen(lv_ui *ui)
lv_obj_set_style_pad_right(ui->screen_step_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_right(ui->screen_step_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_step_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_w_list
ui->screen_w_list = lv_table_create(ui->screen_step_list);
lv_table_set_col_cnt(ui->screen_w_list,1);
lv_table_set_row_cnt(ui->screen_w_list,1);
lv_table_set_cell_value(ui->screen_w_list,0,0,"Name");
lv_obj_set_pos(ui->screen_w_list, 0, 0);
lv_obj_set_scrollbar_mode(ui->screen_w_list, LV_SCROLLBAR_MODE_OFF);
//Write style for screen_w_list, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_pad_top(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_w_list, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_w_list, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_w_list, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_width(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_w_list, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write style for screen_w_list, Part: LV_PART_ITEMS, State: LV_STATE_DEFAULT.
lv_obj_set_style_text_color(ui->screen_w_list, lv_color_hex(0x393c41), LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_w_list, &lv_font_simsun_14, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_w_list, 255, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_w_list, LV_TEXT_ALIGN_CENTER, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_w_list, 0, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_border_width(ui->screen_w_list, 3, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui->screen_w_list, 255, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui->screen_w_list, lv_color_hex(0xd5dee6), LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_border_side(ui->screen_w_list, LV_BORDER_SIDE_FULL, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_w_list, 10, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_w_list, 10, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_w_list, 10, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_w_list, 10, LV_PART_ITEMS|LV_STATE_DEFAULT);
//Write codes screen_inf_list //Write codes screen_inf_list
ui->screen_inf_list = lv_obj_create(ui->screen_tabview_tab_1); ui->screen_inf_list = lv_obj_create(ui->screen_tabview_tab_1);
lv_obj_set_pos(ui->screen_inf_list, 305, 0); lv_obj_set_pos(ui->screen_inf_list, 305, 0);
@ -571,7 +555,7 @@ void setup_scr_screen(lv_ui *ui)
//Write style for screen_table_1, Part: LV_PART_ITEMS, State: LV_STATE_DEFAULT. //Write style for screen_table_1, Part: LV_PART_ITEMS, State: LV_STATE_DEFAULT.
lv_obj_set_style_text_color(ui->screen_table_1, lv_color_hex(0x393c41), LV_PART_ITEMS|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_table_1, lv_color_hex(0x393c41), LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_table_1, &lv_font_simsun_14, LV_PART_ITEMS|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_table_1, &lv_font_montserratMedium_12, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_table_1, 255, LV_PART_ITEMS|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_table_1, 255, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_table_1, LV_TEXT_ALIGN_CENTER, LV_PART_ITEMS|LV_STATE_DEFAULT); lv_obj_set_style_text_align(ui->screen_table_1, LV_TEXT_ALIGN_CENTER, LV_PART_ITEMS|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_table_1, 0, LV_PART_ITEMS|LV_STATE_DEFAULT); lv_obj_set_style_bg_opa(ui->screen_table_1, 0, LV_PART_ITEMS|LV_STATE_DEFAULT);
@ -624,7 +608,7 @@ void setup_scr_screen(lv_ui *ui)
//Write style for screen_chart_temp, Part: LV_PART_TICKS, State: LV_STATE_DEFAULT. //Write style for screen_chart_temp, Part: LV_PART_TICKS, State: LV_STATE_DEFAULT.
lv_obj_set_style_text_color(ui->screen_chart_temp, lv_color_hex(0x151212), LV_PART_TICKS|LV_STATE_DEFAULT); lv_obj_set_style_text_color(ui->screen_chart_temp, lv_color_hex(0x151212), LV_PART_TICKS|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_chart_temp, &lv_font_simsun_14, LV_PART_TICKS|LV_STATE_DEFAULT); lv_obj_set_style_text_font(ui->screen_chart_temp, &lv_font_montserratMedium_12, LV_PART_TICKS|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_chart_temp, 255, LV_PART_TICKS|LV_STATE_DEFAULT); lv_obj_set_style_text_opa(ui->screen_chart_temp, 255, LV_PART_TICKS|LV_STATE_DEFAULT);
lv_obj_set_style_line_width(ui->screen_chart_temp, 2, LV_PART_TICKS|LV_STATE_DEFAULT); lv_obj_set_style_line_width(ui->screen_chart_temp, 2, LV_PART_TICKS|LV_STATE_DEFAULT);
lv_obj_set_style_line_color(ui->screen_chart_temp, lv_color_hex(0xe8e8e8), LV_PART_TICKS|LV_STATE_DEFAULT); lv_obj_set_style_line_color(ui->screen_chart_temp, lv_color_hex(0xe8e8e8), LV_PART_TICKS|LV_STATE_DEFAULT);
@ -657,9 +641,10 @@ void setup_scr_screen(lv_ui *ui)
//Write codes screen_step_inf //Write codes screen_step_inf
ui->screen_step_inf = lv_obj_create(ui->screen_tabview_tab_2); ui->screen_step_inf = lv_obj_create(ui->screen_tabview_tab_2);
lv_obj_set_pos(ui->screen_step_inf, 465, 200); lv_obj_set_pos(ui->screen_step_inf, 468, 200);
lv_obj_set_size(ui->screen_step_inf, 559, 290); lv_obj_set_size(ui->screen_step_inf, 559, 290);
lv_obj_set_scrollbar_mode(ui->screen_step_inf, LV_SCROLLBAR_MODE_ACTIVE); lv_obj_set_scrollbar_mode(ui->screen_step_inf, LV_SCROLLBAR_MODE_ACTIVE);
lv_obj_add_flag(ui->screen_step_inf, LV_OBJ_FLAG_SCROLLABLE);
//Write style for screen_step_inf, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT. //Write style for screen_step_inf, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_step_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_border_width(ui->screen_step_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
@ -865,7 +850,7 @@ void setup_scr_screen(lv_ui *ui)
ui_init_style(&style_screen_w_io_extra_btnm_items_checked); ui_init_style(&style_screen_w_io_extra_btnm_items_checked);
lv_style_set_text_color(&style_screen_w_io_extra_btnm_items_checked, lv_color_hex(0x007185)); lv_style_set_text_color(&style_screen_w_io_extra_btnm_items_checked, lv_color_hex(0x007185));
lv_style_set_text_font(&style_screen_w_io_extra_btnm_items_checked, &lv_font_simsun_18); lv_style_set_text_font(&style_screen_w_io_extra_btnm_items_checked, &lv_font_Alatsi_Regular_18);
lv_style_set_text_opa(&style_screen_w_io_extra_btnm_items_checked, 255); lv_style_set_text_opa(&style_screen_w_io_extra_btnm_items_checked, 255);
lv_style_set_border_width(&style_screen_w_io_extra_btnm_items_checked, 4); lv_style_set_border_width(&style_screen_w_io_extra_btnm_items_checked, 4);
lv_style_set_border_opa(&style_screen_w_io_extra_btnm_items_checked, 255); lv_style_set_border_opa(&style_screen_w_io_extra_btnm_items_checked, 255);
@ -7044,7 +7029,7 @@ void setup_scr_screen(lv_ui *ui)
lv_style_set_pad_bottom(&style_screen_proess_set_extra_btns_main_default, 5); lv_style_set_pad_bottom(&style_screen_proess_set_extra_btns_main_default, 5);
lv_style_set_border_width(&style_screen_proess_set_extra_btns_main_default, 0); lv_style_set_border_width(&style_screen_proess_set_extra_btns_main_default, 0);
lv_style_set_text_color(&style_screen_proess_set_extra_btns_main_default, lv_color_hex(0x0D3055)); lv_style_set_text_color(&style_screen_proess_set_extra_btns_main_default, lv_color_hex(0x0D3055));
lv_style_set_text_font(&style_screen_proess_set_extra_btns_main_default, &lv_font_simsun_14); lv_style_set_text_font(&style_screen_proess_set_extra_btns_main_default, &lv_font_montserratMedium_12);
lv_style_set_text_opa(&style_screen_proess_set_extra_btns_main_default, 255); lv_style_set_text_opa(&style_screen_proess_set_extra_btns_main_default, 255);
lv_style_set_radius(&style_screen_proess_set_extra_btns_main_default, 3); lv_style_set_radius(&style_screen_proess_set_extra_btns_main_default, 3);
lv_style_set_bg_opa(&style_screen_proess_set_extra_btns_main_default, 255); lv_style_set_bg_opa(&style_screen_proess_set_extra_btns_main_default, 255);
@ -7062,7 +7047,7 @@ void setup_scr_screen(lv_ui *ui)
lv_style_set_pad_bottom(&style_screen_proess_set_extra_texts_main_default, 5); lv_style_set_pad_bottom(&style_screen_proess_set_extra_texts_main_default, 5);
lv_style_set_border_width(&style_screen_proess_set_extra_texts_main_default, 0); lv_style_set_border_width(&style_screen_proess_set_extra_texts_main_default, 0);
lv_style_set_text_color(&style_screen_proess_set_extra_texts_main_default, lv_color_hex(0x0D3055)); lv_style_set_text_color(&style_screen_proess_set_extra_texts_main_default, lv_color_hex(0x0D3055));
lv_style_set_text_font(&style_screen_proess_set_extra_texts_main_default, &lv_font_simsun_14); lv_style_set_text_font(&style_screen_proess_set_extra_texts_main_default, &lv_font_montserratMedium_12);
lv_style_set_text_opa(&style_screen_proess_set_extra_texts_main_default, 255); lv_style_set_text_opa(&style_screen_proess_set_extra_texts_main_default, 255);
lv_style_set_radius(&style_screen_proess_set_extra_texts_main_default, 3); lv_style_set_radius(&style_screen_proess_set_extra_texts_main_default, 3);
lv_style_set_transform_width(&style_screen_proess_set_extra_texts_main_default, 0); lv_style_set_transform_width(&style_screen_proess_set_extra_texts_main_default, 0);
@ -7116,7 +7101,7 @@ void setup_scr_screen(lv_ui *ui)
lv_style_set_pad_bottom(&style_screen_step_set_extra_btns_main_default, 5); lv_style_set_pad_bottom(&style_screen_step_set_extra_btns_main_default, 5);
lv_style_set_border_width(&style_screen_step_set_extra_btns_main_default, 0); lv_style_set_border_width(&style_screen_step_set_extra_btns_main_default, 0);
lv_style_set_text_color(&style_screen_step_set_extra_btns_main_default, lv_color_hex(0x0D3055)); lv_style_set_text_color(&style_screen_step_set_extra_btns_main_default, lv_color_hex(0x0D3055));
lv_style_set_text_font(&style_screen_step_set_extra_btns_main_default, &lv_font_simsun_24); lv_style_set_text_font(&style_screen_step_set_extra_btns_main_default, &lv_font_montserratMedium_12);
lv_style_set_text_opa(&style_screen_step_set_extra_btns_main_default, 255); lv_style_set_text_opa(&style_screen_step_set_extra_btns_main_default, 255);
lv_style_set_radius(&style_screen_step_set_extra_btns_main_default, 3); lv_style_set_radius(&style_screen_step_set_extra_btns_main_default, 3);
lv_style_set_bg_opa(&style_screen_step_set_extra_btns_main_default, 255); lv_style_set_bg_opa(&style_screen_step_set_extra_btns_main_default, 255);
@ -7134,7 +7119,7 @@ void setup_scr_screen(lv_ui *ui)
lv_style_set_pad_bottom(&style_screen_step_set_extra_texts_main_default, 5); lv_style_set_pad_bottom(&style_screen_step_set_extra_texts_main_default, 5);
lv_style_set_border_width(&style_screen_step_set_extra_texts_main_default, 0); lv_style_set_border_width(&style_screen_step_set_extra_texts_main_default, 0);
lv_style_set_text_color(&style_screen_step_set_extra_texts_main_default, lv_color_hex(0x0D3055)); lv_style_set_text_color(&style_screen_step_set_extra_texts_main_default, lv_color_hex(0x0D3055));
lv_style_set_text_font(&style_screen_step_set_extra_texts_main_default, &lv_font_simsun_24); lv_style_set_text_font(&style_screen_step_set_extra_texts_main_default, &lv_font_montserratMedium_12);
lv_style_set_text_opa(&style_screen_step_set_extra_texts_main_default, 255); lv_style_set_text_opa(&style_screen_step_set_extra_texts_main_default, 255);
lv_style_set_radius(&style_screen_step_set_extra_texts_main_default, 3); lv_style_set_radius(&style_screen_step_set_extra_texts_main_default, 3);
lv_style_set_transform_width(&style_screen_step_set_extra_texts_main_default, 0); lv_style_set_transform_width(&style_screen_step_set_extra_texts_main_default, 0);
@ -7297,6 +7282,48 @@ void setup_scr_screen(lv_ui *ui)
lv_obj_set_style_pad_left(ui->screen_step_, 5, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_pad_left(ui->screen_step_, 5, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_, 0, LV_PART_MAIN|LV_STATE_DEFAULT); lv_obj_set_style_shadow_width(ui->screen_step_, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_cont_2
ui->screen_cont_2 = lv_obj_create(ui->screen_tabview_tab_4);
lv_obj_set_pos(ui->screen_cont_2, 374, 208);
lv_obj_set_size(ui->screen_cont_2, 300, 200);
lv_obj_set_scrollbar_mode(ui->screen_cont_2, LV_SCROLLBAR_MODE_OFF);
//Write style for screen_cont_2, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_cont_2, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui->screen_cont_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui->screen_cont_2, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_side(ui->screen_cont_2, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_cont_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_cont_2, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_cont_2, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_cont_2, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_cont_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_cont_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_cont_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_cont_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_cont_2, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_cont_1
ui->screen_cont_1 = lv_obj_create(ui->screen_tabview_tab_4);
lv_obj_set_pos(ui->screen_cont_1, 362, 200);
lv_obj_set_size(ui->screen_cont_1, 300, 200);
lv_obj_set_scrollbar_mode(ui->screen_cont_1, LV_SCROLLBAR_MODE_OFF);
//Write style for screen_cont_1, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_cont_1, 2, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui->screen_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui->screen_cont_1, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_side(ui->screen_cont_1, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_cont_1, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_cont_1, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_cont_1, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_cont_1, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes 系统 //Write codes 系统
ui->screen_tabview_tab_5 = lv_tabview_add_tab(ui->screen_tabview,"系统"); ui->screen_tabview_tab_5 = lv_tabview_add_tab(ui->screen_tabview,"系统");
lv_obj_t * screen_tabview_tab_5_label = lv_label_create(ui->screen_tabview_tab_5); lv_obj_t * screen_tabview_tab_5_label = lv_label_create(ui->screen_tabview_tab_5);

46
applications/lvgl/ui_data_csv.c

@ -46,7 +46,7 @@ void field_callback(void *data, size_t size, void *user_data) {
user->data[user->row][user->col][copy_size] = '\0'; user->data[user->row][user->col][copy_size] = '\0';
// 计算当前字段宽度并更新列宽 // 计算当前字段宽度并更新列宽
int field_width = size * 24; // 假设每个字符 8 像素(英文) int field_width = size * 18; // 假设每个字符 8 像素(英文)
// 中文字符需要 ×2:field_width = copy_size * 16; // 中文字符需要 ×2:field_width = copy_size * 16;
if (field_width > user->col_widths[user->col]) { if (field_width > user->col_widths[user->col]) {
user->col_widths[user->col] = field_width; user->col_widths[user->col] = field_width;
@ -124,7 +124,7 @@ void csv_clear_data(UserData *user) {
} }
// ============ 解析后创建 LVGL 表格 ============ // ============ 解析后创建 LVGL 表格 ============
int parse_csv_string(lv_obj_t *container, const char *csv_data, UserData *user) int parse_csv_string(const char *csv_data, UserData *user)
{ {
if (csv_data == NULL) { if (csv_data == NULL) {
//rt_kprintf("[E] NOT DATA\n"); //rt_kprintf("[E] NOT DATA\n");
@ -166,9 +166,6 @@ static UserData *user = NULL;
extern struct rt_memheap sdram_heap; extern struct rt_memheap sdram_heap;
int parse_csv_to_table(lv_obj_t *container, const char *csv_data) { int parse_csv_to_table(lv_obj_t *container, const char *csv_data) {
//清楚点击行
g_selected_row = -1;
if (container == NULL || csv_data == NULL) { if (container == NULL || csv_data == NULL) {
return -1; return -1;
} }
@ -176,7 +173,7 @@ int parse_csv_to_table(lv_obj_t *container, const char *csv_data) {
user = (UserData *)rt_memheap_alloc(&sdram_heap, sizeof(UserData)); user = (UserData *)rt_memheap_alloc(&sdram_heap, sizeof(UserData));
// 解析 CSV // 解析 CSV
if (parse_csv_string(container, csv_data, user) != 0) { if (parse_csv_string(csv_data, user) != 0) {
return -1; return -1;
} }
@ -205,3 +202,40 @@ int parse_csv_to_table(lv_obj_t *container, const char *csv_data) {
return 0; return 0;
} }
char value_[512] = {0};
int parse_csv_to_inf(lv_obj_t *container, const char *csv_data ,int W_data,int H_data) {
if (csv_data == NULL) {
return 0;
}
user = (UserData *)rt_memheap_alloc(&sdram_heap, sizeof(UserData));
int text_row = 0;
// 解析 CSV
if (parse_csv_string(csv_data, user) != 0) {
return 0;
}
// 填充数据
for (int i = 0; i < 512; i++)
{
value_[i] = 0;
}
for (int j = 0; j < user->max_cols; j++) {
text_row = j*28;
rt_snprintf(value_, sizeof(value_),"%s%s:%s\n",value_,csv_get_cell(user, 0, j),csv_get_cell(user, 1, j));
}
// 显示框大小
if (text_row<H_data) {
text_row=H_data;
}
lv_obj_set_size(container, W_data, text_row);
lv_label_set_text(container,value_);
// 释放内存
rt_memheap_free(user);
return 0;
}

1
applications/lvgl/ui_data_csv.h

@ -11,5 +11,6 @@
#define APPLICATIONS_LVGL_UI_DATA_CSV_H_ #define APPLICATIONS_LVGL_UI_DATA_CSV_H_
int parse_csv_to_table(lv_obj_t *container, const char *csv_data); int parse_csv_to_table(lv_obj_t *container, const char *csv_data);
int parse_csv_to_inf(lv_obj_t *container, const char *csv_data ,int W_data,int H_data);
#endif /* APPLICATIONS_LVGL_UI_DATA_CSV_H_ */ #endif /* APPLICATIONS_LVGL_UI_DATA_CSV_H_ */

54
applications/lvgl/ui_data_labels.c

@ -304,13 +304,18 @@ char* get_time_str(char *buf, size_t size)
int Work_Program_DATA=0; int Work_Program_DATA=0;
char select_data_ui[4096]= {0}; char select_data_ui[4096]= {0};
char sqlSELECT[512] = {0}; // 初始化为 0
//工单页面的工艺/工单表
void Work_Program_ui(void) void Work_Program_ui(void)
{ {
//清楚点击行记录
Work_row = -1;
Work_step_row = -1;
Work_Program_DATA = ~Work_Program_DATA; Work_Program_DATA = ~Work_Program_DATA;
if(Work_Program_DATA==0) if(Work_Program_DATA==0)
{ {
char sqlSELECT[512] = {0}; // 初始化为 0
char time_str[32]; char time_str[32];
if (get_time_str(time_str, sizeof(time_str)) != RT_NULL) if (get_time_str(time_str, sizeof(time_str)) != RT_NULL)
{ {
@ -328,4 +333,51 @@ void Work_Program_ui(void)
// 表格绘图 // 表格绘图
parse_csv_to_table(guider_ui.screen_list_inf, select_data_ui); parse_csv_to_table(guider_ui.screen_list_inf, select_data_ui);
} }
lv_table_set_col_cnt(guider_ui.screen_w_list,2);
}
//工单页面的步骤信息表
void Work_Program_step_ui(char* str_data)
{
if(Work_Program_DATA==0)
{
// 安全格式化
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s'%s' ORDER BY Step ASC;",select_WorkorderSteps_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
// 表格绘图
parse_csv_to_table(guider_ui.screen_w_list, select_data_ui);
lv_table_set_col_width(guider_ui.screen_w_list, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list, 1, 250);
}
else
{
// 安全格式化
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s'%s' ORDER BY Step ASC;",select_ProgramSteps_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
// 表格绘图
parse_csv_to_table(guider_ui.screen_w_list, select_data_ui);
lv_table_set_col_width(guider_ui.screen_w_list, 0, 50);
lv_table_set_col_width(guider_ui.screen_w_list, 1, 250);
}
}
//工单页面的步骤详细
void Work_Program_stepINF_ui(char* str_data)
{
if(Work_Program_DATA==0)
{
// 安全格式化
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s WorkOrder = '%s LIMIT 1;",select_WorkorderStepsinf_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
//信息显示
parse_csv_to_inf(guider_ui.screen_text_inf,select_data_ui,550,230);
}
else
{
// 安全格式化
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s ProgramID = '%s LIMIT 1;",select_ProgramStepsinf_DATA,str_data);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
//信息显示
parse_csv_to_inf(guider_ui.screen_text_inf,select_data_ui,550,230);
}
} }

17
applications/lvgl/ui_data_labels.h

@ -12,9 +12,22 @@
#define select_WorkOrder_DATA "SELECT WorkOrder AS 工单,ProgramName AS 工艺 ,Dyelot || '@' || ReDye AS 领料单,\ #define select_WorkOrder_DATA "SELECT WorkOrder AS 工单,ProgramName AS 工艺 ,Dyelot || '@' || ReDye AS 领料单,\
StartTime AS ,EndTime AS ,Time AS ,lock AS ,State AS ,USER AS FROM WorkOrder WHERE State=101 AND EndTime > " StartTime AS ,EndTime AS ,Time AS ,lock AS ,State AS ,USER AS FROM WorkOrder WHERE State=101 AND EndTime > "
#define select_Program_DATA "SELECT ProgramName AS 工艺 ,Step AS 步骤,Time AS 预计时间 FROM ProgramName" #define select_Program_DATA "SELECT ProgramName AS 工艺 ,Step AS 步骤,Time AS 预计时间 FROM ProgramName"
#define select_ProgramSteps_DATA "SELECT Step AS 步 ,StepName AS 步骤工艺 FROM ProgramSteps WHERE Program="
#define select_WorkorderSteps_DATA "SELECT Step AS 步 ,StepName AS 步骤工艺 FROM WorkorderSteps WHERE WorkOrder="
#define select_ProgramStepsinf_DATA "SELECT Program AS 工艺 ,Step AS 步号 ,StepName AS 步骤工艺 , ParameterName AS 细节,\
P1 AS 1 ,P2 AS 2 ,P3 AS 3 ,P4 AS 4 ,P5 AS 5 ,StepName_S1 AS 1 ,P1_S1 AS 1_1 ,P2_S1 AS 1_2,\
P3_S1 AS 1_3 ,P4_S1 AS 1_4 ,P5_S1 AS 1_5 ,StepName_S2 AS 2 ,P1_S2 AS 2_1 ,P2_S2 AS 2_2, \
P3_S2 AS 2_3 ,P4_S2 AS 2_4 ,P5_S2 AS 2_5 FROM ProgramSteps WHERE"
#define select_WorkorderStepsinf_DATA "SELECT Program AS 工艺 ,Step AS 步号 ,StepName AS 步骤 , ParameterName AS 细节,\
P1 AS 1 ,P2 AS 2 ,P3 AS 3 ,P4 AS 4 ,P5 AS 5 ,StepName_S1 AS 1 ,P1_S1 AS 1_1 ,P2_S1 AS 1_2,\
P3_S1 AS 1_3 ,P4_S1 AS 1_4 ,P5_S1 AS 1_5 ,StepName_S2 AS 2 ,P1_S2 AS 2_1 ,P2_S2 AS 2_2, \
P3_S2 AS 2_3 ,P4_S2 AS 2_4 ,P5_S2 AS 2_5 FROM WorkorderSteps WHERE"
#define select_Workorderinf_DATA "SELECT WorkOrder AS 工单 ,Dyelot || '@' || ReDye AS 领料单,ColorNumber AS 代码,\
ColorName AS ,Client ,ClothWeight ,ClothSpecies ,BathRatio ,Total ,Remark FROM WorkOrder WHERE"
typedef struct { typedef struct {
char WorkOrder[32]; char WorkOrder[32];
char Dyelot[32]; // 单号 char Dyelot[32]; // 单号
@ -85,5 +98,7 @@ char* get_time_str(char *buf, size_t size);
void Work_Program_ui(void); void Work_Program_ui(void);
void Work_Program_step_ui(char* str_data);
void Work_Program_stepINF_ui(char* str_data);
#endif /* APPLICATIONS_LVGL_UI_DATA_LABELS_H_ */ #endif /* APPLICATIONS_LVGL_UI_DATA_LABELS_H_ */

Loading…
Cancel
Save