123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- using System;
- using System.Linq;
- using WCS_Client.Models;
- namespace WCS_Client.Workflow
- {
- public class SystemConfigWorkflow
- {
- /// <summary>
- /// 系统配置写入
- /// </summary>
- /// <param name="convNo">设备编号</param>
- /// <param name="isStop">是否启用</param>
- /// <returns></returns>
- /// <exception cref="Exception"></exception>
- public static string SystemConfigSet(string convNo, bool isStop)
- {
- string result = TryCachHelper.TryExecute((db) =>
- {
- //var srmoutinInfo = db.Queryable<WCS_SRMOUTININFO>().First(v => v.SRMOUTIN_CONVNO == convNo);
- var systemConfig = db.Queryable<WCS_SystemConfig>().First(v => v.DEVICECODE == convNo);
- if (systemConfig == null)
- {
- throw new Exception(string.Format("未查询到堆垛机出入口[{0}]信息", convNo));
- }
- else
- {
- if (db.Updateable<WCS_SystemConfig>()
- .UpdateColumns(it => new WCS_SystemConfig
- {
- ENABLED = isStop,
- UPDATETIME = DateTime.Now
- })
- .Where(v => v.DEVICECODE == convNo).ExecuteCommand() < 0)
- {
- throw new Exception(string.Format("堆垛机出入口[{0}]禁(启)用失败", convNo));
- }
- }
- });
- return result;
- }
- public static string AgvSet(string convNo, bool enable, string LCName)
- {
- string result = TryCachHelper.TryExecute((db) =>
- {
- var srmoutinInfo = db.Queryable<WCS_AGV_Config>().First(v => v.POSITION == convNo);
- if (srmoutinInfo == null)
- {
- throw new Exception(string.Format("未查询到产线[{0}]信息", convNo));
- }
- else
- {
- if (LCName == "btn_InEnable")
- {
- if (db.Updateable<WCS_AGV_Config>()
- .UpdateColumns(it => new WCS_AGV_Config
- {
- INENABLE = enable
- })
- .Where(v => v.POSITION == convNo).ExecuteCommand() < 0)
- {
- throw new Exception(string.Format("产线[{0}]入库启用失败", convNo));
- }
- }
- else if (LCName == "btn_OutEnable")
- {
- if (db.Updateable<WCS_AGV_Config>()
- .UpdateColumns(it => new WCS_AGV_Config
- {
- OUTENABLE = enable
- })
- .Where(v => v.POSITION == convNo).ExecuteCommand() < 0)
- {
- throw new Exception(string.Format("产线[{0}]出库启用失败", convNo));
- }
- }
- else if (LCName == "btn_InStop")
- {
- if (db.Updateable<WCS_AGV_Config>()
- .UpdateColumns(it => new WCS_AGV_Config
- {
- INENABLE = enable
- })
- .Where(v => v.POSITION == convNo).ExecuteCommand() < 0)
- {
- throw new Exception(string.Format("产线[{0}]入库禁用失败", convNo));
- }
- }
- else if (LCName == "btn_OutStop")
- {
- if (db.Updateable<WCS_AGV_Config>()
- .UpdateColumns(it => new WCS_AGV_Config
- {
- OUTENABLE = enable
- })
- .Where(v => v.POSITION == convNo).ExecuteCommand() < 0)
- {
- throw new Exception(string.Format("产线[{0}]出库禁用失败", convNo));
- }
- }
- }
- });
- return result;
- }
- }
- }
|