private void tmUpErpWorker(object sender, System.Timers.ElapsedEventArgs e) { lock (this) { try { tmUpErpWorkTimer.Stop(); App.Dispatching.Process.Report report = new Dispatching.Process.Report(); DataParameter[] para = new DataParameter[] { new DataParameter("{0}", string.Format("WCS_TASK.State in (7,9) and WCS_TASK.FinishReturnCode!='000' and WCS_TASK.WarehouseCode='{0}'", Program.WarehouseCode)) }; DataTable dt = bll.FillDataTable("WCS.SelectTask", para); for (int i = 0; i < dt.Rows.Count; i++) { string TaskNo = dt.Rows[i]["TaskNo"].ToString(); int Flag = 3; if (dt.Rows[i]["State"].ToString() == "9") { Flag = 5; } report.Send2MJWcs(context, Flag, TaskNo); Logger.Info("WCS重新上传任务完成标志,任务号:" + TaskNo); } } catch (Exception ex) { Logger.Error(ex.Message); } finally { tmUpErpWorkTimer.Start(); } } }
/// <summary> /// 状态切换 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ToolStripMenuItem_Click(object sender, EventArgs e) { string ItemName = ((ToolStripMenuItem)sender).Name; string State = ItemName.Replace("ToolStripMenuItem", ""); if (this.dgvMain.CurrentCell != null) { BLL.BLLBase bll = new BLL.BLLBase(); string TaskNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[0].Value.ToString(); DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) }; bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param); BindData(); try { App.Dispatching.Process.Report report = new Dispatching.Process.Report(); if (State == "7") { report.Send2MES(TaskNo); } } catch (Exception ex) { Logger.Error("切换状态,上报MES时发生错误:" + ex.Message); } } }
private void ToolStripMenuItemCellCode_Click(object sender, EventArgs e) { if (this.dgvMain.CurrentCell != null) { BLL.BLLBase bll = new BLL.BLLBase(); string TaskNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[0].Value.ToString(); string TaskType = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells["colTaskType"].Value.ToString(); string AlarmCode = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells["colAlarmCode"].ToString(); if (AlarmCode == "503" || AlarmCode == "504") { App.Dispatching.Process.Report report = new Dispatching.Process.Report(); report.Send2MJWcs(context, 4, TaskNo); } else { Logger.Info("非重入或入库货位阻塞不可重新申请货位"); } } }
private void ToolStripMenuItem_Click(object sender, EventArgs e) { string ItemName = ((ToolStripMenuItem)sender).Name; string State = ItemName.Substring(ItemName.Length - 1, 1); if (this.dgvMain.CurrentCell != null) { BLL.BLLBase bll = new BLL.BLLBase(); string TaskNo = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[0].Value.ToString(); string TaskState = this.dgvMain.Rows[this.dgvMain.CurrentCell.RowIndex].Cells[2].Value.ToString(); if (TaskState == "等待" && State == "7") { frmChangefalse frm = new frmChangefalse(); frm.ShowDialog(); return; } DataParameter[] param = new DataParameter[] { new DataParameter("@TaskNo", TaskNo), new DataParameter("@State", State) }; bll.ExecNonQueryTran("WCS.Sp_UpdateTaskState", param); BindData(); Logger.Info("任务:" + TaskNo + " 手动切换状态为:" + State); try { App.Dispatching.Process.Report report = new Dispatching.Process.Report(); if (State == "7") { report.Send2MJWcs(context, 3, TaskNo); } else if (State == "9") { report.Send2MJWcs(context, 5, TaskNo); } } catch (Exception ex) { Logger.Error("切换状态,上报MJ-WCS时发生错误:" + ex.Message); } } }