Sfoglia il codice sorgente

placeorder增加对lift gate 参数的判断

Pen Li 9 anni fa
parent
commit
2fbf814008

BIN
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/UserInterfaceState.xcuserstate


+ 147 - 10
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -5948,6 +5948,7 @@
     NSString *orderCode = [self valueInParams:params key:@"orderCode"];
     NSString *orderCode = [self valueInParams:params key:@"orderCode"];
     orderCode = [self translateSingleQuote:orderCode];
     orderCode = [self translateSingleQuote:orderCode];
     
     
+     
     
     
     NSString *sql = [NSString stringWithFormat:@"select receive_cid,receive_name,receive_ext,receive_contact,receive_email,receive_fax,receive_phone from offline_order where so_id = '%@';",orderCode];
     NSString *sql = [NSString stringWithFormat:@"select receive_cid,receive_name,receive_ext,receive_contact,receive_email,receive_fax,receive_phone from offline_order where so_id = '%@';",orderCode];
     
     
@@ -6713,29 +6714,49 @@
                                        @"type" : @"price",
                                        @"type" : @"price",
                                        @"value" : [NSString stringWithFormat:@"%.2f",handling_fee]
                                        @"value" : [NSString stringWithFormat:@"%.2f",handling_fee]
                                        };
                                        };
-    [dic setValue:handling_fee_dic forKey:@"item_1"];
+   
     
     
     NSDictionary *shipping_dic = @{
     NSDictionary *shipping_dic = @{
                                    @"align" : @"right",
                                    @"align" : @"right",
-                                   @"aname" : @"Shipping",
+                                   @"aname" : @"Shipping*",
                                    @"control" : @"text",
                                    @"control" : @"text",
                                    @"name" : @"shipping",
                                    @"name" : @"shipping",
                                    @"required" : @"true",
                                    @"required" : @"true",
                                    @"type" : @"price",
                                    @"type" : @"price",
                                    @"value" : [NSString stringWithFormat:@"%.2f",shipping]
                                    @"value" : [NSString stringWithFormat:@"%.2f",shipping]
                                    };
                                    };
-    [dic setValue:shipping_dic forKey:@"item_2"];
+   
     
     
     NSDictionary *lift_gate_dic = @{
     NSDictionary *lift_gate_dic = @{
                                    @"align" : @"right",
                                    @"align" : @"right",
-                                   @"aname" : @"Lift Gate",
+                                   @"aname" : @"Liftgate Fee(No Loading Dock)",
                                    @"control" : @"text",
                                    @"control" : @"text",
                                    @"name" : @"lift_gate_value",
                                    @"name" : @"lift_gate_value",
                                    @"required" : @"true",
                                    @"required" : @"true",
                                    @"type" : @"price",
                                    @"type" : @"price",
                                    @"value" : [NSString stringWithFormat:@"%.2f",lift_gate_value]
                                    @"value" : [NSString stringWithFormat:@"%.2f",lift_gate_value]
                                    };
                                    };
-    [dic setValue:lift_gate_dic forKey:@"item_3"];
+    
+    int item_count = 1;
+    
+    NSString *params_lift_gate = [self valueInParams:params key:@"lift_gate"];
+    if (params_lift_gate && [params_lift_gate isEqualToString:@"false"]) {
+        
+        [dic setValue:shipping_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
+        [dic setValue:lift_gate_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
+        
+    } else if (params_lift_gate && [params_lift_gate isEqualToString:@"true"]) {
+        
+        [dic setValue:shipping_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
+        
+    } else {
+        
+    }
+
+    
+    [dic setValue:handling_fee_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
+    
+    
     
     
     NSDictionary *total_price_dic = @{
     NSDictionary *total_price_dic = @{
                                       @"align" : @"right",
                                       @"align" : @"right",
@@ -6745,7 +6766,7 @@
                                       @"type" : @"price",
                                       @"type" : @"price",
                                       @"value" : [NSString stringWithFormat:@"%.2f",totalPrice]
                                       @"value" : [NSString stringWithFormat:@"%.2f",totalPrice]
                                       };
                                       };
-    [dic setValue:total_price_dic forKey:@"item_4"];
+    [dic setValue:total_price_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
     
     
     NSDictionary *total_cuft_dic = @{
     NSDictionary *total_cuft_dic = @{
                                      @"align" : @"right",
                                      @"align" : @"right",
@@ -6754,7 +6775,7 @@
                                      @"name" : @"",
                                      @"name" : @"",
                                      @"value" : [NSString stringWithFormat:@"%.2f",totalCuft]
                                      @"value" : [NSString stringWithFormat:@"%.2f",totalCuft]
                                      };
                                      };
-    [dic setValue:total_cuft_dic forKey:@"item_5"];
+    [dic setValue:total_cuft_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
     
     
     NSDictionary *total_weight_dic = @{
     NSDictionary *total_weight_dic = @{
                                        @"align" : @"right",
                                        @"align" : @"right",
@@ -6763,7 +6784,7 @@
                                        @"name" : @"",
                                        @"name" : @"",
                                        @"value" : [NSString stringWithFormat:@"%.2f",totalWeight]
                                        @"value" : [NSString stringWithFormat:@"%.2f",totalWeight]
                                        };
                                        };
-    [dic setValue:total_weight_dic forKey:@"item_6"];
+    [dic setValue:total_weight_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
     
     
     NSDictionary *total_carton_dic = @{
     NSDictionary *total_carton_dic = @{
                                        @"align" : @"right",
                                        @"align" : @"right",
@@ -6772,9 +6793,9 @@
                                        @"name" : @"",
                                        @"name" : @"",
                                        @"value" : [NSString stringWithFormat:@"%d",totalCarton]
                                        @"value" : [NSString stringWithFormat:@"%d",totalCarton]
                                        };
                                        };
-    [dic setValue:total_carton_dic forKey:@"item_7"];
+    [dic setValue:total_carton_dic forKey:[NSString stringWithFormat:@"item_%d",item_count++]];
     
     
-    [dic setValue:[NSNumber numberWithInteger:8] forKey:@"count"];
+    [dic setValue:[NSNumber numberWithInteger:item_count] forKey:@"count"];
     
     
     return dic;
     return dic;
 }
 }
@@ -6815,6 +6836,118 @@
     NSMutableDictionary * ret = [self offline_notimpl];
     NSMutableDictionary * ret = [self offline_notimpl];
     return [RAUtils dict2data:ret];
     return [RAUtils dict2data:ret];
 }
 }
++ (NSDictionary *)shippingMethodDic:(NSDictionary *)params db:(sqlite3 *)db {
+    NSMutableDictionary *dic = [NSMutableDictionary dictionary];
+    
+//    refresh_trigger	logist
+    NSString *refresh_trigger = [self valueInParams:params key:@"refresh_trigger"];
+    
+    NSString *logist = nil;
+    if ([refresh_trigger isEqualToString:@"logist"]) {
+        logist = [self valueInParams:params key:@"logist"];
+    }
+    
+    [dic setValue:[NSNumber numberWithInteger:1] forKey:@"count"];
+    [dic setValue:@"Shipping Method" forKey:@"title"];
+    
+    // val_0
+    if (logist && [logist isEqualToString:@"WILL CALL"]) {
+        
+    }
+    
+    NSMutableDictionary *val_0 = [NSMutableDictionary dictionary];
+    [val_0 setValue:[NSNumber numberWithInteger:0] forKey:@"check"];
+    [val_0 setValue:@"WILL CALL(requires 24 hours advance notice)" forKey:@"value"];
+    [val_0 setValue:@"WILL CALL" forKey:@"value_id"];
+    
+    NSMutableDictionary *val0_subItem = [NSMutableDictionary dictionary];
+    [val0_subItem setValue:[NSNumber numberWithInteger:1] forKey:@"count"];
+    NSDictionary *val0_subItem_item0 = @{
+                                         @"aname" : @"Option",
+                                         @"cadedate" : @{
+                                             @"count" : [NSNumber numberWithInteger:2],
+                                             @"val_0" : @{
+                                                 @"check" : [NSNumber numberWithInteger:0],
+                                                 @"refresh" : [NSNumber numberWithInteger:0],
+                                                 @"value" : @"PERSONAL PICK UP",
+                                                 @"value_id" : @"PERSONAL PICK UP"
+                                             },
+                                             @"val_1" : @{
+                                                 @"check" : [NSNumber numberWithInteger:0],
+                                                 @"refresh" : [NSNumber numberWithInteger:0],
+                                                 @"sub_item" : @{
+                                                     @"count" : [NSNumber numberWithInteger:1],
+                                                     @"item_0" : @{
+                                                         @"aname" : @"BOL",
+                                                         @"control" : @"edit",
+                                                         @"keyboard" : @"text",
+                                                         @"name" : @"logist_note_text",
+                                                         @"refresh" : [NSNumber numberWithInteger:0],
+                                                         @"required" : @"false",
+                                                         @"value" : @""
+                                                     }
+                                                 },
+                                                 @"value" : @"USE MY CARRIER",
+                                                 @"value_id" : @"USE MY CARRIER"
+                                             }
+                                         },
+                                         @"control" : @"enum",
+                                         @"name" : @"logistic_note",
+                                         @"required" : @"true",
+                                         @"single_select" : @"true"
+                                         };
+
+    [val0_subItem setValue:val0_subItem_item0 forKey:@"item_0"];
+    
+    [val_0 setValue:val0_subItem forKey:@"sub_item"];
+    
+    // val_1
+    NSString *lift_gate = [self valueInParams:params key:@"lift_gate"];
+    if (lift_gate && [lift_gate isEqualToString:@"true"]) {
+        
+    } else {
+        lift_gate = @"false";
+    }
+    NSDictionary *val_1 = @{
+                            @"check" : [NSNumber numberWithInteger:0],
+                            @"sub_item" : @{
+                                @"count" : [NSNumber numberWithInteger:1],
+                                @"item_0" : @{
+                                    @"aname" : @"Do you have Loading Dock Available ? Slide to green for YES",
+                                    @"control" : @"switch",
+                                    @"name" : @"lift_gate",
+                                    @"refresh" : [NSNumber numberWithInteger:1],
+                                    @"required" : @"true",
+                                    @"value" : lift_gate
+                                }
+                            },
+                            @"value" : @"COMMON CARRIER",
+                            @"value_id" : @"COMMON CARRIER"
+                            };
+    
+    // cadedate
+    NSDictionary *cadedate = @{
+                               @"count" : [NSNumber numberWithInteger:2],
+                               @"val_0" : val_0,
+                               @"val_1" : val_1
+                               };
+    
+    
+    // item_0
+    NSDictionary *item_0 = @{
+                             @"aname" : @"Shipping",
+                             @"cadedate" : cadedate,
+                             @"control" : @"enum",
+                             @"name" : @"logist",
+                             @"refresh" : [NSNumber numberWithInteger:1],
+                             @"single_select" : @"true",
+                             };
+    
+    [dic setValue:item_0 forKey:@"item_0"];
+    
+    return dic;
+}
+
 +(NSData*) offline_placeorder :(NSMutableDictionary *) params
 +(NSData*) offline_placeorder :(NSMutableDictionary *) params
 {
 {
     
     
@@ -6827,6 +6960,10 @@
     //  0 Order Type    1 Shipping Method       2 Payment Information
     //  0 Order Type    1 Shipping Method       2 Payment Information
     __block NSMutableDictionary *ret = [self dictionaryFileName:@"placeOrderTemplate.json"];
     __block NSMutableDictionary *ret = [self dictionaryFileName:@"placeOrderTemplate.json"];
     
     
+    //    1 Shipping Method
+    NSDictionary *shipping_method_dic = [self shippingMethodDic:params db:db];
+    [ret setValue:shipping_method_dic forKey:@"section_1"];
+    
     //    3 Customer
     //    3 Customer
     NSDictionary *customer_dic = [self customerDic:params db:db];
     NSDictionary *customer_dic = [self customerDic:params db:db];
     [ret setValue:customer_dic forKey:@"section_3"];
     [ret setValue:customer_dic forKey:@"section_3"];