public StringValue SendTruckState(string sWorkerId, string state) { DisableCache(); Logger.Info(string.Format("SendTruckState: {0}, {1}", sWorkerId, state)); StringValue okValue = new StringValue { Value = "Ok" }; DateTime nowDate = System.DateTime.Now; using (Feng.IRepository rep = new Feng.NH.Repository("zkzx.model.config")) { try { rep.BeginTransaction(); var clzy = rep.Get<车辆作业>(new Guid(sWorkerId)); if (clzy != null && clzy.开始时间.HasValue) { if (state == "途中休息" || state == "堵车" || state == "故障处理") { 作业异常Dao 作业异常Dao = new 作业异常Dao(); 作业异常Dao.新作业异常(clzy, state, null, nowDate); } else if (state.StartsWith("动作")) { string[] sIdxs = state.Split(new char[] { '-' }); int idx = Convert.ToInt32(sIdxs[1]); int idx2 = Convert.ToInt32(sIdxs[2]); int[] taskIdx = null; string[] importantAreas = null; string[] importantTaskStatus = null; string[] importantWorkStatus = null; ModelHelper.Get任务状态(clzy.专家任务, out taskIdx, out importantAreas, out importantTaskStatus, out importantWorkStatus); if (idx >= 0 && idx < importantAreas.Length) { 作业监控Dao zyjkDao = new 作业监控Dao(); zyjkDao.更新作业监控状态2(rep, clzy, nowDate, importantAreas[idx], idx2 == 0 ? "开始" : "结束"); 动作时间数据 entity2 = new 动作时间数据(); entity2.时间 = nowDate; entity2.地点 = importantAreas[idx]; entity2.动作 = (idx2 == 0 ? "开始" : "结束") + importantWorkStatus[idx]; entity2.车辆作业 = clzy; Zkzx.Model.BaseDao<动作时间数据> dao = new Zkzx.Model.BaseDao<动作时间数据>(); dao.Save(rep, entity2); } else { okValue = null; } } else if (state.StartsWith("箱号")) { string[] sIdxs = state.Split(new char[] { '-' }); int idx = Convert.ToInt32(sIdxs[1]); int[] taskIdx = null; string[] importantAreas = null; string[] importantTaskStatus = null; string[] importantWorkStatus = null; ModelHelper.Get任务状态(clzy.专家任务, out taskIdx, out importantAreas, out importantTaskStatus, out importantWorkStatus); if (idx >= 0 && idx < importantAreas.Length && !string.IsNullOrEmpty(sIdxs[2])) { var rw = clzy.专家任务.任务[taskIdx[idx]]; rw.箱号 = sIdxs[2]; (new Zkzx.Model.任务Dao()).Update(rep, rw); } else { okValue = null; } } else if (state.StartsWith("封号")) { string[] sIdxs = state.Split(new char[] { '-' }); int idx = Convert.ToInt32(sIdxs[1]); int[] taskIdx = null; string[] importantAreas = null; string[] importantTaskStatus = null; string[] importantWorkStatus = null; ModelHelper.Get任务状态(clzy.专家任务, out taskIdx, out importantAreas, out importantTaskStatus, out importantWorkStatus); if (idx >= 0 && idx < importantAreas.Length && !string.IsNullOrEmpty(sIdxs[2])) { var rw = clzy.专家任务.任务[taskIdx[idx]]; rw.封志号 = sIdxs[2]; (new Zkzx.Model.任务Dao()).Update(rep, rw); } else { okValue = null; } } } else { okValue = null; } rep.CommitTransaction(); return okValue; } catch (Exception) { rep.RollbackTransaction(); } } return null; }