条形码扫描示例程序

本系统是一款用于铝锭条码离线扫描的应用程序,支持数据采集、查询及上传等功能。通过简单的用户界面进行操作,实现铝锭信息录入、查询及数据传输到远程系统。
  1. /*
  2. 适用8300版本
  3. M/D:2007.5.14
  4. KNL:8300K-3.23
  5. LIB:8300L-2.21
  6. */
  7. #include<8300lib.h>
  8. #include<ucos.h>
  9. #include<stdlib.h>
  10. #defineBYTEunsignedchar
  11. #defineBOOLunsignedchar
  12. #defineULONGunsignedlong
  13. #defineTRUE1
  14. #defineFALSE0
  15. #defineCANCEL2
  16. #defineYmax5
  17. #defineXmax20
  18. staticchar*ACK="ACK\r";
  19. staticchar*NAK="NAK\r";
  20. intbeep1[4]={16,5,0,0};
  21. intbeep2[8]={30,10,0,5,30,10,0,0};
  22. intbeep3[8]={30,50,0,5,30,50,0,0};
  23. intbeep4[4]={30,150,0,0};
  24. //************************VAR***********************************#defineNULL0x00*******//
  25. //voidflip_page(charpage[][Xmax],introwcount);//将page中的内容显示出来,按UP、DOWN键上、下翻动
  26. intInputData(char*databuf,intmaxbit,intx,inty);//数据采集
  27. intInputData2(char*databuf,intmaxbit,intx,inty);
  28. voidbacklight();//设置背光
  29. intbklt_flag=0;
  30. staticBOOLConnectingPage(void);//联接等待界面
  31. //BOOLDownloadLookup(char*filename,intrecord_len,intkey_offset,intkey_len);
  32. ////数据下载到filename中,记录长度为record_len,索引开始位置为key_offset,长度为key_len
  33. BOOLUploadDBF(intfDbf);//数据上传
  34. voidrecord_save(char*record,char*filename);
  35. voidshangchuan(void);
  36. voidntos(charns[],longn,unsignedcount);
  37. chardate[11];
  38. chartime[11];
  39. /*-----------函数声明--------------------*/
  40. voidLogin(void);//登陆界面
  41. voidMainMenu(void);//主菜单
  42. voidgetDatetime(void);//登陆界面显示的时间
  43. voidSetClock(void);//设置时间
  44. voidscan_barcode(void);//扫描条码
  45. voidtransmit(void);//传输
  46. voiddel_data(void);//清除
  47. voidcaiji(void);
  48. intcaiji2(void);
  49. voidchaxun(void);//查询删除
  50. voidchaxun2(void);
  51. voidxiugai(void);//修改
  52. /*-----------变量------------------------*/
  53. charriqi[9];//日期
  54. charchehao[5];//车号
  55. charzuhao[5];//组号
  56. charxuhao[4];//序号
  57. charkunhao[17];//捆号
  58. charzhongliang[11];//重量
  59. charall[46];
  60. intconnect_port=0;
  61. /*******************************************************************/
  62. voidmain()
  63. {
  64. //SetFont(FONT_6X8);
  65. SetFont(FONT_6X12);
  66. SetVideoMode(0);
  67. SetCursor(0);
  68. while(1)
  69. {
  70. Login();/*登录界面*/
  71. MainMenu();/*应用功能菜单*/
  72. }
  73. }
  74. voidLogin(void)
  75. {
  76. while(1)
  77. {
  78. clr_scr();
  79. gotoxy(0,1);
  80. printf("铝锭条码离线扫描系统");
  81. gotoxy(0,3);
  82. printf("版本V1.0.0");
  83. gotoxy(0,4);
  84. getDatetime();
  85. printf("%s",date);
  86. OSTimeDly(300);
  87. on_beeper(beep4);
  88. return;
  89. }
  90. }
  91. voidMainMenu(void)
  92. {
  93. intret,f_hd;
  94. charkey;
  95. if(!access("DATA"))
  96. {
  97. f_hd=create_DBF("DATA",45);
  98. create_index(f_hd,1,0,12);
  99. create_index(f_hd,2,0,16);
  100. create_index(f_hd,3,0,19);
  101. close_DBF(f_hd);
  102. }
  103. while(1)
  104. {
  105. clr_scr();
  106. gotoxy(0,1);
  107. printf("1数据采集");
  108. gotoxy(0,2);
  109. printf("2删除修改");
  110. gotoxy(0,3);
  111. printf("3资料上传");
  112. for(;!kbhit(););
  113. switch(key=getchar())
  114. {
  115. caseKEY_F7:backlight();break;
  116. case'1':caiji();break;
  117. case'2':chaxun();break;
  118. //case'3':xiugai();break;
  119. case'3':shangchuan();break;
  120. caseKEY_ESC:return;
  121. }
  122. }
  123. }
  124. voidchaxun(void)
  125. {
  126. intret1,ret2,ret3,ret4,i;
  127. charriqi1[9],chehao1[5],zuhao1[5];
  128. while(1)
  129. {
  130. memset(riqi,'',9);
  131. riqi[8]=0;
  132. memset(chehao,'',5);
  133. chehao[4]=0;
  134. memset(zuhao,'',5);
  135. zuhao[4]=0;
  136. clr_scr();
  137. gotoxy(0,0);
  138. printf("请输入:");
  139. gotoxy(0,1);
  140. printf("日期:%s",riqi);
  141. gotoxy(0,2);
  142. printf("车号:%s",chehao);
  143. gotoxy(0,3);
  144. printf("组号:%s",zuhao);
  145. for(;;)
  146. {
  147. memset(riqi1,0x00,9);
  148. memset(chehao1,0x00,5);
  149. memset(zuhao1,0x00,5);
  150. clr_scr();
  151. gotoxy(0,0);
  152. printf("请输入:");
  153. gotoxy(0,1);
  154. printf("日期:%s",riqi);
  155. gotoxy(0,2);
  156. printf("车号:%s",chehao);
  157. gotoxy(0,3);
  158. printf("组号:%s",zuhao);
  159. ret1=InputData2(riqi1,8,5,1);
  160. if(ret1==0)//没输入就按回车
  161. {
  162. memset(riqi1,'',9);
  163. riqi1[8]=0;
  164. continue;
  165. }
  166. if(ret1==1)//按ESC
  167. {
  168. return;
  169. }
  170. if(ret1==2)//正常
  171. {
  172. for(i=0;i<strlen(riqi1);i++)
  173. {
  174. riqi[i]=riqi1[i];
  175. }
  176. for(;;)
  177. {
  178. clr_scr();
  179. gotoxy(0,0);
  180. printf("请输入:");
  181. gotoxy(0,1);
  182. printf("日期:%s",riqi);
  183. gotoxy(0,2);
  184. printf("车号:%s",chehao);
  185. gotoxy(0,3);
  186. printf("组号:%s",zuhao);
  187. ret2=InputData2(chehao1,4,5,2);
  188. if(ret2==0)//没输入就按回车
  189. {
  190. memset(chehao1,'',5);
  191. chehao1[4]=0;
  192. continue;
  193. }
  194. if(ret2==1)//按ESC
  195. {
  196. return;
  197. }
  198. if(ret2==2)//正常
  199. {
  200. for(i=0;i<strlen(chehao1);i++)
  201. {
  202. chehao[i]=chehao1[i];
  203. }
  204. for(;;)
  205. {
  206. clr_scr();
  207. gotoxy(0,0);
  208. printf("请输入:");
  209. gotoxy(0,1);
  210. printf("日期:%s",riqi);
  211. gotoxy(0,2);
  212. printf("车号:%s",chehao);
  213. gotoxy(0,3);
  214. printf("组号:%s",zuhao);
  215. ret3=InputData2(zuhao1,4,5,3);
  216. if(ret3==0)//没输入就按回车
  217. {
  218. memset(zuhao1,'',5);
  219. zuhao1[4]=0;
  220. continue;
  221. }
  222. if(ret3==1)//按ESC
  223. {
  224. return;
  225. }
  226. if(ret3==2)//正常
  227. {
  228. for(i=0;i<strlen(zuhao1);i++)
  229. {
  230. zuhao[i]=zuhao1[i];
  231. }
  232. chaxun2();
  233. return;
  234. }
  235. }
  236. }
  237. }
  238. }
  239. }
  240. }
  241. }
  242. voidchaxun2(void)
  243. {
  244. charrcz[17],buf[46],buf2[46];
  245. charxianshixuhao[4],xianshishuliang[4],xianshikunhao[17],xianshizhongliang[11];
  246. intzukunshu;
  247. intguangbiao;
  248. inti,n,j;
  249. intf_hd;
  250. charkey;
  251. inttemp1,temp2;
  252. intret1,ret;
  253. charinput1[17],input2[11],disinput1[17],disinput2[11];
  254. chartemp3[4],temp4[4];
  255. memset(rcz,0x00,17);
  256. strcat(rcz,riqi);
  257. strcat(rcz,chehao);
  258. strcat(rcz,zuhao);
  259. /*-----------------初始化光标位置-------------------------*/
  260. f_hd=open_DBF((char*)"DATA");
  261. n=member_in_DBF(f_hd);
  262. for(i=0;i<n;i++)
  263. {
  264. memset(buf,0x00,46);
  265. lseek_DBF(f_hd,2,i,1);
  266. get_member(f_hd,2,(char*)buf);
  267. if(strncmp(buf,rcz,16)==0)
  268. {
  269. guangbiao=i;
  270. break;
  271. }
  272. }
  273. close_DBF(f_hd);
  274. /*--------------------------------------------------------*/
  275. for(;;)
  276. {
  277. /*--------------检测是否有数据---------------------------*/
  278. f_hd=open_DBF((char*)"DATA");
  279. if(has_member(f_hd,2,(char*)rcz)==1)
  280. {
  281. close_DBF(f_hd);
  282. }
  283. else
  284. {
  285. close_DBF(f_hd);
  286. clr_scr();
  287. gotoxy(0,2);
  288. printf("无当前组号记录!");
  289. OSTimeDly(300);
  290. return;
  291. }
  292. /*------------求相同组数量-----------------*/
  293. zukunshu=0;
  294. memset(buf,0x00,46);
  295. f_hd=open_DBF((char*)"DATA");
  296. n=member_in_DBF(f_hd);
  297. for(i=0;i<n;i++)
  298. {
  299. memset(buf,0x00,46);
  300. lseek_DBF(f_hd,2,i,1);
  301. get_member(f_hd,2,(char*)buf);
  302. if(strncmp(buf,rcz,16)==0)
  303. {
  304. zukunshu=zukunshu+1;
  305. }
  306. }
  307. close_DBF(f_hd);
  308. /*-----------移动到光标位置,取数据------------------*/
  309. f_hd=open_DBF((char*)"DATA");
  310. lseek_DBF(f_hd,2,guangbiao,1);
  311. memset(buf,0x00,46);
  312. get_member(f_hd,2,(char*)buf);
  313. memset(xianshixuhao,0x00,4);
  314. memset(xianshikunhao,0x00,17);
  315. memset(xianshizhongliang,0x00,11);
  316. for(i=16;i<19;i++)
  317. {
  318. xianshixuhao[i-16]=buf[i];
  319. }
  320. for(i=19;i<34;i++)
  321. {
  322. xianshikunhao[i-19]=buf[i];
  323. }
  324. for(i=35;i<44;i++)
  325. {
  326. xianshizhongliang[i-35]=buf[i];
  327. }
  328. close_DBF(f_hd);
  329. clr_scr();
  330. gotoxy(0,0);
  331. printf("序号/组数量");
  332. gotoxy(13,0);
  333. printf("%s",xianshixuhao);
  334. gotoxy(16,0);
  335. printf("/%d",zukunshu);
  336. gotoxy(0,1);
  337. printf("%s",riqi);
  338. gotoxy(9,1);
  339. printf("%s",chehao);
  340. gotoxy(13,1);
  341. printf("%s",zuhao);
  342. gotoxy(0,2);
  343. printf("捆号:%s",xianshikunhao);
  344. gotoxy(0,3);
  345. printf("重量:%s",xianshizhongliang);
  346. gotoxy(0,4);
  347. printf("F1:删除F3:修改");
  348. for(;!kbhit(););
  349. switch(key=getchar())
  350. {
  351. caseKEY_F7:backlight();continue;
  352. caseKEY_DOWN:
  353. {
  354. f_hd=open_DBF((char*)"DATA");
  355. n=member_in_DBF(f_hd);
  356. if(guangbiao<n)
  357. {
  358. lseek_DBF(f_hd,2,guangbiao+1,1);
  359. memset(buf,0x00,46);
  360. get_member(f_hd,2,(char*)buf);
  361. if(strncmp(buf,rcz,16)==0)
  362. {
  363. guangbiao++;
  364. }
  365. }
  366. else
  367. {
  368. }
  369. close_DBF(f_hd);
  370. break;
  371. }
  372. caseKEY_UP:
  373. {
  374. f_hd=open_DBF((char*)"DATA");
  375. n=member_in_DBF(f_hd);
  376. if(guangbiao>0)
  377. {
  378. lseek_DBF(f_hd,2,guangbiao-1,1);
  379. memset(buf,0x00,46);
  380. get_member(f_hd,2,(char*)buf);
  381. if(strncmp(buf,rcz,16)==0)
  382. {
  383. guangbiao--;
  384. }
  385. }
  386. else
  387. {
  388. }
  389. close_DBF(f_hd);
  390. break;
  391. }
  392. caseKEY_F1:
  393. {
  394. clr_scr();
  395. gotoxy(0,1);
  396. printf("是否删除当前数据?");
  397. gotoxy(0,3);
  398. printf("1是2否");
  399. for(;!kbhit(););
  400. switch(key=getchar())
  401. {
  402. caseKEY_F7:backlight();continue;
  403. case'1'://1111
  404. {
  405. f_hd=open_DBF((char*)"DATA");
  406. lseek_DBF(f_hd,2,guangbiao,1);
  407. delete_member(f_hd,2);
  408. n=member_in_DBF(f_hd);
  409. for(i=0;i<n;i++)
  410. {
  411. lseek_DBF(f_hd,2,i,1);
  412. memset(buf,0x00,46);
  413. get_member(f_hd,2,(char*)buf);
  414. if(strncmp(buf,rcz,16)==0)
  415. {
  416. memset(temp3,0x00,4);
  417. temp3[0]=buf[16];
  418. temp3[1]=buf[17];
  419. temp3[2]=buf[18];
  420. temp1=atoi(temp3);
  421. temp2=atoi(xianshixuhao);
  422. if(temp1>temp2)
  423. {
  424. temp1--;
  425. memset(temp3,0x00,4);
  426. itoa(temp1,(char*)temp3,10);
  427. memset(temp4,'',4);
  428. temp4[3]=0;
  429. for(j=0;j<strlen(temp3);j++)
  430. {
  431. temp4[j]=temp3[j];
  432. }
  433. buf[16]=temp4[0];
  434. buf[17]=temp4[1];
  435. buf[18]=temp4[2];
  436. update_member(f_hd,2,(char*)buf);
  437. }
  438. }
  439. }
  440. close_DBF(f_hd);
  441. continue;
  442. }//case1111
  443. case'2':continue;
  444. }
  445. }//caseF_1
  446. caseKEY_F3:
  447. {
  448. memset(disinput1,0x00,17);
  449. memset(disinput2,0x00,11);
  450. for(;;)
  451. {
  452. clr_scr();
  453. gotoxy(0,0);
  454. printf("%s",riqi);
  455. gotoxy(9,0);
  456. printf("%s",chehao);
  457. gotoxy(13,0);
  458. printf("%s",zuhao);
  459. gotoxy(0,2);
  460. printf("捆号:%s",disinput1);
  461. gotoxy(0,3);
  462. printf("重量:%s",disinput2);
  463. memset(input1,0x00,17);
  464. ret=InputData(input1,16,5,2);
  465. if(ret==1)
  466. {
  467. memset(disinput1,'',17);
  468. disinput1[16]=0;
  469. for(i=0;i<strlen(input1);i++)
  470. {
  471. disinput1[i]=input1[i];
  472. }
  473. gotoxy(0,2);
  474. printf("");
  475. gotoxy(0,2);
  476. printf("捆号:%s",disinput1);
  477. memset(input2,0x00,11);
  478. ret1=InputData2(input2,10,5,3);
  479. if(ret1==2)
  480. {
  481. memset(disinput2,'',11);
  482. disinput2[10]=0;
  483. for(i=0;i<strlen(input2);i++)
  484. {
  485. disinput2[i]=input2[i];
  486. }
  487. memset(buf,0x00,46);
  488. strcat(buf,riqi);
  489. strcat(buf,chehao);
  490. strcat(buf,zuhao);
  491. f_hd=open_DBF((char*)"DATA");
  492. lseek_DBF(f_hd,2,guangbiao,1);
  493. memset(buf2,0x00,46);
  494. get_member(f_hd,2,(char*)buf2);
  495. xuhao[0]=buf2[16];
  496. xuhao[1]=buf2[17];
  497. xuhao[2]=buf2[18];
  498. close_DBF(f_hd);
  499. strcat(buf,xuhao);
  500. strcat(buf,disinput1);
  501. strcat(buf,disinput2);
  502. f_hd=open_DBF((char*)"DATA");
  503. lseek_DBF(f_hd,2,guangbiao,1);
  504. update_member(f_hd,2,(char*)buf);
  505. close_DBF(f_hd);
  506. break;
  507. }
  508. elseif(ret1==1)
  509. {
  510. break;
  511. }
  512. }
  513. elseif(ret==0)
  514. {
  515. break;
  516. }
  517. }
  518. continue;
  519. }
  520. caseKEY_ESC:return;
  521. }
  522. }
  523. }
  524. voidshangchuan(void)
  525. {
  526. intf_hd,uploadflag;
  527. charkey1,key2,key;
  528. while(1)
  529. {
  530. clr_scr();
  531. gotoxy(0,0);
  532. printf("===请选择上传方式===");
  533. gotoxy(0,2);
  534. printf("1.数据线连接");
  535. gotoxy(0,3);
  536. printf("2.通讯座连接");
  537. gotoxy(0,4);
  538. printf("ESC返回");
  539. for(;!kbhit(););
  540. switch(key=getchar())
  541. {
  542. caseKEY_F7:backlight();continue;
  543. case'1':
  544. {
  545. connect_port=0;
  546. f_hd=open_DBF((char*)"DATA");
  547. uploadflag=UploadDBF(f_hd);
  548. close_DBF(f_hd);
  549. if(uploadflag==TRUE)
  550. {
  551. clr_scr();
  552. gotoxy(0,1);
  553. printf("%s",(char*)"是否删除所有");
  554. gotoxy(0,2);
  555. printf("%s",(char*)"采集数据");
  556. gotoxy(0,3);
  557. printf("%s",(char*)"1是2否");
  558. for(;!kbhit(););
  559. switch(key2=getchar())
  560. {
  561. caseKEY_F7:backlight();break;
  562. case'1':
  563. {
  564. if(remove((char*)"DATA")==1)
  565. {
  566. on_beeper(beep1);
  567. clr_scr();
  568. gotoxy(0,2);
  569. printf("%s",(char*)"删除成功");
  570. if(!access("DATA"))
  571. {
  572. f_hd=create_DBF("DATA",45);
  573. create_index(f_hd,1,0,12);
  574. create_index(f_hd,2,0,16);
  575. create_index(f_hd,3,0,19);
  576. close_DBF(f_hd);
  577. }
  578. OSTimeDly(300);
  579. }
  580. else
  581. {
  582. on_beeper(beep3);
  583. clr_scr();
  584. gotoxy(0,2);
  585. printf("%s",(char*)"删除失败");
  586. OSTimeDly(300);
  587. }
  588. break;
  589. }
  590. case'2':break;
  591. }
  592. }
  593. break;
  594. }
  595. case'2':
  596. {
  597. connect_port=2;
  598. f_hd=open_DBF((char*)"DATA");
  599. uploadflag=UploadDBF(f_hd);
  600. close_DBF(f_hd);
  601. if(uploadflag==TRUE)
  602. {
  603. clr_scr();
  604. gotoxy(0,1);
  605. printf("%s",(char*)"是否删除所有");
  606. gotoxy(0,2);
  607. printf("%s",(char*)"采集数据");
  608. gotoxy(0,3);
  609. printf("%s",(char*)"1是2否");
  610. for(;!kbhit(););
  611. switch(key2=getchar())
  612. {
  613. caseKEY_F7:backlight();break;
  614. case'1':
  615. {
  616. if(remove((char*)"DATA")==1)
  617. {
  618. on_beeper(beep1);
  619. clr_scr();
  620. gotoxy(0,2);
  621. printf("%s",(char*)"删除成功");
  622. if(!access("DATA"))
  623. {
  624. f_hd=create_DBF("DATA",45);
  625. create_index(f_hd,1,0,12);
  626. create_index(f_hd,2,0,16);
  627. create_index(f_hd,3,0,19);
  628. close_DBF(f_hd);
  629. }
  630. OSTimeDly(300);
  631. }
  632. else
  633. {
  634. on_beeper(beep3);
  635. clr_scr();
  636. gotoxy(0,2);
  637. printf("%s",(char*)"删除失败");
  638. OSTimeDly(300);
  639. }
  640. break;
  641. }
  642. case'2':break;
  643. }
  644. }
  645. break;
  646. }
  647. caseKEY_ESC:return;
  648. }
  649. }
  650. /*f_hd=open_DBF((char*)"DATA");
  651. uploadflag=UploadDBF(f_hd);
  652. close_DBF(f_hd);
  653. if(uploadflag==TRUE)
  654. {
  655. clr_scr();
  656. gotoxy(0,0);
  657. printf("%s",(char*)"是否删除所有");
  658. gotoxy(0,1);
  659. printf("%s",(char*)"采集数据");
  660. gotoxy(0,3);
  661. printf("%s",(char*)"1是2否");
  662. for(;!kbhit(););
  663. switch(key2=getchar())
  664. {
  665. caseKEY_F7:backlight();break;
  666. case'1':
  667. {
  668. if(remove((char*)"shoujian")==1)
  669. {
  670. on_beeper(beep1);
  671. clr_scr();
  672. gotoxy(0,2);
  673. printf("%s",(char*)"删除成功");
  674. if(!access("shoujian"))
  675. {
  676. f_hd=create_DBF("shoujian",92);
  677. create_index(f_hd,1,32,16);
  678. create_index(f_hd,2,0,16);
  679. close_DBF(f_hd);
  680. }
  681. OSTimeDly(300);
  682. }
  683. else
  684. {
  685. on_beeper(beep3);
  686. clr_scr();
  687. gotoxy(0,2);
  688. printf("%s",(char*)"删除失败");
  689. OSTimeDly(300);
  690. }
  691. break;
  692. }
  693. case'2':break;
  694. }
  695. }*/
  696. }
  697. voidcaiji(void)
  698. {
  699. intret1,ret2,ret3,ret4,i;
  700. charriqi1[9],chehao1[5],zuhao1[5];
  701. while(1)
  702. {
  703. memset(riqi,'',9);
  704. riqi[8]=0;
  705. memset(chehao,'',5);
  706. chehao[4]=0;
  707. memset(zuhao,'',5);
  708. zuhao[4]=0;
  709. clr_scr();
  710. gotoxy(0,0);
  711. printf("请输入:");
  712. gotoxy(0,1);
  713. printf("日期:%s",riqi);
  714. gotoxy(0,2);
  715. printf("车号:%s",chehao);
  716. gotoxy(0,3);
  717. printf("组号:%s",zuhao);
  718. for(;;)
  719. {
  720. memset(riqi1,0x00,9);
  721. memset(chehao1,0x00,5);
  722. memset(zuhao1,0x00,5);
  723. clr_scr();
  724. gotoxy(0,0);
  725. printf("请输入:");
  726. gotoxy(0,1);
  727. printf("日期:%s",riqi);
  728. gotoxy(0,2);
  729. printf("车号:%s",chehao);
  730. gotoxy(0,3);
  731. printf("组号:%s",zuhao);
  732. ret1=InputData2(riqi1,8,5,1);
  733. if(ret1==0)//没输入就按回车
  734. {
  735. memset(riqi1,'',9);
  736. riqi1[8]=0;
  737. continue;
  738. }
  739. if(ret1==1)//按ESC
  740. {
  741. return;
  742. }
  743. if(ret1==2)//正常
  744. {
  745. for(i=0;i<strlen(riqi1);i++)
  746. {
  747. riqi[i]=riqi1[i];
  748. }
  749. for(;;)
  750. {
  751. clr_scr();
  752. gotoxy(0,0);
  753. printf("请输入:");
  754. gotoxy(0,1);
  755. printf("日期:%s",riqi);
  756. gotoxy(0,2);
  757. printf("车号:%s",chehao);
  758. gotoxy(0,3);
  759. printf("组号:%s",zuhao);
  760. ret2=InputData2(chehao1,4,5,2);
  761. if(ret2==0)//没输入就按回车
  762. {
  763. memset(chehao1,'',5);
  764. chehao1[4]=0;
  765. continue;
  766. }
  767. if(ret2==1)//按ESC
  768. {
  769. return;
  770. }
  771. if(ret2==2)//正常
  772. {
  773. for(i=0;i<strlen(chehao1);i++)
  774. {
  775. chehao[i]=chehao1[i];
  776. }
  777. for(;;)
  778. {
  779. clr_scr();
  780. gotoxy(0,0);
  781. printf("请输入:");
  782. gotoxy(0,1);
  783. printf("日期:%s",riqi);
  784. gotoxy(0,2);
  785. printf("车号:%s",chehao);
  786. gotoxy(0,3);
  787. printf("组号:%s",zuhao);
  788. ret3=InputData2(zuhao1,4,5,3);
  789. if(ret3==0)//没输入就按回车
  790. {
  791. memset(zuhao1,'',5);
  792. zuhao1[4]=0;
  793. continue;
  794. }
  795. if(ret3==1)//按ESC
  796. {
  797. return;
  798. }
  799. if(ret3==2)//正常
  800. {
  801. for(i=0;i<strlen(zuhao1);i++)
  802. {
  803. zuhao[i]=zuhao1[i];
  804. }
  805. for(;;)
  806. {
  807. ret4=caiji2();
  808. if(ret4==0)//没输入就按回车
  809. {
  810. }
  811. if(ret4==1)//按ESC
  812. {
  813. return;
  814. }
  815. if(ret4==2)//正常
  816. {
  817. }
  818. }
  819. }
  820. }
  821. }
  822. }
  823. }
  824. }
  825. }
  826. }
  827. intcaiji2(void)
  828. {
  829. /*atof
  830. 【功能】将一个字符串转换成浮点数。
  831. 【原型】doubleatof(constchar*s)
  832. 【位置】math.h
  833. */
  834. charinput1[17],input2[11];
  835. chartemp1[13],temp2[17],buf1[46],buf2[13],buf3[17],buf4[11];
  836. chartemptj[11];
  837. intf_hd,n,i,j;
  838. intzukunshu=0,chekunshu=0;
  839. doublezuzhongliang1,zuzhongliang2,chezhongliang1,chezhongliang2;
  840. intret,ret1;
  841. intxuhaoshu;
  842. charxhshu[4];
  843. for(;;)
  844. {
  845. chezhongliang1=0;
  846. zuzhongliang1=0;
  847. zukunshu=0;
  848. chekunshu=0;
  849. memset(temp2,0x00,17);
  850. memset(temp1,0x00,13);
  851. strcat(temp2,riqi);
  852. strcat(temp2,chehao);
  853. strcat(temp2,zuhao);
  854. strcat(temp1,riqi);
  855. strcat(temp1,chehao);
  856. f_hd=open_DBF((char*)"DATA");
  857. n=member_in_DBF(f_hd);
  858. for(i=0;i<n;i++)
  859. {
  860. memset(buf1,0x00,46);
  861. lseek_DBF(f_hd,2,i,1);
  862. get_member(f_hd,2,(char*)buf1);
  863. if(strncmp(buf1,temp2,16)==0)
  864. {
  865. zukunshu=zukunshu+1;
  866. }
  867. }
  868. close_DBF(f_hd);
  869. f_hd=open_DBF((char*)"DATA");
  870. n=member_in_DBF(f_hd);
  871. for(i=0;i<n;i++)
  872. {
  873. memset(buf1,0x00,46);
  874. lseek_DBF(f_hd,1,i,1);
  875. get_member(f_hd,1,(char*)buf1);
  876. if(strncmp(buf1,temp1,12)==0)
  877. {
  878. chekunshu=chekunshu+1;
  879. }
  880. }
  881. close_DBF(f_hd);
  882. /*--------------------------------------------------------*/
  883. f_hd=open_DBF((char*)"DATA");
  884. n=member_in_DBF(f_hd);
  885. for(i=0;i<n;i++)
  886. {
  887. memset(buf1,0x00,46);
  888. lseek_DBF(f_hd,1,i,1);
  889. get_member(f_hd,1,(char*)buf1);
  890. if(strncmp(buf1,temp1,12)==0)
  891. {
  892. memset(temptj,0x00,11);
  893. chezhongliang2=0;
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值