MainWnd and DataEntry.S620 changes
This commit is contained in:
parent
44761ff411
commit
a35716733d
@ -41,15 +41,24 @@ namespace Common
|
||||
|
||||
public static string GetSignature(ProcedureSelection source, ICollection<ProcedureSelection> allSources)
|
||||
{
|
||||
return (source == ProcedureSelection.OrderNrFromOracleDB) ? "O"
|
||||
: (source == ProcedureSelection.OrderNrFromTracingDB) ? "T"
|
||||
return (source == ProcedureSelection.OrderNrFromOracleDB) ? ""
|
||||
: (source == ProcedureSelection.OrderNrFromTracingDB) ? ""
|
||||
: (source == ProcedureSelection.FromSharedDB) ? "R"
|
||||
: (allSources != null && allSources.Contains(ProcedureSelection.FromSharedDB)) ? "L" : "";
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return string.Format("{0}{1} {2}", Signature, ItemNr, Name);
|
||||
switch (Source)
|
||||
{
|
||||
case ProcedureSelection.OrderNrFromOracleDB:
|
||||
case ProcedureSelection.OrderNrFromTracingDB:
|
||||
return Name;
|
||||
case ProcedureSelection.FromSharedDB:
|
||||
case ProcedureSelection.FromLocalDB:
|
||||
default:
|
||||
return string.Format("{0}{1} {2}", Signature, ItemNr, Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,24 +22,24 @@ namespace TBF.Rig.DataContainer.BenchInfo
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public int WaterMetersCount { get { return myCfg.WaterMetersCount; } }
|
||||
public int LinesCount { get { return myCfg.LinesCount; } }
|
||||
public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } }
|
||||
public Unit VolumeUnit { get { return myCfg.VolumeUnit; } }
|
||||
public Unit FlowUnit { get { return myCfg.FlowUnit; } }
|
||||
public Unit MassUnit { get { return myCfg.MassUnit; } }
|
||||
public Unit TempUnit { get { return myCfg.TempUnit; } }
|
||||
public Unit PressUnit { get { return myCfg.PressUnit; } }
|
||||
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public int WaterMetersCount { get { return myCfg.WaterMetersCount; } }
|
||||
public int LinesCount { get { return myCfg.LinesCount; } }
|
||||
public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } }
|
||||
public Unit VolumeUnit { get { return myCfg.VolumeUnit; } }
|
||||
public Unit FlowUnit { get { return myCfg.FlowUnit; } }
|
||||
public Unit MassUnit { get { return myCfg.MassUnit; } }
|
||||
public Unit TempUnit { get { return myCfg.TempUnit; } }
|
||||
public Unit PressUnit { get { return myCfg.PressUnit; } }
|
||||
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
|
||||
|
||||
public ICollection<ProcedureSelection> Source
|
||||
public ICollection<ProcedureSelection> Sources
|
||||
{
|
||||
get { return new ProcedureSelection[] { myCfg.Source1, myCfg.Source2, myCfg.Source3, myCfg.Source4 }; }
|
||||
}
|
||||
|
||||
@ -23,26 +23,26 @@ namespace TBF.Rig.DataContainer.iPerlBenchInfo
|
||||
|
||||
readonly ComponentCfg myCfg;
|
||||
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public int WaterMetersCount { get { return myCfg.WaterMetersCount; } }
|
||||
public int LinesCount { get { return myCfg.LinesCount; } }
|
||||
public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } }
|
||||
public Unit VolumeUnit { get { return myCfg.VolumeUnit; } }
|
||||
public Unit FlowUnit { get { return myCfg.FlowUnit; } }
|
||||
public Unit MassUnit { get { return myCfg.MassUnit; } }
|
||||
public Unit TempUnit { get { return myCfg.TempUnit; } }
|
||||
public Unit PressUnit { get { return myCfg.PressUnit; } }
|
||||
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
|
||||
public Side Side { get { return myCfg.Side; } }
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
public string TestBenchName { get { return myCfg.TestBenchName; } }
|
||||
public int TestBenchId { get { return myCfg.TestBenchId; } }
|
||||
public string Address1 { get { return myCfg.Address1; } }
|
||||
public string Address2 { get { return myCfg.Address2; } }
|
||||
public string Address3 { get { return myCfg.Address3; } }
|
||||
public string Address4 { get { return myCfg.Address4; } }
|
||||
public string Address5 { get { return myCfg.Address5; } }
|
||||
public int WaterMetersCount { get { return myCfg.WaterMetersCount; } }
|
||||
public int LinesCount { get { return myCfg.LinesCount; } }
|
||||
public int CompoundMetersCount { get { return myCfg.CompoundMetersCount; } }
|
||||
public Unit VolumeUnit { get { return myCfg.VolumeUnit; } }
|
||||
public Unit FlowUnit { get { return myCfg.FlowUnit; } }
|
||||
public Unit MassUnit { get { return myCfg.MassUnit; } }
|
||||
public Unit TempUnit { get { return myCfg.TempUnit; } }
|
||||
public Unit PressUnit { get { return myCfg.PressUnit; } }
|
||||
public Unit LengthUnit { get { return myCfg.LenghtUnit; } }
|
||||
public Side Side { get { return myCfg.Side; } }
|
||||
public int MaxTestIndex { get { return myCfg.MaxTestIndex; } } /// (MaxPruefindex % 100) value when to reject water meters completely if they are NOK
|
||||
|
||||
public ICollection<ProcedureSelection> Source
|
||||
public ICollection<ProcedureSelection> Sources
|
||||
{
|
||||
get { return new ProcedureSelection[] { myCfg.Source1, myCfg.Source2, myCfg.Source3, myCfg.Source4 }; }
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
if (entryFormCfg.ProductionTracing)
|
||||
{
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, false, true);
|
||||
myRef.modelessDlg = new FormForMechanicalMetersWithTracing(waterMeters, entryFormCfg.MaxWMsCount, entryFormCfg.CloseButton, false, true, entryFormCfg.OrdersFromProdTracing);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -22,6 +22,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
public int MaxWMsCount;
|
||||
public char CloseButton;
|
||||
public bool ProductionTracing;
|
||||
public bool OrdersFromProdTracing;
|
||||
|
||||
/// Private parameterless constructor invoked by all other (public) constructors
|
||||
EntryFormCfg() { }
|
||||
@ -35,15 +36,17 @@ namespace TBF.Rig.DataEntry.S620
|
||||
MaxWMsCount = 20;
|
||||
CloseButton = '+';
|
||||
ProductionTracing = true;
|
||||
OrdersFromProdTracing = false;
|
||||
}
|
||||
|
||||
public string ToString(int i)
|
||||
{
|
||||
return string.Format("Name={0}, MaxWMsCount={1}, CloseButton={2}, ProductionTracing={3}, Parent={4}",
|
||||
return string.Format("Name={0}, MaxWMsCount={1}, CloseButton={2}, ProdTracing={3}, OrdersFromProdTr={4}, Parent={5}",
|
||||
Name,
|
||||
MaxWMsCount,
|
||||
(CloseButton == '+') ? "+" : (CloseButton == '\t') ? "Tab" : "none",
|
||||
ProductionTracing,
|
||||
OrdersFromProdTracing,
|
||||
string.IsNullOrEmpty(ParentName) ? "-" : ParentName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,6 +77,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
maxWMsCountTextBox.Text = config.MaxWMsCount.ToString();
|
||||
closeButtonComboBox.Text = (config.CloseButton == '+') ? "+" : (config.CloseButton == '\t') ? "Tab" : "<none>";
|
||||
productionTracingCheckBox.Checked = config.ProductionTracing;
|
||||
ordersFromProdTracingCheckBox.Checked = config.OrdersFromProdTracing;
|
||||
}
|
||||
|
||||
public void Unlock()
|
||||
@ -86,6 +87,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
maxWMsCountTextBox.Enabled = true;
|
||||
closeButtonComboBox.Enabled = true;
|
||||
productionTracingCheckBox.Enabled = true;
|
||||
ordersFromProdTracingCheckBox.Enabled = true;
|
||||
}
|
||||
|
||||
public CfgUpdateFlags VerifyCfg(ref string message)
|
||||
@ -121,6 +123,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
config.MaxWMsCount = int.Parse(maxWMsCountTextBox.Text);
|
||||
config.CloseButton = (closeButtonComboBox.Text == "+") ? '+' : (closeButtonComboBox.Text == "Tab") ? '\t' : '\0';
|
||||
config.ProductionTracing = productionTracingCheckBox.Checked;
|
||||
config.OrdersFromProdTracing = ordersFromProdTracingCheckBox.Checked;
|
||||
|
||||
return flags;
|
||||
}
|
||||
|
||||
16
TBF/Rig/DataEntry/S620/EntryFormCfgCtrl.designer.cs
generated
16
TBF/Rig/DataEntry/S620/EntryFormCfgCtrl.designer.cs
generated
@ -41,6 +41,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
this.closeButtonLabel = new System.Windows.Forms.Label();
|
||||
this.maxWMsCountTextBox = new System.Windows.Forms.TextBox();
|
||||
this.maxWMsCountLabel = new System.Windows.Forms.Label();
|
||||
this.ordersFromProdTracingCheckBox = new System.Windows.Forms.CheckBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// nameTextBox
|
||||
@ -133,10 +134,22 @@ namespace TBF.Rig.DataEntry.S620
|
||||
this.maxWMsCountLabel.TabIndex = 5;
|
||||
this.maxWMsCountLabel.Text = "Max. water meters count";
|
||||
//
|
||||
// ordersFromProdTracingCheckBox
|
||||
//
|
||||
this.ordersFromProdTracingCheckBox.AutoSize = true;
|
||||
this.ordersFromProdTracingCheckBox.Enabled = false;
|
||||
this.ordersFromProdTracingCheckBox.Location = new System.Drawing.Point(155, 192);
|
||||
this.ordersFromProdTracingCheckBox.Name = "ordersFromProdTracingCheckBox";
|
||||
this.ordersFromProdTracingCheckBox.Size = new System.Drawing.Size(168, 17);
|
||||
this.ordersFromProdTracingCheckBox.TabIndex = 10;
|
||||
this.ordersFromProdTracingCheckBox.Text = "Orders from production tracing";
|
||||
this.ordersFromProdTracingCheckBox.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// EntryFormCfgCtrl
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.ordersFromProdTracingCheckBox);
|
||||
this.Controls.Add(this.maxWMsCountTextBox);
|
||||
this.Controls.Add(this.maxWMsCountLabel);
|
||||
this.Controls.Add(this.closeButtonComboBox);
|
||||
@ -148,7 +161,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
this.Controls.Add(this.nameLabel);
|
||||
this.Controls.Add(this.classNameLabel);
|
||||
this.Name = "EntryFormCfgCtrl";
|
||||
this.Size = new System.Drawing.Size(333, 200);
|
||||
this.Size = new System.Drawing.Size(333, 226);
|
||||
this.Load += new System.EventHandler(this.EntryFormCfgCtrl_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@ -167,5 +180,6 @@ namespace TBF.Rig.DataEntry.S620
|
||||
private System.Windows.Forms.Label closeButtonLabel;
|
||||
private System.Windows.Forms.TextBox maxWMsCountTextBox;
|
||||
private System.Windows.Forms.Label maxWMsCountLabel;
|
||||
private System.Windows.Forms.CheckBox ordersFromProdTracingCheckBox;
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
readonly char closeButton;
|
||||
readonly bool atTheEnd;
|
||||
readonly bool withProductionTracing;
|
||||
readonly bool ordersFromProdTracing;
|
||||
|
||||
/// To be retrieved after the form is closed
|
||||
string purchaseOrder;
|
||||
@ -218,7 +219,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
/// Constructor
|
||||
/// </summary>
|
||||
/// <param name="waterMetersCount">Number of text boxes for serial numbers</param>
|
||||
public FormForMechanicalMetersWithTracing(IList<Results.Entities.WaterMeter> waterMeters, int maxWMsCount, char closeButton, bool atTheEnd, bool withProductionTracing = true)
|
||||
public FormForMechanicalMetersWithTracing(IList<Results.Entities.WaterMeter> waterMeters, int maxWMsCount, char closeButton, bool atTheEnd, bool withProductionTracing = true, bool ordersFromProdTracing = false)
|
||||
: this()
|
||||
{
|
||||
this.waterMeters = waterMeters;
|
||||
@ -227,6 +228,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
this.closeButton = closeButton;
|
||||
this.atTheEnd = atTheEnd;
|
||||
this.withProductionTracing = withProductionTracing;
|
||||
this.ordersFromProdTracing = ordersFromProdTracing;
|
||||
|
||||
bodyNrText = new string[waterMeters.Count];
|
||||
assignedSerialNr = new int[waterMeters.Count];
|
||||
@ -250,7 +252,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
{
|
||||
try
|
||||
{
|
||||
dbSession = SharedDatabase.TracingDB.SessionFactory.OpenSession();
|
||||
dbSession = SharedDatabase.TracingDB.CreateSession(TBF.DB.CurrentBench.EventsDBSettings.ConnectionString);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
@ -677,10 +679,33 @@ namespace TBF.Rig.DataEntry.S620
|
||||
LocalSettings LS = Program.LocalSettings;
|
||||
|
||||
/// Purchase order
|
||||
for (int i = 0; i < LS.PurchaseOrderHistoryCount; i++)
|
||||
orderCB.Items.Add(LS.PurchaseOrderHistory[i]);
|
||||
if (orderCB.Items.Count > 0)
|
||||
orderCB.Text = orderCB.Items[0].ToString();
|
||||
if (ordersFromProdTracing)
|
||||
{
|
||||
try
|
||||
{
|
||||
foreach (OrderState poState in new OrderState[] { OrderState.New, OrderState.Active })
|
||||
{
|
||||
var list = dbSession.QueryOver<OrderInfo>()
|
||||
.Where(x => x.POState == (sbyte)poState)
|
||||
.List();
|
||||
foreach (var order in list) orderCB.Items.Add(order.POName);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
if (LS.PurchaseOrderHistoryCount > 0 && orderCB.Items.Contains(LS.PurchaseOrderHistory[0]))
|
||||
orderCB.Text = LS.PurchaseOrderHistory[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
/// From history
|
||||
for (int i = 0; i < LS.PurchaseOrderHistoryCount; i++)
|
||||
orderCB.Items.Add(LS.PurchaseOrderHistory[i]);
|
||||
if (orderCB.Items.Count > 0)
|
||||
orderCB.Text = orderCB.Items[0].ToString();
|
||||
}
|
||||
|
||||
/// First S/N in selected range
|
||||
for (int i = 0; i < LS.FirstSNHistoryCount; i++)
|
||||
@ -1109,7 +1134,16 @@ namespace TBF.Rig.DataEntry.S620
|
||||
|
||||
void ProcessPO()
|
||||
{
|
||||
if (ReadPurchaseOrderParamsFromDB(ProcessData.OracleDB.SelectedDB, orderCB.Text, out firstSN, out snDigits, out pcsCount, out prefix, out suffix))
|
||||
if (ordersFromProdTracing && ReadPurchaseOrderParamsFromTracingDB(dbSession, orderCB.Text, out firstSN, out snDigits, out pcsCount, out prefix, out suffix))
|
||||
{
|
||||
prefixTextBox.Text = (prefix != null) ? prefix : string.Empty;
|
||||
suffixTextBox.Text = (suffix != null) ? suffix : string.Empty;
|
||||
snDigitsTextBox.Text = snDigits.ToString();
|
||||
firstSNTextBox.Text = firstSN.ToString(string.Format("D{0}", snDigits));
|
||||
pcsCountTextBox.Text = pcsCount.ToString();
|
||||
exclamationPOLabel.Visible = false;
|
||||
}
|
||||
else if (!ordersFromProdTracing && ReadPurchaseOrderParamsFromOraDB(ProcessData.OracleDB.SelectedDB, orderCB.Text, out firstSN, out snDigits, out pcsCount, out prefix, out suffix))
|
||||
{
|
||||
prefixTextBox.Text = (prefix != null) ? prefix : string.Empty;
|
||||
suffixTextBox.Text = (suffix != null) ? suffix : string.Empty;
|
||||
@ -1135,7 +1169,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadPurchaseOrderParamsFromDB(OracleConnection connection, string orderNr, out int firstSN, out int snDigits, out int piecesCount, out string prefix, out string suffix)
|
||||
bool ReadPurchaseOrderParamsFromOraDB(OracleConnection connection, string orderNr, out int firstSN, out int snDigits, out int piecesCount, out string prefix, out string suffix)
|
||||
{
|
||||
firstSN = 0;
|
||||
piecesCount = 0;
|
||||
@ -1143,7 +1177,7 @@ namespace TBF.Rig.DataEntry.S620
|
||||
prefix = null;
|
||||
suffix = null;
|
||||
|
||||
#if DEBUG
|
||||
#if false
|
||||
firstSN = 101;
|
||||
piecesCount = 100;
|
||||
snDigits = 4;
|
||||
@ -1244,6 +1278,105 @@ namespace TBF.Rig.DataEntry.S620
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadPurchaseOrderParamsFromTracingDB(ISession session, string orderNr, out int firstSN, out int snDigits, out int piecesCount, out string prefix, out string suffix)
|
||||
{
|
||||
firstSN = 0;
|
||||
piecesCount = 0;
|
||||
snDigits = 0;
|
||||
prefix = null;
|
||||
suffix = null;
|
||||
|
||||
#if false
|
||||
firstSN = 101;
|
||||
piecesCount = 100;
|
||||
snDigits = 4;
|
||||
prefix = "M789";
|
||||
suffix = null;
|
||||
foundMeters.Clear();
|
||||
foundSNs.Clear();
|
||||
for (int sn = firstSN; sn <= 125; sn++)
|
||||
{
|
||||
foundMeters.Add(new BodySerNrResult(string.Format("681172554VQ200034{0:D3}", sn), sn, 96));
|
||||
foundSNs.Add(sn);
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
|
||||
if (session == null || string.IsNullOrEmpty(orderNr)) return false;
|
||||
|
||||
try
|
||||
{
|
||||
IList<OrderInfo> listOfOrders = new List<OrderInfo>();
|
||||
foreach (sbyte poState in new sbyte[] { (sbyte)OrderState.New, (sbyte)OrderState.Active })
|
||||
{
|
||||
/// STATUS='NEU'
|
||||
var orders = session.QueryOver<OrderInfo>()
|
||||
.Where(x => x.POName == orderNr)
|
||||
.And(x => x.POState == poState)
|
||||
.List();
|
||||
foreach (var o in orders) listOfOrders.Add(o);
|
||||
}
|
||||
|
||||
|
||||
if (listOfOrders.Count != 1)
|
||||
{
|
||||
string msg2 = string.Format("No PO={0} found in Oracle DB", orderNr);
|
||||
log.Warn(msg2);
|
||||
System.Diagnostics.Debug.WriteLine(msg2);
|
||||
return false;
|
||||
}
|
||||
|
||||
piecesCount = listOfOrders[0].PiecesCount;
|
||||
firstSN = listOfOrders[0].SNFirst;
|
||||
prefix = listOfOrders[0].SNPrefix;
|
||||
snDigits = listOfOrders[0].SNDigitsCount;
|
||||
suffix = listOfOrders[0].SNSuffix;
|
||||
|
||||
foundMeters.Clear();
|
||||
|
||||
//OracleCommand cmd2 = new OracleCommand("SELECT vt_fernum, zaehlernummer, hydr_pruefung FROM vt_zaehler_pd" +
|
||||
// " WHERE anbid=:1 AND auftragsnummer=:2 ORDER BY zaehlernummer ASC", connection);
|
||||
|
||||
//cmd2.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Int32, Value = ProcessData.OracleDB.Anbid_Producer }); ///:1
|
||||
//cmd2.Parameters.Add(new OracleParameter { OracleDbType = OracleDbType.Varchar2, Value = orderNr }); ///:2
|
||||
|
||||
//OracleDataReader dr2 = cmd2.ExecuteReader();
|
||||
//while (dr2.Read())
|
||||
//{
|
||||
// string bodyNr = dr2.GetString(0); /// Body number
|
||||
// int serialNr = dr2.GetInt32(1); /// Assigned serial number when OK, 0 when NOK
|
||||
// int result = dr2.GetInt32(2); /// HYDR_PRUEFUNG: 96=OK, 224=OK after a repetition, 97=NOK
|
||||
|
||||
// if (serialNr > 0 && result != 97)
|
||||
// {
|
||||
// foundMeters.Add(new BodySerNrResult(bodyNr, serialNr, result));
|
||||
// }
|
||||
//}
|
||||
//dr2.Close();
|
||||
|
||||
string msg = string.Format("PO={0} found in Oracle DB: first S/N={1}, total pieces count={2}, pieces produced so far={3}", orderNr, firstSN, piecesCount, foundMeters.Count);
|
||||
log.Warn(msg);
|
||||
System.Diagnostics.Debug.WriteLine(msg);
|
||||
|
||||
foundSNs.Clear();
|
||||
foreach (var mtr in foundMeters)
|
||||
{
|
||||
if (mtr.SerialNr > 0) foundSNs.Add(mtr.SerialNr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string msg = string.Format("ERROR: ORACLE DB query select AUFTRAGSNUMMER, SOLLSTUECK from VT_AUFTRAG_PD where ... failed: {0}", exc.Message);
|
||||
log.Error(msg);
|
||||
System.Diagnostics.Debug.WriteLine(msg);
|
||||
firstSN = 0;
|
||||
piecesCount = 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void firstSNRangeCB_TextChanged(object s, EventArgs e)
|
||||
{
|
||||
if (!loadedOnce) return;
|
||||
|
||||
@ -21,7 +21,7 @@ namespace TBF.Rig.GenericDevices
|
||||
int WaterMetersCount { get; }
|
||||
int LinesCount { get; }
|
||||
int CompoundMetersCount { get; }
|
||||
ICollection<ProcedureSelection> Source { get; }
|
||||
ICollection<ProcedureSelection> Sources { get; }
|
||||
Unit VolumeUnit { get; }
|
||||
Unit FlowUnit { get; }
|
||||
Unit MassUnit { get; }
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
@ -177,9 +178,9 @@ namespace TBF.UI
|
||||
/// Check remote and local configuration DB compatibility
|
||||
string msg;
|
||||
Rig.GenericDevices.IBenchInfo benchInfo = Rig.Sequences.ProcessData.BenchInfo;
|
||||
bool sharedDBUsed = benchInfo != null ? benchInfo.Source.Contains(ProcedureSelection.FromSharedDB) : false;
|
||||
bool oracleDBUsed = benchInfo != null ? benchInfo.Source.Contains(ProcedureSelection.OrderNrFromOracleDB) : false;
|
||||
bool tracingDBUsed = benchInfo != null ? benchInfo.Source.Contains(ProcedureSelection.OrderNrFromTracingDB) : false;
|
||||
bool sharedDBUsed = benchInfo != null ? benchInfo.Sources.Contains(ProcedureSelection.FromSharedDB) : false;
|
||||
bool oracleDBUsed = benchInfo != null ? benchInfo.Sources.Contains(ProcedureSelection.OrderNrFromOracleDB) : false;
|
||||
bool tracingDBUsed = benchInfo != null ? benchInfo.Sources.Contains(ProcedureSelection.OrderNrFromTracingDB) : false;
|
||||
|
||||
if (sharedDBUsed && !Rig.StateMachine.IsRemoteDBCompatible(out msg))
|
||||
{
|
||||
@ -346,7 +347,7 @@ namespace TBF.UI
|
||||
}
|
||||
|
||||
string signature = ProcedureInfo.GetSignature(ls.LastProcedureSource,
|
||||
(Rig.Sequences.ProcessData.BenchInfo != null) ? Rig.Sequences.ProcessData.BenchInfo.Source : null);
|
||||
(Rig.Sequences.ProcessData.BenchInfo != null) ? Rig.Sequences.ProcessData.BenchInfo.Sources : null);
|
||||
|
||||
SelectedProcedure = new ProcedureInfo(ls.LastProcedureSource, ls.LastProcedureNr, ls.LastProcedureName, signature);
|
||||
procedureComboBox.Text = SelectedProcedure.ToString();
|
||||
@ -452,15 +453,15 @@ namespace TBF.UI
|
||||
#if BADGER_MALA_TRAT || BADGER_STREDNA_TRAT || BADGER_VELKA_TRAT || GENESIS || CEVAK_200 || TURA_SPECIAL
|
||||
/// Do nothing = do not process keys
|
||||
#else
|
||||
if (BenchControlPanel != null && BenchControlPanel.ProcessKey(e.KeyChar))
|
||||
{
|
||||
e.Handled = true;
|
||||
log.WarnFormat("'{0}' key pressed, handled by BenchControlPanel", e.KeyChar);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.WarnFormat("'{0}' key pressed, not handled", e.KeyChar);
|
||||
}
|
||||
//if (BenchControlPanel != null && BenchControlPanel.ProcessKey(e.KeyChar))
|
||||
//{
|
||||
// e.Handled = true;
|
||||
// log.WarnFormat("'{0}' key pressed, handled by BenchControlPanel", e.KeyChar);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// log.WarnFormat("'{0}' key pressed, not handled", e.KeyChar);
|
||||
//}
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -702,6 +703,8 @@ namespace TBF.UI
|
||||
ReloadProcedureComboBoxItems(procName);
|
||||
}
|
||||
|
||||
IList<SharedDatabase.Entities.OrderInfo> mySqlOrders = new List<SharedDatabase.Entities.OrderInfo>();
|
||||
IList<Rig.Output.DB.SensusOracle.OrderDetails> oracleOrders = new List<Rig.Output.DB.SensusOracle.OrderDetails>();
|
||||
|
||||
public void ReloadProcedureComboBoxItems(string procedureNameToSelect)
|
||||
{
|
||||
@ -714,11 +717,11 @@ namespace TBF.UI
|
||||
else
|
||||
{
|
||||
bool noneOnly = true;
|
||||
foreach (var s in Rig.Sequences.ProcessData.BenchInfo.Source) if (s != ProcedureSelection.None) { noneOnly = false; break; }
|
||||
foreach (var s in Rig.Sequences.ProcessData.BenchInfo.Sources) if (s != ProcedureSelection.None) { noneOnly = false; break; }
|
||||
|
||||
sources = noneOnly
|
||||
? new ProcedureSelection[] { ProcedureSelection.FromLocalDB }
|
||||
: Rig.Sequences.ProcessData.BenchInfo.Source;
|
||||
: Rig.Sequences.ProcessData.BenchInfo.Sources;
|
||||
}
|
||||
|
||||
if (procedureComboBox.Enabled)
|
||||
@ -728,7 +731,6 @@ namespace TBF.UI
|
||||
IList<ProcedureInfo> procInfos = new List<ProcedureInfo>();
|
||||
IList<Procedure> nativeProcedures = new List<Procedure>();
|
||||
IList<ProcedureSelection> nativeSources = new List<ProcedureSelection>();
|
||||
IList<Rig.Output.DB.SensusOracle.OrderDetails> oracleOrders = new List<Rig.Output.DB.SensusOracle.OrderDetails>();
|
||||
|
||||
foreach (var src in sources)
|
||||
{
|
||||
@ -761,11 +763,21 @@ namespace TBF.UI
|
||||
}
|
||||
else if (src == ProcedureSelection.OrderNrFromTracingDB)
|
||||
{
|
||||
var orders = new List<string>() { "7654321", "8765432", "9876543" };
|
||||
|
||||
foreach (var order in orders)
|
||||
try
|
||||
{
|
||||
procInfos.Add(new ProcedureInfo(src, itemNr++, order, signature));
|
||||
mySqlOrders = SharedDatabase.TracingDB.CreateSession(TBF.DB.CurrentBench.EventsDBSettings.ConnectionString)
|
||||
.QueryOver<SharedDatabase.Entities.OrderInfo>()
|
||||
.Where(x => x.POState != (sbyte)SharedDatabase.Entities.OrderState.Finished)
|
||||
.List();
|
||||
}
|
||||
catch
|
||||
{
|
||||
mySqlOrders = new List<SharedDatabase.Entities.OrderInfo>();
|
||||
}
|
||||
|
||||
foreach (var order in mySqlOrders)
|
||||
{
|
||||
procInfos.Add(new ProcedureInfo(src, itemNr++, order.POName, signature, order.VariantCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -842,41 +854,57 @@ namespace TBF.UI
|
||||
|
||||
private void procedureComboBox_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
int startFrom;
|
||||
ProcedureSelection source;
|
||||
var benchInfo = TBF.Rig.Sequences.ProcessData.BenchInfo;
|
||||
int separPos = procedureComboBox.Text.IndexOf(ProcSeparator);
|
||||
int orderNumber;
|
||||
|
||||
if (!string.IsNullOrEmpty(procedureComboBox.Text) && procedureComboBox.Text[0] == 'O')
|
||||
if (benchInfo == null)
|
||||
{
|
||||
startFrom = 1;
|
||||
source = ProcedureSelection.OrderNrFromOracleDB;
|
||||
int procNr = int.Parse(procedureComboBox.Text.Substring(0, separPos));
|
||||
string procName = procedureComboBox.Text.Substring(separPos + ProcSeparator.Length);
|
||||
UpdateProcedure(procNr, procName, ProcedureSelection.FromLocalDB);
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(procedureComboBox.Text) && procedureComboBox.Text[0] == 'T')
|
||||
else if (int.TryParse(procedureComboBox.Text, out orderNumber))
|
||||
{
|
||||
startFrom = 1;
|
||||
source = ProcedureSelection.OrderNrFromTracingDB;
|
||||
if (benchInfo.Sources.Contains(ProcedureSelection.OrderNrFromTracingDB))
|
||||
{
|
||||
var orderInfo = mySqlOrders.FirstOrDefault(x => x.POName == procedureComboBox.Text);
|
||||
if (orderInfo != null)
|
||||
{
|
||||
UpdateProcedure(0, orderInfo.TestProcedure, ProcedureSelection.OrderNrFromTracingDB);
|
||||
}
|
||||
}
|
||||
else if (benchInfo.Sources.Contains(ProcedureSelection.OrderNrFromOracleDB))
|
||||
{
|
||||
var orderDetails = oracleOrders.FirstOrDefault(x => x.AuftragsNummer == procedureComboBox.Text);
|
||||
if (orderDetails != null)
|
||||
{
|
||||
UpdateProcedure(0, orderDetails.AuftragsNummer, ProcedureSelection.OrderNrFromOracleDB);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(procedureComboBox.Text) && (procedureComboBox.Text[0] == 'L' || procedureComboBox.Text[0] == 'R'))
|
||||
{
|
||||
startFrom = 1;
|
||||
source = (procedureComboBox.Text[0] == 'R') ? ProcedureSelection.FromSharedDB : ProcedureSelection.FromLocalDB;
|
||||
int procNr = int.Parse(procedureComboBox.Text.Substring(1, separPos));
|
||||
string procName = procedureComboBox.Text.Substring(separPos + ProcSeparator.Length);
|
||||
var source = (procedureComboBox.Text[0] == 'R') ? ProcedureSelection.FromSharedDB : ProcedureSelection.FromLocalDB;
|
||||
UpdateProcedure(procNr, procName, source);
|
||||
}
|
||||
else
|
||||
{
|
||||
startFrom = 0;
|
||||
source = ProcedureSelection.FromLocalDB;
|
||||
int procNr = int.Parse(procedureComboBox.Text.Substring(0, separPos));
|
||||
string procName = procedureComboBox.Text.Substring(separPos + ProcSeparator.Length);
|
||||
UpdateProcedure(procNr, procName, ProcedureSelection.FromLocalDB);
|
||||
}
|
||||
|
||||
int separPos = procedureComboBox.Text.IndexOf(ProcSeparator);
|
||||
|
||||
int procNr = int.Parse(procedureComboBox.Text.Substring(startFrom, separPos));
|
||||
string procName = procedureComboBox.Text.Substring(separPos + ProcSeparator.Length);
|
||||
UpdateProcedure(procNr, procName, source);
|
||||
}
|
||||
|
||||
public void UpdateProcedure(int procedureNr, string procedureName, ProcedureSelection source)
|
||||
{
|
||||
SelectedProcedure = new ProcedureInfo(source, 0, procedureName,
|
||||
ProcedureInfo.GetSignature(source, (Rig.Sequences.ProcessData.BenchInfo != null) ? Rig.Sequences.ProcessData.BenchInfo.Source : null));
|
||||
ProcedureInfo.GetSignature(source, (Rig.Sequences.ProcessData.BenchInfo != null) ? Rig.Sequences.ProcessData.BenchInfo.Sources : null));
|
||||
SelectedProcedure.ResolvedSource = ProcedureSelection.FromLocalDB;
|
||||
SelectedProcedure.ResolvedName = procedureName;
|
||||
|
||||
BenchControlPanel.ReloadTests();
|
||||
if (CurrentProcedure != null && CurrentProcedure.Description != null)
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user