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

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


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

@@ -4310,7 +4310,7 @@
     int orderId = [params[@"orderId"] intValue];
     int orderId = [params[@"orderId"] intValue];
     NSMutableDictionary* ret = [self dictionaryFileName:@"orderDetail.json"];
     NSMutableDictionary* ret = [self dictionaryFileName:@"orderDetail.json"];
     
     
-    NSString* sql=[NSString stringWithFormat:@"select o._id,o.so_id,o.poNumber,o.create_time,o.status,o.TotalCuft,o.TotalWeight,o.TotalCarton,decrypt(c.company_name),o.customer_contact,decrypt(c.addr_1),c.addr_2,c.addr_3,c.addr_4,o.logist,o.shipping,o.lift_gate_value,o.general_notes,o.internal_notes,o.paymentType,o.lift_gate,o.receive_name,o.receive_contact,o.receive_ext,o.sender_name,o.sender_contact,o.sender_ext,o.shipping_billto_name,o.shipping_billto_contact,o.shipping_billto_ext,o.billing_name,o.billing_contact,o.billing_ext,o.returnto_name,o.returnto_contact,o.returnto_ext,o.handling_fee_value,o.paymentsAndCredits,o.total_price,o.customer_cid,o.credit_card_first_name,o.credit_card_last_name,o.credit_card_address1,o.credit_card_address2,o.credit_card_zipcode,o.credit_card_type,o.credit_card_number,o.credit_card_security_code,o.credit_card_expiration,o.credit_card_city,o.credit_card_state,o.shipNull from (select _id,so_id,poNumber,create_time,status,TotalCuft,TotalWeight,TotalCarton,customer_cid,customer_contact,logist,shipping,lift_gate_value,general_notes,internal_notes,paymentType,lift_gate,receive_name,receive_contact,receive_ext,sender_name,sender_contact,sender_ext,shipping_billto_name,shipping_billto_contact,shipping_billto_ext,billing_name,billing_contact,billing_ext,returnto_name,returnto_contact,returnto_ext,handling_fee_value,paymentsAndCredits,total_price,customer_cid,credit_card_first_name,credit_card_last_name,credit_card_address1,credit_card_address2,credit_card_zipcode,credit_card_type,credit_card_number,credit_card_security_code,credit_card_expiration,credit_card_city,credit_card_state,ifnull(shipping,'ship_null') as shipNull from offline_order where _id=%d) o left join offline_contact c on o.customer_cid=c.contact_id",orderId ];
+    NSString* sql=[NSString stringWithFormat:@"select o._id,o.so_id,o.poNumber,o.create_time,o.status,o.TotalCuft,o.TotalWeight,o.TotalCarton,decrypt(c.company_name),o.customer_contact,decrypt(c.addr_1),c.addr_2,c.addr_3,c.addr_4,o.logist,o.shipping,o.lift_gate_value,o.general_notes,o.internal_notes,o.paymentType,o.lift_gate,o.receive_name,o.receive_contact,o.receive_ext,o.sender_name,o.sender_contact,o.sender_ext,o.shipping_billto_name,o.shipping_billto_contact,o.shipping_billto_ext,o.billing_name,o.billing_contact,o.billing_ext,o.returnto_name,o.returnto_contact,o.returnto_ext,o.handling_fee_value,o.paymentsAndCredits,o.total_price,o.customer_cid,o.credit_card_first_name,o.credit_card_last_name,o.credit_card_address1,o.credit_card_address2,o.credit_card_zipcode,o.credit_card_type,o.credit_card_number,o.credit_card_security_code,o.credit_card_expiration,o.credit_card_city,o.credit_card_state,o.shipNull,o.erpOrderStatus from (select _id,so_id,poNumber,create_time,status,TotalCuft,TotalWeight,TotalCarton,customer_cid,customer_contact,logist,shipping,lift_gate_value,general_notes,internal_notes,paymentType,lift_gate,receive_name,receive_contact,receive_ext,sender_name,sender_contact,sender_ext,shipping_billto_name,shipping_billto_contact,shipping_billto_ext,billing_name,billing_contact,billing_ext,returnto_name,returnto_contact,returnto_ext,handling_fee_value,paymentsAndCredits,total_price,customer_cid,credit_card_first_name,credit_card_last_name,credit_card_address1,credit_card_address2,credit_card_zipcode,credit_card_type,credit_card_number,credit_card_security_code,credit_card_expiration,credit_card_city,credit_card_state,ifnull(shipping,'ship_null') as shipNull,erpOrderStatus from offline_order where _id=%d) o left join offline_contact c on o.customer_cid=c.contact_id",orderId ];
     
     
     sqlite3 *db = [iSalesDB get_db];
     sqlite3 *db = [iSalesDB get_db];
     sqlite3_stmt * statement;
     sqlite3_stmt * statement;
@@ -4354,55 +4354,15 @@
             nscreate_time = [[self changeDateTimeFormate:nscreate_time] stringByAppendingString:@" PST"];// 与在线统一
             nscreate_time = [[self changeDateTimeFormate:nscreate_time] stringByAppendingString:@" PST"];// 与在线统一
             
             
             int status = sqlite3_column_int(statement, 4);
             int status = sqlite3_column_int(statement, 4);
-            NSString* nsstatus=@"";
-            switch (status) {
-                case 0:
-                {
-                    nsstatus=@"Temp Order";
-                    break;
-                }
-                case 1:
-                {
-                    nsstatus=@"Saved Order";
-                    break;
-                }
-                case 10:
-                {
-                    nsstatus=@"Quote Submitted";
-                    break;
-                }
-                case 11:
-                {
-                    nsstatus=@"Sales Order Submitted";
-                    break;
-                }
-                case 12:
-                {
-                    nsstatus=@"Processing";
-                    break;
-                }
-                case 13:
-                {
-                    nsstatus=@"Shipped";
-                    break;
-                }
-                case 14:
-                {
-                    nsstatus=@"Closed";
-                    break;
-                }
-                case 15:
-                {
-                    nsstatus=@"Cancelled";
-                    break;
-                }
-                    
-                    
-                default:
-                    break;
-            }
+            int erpStatus = sqlite3_column_int(statement, 52);;
+            NSString* nsstatus = [self orderStatus:status erpStatus:erpStatus];
             
             
             // status
             // status
+            if (status > 1 && status != 3) {
+                status = erpStatus;
+            } else if (status == 3) {
+                status = 15;
+            }
             ret[@"orderStatus"] = [NSNumber numberWithInteger:status];
             ret[@"orderStatus"] = [NSNumber numberWithInteger:status];
             ret[@"order_status"] = nsstatus;
             ret[@"order_status"] = nsstatus;
             
             
@@ -4762,7 +4722,7 @@
         NSArray *order_status_array = [orderStatus componentsSeparatedByString:@","];
         NSArray *order_status_array = [orderStatus componentsSeparatedByString:@","];
         if (order_status_array.count == 1) {
         if (order_status_array.count == 1) {
             int status_value = [[order_status_array firstObject] integerValue];
             int status_value = [[order_status_array firstObject] integerValue];
-            if (status_value <= 1) {
+            if (status_value <= 1 || status_value == 3) {
                 where = [where stringByAppendingString:[NSString stringWithFormat:@" and o.status = %d",status_value]];
                 where = [where stringByAppendingString:[NSString stringWithFormat:@" and o.status = %d",status_value]];
             } else {
             } else {
                  where = [where stringByAppendingString:[NSString stringWithFormat:@" and o.erpOrderStatus = %d",status_value]];
                  where = [where stringByAppendingString:[NSString stringWithFormat:@" and o.erpOrderStatus = %d",status_value]];
@@ -4779,7 +4739,7 @@
 //                where = [where stringByAppendingString:[NSString stringWithFormat:@"%@ o.status = %@",condition,status]];
 //                where = [where stringByAppendingString:[NSString stringWithFormat:@"%@ o.status = %@",condition,status]];
                 
                 
                 int status_value = [status integerValue];
                 int status_value = [status integerValue];
-                if (status_value <= 1) {
+                if (status_value <= 1 || status_value == 3) {
                     where = [where stringByAppendingString:[NSString stringWithFormat:@"%@ o.status = %d",condition,status_value]];
                     where = [where stringByAppendingString:[NSString stringWithFormat:@"%@ o.status = %d",condition,status_value]];
                 } else {
                 } else {
                     where = [where stringByAppendingString:[NSString stringWithFormat:@" %@ o.erpOrderStatus = %d",condition,status_value]];
                     where = [where stringByAppendingString:[NSString stringWithFormat:@" %@ o.erpOrderStatus = %d",condition,status_value]];