using System; using System.Data; using System.Text; using XS_DAL; using XS_Model; namespace XS_BLL { public class PUBLIC_BLL { public static bool dl = true; public static void del() { try { string retEx = string.Empty; StringBuilder sql = new StringBuilder(); DataTable dt = DBOperator.GetTableSql("select * from IO_CONTROL_APPLY where DEVICE_CODE in (11001,11002) or APPLY_TASK_STATUS = 1 "); if (dt != null && dt.Rows.Count > 0) { sql.AppendLine(" DELETE from IO_CONTROL_APPLY where DEVICE_CODE in (11001,11002) and APPLY_TASK_STATUS = 0 ;"); //sql.AppendLine(" DELETE from IO_CONTROL_APPLY where DEVICE_CODE in (12009,12024) and APPLY_TASK_STATUS = 1 ;"); sql.AppendLine(" DELETE from IO_CONTROL_APPLY where APPLY_TASK_STATUS = 1 ;"); sql.AppendLine(); //删除IO_CONTROL_APPLY申请表中 垛机扫码申请任务 //bool bl = DBOperator.DelSql("DELETE from IO_CONTROL_APPLY where DEVICE_CODE in (11001,11002) and APPLY_TASK_STATUS = 0", out retEx); //bool bl2 = DBOperator.DelSql("DELETE from IO_CONTROL_APPLY where DEVICE_CODE in (12009) and APPLY_TASK_STATUS = 1", out retEx); bool bl = DBOperator.DelSql(sql.ToString(), out retEx); } //删除IO_CONTROL 任务表中 状态 为999 且taskflag 为2 的任务 //bool bl2 = DBOperator.DelSql("DELETE from IO_INTERFACE_LOG where Control_STATUS = 999 and taskflag = 2", out retEx); //删除接口 默认 30 天 int t = Convert.ToInt32(DateTime.Now.ToString("HH")); if (t % 4 == 0 && dl) { sql.Remove(0, sql.Length); sql.AppendLine(" delete from IO_INTERFACE_LOG where INTERFACE_DATETIME < DATEADD(DAY, -30, GETDATE());"); bool bl = DBOperator.DelSql(sql.ToString(), out retEx); dl = false; } else { dl = t % 4 == 0 ? false : true; } } catch (Exception) { } } /// /// 异常排出 /// /// 起始设备 /// 终止设备 /// 任务类型 /// 托盘信息 public static void errDischarge(string statDevice, string endDevice, string taskType, string STOCK_BARCODE = "") { try { #region 数据赋值 IO_CONTROL model = new IO_CONTROL(); model.CONTROL_ID = Convert.ToString(UtilityBLL.GetTempManageIdx()); model.RELATIVE_CONTROL_ID = -1; model.MANAGE_ID = 909; model.STOCK_BARCODE = STOCK_BARCODE;//SN 码 未码垛前当 托盘码用 model.MANAGE_TASK_TYPE = "1"; model.CONTROL_TASK_LEVEL = "1"; model.START_WAREHOUSE_CODE = "1"; model.END_WAREHOUSE_CODE = "1"; model.START_DEVICE_CODE = statDevice; model.END_DEVICE_CODE = endDevice; model.CONTROL_TASK_TYPE = 4;//站台移库任务 model.CONTROL_STATUS = 0; model.CONTROL_REMARK = ""; model.CONTROL_BEGIN_TIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); #endregion 数据赋值 ///注:条码重复处理 model.Insert(); } catch (Exception ex) { throw; } } } }