Compare commits
	
		
			3 Commits
		
	
	
		
			2c9c74131c
			...
			f60250bb21
		
	
	| Author | SHA1 | Date | 
|---|---|---|
| 
							
							
								
								 | 
						f60250bb21 | |
| 
							
							
								
								 | 
						0b4524aa85 | |
| 
							
							
								
								 | 
						f7e27c290f | 
| 
						 | 
					@ -25,6 +25,13 @@ class WprSerializer(CustomModelSerializer):
 | 
				
			||||||
        model = Wpr
 | 
					        model = Wpr
 | 
				
			||||||
        fields = '__all__'
 | 
					        fields = '__all__'
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					    def to_representation(self, instance):
 | 
				
			||||||
 | 
					        ret = super().to_representation(instance)
 | 
				
			||||||
 | 
					        material_name = ret.get("material_name", "")
 | 
				
			||||||
 | 
					        if material_name:
 | 
				
			||||||
 | 
					            ret["process_name"] = material_name.split("|")[-1]
 | 
				
			||||||
 | 
					        return ret
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class WprDetailSerializer(WprSerializer):
 | 
					class WprDetailSerializer(WprSerializer):
 | 
				
			||||||
    mb_ = MaterialBatchSerializer(source='mb', read_only=True)
 | 
					    mb_ = MaterialBatchSerializer(source='mb', read_only=True)
 | 
				
			||||||
    wm_ = WMaterialSerializer(source='wm', read_only=True)
 | 
					    wm_ = WMaterialSerializer(source='wm', read_only=True)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -118,7 +118,17 @@ class JSONRequestHandler(BaseHTTPRequestHandler):
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
        res = handle_bytes(resp)
 | 
					        res = handle_bytes(resp)
 | 
				
			||||||
        if isinstance(res, str):
 | 
					        if isinstance(res, str):
 | 
				
			||||||
            self.error(res)
 | 
					            if res == "数据头不正确":
 | 
				
			||||||
 | 
					                sc, resp = connect_and_send()
 | 
				
			||||||
 | 
					                if sc is None or resp is None:
 | 
				
			||||||
 | 
					                    return
 | 
				
			||||||
 | 
					                res = handle_bytes(resp)
 | 
				
			||||||
 | 
					                if isinstance(res, str):
 | 
				
			||||||
 | 
					                    self.error(res)
 | 
				
			||||||
 | 
					                else:
 | 
				
			||||||
 | 
					                    self.ok(res)
 | 
				
			||||||
 | 
					            else:
 | 
				
			||||||
 | 
					                self.error(res)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.ok(res)
 | 
					            self.ok(res)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue