public void AddDuiShiTask(Task task, Command cmd) { MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); CommandDA.Insert(cmd); }
public string NewPricingPlan(PricingPlan plan) { string result = ""; try { MongoDBHelper <PricingPlan> mongo_plan = new MongoDBHelper <PricingPlan>(); QueryDocument query = new QueryDocument(); query.Add("MeterNo", plan.MeterNo); MongoCursor <PricingPlan> mongoCursor = mongo_plan.Query(CollectionNameDefine.MeterPricingPlan, query); var dataList = mongoCursor.ToList(); if (dataList != null && dataList.Count >= 1) { var iDelete = new QueryDocument(); iDelete.Add("MeterNo", plan.MeterNo); //删除老计划 mongo_plan.Delete(CollectionNameDefine.MeterPricingPlan, iDelete); } mongo_plan.Insert(CollectionNameDefine.MeterPricingPlan, plan); } catch (Exception e) { result = e.Message; } return(result); }
public static string InsertMeter(Meter meter) { try { Meter _m = QueryMeter(meter.Mac); if (_m != null) { return("表已存在,不能重复插入"); } if (meter.Mac == null || meter.Mac == "") { return("表号不能为空"); } if (meter.Mac.Length != 14) { return("非法的表号。"); } MongoDBHelper <Meter> mongo = new MongoDBHelper <Meter>(); mongo.Insert(CollectionNameDefine.MeterCollectionName, meter); //创建新的账单 Bill bill = new Bill() { BillID = meter.BillID, UserID = meter.UserID, BeginDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }; new M_BillRecordService().AddBill(bill); } catch (Exception e) { return(e.Message); } return(""); }
/// <summary> /// 设置调价计划 /// </summary> /// <param name="info"></param> /// <param name="meter"></param> /// <returns></returns> public string SetPricingPlan(PricingPlan info, IoT_PricingMeter meter) { string result = ""; try { MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = meter.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_调整价格; // //读取表信息 info.MeterNo = meter.MeterNo.Trim(); info.TaskID = task.TaskID; //写任务 mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); meter.TaskID = task.TaskID; //2.设置调价计划数据 DataItem_A010 item_A010 = null; CT ct = new CT(info.MeterType == "00" ? MeterType.气量表 : MeterType.金额表, (bool)info.IsUsedLadder, (JieSuanType)Convert.ToInt16(info.SettlementType.ToString()), ((int)info.Ladder) <= 0 ? 1 : (int)info.Ladder); item_A010 = new DataItem_A010(Convert.ToByte(new Random().Next(0, 255)), ct, DateTime.Now); item_A010.Price1 = (decimal)info.Price1; item_A010.Price2 = (decimal)info.Price2; item_A010.Price3 = (decimal)info.Price3; item_A010.Price4 = (decimal)info.Price4; item_A010.Price5 = (decimal)info.Price5; item_A010.UseGas1 = (decimal)info.Gas1; item_A010.UseGas2 = (decimal)info.Gas2; item_A010.UseGas3 = (decimal)info.Gas3; item_A010.UseGas4 = (decimal)info.Gas4; item_A010.StartDate = Convert.ToDateTime(info.UseDate); Command cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_A010.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.WriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_A010.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_A010.GetBytes()); cmd.Order = 1; CommandDA.Insert(cmd); new PricingPlanDA().NewPricingPlan(info); //注:该函数如何进行事务处理,保证所有数据更新都成功。 } catch (Exception e) { result = e.Message; } return(result); }
/// <summary> /// 添加修正任务 /// </summary> /// <param name="correctRecord"></param> /// <returns></returns> public string AddCorrentTask(CorrectRecord correctRecord, out Task returnTask) { string result = ""; returnTask = null; try { //先删除未执行的任务 DeleteUnRunTask(correctRecord.MeterNo.Trim()); MongoDBHelper <Meter> mongo = new MongoDBHelper <Meter>(); //1、记录修正信息 result = mongo.Insert(CollectionNameDefine.MeterCorrectRecord, correctRecord); if (result != "") { return(result); } //2、创建修正任务指令 //创建一个任务 MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = correctRecord.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_校准; //点火任务(DH),换表登记(HB)、开阀(KF)、关阀(GF)、充值(CZ)、调整价格(TJ) //写任务 result = mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); if (result != "") { return(result); } Command cmd = new Command(); //1.写校正指令 byte ser = Convert.ToByte(new Random().Next(0, 255)); DataItem_C102 item_C102 = new DataItem_C102(ser, correctRecord.TotalTopUp - correctRecord.SettlementBalance, correctRecord.SettlementBalance, correctRecord.LastSettlementDayLJGas); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_C102.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.CYWriteData;//创源写操作 cmd.DataLength = Convert.ToByte(item_C102.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C102.GetBytes()); cmd.Order = 1; //返回修正任务 result = CommandDA.Insert(cmd); returnTask = task; task.CommandList.Add(cmd); if (result != "") { return(result); } } catch (Exception e) { return(e.Message); } return(""); }
/// <summary> /// 向数据库中插入指令 /// </summary> /// <param name="command"></param> /// <returns></returns> public static string Insert(Command command) { try { MongoDBHelper <Command> mongo_CMD = new MongoDBHelper <Command>(); mongo_CMD.Insert(CollectionNameDefine.CommandCollectionName, command); } catch (Exception e) { return(e.Message); } return(""); }
/// <summary> /// 新建账单 /// </summary> /// <param name="bill"></param> public void AddBill(Bill bill) { try { if (bill == null) { return; } MongoDBHelper <Bill> mongo = new MongoDBHelper <Bill>(); mongo.Insert(CollectionNameDefine.Bill, bill); } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// 设置报警参数任务 /// </summary> /// <param name="info"></param> /// <param name="meter"></param> /// <returns></returns> public string SetWariningParameter(IoT_SetAlarm info, IoT_AlarmMeter meter) { string result = ""; try { MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = meter.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_设置报警参数; // //写任务 mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); meter.TaskID = task.TaskID; //3.设置报警参数 DataItem_C103 item_C103 = new DataItem_C103(Convert.ToByte(new Random().Next(0, 255)), new WaringSwitchSign(info.SwitchTag)); item_C103.长期未与服务器通讯报警时间 = Convert.ToByte(info.Par1); item_C103.燃气漏泄切断报警时间 = Convert.ToByte(info.Par2); item_C103.燃气流量过载切断报警时间 = Convert.ToByte(info.Par3); item_C103.异常大流量值 = MyDataConvert.TwoBCDStrToDecimal(info.Par4); item_C103.异常大流量切断报警时间 = Convert.ToByte(info.Par5); item_C103.异常微小流量切断报警时间 = Convert.ToByte(info.Par6); item_C103.持续流量切断报警时间 = Convert.ToByte(info.Par7); item_C103.长期未使用切断报警时间 = Convert.ToByte(info.Par8); //item_C103.长期未使用切断报警时间 = Convert.ToByte(info.Par7); Command cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_C103.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_C103.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C103.GetBytes()); cmd.Order = 3; CommandDA.Insert(cmd); } catch (Exception e) { result = e.Message; } return(result); }
/// <summary> /// 记录资金结算记录 /// </summary> /// <param name="record"></param> public void AddBillRecord(BillRecord record) { try { if (record == null) { return; } MongoDBHelper <BillRecord> mongo = new MongoDBHelper <BillRecord>(); mongo.Insert(CollectionNameDefine.BillRecord, record); if (record.BillRecordType == BillRecordType.结算点记录) { //更新账单 } } catch (Exception e) { Console.WriteLine(e.Message); } }
/// <summary> /// 创建充值任务 /// </summary> /// <param name="topup">充值数据对象</param> /// <param name="taskID"></param> /// <returns></returns> public string TopUp(IoT_MeterTopUp topup, out string taskID) { //创建一个任务 string result = ""; MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = topup.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_充值; //点火任务(DH),换表登记(HB)、开阀(KF)、关阀(GF)、充值(CZ)、调整价格(TJ) //写任务 result = mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); taskID = task.TaskID; if (result != "") { return(result); } //创建命令 Command cmd = new Command(); byte ser = Convert.ToByte(topup.Ser);//new Random().Next(0, 255)); DataItem_A013 item_A013 = new DataItem_A013(ser, ser, (decimal)topup.Amount); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_A013.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.WriteData;//写操作 cmd.DataLength = Convert.ToByte(item_A013.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_A013.GetBytes()); cmd.Order = 1; result = CommandDA.Insert(cmd); if (result != "") { return(result); } return(""); }
/// <summary> /// 设置结算日 /// </summary> /// <param name="settlementDay"></param> /// <param name="meter"></param> /// <returns></returns> public string SetSettlementDay(IoT_SetSettlementDay settlementDay, IoT_SettlementDayMeter meter) { string result = ""; try { MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = meter.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_设置结算日期; // //写任务 mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); meter.TaskID = task.TaskID; //2.设置上传周期 int JSDay = (int)settlementDay.SettlementDay; int JSMonth = (int)settlementDay.SettlementMonth; DataItem_A011 item_A011 = new DataItem_A011(Convert.ToByte(new Random().Next(0, 255)), JSDay, JSMonth); Command cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_A011.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.WriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_A011.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_A011.GetBytes()); cmd.Order = 1; CommandDA.Insert(cmd); } catch (Exception e) { result = e.Message; } return(result); }
/// <summary> /// 设置上传周期 /// </summary> /// <param name="info"></param> /// <param name="meter"></param> /// <returns></returns> public string SetUploadCycle(IoT_SetUploadCycle info, IoT_UploadCycleMeter meter) { string result = ""; try { MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = meter.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_设置上传周期; // //写任务 mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); meter.TaskID = task.TaskID; /*上传周期模式: * 00:以月为周期,在每个月的XX日YY时ZZ分上传数据; * 01:以XX天为周期,在每XX天的YY时ZZ分上传数据,起点为每月的01日00时00分; * 02:以YY时为周期,在每YY小时的ZZ分上传数据,起点为每天的00时00分; * 03:以燃气表启动开始计时,以XX日YY时ZZ分上传数据 */ ReportCycleType cycleType = ReportCycleType.时周期; if (info.ReportType == "00") { cycleType = ReportCycleType.月周期; } else if (info.ReportType == "01") { cycleType = ReportCycleType.天周期; } else if (info.ReportType == "02") { cycleType = ReportCycleType.时周期; } else if (info.ReportType == "03") { cycleType = ReportCycleType.周期采集; } /*周期参数, * DD 天 范围:00-31 * HH 小时 范围:00-23 * MM 分钟 范围:00-59*/ int DD = 1; int HH = 23; int MM = 59; try { DD = Convert.ToInt32(info.Par.Substring(0, 2)); HH = Convert.ToInt32(info.Par.Substring(2, 2)); MM = Convert.ToInt32(info.Par.Substring(4, 2)); } catch { } //2.设置上传周期 DataItem_C105 item_C105 = new DataItem_C105(Convert.ToByte(new Random().Next(0, 255)), cycleType, DD, HH, MM); item_C105.type = (ReportCycleType)Convert.ToByte(info.ReportType); item_C105.XX = Convert.ToUInt16(info.Par.Substring(0, 2)); item_C105.YY = Convert.ToUInt16(info.Par.Substring(2, 2)); item_C105.ZZ = Convert.ToUInt16(info.Par.Substring(4, 2)); Command cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_C105.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_C105.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C105.GetBytes()); cmd.Order = 2; CommandDA.Insert(cmd); } catch (Exception e) { result = e.Message; } return(result); }
/// <summary> /// 换表申请指令 /// </summary> /// <returns></returns> public string SubmitASK(string taskID, IoT_Meter meter, decimal LJGas) { /*数据标识DI,序号SER,当前累计用量(金额),当前剩余用量(气量/金额),本阶梯周期已使用累计用量(气量)*/ //创建一个任务 MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); Task task = new Task(); task.MeterMac = meter.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = taskID; //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_换表登记; //点火任务(DH),换表登记(HB)、开阀(KF)、关阀(GF)、充值(CZ)、调整价格(TJ) //写任务 mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); Command cmd = new Command(); byte ser = Convert.ToByte(new Random().Next(0, 255)); cmd = new Command(); //1.写密钥 //DataItem_A014 item_A014 = new DataItem_A014(ser, (byte)meter.MKeyVer, meter.MKey);// //cmd.TaskID = task.TaskID; //cmd.Identification = ((UInt16)item_A014.IdentityCode).ToString("X2"); //cmd.ControlCode = (byte)ControlCode.WriteData;//写操作 //cmd.DataLength = Convert.ToByte(item_A014.Length); //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_A014.GetBytes()); //cmd.Order = 1; //CommandDA.Insert(cmd); ////2.设置上传周期 //DataItem_C105 item_C105 = new DataItem_C105(Convert.ToByte(new Random().Next(0, 255)), ReportCycleType.天周期, 1, 23, 59); //cmd = new Command(); //cmd.TaskID = task.TaskID; //cmd.Identification = ((UInt16)item_C105.IdentityCode).ToString("X2"); //cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 //cmd.DataLength = Convert.ToByte(item_C105.Length); //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C105.GetBytes()); //cmd.Order = 2; //CommandDA.Insert(cmd); ////3.设置报警参数 //DataItem_C103 item_C103 = new DataItem_C103(Convert.ToByte(new Random().Next(0, 255)), new WaringSwitchSign() { 长期未使用切断报警 = true, 长期未与服务器通讯报警 = true }); //cmd = new Command(); //cmd.TaskID = task.TaskID; //cmd.Identification = ((UInt16)item_C103.IdentityCode).ToString("X2"); //cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 //cmd.DataLength = Convert.ToByte(item_C103.Length); //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C103.GetBytes()); //cmd.Order = 3; //CommandDA.Insert(cmd); //4.写价格表 DataItem_A010 item_A010 = null; CT ct = new CT(meter.MeterType == "00" ? MeterType.气量表 : MeterType.金额表, (bool)meter.IsUsed, (JieSuanType)Convert.ToInt16(meter.SettlementType.ToString()), meter.Ladder == null ? 1 : (int)meter.Ladder); item_A010 = new DataItem_A010(Convert.ToByte(new Random().Next(0, 255)), ct, DateTime.Now); item_A010.Price1 = (decimal)meter.Price1; item_A010.Price2 = (decimal)meter.Price2; item_A010.Price3 = (decimal)meter.Price3; item_A010.Price4 = (decimal)meter.Price4; item_A010.Price5 = (decimal)meter.Price5; item_A010.UseGas1 = (decimal)meter.Gas1; item_A010.UseGas2 = (decimal)meter.Gas2; item_A010.UseGas3 = (decimal)meter.Gas3; item_A010.UseGas4 = (decimal)meter.Gas4; item_A010.StartDate = DateTime.Now; cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_A010.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.WriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_A010.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_A010.GetBytes()); cmd.Order = 4; CommandDA.Insert(cmd); //5.写结算日 DataItem_A011 item_a011 = new DataItem_A011(Convert.ToByte(new Random().Next(0, 255)), Convert.ToByte(meter.SettlementDay)); item_a011.JieSuanMonth = 1;//根据系统定义取值 cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_a011.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.WriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_a011.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_a011.GetBytes()); cmd.Order = 5; CommandDA.Insert(cmd); //6.写换表指令 DataItem_C107 item_C107 = new DataItem_C107(Convert.ToByte(new Random().Next(0, 255)), 0.0m, (decimal)meter.TotalTopUp, LJGas); cmd = new Command(); cmd.TaskID = task.TaskID; cmd.Identification = ((UInt16)item_C107.IdentityCode).ToString("X2"); cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 cmd.DataLength = Convert.ToByte(item_C107.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C107.GetBytes()); cmd.Order = 6; CommandDA.Insert(cmd); return(""); }
/// <summary> /// 发布广告 /// </summary> /// <param name="ap">广告发布信息</param> /// <param name="listMeter">广告用户列表</param> /// <param name="aDItems">广告内容列表</param> /// <param name="type">发布类型</param> /// <returns></returns> public string PublishAD(ADPublish ap, List <ADPublisMeter> listMeter, List <ADItem> aDItems, PublishType type) { //创建一个任务 ser++; MongoDBHelper <Task> mongo_task = new MongoDBHelper <Task>(); // DataItem_C109(byte ser, ADPublishOperatorCode operatorCode,byte fileCount,List<ADFile> fileList) //发布文件列表 List <Common.Item.ADFile> fileList = new List <Common.Item.ADFile>(); //操作码 ADPublishOperatorCode operatorCode = type == PublishType.NewPublish ? ADPublishOperatorCode.ReDefineList : ADPublishOperatorCode.AddList; //文件条数 byte fileCount = (byte)aDItems.Count; foreach (ADItem item in aDItems) { Common.Item.ADFile aDfile = new Common.Item.ADFile((int)item.OrderID, item.StoreName, (DateTime)item.BDate, (DateTime)item.EDate, (int)item.Length, (int)item.FileLength); fileList.Add(aDfile); } foreach (ADPublisMeter meter in listMeter) { Task task = new Task(); task.MeterMac = meter.MeterNo.Trim(); task.TaskDate = QuShi.getDate(); task.TaskID = Guid.NewGuid().ToString(); //用于和指令进行进行关联 task.TaskState = TaskState.Waitting; task.TaskType = TaskType.TaskType_发布广告; //广告文件(GGF) task.TaskSource = string.Format("{0}|{1}|{2}", meter.AP_ID, meter.UserID, meter.CompanyID); mongo_task.Insert(CollectionNameDefine.TaskCollectionName, task); //meter.TaskID = task.TaskID; //设置任务编号 //准备指令 Command cmd = new Command(); DataItem_C109 item_c109 = new DataItem_C109(ser, operatorCode, fileCount, fileList); cmd.Identification = ((UInt16)item_c109.IdentityCode).ToString("X2");; cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 byte[] tmp = item_c109.GetBytes(); cmd.DataLength = Convert.ToByte(tmp.Length); cmd.DataCommand = MyDataConvert.BytesToHexStr(tmp); //指令内容 cmd.Order = (byte)1; cmd.TaskID = task.TaskID; CommandDA.Insert(cmd); } //Command cmd = new Command(); //byte ser = Convert.ToByte(new Random().Next(0, 255)); //byte fileid = (byte)adfile.id;//广告命令 只存储文件编号 //byte[] contentAllBytes = new byte[1]; //contentAllBytes[0] = fileid; ////1.文件发送 //DataItem_C108 item_C108 = new DataItem_C108(ser, adfile.FileName, 1, 1, 1, 1, contentAllBytes);// //cmd.TaskID = task.TaskID; //cmd.Identification = ((UInt16)item_C108.IdentityCode).ToString("X2"); ; //cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 //cmd.DataLength = Convert.ToByte(contentAllBytes.Length); //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C108.GetBytes()); ; //文件内容 //cmd.Order = (byte)1; //CommandDA.Insert(cmd); //1.文件配置发送指令 //cmd = new Command(); //DataItem_C109 item_C109 = new DataItem_C109(Convert.ToByte(new Random().Next(0, 255)), adddfile.FileNO, adddfile.FileName, adddfile.DTStart, adddfile.DTEnd, adddfile.PollTime, adddfile.OpShowStatus, adddfile.OpDeleteStatus);// //cmd.TaskID = task.TaskID; //cmd.Identification = ((UInt16)item_C109.IdentityCode).ToString("X2"); //cmd.ControlCode = (byte)ControlCode.CYWriteData;//设置参数 //cmd.DataLength = Convert.ToByte(item_C109.Length); //cmd.DataCommand = MyDataConvert.BytesToHexStr(item_C109.GetBytes()); //cmd.Order = (byte)(2); //CommandDA.Insert(cmd); return("");//返回空表示成功 }