PDA物流快递条码扫描系统
2011-12-06 09:30
120 查看
PDA物流快递条码扫描系统
快件扫描、拍照上传,电子签名上传
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using handset_dll;
using System.Threading;
using System.Media;//for netcf 3.5
using System.IO;
using System.Runtime.InteropServices;
using deliverSys.Utils;
using PocketSignature;
using System.Reflection;
using System.Text.RegularExpressions;
namespace deliverSys
{
public partial class FrmMain : Form
{
private Scan_Interface scan_demo = new Scan_Interface();
private int Scan_Method = 0;
private volatile bool thread_exit = false;
private string scan_text;
private Gprs_connect gprs_conn = new Gprs_connect();
public FrmSign frmSign;
public FrmCaption frmCaption;
//签名
public string imgPath = "";
public string signPath = "";//签名文件
public FrmMain()
{
InitializeComponent();
}
//拍照
private void butPic_Click(object sender, EventArgs e)
{
frmCaption = new FrmCaption(this);
frmCaption.Show();
this.Hide();
}
//提交
private void butSend_Click(object sender, EventArgs e)
{
string sImgName="", sSignName="";
Globals.Ht.Clear();
if (!imgPath.Equals(""))
{
sImgName = txtDeliver.Text + "-" + DateTime.Now.ToString("yyyyMMddHHmmss")+".jpg";
Globals.Ht.Add(sImgName, imgPath);
}
if (!signPath.Equals(""))
{
sSignName = txtDeliver.Text+"-"+signPath;
Globals.Ht.Add(sSignName, Globals.CaptionPath + signPath);
}
string sSql = "insert into deliverSendingPieces([id],[Barcode],[Staffer],[Description],[picPath],[signPath],[createData],[memo]) "+
" values('" + DateTime.Now.ToString("yyyyMMddHHmmss") + "','" + this.txtBarcode.Text + "','" + txtDeliver.Text+ "',"+
" '" + this.txtDecript.Text + "','" + sImgName + "','" + sSignName + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','')";
Cursor.Current = Cursors.WaitCursor;
bool bReturn = Globals.uploadRecord(sSql, Globals.Ht);
Cursor.Current = Cursors.Default;
if (bReturn)
{
MessageBox.Show("上传成功!");
}
else
MessageBox.Show("上传失败!");
}
//退出
private void butExit_Click(object sender, EventArgs e)
{
if (butScan.Text.Equals("停止"))
{
thread_exit = true;
if (scanthread != null)
{
if (!scanthread.Join(2000))
scanthread.Abort();
}
scan_demo.Scan_Close();
}
gprs_conn.Disconnect();
this.Close();
Application.Exit();
}
//扫描
private delegate void scan_delegate();//代理
private Thread scanthread = null;
private void butScan_Click(object sender, EventArgs e)
{
if (butScan.Text.Equals("停止"))
{
thread_exit = true;
if (!scanthread.Join(2000))
scanthread.Abort();
scan_demo.Scan_Close();
butScan.Text = "扫描";
}
else
{
thread_exit = false;
if (scan_demo.com_open)
return;
scan_demo.Scan_Open();
Scan_Method = 2;
this.butScan.Text = "停止";
scanthread = new Thread(new ThreadStart(scan_todo));
scanthread.Start();
}
}
private void scan_display()
{
this.txtBarcode.Text = scan_text;
}
private void scan_todo()
{
scan_delegate fc = new scan_delegate(scan_display);
byte[] temp = new byte[0xff];
temp[0] = 0x00;
scan_demo.Scan_Write(ref temp, 1);
Thread.Sleep(100);
temp[0] = 0x07;
temp[1] = 0xc6;
temp[2] = 0x04;
temp[3] = 0x00;
temp[4] = 0x00;
temp[5] = 0x8a;
temp[6] = 0x04;
temp[7] = 0xfe;
temp[8] = 0xa1;
scan_demo.Scan_Write(ref temp, 9);
//Thread.Sleep(10);
//for(int i=0;i<10;i++)
// scan_text = scan_demo.Scan_Read();
scan_text = "";
while (true)
{
Thread.Sleep(10);
scan_text = scan_demo.Scan_Read();
if (scan_text.Length > 5)
{
this.Invoke(fc);
break;
}
if (thread_exit)
break;
}
scan_demo.Scan_Close();
}
private void FrmMain_Load(object sender, EventArgs e)
{
try
{
thread_exit = true;
if (scanthread != null)
{
if (!scanthread.Join(2000))
scanthread.Abort();
}
scan_demo.Scan_Close();
//gprs连接
gprs_conn.Connect();
}
catch (Exception ex)
{
Globals.WriteLog("启动出错:" + ex.ToString());
}
}
//签名
private void button1_Click(object sender, EventArgs e)
{
frmSign = new FrmSign(this);
frmSign.Show();
this.Hide();
}
}
}
原创文章,禁止做为商用,版权为浩瀚技术团队,转载请注明出处:http://blog.csdn.net/haohantech
快件扫描、拍照上传,电子签名上传
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using handset_dll;
using System.Threading;
using System.Media;//for netcf 3.5
using System.IO;
using System.Runtime.InteropServices;
using deliverSys.Utils;
using PocketSignature;
using System.Reflection;
using System.Text.RegularExpressions;
namespace deliverSys
{
public partial class FrmMain : Form
{
private Scan_Interface scan_demo = new Scan_Interface();
private int Scan_Method = 0;
private volatile bool thread_exit = false;
private string scan_text;
private Gprs_connect gprs_conn = new Gprs_connect();
public FrmSign frmSign;
public FrmCaption frmCaption;
//签名
public string imgPath = "";
public string signPath = "";//签名文件
public FrmMain()
{
InitializeComponent();
}
//拍照
private void butPic_Click(object sender, EventArgs e)
{
frmCaption = new FrmCaption(this);
frmCaption.Show();
this.Hide();
}
//提交
private void butSend_Click(object sender, EventArgs e)
{
string sImgName="", sSignName="";
Globals.Ht.Clear();
if (!imgPath.Equals(""))
{
sImgName = txtDeliver.Text + "-" + DateTime.Now.ToString("yyyyMMddHHmmss")+".jpg";
Globals.Ht.Add(sImgName, imgPath);
}
if (!signPath.Equals(""))
{
sSignName = txtDeliver.Text+"-"+signPath;
Globals.Ht.Add(sSignName, Globals.CaptionPath + signPath);
}
string sSql = "insert into deliverSendingPieces([id],[Barcode],[Staffer],[Description],[picPath],[signPath],[createData],[memo]) "+
" values('" + DateTime.Now.ToString("yyyyMMddHHmmss") + "','" + this.txtBarcode.Text + "','" + txtDeliver.Text+ "',"+
" '" + this.txtDecript.Text + "','" + sImgName + "','" + sSignName + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "','')";
Cursor.Current = Cursors.WaitCursor;
bool bReturn = Globals.uploadRecord(sSql, Globals.Ht);
Cursor.Current = Cursors.Default;
if (bReturn)
{
MessageBox.Show("上传成功!");
}
else
MessageBox.Show("上传失败!");
}
//退出
private void butExit_Click(object sender, EventArgs e)
{
if (butScan.Text.Equals("停止"))
{
thread_exit = true;
if (scanthread != null)
{
if (!scanthread.Join(2000))
scanthread.Abort();
}
scan_demo.Scan_Close();
}
gprs_conn.Disconnect();
this.Close();
Application.Exit();
}
//扫描
private delegate void scan_delegate();//代理
private Thread scanthread = null;
private void butScan_Click(object sender, EventArgs e)
{
if (butScan.Text.Equals("停止"))
{
thread_exit = true;
if (!scanthread.Join(2000))
scanthread.Abort();
scan_demo.Scan_Close();
butScan.Text = "扫描";
}
else
{
thread_exit = false;
if (scan_demo.com_open)
return;
scan_demo.Scan_Open();
Scan_Method = 2;
this.butScan.Text = "停止";
scanthread = new Thread(new ThreadStart(scan_todo));
scanthread.Start();
}
}
private void scan_display()
{
this.txtBarcode.Text = scan_text;
}
private void scan_todo()
{
scan_delegate fc = new scan_delegate(scan_display);
byte[] temp = new byte[0xff];
temp[0] = 0x00;
scan_demo.Scan_Write(ref temp, 1);
Thread.Sleep(100);
temp[0] = 0x07;
temp[1] = 0xc6;
temp[2] = 0x04;
temp[3] = 0x00;
temp[4] = 0x00;
temp[5] = 0x8a;
temp[6] = 0x04;
temp[7] = 0xfe;
temp[8] = 0xa1;
scan_demo.Scan_Write(ref temp, 9);
//Thread.Sleep(10);
//for(int i=0;i<10;i++)
// scan_text = scan_demo.Scan_Read();
scan_text = "";
while (true)
{
Thread.Sleep(10);
scan_text = scan_demo.Scan_Read();
if (scan_text.Length > 5)
{
this.Invoke(fc);
break;
}
if (thread_exit)
break;
}
scan_demo.Scan_Close();
}
private void FrmMain_Load(object sender, EventArgs e)
{
try
{
thread_exit = true;
if (scanthread != null)
{
if (!scanthread.Join(2000))
scanthread.Abort();
}
scan_demo.Scan_Close();
//gprs连接
gprs_conn.Connect();
}
catch (Exception ex)
{
Globals.WriteLog("启动出错:" + ex.ToString());
}
}
//签名
private void button1_Click(object sender, EventArgs e)
{
frmSign = new FrmSign(this);
frmSign.Show();
this.Hide();
}
}
}
原创文章,禁止做为商用,版权为浩瀚技术团队,转载请注明出处:http://blog.csdn.net/haohantech
相关文章推荐
- PDA物流快递系统
- 免费快递100订单物流跟踪接口
- WMS与PDA扫描业务的结合实现物流仓储管理
- 用c#查询各快递物流信息
- 微信小程序快递鸟查物流
- 网络概念与快递物流
- 快递物流查询接口介绍
- 快递鸟智选物流API对接流程
- 快递物流行业:数据增量下载的实现
- 快递物流查询接口介绍
- 智选物流对电商行业的影响-菜鸟/快递鸟
- 快递鸟智选物流API接口对接demo-JAVA
- 快递物流信息布局
- 【智能物流】快递、云仓、新零售引领物流自动化千亿市场
- PDA物流配送/盘点系统
- 一个快速批量查询快递物流数据的小工具,可用于快递物流跟踪
- Java开发快递物流项目(6)
- 90%订单24小时内完成,要把快递送到汽车后备箱,看京东物流智慧共生和绿色样本
- 快递物流第三方接口
- Android快递物流信息布局开发