Compare commits

...

3 Commits

2 changed files with 18 additions and 1 deletions

View File

@ -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)

View File

@ -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)