没有合适的资源?快使用搜索试试~ 我知道了~
首页C#通过数据库中间表与AGV小车交互通讯
C#通过数据库中间表与AGV小车交互通讯
3星 · 超过75%的资源 需积分: 5 38 下载量 75 浏览量
更新于2023-04-28
评论 2
收藏 274KB PDF 举报
1. 主体设备使用西门子S7-1200 PLC进行控制。 2. C#通过S7.NET与西门子PLC进行交互通讯。 3. AGV受控于自己的WMS系统。 4. C#通过操作远程数据库中的中间表和WMS系统进行交互。
资源详情
资源评论
资源推荐
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using S7.Net;
namespace MDJ4_AGV
{
public partial class MainForm : Form
{
# region//实例化类
////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////
SqlServerDataOperation localDataOper = new SqlServerDataOperation();
SqlServerDataOperation remoteDataOper = new SqlServerDataOperation();
ListViewOperation lvOper = new ListViewOperation();
DataTableOperation dtOper = new DataTableOperation();
S7PLC plc = new S7PLC();
#endregion
#region//定义 PLC 地址变量
////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////
int flagReq_db = 4200; //需求标志位 DB 地址
int[] flagReq_startByte = new int[] { 0, 100, 200, 300 }; //需求标志位起始字节地址
int flagDone_db = 4200; //执行完成反馈标志位 DB 地址
int[] flagDone_startByte = new int[] { 1, 101, 201, 301 }; //执行完成反馈标志位起始
字节地址
int flagFault_db = 4200; //错误标志位 DB 地址
int[] flagFault_startByte = new int[] { 2, 102, 202, 302 }; //错误标志位起始字节地址
int flagStep_db = 4200; //任务流程步骤标志位 DB 地址
int[] flagStep_startByte = new int[] { 3, 103, 203, 303 }; //任务流程步骤标志位起始
字节地址
int taskNo_db = 4200; //任务号中转 DB 地址
int[] taskNo_startByte = new int[] { 4, 104, 204, 304 }; //任务号中转起始字节地址
int taskNoLen = 50; //任务号最大长度
int taskTypeReq_db = 4000; //LEN-WMS 任务类型 DB 地址
int[] taskTypeReq_startByte = new int[] { 0, 100, 200, 300 }; //LEN-WMS 任务类型起
始字节地址
int taskStatusReq_db = 4000; //LEN-WMS 任务状态 DB 地址
int[] taskStatusReq_startByte = new int[] { 1, 101, 201, 301 }; //LEN-WMS 任务状态
起始字节地址
int deviceStatusReq_db = 4000; //LEN-WMS 设备状态 DB 地址
int[] deviceStatusReq_startByte = new int[] { 2, 102, 202, 302 }; //LEN-WMS 设备状
态起始字节地址
int taskTypeCallBack_db = 4100; //WMS-LEN 任务类型 DB 地址
int[] taskTypeCallBack_startByte = new int[] { 0, 100, 200, 300 }; //WMS-LEN 任务类
型起始字节地址
int taskStatusCallBack_db = 4100; //WMS-LEN 任务状态 DB 地址
int[] taskStatusCallBack_startByte = new int[] { 1, 101, 201, 301 }; //WMS-LEN 任务
状态起始字节地址
int partNo_db = 4000; //物料号 DB 地址
int[] partNo_startByte = new int[] { 6, 106, 206, 306 }; //物料号起始字节地址
int partNoLen = 30; //物料号最大长度
#endregion
#region//定义全局变量
////////////////////////////////////////////////////////////////////////////////////////////////////////
///
string taskIdBackup;
string taskNoBackup;
////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// <summary>
/// 定义 LEN_WMS 表列名字典表
/// </summary>
Dictionary<string, string> dicLvLenWmsColName = new Dictionary<string, string>();
/// <summary>
/// LEN_WMS 表列名字典表初始化
/// </summary>
private void DicLvLenWmsColNameInit()
{
DataTable dt = new DataTable();
string sql = string.Format("select EnglishName, ChineseName from
DIC_LenWmsColName");
dt = localDataOper.GetDataTable(sql);
foreach (DataRow dr in dt.Rows)
{
dicLvLenWmsColName.Add(dr[0].ToString().Trim(), dr[1].ToString().Trim());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
///
/// <summary>
/// 定义 WMS_LEN 表列名字典表
/// </summary>
Dictionary<string, string> dicLvWmsLenColName = new Dictionary<string, string>();
/// <summary>
/// WMS_LEN 表列名字典初始化
/// </summary>
private void DicLvWmsLenCloNameInit()
{
DataTable dt = new DataTable();
string sql = string.Format("select EnglishName, ChineseName from
DIC_WmsLenColName");
dt = localDataOper.GetDataTable(sql);
foreach (DataRow dr in dt.Rows)
{
dicLvWmsLenColName.Add(dr[0].ToString().Trim(), dr[1].ToString().Trim());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////
/// <summary>
/// 定义 LEN_WMS 表 BinCode 字典表 - 用于 ListView 显示
/// </summary>
Dictionary<string, string> dicLvLenWmsBinCode = new Dictionary<string, string>();
/// <summary>
/// LEN_WMS 表 BinCode 列字典表初始化
/// </summary>
private void DicLvLenWmsBinCodeInit()
{
DataTable dt = new DataTable();
string sql = string.Format("select Code, NAME from DIC_BinCode");
dt = localDataOper.GetDataTable(sql);
foreach (DataRow dr in dt.Rows)
{
dicLvLenWmsBinCode.Add(dr[0].ToString().Trim(), dr[1].ToString().Trim());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
////////
/// <summary>
/// 定义 BinCode 列表 - 用于任务号
/// </summary>
List<string> binCodeList = new List<string>();
/// <summary>
/// BinCode 列表初始化
/// </summary>
private void ListBinCodeInit()
{
DataTable dt = new DataTable();
string sql = string.Format("select ID, Code from DIC_BinCode");
dt = localDataOper.GetDataTable(sql);
foreach (DataRow dr in dt.Rows)
{
string id = dr[0].ToString();
if (id.Substring(0, 2) == "40")
binCodeList.Add(dr[1].ToString().Trim());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////
/// <summary>
/// 定义 LEN_WMS 表 TaskTypeRequest 字典表
/// </summary>
Dictionary<string, string> dicTaskTypeRequest = new Dictionary<string, string>();
/// <summary>
/// LEN_WMS 表 TaskTypeRequest 字典表初始化
/// </summary>
private void DicTaskTypeRequestInit()
{
DataTable dt = new DataTable();
string sql = string.Format("select ID, NAME from DIC_TASKTYPE_Request");
dt = localDataOper.GetDataTable(sql);
foreach (DataRow dr in dt.Rows)
{
dicTaskTypeRequest.Add(dr[0].ToString().Trim(), dr[1].ToString().Trim());
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////
/// <summary>
/// 定义 WMSLEN_表 TaskTypeCallBack 字典表
/// </summary>
Dictionary<string, string> dicTaskTypeCallBack = new Dictionary<string, string>();
/// <summary>
/// LEN_WMS 表 TaskTypeRequest 字典表初始化
剩余20页未读,继续阅读
AI_DL_CODE
- 粉丝: 1
- 资源: 4
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- RTL8188FU-Linux-v5.7.4.2-36687.20200602.tar(20765).gz
- c++校园超市商品信息管理系统课程设计说明书(含源代码) (2).pdf
- 建筑供配电系统相关课件.pptx
- 企业管理规章制度及管理模式.doc
- vb打开摄像头.doc
- 云计算-可信计算中认证协议改进方案.pdf
- [详细完整版]单片机编程4.ppt
- c语言常用算法.pdf
- c++经典程序代码大全.pdf
- 单片机数字时钟资料.doc
- 11项目管理前沿1.0.pptx
- 基于ssm的“魅力”繁峙宣传网站的设计与实现论文.doc
- 智慧交通综合解决方案.pptx
- 建筑防潮设计-PowerPointPresentati.pptx
- SPC统计过程控制程序.pptx
- SPC统计方法基础知识.pptx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1