Compare commits
3 Commits
2c9c74131c
...
f60250bb21
| Author | SHA1 | Date |
|---|---|---|
|
|
f60250bb21 | |
|
|
0b4524aa85 | |
|
|
f7e27c290f |
|
|
@ -24,6 +24,13 @@ class WprSerializer(CustomModelSerializer):
|
|||
class Meta:
|
||||
model = Wpr
|
||||
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):
|
||||
mb_ = MaterialBatchSerializer(source='mb', read_only=True)
|
||||
|
|
|
|||
|
|
@ -118,7 +118,17 @@ class JSONRequestHandler(BaseHTTPRequestHandler):
|
|||
|
||||
res = handle_bytes(resp)
|
||||
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:
|
||||
self.ok(res)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue