Przeglądaj źródła

修复Portfolio编辑QTY And QTY_P出错。

Pen Li 9 lat temu
rodzic
commit
ebcca4ec1c

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


+ 11 - 9
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioEditQTYViewController.m

@@ -214,22 +214,27 @@
     
     
     bool qtypercentage = self.switchQTY.isOn;
     bool qtypercentage = self.switchQTY.isOn;
     
     
+    
+    
+    if (!self.qtyCheckButton.selected) {
+        self.qty = -INT32_MAX;
+        self.qty_p = -MAXFLOAT;
+    }
+    
     if(self.editQTY.text.length==0)
     if(self.editQTY.text.length==0)
     {
     {
         self.qty=-INT32_MAX;
         self.qty=-INT32_MAX;
         self.qty_p=-MAXFLOAT;
         self.qty_p=-MAXFLOAT;
     } else if(qtypercentage) {
     } else if(qtypercentage) {
-        
+        if (self.qtyCheckButton.selected) {
             self.qty_p=[self.editQTY.text floatValue];
             self.qty_p=[self.editQTY.text floatValue];
             self.qty=-INT32_MAX;
             self.qty=-INT32_MAX;
+        }
     } else {
     } else {
+        if (self.qtyCheckButton.selected) {
             self.qty=[self.editQTY.text intValue];
             self.qty=[self.editQTY.text intValue];
             self.qty_p=-MAXFLOAT;
             self.qty_p=-MAXFLOAT;
-    }
-    
-    if (!self.qtyCheckButton.selected) {
-        self.qty = -INT32_MAX;
-        self.qty_p = -MAXFLOAT;
+        }
     }
     }
     
     
     if (!self.priceCheckButton.selected) {
     if (!self.priceCheckButton.selected) {
@@ -244,9 +249,6 @@
         self.linenotes = nil;
         self.linenotes = nil;
     }
     }
 
 
-
-    
-    
     [self dismissViewControllerAnimated:NO
     [self dismissViewControllerAnimated:NO
                              completion:^{
                              completion:^{
                                  if(self.onSetValue)
                                  if(self.onSetValue)

+ 28 - 27
RedAnt ERP Mobile/common/Functions/portfolio/PortfolioViewController.m

@@ -639,31 +639,31 @@
                         
                         
                         if([[cart_json valueForKey:@"result"] intValue]==2)
                         if([[cart_json valueForKey:@"result"] intValue]==2)
                         {
                         {
-                            if(qty>=0)
-                                item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
-                            else
-                                [item_json removeObjectForKey:@"available_qty"];
-                            if(qty_p>=0)
-                                item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
-                            else
-                                [item_json removeObjectForKey:@"available_percent"];
-                            item_json[@"linenotes"]=notes;
-                            item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
-                            item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
-                            self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
-                            // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
-                            [self.itemListTable reloadData];
+//                            if(qty>=0)
+//                                item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
+//                            else
+//                                [item_json removeObjectForKey:@"available_qty"];
+//                            if(qty_p>=0)
+//                                item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
+//                            else
+//                                [item_json removeObjectForKey:@"available_percent"];
+//                            item_json[@"linenotes"]=notes;
+//                            item_json[@"tear_sheet_discount"]=[NSString stringWithFormat:@"%.2f",discount];
+//                            item_json[@"tear_sheet_price"]=[NSString stringWithFormat:@"%.2f",price];
+//                            self.content_data[[NSString stringWithFormat:@"item_%d",single_idx]]=item_json;
+//                            // item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
+//                            [self.itemListTable reloadData];
                             
                             
                             
                             
-                            if (qty != -INT32_MAX) {
-                                if(qty>=0)
+                            if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
+                                // qty
+                                if (qty != -INT32_MAX)
                                     item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
                                     item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
                                 else
                                 else
                                     [item_json removeObjectForKey:@"available_qty"];
                                     [item_json removeObjectForKey:@"available_qty"];
-                            }
-                            
-                            if (qty_p != -MAXFLOAT) {
-                                if(qty_p>=0)
+                                
+                                // qty_p
+                                if (qty_p != -MAXFLOAT)
                                     item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
                                     item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
                                 else
                                 else
                                     [item_json removeObjectForKey:@"available_percent"];
                                     [item_json removeObjectForKey:@"available_percent"];
@@ -1319,7 +1319,7 @@
         PortfolioEditQTYViewController * vc =[ parentvc.storyboard instantiateViewControllerWithIdentifier:@"PortfolioEditQTYViewController"];
         PortfolioEditQTYViewController * vc =[ parentvc.storyboard instantiateViewControllerWithIdentifier:@"PortfolioEditQTYViewController"];
         
         
         
         
-        NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
+        __block NSMutableDictionary * item_json = [[self.content_data objectForKey:[NSString stringWithFormat:@"item_%ld",(long)indexPath.row]] mutableCopy];
         
         
         vc.arr_fashion_ids = [[NSArray arrayWithObject:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"fashion_id"] intValue]]] mutableCopy];
         vc.arr_fashion_ids = [[NSArray arrayWithObject:[NSString stringWithFormat:@"%d",[[item_json valueForKey:@"fashion_id"] intValue]]] mutableCopy];
 
 
@@ -1357,15 +1357,16 @@
                     if([[cart_json valueForKey:@"result"] intValue]==2)
                     if([[cart_json valueForKey:@"result"] intValue]==2)
                     {
                     {
                         self.editedRow = indexPath.row;
                         self.editedRow = indexPath.row;
-                        if (qty != -INT32_MAX) {
-                            if(qty>=0)
+                        
+                        if (!(qty == -INT32_MAX && qty_p == -MAXFLOAT)) {
+                            // qty
+                            if (qty != -INT32_MAX)
                                 item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
                                 item_json[@"available_qty"]=[NSNumber numberWithInt:qty];
                             else
                             else
                                 [item_json removeObjectForKey:@"available_qty"];
                                 [item_json removeObjectForKey:@"available_qty"];
-                        }
-                        
-                        if (qty_p != -MAXFLOAT) {
-                            if(qty_p>=0)
+                            
+                            // qty_p
+                            if (qty_p != -MAXFLOAT)
                                 item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
                                 item_json[@"available_percent"]=[NSNumber numberWithInt:qty_p];
                             else
                             else
                                 [item_json removeObjectForKey:@"available_percent"];
                                 [item_json removeObjectForKey:@"available_percent"];