add:1.设备维修项目维护 2.设备故障分类维护 3.设备保养项目维护

This commit is contained in:
2023-09-04 11:02:38 +08:00
parent 97f23b2b0b
commit 3e4ba93a54
22 changed files with 2561 additions and 0 deletions

View File

@@ -0,0 +1,61 @@
package org.nl.wms.masterdata_manage.em.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.masterdata_manage.em.service.DevicefaultclassService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author Liuxy
* @date 2022-06-16
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "设备故障分类维护管理")
@RequestMapping("/api/devicefaultclass")
@Slf4j
public class DevicefaultclassController {
private final DevicefaultclassService devicefaultclassService;
@GetMapping
@ApiOperation("查询设备故障分类维护")
//@PreAuthorize("@el.check('devicefaultclass:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(devicefaultclassService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增设备故障分类维护")
//@PreAuthorize("@el.check('devicefaultclass:add')")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
devicefaultclassService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改设备故障分类维护")
//@PreAuthorize("@el.check('devicefaultclass:edit')")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
devicefaultclassService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ApiOperation("删除设备故障分类维护")
//@PreAuthorize("@el.check('devicefaultclass:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
devicefaultclassService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,57 @@
package org.nl.wms.masterdata_manage.em.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.masterdata_manage.em.service.DevicemaintenanceitemsService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author Liuxy
* @date 2022-06-16
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "设备保养项目维护管理")
@RequestMapping("/api/devicemaintenanceitems")
@Slf4j
public class DevicemaintenanceitemsController {
private final DevicemaintenanceitemsService devicemaintenanceitemsService;
@GetMapping
@ApiOperation("查询设备保养项目维护")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(devicemaintenanceitemsService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增设备保养项目维护")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
devicemaintenanceitemsService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改设备保养项目维护")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
devicemaintenanceitemsService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ApiOperation("删除设备保养项目维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
devicemaintenanceitemsService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,57 @@
package org.nl.wms.masterdata_manage.em.rest;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.wms.masterdata_manage.em.service.DevicerepairitemsService;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @author Liuxy
* @date 2022-06-16
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "设备维修项目维护管理")
@RequestMapping("/api/devicerepairitems")
@Slf4j
public class DevicerepairitemsController {
private final DevicerepairitemsService devicerepairitemsService;
@GetMapping
@ApiOperation("查询设备维修项目维护")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(devicerepairitemsService.queryAll(whereJson, page), HttpStatus.OK);
}
@PostMapping
@ApiOperation("新增设备维修项目维护")
public ResponseEntity<Object> create(@RequestBody JSONObject whereJson) {
devicerepairitemsService.create(whereJson);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@ApiOperation("修改设备维修项目维护")
public ResponseEntity<Object> update(@RequestBody JSONObject whereJson) {
devicerepairitemsService.update(whereJson);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@ApiOperation("删除设备维修项目维护")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
devicerepairitemsService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
}

View File

@@ -0,0 +1,72 @@
package org.nl.wms.masterdata_manage.em.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.masterdata_manage.em.service.dto.DevicefaultclassDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务接口
* @date 2022-06-16
**/
public interface DevicefaultclassService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<DevicefaultclassDto>
*/
List<DevicefaultclassDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param device_faultclass_id ID
* @return Devicefaultclass
*/
DevicefaultclassDto findById(Long device_faultclass_id);
/**
* 根据编码查询
*
* @param code code
* @return Devicefaultclass
*/
DevicefaultclassDto findByCode(String code);
/**
* 创建
*
* @param whereJson /
*/
void create(JSONObject whereJson);
/**
* 编辑
*
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,72 @@
package org.nl.wms.masterdata_manage.em.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.masterdata_manage.em.service.dto.DevicemaintenanceitemsDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务接口
* @date 2022-06-16
**/
public interface DevicemaintenanceitemsService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<DevicemaintenanceitemsDto>
*/
List<DevicemaintenanceitemsDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param maint_item_id ID
* @return Devicemaintenanceitems
*/
DevicemaintenanceitemsDto findById(Long maint_item_id);
/**
* 根据编码查询
*
* @param code code
* @return Devicemaintenanceitems
*/
DevicemaintenanceitemsDto findByCode(String code);
/**
* 创建
*
* @param whereJson /
*/
void create(JSONObject whereJson);
/**
* 编辑
*
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,72 @@
package org.nl.wms.masterdata_manage.em.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.masterdata_manage.em.service.dto.DevicerepairitemsDto;
import org.springframework.data.domain.Pageable;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务接口
* @date 2022-06-16
**/
public interface DevicerepairitemsService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<DevicerepairitemsDto>
*/
List<DevicerepairitemsDto> queryAll(Map whereJson);
/**
* 根据ID查询
*
* @param repair_item_id ID
* @return Devicerepairitems
*/
DevicerepairitemsDto findById(Long repair_item_id);
/**
* 根据编码查询
*
* @param code code
* @return Devicerepairitems
*/
DevicerepairitemsDto findByCode(String code);
/**
* 创建
*
* @param whereJson /
*/
void create(JSONObject whereJson);
/**
* 编辑
*
* @param whereJson /
*/
void update(JSONObject whereJson);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
}

View File

@@ -0,0 +1,83 @@
package org.nl.wms.masterdata_manage.em.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
/**
* @author Liuxy
* @description /
* @date 2022-06-16
**/
@Data
public class DevicefaultclassDto implements Serializable {
/** 设备故障分类标识 */
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long device_faultclass_id;
/**
* 设备故障分类编码
*/
private String device_faultclass_code;
/**
* 设备故障分类名称
*/
private String device_faultclass_name;
/**
* 设备分类标识
*/
private Long material_type_id;
/**
* 解决措施
*/
private String solutions;
/**
* 备注
*/
private String remark;
/**
* 创建人
*/
private Long create_id;
/**
* 创建人姓名
*/
private String create_name;
/**
* 创建时间
*/
private String create_time;
/**
* 修改人
*/
private Long update_optid;
/**
* 修改人姓名
*/
private String update_optname;
/**
* 修改时间
*/
private String update_time;
/**
* 是否删除
*/
private String is_delete;
}

View File

@@ -0,0 +1,93 @@
package org.nl.wms.masterdata_manage.em.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
/**
* @author Liuxy
* @description /
* @date 2022-06-16
**/
@Data
public class DevicemaintenanceitemsDto implements Serializable {
/** 设备保养项目标识 */
/**
* 防止精度丢失
*/
@JsonSerialize(using = ToStringSerializer.class)
private Long maint_item_id;
/**
* 设备保养项目编码
*/
private String maint_item_code;
/**
* 设备保养项目名称
*/
private String maint_item_name;
/**
* 保养等级
*/
private String item_level;
/**
* 保养内容
*/
private String contents;
/**
* 保养要求
*/
private String requirement;
/**
* 验收标准
*/
private String acceptancecriteria;
/**
* 创建人
*/
private Long create_id;
/**
* 创建人姓名
*/
private String create_name;
/**
* 创建时间
*/
private String create_time;
/**
* 修改人
*/
private Long update_optid;
/**
* 修改人姓名
*/
private String update_optname;
/**
* 修改时间
*/
private String update_time;
/**
* 是否删除
*/
private String is_delete;
/**
* 备注
*/
private String remark;
}

View File

@@ -0,0 +1,54 @@
package org.nl.wms.masterdata_manage.em.service.dto;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.io.Serializable;
/**
* @description /
* @author Liuxy
* @date 2022-06-16
**/
@Data
public class DevicerepairitemsDto implements Serializable {
/** 设备维修项目标识 */
/** 防止精度丢失 */
@JsonSerialize(using= ToStringSerializer.class)
private Long repair_item_id;
/** 设备维修项目编码 */
private String repair_item_code;
/** 设备维修项目名称 */
private String repair_item_name;
/** 维修要求 */
private String requirement;
/** 创建人 */
private Long create_id;
/** 创建人姓名 */
private String create_name;
/** 创建时间 */
private String create_time;
/** 修改人 */
private Long update_optid;
/** 修改人姓名 */
private String update_optname;
/** 修改时间 */
private String update_time;
/** 是否删除 */
private String is_delete;
/** 备注 */
private String remark;
}

View File

@@ -0,0 +1,151 @@
package org.nl.wms.masterdata_manage.em.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.masterdata_manage.em.service.DevicefaultclassService;
import org.nl.wms.masterdata_manage.em.service.dto.DevicefaultclassDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务实现
* @date 2022-06-16
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class DevicefaultclassServiceImpl implements DevicefaultclassService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String device_faultclass_code = MapUtil.getStr(whereJson, "device_faultclass_code");
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
if (ObjectUtil.isNotEmpty(device_faultclass_code)) map.put("device_faultclass_code","%"+device_faultclass_code+"%");
//处理物料当前节点的所有子节点
if (!StrUtil.isEmpty(material_type_id)) {
map.put("material_type_id", material_type_id);
String classIds = classstandardService.getChildIdStr(material_type_id);
map.put("classIds", classIds);
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
String classIds = classstandardService.getAllChildIdStr(class_idStr);
map.put("classIds", classIds);
}
JSONObject json = WQL.getWO("EM_BI_DEVICEFAULTCLASS").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.device_faultclass_code DESC");
return json;
}
@Override
public List<DevicefaultclassDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicefaultclassDto.class);
return null;
}
@Override
public DevicefaultclassDto findById(Long device_faultclass_id) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
JSONObject json = wo.query("device_faultclass_id = '" + device_faultclass_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicefaultclassDto.class);
}
return null;
}
@Override
public DevicefaultclassDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicefaultclassDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
JSONObject json = new JSONObject();
json.put("device_faultclass_id", IdUtil.getSnowflake(1,1).nextId());
json.put("device_faultclass_code", CodeUtil.getNewCode("DEVICE_FACLASS_CODE"));
json.put("device_faultclass_name", whereJson.getString("device_faultclass_name"));
json.put("material_type_id", whereJson.getString("material_type_id"));
json.put("solutions", whereJson.getString("solutions"));
json.put("remark", whereJson.getString("remark"));
json.put("create_id", currentUserId);
json.put("create_name", nickName);
json.put("create_time", now);
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
JSONObject json = wo.query("device_faultclass_id = '" + whereJson.getString("device_faultclass_id") + "'").uniqueResult(0);
json.put("device_faultclass_name", whereJson.getString("device_faultclass_name"));
json.put("material_type_id", whereJson.getString("material_type_id"));
json.put("solutions", whereJson.getString("solutions"));
json.put("remark", whereJson.getString("remark"));
json.put("update_optid", currentUserId);
json.put("update_optname", nickName);
json.put("update_time", DateUtil.now());
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicefaultclass");
for (Long device_faultclass_id : ids) {
JSONObject param = new JSONObject();
param.put("device_faultclass_id", String.valueOf(device_faultclass_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
}

View File

@@ -0,0 +1,168 @@
package org.nl.wms.masterdata_manage.em.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.masterdata_manage.em.service.DevicemaintenanceitemsService;
import org.nl.wms.masterdata_manage.em.service.dto.DevicemaintenanceitemsDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务实现
* @date 2022-06-16
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class DevicemaintenanceitemsServiceImpl implements DevicemaintenanceitemsService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
String maint_item_code = MapUtil.getStr(whereJson, "maint_item_code");
String contents = MapUtil.getStr(whereJson, "contents");
String requirement = MapUtil.getStr(whereJson, "requirement");
String item_level = MapUtil.getStr(whereJson, "item_level");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
map.put("item_level", item_level);
if (ObjectUtil.isNotEmpty(maint_item_code)) map.put("maint_item_code","%"+maint_item_code+"%");
if (ObjectUtil.isNotEmpty(contents)) map.put("contents","%"+contents+"%");
if (ObjectUtil.isNotEmpty(requirement)) map.put("requirement","%"+requirement+"%");
//处理物料当前节点的所有子节点
if (!StrUtil.isEmpty(material_type_id)) {
map.put("material_type_id", material_type_id);
String classIds = classstandardService.getChildIdStr(material_type_id);
map.put("classIds", classIds);
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
String classIds = classstandardService.getAllChildIdStr(class_idStr);
map.put("classIds", "");
}
JSONObject json = WQL.getWO("EM_BI_DEVICEMAINTAIN_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "maint_item_code DESC");
return json;
}
@Override
public List<DevicemaintenanceitemsDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicemaintenanceitemsDto.class);
return null;
}
@Override
public DevicemaintenanceitemsDto findById(Long maint_item_id) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
JSONObject json = wo.query("maint_item_id = '" + maint_item_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicemaintenanceitemsDto.class);
}
return null;
}
@Override
public DevicemaintenanceitemsDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicemaintenanceitemsDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject json = new JSONObject();
json.put("maint_item_id", IdUtil.getSnowflake(1,1).nextId());
json.put("maint_item_code", CodeUtil.getNewCode("MAINT_ITEM_CODE"));
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
json.put("requirement", whereJson.getString("requirement"));
json.put("acceptancecriteria", whereJson.getString("acceptancecriteria"));
json.put("remark", whereJson.getString("remark"));
json.put("create_id", currentUserId);
json.put("create_name", nickName);
json.put("create_time", now);
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
JSONObject json = wo.query("maint_item_id = '" + whereJson.getString("maint_item_id") + "'").uniqueResult(0);
json.put("maint_item_name", whereJson.getString("maint_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("item_level", whereJson.getString("item_level"));
json.put("contents", whereJson.getString("contents"));
json.put("requirement", whereJson.getString("requirement"));
json.put("acceptancecriteria", whereJson.getString("acceptancecriteria"));
json.put("remark", whereJson.getString("remark"));
json.put("update_optid", currentUserId);
json.put("update_optname", nickName);
json.put("update_time", now);
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicemaintenanceitems");
for (Long maint_item_id : ids) {
JSONObject param = new JSONObject();
param.put("maint_item_id", String.valueOf(maint_item_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
}

View File

@@ -0,0 +1,160 @@
package org.nl.wms.masterdata_manage.em.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.system.util.CodeUtil;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.core.bean.WQLObject;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.masterdata_manage.em.service.DevicerepairitemsService;
import org.nl.wms.masterdata_manage.em.service.dto.DevicerepairitemsDto;
import org.nl.wms.masterdata_manage.备份master.service.ClassstandardService;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Liuxy
* @description 服务实现
* @date 2022-06-16
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class DevicerepairitemsServiceImpl implements DevicerepairitemsService {
private final ClassstandardService classstandardService;
@Override
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
String material_type_id = MapUtil.getStr(whereJson, "material_type_id");
String class_idStr = (String) whereJson.get("class_idStr");
String repair_item_code = MapUtil.getStr(whereJson, "repair_item_code");
String requirement = MapUtil.getStr(whereJson, "requirement");
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
if (ObjectUtil.isNotEmpty(repair_item_code)) map.put("repair_item_code","%"+repair_item_code+"%");
if (ObjectUtil.isNotEmpty(requirement)) map.put("requirement","%"+requirement+"%");
//处理物料当前节点的所有子节点
if (!StrUtil.isEmpty(material_type_id)) {
map.put("material_type_id", material_type_id);
String classIds = classstandardService.getChildIdStr(material_type_id);
map.put("classIds", classIds);
} else if (ObjectUtil.isNotEmpty(class_idStr)) {
String classIds = classstandardService.getAllChildIdStr(class_idStr);
map.put("classIds", "");
}
JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIRITEMS_01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "repair_item_code DESC");
return json;
}
@Override
public List<DevicerepairitemsDto> queryAll(Map whereJson) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
JSONArray arr = wo.query().getResultJSONArray(0);
if (ObjectUtil.isNotEmpty(arr)) return arr.toJavaList(DevicerepairitemsDto.class);
return null;
}
@Override
public DevicerepairitemsDto findById(Long repair_item_id) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
JSONObject json = wo.query("repair_item_id = '" + repair_item_id + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicerepairitemsDto.class);
}
return null;
}
@Override
public DevicerepairitemsDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
JSONObject json = wo.query("code ='" + code + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(json)) {
return json.toJavaObject(DevicerepairitemsDto.class);
}
return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
JSONObject json = new JSONObject();
json.put("repair_item_id", IdUtil.getSnowflake(1,1).nextId());
json.put("repair_item_code", CodeUtil.getNewCode("REPAIR_ITEM_CODE"));
json.put("repair_item_name", whereJson.getString("repair_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("requirement", whereJson.getString("requirement"));
json.put("remark", whereJson.getString("remark"));
json.put("create_id",currentUserId );
json.put("create_name",nickName );
json.put("create_time",now );
json.put("update_optid",currentUserId );
json.put("update_optname",nickName );
json.put("update_time",now );
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(JSONObject whereJson) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
JSONObject json = wo.query("repair_item_id = '" + whereJson.getString("repair_item_id") + "'").uniqueResult(0);
json.put("repair_item_name", whereJson.getString("repair_item_name"));
json.put("material_type_id", whereJson.get("material_type_id"));
json.put("requirement", whereJson.getString("requirement"));
json.put("remark", whereJson.getString("remark"));
json.put("update_optid",currentUserId );
json.put("update_optname",nickName );
json.put("update_time",now );
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
Long currentUserId = Long.parseLong(SecurityUtils.getCurrentUserId());
String nickName = SecurityUtils.getCurrentNickName();
String now = DateUtil.now();
WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairitems");
for (Long repair_item_id : ids) {
JSONObject param = new JSONObject();
param.put("repair_item_id", String.valueOf(repair_item_id));
param.put("is_delete", "1");
param.put("update_optid", currentUserId);
param.put("update_optname", nickName);
param.put("update_time", now);
wo.update(param);
}
}
}

View File

@@ -0,0 +1,67 @@
[交易说明]
交易名: 设备故障分类维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.classIds TYPEAS f_string
输入.device_faultclass_code TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
mst.*,
class.class_name
FROM
EM_BI_DeviceFaultClass mst
LEFT JOIN md_pb_classstandard class ON mst.material_type_id = class.class_id
WHERE
mst.is_delete = '0'
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
OPTION 输入.device_faultclass_code <> ""
(mst.device_faultclass_code like 输入.device_faultclass_code or
mst.device_faultclass_name like 输入.device_faultclass_code)
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,82 @@
[交易说明]
交易名: 设备保养项目维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.maint_item_code TYPEAS s_string
输入.contents TYPEAS s_string
输入.requirement TYPEAS s_string
输入.item_level TYPEAS s_string
输入.classIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
item.*,
class.class_name
FROM
EM_BI_DeviceMaintenanceItems item
LEFT JOIN md_pb_classstandard class ON item.material_type_id = class.class_id
WHERE
item.is_delete = '0'
OPTION 输入.item_level <> ""
item.item_level = 输入.item_level
ENDOPTION
OPTION 输入.maint_item_code <> ""
(item.maint_item_code like 输入.maint_item_code or
item.maint_item_name like 输入.maint_item_code)
ENDOPTION
OPTION 输入.contents <> ""
item.contents like 输入.contents
ENDOPTION
OPTION 输入.requirement <> ""
item.requirement like 输入.requirement
ENDOPTION
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -0,0 +1,72 @@
[交易说明]
交易名: 设备维修项目维护分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.repair_item_code TYPEAS s_string
输入.requirement TYPEAS s_string
输入.classIds TYPEAS f_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
item.*,
class.class_name
FROM
EM_BI_DeviceRepairItems item
LEFT JOIN md_pb_classstandard class ON item.material_type_id = class.class_id
WHERE
item.is_delete = '0'
OPTION 输入.classIds <> ""
class.class_id in 输入.classIds
ENDOPTION
OPTION 输入.requirement <> ""
item.requirement like 输入.requirement
ENDOPTION
OPTION 输入.repair_item_code <> ""
(item.repair_item_code like 输入.repair_item_code or
item.repair_item_name like 输入.repair_item_code)
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF