📄 apsmp.c.bak
字号:
/***********************************************************/
/* */
/* PROGRAM : 西安先达(终端软件) */
/* SYSTEM : DT-900 VER1.00 */
/* FILENAME : APSMP.C */
/* VERSION : 1.10 */
/* AUTHOR : 冯志勤 */
/* DATE OF GET : 2001/04/19 */
/* DATE OF UPDATE : */
/* FUNCTION : */
/* HISTORY : */
/* */
/***********************************************************/
#include "stdio.h "
#include "string.h "
#include "stdlib.h "
#include "itron.h "
#include "casio.h "
#include "cmndef.h "
#include "bios1mac.h"
#include "math.h"
void main_menu(void);
void main_menu1(void);
void main_menu2(void);
void main_menu3(void);
void main_menu4(void);
void find_start1(void);
void find_start2(void);
void find_start3(void);
void find_start4(void);
/************************************/
/* TASK MAIN PART */
/************************************/
void ap_start ( void )
{
SysInit(0);
main_menu();
}
void main_menu(void)
{
int kind;
static const UB *menu[]={
" 1.扫描条码",
" 2.数据传输",
" 3.删除文件"
};
while(1)
{
cls();
Dsp_str(" 手持终端",2,0);
Dsp_str(" 数据采集系统",5,0);
Dsp_str(" 2002.04",8,0);
Wait2(20);
cls();
Dsp_str(menu[0],2,0);
Dsp_str(menu[1],5,0);
Dsp_str(menu[2],8,0);
kind=getkey();
switch(kind)
{ case '1':{
main_menu1();
break;
}
case '2':{
main_menu3();
break;
}
case '3':{
/* main_menu4();*/
break;
}
case '4':{
/* main_menu4();*/
break;
}
}/*end switch*/
}/*end while*/
}/*main_menu*/
void main_menu1(void)
{
ER kind,ret,eercd,ercd;
UB lb[42],cp[42],count[20];
UB buff[46],barcode[46],reco[100],temp[100],ysl[13],zsl[13],xsl[13];
int i,j,k,flag;
B f_time[7],f_date[9];
W ffff,fjlh,fjfj,eeee,nnnn;
UW size;
UB fzq[10];
if(Is_file("pd.txt")==1)
{
creat_file("pd.txt");
}
cls();
memset(count,0x00,sizeof(count));
while(1)
{
cls();
memset(barcode,0x00,sizeof(barcode));
memset(buff,0x00,sizeof(buff));
Dsp_str("扫描:",1,0);
/*
Dsp_str("条码:",5,0);
Dsp_str(lb,5,5);
*/
Dsp_str("总计:",7,0);
Dsp_str(count,7,5);
Dsp_str("条",7,13);
size=dat_fsize();
memset(fzq,0x00,sizeof(fzq));
sprintf(fzq,"%-7d",size);
Dsp_str(" (剩余内存:",9,0);
Dsp_str(fzq,9,12);
Dsp_str(")",9,19);
lcd_csr_put(1,5);
lcd_csr_put(1,5);
lcd_csr_set((H)LCD_CSR_UNDER);
memset(buff,0x00,sizeof(buff));
/****** 读入条码 **************/
key_clear();
ret=read_str(1,5,0,buff,40);
lcd_csr_set((H)LCD_CSR_OFF);
if(ret==E_KEY_CLR) return; /*按CLS 返回*/
if(strlen(buff)==0) continue;
memset(lb,0x00,sizeof(lb));
if(strlen(buff)<40)
{
space_str(buff,40);
memcpy(lb,buff,40);
}
else
{
strcpy(lb,buff);
}
space_str(lb,40);
lb[40]=0x00;
memset(barcode,0x00,sizeof(barcode));
strcpy(barcode,lb);
Dsp_str(lb,1,5);
sprintf(count,"%6.0f",atof(count)+1);
memset(temp,0x00,sizeof(temp));
strcat(temp,barcode);
strcat(temp,"\xd\xa");
temp[42]=0x00;
dat_F_Write("pd.txt",1,0,temp,42);
}/*end while(1)*/
}/*end main_menu1*/
void main_menu2(void)
{
int kind;
static const UB *menu[]={"4.扫描查讯 pd.txt",
"6.依次查讯 pd.txt",
"0.返 回"
};
cls();
Dsp_str(menu[0],2,0);
Dsp_str(menu[1],5,0);
Dsp_str(menu[2],8,0);
kind=getkey();
switch(kind)
{ case '4':{
find_start3();
break;
}
case '6':{
find_start4();
break;
}
case '0':break;
case 12:break;
}/*end switch*/
}/*end main_menu2*/
void main_menu3(void)
{
char kind;
cls();
Dsp_str("请输入(1 or 3): ",2,1);
Dsp_str("1.上传数据 pd.txt",5,1);
Dsp_str("3.返 回",8,1);
kind=getkey();
switch(kind)
{
case '1':{ cls();
if(sendfile("pd.txt")==0)
del_file("pd.txt");
break;
}
case '3':{ cls();
break;
}
case 12: break;
default: { cls();
Dsp_str("输入错误 !",3,6);
Dsp_str("请输入 1 or 3",6,3);
kind=getkey();
break;
}
}
}
void main_menu4(void)
{
char kind;
cls();
Dsp_str("请输入(1 or 3): ",2,1);
Dsp_str("1.删除文件 pd.txt",5,1);
Dsp_str("3.返 回",8,1);
kind=getkey();
switch(kind)
{
case '1':{ cls();
Dsp_str("你确定要删除数据吗?",2,1);
Dsp_str("ENT 删除",5,3);
Dsp_str("任意键 不删除",8,3);
kind=getkey();
if(kind==13) del_file("pd.txt");
break;
}
case '3':{
break;
}
case 12: break;
default: { cls();
Dsp_str("输入错误 !",3,6);
Dsp_str("请输入 1 or 3",6,3);
kind=getkey();
break;
}
}
}
void find_start1(void)
{
ER ret,ercd;
UB buff[16],barcode[16],reco[100],zsl[13];
W fjlh;
if(Is_file("data.txt")==1)
{
cls();
Dsp_str("文件 data.txt 不存在",2,0);
Dsp_str(" 请执行数据传输功能:",5,0);
Dsp_str(" 将文件传入盘点机中:",8,0);
beep(1);
Wait(2);
return;
}
while(1)
{
cls();
memset(barcode,0x00,sizeof(barcode));
Dsp_str("请扫描商品编号",2,3);
Dsp_str("条码:",6,0);
lcd_csr_put(6,5);
lcd_csr_set((H)LCD_CSR_UNDER);
memset(buff,0x00,15);
/****** 读入条码 **************/
key_clear();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -