修改包
This commit is contained in:
parent
3db006b061
commit
92a57ff383
|
|
@ -2,9 +2,14 @@ package com.bonus.material.devchange.controller;
|
|||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import com.bonus.common.biz.config.ListPagingUtil;
|
||||
import com.bonus.common.core.utils.poi.ExcelUtil;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.material.basic.domain.BmSlideShow;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeVo;
|
||||
import com.bonus.material.devchange.domain.DevChangeVo;
|
||||
|
|
@ -17,6 +22,7 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
|
|
@ -67,7 +73,7 @@ public class DevChangeController extends BaseController {
|
|||
|
||||
|
||||
|
||||
@ApiOperation(value = "新增出库、入库、-退役、维修 ")
|
||||
@ApiOperation(value = "新增出库")
|
||||
@PostMapping("/addChangeInfo")
|
||||
public AjaxResult addChangeInfo(@RequestBody CsDeviceChangeVo vo) {
|
||||
return service.addChangeInfo(vo);
|
||||
|
|
@ -75,6 +81,32 @@ public class DevChangeController extends BaseController {
|
|||
|
||||
|
||||
|
||||
@ApiOperation(value = "入库和维修")
|
||||
@PostMapping("/updateDevChangeInfo")
|
||||
public AjaxResult updateDevChangeInfo(@RequestBody CsDeviceChangeVo vo) {
|
||||
return service.updateDevChangeInfo(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "入库、报废")
|
||||
@PostMapping("/updateDevChangeInfo2")
|
||||
public AjaxResult updateDevChangeInfo2(@RequestBody CsDeviceChangeVo vo) {
|
||||
return service.updateDevChangeInfo2(vo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "入库、报废")
|
||||
@PostMapping("/updateDevChangeInfo3")
|
||||
public AjaxResult updateDevChangeInfo3(@RequestBody CsDeviceChangeVo vo) {
|
||||
return service.updateDevChangeInfo3(vo);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导出设备流转台账")
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, CsDeviceChangeVo vo) {
|
||||
List<CsDeviceChangeVo> list = service.getDevChangeList(vo);
|
||||
ExcelUtil<CsDeviceChangeVo> util = new ExcelUtil<CsDeviceChangeVo>(CsDeviceChangeVo.class);
|
||||
util.exportExcel(response, list, "设备流转台账");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -86,10 +118,19 @@ public class DevChangeController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "导出设备流转台账详情")
|
||||
@PostMapping("/exportDetails")
|
||||
public void exportDetails(HttpServletResponse response, CsDeviceChangeDetailsVo vo) {
|
||||
List<DevChangeVo> list = service.getDevDetails(vo);
|
||||
ExcelUtil<DevChangeVo> util = new ExcelUtil<DevChangeVo>(DevChangeVo.class);
|
||||
util.exportExcel(response, list, "导出设备流转台账详情");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "出库记录单")
|
||||
@PostMapping("/getDevDetails")
|
||||
public AjaxResult getDevDetails(@RequestBody CsDeviceChangeDetailsVo vo) {
|
||||
return service.getDevDetails(vo);
|
||||
return AjaxResult.success(service.getDevDetails(vo));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,13 @@ public class CsDeviceChangeDetailsVo {
|
|||
private Integer pageNum;
|
||||
|
||||
private Integer pageSize;
|
||||
|
||||
private String proId;
|
||||
|
||||
private int num=1;
|
||||
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
|
@ -12,6 +13,14 @@ public class CsDeviceChangeVo {
|
|||
private Integer pageNum;
|
||||
|
||||
private Integer pageSize;
|
||||
/**
|
||||
* 退役原因
|
||||
*/
|
||||
private String reasonId;
|
||||
/**
|
||||
* 退役原因
|
||||
*/
|
||||
private String reasonVal;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
|
|
@ -19,11 +28,18 @@ public class CsDeviceChangeVo {
|
|||
/**
|
||||
* 变更状前状态
|
||||
*/
|
||||
@Excel(name = "流转前状态",width = 20,sort = 4)
|
||||
private String changeStatusName;
|
||||
|
||||
private String changeStatus;
|
||||
/**
|
||||
* 类型
|
||||
* 变更类型 1入库 2出库 3 退役 4 维修
|
||||
*/
|
||||
@Excel(name = "操作类型",width = 25 ,sort = 2)
|
||||
private String typeName;
|
||||
|
||||
|
||||
private String type;
|
||||
/**
|
||||
* 变更状态 0自用 1共享
|
||||
|
|
@ -36,6 +52,7 @@ public class CsDeviceChangeVo {
|
|||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@Excel(name = "使用项目",width = 25,sort = 7)
|
||||
private String proName;
|
||||
/**
|
||||
* 工程类型
|
||||
|
|
@ -44,6 +61,7 @@ public class CsDeviceChangeVo {
|
|||
/**
|
||||
* 设备数量
|
||||
*/
|
||||
@Excel(name = "设备数量",width = 25,sort = 9)
|
||||
private String devNum;
|
||||
/**
|
||||
* 电压等级
|
||||
|
|
@ -52,6 +70,7 @@ public class CsDeviceChangeVo {
|
|||
/**
|
||||
* 使用单位
|
||||
*/
|
||||
@Excel(name = "使用单位",width = 25,sort = 6)
|
||||
private String useUint;
|
||||
/**
|
||||
* 省
|
||||
|
|
@ -68,14 +87,17 @@ public class CsDeviceChangeVo {
|
|||
/**
|
||||
* 详细地址
|
||||
*/
|
||||
@Excel(name = "使用地址",width = 25,sort = 8)
|
||||
private String proLocation;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Excel(name = "操作时间",width = 25,sort = 2)
|
||||
private String createTime;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@Excel(name = "操作人",width = 20,sort = 1)
|
||||
private String createUser;
|
||||
/**
|
||||
* 使用人
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DevChangeDetailsVo {
|
||||
|
||||
private String id;
|
||||
|
||||
private int num=1;
|
||||
|
||||
private String type;
|
||||
|
||||
private String proId;
|
||||
|
||||
private String devId;
|
||||
|
||||
public DevChangeDetailsVo() {
|
||||
}
|
||||
|
||||
public DevChangeDetailsVo(String devId, String proId, String type, int num) {
|
||||
this.num = num;
|
||||
this.type = type;
|
||||
this.proId = proId;
|
||||
this.devId = devId;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.material.devchange.domain;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -42,10 +43,12 @@ public class DevChangeVo {
|
|||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
@Excel(name = "设备型号",width = 25 ,sort = 2)
|
||||
private String devModel;
|
||||
/**
|
||||
* 设备名称
|
||||
*/
|
||||
@Excel(name = "设备名称",width = 25 ,sort = 1)
|
||||
private String devName;
|
||||
/**
|
||||
* 等级
|
||||
|
|
@ -66,6 +69,7 @@ public class DevChangeVo {
|
|||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@Excel(name = "设备名称",width = 25 ,sort = 3)
|
||||
private String devCode;
|
||||
/**
|
||||
* 产权单位
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
package com.bonus.material.devchange.mapper;
|
||||
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeVo;
|
||||
import com.bonus.material.devchange.domain.DevChangeVo;
|
||||
import com.bonus.material.devchange.domain.JjProjectVo;
|
||||
import com.bonus.material.devchange.domain.*;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -96,7 +93,7 @@ public interface DevChangeMapper {
|
|||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<CsDeviceChangeDetailsVo> getDevDetails(CsDeviceChangeDetailsVo vo);
|
||||
List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo);
|
||||
|
||||
/**
|
||||
* 电压等级
|
||||
|
|
@ -104,4 +101,29 @@ public interface DevChangeMapper {
|
|||
* @return
|
||||
*/
|
||||
List<JjProjectVo> getVoltageLevel(JjProjectVo vo);
|
||||
|
||||
/**
|
||||
* 修改详情
|
||||
* @param deviceChangeDetailsVo
|
||||
*/
|
||||
void addDevChangeDetails(DevChangeDetailsVo deviceChangeDetailsVo);
|
||||
|
||||
/**
|
||||
* 查询数据
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<DevChangeDetailsVo> getDevChangeDetailsList(DevChangeDetailsVo vo);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param voo
|
||||
*/
|
||||
void deleteDevChangeDetails(DevChangeDetailsVo voo);
|
||||
|
||||
/**
|
||||
* 修改数量
|
||||
* @param newNum
|
||||
*/
|
||||
void updateChangeDetailsNum(DevChangeDetailsVo voo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public interface DevChangeService {
|
|||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo);
|
||||
List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo);
|
||||
|
||||
/**
|
||||
* 电压等级下拉选
|
||||
|
|
@ -57,4 +57,10 @@ public interface DevChangeService {
|
|||
* @return
|
||||
*/
|
||||
List<JjProjectVo> getVoltageLevel(JjProjectVo vo);
|
||||
|
||||
AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo);
|
||||
|
||||
AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo);
|
||||
|
||||
AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,10 +5,7 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.common.utils.StringUtil;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo;
|
||||
import com.bonus.material.devchange.domain.CsDeviceChangeVo;
|
||||
import com.bonus.material.devchange.domain.DevChangeVo;
|
||||
import com.bonus.material.devchange.domain.JjProjectVo;
|
||||
import com.bonus.material.devchange.domain.*;
|
||||
import com.bonus.material.devchange.mapper.DevChangeMapper;
|
||||
import com.bonus.material.device.domain.vo.DevInfoPropertyVo;
|
||||
import com.bonus.material.device.domain.vo.DevInfoVo;
|
||||
|
|
@ -66,6 +63,191 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateDevChangeInfo(CsDeviceChangeVo vo) {
|
||||
try{
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
vo.setCreateUser(username);
|
||||
String proCode=vo.getProCode();
|
||||
if (StringUtils.isBlank(proCode)) {
|
||||
return AjaxResult.error("请选择工程");
|
||||
}
|
||||
if (StringUtils.isBlank(vo.getType())) {
|
||||
return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修");
|
||||
}
|
||||
String json=vo.getJsonData();
|
||||
if (StringUtils.isBlank(json)) {
|
||||
return AjaxResult.error("请选择变更的设备");
|
||||
}
|
||||
List<CsDeviceChangeDetailsVo> list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class);
|
||||
if(list==null || list.isEmpty()){
|
||||
return AjaxResult.error("请选择变更的设备");
|
||||
}
|
||||
|
||||
//出库
|
||||
if("2".equals(vo.getType())){
|
||||
String changeUnit=mapper.getChangeUnit(list.get(0).getDevId());
|
||||
vo.setChangeUnit(changeUnit);
|
||||
} else {
|
||||
//
|
||||
String changeUnit=mapper.getChangeUnitById(list.get(0).getDevId());
|
||||
vo.setChangeUnit(changeUnit);
|
||||
}
|
||||
if("1".equals(vo.getType())){
|
||||
//入库厂家
|
||||
String changeUnit=mapper.getChangeUnit(list.get(0).getDevId());
|
||||
vo.setUseUint(changeUnit);
|
||||
}
|
||||
//变更前状态查询
|
||||
String changeStatus=mapper.getChangeStatus(list.get(0).getDevId());
|
||||
vo.setChangeStatus(changeStatus);
|
||||
vo.setDevNum(list.size()+"");
|
||||
int num=mapper.addChangeInfo(vo);
|
||||
if(num>0){
|
||||
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){
|
||||
if("1".equals(vo.getStatus())){
|
||||
updateDevDetails(deviceChangeDetailsVo.getDevId(),null,"1",deviceChangeDetailsVo.getNum());
|
||||
|
||||
}else{
|
||||
updateDevDetails(deviceChangeDetailsVo.getDevId(),null,"5",deviceChangeDetailsVo.getNum());
|
||||
}
|
||||
//新增设备列表数据
|
||||
deviceChangeDetailsVo.setChangeId(vo.getId());
|
||||
//新增设备详情
|
||||
int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo);
|
||||
if(isSuccess>0){
|
||||
vo.setDevId(deviceChangeDetailsVo.getDevId());
|
||||
vo.setChangeStatus(vo.getStatus());
|
||||
vo.setUseUint(null);
|
||||
vo.setUserName(null);
|
||||
vo.setUserPhone(null);
|
||||
vo.setProCode(null);
|
||||
mapper.updateDevInfo(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 报废接口
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateDevChangeInfo3(CsDeviceChangeVo vo) {
|
||||
try{
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
vo.setCreateUser(username);
|
||||
if (StringUtils.isBlank(vo.getType())) {
|
||||
return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修");
|
||||
}
|
||||
String json=vo.getJsonData();
|
||||
if (StringUtils.isBlank(json)) {
|
||||
return AjaxResult.error("请选择变更的设备");
|
||||
}
|
||||
List<CsDeviceChangeDetailsVo> list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class);
|
||||
if(list==null || list.isEmpty()){
|
||||
return AjaxResult.error("请选择变更的设备");
|
||||
}
|
||||
//入库厂家
|
||||
String usUnit=mapper.getChangeUnit(list.get(0).getDevId());
|
||||
vo.setUseUint(usUnit);
|
||||
vo.setChangeUnit(usUnit);
|
||||
vo.setChangeStatus("1");
|
||||
vo.setDevNum(list.size()+"");
|
||||
String proId=vo.getProCode();
|
||||
int num=mapper.addChangeInfo(vo);
|
||||
if(num>0){
|
||||
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){
|
||||
updateDevDetails(deviceChangeDetailsVo.getDevId(),proId,"4",deviceChangeDetailsVo.getNum());
|
||||
//新增设备列表数据
|
||||
deviceChangeDetailsVo.setChangeId(vo.getId());
|
||||
deviceChangeDetailsVo.setReasonVal(vo.getReasonVal());
|
||||
deviceChangeDetailsVo.setReasonId(vo.getReasonId());
|
||||
//新增设备详情
|
||||
int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo);
|
||||
if(isSuccess>0){
|
||||
vo.setDevId(deviceChangeDetailsVo.getDevId());
|
||||
vo.setChangeStatus(vo.getStatus());
|
||||
vo.setUseUint(null);
|
||||
vo.setUserName(null);
|
||||
vo.setUserPhone(null);
|
||||
vo.setProCode(null);
|
||||
mapper.updateDevInfo(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 维修接口
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateDevChangeInfo2(CsDeviceChangeVo vo) {
|
||||
try{
|
||||
String username = SecurityUtils.getLoginUser().getUsername();
|
||||
vo.setCreateUser(username);
|
||||
if (StringUtils.isBlank(vo.getType())) {
|
||||
return AjaxResult.error("请上传类型type:1入库 2出库 3 退役 4 维修");
|
||||
}
|
||||
String json=vo.getJsonData();
|
||||
if (StringUtils.isBlank(json)) {
|
||||
return AjaxResult.error("请选择变更的设备");
|
||||
}
|
||||
List<CsDeviceChangeDetailsVo> list=JSON.parseArray(json, CsDeviceChangeDetailsVo.class);
|
||||
if(list==null || list.isEmpty()){
|
||||
return AjaxResult.error("请选择变更的设备");
|
||||
}
|
||||
//入库厂家
|
||||
String usUnit=mapper.getChangeUnit(list.get(0).getDevId());
|
||||
vo.setUseUint(usUnit);
|
||||
vo.setChangeUnit(usUnit);
|
||||
vo.setChangeStatus("5");
|
||||
vo.setDevNum(list.size()+"");
|
||||
String proId=vo.getProCode();
|
||||
int num=mapper.addChangeInfo(vo);
|
||||
if(num>0){
|
||||
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){
|
||||
if("1".equals(vo.getStatus())){
|
||||
updateDevDetails2(deviceChangeDetailsVo.getDevId(),proId,"1",deviceChangeDetailsVo.getNum());
|
||||
}else{
|
||||
updateDevDetails2(deviceChangeDetailsVo.getDevId(),proId,"4",deviceChangeDetailsVo.getNum());
|
||||
}
|
||||
//新增设备列表数据
|
||||
deviceChangeDetailsVo.setChangeId(vo.getId());
|
||||
//新增设备详情
|
||||
int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo);
|
||||
if(isSuccess>0){
|
||||
vo.setDevId(deviceChangeDetailsVo.getDevId());
|
||||
vo.setChangeStatus(vo.getStatus());
|
||||
vo.setUseUint(null);
|
||||
vo.setUserName(null);
|
||||
vo.setUserPhone(null);
|
||||
vo.setProCode(null);
|
||||
mapper.updateDevInfo(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备台账数据
|
||||
* @param vo
|
||||
|
|
@ -114,6 +296,8 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
for (CsDeviceChangeDetailsVo deviceChangeDetailsVo:list){
|
||||
//新增设备列表数据
|
||||
deviceChangeDetailsVo.setChangeId(vo.getId());
|
||||
//数据更新
|
||||
updateDevDetails(deviceChangeDetailsVo.getDevId(),vo.getProCode(),vo.getType(),deviceChangeDetailsVo.getNum());
|
||||
//新增设备详情
|
||||
int isSuccess= mapper.addDetailsInfo(deviceChangeDetailsVo);
|
||||
if(isSuccess>0){
|
||||
|
|
@ -138,6 +322,85 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
public void updateDevDetails2(String devId,String proCode,String type,int num){
|
||||
try{
|
||||
DevChangeDetailsVo vo=new DevChangeDetailsVo(devId,proCode,type,num);
|
||||
List<DevChangeDetailsVo> list=mapper.getDevChangeDetailsList(vo);
|
||||
DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"5",num);
|
||||
List<DevChangeDetailsVo> newList=mapper.getDevChangeDetailsList(devChangeDetailsVo);
|
||||
for (DevChangeDetailsVo voo:newList){
|
||||
if(voo.getNum()==num){
|
||||
mapper.deleteDevChangeDetails(voo);
|
||||
}else if(voo.getNum()>num){
|
||||
int newNum=voo.getNum()-num;
|
||||
vo.setNum(newNum);
|
||||
mapper.updateChangeDetailsNum(vo);
|
||||
}
|
||||
}
|
||||
//入库--报废
|
||||
if("4".equals(type) ){
|
||||
if(list==null || list.isEmpty()){
|
||||
mapper.addDevChangeDetails(vo);
|
||||
}else{
|
||||
for (DevChangeDetailsVo voo:list){
|
||||
int newNum=voo.getNum()+num;
|
||||
vo.setNum(newNum);
|
||||
mapper.updateChangeDetailsNum(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 修改设备 状态
|
||||
*/
|
||||
public void updateDevDetails(String devId,String proCode,String type,int num){
|
||||
try{
|
||||
DevChangeDetailsVo vo=new DevChangeDetailsVo(devId,proCode,type,num);
|
||||
List<DevChangeDetailsVo> list=mapper.getDevChangeDetailsList(vo);
|
||||
if( "1".equals(type) || "5".equals(type)){
|
||||
DevChangeDetailsVo devChangeDetailsVo=new DevChangeDetailsVo(devId,proCode,"2",num);
|
||||
List<DevChangeDetailsVo> newList=mapper.getDevChangeDetailsList(devChangeDetailsVo);
|
||||
for (DevChangeDetailsVo voo:newList){
|
||||
if(voo.getNum()==num){
|
||||
mapper.deleteDevChangeDetails(voo);
|
||||
}else if(voo.getNum()>num){
|
||||
int newNum=voo.getNum()-num;
|
||||
vo.setNum(newNum);
|
||||
mapper.updateChangeDetailsNum(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
//入库
|
||||
if("1".equals(type)){
|
||||
//查询 历史数据 进行删除
|
||||
for (DevChangeDetailsVo voo:list){
|
||||
if(voo.getNum()==num){
|
||||
mapper.deleteDevChangeDetails(voo);
|
||||
}else if(voo.getNum()>num){
|
||||
int newNum=voo.getNum()-num;
|
||||
vo.setNum(newNum);
|
||||
mapper.updateChangeDetailsNum(vo);
|
||||
}
|
||||
}
|
||||
} else if("2".equals(type) || "3".equals(type) || "4".equals(type) || "5".equals(type)){
|
||||
if(list==null || list.isEmpty()){
|
||||
mapper.addDevChangeDetails(vo);
|
||||
}else{
|
||||
for (DevChangeDetailsVo voo:list){
|
||||
int newNum=voo.getNum()+num;
|
||||
vo.setNum(newNum);
|
||||
mapper.updateChangeDetailsNum(vo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询工程下拉选
|
||||
|
|
@ -175,14 +438,14 @@ public class DevChangeServiceImpl implements DevChangeService {
|
|||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult getDevDetails(CsDeviceChangeDetailsVo vo) {
|
||||
public List<DevChangeVo> getDevDetails(CsDeviceChangeDetailsVo vo) {
|
||||
try{
|
||||
List<CsDeviceChangeDetailsVo> list=mapper.getDevDetails(vo);
|
||||
return AjaxResult.success(list);
|
||||
List<DevChangeVo> list=mapper.getDevDetails(vo);
|
||||
return list;
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return AjaxResult.success(new ArrayList<>());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -19,7 +19,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
)values (
|
||||
#{changeId},#{devId},#{useTime},#{reasonId},#{reasonVal},#{remark},#{repairman},#{repairTime},#{repairContent},0
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="addDevChangeDetails">
|
||||
insert into cs_device_detials(
|
||||
pro_id,dev_id, num, type, create_time, update_time)
|
||||
values (#{proId},#{devId},#{num},#{type},now(),now())
|
||||
</insert>
|
||||
<update id="updateJson">
|
||||
update ma_dev_info set json_data=#{jsonData} where ma_id=#{devId}
|
||||
|
|
@ -29,6 +34,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
change_status=#{changeStatus}
|
||||
where ma_id=#{devId}
|
||||
</update>
|
||||
<delete id="deleteDevChangeDetails">
|
||||
delete from cs_device_detials where id=#{id}
|
||||
</delete>
|
||||
<!--xiugao1-->
|
||||
<update id="updateChangeDetailsNum">
|
||||
update cs_device_detials set num=#{num} where id=#{id}
|
||||
</update>
|
||||
<select id="getMaxFeature" resultType="java.lang.Integer">
|
||||
select count(1) num
|
||||
from ma_dev_info_properties
|
||||
|
|
@ -43,11 +55,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
mt.devModel ,bci.company_name compName,bci.operate_address orgName,IFNULL(pro.pro_name,'-') proName,
|
||||
dev.on_project proId
|
||||
FROM ma_dev_info dev
|
||||
left join bm_company_info bci on bci.company_id=dev.own_co
|
||||
left join ma_type_view mt on mt.typeId=dev.type_id
|
||||
LEFT JOIN ma_dev_qc mdq on dev.ma_id=mdq.ma_id
|
||||
left join jj_sing_project pro on pro.pro_code=dev.on_project
|
||||
left join bm_company_info bci on bci.company_id=dev.own_co
|
||||
left join ma_type_view mt on mt.typeId=dev.type_id
|
||||
LEFT JOIN (SELECT max( next_check_time) next_check_time,ma_id from ma_dev_qc GROUP BY ma_id ) mdq on dev.ma_id=mdq.ma_id
|
||||
left join jj_sing_project pro on pro.pro_code=dev.on_project
|
||||
where is_active=1
|
||||
<if test="proId!=null and proId!=''">
|
||||
and dev.on_project=#{proId}
|
||||
</if>
|
||||
<if test="devName!=null and devName!=''">
|
||||
and dev.device_name like concat('%',#{devName},'%')
|
||||
</if>
|
||||
|
|
@ -55,10 +70,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
and mt.typeId=#{typeId}
|
||||
</if>
|
||||
<if test="status!=null and status!=''">
|
||||
<if test='status=="0"'>
|
||||
<if test='status=="2"'>
|
||||
and dev.change_status in(2,3)
|
||||
</if>
|
||||
<if test='status!="0"'>
|
||||
<if test='status!="2"'>
|
||||
AND dev.change_status=#{status}
|
||||
</if>
|
||||
</if>
|
||||
|
|
@ -81,11 +96,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
<select id="getDevChangeList" resultType="com.bonus.material.devchange.domain.CsDeviceChangeVo">
|
||||
select cds.id,cds.change_status changeStatus,cds.type,cds.status,cds.pro_code proCode,cds.pro_name proName,
|
||||
cds.pro_type proType,cds.dev_num devNum,cds.voltage_level voltageLevel,
|
||||
cds.use_unit useUint,cds.pro_province proProvince,cds.pro_city proCity,cds.pro_county proCounty,
|
||||
cds.pro_location proLocation,cds.create_time createTime,
|
||||
cds.create_user createUser,cds.del_flag,cds.user_name userName,cds.user_phone userPhone,
|
||||
cds.change_unit changeUnit
|
||||
cds.pro_type proType,cds.dev_num devNum,cds.voltage_level voltageLevel,
|
||||
cds.use_unit useUint,cds.pro_province proProvince,cds.pro_city proCity,cds.pro_county proCounty,
|
||||
cds.pro_location proLocation,cds.create_time createTime,
|
||||
cds.create_user createUser,cds.del_flag,cds.user_name userName,cds.user_phone userPhone,
|
||||
cds.change_unit changeUnit,
|
||||
CASE
|
||||
WHEN cds.change_status = 1 THEN '在库'
|
||||
WHEN cds.change_status = 2 THEN '再用'
|
||||
WHEN cds.change_status = 3 THEN '退役'
|
||||
WHEN cds.change_status = 4 THEN '维修'
|
||||
ELSE '未知'
|
||||
END
|
||||
AS changeStatusName
|
||||
, CASE
|
||||
WHEN cds.type = 1 THEN '入库'
|
||||
WHEN cds.type = 2 THEN '出库'
|
||||
WHEN cds.type = 3 THEN '退役'
|
||||
WHEN cds.type = 4 THEN '维修'
|
||||
ELSE '未知'
|
||||
END
|
||||
AS typeName
|
||||
from cs_device_change cds
|
||||
WHERE cds.del_flag=0
|
||||
<if test="keyWord!=null and keyWord!=''">
|
||||
|
|
@ -101,10 +132,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
cds.pro_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="status!=null and status!=''">
|
||||
and cds.type=#{status}
|
||||
<if test="type!=null and type!=''">
|
||||
and cds.type=#{type}
|
||||
</if>
|
||||
<if test="status!=null and status!=''">
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!='' ">
|
||||
and cds.create_time between #{startTime} and #{endTime}
|
||||
</if>
|
||||
</select>
|
||||
|
|
@ -121,8 +152,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from ma_dev_info
|
||||
where ma_id=#{devId}
|
||||
</select>
|
||||
<select id="getDevDetails" resultType="com.bonus.material.devchange.domain.CsDeviceChangeDetailsVo">
|
||||
select dev.ma_id devId,dev.device_name devName,dev.code devCode,dev.json_data,DATE(dev.production_date ) productDate ,dev.buy_price buyPrice ,dev.brand ,
|
||||
<select id="getDevDetails" resultType="com.bonus.material.devchange.domain.DevChangeVo">
|
||||
select dev.ma_id devId,dev.device_name devName,dev.code devCode,dev.json_data,DATE(dev.production_date ) productDate ,dev.buy_price buyPrice ,dev.brand ,
|
||||
mdq.next_check_time nextDate,mt.typeId, mt.unit_name unit,mt.maintenance_alarm_day ,
|
||||
mt.lease_price,mt.proType,mt.level,mt.mainGx,mt.childGx,mt.devCategory ,mt.devSubcategory ,mt.devName,
|
||||
mt.devModel ,bci.company_name compName,bci.operate_address orgName,IFNULL(pro.pro_name,'-') proName,
|
||||
|
|
@ -131,7 +162,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join ma_dev_info dev on dcd.dev_id=dev.ma_id
|
||||
left join bm_company_info bci on bci.company_id=dev.own_co
|
||||
left join ma_type_view mt on mt.typeId=dev.type_id
|
||||
LEFT JOIN ma_dev_qc mdq on dev.ma_id=mdq.ma_id
|
||||
LEFT JOIN
|
||||
(SELECT max( next_check_time) next_check_time,ma_id
|
||||
from ma_dev_qc
|
||||
GROUP BY ma_id
|
||||
) mdq on dev.ma_id=mdq.ma_id
|
||||
left join jj_sing_project pro on pro.pro_code=dev.on_project
|
||||
where is_active=1 and dcd.change_id=#{id}
|
||||
</select>
|
||||
|
|
@ -139,5 +174,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select distinct voltage
|
||||
from jj_sing_project
|
||||
|
||||
</select>
|
||||
<select id="getDevChangeDetailsList" resultType="com.bonus.material.devchange.domain.DevChangeDetailsVo">
|
||||
select id,
|
||||
pro_id proId,
|
||||
dev_id devId,
|
||||
num ,
|
||||
type,
|
||||
create_time,
|
||||
update_time
|
||||
from cs_device_detials
|
||||
where dev_id=#{devId} and type=#{type}
|
||||
<if test="proId!=null and proId!=''">
|
||||
pro_id=#{proId}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue