Browse Source

程序页面添加删除功能

master
忱 沈 5 months ago
parent
commit
5d5b79ed18
  1. 4
      applications/lvgl/guider/custom/custom.c
  2. 59
      applications/lvgl/guider/generated/events_init.c
  3. 8
      applications/lvgl/guider/generated/gui_guider.h
  4. 160
      applications/lvgl/guider/generated/setup_scr_screen.c
  5. 36
      applications/lvgl/ui_data_csv.c
  6. 110
      applications/lvgl/ui_data_labels.c
  7. 11
      applications/lvgl/ui_data_labels.h
  8. 3
      applications/lvgl/ui_data_labels_step.c
  9. 8
      applications/sql/DB_SQLite.c

4
applications/lvgl/guider/custom/custom.c

@ -12,6 +12,7 @@
* INCLUDES
*********************/
#include <stdio.h>
#include <stdlib.h>
#include "lvgl.h"
#include "custom.h"
#include <guider/generated/events_init.h>
@ -180,10 +181,11 @@ static void table_click_event_cb(lv_event_t *e) {
pname_row = row;// 写入行号
rt_snprintf(value_W, sizeof(value_W),lv_table_get_cell_value(guider_ui.screen_pname_row, row, 0));
UI_pname_step_row(value_W);
UI_pname_step_inf(value_W,0);
}
else if(table == guider_ui.screen_pname_step_row){//工艺程序细节信息
pname_step_row = row;// 写入行号
value_S = lv_table_get_cell_value(guider_ui.screen_pname_step_row, row, 0);
value_S = atoi(lv_table_get_cell_value(guider_ui.screen_pname_step_row, row, 0));
UI_pname_step_inf(value_W,value_S);
}
}

59
applications/lvgl/guider/generated/events_init.c

@ -300,6 +300,7 @@ static void screen_set_Delete_event_handler (lv_event_t *e)
switch (code) {
case LV_EVENT_CLICKED:
{
lv_obj_clear_flag(guider_ui.screen_step_DELETE, LV_OBJ_FLAG_HIDDEN);
break;
}
default:
@ -347,7 +348,7 @@ static void screen_stepinf_s1_event_handler (lv_event_t *e)
switch (code) {
case LV_EVENT_CLICKED:
{
//uint16_t id = lv_dropdown_get_selected(guider_ui.screen_stepinf_s1);
uint16_t id = lv_dropdown_get_selected(guider_ui.screen_stepinf_s1);
lv_obj_clear_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s2b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s3b, LV_OBJ_FLAG_HIDDEN);
@ -364,7 +365,7 @@ static void screen_stepinf_s2_event_handler (lv_event_t *e)
switch (code) {
case LV_EVENT_CLICKED:
{
//uint16_t id = lv_dropdown_get_selected(guider_ui.screen_stepinf_s2);
uint16_t id = lv_dropdown_get_selected(guider_ui.screen_stepinf_s2);
lv_obj_add_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_flag(guider_ui.screen_stepinf_s2b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s3b, LV_OBJ_FLAG_HIDDEN);
@ -381,7 +382,7 @@ static void screen_stepinf_s3_event_handler (lv_event_t *e)
switch (code) {
case LV_EVENT_CLICKED:
{
//uint16_t id = lv_dropdown_get_selected(guider_ui.screen_stepinf_s3);
uint16_t id = lv_dropdown_get_selected(guider_ui.screen_stepinf_s3);
lv_obj_add_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s2b, LV_OBJ_FLAG_HIDDEN);
lv_obj_clear_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
@ -399,6 +400,55 @@ static void screen_btn_1_event_handler (lv_event_t *e)
case LV_EVENT_CLICKED:
{
lv_obj_add_flag(guider_ui.screen_stepinf, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s3b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s2b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
break;
}
default:
break;
}
}
static void screen_btn_2_event_handler (lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
switch (code) {
case LV_EVENT_CLICKED:
{
lv_obj_add_flag(guider_ui.screen_stepinf, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s1b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s2b, LV_OBJ_FLAG_HIDDEN);
lv_obj_add_flag(guider_ui.screen_stepinf_s3b, LV_OBJ_FLAG_HIDDEN);
break;
}
default:
break;
}
}
static void screen_step_DELETE_no_event_handler (lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
switch (code) {
case LV_EVENT_CLICKED:
{
lv_obj_add_flag(guider_ui.screen_step_DELETE, LV_OBJ_FLAG_HIDDEN);
break;
}
default:
break;
}
}
static void screen_step_DELETE_yes_event_handler (lv_event_t *e)
{
lv_event_code_t code = lv_event_get_code(e);
switch (code) {
case LV_EVENT_CLICKED:
{
UI_pname_del();
lv_obj_add_flag(guider_ui.screen_step_DELETE, LV_OBJ_FLAG_HIDDEN);
break;
}
default:
@ -434,6 +484,9 @@ void events_init_screen (lv_ui *ui)
lv_obj_add_event_cb(ui->screen_stepinf_s2, screen_stepinf_s2_event_handler, LV_EVENT_ALL, ui);
lv_obj_add_event_cb(ui->screen_stepinf_s3, screen_stepinf_s3_event_handler, LV_EVENT_ALL, ui);
lv_obj_add_event_cb(ui->screen_btn_1, screen_btn_1_event_handler, LV_EVENT_ALL, ui);
lv_obj_add_event_cb(ui->screen_btn_2, screen_btn_2_event_handler, LV_EVENT_ALL, ui);
lv_obj_add_event_cb(ui->screen_step_DELETE_no, screen_step_DELETE_no_event_handler, LV_EVENT_ALL, ui);
lv_obj_add_event_cb(ui->screen_step_DELETE_yes, screen_step_DELETE_yes_event_handler, LV_EVENT_ALL, ui);
}

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

@ -476,6 +476,14 @@ typedef struct
lv_obj_t *screen_label_52;
lv_obj_t *screen_stepinf_step;
lv_obj_t *screen_label_53;
lv_obj_t *screen_step_DELETE;
lv_obj_t *screen_step_DELETE_no;
lv_obj_t *screen_step_DELETE_no_label;
lv_obj_t *screen_step_DELETE_yes;
lv_obj_t *screen_step_DELETE_yes_label;
lv_obj_t *screen_step_DELETE_namep;
lv_obj_t *screen_step_DELETE_name;
lv_obj_t *screen_step_DELETE_inf;
lv_obj_t *g_kb_top_layer;
lv_obj_t *screen_w_list;
lv_obj_t *screen_list_inf;

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

@ -7614,8 +7614,8 @@ void setup_scr_screen(lv_ui *ui)
lv_textarea_set_placeholder_text(ui->screen_stepinf_p1, "");
lv_textarea_set_password_bullet(ui->screen_stepinf_p1, "*");
lv_textarea_set_password_mode(ui->screen_stepinf_p1, false);
lv_textarea_set_one_line(ui->screen_stepinf_p1, false);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p1, "");
lv_textarea_set_one_line(ui->screen_stepinf_p1, true);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p1, "0123456789.");
lv_textarea_set_max_length(ui->screen_stepinf_p1, 32);
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
lv_obj_add_event_cb(ui->screen_stepinf_p1, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer);
@ -7654,8 +7654,8 @@ void setup_scr_screen(lv_ui *ui)
lv_textarea_set_placeholder_text(ui->screen_stepinf_p2, "");
lv_textarea_set_password_bullet(ui->screen_stepinf_p2, "*");
lv_textarea_set_password_mode(ui->screen_stepinf_p2, false);
lv_textarea_set_one_line(ui->screen_stepinf_p2, false);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p2, "");
lv_textarea_set_one_line(ui->screen_stepinf_p2, true);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p2, "0123456789.");
lv_textarea_set_max_length(ui->screen_stepinf_p2, 32);
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
lv_obj_add_event_cb(ui->screen_stepinf_p2, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer);
@ -7694,8 +7694,8 @@ void setup_scr_screen(lv_ui *ui)
lv_textarea_set_placeholder_text(ui->screen_stepinf_p3, "");
lv_textarea_set_password_bullet(ui->screen_stepinf_p3, "*");
lv_textarea_set_password_mode(ui->screen_stepinf_p3, false);
lv_textarea_set_one_line(ui->screen_stepinf_p3, false);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p3, "");
lv_textarea_set_one_line(ui->screen_stepinf_p3, true);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p3, "0123456789.");
lv_textarea_set_max_length(ui->screen_stepinf_p3, 32);
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
lv_obj_add_event_cb(ui->screen_stepinf_p3, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer);
@ -7734,8 +7734,8 @@ void setup_scr_screen(lv_ui *ui)
lv_textarea_set_placeholder_text(ui->screen_stepinf_p4, "");
lv_textarea_set_password_bullet(ui->screen_stepinf_p4, "*");
lv_textarea_set_password_mode(ui->screen_stepinf_p4, false);
lv_textarea_set_one_line(ui->screen_stepinf_p4, false);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p4, "");
lv_textarea_set_one_line(ui->screen_stepinf_p4, true);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p4, "0123456789.");
lv_textarea_set_max_length(ui->screen_stepinf_p4, 32);
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
lv_obj_add_event_cb(ui->screen_stepinf_p4, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer);
@ -7774,8 +7774,8 @@ void setup_scr_screen(lv_ui *ui)
lv_textarea_set_placeholder_text(ui->screen_stepinf_p5, "");
lv_textarea_set_password_bullet(ui->screen_stepinf_p5, "*");
lv_textarea_set_password_mode(ui->screen_stepinf_p5, false);
lv_textarea_set_one_line(ui->screen_stepinf_p5, false);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p5, "");
lv_textarea_set_one_line(ui->screen_stepinf_p5, true);
lv_textarea_set_accepted_chars(ui->screen_stepinf_p5, "0123456789.");
lv_textarea_set_max_length(ui->screen_stepinf_p5, 32);
#if LV_USE_KEYBOARD != 0 || LV_USE_ZH_KEYBOARD != 0
lv_obj_add_event_cb(ui->screen_stepinf_p5, ta_event_cb, LV_EVENT_ALL, ui->g_kb_top_layer);
@ -8166,6 +8166,146 @@ void setup_scr_screen(lv_ui *ui)
lv_obj_set_style_pad_left(ui->screen_label_53, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_label_53, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_DELETE
ui->screen_step_DELETE = lv_obj_create(ui->screen);
lv_obj_set_pos(ui->screen_step_DELETE, 400, 105);
lv_obj_set_size(ui->screen_step_DELETE, 300, 380);
lv_obj_set_scrollbar_mode(ui->screen_step_DELETE, LV_SCROLLBAR_MODE_OFF);
lv_obj_add_flag(ui->screen_step_DELETE, LV_OBJ_FLAG_HIDDEN);
//Write style for screen_step_DELETE, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_step_DELETE, 5, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui->screen_step_DELETE, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui->screen_step_DELETE, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_side(ui->screen_step_DELETE, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_step_DELETE, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_step_DELETE, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_step_DELETE, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_step_DELETE, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_step_DELETE, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_step_DELETE, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_step_DELETE, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_step_DELETE, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_DELETE, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_DELETE_no
ui->screen_step_DELETE_no = lv_btn_create(ui->screen_step_DELETE);
ui->screen_step_DELETE_no_label = lv_label_create(ui->screen_step_DELETE_no);
lv_label_set_text(ui->screen_step_DELETE_no_label, "取消");
lv_label_set_long_mode(ui->screen_step_DELETE_no_label, LV_LABEL_LONG_WRAP);
lv_obj_align(ui->screen_step_DELETE_no_label, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_pad_all(ui->screen_step_DELETE_no, 0, LV_STATE_DEFAULT);
lv_obj_set_width(ui->screen_step_DELETE_no_label, LV_PCT(100));
lv_obj_set_pos(ui->screen_step_DELETE_no, 25, 290);
lv_obj_set_size(ui->screen_step_DELETE_no, 100, 50);
//Write style for screen_step_DELETE_no, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_text_color(ui->screen_step_DELETE_no, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_step_DELETE_no, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_step_DELETE_no, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_step_DELETE_no, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_step_DELETE_no, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_step_DELETE_no, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_step_DELETE_no, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_width(ui->screen_step_DELETE_no, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_DELETE_no, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_step_DELETE_no, 5, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_DELETE_yes
ui->screen_step_DELETE_yes = lv_btn_create(ui->screen_step_DELETE);
ui->screen_step_DELETE_yes_label = lv_label_create(ui->screen_step_DELETE_yes);
lv_label_set_text(ui->screen_step_DELETE_yes_label, "确认");
lv_label_set_long_mode(ui->screen_step_DELETE_yes_label, LV_LABEL_LONG_WRAP);
lv_obj_align(ui->screen_step_DELETE_yes_label, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_style_pad_all(ui->screen_step_DELETE_yes, 0, LV_STATE_DEFAULT);
lv_obj_set_width(ui->screen_step_DELETE_yes_label, LV_PCT(100));
lv_obj_set_pos(ui->screen_step_DELETE_yes, 165, 290);
lv_obj_set_size(ui->screen_step_DELETE_yes, 100, 50);
//Write style for screen_step_DELETE_yes, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_bg_opa(ui->screen_step_DELETE_yes, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_color(ui->screen_step_DELETE_yes, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_grad_dir(ui->screen_step_DELETE_yes, LV_GRAD_DIR_NONE, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_width(ui->screen_step_DELETE_yes, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_step_DELETE_yes, 5, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_DELETE_yes, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui->screen_step_DELETE_yes, lv_color_hex(0xffffff), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_step_DELETE_yes, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_step_DELETE_yes, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_step_DELETE_yes, LV_TEXT_ALIGN_CENTER, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_DELETE_namep
ui->screen_step_DELETE_namep = lv_label_create(ui->screen_step_DELETE);
lv_label_set_text(ui->screen_step_DELETE_namep, "工艺");
lv_label_set_long_mode(ui->screen_step_DELETE_namep, LV_LABEL_LONG_WRAP);
lv_obj_set_pos(ui->screen_step_DELETE_namep, 10, 15);
lv_obj_set_size(ui->screen_step_DELETE_namep, 50, 25);
//Write style for screen_step_DELETE_namep, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui->screen_step_DELETE_namep, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_step_DELETE_namep, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_step_DELETE_namep, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_letter_space(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_line_space(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_step_DELETE_namep, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_DELETE_namep, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_DELETE_name
ui->screen_step_DELETE_name = lv_label_create(ui->screen_step_DELETE);
lv_label_set_text(ui->screen_step_DELETE_name, "工艺");
lv_label_set_long_mode(ui->screen_step_DELETE_name, LV_LABEL_LONG_WRAP);
lv_obj_set_pos(ui->screen_step_DELETE_name, 105, 15);
lv_obj_set_size(ui->screen_step_DELETE_name, 180, 25);
//Write style for screen_step_DELETE_name, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui->screen_step_DELETE_name, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_step_DELETE_name, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_step_DELETE_name, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_letter_space(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_line_space(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_step_DELETE_name, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_DELETE_name, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//Write codes screen_step_DELETE_inf
ui->screen_step_DELETE_inf = lv_label_create(ui->screen_step_DELETE);
lv_label_set_text(ui->screen_step_DELETE_inf, "信息");
lv_label_set_long_mode(ui->screen_step_DELETE_inf, LV_LABEL_LONG_WRAP);
lv_obj_set_pos(ui->screen_step_DELETE_inf, 5, 50);
lv_obj_set_size(ui->screen_step_DELETE_inf, 280, 200);
//Write style for screen_step_DELETE_inf, Part: LV_PART_MAIN, State: LV_STATE_DEFAULT.
lv_obj_set_style_border_width(ui->screen_step_DELETE_inf, 1, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_opa(ui->screen_step_DELETE_inf, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_color(ui->screen_step_DELETE_inf, lv_color_hex(0x2195f6), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_border_side(ui->screen_step_DELETE_inf, LV_BORDER_SIDE_FULL, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_radius(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_color(ui->screen_step_DELETE_inf, lv_color_hex(0x000000), LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_font(ui->screen_step_DELETE_inf, &lv_font_simsun_24, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_opa(ui->screen_step_DELETE_inf, 255, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_letter_space(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_line_space(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_text_align(ui->screen_step_DELETE_inf, LV_TEXT_ALIGN_LEFT, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_top(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_right(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_bottom(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_pad_left(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
lv_obj_set_style_shadow_width(ui->screen_step_DELETE_inf, 0, LV_PART_MAIN|LV_STATE_DEFAULT);
//The custom code of screen.

36
applications/lvgl/ui_data_csv.c

@ -372,30 +372,18 @@ IO_STEP_DATA step_csv_to_table(const char *csv_data) {
temp.Parameter3 = atof(csv_get_cell(user, 1, 6));
temp.Parameter4 = atof(csv_get_cell(user, 1, 7));
temp.Parameter5 = atof(csv_get_cell(user, 1, 8));
temp.P6 = atoi(csv_get_cell(user, 1, 9));
temp.P7 = atoi(csv_get_cell(user, 1, 10));
temp.P8 = atoi(csv_get_cell(user, 1, 11));
temp.P9 = atoi(csv_get_cell(user, 1, 12));
temp.P10 = atoi(csv_get_cell(user, 1, 13));
temp.Parameter1_S1 = atof(csv_get_cell(user, 1, 14));
temp.Parameter2_S1 = atof(csv_get_cell(user, 1, 15));
temp.Parameter3_S1 = atof(csv_get_cell(user, 1, 16));
temp.Parameter4_S1 = atof(csv_get_cell(user, 1, 17));
temp.Parameter5_S1 = atof(csv_get_cell(user, 1, 18));
temp.Parameter1_S2 = atof(csv_get_cell(user, 1, 19));
temp.Parameter2_S2 = atof(csv_get_cell(user, 1, 20));
temp.Parameter3_S2 = atof(csv_get_cell(user, 1, 21));
temp.Parameter4_S2 = atof(csv_get_cell(user, 1, 22));
temp.Parameter5_S2 = atof(csv_get_cell(user, 1, 23));
temp.Parameter1_S3 = atof(csv_get_cell(user, 1, 24));
temp.Parameter2_S3 = atof(csv_get_cell(user, 1, 25));
temp.Parameter3_S3 = atof(csv_get_cell(user, 1, 26));
temp.Parameter4_S3 = atof(csv_get_cell(user, 1, 27));
temp.Parameter5_S3 = atof(csv_get_cell(user, 1, 28));
temp.ReDye = atoi(csv_get_cell(user, 1, 29));
rt_snprintf(temp.StepID_S1, 3,csv_get_cell(user, 1, 30));
rt_snprintf(temp.StepID_S2, 3,csv_get_cell(user, 1, 31));
rt_snprintf(temp.StepID_S3, 3,csv_get_cell(user, 1, 32));
temp.Parameter1_S1 = atof(csv_get_cell(user, 1, 9));
temp.Parameter2_S1 = atof(csv_get_cell(user, 1, 10));
temp.Parameter3_S1 = atof(csv_get_cell(user, 1, 11));
temp.Parameter4_S1 = atof(csv_get_cell(user, 1, 12));
temp.Parameter5_S1 = atof(csv_get_cell(user, 1, 13));
temp.Parameter1_S2 = atof(csv_get_cell(user, 1, 14));
temp.Parameter2_S2 = atof(csv_get_cell(user, 1, 15));
temp.Parameter3_S2 = atof(csv_get_cell(user, 1, 16));
temp.Parameter4_S2 = atof(csv_get_cell(user, 1, 17));
temp.Parameter5_S2 = atof(csv_get_cell(user, 1, 18));
rt_snprintf(temp.StepID_S1, 3,csv_get_cell(user, 1, 19));
rt_snprintf(temp.StepID_S2, 3,csv_get_cell(user, 1, 20));
// 释放内存
rt_memheap_free(user);

110
applications/lvgl/ui_data_labels.c

@ -433,7 +433,7 @@ void Work_start(void)
}
}
//
//===========程序页面==============
void UI_pname_row(void)
{
pname_row = -1;
@ -470,7 +470,14 @@ void UI_pname_step_row(char* str_data)
// 查询工艺数据
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);
// 表格绘图
//添加删除信息
lv_label_set_text(guider_ui.screen_step_DELETE_name,str_data);
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"删除工艺:'%s'",str_data);
lv_label_set_text(guider_ui.screen_step_DELETE_inf,sqlSELECT);
rt_snprintf(UI_pname_Program, sizeof(UI_pname_Program),str_data);
// 步骤表格绘图
if((select_data_ui[0]=='N')&&(select_data_ui[1]=='o')){
lv_table_set_col_cnt(guider_ui.screen_pname_step_row,2);
lv_table_set_row_cnt(guider_ui.screen_pname_step_row,0);
@ -483,25 +490,110 @@ void UI_pname_step_row(char* str_data)
parse_csv_to_table(guider_ui.screen_pname_step_row, select_data_ui,0);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 0, 50);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 1, 250);
}
//程序页面的编辑
IO_STEP_DATA UI_pname_step_inf_temp ={0};
char UI_pname_Program[32]={0};
int8_t UI_pname_Program_row=0;
void UI_pname_step_inf(char* str_data,int row)
{
if(row==0)
{
// 查询数据
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"%s Program = '%s' AND Step = %d LIMIT 1;",select_Programstep_R,str_data);
rt_kprintf(sqlSELECT);
db_send_select(DB_CMD_SELECT, sqlSELECT, 500,select_data_ui);
rt_kprintf(select_data_ui);
UI_pname_step_inf_temp = step_csv_to_table(select_data_ui);
rt_snprintf(UI_pname_step_inf_temp.Program, sizeof(UI_pname_step_inf_temp.Program),str_data);
UI_pname_step_inf_temp.Step = row;
}else{
UI_pname_step_inf_temp = step_csv_to_table(select_data_ui);
UI_pname_step_inf_temp.Step = row;
}
STEP_DATA_set_ui(&UI_pname_step_inf_temp);
STEP_DATA_set_ui(&UI_pname_step_inf_temp);
//添加删除信息
if(row!=0)
{
lv_label_set_text(guider_ui.screen_step_DELETE_name,str_data);
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"工艺:'%s\n删除步骤:%d'",str_data ,row);
lv_label_set_text(guider_ui.screen_step_DELETE_inf,sqlSELECT);
UI_pname_Program_row = row;
}
}
//删除功能
void UI_pname_step_del(char* str_data,int row)
{
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"DELETE FROM ProgramSteps WHERE Program= '%s' AND Step = %d",str_data,row);
if( db_send_command(DB_CMD_EXEC, sqlSELECT, 500)==RT_EOK) //
{
// 查询工艺数据
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);
// 表格绘图
if((select_data_ui[0]=='N')&&(select_data_ui[1]=='o'))
{
lv_table_set_col_cnt(guider_ui.screen_pname_step_row,2);
lv_table_set_row_cnt(guider_ui.screen_pname_step_row,0);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 0, 50);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 1, 250);
lv_table_set_cell_value(guider_ui.screen_pname_step_row,0,0,"");
lv_table_set_cell_value(guider_ui.screen_pname_step_row,0,1,"步骤工艺");
return;
}
parse_csv_to_table(guider_ui.screen_pname_step_row, select_data_ui,0);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 0, 50);
lv_table_set_col_width(guider_ui.screen_pname_step_row, 1, 250);
}
}
void UI_pname_row_del(char* str_data)
{
//删除
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"DELETE FROM ProgramName WHERE ProgramName= '%s'",str_data);
if( db_send_command(DB_CMD_EXEC, sqlSELECT, 500)==RT_EOK) //
{
rt_snprintf(sqlSELECT, sizeof(sqlSELECT),"DELETE FROM ProgramSteps WHERE Program= '%s'",str_data);
db_send_command(DB_CMD_EXEC, sqlSELECT, 500);
}
pname_row = -1;
pname_step_row = -1;
// 查询工艺数据和返回行数
db_send_select(DB_CMD_SELECT, select_Program_DATA, 500,select_data_ui);
// 表格绘图
int select_row = parse_csv_to_table(guider_ui.screen_pname_row, select_data_ui,0);
lv_table_set_col_width(guider_ui.screen_pname_row, 0, 430);
lv_table_set_col_width(guider_ui.screen_pname_row, 1, 80);
lv_table_set_col_width(guider_ui.screen_pname_row, 2, 200);
if(select_row >0 && select_row <255)
{
//有多少工艺
char name_select_row[8] = {0};
rt_snprintf(name_select_row, sizeof(name_select_row),"%d/255",select_row-1);
lv_label_set_text(guider_ui.screen_step_,name_select_row);
}else{ lv_label_set_text(guider_ui.screen_step_,"---/255");}
lv_textarea_set_text(guider_ui.screen_pname_set,"工艺");
}
//删除信息
void UI_pname_del()
{
if(UI_pname_Program[0] != '\0'){
if(UI_pname_Program_row==0)
{
UI_pname_row_del(UI_pname_Program);
}else{
UI_pname_step_del(UI_pname_Program,UI_pname_Program_row);
}
}
UI_pname_Program[0]='\0';
UI_pname_Program_row =0;
}

11
applications/lvgl/ui_data_labels.h

@ -21,9 +21,8 @@ StartTime AS 预计开始,EndTime AS 预计完成,Time AS 预计用时,lock AS
#define select_Workordersteps_R "SELECT Dyelot,StepID,StepName,ParameterName,P1,P2,P3,P4,P5,P6,P7,P8,P9,\
P1_S1,P2_S1,P3_S1,P4_S1,P5_S1,P1_S2,P2_S2,P3_S2,P4_S2,P5_S2,P1_S3,P2_S3,P3_S3,P4_S3,P5_S3,ReDye,\
StepID_S1,StepID_S2,StepID_S3 FROM WorkorderSteps WHERE "
#define select_Programstep_R "SELECT ProgramID,StepID,StepName,ParameterName,P1,P2,P3,P4,P5,P6,P7,P8,P9,\
P1_S1,P2_S1,P3_S1,P4_S1,P5_S1,P1_S2,P2_S2,P3_S2,P4_S2,P5_S2,P1_S3,P2_S3,P3_S3,P4_S3,P5_S3,ReDye,\
StepID_S1,StepID_S2,StepID_S3 FROM ProgramSteps WHERE"
#define select_Programstep_R "SELECT ProgramID,StepID,StepName,ParameterName,P1,P2,P3,P4,P5,P1_S1,P2_S1,\
P3_S1,P4_S1,P5_S1,P1_S2,P2_S2,P3_S2,P4_S2,P5_S2,StepID_S1,StepID_S2 FROM ProgramSteps WHERE"
#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,\
@ -109,9 +108,15 @@ void Work_Program_step_ui(char* str_data);
void Work_Program_stepINF_ui(char* str_data);
void Work_start(void);
//程序页面
extern char UI_pname_Program[32];
extern int8_t UI_pname_Program_row;
void UI_pname_row(void);
void UI_pname_step_row(char* str_data);
void UI_pname_step_inf(char* str_data,int row);
void UI_pname_step_del(char* str_data,int row);
void UI_pname_row_del(char* str_data);
void UI_pname_del();
//step
#include <data/SC828_DATA_table.h>

3
applications/lvgl/ui_data_labels_step.c

@ -72,8 +72,9 @@ void STEP_DATA_set_ui(IO_STEP_DATA* STEPDATA_inf)
char str_str[32];
lv_snprintf(str_str, sizeof(str_str), "%d", STEPDATA_inf->Step);
lv_label_set_text(guider_ui.screen_stepinf_step,(const char *)str_str);
lv_label_set_text(guider_ui.screen_stepinf_name,(const char *)STEPDATA_inf->StepName);
lv_label_set_text(guider_ui.screen_stepinf_name,(const char *)STEPDATA_inf->Program);
lv_label_set_text(guider_ui.screen_stepinf_s1b,get_step_name(STEPDATA_inf->StepID));
lv_label_set_text(guider_ui.screen_stepinf_s2b,get_step_name(STEPDATA_inf->StepID_S1));
lv_label_set_text(guider_ui.screen_stepinf_s3b,get_step_name(STEPDATA_inf->StepID_S2));
}

8
applications/sql/DB_SQLite.c

@ -43,11 +43,9 @@ extern int sqlite3_init_with_sdram_heap(void);
static const char *sql_upgrade_program_steps =
"CREATE TABLE ProgramSteps (ProgramID VARCHAR,Program VARCHAR,Mode VARCHAR,Step INT,StepID VARCHAR,StepName VARCHAR,"
"ParameterName VARCHAR,P1 DOUBLE,P2 DOUBLE,P3 DOUBLE,P4 DOUBLE,P5 DOUBLE,P6 INT,P7 INT,P8 INT,P9 INT,P10 INT,"
"Remark VARCHAR,StepTime INT,StepID_S1 VARCHAR,StepID_S2 VARCHAR,StepID_S3 VARCHAR,StepName_S1 VARCHAR,"
"StepName_S2 VARCHAR,StepName_S3 VARCHAR,P1_S1 DOUBLE,P1_S2 DOUBLE,P1_S3 DOUBLE,P2_S1 DOUBLE,P2_S2 DOUBLE,"
"P2_S3 DOUBLE,P3_S1 DOUBLE,P3_S2 DOUBLE,P3_S3 DOUBLE,P4_S1 DOUBLE,P4_S2 DOUBLE,P4_S3 DOUBLE,P5_S1 DOUBLE,"
"P5_S2 DOUBLE,P5_S3 DOUBLE); ";
"ParameterName VARCHAR,P1 DOUBLE,P2 DOUBLE,P3 DOUBLE,P4 DOUBLE,P5 DOUBLE,Remark VARCHAR,StepTime INT,StepID_S1 VARCHAR,"
"StepID_S2 VARCHAR,StepID_S3 VARCHAR,StepName_S1 VARCHAR,StepName_S2 VARCHAR,P1_S1 DOUBLE,P1_S2 DOUBLE,P2_S1 DOUBLE,"
"P2_S2 DOUBLE,P3_S1 DOUBLE,P3_S2 DOUBLE,P4_S1 DOUBLE,P4_S2 DOUBLE,P5_S1 DOUBLE,P5_S2 DOUBLE); ";
static const char *sql_upgrade_programname =
"CREATE TABLE ProgramName (ProgramName VARCHAR,ProgramID VARCHAR,[Group] VARCHAR,Step INT,Time VARCHAR,Notes VARCHAR); ";

Loading…
Cancel
Save