|
@@ -45,7 +45,7 @@ public class AsyncService {
|
|
|
"Alarm_unit_2", "Alarm_unit_20", "Alarm_unit_21", "Alarm_unit_22", "Alarm_unit_23",
|
|
|
"Alarm_unit_24", "Alarm_unit_25", "Alarm_unit_26", "Alarm_unit_27", "Alarm_unit_3",
|
|
|
"Alarm_unit_4", "Alarm_unit_5", "Alarm_unit_6", "Alarm_unit_7", "Alarm_unit_8",
|
|
|
- "Alarm_unit_9"
|
|
|
+ "Alarm_unit_9", "Formula_data_36"
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -232,6 +232,8 @@ public class AsyncService {
|
|
|
float[] total = new float[6];
|
|
|
//米克重
|
|
|
int lastMkz = 0;
|
|
|
+ //规格
|
|
|
+ String lastSpec = "";
|
|
|
//毛高
|
|
|
float lastHeight = 0f;
|
|
|
//上次密度记录的米长
|
|
@@ -245,7 +247,9 @@ public class AsyncService {
|
|
|
for (int i = 0; i < values.size(); i++) {
|
|
|
JSONArray da = values.getJSONArray(i);
|
|
|
//当前时间数据 米长,正向电能,牵拉密度 2025-06-19 取消电量计算没必要了
|
|
|
+ //0.米长 1.已废弃 2.密度 3.规格
|
|
|
float[] curr = {da.getFloat(fieldList.indexOf("Capacity_data_2")), 0f, da.getFloat(fieldList.indexOf("Formula_data_24"))};
|
|
|
+ String spec = da.getStr(fieldList.indexOf("Formula_data_36"));
|
|
|
int curr48 = da.getInt(fieldList.indexOf("Capacity_data_48"));
|
|
|
|
|
|
if (i == 0) {
|
|
@@ -258,12 +262,15 @@ public class AsyncService {
|
|
|
if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_15")))) {
|
|
|
lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_36")))) {
|
|
|
+ lastSpec = da.getStr(fieldList.indexOf("Formula_data_36"));
|
|
|
+ }
|
|
|
last48 = curr48;
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if (last[2] != curr[2]) {
|
|
|
- calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, specList);
|
|
|
+ if (last[2] != curr[2] || (StringUtils.isNotEmpty(lastSpec) && !lastSpec.equals(spec))) {
|
|
|
+ calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, lastSpec, specList);
|
|
|
lastSpecLength = total[0];
|
|
|
}
|
|
|
//如果当前值为小于上一个,且上一个值不为0,则计算
|
|
@@ -290,11 +297,14 @@ public class AsyncService {
|
|
|
if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_15")))) {
|
|
|
lastHeight = da.getFloat(fieldList.indexOf("Formula_data_15"));
|
|
|
}
|
|
|
+ if (StringUtils.isNotEmpty(da.getStr(fieldList.indexOf("Formula_data_36")))) {
|
|
|
+ lastSpec = da.getStr(fieldList.indexOf("Formula_data_36"));
|
|
|
+ }
|
|
|
last48 = curr48;
|
|
|
}
|
|
|
//还是只计算米长
|
|
|
calcTotal(0, last, first, total, lastMkz, coefficient);
|
|
|
- calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, specList);
|
|
|
+ calcSpec(total[0], lastSpecLength, last[2], lastMkz, lastHeight, lastSpec, specList);
|
|
|
total[3] = 3600 - total[4];
|
|
|
total[5] = lastHeight;
|
|
|
Map<String, Object> result = new HashMap<>(16);
|
|
@@ -377,15 +387,16 @@ public class AsyncService {
|
|
|
* @param lastMkz 米克重
|
|
|
* @param specList 列表
|
|
|
*/
|
|
|
- private void calcSpec(float len, float lastLen, float lastDensity, int lastMkz, float lastHeight, List<TwinCalcHourSpec> specList) {
|
|
|
+ private void calcSpec(float len, float lastLen, float lastDensity, int lastMkz, float lastHeight, String lastSpec, List<TwinCalcHourSpec> specList) {
|
|
|
//计算规格米长
|
|
|
- //如果密度有变化,就记录下来
|
|
|
+ //如果密度或者规格有变化,就记录下来
|
|
|
TwinCalcHourSpec spec = new TwinCalcHourSpec();
|
|
|
spec.setDensity(BigDecimal.valueOf(lastDensity));
|
|
|
float len1 = len - lastLen;
|
|
|
spec.setLength(BigDecimal.valueOf(len1));
|
|
|
spec.setMick(lastMkz);
|
|
|
spec.setHeight(BigDecimal.valueOf(lastHeight));
|
|
|
+ spec.setSpec(lastSpec);
|
|
|
specList.add(spec);
|
|
|
}
|
|
|
|