|
|
@@ -188,25 +188,10 @@ public class ProdBatchController extends CommonController {
|
|
|
renderJson(ApiResponse.success(new PageResult<>(0, pageNumber, pageSize, new ArrayList<>())));
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- List<Record> itemList = Db.find("select sku,id,item_name from t_jz_item where Status =1");
|
|
|
- Map<String,Record>paramMap = new HashMap<>();
|
|
|
- for (Record record : itemList) {
|
|
|
- paramMap.put(record.getStr("sku"),record);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
List<Record> list = paginate.getList();
|
|
|
List<DeviceMonitorRecordDto> deviceMonitorRecordDtoList = new ArrayList<>();
|
|
|
for (Record record : list) {
|
|
|
DeviceMonitorRecordDto deviceMonitorRecordDto = convertRecordToDeviceMonitorRecordDto(record);
|
|
|
- String sku = record.getStr("product_sku");
|
|
|
- String itemName = "";
|
|
|
- if (paramMap.containsKey(sku)) {
|
|
|
- itemName = paramMap.get(sku).getStr("item_name");
|
|
|
- }
|
|
|
- deviceMonitorRecordDto.setProduct(itemName);
|
|
|
deviceMonitorRecordDtoList.add(deviceMonitorRecordDto);
|
|
|
}
|
|
|
renderJson(new PageResult<>(paginate.getTotalRow(), pageNumber, pageSize, deviceMonitorRecordDtoList));
|
|
|
@@ -234,15 +219,15 @@ public class ProdBatchController extends CommonController {
|
|
|
if (result) {
|
|
|
apiResponse.setMsg("刷新成功");
|
|
|
apiResponse.setCode(0);
|
|
|
- StringBuilder sql = new StringBuilder("select tjd.*,tdd.id as deviceId,tdd.device_no as deviceNo, tdd.desc as device_name, tf.factory_name, tw.workshop_name, tjp.item_name as product_name");
|
|
|
+ StringBuilder sql = new StringBuilder("select tjd.*,tdd.id as deviceId,tdd.device_no as deviceNo, tdd.desc as device_name, tf.factory_name, tw.workshop_name");
|
|
|
sql.append(" from t_jz_device tdd");
|
|
|
sql.append(" inner join t_device_detail tjd on tdd.id = tjd.device_id");
|
|
|
sql.append(" left join t_factory tf on tdd.factory_id = tf.id");
|
|
|
sql.append(" left join t_workshop tw on tdd.workshop_id = tw.id");
|
|
|
- sql.append(" left join t_jz_item tjp on tjd.product_sku = tjp.sku");
|
|
|
sql.append(" where tdd.id = ?");
|
|
|
record = Db.findFirst(sql.toString(), deviceId);
|
|
|
DeviceMonitorRecordDto deviceMonitorRecordDto = convertRecordToDeviceMonitorRecordDto(record);
|
|
|
+
|
|
|
apiResponse.setData(deviceMonitorRecordDto);
|
|
|
} else {
|
|
|
apiResponse.setCode(500);
|
|
|
@@ -587,6 +572,17 @@ public class ProdBatchController extends CommonController {
|
|
|
if(deviceNo != null){
|
|
|
deviceMonitorRecordDto.setOnline(1);
|
|
|
}
|
|
|
+ List<Record> itemList = Db.find("select sku,id,item_name from t_jz_item where Status =1");
|
|
|
+ Map<String,Record>paramMap = new HashMap<>();
|
|
|
+ for (Record itemRecord : itemList) {
|
|
|
+ paramMap.put(itemRecord.getStr("sku"),itemRecord);
|
|
|
+ }
|
|
|
+ String sku = record.getStr("product_sku");
|
|
|
+ String itemName = "";
|
|
|
+ if (paramMap.containsKey(sku)) {
|
|
|
+ itemName = paramMap.get(sku).getStr("item_name");
|
|
|
+ }
|
|
|
+ deviceMonitorRecordDto.setProduct(itemName);
|
|
|
return deviceMonitorRecordDto;
|
|
|
}
|
|
|
}
|