DataEntry.S620 : Serial number assignment fixed, AssignedSN = -1 when not assigned, ver. 3.1.1843
This commit is contained in:
parent
ba549cbaee
commit
1f0bbc0d4e
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("3.1.1840.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1840.0")]
|
||||
[assembly: AssemblyVersion("3.1.1843.0")]
|
||||
[assembly: AssemblyFileVersion("3.1.1843.0")]
|
||||
|
||||
@ -87,6 +87,9 @@ namespace TBF.Rig.DataEntry.S620
|
||||
static IList<Part> uniqueCodeParts;
|
||||
static IList<ICheckItem> palety;
|
||||
|
||||
int lastProducedPcsCount;
|
||||
int lastAssignedSN;
|
||||
|
||||
static FormForMechanicalMetersWithTracing()
|
||||
{
|
||||
workflows = new List<Process>();
|
||||
@ -417,27 +420,29 @@ namespace TBF.Rig.DataEntry.S620
|
||||
assignedSNs.Clear();
|
||||
|
||||
var order = ProcessData.OrderInfo;
|
||||
var oraOrder = order as TBF.Rig.Output.DB.SensusOracle.OrderDetails;
|
||||
///
|
||||
var oraOrder = order as TBF.Rig.Output.DB.SensusOracle.OrderDetails;
|
||||
if (oraOrder != null && (ProcessData.OracleDB == null || !ProcessData.OracleDB.ReadOrderDetails(ref oraOrder)))
|
||||
{
|
||||
return false;
|
||||
return false; /// Oracle order details could not be loaded
|
||||
}
|
||||
|
||||
lastProducedPcsCount = order.CurrentPcsCount;
|
||||
lastAssignedSN = order.CurrentSN;
|
||||
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
bool passed = waterMeters[i].PassedFromTests();
|
||||
if (passed && !string.IsNullOrEmpty(bodyNrBoxes[i].Text) && checkBoxes[i].Checked)
|
||||
if (passed && !string.IsNullOrEmpty(bodyNrBoxes[i].Text) && checkBoxes[i].Checked && lastProducedPcsCount < order.PiecesCount)
|
||||
{
|
||||
int currentSerialNr = (order.CurrentSN < order.SNFirst)
|
||||
int currentSerialNr = (lastAssignedSN < order.SNFirst)
|
||||
? order.SNFirst
|
||||
: order.CurrentSN + 1;
|
||||
: lastAssignedSN + 1;
|
||||
|
||||
serialNrBoxes[i].Text = currentSerialNr.ToString(string.Format("D{0}", snDigits));
|
||||
|
||||
order.CurrentSN = currentSerialNr;
|
||||
order.CurrentPcsCount++;
|
||||
lastAssignedSN = currentSerialNr;
|
||||
lastProducedPcsCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -775,21 +780,27 @@ namespace TBF.Rig.DataEntry.S620
|
||||
}
|
||||
|
||||
/// Read UI data and store them to 'interface' variables
|
||||
int itmp;
|
||||
for (int i = 0; i < textBoxesCount; i++)
|
||||
{
|
||||
bodyNrText[i] = bodyNrBoxes[i].Text;
|
||||
if (atTheEnd)
|
||||
{
|
||||
assignedSerialNr[i] = int.TryParse(serialNrBoxes[i].Text, out itmp) ? itmp : 0;
|
||||
completeSerialNr[i] = string.Format("{0}{1}{2}",
|
||||
(prefix != null) ? prefix : string.Empty,
|
||||
assignedSerialNr[i].ToString(string.Format("D{0}", Math.Max(snDigits, 1))),
|
||||
(suffix != null) ? suffix : string.Empty);
|
||||
int nonnegativeSN;
|
||||
bool isAssigned = int.TryParse(serialNrBoxes[i].Text, out nonnegativeSN) && nonnegativeSN >= 0;
|
||||
assignedSerialNr[i] = !isAssigned ? -1 : nonnegativeSN;
|
||||
completeSerialNr[i] = !isAssigned ? string.Empty : string.Format("{0}{1}{2}", (prefix != null) ? prefix : string.Empty,
|
||||
assignedSerialNr[i].ToString(string.Format("D{0}", Math.Max(snDigits, 1))),
|
||||
(suffix != null) ? suffix : string.Empty);
|
||||
}
|
||||
disabled[i] = !checkBoxes[i].Checked;
|
||||
}
|
||||
purchaseOrder = (preSelectedPurchaseOrder != null) ? preSelectedPurchaseOrder : orderCB.Text;
|
||||
|
||||
if (atTheEnd && ProcessData.OrderInfo != null)
|
||||
{
|
||||
ProcessData.OrderInfo.CurrentPcsCount = lastProducedPcsCount;
|
||||
ProcessData.OrderInfo.CurrentSN = lastAssignedSN;
|
||||
}
|
||||
|
||||
|
||||
//SaveProductionTracingRecords(); /// TODO
|
||||
|
||||
@ -797,6 +808,9 @@ namespace TBF.Rig.DataEntry.S620
|
||||
Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Not used now
|
||||
/// </summary>
|
||||
private void SaveProductionTracingRecords()
|
||||
{
|
||||
if (atTheEnd)
|
||||
@ -1521,26 +1535,6 @@ namespace TBF.Rig.DataEntry.S620
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns next free serial number within specified range or 0 if no appropriate s/n is available
|
||||
/// </summary>
|
||||
/// <returns>Serial number or 0</returns>
|
||||
int GetNextSerialNr()
|
||||
{
|
||||
for (int sn = snRangeFirst; sn <= snRangeLast; sn++)
|
||||
{
|
||||
if (!foundSNs.Contains(sn) && !assignedSNs.Contains(sn))
|
||||
{
|
||||
/// A free serial number within specified range found
|
||||
assignedSNs.Add(sn);
|
||||
return sn;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; /// No free serial number found
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Read released-active processes from the database.
|
||||
/// </summary>
|
||||
|
||||
@ -963,6 +963,13 @@ namespace TBF.Rig.TestMethods.S640Communication
|
||||
{
|
||||
/// Disable the water meter to prevent sealing
|
||||
wm.Disabled = true;
|
||||
wm.AssignedSerialNr = -1;
|
||||
wm.Prefix = order.SNPrefix;
|
||||
wm.Suffix = order.SNSuffix;
|
||||
wm.CompleteSerialNr = string.Empty;
|
||||
|
||||
assignedSNs[i].Text = wm.CompleteSerialNr;
|
||||
assignedRadioAddresses[i].Text = wm.RadioAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user