代码更新

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

View File

@@ -151,7 +151,7 @@ import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
import AddDialog from '@/views/wms/sb/repair/devicerepair/AddDialog'
import { getDepts } from '@/api/system/dept'
import { getDepts, getDeptSuperior } from '@/api/system/dept'
import { mapGetters } from 'vuex'
export default {
@@ -186,21 +186,24 @@ export default {
}
},
computed: {
...mapGetters([
'user'
])
...mapGetters({
user: 'user'
})
},
created() {
debugger
const param = {
'materOpt_code': this.materOpt_code
}
crudMaterialbase.getMaterOptType(param).then(res => {
this.class_idStr = res.class_idStr
this.crud.query.class_idStr = this.class_idStr
this.crud.toQuery()
this.queryClassId()
})
this.getDepts()
this.query.dept_id = this.user.dept.id
this.getSupDepts(this.user.dept.id)
this.crud.toQuery()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
@@ -283,6 +286,25 @@ export default {
return obj
})
})
},
getSupDepts(deptId) {
debugger
var number = parseFloat(deptId)
getDeptSuperior(number).then(res => {
const date = res.content
this.buildDepts(date)
this.depts = date
})
},
buildDepts(depts) {
depts.forEach(data => {
if (data.children) {
this.buildDepts(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}

View File

@@ -209,11 +209,11 @@ export default {
},
methods: {
[CRUD.HOOK.beforeSubmit]() {
const arr = this.form.tableData
/* const arr = this.form.tableData
if (arr.length === 0) {
this.crud.notify('明细不能为空', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
}*/
},
[CRUD.HOOK.afterToEdit]() {
const data = {

View File

@@ -78,7 +78,7 @@
</div>
<!--如果想在工具栏加入更多按钮可以使用插槽方式 slot = 'left' or 'right'-->
<crudOperation :permission="permission">
<el-button
<!-- <el-button
slot="right"
class="filter-item"
type="success"
@@ -88,7 +88,7 @@
@click="submit"
>
提交
</el-button>
</el-button>-->
</crudOperation>
<!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">

View File

@@ -161,6 +161,16 @@
<el-table-column prop="audit_time" label="审核时间" width="150px" show-overflow-tooltip />
<el-table-column prop="source_bill_code" label="源单号" show-overflow-tooltip />
<el-table-column prop="source_bill_type" label="源单业务类型" width="120px" />
<el-table-column v-permission="[]" label="操作" width="120px" align="center" fixed="right">
<template slot-scope="scope">
<udOperation
:data="scope.row"
:permission="permission"
:disabled-edit="formterStatus(scope.row)"
:disabled-dle="scope.row.invstatus !== '01'"
/>
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
@@ -169,6 +179,7 @@
<resuftDialog :dialog-show.sync="resuftDialog" :open-param="openParam" />
<ReceiveDialog :dialog-show.sync="receiveDialog" :open-param="openParam" />
<StartDialog :dialog-show.sync="startDialog" :open-param="openParam" />
<AddDialog/>
</div>
</template>
@@ -188,11 +199,12 @@ import ExecuteDialog from '@/views/wms/sb/repair/devicerepairpa/ExecuteDialog'
import resuftDialog from '@/views/wms/sb/repair/devicerepairpa/resuftDialog'
import ReceiveDialog from '@/views/wms/sb/repair/devicerepairpa/ReceiveDialog'
import StartDialog from '@/views/wms/sb/repair/devicerepairpa/StartDialog'
import AddDialog from '@/views/wms/sb/repair/devicerepair/AddDialog'
export default {
name: 'Devicerepairpa',
dicts: ['EM_DEVICE_WX_INVTYPE', 'EM_DEVICE_WX_INVSTATUS', 'EM_FAULT_LEVEL'],
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, Treeselect, ExecuteDialog, resuftDialog, ReceiveDialog, StartDialog },
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, Treeselect, ExecuteDialog, resuftDialog, ReceiveDialog, StartDialog, AddDialog },
mixins: [presenter(), header(), crud()],
cruds() {
return CRUD({
@@ -202,7 +214,7 @@ export default {
sort: 'repair_id,desc',
crudMethod: { ...crudDevicerepairmst },
optShow: {
add: false,
add: true,
edit: false,
del: false,
download: false,
@@ -249,6 +261,9 @@ export default {
hand(value) {
this.crud.toQuery()
},
formterStatus(row) {
return '06,07,99'.includes(row.invstatus)
},
loadClass({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
@@ -289,9 +304,6 @@ export default {
startRepair() {
const _selectData = this.$refs.table.selection
const data = _selectData[0]
if (data.invstatus !== '02') {
return this.crud.notify('只能对提交状态的单据维修', CRUD.NOTIFICATION_TYPE.INFO)
}
this.openParam = data
this.startDialog = true
},
@@ -383,7 +395,7 @@ export default {
this.confirm_flag = false
this.result_flag = false
for (let i = 0; i < rows.length; i++) {
if ('01,03,04,05,06,07,99'.includes(rows[i].invstatus)) {
if ('03,04,05,06,07,99'.includes(rows[i].invstatus)) {
this.start_flag = true
}
if ('01,02,04,05,06,07,99'.includes(rows[i].invstatus)) {

View File

@@ -168,7 +168,7 @@
<el-table-column prop="fault_desc" label="故障描述" show-overflow-tooltip width="120px" />
<el-table-column prop="remark" label="备注" show-overflow-tooltip width="120px" />
<el-table-column prop="fault_time" label="故障时间" width="150px" />
<el-table-column prop="create_name" label="创建" />
<el-table-column prop="create_name" label="报修" />
<el-table-column prop="create_time" label="创建时间" width="150px" />
<el-table-column prop="process_name" label="处理人" />
<el-table-column prop="process_time" label="处理时间" width="150px" />