|
@@ -8,11 +8,7 @@ using InABox.Clients;
|
|
|
using Comal.Classes;
|
|
|
using Xamarin.Forms;
|
|
|
using Xamarin.Forms.Xaml;
|
|
|
-using System.Threading;
|
|
|
-using System.Threading.Tasks;
|
|
|
-using comal.timesheets.QAForms;
|
|
|
using XF.Material.Forms.UI.Dialogs;
|
|
|
-using comal.timesheets;
|
|
|
using Xamarin.Essentials;
|
|
|
using System.IO;
|
|
|
using PRSSecurity = InABox.Core.Security;
|
|
@@ -401,8 +397,6 @@ namespace comal.timesheets
|
|
|
purchaseOrderItem.Dimensions.Width = poItemShell.DimensionsWidth;
|
|
|
purchaseOrderItem.Dimensions.Height = poItemShell.DimensionsHeight;
|
|
|
purchaseOrderItem.Dimensions.Weight = poItemShell.DimensionsWeight;
|
|
|
- purchaseOrderItem.Dimensions.Value = poItemShell.DimensionsValue;
|
|
|
- purchaseOrderItem.Dimensions.UnitSize = poItemShell.DimensionsUnitSize;
|
|
|
purchaseOrderItem.Cost = poItemShell.Cost;
|
|
|
purchaseOrderItem.Dimensions.Unit.HasHeight = poItemShell.DimensionsHasHeight;
|
|
|
purchaseOrderItem.Dimensions.Unit.HasLength = poItemShell.DimensionsHasLength;
|
|
@@ -413,6 +407,8 @@ namespace comal.timesheets
|
|
|
purchaseOrderItem.Dimensions.Unit.Format = poItemShell.DimensionsUnitFormat;
|
|
|
purchaseOrderItem.Dimensions.Unit.Code = poItemShell.DimensionsUnitCode;
|
|
|
purchaseOrderItem.Dimensions.Unit.Description = poItemShell.DimensionsUnitDescription;
|
|
|
+ purchaseOrderItem.Dimensions.UnitSize = poItemShell.DimensionsUnitSize;
|
|
|
+ purchaseOrderItem.Dimensions.Value = poItemShell.DimensionsValue;
|
|
|
return purchaseOrderItem;
|
|
|
}
|
|
|
|
|
@@ -594,90 +590,50 @@ namespace comal.timesheets
|
|
|
{
|
|
|
foreach (CoreRow row in table.Rows)
|
|
|
{
|
|
|
- List<object> list = row.Values;
|
|
|
- if (list[0] == null) { list[0] = Guid.Empty; } //0
|
|
|
- if (list[1] == null) { list[1] = ""; } //1
|
|
|
- if (list[2] == null) { list[2] = ""; } //2
|
|
|
- if (list[3] == null) { list[3] = ""; } //3
|
|
|
- if (list[4] == null) { list[4] = ""; } //4
|
|
|
- if (list[5] == null) { list[5] = ""; } //5
|
|
|
- if (list[6] == null) { list[6] = 0F; } //6
|
|
|
- if (list[7] == null) { list[7] = Guid.Empty; } //7
|
|
|
- if (list[8] == null) { list[8] = Guid.Empty; } //8
|
|
|
- if (list[9] == null) { list[9] = DateTime.MinValue; } //9
|
|
|
- if (list[10] == null) { list[10] = Guid.Empty; } //10
|
|
|
- if (list[11] == null) { list[11] = ""; } //11
|
|
|
- if (list[12] == null) { list[12] = Guid.Empty; } //12
|
|
|
- if (list[13] == null) { list[13] = false; } //13
|
|
|
- if (list[14] == null) { list[14] = Guid.Empty; } //14
|
|
|
- if (list[15] == null) { list[15] = ""; } //15
|
|
|
- if (list[16] == null) { list[16] = ""; } //16
|
|
|
- if (list[17] == null) { list[17] = Guid.Empty; } //17
|
|
|
- if (list[18] == null) { list[18] = ""; } //18
|
|
|
- if (list[19] == null) { list[19] = ""; } //19
|
|
|
- if (list[20] == null) { list[20] = Guid.Empty; } //20
|
|
|
- if (list[21] == null) { list[21] = 0; } //21
|
|
|
- if (list[22] == null) { list[22] = 0; } //22
|
|
|
- if (list[23] == null) { list[23] = 0; } //23
|
|
|
- if (list[24] == null) { list[24] = 0; } //24
|
|
|
- if (list[25] == null) { list[25] = 0; } //25
|
|
|
- if (list[26] == null) { list[26] = 0; } //26
|
|
|
- if (list[27] == null) { list[27] = ""; } //27
|
|
|
- if (list[28] == null) { list[28] = 0; } //28
|
|
|
- if (list[28] == null) { list[29] = false; } //29
|
|
|
- if (list[29] == null) { list[30] = false; } //30
|
|
|
- if (list[30] == null) { list[31] = false; } //31
|
|
|
- if (list[31] == null) { list[32] = false; } //32
|
|
|
- if (list[32] == null) { list[33] = false; } //33
|
|
|
- if (list[33] == null) { list[34] = ""; } //34
|
|
|
- if (list[34] == null) { list[35] = ""; } //35
|
|
|
- if (list[35] == null) { list[36] = ""; } //36
|
|
|
- if (list[36] == null) { list[37] = ""; } //37
|
|
|
-
|
|
|
-
|
|
|
POItemShell item = new POItemShell()
|
|
|
{
|
|
|
- ID = Guid.Parse(list[0].ToString()),
|
|
|
- PONumber = list[1].ToString(),
|
|
|
- ConsignmentNumber = "Cons: " + list[2].ToString(),
|
|
|
- JobName = list[3].ToString(),
|
|
|
- JobNumber = list[4].ToString(),
|
|
|
- Description = list[5].ToString(),
|
|
|
- ConsignmentID = Guid.Parse(list[7].ToString()),
|
|
|
- POID = Guid.Parse(list[8].ToString()),
|
|
|
- //FormCompleted = DateTime.Parse(list[10].ToString()),
|
|
|
- ReceivedDate = DateTime.Parse(list[9].ToString()),
|
|
|
- JobID = Guid.Parse(list[10].ToString()),
|
|
|
- SupplierCode = list[11].ToString(),
|
|
|
- ProductID = Guid.Parse(list[12].ToString()),
|
|
|
- Nonstock = Boolean.Parse(list[13].ToString()),
|
|
|
- StyleID = Guid.Parse(list[14].ToString()),
|
|
|
- StyleCode = list[15].ToString(),
|
|
|
- StyleDescription = list[16].ToString(),
|
|
|
- StockLocationID = Guid.Parse(list[17].ToString()),
|
|
|
- StockLocationDescription = list[18].ToString(),
|
|
|
- StockLocationCode = list[19].ToString(),
|
|
|
- DimensionsUnitID = Guid.Parse(list[20].ToString()),
|
|
|
- DimensionsQuantity = double.Parse(list[21].ToString()),
|
|
|
- DimensionsLength = double.Parse(list[22].ToString()),
|
|
|
- DimensionsWidth = double.Parse(list[23].ToString()),
|
|
|
- DimensionsHeight = double.Parse(list[24].ToString()),
|
|
|
- DimensionsWeight = double.Parse(list[25].ToString()),
|
|
|
- DimensionsValue = double.Parse(list[26].ToString()),
|
|
|
- DimensionsUnitSize = list[27].ToString(),
|
|
|
- Cost = double.Parse(list[28].ToString()),
|
|
|
- DimensionsHasHeight = bool.Parse(list[29].ToString()),
|
|
|
- DimensionsHasLength = bool.Parse(list[30].ToString()),
|
|
|
- DimensionsHasWidth = bool.Parse(list[31].ToString()),
|
|
|
- DimensionsHasWeight = bool.Parse(list[32].ToString()),
|
|
|
- DimensionsHasQuantity = bool.Parse(list[33].ToString()),
|
|
|
- DimensionsUnitFormula = list[34].ToString(),
|
|
|
- DimensionsUnitFormat = list[35].ToString(),
|
|
|
- DimensionsUnitCode = list[36].ToString(),
|
|
|
- DimensionsUnitDescription = list[37].ToString(),
|
|
|
+ ID = row.Get<PurchaseOrderItem, Guid>(x => x.ID),
|
|
|
+ PONumber = row.Get<PurchaseOrderItem, string>(x => x.PurchaseOrderLink.PONumber),
|
|
|
+ ConsignmentNumber = "Cons: " + row.Get<PurchaseOrderItem, string>(x => x.Consignment.Number),
|
|
|
+ JobName = row.Get<PurchaseOrderItem, string>(x => x.Job.Name),
|
|
|
+ JobNumber = row.Get<PurchaseOrderItem, string>(x => x.Job.JobNumber),
|
|
|
+ Description = row.Get<PurchaseOrderItem, string>(x => x.Description),
|
|
|
+ ConsignmentID = row.Get<PurchaseOrderItem, Guid>(x => x.Consignment.ID),
|
|
|
+ POID = row.Get<PurchaseOrderItem, Guid>(x => x.PurchaseOrderLink.ID),
|
|
|
+ ReceivedDate = row.Get<PurchaseOrderItem, DateTime>(x => x.ReceivedDate),
|
|
|
+ JobID = row.Get<PurchaseOrderItem, Guid>(x => x.Job.ID),
|
|
|
+ SupplierCode = row.Get<PurchaseOrderItem, string>(x => x.SupplierCode),
|
|
|
+ ProductID = row.Get<PurchaseOrderItem, Guid>(x => x.Product.ID),
|
|
|
+ Nonstock = row.Get<PurchaseOrderItem, bool>(x => x.Product.NonStock),
|
|
|
+ StyleID = row.Get<PurchaseOrderItem, Guid>(x => x.Style.ID),
|
|
|
+ StyleCode = row.Get<PurchaseOrderItem, string>(x => x.Style.Code),
|
|
|
+ StyleDescription = row.Get<PurchaseOrderItem, string>(x => x.Style.Description),
|
|
|
+ StockLocationID = row.Get<PurchaseOrderItem, Guid>(x => x.Product.DefaultLocation.ID),
|
|
|
+ StockLocationDescription = row.Get<PurchaseOrderItem, string>(x => x.Product.DefaultLocation.Description),
|
|
|
+ StockLocationCode = row.Get<PurchaseOrderItem, string>(x => x.Product.DefaultLocation.Code),
|
|
|
+ DimensionsUnitID = row.Get<PurchaseOrderItem, Guid>(x => x.Dimensions.Unit.ID),
|
|
|
+ DimensionsQuantity = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Quantity),
|
|
|
+ DimensionsLength = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Length),
|
|
|
+ DimensionsWidth = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Width),
|
|
|
+ DimensionsHeight = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Height),
|
|
|
+ DimensionsWeight = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Weight),
|
|
|
+ DimensionsValue = row.Get<PurchaseOrderItem, double>(x => x.Dimensions.Value),
|
|
|
+ DimensionsUnitSize = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.UnitSize),
|
|
|
+ Cost = row.Get<PurchaseOrderItem, double>(x => x.Cost),
|
|
|
+ DimensionsHasHeight = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasHeight),
|
|
|
+ DimensionsHasLength = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasLength),
|
|
|
+ DimensionsHasWidth = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasWidth),
|
|
|
+ DimensionsHasWeight = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasWeight),
|
|
|
+ DimensionsHasQuantity = row.Get<PurchaseOrderItem, bool>(x => x.Dimensions.Unit.HasQuantity),
|
|
|
+ DimensionsUnitFormula = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Formula),
|
|
|
+ DimensionsUnitFormat = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Format),
|
|
|
+ DimensionsUnitCode = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Code),
|
|
|
+ DimensionsUnitDescription = row.Get<PurchaseOrderItem, string>(x => x.Dimensions.Unit.Description),
|
|
|
+ ExpectedQty = row.Get<PurchaseOrderItem, double>(x => x.Qty),
|
|
|
};
|
|
|
- if (double.TryParse(list[6].ToString(), out double result))
|
|
|
- item.ExpectedQty = result;
|
|
|
+
|
|
|
+ if (string.IsNullOrWhiteSpace(item.DimensionsUnitSize) || item.DimensionsUnitID == Guid.Empty)
|
|
|
+ item = TryFixPOItem(item, row);
|
|
|
|
|
|
poItemShells.Add(item);
|
|
|
}
|
|
@@ -696,6 +652,8 @@ namespace comal.timesheets
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private void LoadProductImages()
|
|
|
{
|
|
|
Task.Run(() =>
|
|
@@ -826,48 +784,106 @@ namespace comal.timesheets
|
|
|
return newConsignment;
|
|
|
}
|
|
|
|
|
|
- Columns<PurchaseOrderItem> columns = new Columns<PurchaseOrderItem>(x => x.ID, //0
|
|
|
- x => x.PurchaseOrderLink.PONumber, //1
|
|
|
- x => x.Consignment.Number, //2
|
|
|
- x => x.Job.Name, //3
|
|
|
- x => x.Job.JobNumber, //4
|
|
|
- x => x.Description, //5
|
|
|
- x => x.Qty, //6
|
|
|
- x => x.Consignment.ID, //7
|
|
|
- x => x.PurchaseOrderLink.ID, //8
|
|
|
- x => x.ReceivedDate, //9
|
|
|
- x => x.Job.ID, //10
|
|
|
- x => x.SupplierCode, //11
|
|
|
- x => x.Product.ID, //12
|
|
|
- x => x.Product.NonStock, //13
|
|
|
- x => x.Style.ID, //14
|
|
|
- x => x.Style.Code, //15
|
|
|
- x => x.Style.Description, //16
|
|
|
- x => x.Product.DefaultLocation.ID, //17
|
|
|
- x => x.Product.DefaultLocation.Description, //18
|
|
|
- x => x.Product.DefaultLocation.Code, //19
|
|
|
- x => x.Dimensions.Unit.ID, //20
|
|
|
- x => x.Dimensions.Quantity, //21
|
|
|
- x => x.Dimensions.Length, //22
|
|
|
- x => x.Dimensions.Width, //23
|
|
|
- x => x.Dimensions.Height, //24
|
|
|
- x => x.Dimensions.Weight, //25
|
|
|
- x => x.Dimensions.Value, //26
|
|
|
- x => x.Dimensions.UnitSize, //27
|
|
|
- x => x.Cost, //28
|
|
|
- x => x.Dimensions.Unit.HasHeight, //29
|
|
|
- x => x.Dimensions.Unit.HasLength, //30
|
|
|
- x => x.Dimensions.Unit.HasWidth, //31
|
|
|
- x => x.Dimensions.Unit.HasWeight, //32
|
|
|
- x => x.Dimensions.Unit.HasQuantity, //33
|
|
|
- x => x.Dimensions.Unit.Formula, //34
|
|
|
- x => x.Dimensions.Unit.Format, //35
|
|
|
- x => x.Dimensions.Unit.Code, //36
|
|
|
- x => x.Dimensions.Unit.Description //37
|
|
|
+ Columns<PurchaseOrderItem> columns = new Columns<PurchaseOrderItem>(x => x.ID,
|
|
|
+ x => x.PurchaseOrderLink.PONumber,
|
|
|
+ x => x.Consignment.Number,
|
|
|
+ x => x.Job.Name,
|
|
|
+ x => x.Job.JobNumber,
|
|
|
+ x => x.Description,
|
|
|
+ x => x.Qty,
|
|
|
+ x => x.Consignment.ID,
|
|
|
+ x => x.PurchaseOrderLink.ID,
|
|
|
+ x => x.ReceivedDate,
|
|
|
+ x => x.Job.ID,
|
|
|
+ x => x.SupplierCode,
|
|
|
+ x => x.Product.ID,
|
|
|
+ x => x.Product.NonStock,
|
|
|
+ x => x.Style.ID,
|
|
|
+ x => x.Style.Code,
|
|
|
+ x => x.Style.Description,
|
|
|
+ x => x.Product.DefaultLocation.ID,
|
|
|
+ x => x.Product.DefaultLocation.Description,
|
|
|
+ x => x.Product.DefaultLocation.Code,
|
|
|
+ x => x.Dimensions.Unit.ID,
|
|
|
+ x => x.Dimensions.Quantity,
|
|
|
+ x => x.Dimensions.Length,
|
|
|
+ x => x.Dimensions.Width,
|
|
|
+ x => x.Dimensions.Height,
|
|
|
+ x => x.Dimensions.Weight,
|
|
|
+ x => x.Dimensions.Value,
|
|
|
+ x => x.Dimensions.UnitSize,
|
|
|
+ x => x.Cost,
|
|
|
+ x => x.Dimensions.Unit.HasHeight,
|
|
|
+ x => x.Dimensions.Unit.HasLength,
|
|
|
+ x => x.Dimensions.Unit.HasWidth,
|
|
|
+ x => x.Dimensions.Unit.HasWeight,
|
|
|
+ x => x.Dimensions.Unit.HasQuantity,
|
|
|
+ x => x.Dimensions.Unit.Formula,
|
|
|
+ x => x.Dimensions.Unit.Format,
|
|
|
+ x => x.Dimensions.Unit.Code,
|
|
|
+ x => x.Dimensions.Unit.Description,
|
|
|
+ x => x.Product.Dimensions.UnitSize,
|
|
|
+ x => x.Product.Dimensions.Unit.ID,
|
|
|
+ x => x.Product.Dimensions.Quantity,
|
|
|
+ x => x.Product.Dimensions.Length,
|
|
|
+ x => x.Product.Dimensions.Width,
|
|
|
+ x => x.Product.Dimensions.Weight,
|
|
|
+ x => x.Product.Dimensions.Height,
|
|
|
+ x => x.Product.Dimensions.Value,
|
|
|
+ x => x.Product.Dimensions.Unit.HasHeight,
|
|
|
+ x => x.Product.Dimensions.Unit.HasLength,
|
|
|
+ x => x.Product.Dimensions.Unit.HasWeight,
|
|
|
+ x => x.Product.Dimensions.Unit.HasWidth,
|
|
|
+ x => x.Product.Dimensions.Unit.HasQuantity,
|
|
|
+ x => x.Product.Dimensions.Unit.Format,
|
|
|
+ x => x.Product.Dimensions.Unit.Formula,
|
|
|
+ x => x.Product.Dimensions.Unit.Code,
|
|
|
+ x => x.Product.Dimensions.Unit.Description
|
|
|
);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ private POItemShell TryFixPOItem(POItemShell item, CoreRow row)
|
|
|
+ {
|
|
|
+ PurchaseOrderItem poItem = row.ToObject<PurchaseOrderItem>();
|
|
|
+ poItem.Dimensions.Quantity = poItem.Product.Dimensions.Quantity;
|
|
|
+ poItem.Dimensions.Length = poItem.Product.Dimensions.Length;
|
|
|
+ poItem.Dimensions.Width = poItem.Product.Dimensions.Width;
|
|
|
+ poItem.Dimensions.Height = poItem.Product.Dimensions.Height;
|
|
|
+ poItem.Dimensions.Weight = poItem.Product.Dimensions.Weight;
|
|
|
+ poItem.Dimensions.Unit.ID = poItem.Product.Dimensions.Unit.ID;
|
|
|
+ poItem.Dimensions.Unit.HasHeight = poItem.Product.Dimensions.Unit.HasHeight;
|
|
|
+ poItem.Dimensions.Unit.HasLength = poItem.Product.Dimensions.Unit.HasLength;
|
|
|
+ poItem.Dimensions.Unit.HasWidth = poItem.Product.Dimensions.Unit.HasWidth;
|
|
|
+ poItem.Dimensions.Unit.HasWeight = poItem.Product.Dimensions.Unit.HasWeight;
|
|
|
+ poItem.Dimensions.Unit.HasQuantity = poItem.Product.Dimensions.Unit.HasQuantity;
|
|
|
+ poItem.Dimensions.Unit.Formula = poItem.Product.Dimensions.Unit.Formula;
|
|
|
+ poItem.Dimensions.Unit.Code = poItem.Product.Dimensions.Unit.Code;
|
|
|
+ poItem.Dimensions.Unit.Description = poItem.Product.Dimensions.Unit.Description;
|
|
|
+ poItem.Dimensions.UnitSize = poItem.Product.Dimensions.UnitSize;
|
|
|
+ poItem.Dimensions.Value = poItem.Product.Dimensions.Value;
|
|
|
+
|
|
|
+ Task.Run(() => { new Client<PurchaseOrderItem>().Save(poItem, "Fix Dimensions on Receivals App"); });
|
|
|
+
|
|
|
+ item.DimensionsQuantity = poItem.Dimensions.Quantity;
|
|
|
+ item.DimensionsLength = poItem.Dimensions.Length;
|
|
|
+ item.DimensionsWeight = poItem.Dimensions.Weight;
|
|
|
+ item.DimensionsWidth = poItem.Dimensions.Width;
|
|
|
+ item.DimensionsHeight = poItem.Dimensions.Height;
|
|
|
+ item.DimensionsUnitID = poItem.Dimensions.Unit.ID;
|
|
|
+ item.DimensionsHasHeight = poItem.Dimensions.Unit.HasHeight;
|
|
|
+ item.DimensionsHasLength = poItem.Dimensions.Unit.HasLength;
|
|
|
+ item.DimensionsHasWidth = poItem.Dimensions.Unit.HasWidth;
|
|
|
+ item.DimensionsHasWeight = poItem.Dimensions.Unit.HasWeight;
|
|
|
+ item.DimensionsHasQuantity = poItem.Dimensions.Unit.HasQuantity;
|
|
|
+ item.DimensionsUnitFormula = poItem.Dimensions.Unit.Formula;
|
|
|
+ item.DimensionsUnitFormat = poItem.Dimensions.Unit.Format;
|
|
|
+ item.DimensionsUnitCode = poItem.Dimensions.Unit.Code;
|
|
|
+ item.DimensionsUnitDescription = poItem.Dimensions.Unit.Description;
|
|
|
+ item.DimensionsUnitSize = poItem.Dimensions.UnitSize;
|
|
|
+ item.DimensionsValue = poItem.Dimensions.Value;
|
|
|
+
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ }
|
|
|
#endregion
|
|
|
|
|
|
|