//测试 private void btTest_Click(object sender, RoutedEventArgs e) { if (lvPos.SelectedItems.Count > 0) { ErrorPos p = lvPos.SelectedItems[0] as ErrorPos; string poscode = p.PosCode; PLC_Tcp_CP.ClearRecordSingle(poscode); Thread.Sleep(100); PLC_Tcp_CP.DCTMoveDownSingle(poscode); Thread.Sleep(1000); int n = PLC_Tcp_CP.ReadRecordSingle(poscode); if (n == 1) { csMsg.ShowInfo("出药成功", true); } else if (n > 1) { csMsg.ShowWarning("多出药", true); } else { csMsg.ShowWarning("未出药", true); } } }
//重新盘点 private void btPD_Click(object sender, RoutedEventArgs e) { if (lvPos.SelectedItems.Count > 0) { ErrorPos p = lvPos.SelectedItems[0] as ErrorPos; string poscode = p.PosCode; int n = PLC_Tcp_AP.PDNum(poscode, string.IsNullOrEmpty(p.DrugOnlyCode)); tbNum.Text = n.ToString(); } }
/// <inheritdoc/> public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + Unexpected.GetHashCode(); hash = hash * 23 + EOF.GetHashCode(); hash = hash * 23 + Expected.GetHashCode(); hash = hash * 23 + ErrorPos.GetHashCode(); hash = hash * 23 + Message?.GetHashCode() ?? 0; return(hash); } }
//启用 private void btOpen_Click(object sender, RoutedEventArgs e) { if (lvPos.SelectedItems.Count > 0) { ErrorPos p = lvPos.SelectedItems[0] as ErrorPos; string poscode = p.PosCode; string sql = "update drug_pos set errornum=0 where maccode='{0}' and poscode='{1}';"; sql += "delete from sys_error where maccode='{0}' and poscode='{1}' and errortype='1'"; sql = string.Format(sql, Config.Soft.MacCode, poscode); csSql.ExecuteSql(sql, Config.Soft.ConnString); ShowRecord(); } }
//更新库存 private void btUpdate_Click(object sender, RoutedEventArgs e) { if (lvPos.SelectedItems.Count > 0) { ErrorPos p = lvPos.SelectedItems[0] as ErrorPos; if (!string.IsNullOrEmpty(p.DrugOnlyCode)) { string poscode = p.PosCode; string sql = "update drug_pos set drugnum={0} where maccode='{1}' and poscode='{2}';"; sql = string.Format(sql, tbNum.Text, Config.Soft.MacCode, poscode); sql += "delete from sys_error where errortype='PE' and maccode='{0}' and poscode='{1}'"; sql = string.Format(sql, Config.Soft.MacCode, poscode); csSql.ExecuteSql(sql, Config.Soft.ConnString); ShowRecord(); } } }