Просмотр исходного кода

修改离线Order List,是状态码和Filter一致。
修改Order List,使用状态码判断Order状态。
修改表单文本框编辑,使文本框在开始编辑时自动删除0。
修改Check For Saved Order时Order List的Filter。
修改Order Detail增加Tax。

Pen Li 9 лет назад
Родитель
Сommit
a75f7984d0

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


+ 28 - 0
RedAnt ERP Mobile/RedAnt ERP Mobile.xcworkspace/xcuserdata/macmini1.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -2,4 +2,32 @@
 <Bucket
    type = "0"
    version = "2.0">
+   <Breakpoints>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "iSales-NPD/AppDelegate.m"
+            timestampString = "507891192.616499"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "406"
+            endingLineNumber = "406"
+            landmarkName = "-SetSo:"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "Yes"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            scope = "0"
+            stopOnStyle = "0">
+         </BreakpointContent>
+      </BreakpointProxy>
+   </Breakpoints>
 </Bucket>

+ 19 - 0
RedAnt ERP Mobile/common/CommonEditor/CommonEditorViewController.m

@@ -5666,6 +5666,15 @@
     //  UITableViewCell *cell = (UITableViewCell *) textField.superview.superview;
     NSIndexPath *   indexPath = self.lastedit_from;
     
+    NSDictionary* item_json =((NSMutableArray*)self.content_data_control[indexPath.section])[indexPath.row];
+    if ([item_json objectForKey:@"fill"]) {
+        NSString *fillText = [item_json objectForKey:@"fill"];
+        
+        if (fillText && textField.text.length == 0) {
+            textField.text = fillText;
+        }
+    }
+    
     [self textfieldSetValue:indexPath value:textField.text];
     //    NSMutableDictionary* section_json=nil;
     //
@@ -5935,6 +5944,16 @@
     self.lastedit = textField;
     UITableViewCell *cell = (UITableViewCell *) textField.superview.superview;
     self.lastedit_from  = [self.editorTable indexPathForCell:cell];
+    
+    NSDictionary* item_json =((NSMutableArray*)self.content_data_control[self.lastedit_from.section])[self.lastedit_from.row];
+    
+    if ([item_json valueForKey:@"clear"]) {
+        BOOL clear = [[item_json valueForKey:@"clear"] doubleValue] == [textField.text doubleValue];
+        
+        if (clear) {
+            textField.text = nil;
+        }
+    }
 }
 
 

+ 7 - 1
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -8605,7 +8605,13 @@ NSString* gprice = [self get_portfolio_price :appDelegate.contact_id item_id:ite
             item[@"customer_contact"] = customer_contact;
             item[@"order_id"]= [NSString stringWithFormat:@"%d",order_id];
             item[@"purchase_time"]= nscreate_time;
-            item[@"orderStatus"]= [NSString stringWithFormat:@"%d",status];
+            int statusCode = status;
+            if (statusCode == 2) {
+                statusCode = erpStatus;
+            } else if (statusCode == 3) {
+                statusCode = 15;
+            }
+            item[@"orderStatus"]= [NSString stringWithFormat:@"%d",statusCode];
             item[@"order_status"]= nsstatus;
             item[@"order_code"]= nssoid;//[NSString stringWithFormat:@"%d",order_id];
             item[@"offline_edit"] = [NSNumber numberWithInt:offline_edit];

+ 9 - 3
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -1005,7 +1005,7 @@
                 }
                 //            [self.btnPDF setImage:[[UIImage imageNamed:@"download"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];
                 
-                NSString* status = [self.content_data valueForKey:@"order_status"];
+//                NSString* status = [self.content_data valueForKey:@"order_status"];
 
                 NSString* lock_user = [self.content_data valueForKey:@"opened_customer"];
 
@@ -1412,7 +1412,7 @@
         }
     }
     if(section==3)
-        return 5;
+        return 6;
     return 0;
     
 }
@@ -1796,7 +1796,13 @@
                     cell.chargeLabel.text = @"Handling Fee:";
                     cell.priceLabel.text =[self.content_data valueForKey:@"Handling Fee"];
                     break;
-                case 4:
+                case 4: {
+                    cell.chargeLabel.text = @"Tax:";
+                    NSString *tax = [self.content_data valueForKey:@"Tax"] ? [self.content_data valueForKey:@"Tax"] : @"$0.00";
+                    cell.priceLabel.text = tax;
+                }
+                    break;
+                case 5:
                 {
                     NSString* price=[self.content_data valueForKey:@"Total"];
                     if(appDelegate.can_see_price&&appDelegate.price_hidden==false)

+ 26 - 24
RedAnt ERP Mobile/common/Functions/order/OrderListViewController.m

@@ -1069,9 +1069,10 @@
             price=nil;
         }
         
-        
+        NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
         NSString* purchase_time= [self.content_data[indexPath.row] valueForKey:@"purchase_time"];
-        NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
+//        NSString* status = [self.content_data[indexPath.row] valueForKey:@"order_status"] ;
+        NSString* status = [RAUtils orderStatus:statusCode];
         NSString* customer_name = [self.content_data[indexPath.row] valueForKey:@"customer_name"];
         NSString* model_count = [self.content_data[indexPath.row] valueForKey:@"model_count"];
         NSString* sales = [self.content_data[indexPath.row] valueForKey:@"sales_rep"];
@@ -1267,7 +1268,8 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSString* so= [self.content_data[indexPath.row] valueForKey:@"so#"];
     NSString* orderid= [self.content_data[indexPath.row] valueForKey:@"order_id"];
-    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
+//    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
+    NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
     
     if(appDelegate.user_type==USER_ROLE_EMPLOYEE) {
 
@@ -1433,12 +1435,12 @@
         
         
         
-        if([order_status isEqualToString:@"Saved Order"]&&appDelegate.can_cancel_order)
+        if(/*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1&&appDelegate.can_cancel_order)
             return @[cancelAction];
         
         else
         {
-            if([order_status isEqualToString:@"Quote Saved"])
+            if(/*[order_status isEqualToString:@"Quote Saved"]*/statusCode == 0)
             {
                 NSMutableArray* arr=[@[] mutableCopy];
                 if(appDelegate.can_delete_order)
@@ -1664,15 +1666,9 @@
 
         NSMutableArray *actionArr = [NSMutableArray array];
         // 取消订单
-        if([order_status isEqualToString:@"Saved Order"]&&appDelegate.can_cancel_order)
+        if(/*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1&&appDelegate.can_cancel_order)
             [actionArr addObject:cancelAction];
         
-//        if ([Singleton sharedInstance].permissions_merge_order) {// 有合并订单的权限
-//            if (self.orderType == 0) {// Sales Order不能合并
-//                [actionArr addObject:add2MergeListAction];
-//            }
-//
-//        }
         return actionArr;
     }
     
@@ -1689,18 +1685,13 @@
         return NO;
     
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
-    
+//    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
+    NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
     
     if(appDelegate.user_type==USER_ROLE_CUSTOMER) {
         // saved && ((type==0 && merge_permission) || type == 1 || can_cancel)
-//        if ([order_status isEqualToString:@"Saved Order"] && (([Singleton sharedInstance].permissions_merge_order && self.orderType == 0) || self.orderType == 1 || appDelegate.can_cancel_order)) {
-//            DebugLog(@"%d Yes",indexPath.row);
-//            return YES;
-//        } else {
-//            return NO;
-//        }
-        BOOL isSavedOrder = [order_status isEqualToString:@"Saved Order"];
+
+        BOOL isSavedOrder = /*[order_status isEqualToString:@"Saved Order"]*/statusCode == 1;
         switch (self.orderType) {
             case 0:{ // Shop Order
                 
@@ -1749,9 +1740,9 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     bool offline_edit =[[self.content_data[indexPath.row] valueForKey:@"offline_edit"] boolValue];
     
-    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
-    
-    if(![order_status isEqualToString:@"Saved Order"]&&! [order_status isEqualToString:@"Quote Saved"])
+//    NSString* order_status= [self.content_data[indexPath.row] valueForKey:@"order_status"];
+    NSInteger statusCode = [[self.content_data[indexPath.row] valueForKey:@"orderStatus"] integerValue];
+    if(/*![order_status isEqualToString:@"Saved Order"]&&! [order_status isEqualToString:@"Quote Saved"]*/statusCode != 1 && statusCode != 0)
         return UITableViewCellEditingStyleNone;
     else
     {
@@ -2049,6 +2040,17 @@ commitEditingStyle:(UITableViewCellEditingStyle)editingStyle  forRowAtIndexPath:
             
         }
         
+    } else {
+        
+        NSString *resource = @"status_filter_cadedate_open";
+        if (ordertype == 1) {
+            resource = @"status_filter_cadedate_po";
+        }
+        
+        NSData *json=[NSData dataWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:resource ofType:@"json" ]];
+        NSError *error=nil;
+        self.status_cadedate = [[NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error] mutableCopy];
+        
     }
     
    

+ 8 - 0
RedAnt ERP Mobile/common/Functions/order/status_filter_cadedate_po.json

@@ -0,0 +1,8 @@
+{
+    "count":1,
+     "val_0": {
+        "value": "Saved PO",
+        "value_id": 1,
+        "check":1
+    }
+}

+ 3 - 0
RedAnt ERP Mobile/common/RAUtils.h

@@ -64,4 +64,7 @@
 
 
 + (bool)mergeContentsOfPath:(NSString *)srcDir intoPath:(NSString *)dstDir error:(NSError**)err;
+
++ (NSString *)orderStatus:(NSInteger)statusCode;
+
 @end

+ 43 - 0
RedAnt ERP Mobile/common/RAUtils.m

@@ -12,6 +12,8 @@
 #import <sys/param.h>
 #import <sys/mount.h>
 #import "const.h"
+#import "AppDelegate.h"
+#import "Singleton.h"
 
 
 #import "ZipArchive.h"
@@ -853,6 +855,47 @@ begin:
     //    return CGRectMake(x, y, v.frame.size.width, v.frame.size.height);
 }
 
++ (NSString *)orderStatus:(NSInteger)statusCode {
+    
+    __block NSString *status = nil;
+    
+    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    NSDictionary *filter = nil;
+    switch (appDelegate.user_type) {
+        case USER_ROLE_EMPLOYEE: {
+            filter = appDelegate.OrderFilter;
+        }
+            break;
+        case USER_ROLE_CUSTOMER: {
+            if ([Singleton sharedInstance].customer_order_type == 0) {
+                filter = [Singleton sharedInstance].shop_order_status_filter;
+            } else {
+                filter = [Singleton sharedInstance].sales_order_status_filter;
+            }
+        }
+            break;
+        case USER_ROLE_UNKNOWN: {
+            
+        }
+            
+        default:
+            break;
+    }
+    
+    [filter enumerateKeysAndObjectsUsingBlock:^(id  _Nonnull key, id  _Nonnull obj, BOOL * _Nonnull stop) {
+        
+        if ([obj isKindOfClass:[NSDictionary class]]) {
+            NSDictionary *orderStatusDic = (NSDictionary *)obj;
+            if ([[orderStatusDic objectForKey:@"value_id"] integerValue] == statusCode) {
+                status = [orderStatusDic objectForKey:@"value"];
+                *stop = YES;
+            }
+        }
+        
+    }];
+    
+    return status;
+}
 
 @end
 

+ 1 - 1
RedAnt ERP Mobile/common/data_provider/iSalesNetwork.m

@@ -1284,7 +1284,7 @@ repeat:
         NSError *error=nil;
         NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
         
-        [appDelegate SetSo:[jsobj valueForKey:@"so#"]];
+//        [appDelegate SetSo:[jsobj valueForKey:@"so#"]];
         return jsobj;
     }
     else

+ 4 - 0
RedAnt ERP Mobile/iSales-NPD.xcodeproj/project.pbxproj

@@ -29,6 +29,7 @@
 		42A225331D6E7D1D00235B62 /* placeOrderTemplate.json in Resources */ = {isa = PBXBuildFile; fileRef = 42A225321D6E7D1D00235B62 /* placeOrderTemplate.json */; };
 		42A51BF41D62F60300F13667 /* more_info.html in Resources */ = {isa = PBXBuildFile; fileRef = 42A51BF31D62F60300F13667 /* more_info.html */; };
 		42A51BF61D62F9AB00F13667 /* orderDetail.json in Resources */ = {isa = PBXBuildFile; fileRef = 42A51BF51D62F9AB00F13667 /* orderDetail.json */; };
+		42B309791E45BA32007AFC62 /* status_filter_cadedate_po.json in Resources */ = {isa = PBXBuildFile; fileRef = 42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */; };
 		42B3C9BB1D642C880053985C /* order_info.html in Resources */ = {isa = PBXBuildFile; fileRef = 42B3C9BA1D642C880053985C /* order_info.html */; };
 		42C2E8BC1DB49D02006C0495 /* TearSheet.json in Resources */ = {isa = PBXBuildFile; fileRef = 42C2E8BB1DB49D02006C0495 /* TearSheet.json */; };
 		42C9FB151D5B28FA001DCA8B /* contactAdvanceSearch.json in Resources */ = {isa = PBXBuildFile; fileRef = 42C9FB141D5B28FA001DCA8B /* contactAdvanceSearch.json */; };
@@ -283,6 +284,7 @@
 		42A225321D6E7D1D00235B62 /* placeOrderTemplate.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = placeOrderTemplate.json; sourceTree = "<group>"; };
 		42A51BF31D62F60300F13667 /* more_info.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = more_info.html; sourceTree = "<group>"; };
 		42A51BF51D62F9AB00F13667 /* orderDetail.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = orderDetail.json; sourceTree = "<group>"; };
+		42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = status_filter_cadedate_po.json; path = common/Functions/order/status_filter_cadedate_po.json; sourceTree = SOURCE_ROOT; };
 		42B3C9BA1D642C880053985C /* order_info.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = order_info.html; sourceTree = "<group>"; };
 		42C2E8BB1DB49D02006C0495 /* TearSheet.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = TearSheet.json; sourceTree = "<group>"; };
 		42C9FB141D5B28FA001DCA8B /* contactAdvanceSearch.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = contactAdvanceSearch.json; sourceTree = "<group>"; };
@@ -1032,6 +1034,7 @@
 				7162A5941C58733400AB630E /* OrderListViewController.h */,
 				7162A5951C58733400AB630E /* OrderListViewController.m */,
 				7162A5961C58733400AB630E /* status_filter_cadedate_open.json */,
+				42B309781E45BA32007AFC62 /* status_filter_cadedate_po.json */,
 				7162A5971C58733400AB630E /* offline_status_filter_cadedate.json */,
 				714B1F3E1C7BF74100539193 /* OrderDetailSignatureCell.h */,
 				714B1F3F1C7BF74100539193 /* OrderDetailSignatureCell.m */,
@@ -1597,6 +1600,7 @@
 				712AFEE51DBDAF0300254965 /* pdfcreator.xcassets in Resources */,
 				7162A55E1C58724700AB630E /* customer_advanced_search.json in Resources */,
 				7162A5A11C58733400AB630E /* offline_status_filter_cadedate.json in Resources */,
+				42B309791E45BA32007AFC62 /* status_filter_cadedate_po.json in Resources */,
 				713F76BD1929F4A7006A7305 /* Main.storyboard in Resources */,
 				42A51BF41D62F60300F13667 /* more_info.html in Resources */,
 			);