|
|
|
package com.glxp.api.controller.inv;
|
|
|
|
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.constant.Constant;
|
|
|
|
import com.glxp.api.constant.DeviceStatus;
|
|
|
|
import com.glxp.api.entity.inv.DeviceInspectTaskDetailEntity;
|
|
|
|
import com.glxp.api.entity.inv.DeviceInspectTaskEntity;
|
|
|
|
import com.glxp.api.req.inv.FilterDeviceInspectTakeRequest;
|
|
|
|
import com.glxp.api.res.inv.DeviceInspectTakeResponse;
|
|
|
|
import com.glxp.api.service.inv.DeviceInspectTaskDetailService;
|
|
|
|
import com.glxp.api.service.inv.DeviceInspectTaskService;
|
|
|
|
import com.glxp.api.util.GennerOrderUtils;
|
|
|
|
import com.glxp.api.util.OrderNoTypeBean;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 设备巡检任务接口
|
|
|
|
*/
|
|
|
|
@Slf4j
|
|
|
|
@RestController
|
|
|
|
public class DeviceInspectTakeController {
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
DeviceInspectTaskService deviceInspectTaskService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
DeviceInspectTaskDetailService deviceInspectTaskDetailService;
|
|
|
|
@Resource
|
|
|
|
private GennerOrderUtils gennerOrderUtils;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 查询设设备巡检任务接口
|
|
|
|
*
|
|
|
|
* @param filterDeviceInspectTakeRequest
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
@GetMapping("/udiwms/inv/device/inspect/take/filter")
|
|
|
|
public BaseResponse filterList(FilterDeviceInspectTakeRequest filterDeviceInspectTakeRequest) {
|
|
|
|
List<DeviceInspectTakeResponse> list = deviceInspectTaskService.filterList(filterDeviceInspectTakeRequest);
|
|
|
|
PageInfo<DeviceInspectTakeResponse> pageInfo = new PageInfo<>(list);
|
|
|
|
return ResultVOUtils.page(pageInfo);
|
|
|
|
}
|
|
|
|
@PostMapping("/udiwms/inv/device/inspect/take/uploadDeviceInspecTake")
|
|
|
|
public BaseResponse uploadDeviceInspecTake(@RequestBody DeviceInspectTaskEntity deviceInspectTaskEntity) {
|
|
|
|
deviceInspectTaskEntity.setUpdateTime(new Date());
|
|
|
|
if(deviceInspectTaskEntity.getStatus() == DeviceStatus.DEVICE_STATUS_TEMP_DURINGINSPECTTION){
|
|
|
|
deviceInspectTaskEntity.setStrartTime(new Date());
|
|
|
|
}else if (deviceInspectTaskEntity.getStatus() == DeviceStatus.DEVICE_STATUS_TEMP_INSPECTED){
|
|
|
|
deviceInspectTaskEntity.setEndTime(new Date());
|
|
|
|
}
|
|
|
|
boolean falg=deviceInspectTaskService.updateById(deviceInspectTaskEntity);
|
|
|
|
if(!falg){
|
|
|
|
return ResultVOUtils.error(999,"更新失败");
|
|
|
|
}
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inv/device/inspect/take/uploadDeviceTake")
|
|
|
|
public BaseResponse uploadDeviceTake(@RequestBody DeviceInspectTaskEntity deviceInspectTaskEntity) {
|
|
|
|
deviceInspectTaskEntity.setUpdateTime(new Date());
|
|
|
|
boolean falg=deviceInspectTaskService.updateById(deviceInspectTaskEntity);
|
|
|
|
if(!falg){
|
|
|
|
return ResultVOUtils.error(999,"更新失败");
|
|
|
|
}
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inv/device/inspect/take/addDeviceInspecTake")
|
|
|
|
public BaseResponse addDeviceInspecTake(@RequestBody DeviceInspectTaskEntity deviceInspectTaskEntity) {
|
|
|
|
String orderId = gennerOrderUtils.createStOrderNo(new OrderNoTypeBean(Constant.DEVICE_INSPECT_PLAN_ORDER, "yyyyMMdd"));
|
|
|
|
deviceInspectTaskEntity.setOrderId(orderId);
|
|
|
|
deviceInspectTaskEntity.setCreateTime(new Date());
|
|
|
|
deviceInspectTaskService.addDeviceInspectTask(deviceInspectTaskEntity);
|
|
|
|
return ResultVOUtils.success(deviceInspectTaskEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inv/device/inspect/take/delectDeviceInspecTake")
|
|
|
|
public BaseResponse delectDeviceInspecTake(@RequestBody DeviceInspectTaskEntity deviceInspectTaskEntity) {
|
|
|
|
|
|
|
|
deviceInspectTaskService.delectDeviceInspectTask(deviceInspectTaskEntity);
|
|
|
|
return ResultVOUtils.success(deviceInspectTaskEntity);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------ 详情方法--------------------------------------------------------------//
|
|
|
|
@GetMapping("/udiwms/inv/device/inspect/take/detail/selectDeviceInspecTakeDetail")
|
|
|
|
public BaseResponse selectDeviceInspecTakeDetail(DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
|
|
|
|
List<DeviceInspectTaskDetailEntity> deviceInspectPlanDelectEntityList = deviceInspectTaskDetailService.selectDeviceInspectTakeDetail(deviceInspectTaskDetailEntity);
|
|
|
|
return ResultVOUtils.success(deviceInspectPlanDelectEntityList);
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inv/device/inspect/take/detail/uploadDeviceInspecTakeDetail")
|
|
|
|
public BaseResponse uploadDeviceInspecTakeDetail(@RequestBody DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
|
|
|
|
deviceInspectTaskDetailEntity.setUpdateTime(new Date());
|
|
|
|
boolean falg=deviceInspectTaskDetailService.uploadDeviceInspecTakeDetail(deviceInspectTaskDetailEntity);
|
|
|
|
if(!falg){
|
|
|
|
return ResultVOUtils.error(999,"更新失败");
|
|
|
|
}
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/udiwms/inv/device/inspect/take/detail/addDeviceInspecTakeDetail")
|
|
|
|
public BaseResponse addDeviceInspecTakeDetail(@RequestBody DeviceInspectTaskDetailEntity deviceInspectTaskDetailEntity) {
|
|
|
|
|
|
|
|
boolean falg=deviceInspectTaskDetailService.addDeviceInspectTaskDelect(deviceInspectTaskDetailEntity);
|
|
|
|
if(!falg){
|
|
|
|
return ResultVOUtils.error(999,"更新失败");
|
|
|
|
}
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|