ソースを参照

Fixed Digital Form Save/Load
Fixed Clock On/Off issues
Fixed Crash in QuickPickModule

Frank van den Bos 7 ヶ月 前
コミット
be35c91831

+ 1 - 1
prs.mobile.new/PRS.Mobile.Droid/Properties/AndroidManifest.xml

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="824000" android:versionName="8.24.0" package="comal.timesheets.Android">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="824200" android:versionName="8.24.2" package="comal.timesheets.Android">
 	<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="34" />
 	<uses-sdk android:minSdkVersion="28" android:targetSdkVersion="34" />
 	<queries>
 	<queries>
 		<intent>
 		<intent>

+ 1 - 1
prs.mobile.new/PRS.Mobile.iOS/Info.plist

@@ -27,7 +27,7 @@
 	<key>CFBundleIdentifier</key>
 	<key>CFBundleIdentifier</key>
 	<string>com.prsdigital.prssiteapp</string>
 	<string>com.prsdigital.prssiteapp</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>8.24.0</string>
+	<string>8.24.2</string>
 	<key>UILaunchStoryboardName</key>
 	<key>UILaunchStoryboardName</key>
 	<string>LaunchScreen</string>
 	<string>LaunchScreen</string>
 	<key>CFBundleName</key>
 	<key>CFBundleName</key>

+ 6 - 14
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/DataModels/DigitalFormHostModel.cs

@@ -38,19 +38,15 @@ namespace PRS.Mobile
                 DigitalFormLayout = layout ?? QueryDigitalFormLayout(formid);
                 DigitalFormLayout = layout ?? QueryDigitalFormLayout(formid);
             });
             });
             
             
-            var getVariables = Task.Run(() =>
-            {
-                variables = QueryVariables(formid);
-            });
-            
             var loadDFDataModel = Task.Run(() =>
             var loadDFDataModel = Task.Run(() =>
             {
             {
-                DigitalFormDataModel = new DigitalFormDataModel<TEntity, TEntityLink, TInstance>(parent.ID, instanceid);
+                variables = QueryVariables(formid);
+                DigitalFormDataModel = new DigitalFormDataModel<TEntity, TEntityLink, TInstance>(parent.ID, instanceid, variables.ToArray());
                 DigitalFormDataModel.Load(null);
                 DigitalFormDataModel.Load(null);
                 Entity = DigitalFormDataModel.Entity;
                 Entity = DigitalFormDataModel.Entity;
             });
             });
             
             
-            Task.WaitAll(loadLayout, getVariables, loadDFDataModel);
+            Task.WaitAll(loadLayout, loadDFDataModel);
             
             
             DFLayout.LoadLayout(DigitalFormLayout.Layout);
             DFLayout.LoadLayout(DigitalFormLayout.Layout);
             
             
@@ -77,19 +73,15 @@ namespace PRS.Mobile
                 DigitalFormLayout = layout ?? QueryDigitalFormLayout(formid);
                 DigitalFormLayout = layout ?? QueryDigitalFormLayout(formid);
             });
             });
             
             
-            var getVariables = Task.Run(() =>
-            {
-                variables = QueryVariables(formid);
-            });
-            
             var loadDFDataModel = Task.Run(() =>
             var loadDFDataModel = Task.Run(() =>
             {
             {
-                DigitalFormDataModel = new DigitalFormDataModel<TEntity, TEntityLink, TInstance>(parent, instance);
+                variables = QueryVariables(formid);
+                DigitalFormDataModel = new DigitalFormDataModel<TEntity, TEntityLink, TInstance>(parent, instance, variables.ToArray());
                 DigitalFormDataModel.Load(null);
                 DigitalFormDataModel.Load(null);
                 Entity = DigitalFormDataModel.Entity;
                 Entity = DigitalFormDataModel.Entity;
             });
             });
             
             
-            Task.WaitAll(loadLayout, getVariables, loadDFDataModel);
+            Task.WaitAll(loadLayout, loadDFDataModel);
             
             
             DFLayout.LoadLayout(DigitalFormLayout.Layout);
             DFLayout.LoadLayout(DigitalFormLayout.Layout);
             
             

+ 10 - 1
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/QAFormViewer.cs

@@ -119,9 +119,18 @@ namespace PRS.Mobile
         {
         {
             foreach (DFLayoutField field in Bindings.Keys)
             foreach (DFLayoutField field in Bindings.Keys)
             {
             {
+                
                 try
                 try
                 {
                 {
-                    if (RetainedData.HasValue(field.Name))
+                    var prop = field.GetPropertyValue <string> ("Property");
+                    if (!string.IsNullOrWhiteSpace(prop))
+                    {
+                        var binding = Bindings[field];
+                        binding.Value = CoreUtils.GetPropertyValue(_model.Entity, prop);
+                        if (binding is DigitalFormLookupView lv && binding.Value is Guid id)
+                            lv.DoLookup(id);
+                    }
+                    else if (RetainedData.HasValue(field.Name))
                         Bindings[field].Deserialize(RetainedData.GetEntry(field.Name));
                         Bindings[field].Deserialize(RetainedData.GetEntry(field.Name));
                     else if (Storage.HasValue(field.Name))
                     else if (Storage.HasValue(field.Name))
                         Bindings[field].Deserialize(Storage.GetEntry(field.Name));
                         Bindings[field].Deserialize(Storage.GetEntry(field.Name));

+ 24 - 0
prs.mobile.new/PRS.Mobile/Components/DigitalForms/Editor/Views/DigitalFormLookupView.cs

@@ -1,5 +1,6 @@
 using System;
 using System;
 using System.Linq;
 using System.Linq;
+using InABox.Clients;
 using InABox.Core;
 using InABox.Core;
 using InABox.Mobile;
 using InABox.Mobile;
 using Xamarin.Forms;
 using Xamarin.Forms;
@@ -65,6 +66,29 @@ namespace PRS.Mobile
         {
         {
             _value = new DFLayoutLookupValue();
             _value = new DFLayoutLookupValue();
         }
         }
+
+        public void DoLookup(Guid id)
+        {
+            if (Definition == null)
+                return;
+            var lookupType = CoreUtils.GetEntity(Definition.Properties.LookupType);
+            var filter = Filter.Create(lookupType, "ID").IsEqualTo(id);
+            var columns = Columns.Create(lookupType, ColumnTypeFlags.None)
+                .Add("ID")
+                .Add(Definition.Properties.Property)
+                .Add(Definition.Properties.AdditionalPropertiesList)
+                .Add(LookupFactory.DefineColumns(lookupType).ColumnNames());
+            
+            var row = Client.Create(lookupType).Query(filter, columns).Rows.FirstOrDefault();
+            if (row == null)
+                return;
+            
+            _value.ID = row.Get<Guid>("ID");
+            _value.Text = LookupFactory.FormatLookup(lookupType, row.ToDictionary(), new[] { "ID" });
+            _value.Values = row.ToDictionary();
+            UpdateUI();
+
+        }
         
         
         protected void DoLookup(object sender, MobileButtonClickEventArgs args)
         protected void DoLookup(object sender, MobileButtonClickEventArgs args)
         {
         {

+ 8 - 14
prs.mobile.new/PRS.Mobile/MainPage.xaml.cs

@@ -492,10 +492,10 @@ namespace PRS.Mobile
                                 if (_currenttimesheet.Date != DateTime.Today)
                                 if (_currenttimesheet.Date != DateTime.Today)
                                 {
                                 {
                                     var here = GPSLocation();
                                     var here = GPSLocation();
-                                    _currenttimesheet.FinishLocation = here;
+                                    _currenttimesheet.FinishLocation.CopyFrom(here);
                                     _currenttimesheet.Finish = TimeSpan.FromDays(1).Subtract(TimeSpan.FromSeconds(1));
                                     _currenttimesheet.Finish = TimeSpan.FromDays(1).Subtract(TimeSpan.FromSeconds(1));
                                     new Client<TimeSheet>().Save(_currenttimesheet,
                                     new Client<TimeSheet>().Save(_currenttimesheet,
-                                        "Closing Timesheet at Modnight on Mobile Device");
+                                        "Closing Timesheet at Midnight on Mobile Device");
                                     CreateTimeSheet(_currenttimesheet.JobLink.ID, _currenttimesheet.JobLink.JobNumber, _currenttimesheet.JobLink.Name, here, here.Address, "Creating Timeheet at Midnight on Mobile Device");
                                     CreateTimeSheet(_currenttimesheet.JobLink.ID, _currenttimesheet.JobLink.JobNumber, _currenttimesheet.JobLink.Name, here, here.Address, "Creating Timeheet at Midnight on Mobile Device");
                                 }
                                 }
                             }
                             }
@@ -583,7 +583,7 @@ namespace PRS.Mobile
                 {
                 {
                     _currenttimesheet.Finish =
                     _currenttimesheet.Finish =
                         new TimeSpan(DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, 0);
                         new TimeSpan(DateTime.Now.TimeOfDay.Hours, DateTime.Now.TimeOfDay.Minutes, 0);
-                    _currenttimesheet.FinishLocation = here;
+                    _currenttimesheet.FinishLocation .CopyFrom(here);
                     //bUpdatingTimesheet = true;
                     //bUpdatingTimesheet = true;
                     new Client<TimeSheet>().Save(_currenttimesheet, "Clocking Off");
                     new Client<TimeSheet>().Save(_currenttimesheet, "Clocking Off");
                 }
                 }
@@ -849,22 +849,16 @@ namespace PRS.Mobile
             {
             {
                 _currenttimesheet = new TimeSheet
                 _currenttimesheet = new TimeSheet
                 {
                 {
-                    EmployeeLink =
-                    {
-                        ID = App.Data.Me.ID
-                    },
                     Date = DateTime.Today,
                     Date = DateTime.Today,
-                    StartLocation = location,
-                    JobLink =
-                    {
-                        ID = jobid,
-                        JobNumber = jobnumber,
-                        Name = jobname
-                    },
                     Address = address,
                     Address = address,
                     SoftwareVersion = MobileUtils.AppVersion.InstalledVersionNumber + App.DeviceString,
                     SoftwareVersion = MobileUtils.AppVersion.InstalledVersionNumber + App.DeviceString,
                     Start = (DateTime.Now - DateTime.Today).Floor(TimeSpan.FromMinutes(1))
                     Start = (DateTime.Now - DateTime.Today).Floor(TimeSpan.FromMinutes(1))
                 };
                 };
+                _currenttimesheet.EmployeeLink.ID = App.Data.Me.ID;
+                _currenttimesheet.JobLink.ID = jobid;
+                _currenttimesheet.JobLink.JobNumber = jobnumber;
+                _currenttimesheet.JobLink.Name = jobname;
+                _currenttimesheet.StartLocation.CopyFrom(location);
                 new Client<TimeSheet>().Save(_currenttimesheet, auditmessage);
                 new Client<TimeSheet>().Save(_currenttimesheet, auditmessage);
 
 
             }
             }

+ 1 - 1
prs.mobile.new/PRS.Mobile/Modules/Warehousing/QuickPick/QuickPickModule.xaml

@@ -12,7 +12,7 @@
     </mobile:MobilePage.BindingContext>
     </mobile:MobilePage.BindingContext>
     
     
     <mobile:MobilePage.Resources>
     <mobile:MobilePage.Resources>
-        <mobile:ByteArrayToImageSourceConverter x:Key="ByteArrayToImageSourceConverter"/>
+        <mobile:ByteArrayToImageSourceConverter x:Key="ByteArrayToImageSourceConverter" BlankIfEmpty="False"/>
         <mobile:StringWithDefaultValueConverter x:Key="DefaultToGeneralStock" Default="(General Stock)" />
         <mobile:StringWithDefaultValueConverter x:Key="DefaultToGeneralStock" Default="(General Stock)" />
         <mobile:DoubleCalculator x:Key="ScannerHeightCalculator" Type="Product" Constants="0.65"/>
         <mobile:DoubleCalculator x:Key="ScannerHeightCalculator" Type="Product" Constants="0.65"/>
         <mobile:IntToBooleanConverter x:Key="SummaryPageVisible" Value="1" Result="True" />
         <mobile:IntToBooleanConverter x:Key="SummaryPageVisible" Value="1" Result="True" />

+ 2 - 1
prs.mobile.new/PRS.Mobile/Modules/Warehousing/QuickPick/QuickPickModule.xaml.cs

@@ -144,7 +144,8 @@ namespace PRS.Mobile
                         requiItem.DimensionsValue = args.Holding.DimensionsValue;
                         requiItem.DimensionsValue = args.Holding.DimensionsValue;
                         requiItem.DimensionsUnitSize = args.Holding.DimensionsUnitSize;
                         requiItem.DimensionsUnitSize = args.Holding.DimensionsUnitSize;
                         requiItem.ImageID = args.Holding.ImageID;
                         requiItem.ImageID = args.Holding.ImageID;
-                        _viewModel.RequisitionItems.Images[args.Holding.ImageID] = args.Holding.Parent.Images[args.Holding.ImageID];
+                        if (args.Holding.Parent.Images.TryGetValue(args.Holding.ImageID, out var _image))
+                            _viewModel.RequisitionItems.Images[args.Holding.ImageID] = _image;
                         requiItem.SourceJRI = args.JobRequisitionItemID;
                         requiItem.SourceJRI = args.JobRequisitionItemID;
                         requiItem.TargetJRI = args.JobRequisitionItemID;
                         requiItem.TargetJRI = args.JobRequisitionItemID;
                         requiItem.Quantity = args.Quantity;
                         requiItem.Quantity = args.Quantity;