public DTOResponse CreateTaskByMen(MoveRequest request) { DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); dtoResponse = this.CreateTaskByMen(request, dbCon, dbTrans); LogService.logger.Info((object)dtoResponse.ToString()); return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; LogService.logger.Error((object)ex); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); } }
/// <summary> /// 确认重置站台设置信息 /// </summary> public DTOResponse RestChanelStorestate(MoveRequest request) { DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); string msg = "重置站台设置信息"; string sqlUpdateStn = string.Format( @"UPDATE PROJ_STATIONINFO SET USECAPACITY=0,OPDATE='{1}',OPMESSAGE='{2}' WHERE CONTROLNO='{0}'", request.StationNo, Utils.GetDatetime(), msg); int count1 = dbCon.ExecuteSql(sqlUpdateStn); dtoResponse.IsSuccess = count1 > 0 ? true : false; dtoResponse.MessageText = "确认重置" + request.StationNo + "站台状态成功:" + count1 + "个工位"; LogService.logger.Info((object)dtoResponse.ToString()); return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; LogService.logger.Error((object)ex); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); } }
public DTOResponse RestForArc(CheckRequest request) { DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); IDbConnection dbConn = dbCon; Expression <Func <SysCheckEntity, bool> > predicate = (Expression <Func <SysCheckEntity, bool> >)(x => x.ITEMSTATE == 1); foreach (SysCheckEntity uldCheck in dbConn.Select <SysCheckEntity>(predicate).OrderBy <SysCheckEntity, int>((Func <SysCheckEntity, int>)(x => x.ID)).ToList <SysCheckEntity>()) { if (!string.IsNullOrEmpty(uldCheck.ARCITEMVALUE)) { long num = (long)dbCon.ExecuteSql(uldCheck.ARCITEMVALUE); } } dtoResponse.IsSuccess = true; dtoResponse.MessageText = "执行成功!"; return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.ToString(); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); } }
public DTOResponse Rest(CheckRequest request) { this.RestForArc(request); DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); IDbConnection dbConn = dbCon; Expression <Func <SysCheckEntity, bool> > predicate = (Expression <Func <SysCheckEntity, bool> >)(x => x.ITEMSTATE == 1); foreach (SysCheckEntity uldCheck in dbConn.Select <SysCheckEntity>(predicate).OrderBy <SysCheckEntity, int>((Func <SysCheckEntity, int>)(x => x.ID)).ToList <SysCheckEntity>()) { long num = (long)dbCon.ExecuteSql(uldCheck.ITEMVALUE); uldCheck.AFFECTEDCOUNT = num; uldCheck.EXECUTEDATE = Utils.GetTodayNow(); dbCon.Save <SysCheckEntity>(uldCheck, false); } dtoResponse.IsSuccess = true; dtoResponse.MessageText = "执行成功!"; return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.ToString(); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); LogService.WriteLog(new LogerInfo() { SOURCEOBJECTID = "盘点执行", SOURCECONTENTJSON = request.ToJson <CheckRequest>() }); } }
public DTOResponse SetGroupnoSeq(LocationRequest request) { //根据左右方向设置GROUPNOSEQ的值 //先进后出(FILO) 先进先出(FIFO) DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = null; IDbTransaction dbTrans = null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); List <LocGroupEntity> locGroupEntities = dbCon.Select <LocGroupEntity>(x => request.ListGroupNo.Contains(x.GROUPNO)); foreach (var group in locGroupEntities) { List <LocDetailEntity> locDetailEntities = dbCon.Select <LocDetailEntity>(x => x.GROUPNO == group.GROUPNO); SqlExpression <LocGroupEntity> expression = dbCon.From <LocGroupEntity>(); expression.UpdateFields.Add("DIRECTIONENTRY"); expression.UpdateFields.Add("GROUPMODEL"); expression.Where(x => x.ID == group.ID); group.DIRECTIONENTRY = request.GroupLeftOrRight; group.GROUPMODEL = request.GroupModel; int c = dbCon.UpdateOnly(group, expression); int seqIndex = 0; SqlExpression <LocDetailEntity> sqlExpression = null; if (request.GroupModel == "FILO") { seqIndex = 0; if (request.GroupLeftOrRight == "L") { seqIndex = locDetailEntities.Count; foreach (var item in locDetailEntities) { item.GROUPNOSEQ = seqIndex; seqIndex--; sqlExpression = dbCon.From <LocDetailEntity>(); sqlExpression.UpdateFields.Add("GROUPNOSEQ"); sqlExpression.Where(x => x.ID == item.ID); int count = dbCon.UpdateOnly <LocDetailEntity>(item, sqlExpression); } } else { foreach (var item in locDetailEntities) { seqIndex++; item.GROUPNOSEQ = seqIndex; sqlExpression = dbCon.From <LocDetailEntity>(); sqlExpression.UpdateFields.Add("GROUPNOSEQ"); sqlExpression.Where(x => x.ID == item.ID); int count = dbCon.UpdateOnly <LocDetailEntity>(item, sqlExpression); } } } if (request.GroupModel == "none") { seqIndex = 0; foreach (var item in locDetailEntities) { seqIndex++; item.GROUPNOSEQ = seqIndex; sqlExpression = dbCon.From <LocDetailEntity>(); sqlExpression.UpdateFields.Add("GROUPNOSEQ"); sqlExpression.Where(x => x.ID == item.ID); int count = dbCon.UpdateOnly <LocDetailEntity>(item, sqlExpression); } } if (request.GroupModel == "FIFO") { } } dtoResponse.IsSuccess = true; dtoResponse.MessageText = "操作成功!"; return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; logger.Error((object)ex); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); } }
public DTOResponse TaskHandle() { DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; string id = (string)null; string msg = (string)null; try { HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); INF_JOBFEEDBACKEntity jobFeedBack = dbCon.Select <INF_JOBFEEDBACKEntity>((Expression <Func <INF_JOBFEEDBACKEntity, bool> >)(x => x.STATUS == 0 && x.RESPONDCOUNT < 1)).OrderBy <INF_JOBFEEDBACKEntity, string>((Func <INF_JOBFEEDBACKEntity, string>)(x => x.ENTERDATE)).OrderBy <INF_JOBFEEDBACKEntity, string>((Func <INF_JOBFEEDBACKEntity, string>)(x => x.JOBID)).OrderBy <INF_JOBFEEDBACKEntity, string>((Func <INF_JOBFEEDBACKEntity, string>)(x => x.FEEDBACKSTATUS)).FirstNonDefault <INF_JOBFEEDBACKEntity>(); if (jobFeedBack == null) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = "当前没有请求需要处理!"; return(dtoResponse); } id = jobFeedBack.ID; TaskEntity projTaskEntity = OrmLiteReadExpressionsApi.Single <TaskEntity>(dbCon, (Expression <Func <TaskEntity, bool> >)(x => x.TASKNO == jobFeedBack.JOBID)); if (projTaskEntity == null) { TaskStepEntity stepEntity = OrmLiteReadExpressionsApi.Single <TaskStepEntity>(dbCon, (Expression <Func <TaskStepEntity, bool> >)(x => x.ID == jobFeedBack.JOBID)); if (stepEntity != null) { stepEntity.STEPSTATE = "3"; dbCon.Update <TaskStepEntity>(stepEntity, (Expression <Func <TaskStepEntity, bool> >)(x => x.ID == stepEntity.ID), (Action <IDbCommand>)null); TaskEntity taskEntity = OrmLiteReadExpressionsApi.Single <TaskEntity>(dbCon, (Expression <Func <TaskEntity, bool> >)(x => x.TASKNO == stepEntity.TASKNO)); //dtoResponse = BPCommon.NextTaskStep(dbCon, dbTrans, taskEntity); if (!dtoResponse.IsSuccess) { return(dtoResponse); } jobFeedBack.STATUS = 1; ++jobFeedBack.RESPONDCOUNT; jobFeedBack.RESPONDDATE = Utils.GetTodayNow(); jobFeedBack.RESPONDMSG = "反馈成功"; dbCon.Update <INF_JOBFEEDBACKEntity>(jobFeedBack, (Action <IDbCommand>)null); dtoResponse.IsSuccess = true; dtoResponse.MessageText = "子任务" + jobFeedBack.JOBID + "处理成功!"; return(dtoResponse); } dtoResponse.IsSuccess = false; dtoResponse.MessageText = "查找任务" + jobFeedBack.JOBID + "失败!"; dtoResponse.MessageCode = "9999"; return(dtoResponse); } this.InsertTaskStat(jobFeedBack); if (projTaskEntity.TASKTCLASS == "3") { if (jobFeedBack.FEEDBACKSTATUS == "1") { projTaskEntity.TASKSTATE = jobFeedBack.FEEDBACKSTATUS; projTaskEntity.STARTDATE = Utils.GetTodayNow(); projTaskEntity.TASKMESSAGE = "任务开始"; } if (jobFeedBack.FEEDBACKSTATUS == "99") { projTaskEntity.TASKSTATE = jobFeedBack.FEEDBACKSTATUS; projTaskEntity.ENDDATE = Utils.GetTodayNow(); projTaskEntity.TASKMESSAGE = "任务结束"; } } else { if (jobFeedBack.FEEDBACKSTATUS == "1") { projTaskEntity.TASKSTATE = jobFeedBack.FEEDBACKSTATUS; projTaskEntity.STARTDATE = Utils.GetTodayNow(); projTaskEntity.TASKMESSAGE = "任务开始"; } if (jobFeedBack.FEEDBACKSTATUS == "3") { projTaskEntity.TRUCKNO = jobFeedBack.EXTATTR1; projTaskEntity.TRUCKNO_PLAN = Utils.GetTodayNow(); projTaskEntity.TASKMESSAGE = "设备开始执行"; } if (jobFeedBack.FEEDBACKSTATUS == "99") { projTaskEntity.TASKSTATE = jobFeedBack.FEEDBACKSTATUS; projTaskEntity.ENDDATE = Utils.GetTodayNow(); projTaskEntity.TASKMESSAGE = "任务结束"; string sql1 = string.Format("UPDATE PROJ_LOCATION_DETAIL SET STORESTATE='0' WHERE LOCATIONNO='{0}'", (object)projTaskEntity.SOURCE01); dbCon.ExecuteSql(sql1); string sql2 = string.Format("UPDATE PROJ_LOCATION_DETAIL SET STORESTATE='1' WHERE LOCATIONNO='{0}'", (object)projTaskEntity.DESTINATION01); dbCon.ExecuteSql(sql2); string sql3 = string.Format("UPDATE PROJ_ULDINFO SET CURRLOC='{2}',MODIFYBY='{3}',MODIFYDATE='{4}',CURRSTATE=CURRSTATE+1 WHERE ULDNO='{0}' AND P01='{1}'", (object)projTaskEntity.PALLETNO, (object)projTaskEntity.BILLID, (object)projTaskEntity.DESTINATION01, (object)projTaskEntity.TASKNO, (object)Utils.GetDatetime()); dbCon.ExecuteSql(sql3); string sql4 = string.Format("UPDATE PROJ_ULDCARRYPLAN SET P10='{2}',MODIFYBY='{3}',MODIFYDATE='{4}' WHERE PLANNO='{0}' AND ULDNO='{1}'", (object)projTaskEntity.BILLID, (object)projTaskEntity.PALLETNO, (object)projTaskEntity.DESTINATION02, (object)projTaskEntity.TASKNO, (object)Utils.GetDatetime()); dbCon.ExecuteSql(sql4); if (SysParamsService.CheckPrarams("SimulatorTaskOver").ToLower() == "true") { this.UpdateInfEquipmentStatus(dbCon, dbTrans, projTaskEntity); } //dtoResponse = BPCommon.NextTaskStep(dbCon, dbTrans, projTaskEntity); if (!dtoResponse.IsSuccess) { return(dtoResponse); } this.GetDataFromDCS(new List <long>() { long.Parse(projTaskEntity.TASKNO) }); } } jobFeedBack.STATUS = 1; ++jobFeedBack.RESPONDCOUNT; jobFeedBack.RESPONDDATE = Utils.GetTodayNow(); jobFeedBack.RESPONDMSG = "反馈成功"; int num1 = dbCon.Update <INF_JOBFEEDBACKEntity>(jobFeedBack, (Action <IDbCommand>)null); int num2 = dbCon.Update <TaskEntity>(projTaskEntity, (Action <IDbCommand>)null); if (num1 == 1 && num2 == 1) { dtoResponse.IsSuccess = true; dtoResponse.MessageText = "执行操作成功!"; } return(dtoResponse); } catch (Exception ex) { msg = ex.Message; dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; DCSInfService.logger.Error((object)ex); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); if (dtoResponse.MessageCode == "9999") { this.UpdataJobFeedBack(id, msg); } } }
public DTOResponse UpdateEquipmentStatus() { DTOResponse dtoResponse = new DTOResponse(); IDbConnection dbCon = (IDbConnection)null; IDbTransaction dbTrans = (IDbTransaction)null; try { object obj = HelperDbOperation.ExecuteScalar("SELECT ID FROM PROJ_ULDSCENE WHERE SCENESTATE=1"); HelperDbOperation.BeginTransaction(ref dbCon, ref dbTrans); List <INF_EQUIPMENTSTATUSEntity> equipmentstatusEntityList = dbCon.Select <INF_EQUIPMENTSTATUSEntity>((Expression <Func <INF_EQUIPMENTSTATUSEntity, bool> >)(x => x.WMSLOCNUM == "none" && x.STATUS == 0)); foreach (INF_EQUIPMENTSTATUSEntity equipmentstatusEntity in equipmentstatusEntityList) { if (equipmentstatusEntity.EQUIPMENTSTATUS == "1") { string str1 = "0"; string str2 = "故障代码:" + equipmentstatusEntity.EQUIPMENTSTATUS; string todayNow = Utils.GetTodayNow(); string sql1 = string.Format("UPDATE PROJ_LOCATION_DETAIL SET LOCATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLID='{0}'", (object)equipmentstatusEntity.EQUIPMENTID, (object)str1, (object)str2, (object)todayNow); int num1 = dbCon.ExecuteSql(sql1); string sql2 = (string)null; int num2 = 0; string sql3 = (string)null; int num3 = 0; int num4 = 0; if (Convert.ToInt32(obj) < 100) { sql2 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT GROUPNO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"1", (object)str2, (object)todayNow); num2 = dbCon.ExecuteSql(sql2); sql3 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"1", (object)str2, (object)todayNow); num3 = dbCon.ExecuteSql(sql3); if (SysParamsService.CheckPrarams("StationErrorUpdateRelate").ToLower() == "true") { string sql4 = string.Format("UPDATE PROJ_STATIONINFO SET ISCLOSE={1} WHERE STATIONNO IN ( SELECT RELATENO FROM PROJ_STATIONRELATE WHERE STATIONNO IN ( SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}'))", (object)equipmentstatusEntity.EQUIPMENTID, (object)0); num4 = dbCon.ExecuteSql(sql4); } } DCSInfService.logger.Info((object)sql2); DCSInfService.logger.Info((object)sql3); DCSInfService.logger.Info((object)(equipmentstatusEntity.EQUIPMENTID + ":" + num1.ToString() + "/" + num2.ToString() + "/" + num3.ToString() + " " + str2)); SysAlterInfoService.InsertAlterInfo("2", equipmentstatusEntity.EQUIPMENTID + "故障恢复!" + str2, "1"); } else { string str1 = "error"; string str2 = "故障代码:" + equipmentstatusEntity.EQUIPMENTSTATUS; string todayNow = Utils.GetTodayNow(); string sql1 = string.Format("UPDATE PROJ_LOCATION_DETAIL SET LOCATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLID='{0}'", (object)equipmentstatusEntity.EQUIPMENTID, (object)str1, (object)str2, (object)todayNow); int num1 = dbCon.ExecuteSql(sql1); string sql2 = (string)null; int num2 = 0; string sql3 = (string)null; int num3 = 0; int num4 = 0; if (Convert.ToInt32(obj) < 100) { sql2 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT GROUPNO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"0", (object)str2, (object)todayNow); num2 = dbCon.ExecuteSql(sql2); sql3 = string.Format("UPDATE PROJ_STATIONINFO SET STATIONSTATE='{1}',OPMESSAGE='{2}',OPDATE='{3}',OPBY='dcs' WHERE CONTROLNO IN (SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}')", (object)equipmentstatusEntity.EQUIPMENTID, (object)"0", (object)str2, (object)todayNow); num3 = dbCon.ExecuteSql(sql3); if (SysParamsService.CheckPrarams("StationErrorUpdateRelate").ToLower() == "true") { string sql4 = string.Format("UPDATE PROJ_STATIONINFO SET ISCLOSE={1} WHERE STATIONNO IN ( SELECT RELATENO FROM PROJ_STATIONRELATE WHERE STATIONNO IN ( SELECT AREANO FROM PROJ_LOCATION_DETAIL WHERE CONTROLID='{0}'))", (object)equipmentstatusEntity.EQUIPMENTID, (object)9); num4 = dbCon.ExecuteSql(sql4); } } DCSInfService.logger.Info((object)sql2); DCSInfService.logger.Info((object)sql3); DCSInfService.logger.Info((object)(equipmentstatusEntity.EQUIPMENTID + ":" + num1.ToString() + "/" + num2.ToString() + "/" + num3.ToString() + " " + str2)); SysAlterInfoService.InsertAlterInfo("2", equipmentstatusEntity.EQUIPMENTID + "发生故障!" + str2, "1"); } string sql = string.Format("UPDATE INF_EQUIPMENTSTATUS SET STATUS=1,MODIFYDATE='{1}' WHERE ID='{0}'", (object)equipmentstatusEntity.ID, (object)Utils.GetDatetime()); dbCon.ExecuteSql(sql); } dtoResponse.IsSuccess = true; dtoResponse.MessageText = "执行设备状态更新:" + equipmentstatusEntityList.Count.ToString(); return(dtoResponse); } catch (Exception ex) { dtoResponse.IsSuccess = false; dtoResponse.MessageText = ex.Message; DCSInfService.logger.Error((object)ex); return(dtoResponse); } finally { HelperDbOperation.EndTransaction(dtoResponse.IsSuccess, ref dbCon, ref dbTrans); } }