代码更新

This commit is contained in:
2022-10-11 14:51:04 +08:00
parent 900b4a9e1e
commit 8a8b05a77c
15 changed files with 153 additions and 27 deletions

View File

@@ -69,4 +69,11 @@ public class DeviceBigScreenController {
public ResponseEntity<Object> getDeviceGroupStatus(){
return new ResponseEntity<>(deviceBigScreenService.getDeviceGroupStatus(),HttpStatus.OK);
}
@PostMapping("/getTodayTask")
@Log("当日任务列表")
@ApiOperation("当日任务列表")
public ResponseEntity<Object> getTodayTask(){
return new ResponseEntity<>(deviceBigScreenService.getTodayTask(),HttpStatus.OK);
}
}

View File

@@ -45,4 +45,10 @@ public interface DeviceBigScreenService {
* @return JSONObject
*/
JSONObject getDeviceGroupStatus();
/**
* 当日任务列表
* @return JSONObject
*/
JSONObject getTodayTask();
}

View File

@@ -14,6 +14,7 @@ import org.nl.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
@Service
@RequiredArgsConstructor
@@ -476,4 +477,22 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService {
resultJson.put("desc", "查询成功");
return resultJson;
}
@Override
public JSONObject getTodayTask() {
JSONObject resultJson = new JSONObject();
JSONObject resultData = new JSONObject();
HashMap<String, String> map = new HashMap<>();
map.put("flag", "4");
JSONArray resultJSONArray = WQL.getWO("TASK_AUTOWEBSOCKETTSK").addParamMap(map).process().getResultJSONArray(0);
resultData.put("device_group_arr", resultJSONArray);
resultJson.put("srb", resultData);
resultJson.put("code", "1");
resultJson.put("desc", "查询成功");
return resultJson;
}
}

View File

@@ -2,7 +2,10 @@
package org.nl.wms.sb.repair.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
@@ -370,7 +373,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
// 1.判断维修单明细中是否完成 都为是,不是则报错
JSONArray reDtlArr = reDtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException("明细为空");
if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException("明细不能为空");
for (int i = 0; i < reDtlArr.size(); i++) {
JSONObject json = reDtlArr.getJSONObject(i);
if (!StrUtil.equals(json.getString("isfinish"), "1")) {
@@ -735,6 +738,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
jsonSpareBom.put("qty", json.get("qty"));
jsonSpareBom.put("qty_unit_id", json.get("qty_unit_id"));
jsonSpareBom.put("qty_unit_name", json.getString("qty_unit_name"));
jsonSpareBom.put("current_change", DateUtil.now());
spareBOMTab.insert(jsonSpareBom);
} else {
JSONObject jsonSpareBom = spareBOMTab.query("sparepart_only_id = '" + old_sparepart_only_id + "'").uniqueResult(0);
@@ -744,6 +748,23 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
jsonSpareBom.put("qty", json.get("qty"));
jsonSpareBom.put("qty_unit_id", json.get("qty_unit_id"));
jsonSpareBom.put("qty_unit_name", json.getString("qty_unit_name"));
jsonSpareBom.put("last_change", jsonSpareBom.getString("current_change"));
jsonSpareBom.put("current_change", DateUtil.now());
// 间隔时间:本次更新时间 - 上次更新时间(天)
String last_change = jsonSpareBom.getString("last_change");
String current_change = jsonSpareBom.getString("current_change");
if (ObjectUtil.isNotEmpty(last_change) && ObjectUtil.isNotEmpty(current_change)) {
// 都不为空才能插入间隔时间
DateTime date1 = DateUtil.parse(last_change);
DateTime date2 = DateUtil.parse(current_change);
try {
long betweenDay = DateUtil.between(date1, date2, DateUnit.HOUR);
double interval_time = NumberUtil.round(NumberUtil.div(betweenDay, 24), 1).doubleValue();
jsonSpareBom.put("interval_time",interval_time);
} catch (Exception e) {
jsonSpareBom.put("interval_time","");
}
}
spareBOMTab.update(jsonSpareBom);
}
@@ -1035,5 +1056,4 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC");
return json;
}
}

View File

@@ -145,12 +145,24 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic
@Override
@Transactional(rollbackFor = Exception.class)
public void create(DevicerepairrequestDto dto) {
DeptService deptService = SpringContextHolder.getBean(DeptService.class);
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String now = DateUtil.now();
JwtUserDto currentUser = (JwtUserDto) SecurityUtils.getCurrentUser();
Long deptId = currentUser.getDeptId();
// 登录人所在班组下的设备维修单(结束维修) > 2 报错
JSONObject jsonUser = WQLObject.getWQLObject("sys_user").query("user_id = '" + currentUserId + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonUser)) {
String dept_str = deptService.getChildIdStr(jsonUser.getLong("dept_id"));
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIRREQUEST001").addParam("flag", "4").addParam("deptIds", dept_str).process().uniqueResult(0);
if (json.getIntValue("num") > 2) {
throw new BadRequestException("结束维修状态的设备数>2");
}
}
dto.setRequest_id(IdUtil.getSnowflake(1, 1).nextId());
dto.setRequest_code(CodeUtil.getNewCode("BXD_CODE"));

View File

@@ -264,6 +264,7 @@
SELECT
mst.*,
class.class_name,
file.material_type_id,
file.device_code,
file.device_name,
file.extend_code,
@@ -283,7 +284,7 @@
WHERE
mst.is_delete = '0'
AND file.is_delete = '0'
AND mst.invstatus not in ('01','04','06','99')
AND mst.invstatus not in ('04','06','99')
OPTION 输入.device_code <> ""
(file.device_code like 输入.device_code or

View File

@@ -165,5 +165,24 @@
ENDPAGEQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT
count(*) AS num
FROM
EM_BI_DeviceRepairMst mst
LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id
WHERE
mst.is_delete = '0'
AND file.is_delete = '0'
AND mst.invstatus = '06'
OPTION 输入.deptIds <> ""
file.use_groupid in 输入.deptIds
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -270,16 +270,21 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla
map.put("useIds", useIds);
}
// 获取当前登陆用户
Long currentUserId = SecurityUtils.getCurrentUserId();
JSONObject jsonUser = WQLObject.getWQLObject("sys_user").query("user_id = '" + currentUserId + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonUser)) {
String dept_str = deptService.getChildIdStr(jsonUser.getLong("dept_id"));
if (ObjectUtil.isNotEmpty(dept_str)) {
map.put("dept_str",dept_str);
// 如果班组为空 则默认当前用户部门
if (ObjectUtil.isEmpty(use_id) && ObjectUtil.isEmpty(dept_id)) {
// 获取当前登陆用户
Long currentUserId = SecurityUtils.getCurrentUserId();
JSONObject jsonUser = WQLObject.getWQLObject("sys_user").query("user_id = '" + currentUserId + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonUser)) {
String dept_str = deptService.getChildIdStr(jsonUser.getLong("dept_id"));
if (ObjectUtil.isNotEmpty(dept_str)) {
map.put("dept_str",dept_str);
}
}
}
JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCEPLAN001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.update_time DESC");
return json;
}

View File

@@ -177,7 +177,6 @@
WHERE
file.is_delete = '0'
AND file.status not in (90,91)
AND d2.dept_id in 输入.dept_str
OPTION 输入.device_code <> ""
(file.device_code like 输入.device_code or
@@ -192,6 +191,10 @@
d2.dept_id in 输入.useIds
ENDOPTION
OPTION 输入.dept_str <> ""
d2.dept_id in 输入.dept_str
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF