📄 manage.lst
字号:
247 void BcdToBar(uchar *bcd,uchar *bar)
248 {
249 1 uchar str[15],i,j,k;
250 1
251 1 k=bcd[0]&0x0F;
252 1 str[0]='0'+k; //条形码是13位10进制数,存储为BCD格式时最高位是0
253 1 i=1,j=1; //转换为字符串时应该将最高位的0去掉
254 1 while(i<7)
255 1 {
256 2 k=bcd[i]>>4;
257 2 str[j]=k+'0';
258 2 j++;
259 2 k=bcd[i]&0x0F;
260 2 str[j]=k+'0';
261 2 j++;
262 2 i++;
263 2 }
264 1 str[j]=0;
265 1 StrToBar(str,bar);
266 1 }
267
268 void BarToBcd(uchar *bar,uchar *bcd)
269 {
270 1 gyt2 *xp;
271 1 gyt4 *tp;
272 1 uint m,w;
273 1 ulong n,v;
274 1 uchar i,str[15];
275 1
276 1 m=1000;
277 1 n=100000000;
278 1 xp = bar;
*** WARNING C182 IN LINE 278 OF MANAGE.C: pointer to different objects
279 1 tp = &bar[2];
*** WARNING C182 IN LINE 279 OF MANAGE.C: pointer to different objects
280 1 w=xp->dat;
281 1 v=tp->dat;
282 1 if(w==0 && v==0)
283 1 {
284 2 for(i=0;i<7;i++)
285 2 bcd[i]=0;
286 2 return;
287 2 }
288 1 for(i=0;i<4;i++)
289 1 {
290 2 str[i]=w/m+'0';
291 2 w=w%m;
292 2 m/=10;
293 2 }
294 1 for(i=4;i<13;i++)
295 1 {
296 2 str[i]=v/n+'0';
297 2 v=v%n;
298 2 n/=10;
299 2 }
C51 COMPILER V8.01 MANAGE 03/28/2006 09:49:23 PAGE 6
300 1 StrToBcd(13,str,bcd);
301 1 }
302
303 void WareShow(uint no,uchar *str,ulong pricein,ulong priceout,ulong numin,ulong numout,uchar *bar,uchar in
-dex)
304 {
305 1 gyt4 *xp;
306 1 uchar i,m;
307 1
308 1 m=0;
309 1 WindowsSet(7);
310 1 if((no & 0xFF00)==0xFF00)
311 1 {
312 2 strcpy(&WinHint[0][1],"项目:");
313 2 m=1; no -= 0xFF00;
314 2 }
315 1 else
316 1 strcpy(&WinHint[0][1],"PLU :");
317 1
318 1 NumToStr(no,&WinHint[0][6],SwitchInt);
319 1
320 1 strcpy(&WinHint[1][1],"名称:");
321 1 for(i=0;i<16;i++)
322 1 WinDat[1][2+i]=str[i];
323 1 WinDat[1][0]=3;WinDat[1][1]=16;
324 1
325 1 strcpy(&WinHint[2][1],"进货价格:");
326 1 xp = &WinDat[2][2];
*** WARNING C182 IN LINE 326 OF MANAGE.C: pointer to different objects
327 1 xp->dat = pricein;
328 1 WinDat[2][0]=2;WinDat[2][1]=5;
329 1
330 1 strcpy(&WinHint[3][1],"销售价格:");
331 1 xp = &WinDat[3][2];
*** WARNING C182 IN LINE 331 OF MANAGE.C: pointer to different objects
332 1 xp->dat = priceout;
333 1 WinDat[3][0]=2;WinDat[3][1]=5;
334 1
335 1 strcpy(&WinHint[4][1],"库存数量:");
336 1 xp = &WinDat[4][2];
*** WARNING C182 IN LINE 336 OF MANAGE.C: pointer to different objects
337 1 xp->dat = numin;
338 1 WinDat[4][0]=2;WinDat[4][1]=5;
339 1
340 1 strcpy(&WinHint[5][1],"已销售数量:");
341 1 xp = &WinDat[5][2];
*** WARNING C182 IN LINE 341 OF MANAGE.C: pointer to different objects
342 1 xp->dat = numout;
343 1 WinDat[5][0]=2;WinDat[5][1]=5;
344 1
345 1 strcpy(&WinHint[6][1],"税种税目索引号:");
346 1 xp = &WinDat[6][2];
*** WARNING C182 IN LINE 346 OF MANAGE.C: pointer to different objects
347 1 xp->dat = index;
348 1 WinDat[6][0]=1;WinDat[6][1]=1;
349 1
350 1 if(m==0)
351 1 {//有条形码
352 2 WinHint[7][0]=1;
353 2 strcpy(&WinHint[7][1],"条形码:");
354 2 BarToBcd(bar,&WinDat[7][2]);
355 2 WinDat[7][0]=6;WinDat[7][1]=13;
C51 COMPILER V8.01 MANAGE 03/28/2006 09:49:23 PAGE 7
356 2 }
357 1 }
358
359 uchar GetWareInfo(uint no,uchar mode)
360 {
361 1 gyt4 *wp,xp,hp,tp,mp,*fp;
362 1 uchar str[40],i,bar[7],k,len,warenamestr[17];
363 1 uchar m,flg,taxindex,index[7];
364 1 uint n;
365 1 ulong adr,gs;
366 1
367 1 n=no;
368 1 if((no & 0xFF00)==0xFF00)
369 1 {
370 2 m=1;
371 2 no -= 0xFF00;
372 2 gs = no-1;
373 2 adr = gs*33 + ItemAdr; //项目、部类
374 2 }
375 1 else
376 1 {
377 2 m=0;
378 2 gs = no-1;
379 2 adr = gs*39 + WareAdr; //PLU
380 2 }
381 1 memset(warenamestr,0,sizeof(warenamestr));
382 1 if(mode == 1)
383 1 {//增加商品
384 2 xp.dat=0;
385 2 hp.dat=0;
386 2 tp.dat=0;
387 2 mp.dat=0;
388 2 taxindex=0;
389 2 memset(bar,0,sizeof(bar));
390 2 }
391 1 else
392 1 {//修改商品
393 2 SerialFlashRead(FlashDat,adr,16,warenamestr);
394 2 SerialFlashRead(FlashDat,adr+16,4,xp.str);
395 2 SerialFlashRead(FlashDat,adr+20,4,hp.str);
396 2 SerialFlashRead(FlashDat,adr+24,4,mp.str);
397 2 SerialFlashRead(FlashDat,adr+28,4,tp.str);
398 2 SerialFlashRead(FlashDat,adr+32,1,str);
399 2 if(m==0)SerialFlashRead(FlashDat,adr+33,6,bar); //条形码
400 2 taxindex=str[0];
401 2 }
402 1 WareShow(n,warenamestr,xp.dat,hp.dat,mp.dat,tp.dat,bar,taxindex);
403 1
404 1 I2cRead(IndexItems,6,index);
405 1 I2cRead(SingleQuota,4,xp.str);
406 1 k=3;
407 1 if(mode == 1)k=2;
408 1 while(1)
409 1 {
410 2 bar[0]=K_TC;
411 2 bar[1]=K_HJ;
412 2 bar[2]=0;
413 2 i=Windows(k,1,bar);
414 2 if(i==K_TC || i==0xFF)return 0;
415 2 fp = &WinDat[6][2];
*** WARNING C182 IN LINE 415 OF MANAGE.C: pointer to different objects
416 2 str[32]=(uchar)fp->dat;
C51 COMPILER V8.01 MANAGE 03/28/2006 09:49:23 PAGE 8
417 2 flg=0;
418 2 for(i=0;i<6;i++)
419 2 {
420 3 if(index[i]==str[32])flg=1;
421 3 }
422 2 if(flg==0)
423 2 {
424 3 Hint(16,0,"税种税目索引号非法!",3);
425 3 continue;
426 3 }
427 2 wp = &str[20];
*** WARNING C182 IN LINE 427 OF MANAGE.C: pointer to different objects
428 2 fp = &WinDat[3][2];
*** WARNING C182 IN LINE 428 OF MANAGE.C: pointer to different objects
429 2 wp->dat=fp->dat;
430 2 if(fp->dat>xp.dat)
431 2 {
432 3 Hint(32,0,"销售价格超出最大限额!",3);
433 3 continue;
434 3 }
435 2 break;
436 2 }
437 1 for(i=0;i<16;i++)str[i]=WinDat[1][i+2];
438 1 wp = &str[16];
*** WARNING C182 IN LINE 438 OF MANAGE.C: pointer to different objects
439 1 fp = &WinDat[2][2];
*** WARNING C182 IN LINE 439 OF MANAGE.C: pointer to different objects
440 1 wp->dat=fp->dat;
441 1
442 1 wp = &str[24];
*** WARNING C182 IN LINE 442 OF MANAGE.C: pointer to different objects
443 1 fp = &WinDat[4][2];
*** WARNING C182 IN LINE 443 OF MANAGE.C: pointer to different objects
444 1 wp->dat=fp->dat;
445 1
446 1 wp = &str[28];
*** WARNING C182 IN LINE 446 OF MANAGE.C: pointer to different objects
447 1 fp = &WinDat[5][2];
*** WARNING C182 IN LINE 447 OF MANAGE.C: pointer to different objects
448 1 wp->dat=fp->dat;
449 1
450 1 len=33;
451 1 if(m!=1)
452 1 {
453 2 len=39;
454 2 BcdToBar(&WinDat[7][2],&str[33]);
455 2 }
456 1 LcdDisplay(8,16,"您确定要修改/添加吗?",3);
457 1 LcdDisplay(24,28,"--按<合计>键确定",0);
458 1 LcdDisplay(40,36,"--按其它键取消",0);
459 1 if(KeyScan()!=K_HJ)
460 1 return 0;
461 1 // #if FlashDatM25P80
462 1 // Modify(FlashDat,adr,len,str); //写入25P80
463 1 // #else
464 1 SerialFlashWrite(FlashDat,adr,len,str); //写入45P80
465 1 // #endif
466 1 return 1;
467 1 // Hint(16,32,"操作成功!",3);
468 1 }
469
470 void ManageSet()
C51 COMPILER V8.01 MANAGE 03/28/2006 09:49:23 PAGE 9
471 {
472 1 gyt2 tp;
473 1 ulong adr;
474 1 uchar k,i,j,x,m,str[25];
475 1 uchar const xm[]={K_XM1,K_XM2,K_XM3,K_XM4,K_XM5,K_XM6,K_XM7,K_XM8,K_XM9,K_XM10,K_XM11,K_XM12,
476 1 K_XM13,K_XM14,K_XM15,K_XM16,K_XM17,K_XM18,K_XM19,K_XM20,K_XM21,K_XM22,K_XM23,K_XM24,K_XM25};
477 1
478 1 x=1;
479 1 while(1)
480 1 {
481 2 WindowsSet(5);
482 2 strcpy(&WinHint[0][1],"1.修改项目");
483 2 strcpy(&WinHint[1][1],"2.修改PLU");
484 2 strcpy(&WinHint[2][1],"3.增加项目");
485 2 strcpy(&WinHint[3][1],"4.增加PLU");
486 2 strcpy(&WinHint[4][1],"5.下载商品信息");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -