原创_企业对照编号-显示在产品选择界面_产供销
学习.交流
专业源于专注
www. onlyit. cn   
学习交流 文件下载 手册资料 交流QQ群

    

 7  1/1   1  
作者
内容
summer  [个人空间]
QQ名  summer


注册  2009-09-08
发贴数  730
精华贴  9
原创贴  7
来自  
状态  正常

级别  会员
#1»发布于2022-03-08 08:43

int 创建普通按钮右面(string 上级控件名,string 跟随控件名,string 新建控件名称,int x,int y,int 宽度,int 高度,string 文本,string 命令) 

  int gx,gy,gk,gg 
  gk=gui_get_w(跟随控件名)+宽度; 
  gg=gui_get_h(跟随控件名)+高度; 
  gx=gui_get_x(跟随控件名) +gui_get_w(跟随控件名)+x; 
  gy=gui_get_y(跟随控件名)+y; 
 
  gui_create_button(上级控件名,新建控件名称,gx,gy,gk,gg,文本,命令); 
 
  return 1; 
}; 
 
int 创建标签式按钮右边(string 上级控件名,string 跟随控件名,string 新建控件名称,int x,int y,int 宽度,int 高度,string 文本,string 命令) 

 
  int gx,gy,gk,gg 
  gk=gui_get_w(跟随控件名)+宽度; 
  gg=gui_get_h(跟随控件名)+高度; 
  gx=gui_get_x(跟随控件名)+gui_get_w(跟随控件名)+x; 
  gy=gui_get_y(跟随控件名)+y; 
 
  gui_create_speedbutton(上级控件名,新建控件名称,gx,gy,gk,gg,文本,命令); 
   
  return 1; 
}; 
 
//模糊查询: 取值控件id,查询字段 
string sql_map_eba_res(string gui_id,string db_col)  //客户对照编号表:res_eba_code_map 

   string sql; 
   //客户产品编号 
   sql+=db_col+" like '%"+gui_get_val(gui_id)+"%' "; 
   return sql; 

 
//数据区设置列数,列名列宽 
int func_def_field() 

  int col_id; 
  col_id=0; 
  db_set_field_count(11); 
  db_set_field_info(col_id++,"is_choise","选择",60); 
  db_set_field_info(col_id++,"eba_res_id","客户产品编号",60); 
  db_set_field_info(col_id++,"eba_res_name","客户产品名字",60); 
  db_set_field_info(col_id++,"ext_1","客户产品扩展1",60); 
  db_set_field_info(col_id++,"ext_2","客户产品扩展2",60); 
  db_set_field_info(col_id++,"eba_id","客户",60); 
  db_map("eba","eba_id","eba_id"); 
  db_set_field_info(col_id++,"res_id","编号",60); 
  db_set_field_info(col_id++,"res_name","名称",60); 
  db_set_field_info(col_id++,"res_spec","规格",60); 
  db_set_field_info(col_id++,"res_model","型号",60); 
  db_set_field_info(col_id++,"res_desc","描述",60); 
  return 1; 

 
//数据查询 :参数 写入表格名,附加检查条件 
int func_query(string ext_grid_id,string sql_add_tab_cond) 

  string sql; 
  sql="select '' as is_choise,g.eba_res_id,g.eba_res_name,g.ext_1,g.ext_2,g.eba_id,g.res_id,d.res_name," 
  sql+="d.res_spec,d.res_model,d.res_desc " 
  sql+="from (res_eba_code_map g inner join res d on g.res_id=d.res_id) " 
  sql+="where  1=1 " 
  sql+=sql_add_tab_cond()  //附加检查条件 
  sql+="order by g.eba_res_id,g.eba_id,g.res_id " 
  //dbg(sql) 
  db_run(sql); 
  func_def_field(); //设置列数,列名列宽 
 
  grid_show_db(ext_grid_id); 
  return 1; 

 
//业对照编号-模糊查询 
int func_fuzzy_search() 

  string sql_add_tab_cond; 
  sql_add_tab_cond=" and ("+sql_map_eba_res("fuzzy_search","g.eba_res_id");//sql模糊查询: 取值控件id,查询字段 
  sql_add_tab_cond+=" or "+sql_map_eba_res("fuzzy_search","g.eba_res_name");//sql模糊查询: 取值控件id,查询字段 
  sql_add_tab_cond+=" or "+sql_map_eba_res("fuzzy_search","g.ext_1");//sql模糊查询: 取值控件id,查询字段 
  sql_add_tab_cond+=" or "+sql_map_eba_res("fuzzy_search","g.ext_2");//sql模糊查询: 取值控件id,查询字段 
  sql_add_tab_cond+=" ) " 
  //dbg(sql_add_tab_cond) 
  //数据查询 :参数 写入表格名,附加检查条件 
  func_query("my_eba_sel_grid",sql_add_tab_cond); 
  return 1; 
}; 
 
//企业对照编号-确认增加物料 
int func_add_res() 

  string choise_res_father; //把选择上产品,按编号拼接为字符串 
  //改变企业对照窗体大小:表格编号 
  //把表格区数据写到数据区,关闭当前窗口 
  string ext_grid_id; 
  ext_grid_id="my_eba_sel_grid"; 
  int n;  //定义整数  报表行数 
  int id;  //定义整数  循环条件初始化数 
  n = grid_row_num(ext_grid_id); 
  for(id=1;id<n;id++)         
  {   
   if(grid_get_v(ext_grid_id,'is_choise',id)!="") 
   choise_res_father+=grid_get_v(ext_grid_id,'res_id',id)+"," 
  }; 
  win_close(); 
   
  //如果编号字符串为空直接返回 
  if(choise_res_father=="") 
  return 1; 
 
  string gui_id; //增加明细的窗口的标识:  不同界面标识不同需要根据实际情况修改 
  gui_id="销售订单==TForm_Voucher_Vr"; 
  change_to_win(gui_id); 
  //dbg(choise_res_father); 
  str_lst_to_db(choise_res_father); 
   
  //数据区物料增加到单据界面 
  db_go_head(); 
  int n,id; 
  n = db_row_count(); // SQL检索出报表  提取报表行数 
  for(id=1;id<=n;id++)  
  {   
   vr_add_res(db_res(0),0); 
   db_next(); 
  }; 
  vr_add_res_check(); 
   
  return 1; 
}; 
 
//参数:列名,列标题,列宽 
int gird_set_info(string grid_id,int grid_field_id,string grid_field_name,string gird_field_title,int grid_field_width) 

  grid_set_col_name(grid_id,grid_field_id,grid_field_name);  //设置:列名 
  grid_set_v(grid_id,grid_field_name,0,gird_field_title);   //设置:列标题 
  grid_set_col_width(grid_id,grid_field_name,grid_field_width);              //设置:列宽 
}; 
 
//表格设置列数,列名列宽  参数:表格名 
int grid_def_field(string grid_id)  

  gird_set_info(grid_id,0,"-","-",30); 
  int col_id; 
  col_id=1; 
  grid_set_col_num(grid_id,12); 
  gird_set_info(grid_id,col_id++,"is_choise","选择",40); 
  gird_set_info(grid_id,col_id++,"eba_res_id","客户产品编号",100); 
  gird_set_info(grid_id,col_id++,"eba_res_name","客户产品名字",100); 
  gird_set_info(grid_id,col_id++,"ext_1","客户产品扩展1",100); 
  gird_set_info(grid_id,col_id++,"ext_2","客户产品扩展2",100); 
  gird_set_info(grid_id,col_id++,"eba_id","客户",100); 
  gird_set_info(grid_id,col_id++,"res_id","编号",100); 
  grid_mark_readonly(grid_id,"res_id"); 
  gird_set_info(grid_id,col_id++,"res_name","名称",100); 
  grid_mark_readonly(grid_id,"res_name"); 
  gird_set_info(grid_id,col_id++,"res_spec","规格",100); 
  grid_mark_readonly(grid_id,"res_spec"); 
  gird_set_info(grid_id,col_id++,"res_model","型号",100); 
  grid_mark_readonly(grid_id,"res_model"); 
  gird_set_info(grid_id,col_id++,"res_desc","描述",100); 
  grid_mark_readonly(grid_id,"res_desc"); 
  return 1; 

 
//表格双击事件 
int grid_dbl() 

  string sel_res_grid; //已选择表格名 
  sel_res_grid="MG_Sel_Res"; 
 
  string ext_grid_id;//企业对照编号表格名 
  ext_grid_id="my_eba_sel_grid"; 
 
  //双击如果空白就写√ ,如果是√就空白 
  int row_id; 
  row_id=grid_cur_row(ext_grid_id); 
  string eba_res_id,eba_res_name;//企业对照编号表格名 双击行对应物料编号 名称 
  eba_res_id=grid_get_v(ext_grid_id,"res_id",row_id); 
  eba_res_name=grid_get_v(ext_grid_id,"res_name",row_id); 
  //dbg(eba_res_id); 
  //dbg(eba_res_name); 
  //dbg(row_id); 
  if(grid_get_v(ext_grid_id,"is_choise",row_id)=="") 
  { 
     grid_set_v(ext_grid_id,"is_choise",row_id,"√"); 
   //未找到时增加一行 
     if(grid_find(sel_res_grid,"res_id",eba_res_id)==-1) 
   { 
    //增加一个空白行,找到最近一行空白行,写入编号名称 
    grid_add_row_num(sel_res_grid,1); 
    int ext_row_id; 
    ext_row_id=grid_find(sel_res_grid,"res_id",""); 
    //dbg("未找到时增加一行:"+ext_row_id) 
    grid_set_v(sel_res_grid,"res_id",ext_row_id,eba_res_id); 
    grid_set_v(sel_res_grid,"res_name",ext_row_id,eba_res_name); 
    grid_set_v(sel_res_grid,"is_choise",ext_row_id,"1"); 
   } 
  } 
  else 
  { 
     grid_set_v(ext_grid_id,"is_choise",row_id,""); 
      //找到时删除该行 
   int ext_row_id; 
   ext_row_id=grid_find(sel_res_grid,"res_id",eba_res_id); 
   //dbg("找到时删除该行:"+ext_row_id) 
    
     if(ext_row_id>0) 
   { 
    //只有一行只用清空,否则删除行 
    if(grid_row_num(sel_res_grid)==1) 
    grid_clear_row(sel_res_grid,ext_row_id); 
      else 
    grid_del_row(sel_res_grid,ext_row_id); 
   } 
  } 
   
}; 
 
//企业对照编号界面新建表格:参数:新增页面编号,新增表格编号 
int eba_sel_create_grid(string ext_page_id,string ext_grid_id) 

  //增加页面控件 
  gui_create_tabsheet_page("PageControl",ext_page_id,"企业对照编号"); 
  //增加检索框 
  gui_create_edit(ext_page_id,"fuzzy_search",0,0,200,40); 
  gui_set_font_size("fuzzy_search",11); 
  gui_set_val("fuzzy_search",""); 
  创建普通按钮右面(ext_page_id,"fuzzy_search","fuzzy_search_button",0,-1,-80,3,"模糊查询","call_prog.rec.res_select.func_fuzzy_search") 
  创建普通按钮右面(ext_page_id,"fuzzy_search_button","add_res_button",0,0,20,0,"增加物料到销售订单","call_prog.rec.res_select.func_add_res") 
  gui_set_hint('add_res_button','企业对照编号选择的物料,只有用此按键增加到单据里!’); 
 
  //增加表格控件 
  int grid_x,grid_y; 
  grid_x=gui_get_x(ext_page_id); 
  grid_y=gui_get_y(ext_page_id); 
  gui_create_grid(ext_page_id,ext_grid_id,grid_x,grid_y); 
  //设置表格大小 
  int grid_w,grid_h; 
  grid_w=gui_get_w(ext_page_id); 
  grid_h=gui_get_h(ext_page_id); 
  gui_set_w(ext_grid_id,grid_w); 
  gui_set_h(ext_grid_id,grid_h-gui_get_h("fuzzy_search"));  //表格高度=控件高度-检索框高度 
 
  grid_set_row_num(ext_grid_id,2); 
  grid_set_col_num(ext_grid_id,2); 
  //表格设置列数,列名列宽  参数:表格名 
  grid_def_field(ext_grid_id); 
  grid_set_opt(ext_grid_id,'rowselect.off'); 
  //表格双击事件 
  grid_set_dbl_click_func(ext_grid_id,'rec.res_select','grid_dbl'); 
   
 
  return 1; 
}; 
 
int func_show_win() 

  //企业对照编号界面新建表格:参数:新增页面编号,新增表格编号 
  eba_sel_create_grid("my_eba_sel","my_eba_sel_grid"); 
  //msg('func_show_win'); 
  return 1; 
}; 
 
int func_win_active() 

  //msg('func_win_active'); 
  return 1; 
}; 
 
int load_over() 

  //msg('load_over'); 
  return 1; 
}; 
 
int row_change() 

  //msg('row_change'); 
  return 1; 
}; 
 
int func_win_resize() 

  //改变企业对照窗体大小:新增页面编号,新增表格编号 
  string ext_page_id,ext_grid_id; 
  ext_page_id="my_eba_sel"; 
  ext_grid_id="my_eba_sel_grid"; 
  //设置表格大小 
  int grid_w,grid_h; 
  grid_w=gui_get_w(ext_page_id); 
  grid_h=gui_get_h(ext_page_id); 
  gui_set_w(ext_grid_id,grid_w); 
  gui_set_h(ext_grid_id,grid_h-gui_get_h("fuzzy_search")); //表格高度=控件高度-检索框高度 
   
  return 1; 
};

企业对照编号-显示在产品选择界面

        




官方认证第三方服务团队  夏延明 QQ:15932787 13776070373
服务介绍: http://www.onlyit.cn/user_home?user_id=10304

wwx001  [个人空间]
QQ名  时光呓语


注册  2011-05-23
发贴数  700
精华贴  2
原创贴  3
来自  
状态  正常

级别  会员
#2»发布于2022-03-08 13:51

厉害,收藏备用了。


        




QQ:772600297

summer  [个人空间]
QQ名  summer


注册  2009-09-08
发贴数  730
精华贴  9
原创贴  7
来自  
状态  正常

级别  会员
#3»发布于2022-03-08 15:27

把脚本放产品资料里 选择产品脚本里



        




官方认证第三方服务团队  夏延明 QQ:15932787 13776070373
服务介绍: http://www.onlyit.cn/user_home?user_id=10304

daibiaoge  [个人空间]


注册  2020-04-30
发贴数  446
精华贴  2
原创贴  1
来自  
状态  正常

级别  会员
#4»发布于2022-03-09 09:14

這功能 可以改改 放在 產品列表界面嗎? 
 
當,選擇左側目錄樹時,執行 自定義腳本


        


summer  [个人空间]
QQ名  summer


注册  2009-09-08
发贴数  730
精华贴  9
原创贴  7
来自  
状态  正常

级别  会员
#5»发布于2022-03-09 09:34

gui_create_treeview  SSIIIISS  I  创建树形列表,运行触发函数  上级控件名、新建控件名称,x坐标,y坐标,宽度,高度,模块标识,函数标识 
 
 
新建树形时可以关联到函数。系统树形控件是暂时不支持,触发脚本的。


        于 2022-03-09 09:34 被 summer 修改




官方认证第三方服务团队  夏延明 QQ:15932787 13776070373
服务介绍: http://www.onlyit.cn/user_home?user_id=10304

lyfhqiq  [个人空间]
QQ名  303512095


注册  2017-06-04
发贴数  15
精华数  0
原创贴  0
来自  
状态  正常

级别  会员
#6»发布于2022-05-20 08:47

厉害,收藏备用了。




AGF  [个人空间]


注册  2010-05-16
发贴数  229
精华数  0
原创贴  0
来自  
状态  正常

级别  会员
#7»发布于2022-06-02 09:37

精华贴子,必须收着





 7  1/1   1  

登录后方可发贴


[ 电话: 0571-85462761 王先生 QQ: 124520435 加入软件QQ群 - 杭州 - 浙ICP备19051128号-1 网安 33010402003225 ]