测量点配置
This commit is contained in:
@ -147,5 +147,5 @@ influxdb:
|
|||||||
bucket: mes
|
bucket: mes
|
||||||
token: -okZX8Re-PY3tEPV1_e7w-u9bvZlGnoMwpIEKjTQnpaZ3GyVJM9U72WLb5hNAQIDlCNU0NlfgoFQA__mhyUAxw==
|
token: -okZX8Re-PY3tEPV1_e7w-u9bvZlGnoMwpIEKjTQnpaZ3GyVJM9U72WLb5hNAQIDlCNU0NlfgoFQA__mhyUAxw==
|
||||||
measurement: device_point
|
measurement: device_point
|
||||||
|
display-zone: Asia/Shanghai
|
||||||
timeout-millis: 10000
|
timeout-millis: 10000
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,42 @@
|
|||||||
|
package com.ktg.mes.board.controller;
|
||||||
|
|
||||||
|
import com.ktg.common.core.controller.BaseController;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
import com.ktg.mes.board.domain.BoardPointBinding;
|
||||||
|
import com.ktg.mes.board.service.IBoardPointBindingService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
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.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/board/binding")
|
||||||
|
public class BoardPointBindingController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IBoardPointBindingService boardPointBindingService;
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BoardPointBinding boardPointBinding) {
|
||||||
|
startPage();
|
||||||
|
List<BoardPointBinding> list = boardPointBindingService.selectBoardPointBindingList(boardPointBinding);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/config")
|
||||||
|
public AjaxResult config(@RequestParam(value = "screenCode", required = false) String screenCode) {
|
||||||
|
return AjaxResult.success(boardPointBindingService.selectByScreenCode(screenCode));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/config")
|
||||||
|
public AjaxResult save(@RequestParam(value = "screenCode", required = false) String screenCode,
|
||||||
|
@RequestBody List<BoardPointBinding> bindings) {
|
||||||
|
boardPointBindingService.saveByScreenCode(screenCode, bindings, getUsername());
|
||||||
|
return AjaxResult.success(boardPointBindingService.selectByScreenCode(screenCode));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,93 @@
|
|||||||
|
package com.ktg.mes.board.controller;
|
||||||
|
|
||||||
|
import com.ktg.common.annotation.Log;
|
||||||
|
import com.ktg.common.core.controller.BaseController;
|
||||||
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
import com.ktg.common.enums.BusinessType;
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
|
import com.ktg.mes.board.domain.vo.BoardScreenConfigVo;
|
||||||
|
import com.ktg.mes.board.service.IBoardPointBindingService;
|
||||||
|
import com.ktg.mes.board.service.IBoardScreenInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/mes/board/screen")
|
||||||
|
public class BoardScreenInfoController extends BaseController {
|
||||||
|
@Autowired
|
||||||
|
private IBoardScreenInfoService boardScreenInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IBoardPointBindingService boardPointBindingService;
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(BoardScreenInfo boardScreenInfo) {
|
||||||
|
startPage();
|
||||||
|
List<BoardScreenInfo> list = boardScreenInfoService.selectBoardScreenInfoList(boardScreenInfo);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:query')")
|
||||||
|
@GetMapping("/{screenId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("screenId") Long screenId) {
|
||||||
|
return AjaxResult.success(boardScreenInfoService.selectBoardScreenInfoByScreenId(screenId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:add')")
|
||||||
|
@Log(title = "看板信息", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody BoardScreenInfo boardScreenInfo) {
|
||||||
|
boardScreenInfo.setCreateBy(getUsername());
|
||||||
|
return toAjax(boardScreenInfoService.insertBoardScreenInfo(boardScreenInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:edit')")
|
||||||
|
@Log(title = "看板信息", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody BoardScreenInfo boardScreenInfo) {
|
||||||
|
boardScreenInfo.setUpdateBy(getUsername());
|
||||||
|
return toAjax(boardScreenInfoService.updateBoardScreenInfo(boardScreenInfo));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:remove')")
|
||||||
|
@Log(title = "看板信息", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{screenIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] screenIds) {
|
||||||
|
return toAjax(boardScreenInfoService.deleteBoardScreenInfoByScreenIds(screenIds));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:query')")
|
||||||
|
@GetMapping("/config")
|
||||||
|
public AjaxResult getConfig(@RequestParam("screenId") Long screenId) {
|
||||||
|
return AjaxResult.success(boardPointBindingService.selectByScreenId(screenId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:edit')")
|
||||||
|
@Log(title = "看板绑定配置", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/config")
|
||||||
|
public AjaxResult saveConfig(@RequestBody BoardScreenConfigVo configVo) {
|
||||||
|
boardPointBindingService.saveByScreenId(configVo.getScreenId(), configVo.getBindings(), getUsername());
|
||||||
|
return AjaxResult.success("保存成功", boardPointBindingService.selectByScreenId(configVo.getScreenId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:screenbinding:remove')")
|
||||||
|
@Log(title = "看板绑定配置", businessType = BusinessType.CLEAN)
|
||||||
|
@DeleteMapping("/config")
|
||||||
|
public AjaxResult resetConfig(@RequestParam("screenId") Long screenId) {
|
||||||
|
boardPointBindingService.deleteByScreenId(screenId);
|
||||||
|
return AjaxResult.success("已清空绑定配置");
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.ktg.mes.board.controller;
|
|||||||
|
|
||||||
import com.ktg.common.core.domain.AjaxResult;
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.mes.board.service.IWorkshopBoardService;
|
import com.ktg.mes.board.service.IWorkshopBoardService;
|
||||||
|
import com.ktg.mes.board.task.BoardQuartzTask;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
@ -14,8 +15,12 @@ public class WorkshopBoardController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IWorkshopBoardService workshopBoardService;
|
private IWorkshopBoardService workshopBoardService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardQuartzTask boardQuartzTask;
|
||||||
|
|
||||||
@GetMapping("/data")
|
@GetMapping("/data")
|
||||||
public AjaxResult data(@RequestParam(value = "screenCode", required = false) String screenCode) {
|
public AjaxResult data(@RequestParam(value = "screenCode", required = false) String screenCode) {
|
||||||
|
boardQuartzTask.syncByScreenCode(screenCode);
|
||||||
return AjaxResult.success(workshopBoardService.getBoardData(screenCode));
|
return AjaxResult.success(workshopBoardService.getBoardData(screenCode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,130 @@
|
|||||||
|
package com.ktg.mes.board.domain;
|
||||||
|
|
||||||
|
public class BoardMachineCard {
|
||||||
|
private Long id;
|
||||||
|
private String name;
|
||||||
|
private String model;
|
||||||
|
private String rawStatus;
|
||||||
|
private String rawMode;
|
||||||
|
private String runtime;
|
||||||
|
private String output;
|
||||||
|
private String progress;
|
||||||
|
private String workDate;
|
||||||
|
private String batchNo;
|
||||||
|
private String planQty;
|
||||||
|
private String productModel;
|
||||||
|
private String color;
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getModel() {
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModel(String model) {
|
||||||
|
this.model = model;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRawStatus() {
|
||||||
|
return rawStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRawStatus(String rawStatus) {
|
||||||
|
this.rawStatus = rawStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRawMode() {
|
||||||
|
return rawMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRawMode(String rawMode) {
|
||||||
|
this.rawMode = rawMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRuntime() {
|
||||||
|
return runtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuntime(String runtime) {
|
||||||
|
this.runtime = runtime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOutput() {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutput(String output) {
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProgress() {
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgress(String progress) {
|
||||||
|
this.progress = progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkDate() {
|
||||||
|
return workDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkDate(String workDate) {
|
||||||
|
this.workDate = workDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBatchNo() {
|
||||||
|
return batchNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatchNo(String batchNo) {
|
||||||
|
this.batchNo = batchNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPlanQty() {
|
||||||
|
return planQty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlanQty(String planQty) {
|
||||||
|
this.planQty = planQty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getProductModel() {
|
||||||
|
return productModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProductModel(String productModel) {
|
||||||
|
this.productModel = productModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getColor() {
|
||||||
|
return color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColor(String color) {
|
||||||
|
this.color = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRemark() {
|
||||||
|
return remark;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRemark(String remark) {
|
||||||
|
this.remark = remark;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,162 @@
|
|||||||
|
package com.ktg.mes.board.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class BoardOrderProgress extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long progressId;
|
||||||
|
|
||||||
|
private Long screenId;
|
||||||
|
|
||||||
|
private String screenCode;
|
||||||
|
|
||||||
|
private Long machineryId;
|
||||||
|
|
||||||
|
private String machineryCode;
|
||||||
|
|
||||||
|
private String machineryName;
|
||||||
|
|
||||||
|
private String machineryModel;
|
||||||
|
|
||||||
|
private String deviceStatus;
|
||||||
|
|
||||||
|
private String runMode;
|
||||||
|
|
||||||
|
private String todayRunTime;
|
||||||
|
|
||||||
|
private String todayPieceCount;
|
||||||
|
|
||||||
|
private String taskProgress;
|
||||||
|
|
||||||
|
private String batchCode;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date collectTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date refreshTime;
|
||||||
|
|
||||||
|
public Long getProgressId() {
|
||||||
|
return progressId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProgressId(Long progressId) {
|
||||||
|
this.progressId = progressId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getScreenId() {
|
||||||
|
return screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenId(Long screenId) {
|
||||||
|
this.screenId = screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScreenCode() {
|
||||||
|
return screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenCode(String screenCode) {
|
||||||
|
this.screenCode = screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMachineryId() {
|
||||||
|
return machineryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryId(Long machineryId) {
|
||||||
|
this.machineryId = machineryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMachineryCode() {
|
||||||
|
return machineryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryCode(String machineryCode) {
|
||||||
|
this.machineryCode = machineryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMachineryName() {
|
||||||
|
return machineryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryName(String machineryName) {
|
||||||
|
this.machineryName = machineryName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMachineryModel() {
|
||||||
|
return machineryModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryModel(String machineryModel) {
|
||||||
|
this.machineryModel = machineryModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceStatus() {
|
||||||
|
return deviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceStatus(String deviceStatus) {
|
||||||
|
this.deviceStatus = deviceStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRunMode() {
|
||||||
|
return runMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRunMode(String runMode) {
|
||||||
|
this.runMode = runMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTodayRunTime() {
|
||||||
|
return todayRunTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTodayRunTime(String todayRunTime) {
|
||||||
|
this.todayRunTime = todayRunTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTodayPieceCount() {
|
||||||
|
return todayPieceCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTodayPieceCount(String todayPieceCount) {
|
||||||
|
this.todayPieceCount = todayPieceCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTaskProgress() {
|
||||||
|
return taskProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTaskProgress(String taskProgress) {
|
||||||
|
this.taskProgress = taskProgress;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBatchCode() {
|
||||||
|
return batchCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBatchCode(String batchCode) {
|
||||||
|
this.batchCode = batchCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCollectTime() {
|
||||||
|
return collectTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCollectTime(Date collectTime) {
|
||||||
|
this.collectTime = collectTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getRefreshTime() {
|
||||||
|
return refreshTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRefreshTime(Date refreshTime) {
|
||||||
|
this.refreshTime = refreshTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
package com.ktg.mes.board.domain;
|
||||||
|
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
public class BoardPointBinding extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long bindingId;
|
||||||
|
|
||||||
|
private Long screenId;
|
||||||
|
|
||||||
|
private String screenCode;
|
||||||
|
|
||||||
|
private Long machineryId;
|
||||||
|
|
||||||
|
private String machineryCode;
|
||||||
|
|
||||||
|
private String bindingField;
|
||||||
|
|
||||||
|
private Long pointId;
|
||||||
|
|
||||||
|
private String pointCode;
|
||||||
|
|
||||||
|
private String pointName;
|
||||||
|
|
||||||
|
private Integer sortNum;
|
||||||
|
|
||||||
|
private String enableFlag;
|
||||||
|
|
||||||
|
public Long getBindingId() {
|
||||||
|
return bindingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBindingId(Long bindingId) {
|
||||||
|
this.bindingId = bindingId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getScreenId() {
|
||||||
|
return screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenId(Long screenId) {
|
||||||
|
this.screenId = screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScreenCode() {
|
||||||
|
return screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenCode(String screenCode) {
|
||||||
|
this.screenCode = screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getMachineryId() {
|
||||||
|
return machineryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryId(Long machineryId) {
|
||||||
|
this.machineryId = machineryId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMachineryCode() {
|
||||||
|
return machineryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryCode(String machineryCode) {
|
||||||
|
this.machineryCode = machineryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBindingField() {
|
||||||
|
return bindingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBindingField(String bindingField) {
|
||||||
|
this.bindingField = bindingField;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getPointId() {
|
||||||
|
return pointId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPointId(Long pointId) {
|
||||||
|
this.pointId = pointId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPointCode() {
|
||||||
|
return pointCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPointCode(String pointCode) {
|
||||||
|
this.pointCode = pointCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPointName() {
|
||||||
|
return pointName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPointName(String pointName) {
|
||||||
|
this.pointName = pointName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSortNum() {
|
||||||
|
return sortNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSortNum(Integer sortNum) {
|
||||||
|
this.sortNum = sortNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnableFlag() {
|
||||||
|
return enableFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnableFlag(String enableFlag) {
|
||||||
|
this.enableFlag = enableFlag;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,132 @@
|
|||||||
|
package com.ktg.mes.board.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ktg.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class BoardScreenInfo extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Long screenId;
|
||||||
|
|
||||||
|
private String screenCode;
|
||||||
|
|
||||||
|
private String ownerName;
|
||||||
|
|
||||||
|
private Long workshopId;
|
||||||
|
|
||||||
|
private String workshopCode;
|
||||||
|
|
||||||
|
private String workshopName;
|
||||||
|
|
||||||
|
private Integer deviceTotal;
|
||||||
|
|
||||||
|
private Integer onlineCount;
|
||||||
|
|
||||||
|
private Integer runningCount;
|
||||||
|
|
||||||
|
private Integer stopCount;
|
||||||
|
|
||||||
|
private BigDecimal startRate;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date latestRefreshTime;
|
||||||
|
|
||||||
|
public Long getScreenId() {
|
||||||
|
return screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenId(Long screenId) {
|
||||||
|
this.screenId = screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScreenCode() {
|
||||||
|
return screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenCode(String screenCode) {
|
||||||
|
this.screenCode = screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOwnerName() {
|
||||||
|
return ownerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOwnerName(String ownerName) {
|
||||||
|
this.ownerName = ownerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getWorkshopId() {
|
||||||
|
return workshopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkshopId(Long workshopId) {
|
||||||
|
this.workshopId = workshopId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkshopCode() {
|
||||||
|
return workshopCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkshopCode(String workshopCode) {
|
||||||
|
this.workshopCode = workshopCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWorkshopName() {
|
||||||
|
return workshopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkshopName(String workshopName) {
|
||||||
|
this.workshopName = workshopName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getDeviceTotal() {
|
||||||
|
return deviceTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceTotal(Integer deviceTotal) {
|
||||||
|
this.deviceTotal = deviceTotal;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getOnlineCount() {
|
||||||
|
return onlineCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOnlineCount(Integer onlineCount) {
|
||||||
|
this.onlineCount = onlineCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getRunningCount() {
|
||||||
|
return runningCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRunningCount(Integer runningCount) {
|
||||||
|
this.runningCount = runningCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getStopCount() {
|
||||||
|
return stopCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStopCount(Integer stopCount) {
|
||||||
|
this.stopCount = stopCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getStartRate() {
|
||||||
|
return startRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStartRate(BigDecimal startRate) {
|
||||||
|
this.startRate = startRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getLatestRefreshTime() {
|
||||||
|
return latestRefreshTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLatestRefreshTime(Date latestRefreshTime) {
|
||||||
|
this.latestRefreshTime = latestRefreshTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package com.ktg.mes.board.domain.vo;
|
||||||
|
|
||||||
|
import com.ktg.mes.board.domain.BoardPointBinding;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class BoardScreenConfigVo {
|
||||||
|
private Long screenId;
|
||||||
|
|
||||||
|
private String screenCode;
|
||||||
|
|
||||||
|
private List<BoardPointBinding> bindings;
|
||||||
|
|
||||||
|
public Long getScreenId() {
|
||||||
|
return screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenId(Long screenId) {
|
||||||
|
this.screenId = screenId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getScreenCode() {
|
||||||
|
return screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScreenCode(String screenCode) {
|
||||||
|
this.screenCode = screenCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BoardPointBinding> getBindings() {
|
||||||
|
return bindings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBindings(List<BoardPointBinding> bindings) {
|
||||||
|
this.bindings = bindings;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.ktg.mes.board.mapper;
|
||||||
|
|
||||||
|
import com.ktg.mes.board.domain.BoardMachineCard;
|
||||||
|
import com.ktg.mes.board.domain.BoardOrderProgress;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BoardOrderProgressMapper {
|
||||||
|
BoardOrderProgress selectByScreenIdAndMachineryCode(@Param("screenId") Long screenId, @Param("machineryCode") String machineryCode);
|
||||||
|
|
||||||
|
BoardOrderProgress selectByScreenCodeAndMachineryCode(@Param("screenCode") String screenCode, @Param("machineryCode") String machineryCode);
|
||||||
|
|
||||||
|
List<BoardOrderProgress> selectByScreenId(Long screenId);
|
||||||
|
|
||||||
|
List<BoardOrderProgress> selectByScreenCode(String screenCode);
|
||||||
|
|
||||||
|
List<BoardMachineCard> selectMachineCardListByScreenId(Long screenId);
|
||||||
|
|
||||||
|
List<BoardMachineCard> selectMachineCardList(String screenCode);
|
||||||
|
|
||||||
|
int insert(BoardOrderProgress boardOrderProgress);
|
||||||
|
|
||||||
|
int update(BoardOrderProgress boardOrderProgress);
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.ktg.mes.board.mapper;
|
||||||
|
|
||||||
|
import com.ktg.mes.board.domain.BoardPointBinding;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BoardPointBindingMapper {
|
||||||
|
List<BoardPointBinding> selectBoardPointBindingList(BoardPointBinding boardPointBinding);
|
||||||
|
|
||||||
|
List<BoardPointBinding> selectByScreenId(Long screenId);
|
||||||
|
|
||||||
|
List<BoardPointBinding> selectByScreenCode(String screenCode);
|
||||||
|
|
||||||
|
int insertBoardPointBinding(BoardPointBinding boardPointBinding);
|
||||||
|
|
||||||
|
int updateBoardPointBinding(BoardPointBinding boardPointBinding);
|
||||||
|
|
||||||
|
int deleteBoardPointBindingByBindingIds(Long[] bindingIds);
|
||||||
|
|
||||||
|
int deleteByScreenId(Long screenId);
|
||||||
|
|
||||||
|
int deleteByScreenCode(String screenCode);
|
||||||
|
|
||||||
|
int batchInsertBoardPointBinding(List<BoardPointBinding> list);
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.ktg.mes.board.mapper;
|
||||||
|
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface BoardScreenInfoMapper {
|
||||||
|
BoardScreenInfo selectByScreenId(Long screenId);
|
||||||
|
|
||||||
|
BoardScreenInfo selectByScreenCode(String screenCode);
|
||||||
|
|
||||||
|
List<BoardScreenInfo> selectBoardScreenInfoList(BoardScreenInfo boardScreenInfo);
|
||||||
|
|
||||||
|
int insert(BoardScreenInfo boardScreenInfo);
|
||||||
|
|
||||||
|
int update(BoardScreenInfo boardScreenInfo);
|
||||||
|
|
||||||
|
int deleteByScreenIds(Long[] screenIds);
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.ktg.mes.board.service;
|
||||||
|
|
||||||
|
import com.ktg.mes.board.domain.BoardPointBinding;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IBoardPointBindingService {
|
||||||
|
List<BoardPointBinding> selectBoardPointBindingList(BoardPointBinding boardPointBinding);
|
||||||
|
|
||||||
|
List<BoardPointBinding> selectByScreenId(Long screenId);
|
||||||
|
|
||||||
|
List<BoardPointBinding> selectByScreenCode(String screenCode);
|
||||||
|
|
||||||
|
int saveByScreenId(Long screenId, List<BoardPointBinding> bindings, String operName);
|
||||||
|
|
||||||
|
int saveByScreenCode(String screenCode, List<BoardPointBinding> bindings, String operName);
|
||||||
|
|
||||||
|
int deleteByScreenId(Long screenId);
|
||||||
|
}
|
||||||
@ -0,0 +1,19 @@
|
|||||||
|
package com.ktg.mes.board.service;
|
||||||
|
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IBoardScreenInfoService {
|
||||||
|
BoardScreenInfo selectBoardScreenInfoByScreenId(Long screenId);
|
||||||
|
|
||||||
|
BoardScreenInfo selectBoardScreenInfoByScreenCode(String screenCode);
|
||||||
|
|
||||||
|
List<BoardScreenInfo> selectBoardScreenInfoList(BoardScreenInfo boardScreenInfo);
|
||||||
|
|
||||||
|
int insertBoardScreenInfo(BoardScreenInfo boardScreenInfo);
|
||||||
|
|
||||||
|
int updateBoardScreenInfo(BoardScreenInfo boardScreenInfo);
|
||||||
|
|
||||||
|
int deleteBoardScreenInfoByScreenIds(Long[] screenIds);
|
||||||
|
}
|
||||||
@ -0,0 +1,90 @@
|
|||||||
|
package com.ktg.mes.board.service.impl;
|
||||||
|
|
||||||
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.mes.board.domain.BoardPointBinding;
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
|
import com.ktg.mes.board.mapper.BoardPointBindingMapper;
|
||||||
|
import com.ktg.mes.board.mapper.BoardScreenInfoMapper;
|
||||||
|
import com.ktg.mes.board.service.IBoardPointBindingService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BoardPointBindingServiceImpl implements IBoardPointBindingService {
|
||||||
|
@Autowired
|
||||||
|
private BoardPointBindingMapper boardPointBindingMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardScreenInfoMapper boardScreenInfoMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BoardPointBinding> selectBoardPointBindingList(BoardPointBinding boardPointBinding) {
|
||||||
|
return boardPointBindingMapper.selectBoardPointBindingList(boardPointBinding);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BoardPointBinding> selectByScreenId(Long screenId) {
|
||||||
|
return boardPointBindingMapper.selectByScreenId(screenId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BoardPointBinding> selectByScreenCode(String screenCode) {
|
||||||
|
return boardPointBindingMapper.selectByScreenCode(screenCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int saveByScreenId(Long screenId, List<BoardPointBinding> bindings, String operName) {
|
||||||
|
if (screenId == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
BoardScreenInfo screenInfo = boardScreenInfoMapper.selectByScreenId(screenId);
|
||||||
|
if (screenInfo == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
boardPointBindingMapper.deleteByScreenId(screenId);
|
||||||
|
if (bindings == null || bindings.isEmpty()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
List<BoardPointBinding> rows = new ArrayList<BoardPointBinding>();
|
||||||
|
int sortNum = 1;
|
||||||
|
for (BoardPointBinding binding : bindings) {
|
||||||
|
if (binding == null || StringUtils.isBlank(binding.getBindingField()) || StringUtils.isBlank(binding.getMachineryCode())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
binding.setBindingId(null);
|
||||||
|
binding.setScreenId(screenId);
|
||||||
|
binding.setScreenCode(screenInfo.getScreenCode());
|
||||||
|
binding.setSortNum(binding.getSortNum() == null ? sortNum++ : binding.getSortNum());
|
||||||
|
binding.setEnableFlag(StringUtils.isBlank(binding.getEnableFlag()) ? "Y" : binding.getEnableFlag());
|
||||||
|
binding.setCreateBy(operName);
|
||||||
|
binding.setCreateTime(DateUtils.getNowDate());
|
||||||
|
rows.add(binding);
|
||||||
|
}
|
||||||
|
if (rows.isEmpty()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return boardPointBindingMapper.batchInsertBoardPointBinding(rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int saveByScreenCode(String screenCode, List<BoardPointBinding> bindings, String operName) {
|
||||||
|
String actualScreenCode = StringUtils.isBlank(screenCode) ? "WORKSHOP_BOARD_DEFAULT" : screenCode.trim();
|
||||||
|
BoardScreenInfo screenInfo = boardScreenInfoMapper.selectByScreenCode(actualScreenCode);
|
||||||
|
if (screenInfo == null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return saveByScreenId(screenInfo.getScreenId(), bindings, operName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int deleteByScreenId(Long screenId) {
|
||||||
|
return boardPointBindingMapper.deleteByScreenId(screenId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,76 @@
|
|||||||
|
package com.ktg.mes.board.service.impl;
|
||||||
|
|
||||||
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
|
import com.ktg.mes.board.mapper.BoardPointBindingMapper;
|
||||||
|
import com.ktg.mes.board.mapper.BoardScreenInfoMapper;
|
||||||
|
import com.ktg.mes.board.service.IBoardScreenInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class BoardScreenInfoServiceImpl implements IBoardScreenInfoService {
|
||||||
|
@Autowired
|
||||||
|
private BoardScreenInfoMapper boardScreenInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardPointBindingMapper boardPointBindingMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoardScreenInfo selectBoardScreenInfoByScreenId(Long screenId) {
|
||||||
|
return boardScreenInfoMapper.selectByScreenId(screenId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoardScreenInfo selectBoardScreenInfoByScreenCode(String screenCode) {
|
||||||
|
return boardScreenInfoMapper.selectByScreenCode(screenCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BoardScreenInfo> selectBoardScreenInfoList(BoardScreenInfo boardScreenInfo) {
|
||||||
|
return boardScreenInfoMapper.selectBoardScreenInfoList(boardScreenInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertBoardScreenInfo(BoardScreenInfo boardScreenInfo) {
|
||||||
|
boardScreenInfo.setCreateTime(DateUtils.getNowDate());
|
||||||
|
if (boardScreenInfo.getDeviceTotal() == null) {
|
||||||
|
boardScreenInfo.setDeviceTotal(0);
|
||||||
|
}
|
||||||
|
if (boardScreenInfo.getOnlineCount() == null) {
|
||||||
|
boardScreenInfo.setOnlineCount(0);
|
||||||
|
}
|
||||||
|
if (boardScreenInfo.getRunningCount() == null) {
|
||||||
|
boardScreenInfo.setRunningCount(0);
|
||||||
|
}
|
||||||
|
if (boardScreenInfo.getStopCount() == null) {
|
||||||
|
boardScreenInfo.setStopCount(0);
|
||||||
|
}
|
||||||
|
return boardScreenInfoMapper.insert(boardScreenInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int updateBoardScreenInfo(BoardScreenInfo boardScreenInfo) {
|
||||||
|
boardScreenInfo.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return boardScreenInfoMapper.update(boardScreenInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public int deleteBoardScreenInfoByScreenIds(Long[] screenIds) {
|
||||||
|
if (screenIds == null || screenIds.length == 0) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
for (Long screenId : screenIds) {
|
||||||
|
if (screenId == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boardPointBindingMapper.deleteByScreenId(screenId);
|
||||||
|
}
|
||||||
|
return boardScreenInfoMapper.deleteByScreenIds(screenIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,152 +1,104 @@
|
|||||||
package com.ktg.mes.board.service.impl;
|
package com.ktg.mes.board.service.impl;
|
||||||
|
|
||||||
import com.ktg.common.utils.StringUtils;
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.mes.board.domain.BoardMachineCard;
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
import com.ktg.mes.board.domain.WorkshopBoardData;
|
import com.ktg.mes.board.domain.WorkshopBoardData;
|
||||||
|
import com.ktg.mes.board.mapper.BoardOrderProgressMapper;
|
||||||
|
import com.ktg.mes.board.mapper.BoardScreenInfoMapper;
|
||||||
import com.ktg.mes.board.service.IWorkshopBoardService;
|
import com.ktg.mes.board.service.IWorkshopBoardService;
|
||||||
import com.ktg.mes.md.domain.MdMeasurePoint;
|
import com.ktg.mes.board.support.BoardDisplayValueMapper;
|
||||||
import com.ktg.mes.md.domain.MdScreenBinding;
|
|
||||||
import com.ktg.mes.md.domain.vo.ScreenBindingConfigVo;
|
|
||||||
import com.ktg.mes.md.domain.vo.ScreenBindingMachineConfig;
|
|
||||||
import com.ktg.mes.md.service.IMdMeasurePointService;
|
|
||||||
import com.ktg.mes.md.service.IMdScreenBindingService;
|
|
||||||
import com.ktg.mes.md.service.impl.ScreenBindingDefaults;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class WorkshopBoardServiceImpl implements IWorkshopBoardService {
|
public class WorkshopBoardServiceImpl implements IWorkshopBoardService {
|
||||||
@Autowired
|
private static final String DEFAULT_SCREEN_CODE = "WORKSHOP_BOARD_DEFAULT";
|
||||||
private IMdScreenBindingService mdScreenBindingService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IMdMeasurePointService mdMeasurePointService;
|
private BoardScreenInfoMapper boardScreenInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardOrderProgressMapper boardOrderProgressMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkshopBoardData getBoardData(String screenCode) {
|
public WorkshopBoardData getBoardData(String screenCode) {
|
||||||
ScreenBindingConfigVo configVo = mdScreenBindingService.getScreenBindingConfig(screenCode);
|
String actualScreenCode = StringUtils.isBlank(screenCode) ? DEFAULT_SCREEN_CODE : screenCode.trim();
|
||||||
Map<String, MdMeasurePoint> pointMap = mdMeasurePointService.selectMdMeasurePointMapByPointCodes(collectPointCodes(configVo));
|
WorkshopBoardData data = new WorkshopBoardData();
|
||||||
return buildBoardData(configVo, pointMap);
|
BoardScreenInfo screenInfo = boardScreenInfoMapper.selectByScreenCode(actualScreenCode);
|
||||||
}
|
if (screenInfo != null) {
|
||||||
|
data.setHeader(buildHeader(screenInfo, actualScreenCode));
|
||||||
private Collection<String> collectPointCodes(ScreenBindingConfigVo configVo) {
|
data.setSummary(buildSummary(screenInfo));
|
||||||
List<String> result = new ArrayList<String>();
|
|
||||||
for (MdScreenBinding binding : configVo.getBasicBindings()) {
|
|
||||||
collectPointCode(result, binding);
|
|
||||||
}
|
|
||||||
for (ScreenBindingMachineConfig machineConfig : configVo.getMachineConfigs()) {
|
|
||||||
for (MdScreenBinding binding : machineConfig.getBindings()) {
|
|
||||||
collectPointCode(result, binding);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void collectPointCode(List<String> result, MdScreenBinding binding) {
|
|
||||||
if (binding == null || !ScreenBindingDefaults.SOURCE_POINT.equals(binding.getSourceType()) || StringUtils.isEmpty(binding.getPointCode())) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!result.contains(binding.getPointCode())) {
|
|
||||||
result.add(binding.getPointCode());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private WorkshopBoardData buildBoardData(ScreenBindingConfigVo configVo, Map<String, MdMeasurePoint> pointMap) {
|
|
||||||
WorkshopBoardData fallback = ScreenBindingDefaults.createFallbackBoardData();
|
|
||||||
applyBasicBindings(configVo.getBasicBindings(), fallback, pointMap);
|
|
||||||
applyMachineBindings(configVo.getMachineConfigs(), fallback, pointMap);
|
|
||||||
return fallback;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyBasicBindings(List<MdScreenBinding> bindings, WorkshopBoardData boardData, Map<String, MdMeasurePoint> pointMap) {
|
|
||||||
for (MdScreenBinding binding : bindings) {
|
|
||||||
String bindingKey = binding.getBindingKey();
|
|
||||||
if (StringUtils.isEmpty(bindingKey) || bindingKey.indexOf(".") < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
String[] segments = bindingKey.split("\\.");
|
|
||||||
if (segments.length != 2) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ("header".equals(segments[0])) {
|
|
||||||
boardData.getHeader().put(segments[1], resolveBindingValue(binding, pointMap));
|
|
||||||
} else if ("summary".equals(segments[0])) {
|
|
||||||
boardData.getSummary().put(segments[1], resolveBindingValue(binding, pointMap));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void applyMachineBindings(List<ScreenBindingMachineConfig> machineConfigs, WorkshopBoardData boardData, Map<String, MdMeasurePoint> pointMap) {
|
|
||||||
Map<Long, ScreenBindingMachineConfig> machineMap = new LinkedHashMap<Long, ScreenBindingMachineConfig>();
|
|
||||||
for (ScreenBindingMachineConfig machineConfig : machineConfigs) {
|
|
||||||
machineMap.put(machineConfig.getId(), machineConfig);
|
|
||||||
}
|
|
||||||
List<Map<String, Object>> newMachineList = new ArrayList<Map<String, Object>>();
|
|
||||||
for (Map<String, Object> machine : boardData.getMachineList()) {
|
|
||||||
Long machineId = toLong(machine.get("id"));
|
|
||||||
ScreenBindingMachineConfig machineConfig = machineMap.get(machineId);
|
|
||||||
if (machineConfig == null) {
|
|
||||||
newMachineList.add(machine);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Map<String, Object> newMachine = new LinkedHashMap<String, Object>(machine);
|
|
||||||
if (StringUtils.isNotEmpty(machineConfig.getStatusClass())) {
|
|
||||||
newMachine.put("statusClass", machineConfig.getStatusClass());
|
|
||||||
}
|
|
||||||
for (MdScreenBinding binding : machineConfig.getBindings()) {
|
|
||||||
newMachine.put(binding.getBindingKey(), resolveBindingValue(binding, pointMap));
|
|
||||||
}
|
|
||||||
newMachineList.add(newMachine);
|
|
||||||
}
|
|
||||||
boardData.setMachineList(newMachineList);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String resolveBindingValue(MdScreenBinding binding, Map<String, MdMeasurePoint> pointMap) {
|
|
||||||
String value;
|
|
||||||
if (ScreenBindingDefaults.SOURCE_POINT.equals(binding.getSourceType()) && StringUtils.isNotEmpty(binding.getPointCode())) {
|
|
||||||
MdMeasurePoint point = pointMap.get(binding.getPointCode());
|
|
||||||
value = point == null ? null : point.getLatestValue();
|
|
||||||
} else {
|
} else {
|
||||||
value = binding.getFixedValue();
|
data.getHeader().put("screenCode", actualScreenCode);
|
||||||
|
data.getHeader().put("ownerName", "--");
|
||||||
|
data.getSummary().put("total", "0");
|
||||||
|
data.getSummary().put("online", "0");
|
||||||
|
data.getSummary().put("running", "0");
|
||||||
|
data.getSummary().put("stop", "0");
|
||||||
|
data.getSummary().put("startRate", "0%");
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(value)) {
|
List<BoardMachineCard> machineCards = screenInfo != null && screenInfo.getScreenId() != null
|
||||||
value = binding.getDefaultValue();
|
? boardOrderProgressMapper.selectMachineCardListByScreenId(screenInfo.getScreenId())
|
||||||
|
: boardOrderProgressMapper.selectMachineCardList(actualScreenCode);
|
||||||
|
for (BoardMachineCard machineCard : machineCards) {
|
||||||
|
data.getMachineList().add(toMachineMap(machineCard));
|
||||||
}
|
}
|
||||||
if (StringUtils.isEmpty(value)) {
|
return data;
|
||||||
return "--";
|
|
||||||
}
|
|
||||||
String formatted = formatNumber(value, binding.getPrecisionDigit());
|
|
||||||
if (StringUtils.isEmpty(binding.getDisplayUnit()) || formatted.contains(binding.getDisplayUnit())) {
|
|
||||||
return formatted;
|
|
||||||
}
|
|
||||||
return formatted + binding.getDisplayUnit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatNumber(String value, Integer precisionDigit) {
|
private Map<String, Object> buildHeader(BoardScreenInfo screenInfo, String screenCode) {
|
||||||
if (precisionDigit == null) {
|
Map<String, Object> header = new LinkedHashMap<String, Object>();
|
||||||
return value;
|
header.put("screenCode", StringUtils.defaultIfBlank(screenInfo.getScreenCode(), screenCode));
|
||||||
}
|
header.put("ownerName", StringUtils.defaultIfBlank(screenInfo.getOwnerName(), "--"));
|
||||||
try {
|
return header;
|
||||||
BigDecimal decimal = new BigDecimal(value);
|
|
||||||
return decimal.setScale(precisionDigit, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Long toLong(Object value) {
|
private Map<String, Object> buildSummary(BoardScreenInfo screenInfo) {
|
||||||
if (value == null) {
|
Map<String, Object> summary = new LinkedHashMap<String, Object>();
|
||||||
return 0L;
|
summary.put("total", String.valueOf(defaultInt(screenInfo.getDeviceTotal())));
|
||||||
}
|
summary.put("online", String.valueOf(defaultInt(screenInfo.getOnlineCount())));
|
||||||
if (value instanceof Number) {
|
summary.put("running", String.valueOf(defaultInt(screenInfo.getRunningCount())));
|
||||||
return ((Number) value).longValue();
|
summary.put("stop", String.valueOf(defaultInt(screenInfo.getStopCount())));
|
||||||
}
|
summary.put("startRate", formatPercent(screenInfo.getStartRate()));
|
||||||
return Long.valueOf(String.valueOf(value));
|
return summary;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, Object> toMachineMap(BoardMachineCard machineCard) {
|
||||||
|
Map<String, Object> map = new LinkedHashMap<String, Object>();
|
||||||
|
map.put("id", machineCard.getId());
|
||||||
|
map.put("name", defaultText(machineCard.getName()));
|
||||||
|
map.put("model", defaultText(machineCard.getModel()));
|
||||||
|
map.put("statusText", BoardDisplayValueMapper.toDeviceStatusText(machineCard.getRawStatus()));
|
||||||
|
map.put("statusClass", BoardDisplayValueMapper.toStatusClass(machineCard.getRawStatus()));
|
||||||
|
map.put("mode", BoardDisplayValueMapper.toRunModeText(machineCard.getRawMode()));
|
||||||
|
map.put("runtime", defaultText(machineCard.getRuntime()));
|
||||||
|
map.put("output", defaultText(machineCard.getOutput()));
|
||||||
|
map.put("progress", defaultText(machineCard.getProgress()));
|
||||||
|
map.put("workDate", defaultText(machineCard.getWorkDate()));
|
||||||
|
map.put("batchNo", defaultText(machineCard.getBatchNo()));
|
||||||
|
map.put("planQty", defaultText(machineCard.getPlanQty()));
|
||||||
|
map.put("productModel", defaultText(machineCard.getProductModel()));
|
||||||
|
map.put("color", defaultText(machineCard.getColor()));
|
||||||
|
map.put("remark", defaultText(machineCard.getRemark()));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String defaultText(String value) {
|
||||||
|
return StringUtils.isBlank(value) ? "--" : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int defaultInt(Integer value) {
|
||||||
|
return value == null ? 0 : value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatPercent(BigDecimal value) {
|
||||||
|
BigDecimal actualValue = value == null ? BigDecimal.ZERO : value;
|
||||||
|
return actualValue.stripTrailingZeros().toPlainString() + "%";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
package com.ktg.mes.board.support;
|
||||||
|
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
|
||||||
|
public final class BoardDisplayValueMapper {
|
||||||
|
private static final String STATUS_IDLE = "1";
|
||||||
|
private static final String STATUS_RUNNING = "2";
|
||||||
|
private static final String STATUS_FAULT = "3";
|
||||||
|
|
||||||
|
private static final String RUN_MODE_MANUAL = "0";
|
||||||
|
private static final String RUN_MODE_SEMI_AUTO = "1";
|
||||||
|
private static final String RUN_MODE_PHOTOEYE_AUTO = "2";
|
||||||
|
private static final String RUN_MODE_TIME_AUTO = "3";
|
||||||
|
|
||||||
|
private BoardDisplayValueMapper() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toDeviceStatusText(String rawStatus) {
|
||||||
|
if (StringUtils.isBlank(rawStatus)) {
|
||||||
|
return "--";
|
||||||
|
}
|
||||||
|
if (STATUS_IDLE.equals(rawStatus)) {
|
||||||
|
return "待机";
|
||||||
|
}
|
||||||
|
if (STATUS_RUNNING.equals(rawStatus)) {
|
||||||
|
return "运行";
|
||||||
|
}
|
||||||
|
if (STATUS_FAULT.equals(rawStatus)) {
|
||||||
|
return "故障";
|
||||||
|
}
|
||||||
|
return "--";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toRunModeText(String rawMode) {
|
||||||
|
if (StringUtils.isBlank(rawMode)) {
|
||||||
|
return "--";
|
||||||
|
}
|
||||||
|
if (RUN_MODE_MANUAL.equals(rawMode)) {
|
||||||
|
return "手动";
|
||||||
|
}
|
||||||
|
if (RUN_MODE_SEMI_AUTO.equals(rawMode)) {
|
||||||
|
return "半自动";
|
||||||
|
}
|
||||||
|
if (RUN_MODE_PHOTOEYE_AUTO.equals(rawMode)) {
|
||||||
|
return "电眼自动";
|
||||||
|
}
|
||||||
|
if (RUN_MODE_TIME_AUTO.equals(rawMode)) {
|
||||||
|
return "时间自动";
|
||||||
|
}
|
||||||
|
return "调模使用";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String toStatusClass(String rawStatus) {
|
||||||
|
if (STATUS_RUNNING.equals(rawStatus)) {
|
||||||
|
return "is-running";
|
||||||
|
}
|
||||||
|
if (STATUS_FAULT.equals(rawStatus)) {
|
||||||
|
return "is-stop";
|
||||||
|
}
|
||||||
|
return "is-idle";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isRunning(String rawStatus) {
|
||||||
|
return STATUS_RUNNING.equals(rawStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isOnline(String rawStatus) {
|
||||||
|
return STATUS_IDLE.equals(rawStatus) || STATUS_RUNNING.equals(rawStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isStop(String rawStatus) {
|
||||||
|
return STATUS_FAULT.equals(rawStatus);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,253 @@
|
|||||||
|
package com.ktg.mes.board.task;
|
||||||
|
|
||||||
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.mes.board.domain.BoardOrderProgress;
|
||||||
|
import com.ktg.mes.board.domain.BoardPointBinding;
|
||||||
|
import com.ktg.mes.board.domain.BoardScreenInfo;
|
||||||
|
import com.ktg.mes.board.mapper.BoardOrderProgressMapper;
|
||||||
|
import com.ktg.mes.board.mapper.BoardPointBindingMapper;
|
||||||
|
import com.ktg.mes.board.mapper.BoardScreenInfoMapper;
|
||||||
|
import com.ktg.mes.board.support.BoardDisplayValueMapper;
|
||||||
|
import com.ktg.mes.dv.domain.DvMachinery;
|
||||||
|
import com.ktg.mes.dv.mapper.DvMachineryMapper;
|
||||||
|
import com.ktg.mes.md.domain.MdMeasurePoint;
|
||||||
|
import com.ktg.mes.md.service.IMdMeasurePointService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.ktg.mes.md.domain.MeasurePointHistoryItem;
|
||||||
|
|
||||||
|
@Component("boardQuartzTask")
|
||||||
|
public class BoardQuartzTask {
|
||||||
|
private static final String DEFAULT_SCREEN_CODE = "WORKSHOP_BOARD_DEFAULT";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardPointBindingMapper boardPointBindingMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardOrderProgressMapper boardOrderProgressMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BoardScreenInfoMapper boardScreenInfoMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IMdMeasurePointService mdMeasurePointService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DvMachineryMapper dvMachineryMapper;
|
||||||
|
|
||||||
|
public void syncDefaultScreen() {
|
||||||
|
syncConfiguredScreens();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncConfiguredScreens() {
|
||||||
|
List<BoardScreenInfo> screenInfoList = boardScreenInfoMapper.selectBoardScreenInfoList(new BoardScreenInfo());
|
||||||
|
if (screenInfoList == null || screenInfoList.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Set<String> syncedScreenCodes = new HashSet<String>();
|
||||||
|
for (BoardScreenInfo screenInfo : screenInfoList) {
|
||||||
|
if (screenInfo == null || StringUtils.isBlank(screenInfo.getScreenCode())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String screenCode = screenInfo.getScreenCode().trim();
|
||||||
|
if (!syncedScreenCodes.add(screenCode)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
syncByScreenCode(screenCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void syncByScreenCode(String screenCode) {
|
||||||
|
String actualScreenCode = StringUtils.isBlank(screenCode) ? DEFAULT_SCREEN_CODE : screenCode.trim();
|
||||||
|
BoardScreenInfo screenInfo = boardScreenInfoMapper.selectByScreenCode(actualScreenCode);
|
||||||
|
if (screenInfo == null || screenInfo.getScreenId() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Long screenId = screenInfo.getScreenId();
|
||||||
|
List<BoardPointBinding> bindings = boardPointBindingMapper.selectByScreenId(screenId);
|
||||||
|
Map<String, BoardOrderProgress> progressMap = new LinkedHashMap<String, BoardOrderProgress>();
|
||||||
|
Date now = DateUtils.getNowDate();
|
||||||
|
for (BoardPointBinding binding : bindings) {
|
||||||
|
if (binding == null || StringUtils.isBlank(binding.getMachineryCode())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BoardOrderProgress progress = progressMap.get(binding.getMachineryCode());
|
||||||
|
if (progress == null) {
|
||||||
|
progress = loadOrCreateProgress(screenId, actualScreenCode, binding.getMachineryCode(), now);
|
||||||
|
progressMap.put(binding.getMachineryCode(), progress);
|
||||||
|
}
|
||||||
|
applyPointValue(progress, binding);
|
||||||
|
}
|
||||||
|
for (BoardOrderProgress progress : progressMap.values()) {
|
||||||
|
upsertProgress(progress, now);
|
||||||
|
}
|
||||||
|
refreshScreenInfo(screenId, actualScreenCode, now);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BoardOrderProgress loadOrCreateProgress(Long screenId, String screenCode, String machineryCode, Date now) {
|
||||||
|
BoardOrderProgress progress = boardOrderProgressMapper.selectByScreenIdAndMachineryCode(screenId, machineryCode);
|
||||||
|
if (progress == null) {
|
||||||
|
progress = new BoardOrderProgress();
|
||||||
|
progress.setScreenId(screenId);
|
||||||
|
progress.setScreenCode(screenCode);
|
||||||
|
progress.setMachineryCode(machineryCode);
|
||||||
|
progress.setCreateBy("quartz");
|
||||||
|
progress.setCreateTime(now);
|
||||||
|
}
|
||||||
|
DvMachinery machinery = loadMachinery(machineryCode);
|
||||||
|
if (machinery != null) {
|
||||||
|
progress.setMachineryId(machinery.getMachineryId());
|
||||||
|
progress.setMachineryName(machinery.getMachineryName());
|
||||||
|
progress.setMachineryModel(machinery.getMachinerySpec());
|
||||||
|
}
|
||||||
|
return progress;
|
||||||
|
}
|
||||||
|
|
||||||
|
private DvMachinery loadMachinery(String machineryCode) {
|
||||||
|
List<DvMachinery> list = dvMachineryMapper.selectByMachineryCode(machineryCode);
|
||||||
|
return list == null || list.isEmpty() ? null : list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyPointValue(BoardOrderProgress progress, BoardPointBinding binding) {
|
||||||
|
MdMeasurePoint point = mdMeasurePointService.queryLatestValue(binding.getPointCode());
|
||||||
|
if (point == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String latestValue = point.getLatestValue();
|
||||||
|
if (StringUtils.isBlank(latestValue)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ("device_status".equals(binding.getBindingField())) {
|
||||||
|
progress.setDeviceStatus(latestValue);
|
||||||
|
} else if ("run_mode".equals(binding.getBindingField())) {
|
||||||
|
progress.setRunMode(latestValue);
|
||||||
|
} else if ("today_run_time".equals(binding.getBindingField())) {
|
||||||
|
progress.setTodayRunTime(calculateTodayRunTime(point, latestValue));
|
||||||
|
} else if ("today_piece_count".equals(binding.getBindingField())) {
|
||||||
|
progress.setTodayPieceCount(latestValue);
|
||||||
|
} else if ("batch_code".equals(binding.getBindingField())) {
|
||||||
|
progress.setBatchCode(latestValue);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(point.getLatestTime())) {
|
||||||
|
try {
|
||||||
|
progress.setCollectTime(DateUtils.parseDate(point.getLatestTime()));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String calculateTodayRunTime(MdMeasurePoint point, String latestValue) {
|
||||||
|
BigDecimal latest = parseDecimal(latestValue);
|
||||||
|
if (latest == null) {
|
||||||
|
return latestValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal yesterdayLastValue = queryYesterdayLastValue(point.getPointCode());
|
||||||
|
if (yesterdayLastValue == null) {
|
||||||
|
return formatDecimal(latest, point.getPrecisionDigit());
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal todayRunTime = latest.subtract(yesterdayLastValue);
|
||||||
|
if (todayRunTime.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
todayRunTime = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
return formatDecimal(todayRunTime, point.getPrecisionDigit());
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal queryYesterdayLastValue(String pointCode) {
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
String startTime = today.minusDays(1).toString() + " 00:00:00";
|
||||||
|
String endTime = today.toString() + " 00:00:00";
|
||||||
|
List<MeasurePointHistoryItem> history = mdMeasurePointService.queryHistory(pointCode, null, null, startTime, endTime);
|
||||||
|
if (history == null || history.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
MeasurePointHistoryItem lastItem = history.get(history.size() - 1);
|
||||||
|
return lastItem == null ? null : lastItem.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private BigDecimal parseDecimal(String value) {
|
||||||
|
if (StringUtils.isBlank(value)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return new BigDecimal(value);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatDecimal(BigDecimal value, Integer precisionDigit) {
|
||||||
|
if (value == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (precisionDigit != null && precisionDigit >= 0) {
|
||||||
|
value = value.setScale(precisionDigit, RoundingMode.HALF_UP);
|
||||||
|
}
|
||||||
|
return value.stripTrailingZeros().toPlainString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void upsertProgress(BoardOrderProgress progress, Date now) {
|
||||||
|
progress.setRefreshTime(now);
|
||||||
|
progress.setUpdateBy("quartz");
|
||||||
|
progress.setUpdateTime(now);
|
||||||
|
if (progress.getProgressId() == null) {
|
||||||
|
boardOrderProgressMapper.insert(progress);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boardOrderProgressMapper.update(progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshScreenInfo(Long screenId, String screenCode, Date now) {
|
||||||
|
List<BoardOrderProgress> list = boardOrderProgressMapper.selectByScreenId(screenId);
|
||||||
|
int deviceTotal = list.size();
|
||||||
|
int onlineCount = 0;
|
||||||
|
int runningCount = 0;
|
||||||
|
int stopCount = 0;
|
||||||
|
for (BoardOrderProgress progress : list) {
|
||||||
|
String status = StringUtils.defaultString(progress.getDeviceStatus());
|
||||||
|
if (BoardDisplayValueMapper.isRunning(status)) {
|
||||||
|
runningCount++;
|
||||||
|
onlineCount++;
|
||||||
|
} else if (BoardDisplayValueMapper.isOnline(status)) {
|
||||||
|
onlineCount++;
|
||||||
|
} else if (BoardDisplayValueMapper.isStop(status)) {
|
||||||
|
stopCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BoardScreenInfo screenInfo = boardScreenInfoMapper.selectByScreenId(screenId);
|
||||||
|
if (screenInfo == null) {
|
||||||
|
screenInfo = new BoardScreenInfo();
|
||||||
|
screenInfo.setScreenId(screenId);
|
||||||
|
screenInfo.setScreenCode(screenCode);
|
||||||
|
screenInfo.setCreateBy("quartz");
|
||||||
|
screenInfo.setCreateTime(now);
|
||||||
|
}
|
||||||
|
screenInfo.setDeviceTotal(deviceTotal);
|
||||||
|
screenInfo.setOnlineCount(onlineCount);
|
||||||
|
screenInfo.setRunningCount(runningCount);
|
||||||
|
screenInfo.setStopCount(stopCount);
|
||||||
|
screenInfo.setStartRate(deviceTotal == 0 ? BigDecimal.ZERO :
|
||||||
|
new BigDecimal(runningCount).multiply(new BigDecimal("100")).divide(new BigDecimal(deviceTotal), 2, RoundingMode.HALF_UP));
|
||||||
|
screenInfo.setLatestRefreshTime(now);
|
||||||
|
screenInfo.setUpdateBy("quartz");
|
||||||
|
screenInfo.setUpdateTime(now);
|
||||||
|
if (screenInfo.getScreenId() == null) {
|
||||||
|
boardScreenInfoMapper.insert(screenInfo);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
boardScreenInfoMapper.update(screenInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -52,6 +52,9 @@ public class DvCheckPlan extends BaseEntity
|
|||||||
@Excel(name = "状态")
|
@Excel(name = "状态")
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
|
/** 关联设备编码,逗号分隔 */
|
||||||
|
private String machineryCodes;
|
||||||
|
|
||||||
/** 预留字段1 */
|
/** 预留字段1 */
|
||||||
private String attr1;
|
private String attr1;
|
||||||
|
|
||||||
@ -144,6 +147,14 @@ public class DvCheckPlan extends BaseEntity
|
|||||||
{
|
{
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMachineryCodes() {
|
||||||
|
return machineryCodes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryCodes(String machineryCodes) {
|
||||||
|
this.machineryCodes = machineryCodes;
|
||||||
|
}
|
||||||
public void setAttr1(String attr1)
|
public void setAttr1(String attr1)
|
||||||
{
|
{
|
||||||
this.attr1 = attr1;
|
this.attr1 = attr1;
|
||||||
@ -193,6 +204,7 @@ public class DvCheckPlan extends BaseEntity
|
|||||||
", cycleType='" + cycleType + '\'' +
|
", cycleType='" + cycleType + '\'' +
|
||||||
", cycleCount=" + cycleCount +
|
", cycleCount=" + cycleCount +
|
||||||
", status='" + status + '\'' +
|
", status='" + status + '\'' +
|
||||||
|
", machineryCodes='" + machineryCodes + '\'' +
|
||||||
", attr1='" + attr1 + '\'' +
|
", attr1='" + attr1 + '\'' +
|
||||||
", attr2='" + attr2 + '\'' +
|
", attr2='" + attr2 + '\'' +
|
||||||
", attr3=" + attr3 +
|
", attr3=" + attr3 +
|
||||||
|
|||||||
@ -53,18 +53,18 @@ public class DvRepair extends BaseEntity
|
|||||||
private Long machineryTypeId;
|
private Long machineryTypeId;
|
||||||
|
|
||||||
/** 报修日期 */
|
/** 报修日期 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "报修日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "报修日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date requireDate;
|
private Date requireDate;
|
||||||
|
|
||||||
/** 维修完成日期 */
|
/** 维修完成日期 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "维修完成日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "维修完成日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date finishDate;
|
private Date finishDate;
|
||||||
|
|
||||||
/** 验收日期 */
|
/** 验收日期 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "验收日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
@Excel(name = "验收日期", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date confirmDate;
|
private Date confirmDate;
|
||||||
|
|
||||||
/** 维修结果 */
|
/** 维修结果 */
|
||||||
|
|||||||
@ -1,12 +1,23 @@
|
|||||||
package com.ktg.mes.dv.domain.dto;
|
package com.ktg.mes.dv.domain.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class DvCheckPlanDTO {
|
public class DvCheckPlanDTO {
|
||||||
|
|
||||||
private String planType;
|
private String planType;
|
||||||
|
|
||||||
private String machineryCode;
|
private String machineryCode;
|
||||||
|
|
||||||
|
public String getPlanType() {
|
||||||
|
return planType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlanType(String planType) {
|
||||||
|
this.planType = planType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMachineryCode() {
|
||||||
|
return machineryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryCode(String machineryCode) {
|
||||||
|
this.machineryCode = machineryCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,10 +1,13 @@
|
|||||||
package com.ktg.mes.dv.domain.dto;
|
package com.ktg.mes.dv.domain.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class DvRepairDTO {
|
public class DvRepairDTO {
|
||||||
|
|
||||||
private String machineryCode;
|
private String machineryCode;
|
||||||
|
|
||||||
|
public String getMachineryCode() {
|
||||||
|
return machineryCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMachineryCode(String machineryCode) {
|
||||||
|
this.machineryCode = machineryCode;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,6 +12,7 @@ public class InfluxDbConfig {
|
|||||||
private String bucket;
|
private String bucket;
|
||||||
private String token;
|
private String token;
|
||||||
private String measurement;
|
private String measurement;
|
||||||
|
private String displayZone = "Asia/Shanghai";
|
||||||
private Integer timeoutMillis = 10000;
|
private Integer timeoutMillis = 10000;
|
||||||
|
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
@ -62,6 +63,14 @@ public class InfluxDbConfig {
|
|||||||
this.measurement = measurement;
|
this.measurement = measurement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDisplayZone() {
|
||||||
|
return displayZone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayZone(String displayZone) {
|
||||||
|
this.displayZone = displayZone;
|
||||||
|
}
|
||||||
|
|
||||||
public Integer getTimeoutMillis() {
|
public Integer getTimeoutMillis() {
|
||||||
return timeoutMillis;
|
return timeoutMillis;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -56,6 +57,24 @@ public class MdMeasurePointController extends BaseController {
|
|||||||
util.exportExcel(response, list, "测量点数据");
|
util.exportExcel(response, list, "测量点数据");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/importTemplate")
|
||||||
|
public void importTemplate(HttpServletResponse response) {
|
||||||
|
ExcelUtil<MdMeasurePoint> util = new ExcelUtil<MdMeasurePoint>(MdMeasurePoint.class);
|
||||||
|
util.importTemplateExcel(response, "测量点数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
@PreAuthorize("@ss.hasPermi('mes:md:measurepoint:import')")
|
||||||
|
@Log(title = "测量点", businessType = BusinessType.IMPORT)
|
||||||
|
@PostMapping("/importData")
|
||||||
|
public AjaxResult importData(MultipartFile file,
|
||||||
|
@RequestParam(name = "updateSupport", defaultValue = "false") boolean updateSupport) throws Exception {
|
||||||
|
ExcelUtil<MdMeasurePoint> util = new ExcelUtil<MdMeasurePoint>(MdMeasurePoint.class);
|
||||||
|
List<MdMeasurePoint> pointList = util.importExcel(file.getInputStream());
|
||||||
|
String operName = getUsername();
|
||||||
|
String message = mdMeasurePointService.importMeasurePoint(pointList, updateSupport, operName);
|
||||||
|
return AjaxResult.success(message);
|
||||||
|
}
|
||||||
|
|
||||||
@PreAuthorize("@ss.hasPermi('mes:md:measurepoint:query')")
|
@PreAuthorize("@ss.hasPermi('mes:md:measurepoint:query')")
|
||||||
@GetMapping("/{pointId}")
|
@GetMapping("/{pointId}")
|
||||||
public AjaxResult getInfo(@PathVariable("pointId") Long pointId) {
|
public AjaxResult getInfo(@PathVariable("pointId") Long pointId) {
|
||||||
|
|||||||
@ -31,4 +31,6 @@ public interface IMdMeasurePointService {
|
|||||||
List<MeasurePointHistoryItem> queryHistory(String pointCode, String range, String interval, String startTime, String endTime);
|
List<MeasurePointHistoryItem> queryHistory(String pointCode, String range, String interval, String startTime, String endTime);
|
||||||
|
|
||||||
Map<String, MdMeasurePoint> selectMdMeasurePointMapByPointCodes(Collection<String> pointCodes);
|
Map<String, MdMeasurePoint> selectMdMeasurePointMapByPointCodes(Collection<String> pointCodes);
|
||||||
|
|
||||||
|
String importMeasurePoint(List<MdMeasurePoint> pointList, Boolean isUpdateSupport, String operName);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,9 @@ import java.net.HttpURLConnection;
|
|||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.time.OffsetDateTime;
|
import java.time.OffsetDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -33,6 +35,7 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class MdMeasurePointInfluxService {
|
public class MdMeasurePointInfluxService {
|
||||||
private static final Logger log = LoggerFactory.getLogger(MdMeasurePointInfluxService.class);
|
private static final Logger log = LoggerFactory.getLogger(MdMeasurePointInfluxService.class);
|
||||||
|
private static final DateTimeFormatter DISPLAY_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private InfluxDbConfig influxDbConfig;
|
private InfluxDbConfig influxDbConfig;
|
||||||
@ -45,7 +48,7 @@ public class MdMeasurePointInfluxService {
|
|||||||
if (!rows.isEmpty()) {
|
if (!rows.isEmpty()) {
|
||||||
Map<String, String> row = rows.get(0);
|
Map<String, String> row = rows.get(0);
|
||||||
point.setLatestValue(formatValue(row.get("_value"), point.getPrecisionDigit()));
|
point.setLatestValue(formatValue(row.get("_value"), point.getPrecisionDigit()));
|
||||||
point.setLatestTime(row.get("_time"));
|
point.setLatestTime(formatDisplayTime(row.get("_time")));
|
||||||
}
|
}
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
@ -61,7 +64,7 @@ public class MdMeasurePointInfluxService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
result.add(new MeasurePointHistoryItem(row.get("_time"), new BigDecimal(row.get("_value"))));
|
result.add(new MeasurePointHistoryItem(formatDisplayTime(row.get("_time")), new BigDecimal(row.get("_value"))));
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -306,11 +309,37 @@ public class MdMeasurePointInfluxService {
|
|||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return java.time.LocalDateTime.parse(value, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
|
return LocalDateTime.parse(value, DISPLAY_TIME_FORMATTER)
|
||||||
.atOffset(ZoneOffset.ofHours(8))
|
.atOffset(ZoneOffset.ofHours(8))
|
||||||
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
.format(DateTimeFormatter.ISO_OFFSET_DATE_TIME);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String formatDisplayTime(String value) {
|
||||||
|
if (StringUtils.isBlank(value)) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return OffsetDateTime.parse(value)
|
||||||
|
.atZoneSameInstant(getDisplayZoneId())
|
||||||
|
.format(DISPLAY_TIME_FORMATTER);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return LocalDateTime.parse(value, DISPLAY_TIME_FORMATTER)
|
||||||
|
.format(DISPLAY_TIME_FORMATTER);
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ZoneId getDisplayZoneId() {
|
||||||
|
try {
|
||||||
|
return ZoneId.of(StringUtils.defaultIfBlank(influxDbConfig.getDisplayZone(), "Asia/Shanghai"));
|
||||||
|
} catch (Exception ignored) {
|
||||||
|
return ZoneId.of("Asia/Shanghai");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
package com.ktg.mes.md.service.impl;
|
package com.ktg.mes.md.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.ktg.common.constant.UserConstants;
|
import com.ktg.common.constant.UserConstants;
|
||||||
|
import com.ktg.common.exception.ServiceException;
|
||||||
import com.ktg.common.utils.DateUtils;
|
import com.ktg.common.utils.DateUtils;
|
||||||
|
import com.ktg.common.utils.StringUtils;
|
||||||
|
import com.ktg.common.utils.bean.BeanValidators;
|
||||||
import com.ktg.mes.md.domain.MdMeasurePoint;
|
import com.ktg.mes.md.domain.MdMeasurePoint;
|
||||||
import com.ktg.mes.md.domain.MdWorkshop;
|
import com.ktg.mes.md.domain.MdWorkshop;
|
||||||
import com.ktg.mes.md.domain.MeasurePointHistoryItem;
|
import com.ktg.mes.md.domain.MeasurePointHistoryItem;
|
||||||
@ -11,6 +15,7 @@ import com.ktg.mes.md.service.IMdWorkshopService;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.validation.Validator;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
@ -28,6 +33,9 @@ public class MdMeasurePointServiceImpl implements IMdMeasurePointService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private MdMeasurePointInfluxService mdMeasurePointInfluxService;
|
private MdMeasurePointInfluxService mdMeasurePointInfluxService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
protected Validator validator;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MdMeasurePoint selectMdMeasurePointByPointId(Long pointId) {
|
public MdMeasurePoint selectMdMeasurePointByPointId(Long pointId) {
|
||||||
MdMeasurePoint point = mdMeasurePointMapper.selectMdMeasurePointByPointId(pointId);
|
MdMeasurePoint point = mdMeasurePointMapper.selectMdMeasurePointByPointId(pointId);
|
||||||
@ -42,11 +50,7 @@ public class MdMeasurePointServiceImpl implements IMdMeasurePointService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<MdMeasurePoint> selectMdMeasurePointList(MdMeasurePoint mdMeasurePoint) {
|
public List<MdMeasurePoint> selectMdMeasurePointList(MdMeasurePoint mdMeasurePoint) {
|
||||||
List<MdMeasurePoint> list = mdMeasurePointMapper.selectMdMeasurePointList(mdMeasurePoint);
|
return mdMeasurePointMapper.selectMdMeasurePointList(mdMeasurePoint);
|
||||||
for (MdMeasurePoint point : list) {
|
|
||||||
mdMeasurePointInfluxService.fillLatestValue(point);
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -121,6 +125,76 @@ public class MdMeasurePointServiceImpl implements IMdMeasurePointService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String importMeasurePoint(List<MdMeasurePoint> pointList, Boolean isUpdateSupport, String operName) {
|
||||||
|
if (StringUtils.isNull(pointList) || pointList.size() == 0) {
|
||||||
|
throw new ServiceException("导入测量点数据不能为空!");
|
||||||
|
}
|
||||||
|
int successNum = 0;
|
||||||
|
int failureNum = 0;
|
||||||
|
StringBuilder successMsg = new StringBuilder();
|
||||||
|
StringBuilder failureMsg = new StringBuilder();
|
||||||
|
for (MdMeasurePoint point : pointList) {
|
||||||
|
String pointCode = StringUtils.trimToEmpty(point.getPointCode());
|
||||||
|
String pointName = StringUtils.trimToEmpty(point.getPointName());
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(pointCode)) {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点编码不能为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(pointName)) {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点 ").append(pointCode).append(" 的名称不能为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(StringUtils.trimToEmpty(point.getFieldKey()))) {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点 ").append(pointCode).append(" 的字段名不能为空");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
normalizePoint(point);
|
||||||
|
resolveWorkshop(point);
|
||||||
|
BeanValidators.validateWithException(validator, point);
|
||||||
|
|
||||||
|
MdMeasurePoint exists = mdMeasurePointMapper.checkPointCodeUnique(point);
|
||||||
|
if (StringUtils.isNull(exists)) {
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(checkPointNameUnique(point))) {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点 ").append(pointCode).append(" 的名称已存在");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
point.setCreateBy(operName);
|
||||||
|
insertMdMeasurePoint(point);
|
||||||
|
successNum++;
|
||||||
|
} else if (Boolean.TRUE.equals(isUpdateSupport)) {
|
||||||
|
point.setPointId(exists.getPointId());
|
||||||
|
if (UserConstants.NOT_UNIQUE.equals(checkPointNameUnique(point))) {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点 ").append(pointCode).append(" 的名称已存在");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
point.setUpdateBy(operName);
|
||||||
|
updateMdMeasurePoint(point);
|
||||||
|
successNum++;
|
||||||
|
} else {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点 ").append(pointCode).append(" 已存在");
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
failureNum++;
|
||||||
|
failureMsg.append("<br/>").append(failureNum).append("、测量点 ").append(pointCode).append(" 导入失败:").append(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (failureNum > 0) {
|
||||||
|
failureMsg.insert(0, "导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||||
|
throw new ServiceException(failureMsg.toString());
|
||||||
|
}
|
||||||
|
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条");
|
||||||
|
return successMsg.toString();
|
||||||
|
}
|
||||||
|
|
||||||
private void fillWorkshopInfo(MdMeasurePoint mdMeasurePoint) {
|
private void fillWorkshopInfo(MdMeasurePoint mdMeasurePoint) {
|
||||||
if (mdMeasurePoint.getWorkshopId() == null) {
|
if (mdMeasurePoint.getWorkshopId() == null) {
|
||||||
mdMeasurePoint.setWorkshopCode(null);
|
mdMeasurePoint.setWorkshopCode(null);
|
||||||
@ -133,4 +207,66 @@ public class MdMeasurePointServiceImpl implements IMdMeasurePointService {
|
|||||||
mdMeasurePoint.setWorkshopName(workshop.getWorkshopName());
|
mdMeasurePoint.setWorkshopName(workshop.getWorkshopName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void normalizePoint(MdMeasurePoint point) {
|
||||||
|
point.setPointCode(StringUtils.trim(point.getPointCode()));
|
||||||
|
point.setPointName(StringUtils.trim(point.getPointName()));
|
||||||
|
point.setDeviceCode(StringUtils.trim(point.getDeviceCode()));
|
||||||
|
point.setNodeCode(StringUtils.trim(point.getNodeCode()));
|
||||||
|
point.setFieldKey(StringUtils.trim(point.getFieldKey()));
|
||||||
|
point.setTagJson(StringUtils.trim(point.getTagJson()));
|
||||||
|
point.setUnit(StringUtils.trim(point.getUnit()));
|
||||||
|
point.setRemark(StringUtils.trim(point.getRemark()));
|
||||||
|
if (ObjectUtil.isEmpty(point.getPrecisionDigit())) {
|
||||||
|
point.setPrecisionDigit(2);
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isEmpty(point.getSortNum())) {
|
||||||
|
point.setSortNum(1);
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(point.getEnableFlag())) {
|
||||||
|
point.setEnableFlag(UserConstants.YES);
|
||||||
|
} else {
|
||||||
|
point.setEnableFlag(StringUtils.upperCase(StringUtils.trim(point.getEnableFlag())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resolveWorkshop(MdMeasurePoint point) {
|
||||||
|
if (point.getWorkshopId() != null) {
|
||||||
|
fillWorkshopInfo(point);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String workshopCode = StringUtils.trim(point.getWorkshopCode());
|
||||||
|
String workshopName = StringUtils.trim(point.getWorkshopName());
|
||||||
|
if (StringUtils.isEmpty(workshopCode) && StringUtils.isEmpty(workshopName)) {
|
||||||
|
point.setWorkshopId(null);
|
||||||
|
point.setWorkshopCode(null);
|
||||||
|
point.setWorkshopName(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
MdWorkshop query = new MdWorkshop();
|
||||||
|
if (StringUtils.isNotEmpty(workshopCode)) {
|
||||||
|
query.setWorkshopCode(workshopCode);
|
||||||
|
} else {
|
||||||
|
query.setWorkshopName(workshopName);
|
||||||
|
}
|
||||||
|
List<MdWorkshop> workshops = mdWorkshopService.selectMdWorkshopList(query);
|
||||||
|
MdWorkshop matched = null;
|
||||||
|
for (MdWorkshop workshop : workshops) {
|
||||||
|
if (StringUtils.isNotEmpty(workshopCode) && workshopCode.equals(workshop.getWorkshopCode())) {
|
||||||
|
matched = workshop;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(workshopCode) && workshopName.equals(workshop.getWorkshopName())) {
|
||||||
|
matched = workshop;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (matched == null) {
|
||||||
|
throw new ServiceException("所属车间不存在,请填写正确的车间编码或车间名称");
|
||||||
|
}
|
||||||
|
point.setWorkshopId(matched.getWorkshopId());
|
||||||
|
point.setWorkshopCode(matched.getWorkshopCode());
|
||||||
|
point.setWorkshopName(matched.getWorkshopName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,11 +1,9 @@
|
|||||||
package com.ktg.mes.pro.controller.vo;
|
package com.ktg.mes.pro.controller.vo;
|
||||||
|
|
||||||
import com.ktg.mes.pro.domain.ProRouteProcess;
|
import com.ktg.mes.pro.domain.ProRouteProcess;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ProRouteHomeVO extends ProRouteProcess {
|
public class ProRouteHomeVO extends ProRouteProcess {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,4 +21,27 @@ public class ProRouteHomeVO extends ProRouteProcess {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal total;
|
private BigDecimal total;
|
||||||
|
|
||||||
|
public BigDecimal getCompleteNumber() {
|
||||||
|
return completeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCompleteNumber(BigDecimal completeNumber) {
|
||||||
|
this.completeNumber = completeNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getIncompleteNumber() {
|
||||||
|
return incompleteNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncompleteNumber(BigDecimal incompleteNumber) {
|
||||||
|
this.incompleteNumber = incompleteNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal(BigDecimal total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,18 @@
|
|||||||
package com.ktg.mes.pro.controller.vo;
|
package com.ktg.mes.pro.controller.vo;
|
||||||
|
|
||||||
import com.ktg.mes.pro.domain.ProWorkorder;
|
import com.ktg.mes.pro.domain.ProWorkorder;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ProWorkorderHomeVO extends ProWorkorder {
|
public class ProWorkorderHomeVO extends ProWorkorder {
|
||||||
|
|
||||||
private List<ProRouteHomeVO> routeHomg;
|
private List<ProRouteHomeVO> routeHomg;
|
||||||
|
|
||||||
|
public List<ProRouteHomeVO> getRouteHomg() {
|
||||||
|
return routeHomg;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRouteHomg(List<ProRouteHomeVO> routeHomg) {
|
||||||
|
this.routeHomg = routeHomg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ import com.ktg.mes.wm.domain.WmBarcode;
|
|||||||
import com.ktg.mes.wm.service.IWmBarcodeService;
|
import com.ktg.mes.wm.service.IWmBarcodeService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -21,6 +23,7 @@ import java.util.Map;
|
|||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class PmReportBean {
|
public class PmReportBean {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(PmReportBean.class);
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IProWorkorderService proWorkorderService;
|
private IProWorkorderService proWorkorderService;
|
||||||
|
|||||||
@ -2,6 +2,8 @@ package com.ktg.mes.websocket;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.websocket.*;
|
import javax.websocket.*;
|
||||||
@ -17,6 +19,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class MesWebSocket {
|
public class MesWebSocket {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(MesWebSocket.class);
|
||||||
private static Map<String, Session> sessionMap = new ConcurrentHashMap<>();
|
private static Map<String, Session> sessionMap = new ConcurrentHashMap<>();
|
||||||
public final static String WEBSOCKET_HEARTBEAT = "heartbeat-iot";
|
public final static String WEBSOCKET_HEARTBEAT = "heartbeat-iot";
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -1,12 +1,23 @@
|
|||||||
package com.ktg.mes.wm.domain.vo;
|
package com.ktg.mes.wm.domain.vo;
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class WmAreaPrintVO {
|
public class WmAreaPrintVO {
|
||||||
|
|
||||||
private String barcodeContent;
|
private String barcodeContent;
|
||||||
|
|
||||||
private String locationName;
|
private String locationName;
|
||||||
|
|
||||||
|
public String getBarcodeContent() {
|
||||||
|
return barcodeContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBarcodeContent(String barcodeContent) {
|
||||||
|
this.barcodeContent = barcodeContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLocationName() {
|
||||||
|
return locationName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocationName(String locationName) {
|
||||||
|
this.locationName = locationName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,151 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ktg.mes.board.mapper.BoardOrderProgressMapper">
|
||||||
|
|
||||||
|
<resultMap id="BoardOrderProgressResult" type="com.ktg.mes.board.domain.BoardOrderProgress">
|
||||||
|
<result property="progressId" column="progress_id"/>
|
||||||
|
<result property="screenId" column="screen_id"/>
|
||||||
|
<result property="screenCode" column="screen_code"/>
|
||||||
|
<result property="machineryId" column="machinery_id"/>
|
||||||
|
<result property="machineryCode" column="machinery_code"/>
|
||||||
|
<result property="machineryName" column="machinery_name"/>
|
||||||
|
<result property="machineryModel" column="machinery_model"/>
|
||||||
|
<result property="deviceStatus" column="device_status"/>
|
||||||
|
<result property="runMode" column="run_mode"/>
|
||||||
|
<result property="todayRunTime" column="today_run_time"/>
|
||||||
|
<result property="todayPieceCount" column="today_piece_count"/>
|
||||||
|
<result property="taskProgress" column="task_progress"/>
|
||||||
|
<result property="batchCode" column="batch_code"/>
|
||||||
|
<result property="collectTime" column="collect_time"/>
|
||||||
|
<result property="refreshTime" column="refresh_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<resultMap id="BoardMachineCardResult" type="com.ktg.mes.board.domain.BoardMachineCard">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="name" column="name"/>
|
||||||
|
<result property="model" column="model"/>
|
||||||
|
<result property="rawStatus" column="raw_status"/>
|
||||||
|
<result property="rawMode" column="raw_mode"/>
|
||||||
|
<result property="runtime" column="runtime"/>
|
||||||
|
<result property="output" column="output"/>
|
||||||
|
<result property="progress" column="progress"/>
|
||||||
|
<result property="workDate" column="work_date"/>
|
||||||
|
<result property="batchNo" column="batch_no"/>
|
||||||
|
<result property="planQty" column="plan_qty"/>
|
||||||
|
<result property="productModel" column="product_model"/>
|
||||||
|
<result property="color" column="color"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBoardOrderProgressColumns">
|
||||||
|
select progress_id, screen_id, screen_code, machinery_id, machinery_code, machinery_name, machinery_model, device_status,
|
||||||
|
run_mode, today_run_time, today_piece_count, task_progress, batch_code, collect_time, refresh_time,
|
||||||
|
remark, create_by, create_time, update_by, update_time
|
||||||
|
from board_order_progress
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByScreenIdAndMachineryCode" resultMap="BoardOrderProgressResult">
|
||||||
|
<include refid="selectBoardOrderProgressColumns"/>
|
||||||
|
where screen_id = #{screenId}
|
||||||
|
and machinery_code = #{machineryCode}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByScreenCodeAndMachineryCode" resultMap="BoardOrderProgressResult">
|
||||||
|
<include refid="selectBoardOrderProgressColumns"/>
|
||||||
|
where screen_code = #{screenCode}
|
||||||
|
and machinery_code = #{machineryCode}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByScreenId" resultMap="BoardOrderProgressResult">
|
||||||
|
<include refid="selectBoardOrderProgressColumns"/>
|
||||||
|
where screen_id = #{screenId}
|
||||||
|
order by machinery_code asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByScreenCode" resultMap="BoardOrderProgressResult">
|
||||||
|
<include refid="selectBoardOrderProgressColumns"/>
|
||||||
|
where screen_code = #{screenCode}
|
||||||
|
order by machinery_code asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMachineCardListByScreenId" resultMap="BoardMachineCardResult">
|
||||||
|
select p.machinery_id as id,
|
||||||
|
p.machinery_code as name,
|
||||||
|
ifnull(p.machinery_model, p.machinery_name) as model,
|
||||||
|
p.device_status as raw_status,
|
||||||
|
p.run_mode as raw_mode,
|
||||||
|
ifnull(p.today_run_time, '--') as runtime,
|
||||||
|
ifnull(p.today_piece_count, '--') as output,
|
||||||
|
ifnull(p.task_progress, '--') as progress,
|
||||||
|
ifnull(date_format(w.request_date, '%Y-%m-%d'), '--') as work_date,
|
||||||
|
ifnull(p.batch_code, '--') as batch_no,
|
||||||
|
ifnull(cast(w.quantity as char), '--') as plan_qty,
|
||||||
|
ifnull(w.product_spc, '--') as product_model,
|
||||||
|
ifnull(w.attr1, '--') as color,
|
||||||
|
ifnull(w.remark, '--') as remark
|
||||||
|
from board_order_progress p
|
||||||
|
left join pro_workorder w on w.batch_code = p.batch_code
|
||||||
|
where p.screen_id = #{screenId}
|
||||||
|
order by p.machinery_code asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMachineCardList" resultMap="BoardMachineCardResult">
|
||||||
|
select p.machinery_id as id,
|
||||||
|
p.machinery_code as name,
|
||||||
|
ifnull(p.machinery_model, p.machinery_name) as model,
|
||||||
|
p.device_status as raw_status,
|
||||||
|
p.run_mode as raw_mode,
|
||||||
|
ifnull(p.today_run_time, '--') as runtime,
|
||||||
|
ifnull(p.today_piece_count, '--') as output,
|
||||||
|
ifnull(p.task_progress, '--') as progress,
|
||||||
|
ifnull(date_format(w.request_date, '%Y-%m-%d'), '--') as work_date,
|
||||||
|
ifnull(p.batch_code, '--') as batch_no,
|
||||||
|
ifnull(cast(w.quantity as char), '--') as plan_qty,
|
||||||
|
ifnull(w.product_spc, '--') as product_model,
|
||||||
|
ifnull(w.attr1, '--') as color,
|
||||||
|
ifnull(w.remark, '--') as remark
|
||||||
|
from board_order_progress p
|
||||||
|
left join pro_workorder w on w.batch_code = p.batch_code
|
||||||
|
where p.screen_code = #{screenCode}
|
||||||
|
order by p.machinery_code asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.ktg.mes.board.domain.BoardOrderProgress" useGeneratedKeys="true" keyProperty="progressId">
|
||||||
|
insert into board_order_progress
|
||||||
|
(screen_id, screen_code, machinery_id, machinery_code, machinery_name, machinery_model, device_status, run_mode,
|
||||||
|
today_run_time, today_piece_count, task_progress, batch_code, collect_time, refresh_time, remark,
|
||||||
|
create_by, create_time, update_by, update_time)
|
||||||
|
values
|
||||||
|
(#{screenId}, #{screenCode}, #{machineryId}, #{machineryCode}, #{machineryName}, #{machineryModel}, #{deviceStatus}, #{runMode},
|
||||||
|
#{todayRunTime}, #{todayPieceCount}, #{taskProgress}, #{batchCode}, #{collectTime}, #{refreshTime}, #{remark},
|
||||||
|
#{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.ktg.mes.board.domain.BoardOrderProgress">
|
||||||
|
update board_order_progress
|
||||||
|
set machinery_id = #{machineryId},
|
||||||
|
machinery_name = #{machineryName},
|
||||||
|
machinery_model = #{machineryModel},
|
||||||
|
device_status = #{deviceStatus},
|
||||||
|
run_mode = #{runMode},
|
||||||
|
today_run_time = #{todayRunTime},
|
||||||
|
today_piece_count = #{todayPieceCount},
|
||||||
|
task_progress = #{taskProgress},
|
||||||
|
batch_code = #{batchCode},
|
||||||
|
collect_time = #{collectTime},
|
||||||
|
refresh_time = #{refreshTime},
|
||||||
|
remark = #{remark},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where progress_id = #{progressId}
|
||||||
|
</update>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,112 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ktg.mes.board.mapper.BoardPointBindingMapper">
|
||||||
|
|
||||||
|
<resultMap id="BoardPointBindingResult" type="com.ktg.mes.board.domain.BoardPointBinding">
|
||||||
|
<result property="bindingId" column="binding_id"/>
|
||||||
|
<result property="screenId" column="screen_id"/>
|
||||||
|
<result property="screenCode" column="screen_code"/>
|
||||||
|
<result property="machineryId" column="machinery_id"/>
|
||||||
|
<result property="machineryCode" column="machinery_code"/>
|
||||||
|
<result property="bindingField" column="binding_field"/>
|
||||||
|
<result property="pointId" column="point_id"/>
|
||||||
|
<result property="pointCode" column="point_code"/>
|
||||||
|
<result property="pointName" column="point_name"/>
|
||||||
|
<result property="sortNum" column="sort_num"/>
|
||||||
|
<result property="enableFlag" column="enable_flag"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBoardPointBindingColumns">
|
||||||
|
select binding_id, screen_id, screen_code, machinery_id, machinery_code, binding_field, point_id, point_code, point_name,
|
||||||
|
sort_num, enable_flag, remark, create_by, create_time, update_by, update_time
|
||||||
|
from board_point_binding
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectBoardPointBindingList" parameterType="com.ktg.mes.board.domain.BoardPointBinding" resultMap="BoardPointBindingResult">
|
||||||
|
<include refid="selectBoardPointBindingColumns"/>
|
||||||
|
<where>
|
||||||
|
<if test="screenId != null">and screen_id = #{screenId}</if>
|
||||||
|
<if test="screenCode != null and screenCode != ''">and screen_code = #{screenCode}</if>
|
||||||
|
<if test="machineryCode != null and machineryCode != ''">and machinery_code = #{machineryCode}</if>
|
||||||
|
<if test="bindingField != null and bindingField != ''">and binding_field = #{bindingField}</if>
|
||||||
|
<if test="enableFlag != null and enableFlag != ''">and enable_flag = #{enableFlag}</if>
|
||||||
|
</where>
|
||||||
|
order by machinery_code asc, sort_num asc, binding_id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByScreenId" resultMap="BoardPointBindingResult">
|
||||||
|
<include refid="selectBoardPointBindingColumns"/>
|
||||||
|
where screen_id = #{screenId}
|
||||||
|
and enable_flag = 'Y'
|
||||||
|
order by machinery_code asc, sort_num asc, binding_id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByScreenCode" resultMap="BoardPointBindingResult">
|
||||||
|
<include refid="selectBoardPointBindingColumns"/>
|
||||||
|
where screen_code = #{screenCode}
|
||||||
|
and enable_flag = 'Y'
|
||||||
|
order by machinery_code asc, sort_num asc, binding_id asc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertBoardPointBinding" parameterType="com.ktg.mes.board.domain.BoardPointBinding" useGeneratedKeys="true" keyProperty="bindingId">
|
||||||
|
insert into board_point_binding
|
||||||
|
(screen_id, screen_code, machinery_id, machinery_code, binding_field, point_id, point_code, point_name, sort_num,
|
||||||
|
enable_flag, remark, create_by, create_time, update_by, update_time)
|
||||||
|
values
|
||||||
|
(#{screenId}, #{screenCode}, #{machineryId}, #{machineryCode}, #{bindingField}, #{pointId}, #{pointCode}, #{pointName}, #{sortNum},
|
||||||
|
#{enableFlag}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<insert id="batchInsertBoardPointBinding">
|
||||||
|
insert into board_point_binding
|
||||||
|
(screen_id, screen_code, machinery_id, machinery_code, binding_field, point_id, point_code, point_name, sort_num,
|
||||||
|
enable_flag, remark, create_by, create_time, update_by, update_time)
|
||||||
|
values
|
||||||
|
<foreach collection="list" item="item" separator=",">
|
||||||
|
(#{item.screenId}, #{item.screenCode}, #{item.machineryId}, #{item.machineryCode}, #{item.bindingField}, #{item.pointId},
|
||||||
|
#{item.pointCode}, #{item.pointName}, #{item.sortNum}, #{item.enableFlag}, #{item.remark},
|
||||||
|
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
|
||||||
|
</foreach>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateBoardPointBinding" parameterType="com.ktg.mes.board.domain.BoardPointBinding">
|
||||||
|
update board_point_binding
|
||||||
|
set screen_id = #{screenId},
|
||||||
|
screen_code = #{screenCode},
|
||||||
|
machinery_id = #{machineryId},
|
||||||
|
machinery_code = #{machineryCode},
|
||||||
|
binding_field = #{bindingField},
|
||||||
|
point_id = #{pointId},
|
||||||
|
point_code = #{pointCode},
|
||||||
|
point_name = #{pointName},
|
||||||
|
sort_num = #{sortNum},
|
||||||
|
enable_flag = #{enableFlag},
|
||||||
|
remark = #{remark},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where binding_id = #{bindingId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteBoardPointBindingByBindingIds">
|
||||||
|
delete from board_point_binding
|
||||||
|
where binding_id in
|
||||||
|
<foreach collection="array" item="bindingId" open="(" separator="," close=")">
|
||||||
|
#{bindingId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByScreenCode">
|
||||||
|
delete from board_point_binding where screen_code = #{screenCode}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteByScreenId">
|
||||||
|
delete from board_point_binding where screen_id = #{screenId}
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,92 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.ktg.mes.board.mapper.BoardScreenInfoMapper">
|
||||||
|
|
||||||
|
<resultMap id="BoardScreenInfoResult" type="com.ktg.mes.board.domain.BoardScreenInfo">
|
||||||
|
<result property="screenId" column="screen_id"/>
|
||||||
|
<result property="screenCode" column="screen_code"/>
|
||||||
|
<result property="ownerName" column="owner_name"/>
|
||||||
|
<result property="workshopId" column="workshop_id"/>
|
||||||
|
<result property="workshopCode" column="workshop_code"/>
|
||||||
|
<result property="workshopName" column="workshop_name"/>
|
||||||
|
<result property="deviceTotal" column="device_total"/>
|
||||||
|
<result property="onlineCount" column="online_count"/>
|
||||||
|
<result property="runningCount" column="running_count"/>
|
||||||
|
<result property="stopCount" column="stop_count"/>
|
||||||
|
<result property="startRate" column="start_rate"/>
|
||||||
|
<result property="latestRefreshTime" column="latest_refresh_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectBoardScreenInfoColumns">
|
||||||
|
select screen_id, screen_code, owner_name, workshop_id, workshop_code, workshop_name,
|
||||||
|
device_total, online_count, running_count, stop_count, start_rate, latest_refresh_time,
|
||||||
|
remark, create_by, create_time, update_by, update_time
|
||||||
|
from board_screen_info
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectByScreenCode" resultMap="BoardScreenInfoResult">
|
||||||
|
<include refid="selectBoardScreenInfoColumns"/>
|
||||||
|
where screen_code = #{screenCode}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectByScreenId" resultMap="BoardScreenInfoResult">
|
||||||
|
<include refid="selectBoardScreenInfoColumns"/>
|
||||||
|
where screen_id = #{screenId}
|
||||||
|
limit 1
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectBoardScreenInfoList" parameterType="com.ktg.mes.board.domain.BoardScreenInfo" resultMap="BoardScreenInfoResult">
|
||||||
|
<include refid="selectBoardScreenInfoColumns"/>
|
||||||
|
<where>
|
||||||
|
<if test="screenCode != null and screenCode != ''">and screen_code like concat('%', #{screenCode}, '%')</if>
|
||||||
|
<if test="ownerName != null and ownerName != ''">and owner_name like concat('%', #{ownerName}, '%')</if>
|
||||||
|
<if test="workshopId != null">and workshop_id = #{workshopId}</if>
|
||||||
|
<if test="workshopCode != null and workshopCode != ''">and workshop_code = #{workshopCode}</if>
|
||||||
|
<if test="workshopName != null and workshopName != ''">and workshop_name like concat('%', #{workshopName}, '%')</if>
|
||||||
|
</where>
|
||||||
|
order by update_time desc, create_time desc, screen_id desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insert" parameterType="com.ktg.mes.board.domain.BoardScreenInfo" useGeneratedKeys="true" keyProperty="screenId">
|
||||||
|
insert into board_screen_info
|
||||||
|
(screen_code, owner_name, workshop_id, workshop_code, workshop_name, device_total, online_count, running_count,
|
||||||
|
stop_count, start_rate, latest_refresh_time, remark, create_by, create_time, update_by, update_time)
|
||||||
|
values
|
||||||
|
(#{screenCode}, #{ownerName}, #{workshopId}, #{workshopCode}, #{workshopName}, #{deviceTotal}, #{onlineCount}, #{runningCount},
|
||||||
|
#{stopCount}, #{startRate}, #{latestRefreshTime}, #{remark}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="update" parameterType="com.ktg.mes.board.domain.BoardScreenInfo">
|
||||||
|
update board_screen_info
|
||||||
|
set owner_name = #{ownerName},
|
||||||
|
workshop_id = #{workshopId},
|
||||||
|
workshop_code = #{workshopCode},
|
||||||
|
workshop_name = #{workshopName},
|
||||||
|
device_total = #{deviceTotal},
|
||||||
|
online_count = #{onlineCount},
|
||||||
|
running_count = #{runningCount},
|
||||||
|
stop_count = #{stopCount},
|
||||||
|
start_rate = #{startRate},
|
||||||
|
latest_refresh_time = #{latestRefreshTime},
|
||||||
|
remark = #{remark},
|
||||||
|
update_by = #{updateBy},
|
||||||
|
update_time = #{updateTime}
|
||||||
|
where screen_id = #{screenId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteByScreenIds">
|
||||||
|
delete from board_screen_info
|
||||||
|
where screen_id in
|
||||||
|
<foreach collection="array" item="screenId" open="(" separator="," close=")">
|
||||||
|
#{screenId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="cycleType" column="cycle_type" />
|
<result property="cycleType" column="cycle_type" />
|
||||||
<result property="cycleCount" column="cycle_count" />
|
<result property="cycleCount" column="cycle_count" />
|
||||||
<result property="status" column="status" />
|
<result property="status" column="status" />
|
||||||
|
<result property="machineryCodes" column="machinery_codes" />
|
||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="attr1" column="attr1" />
|
<result property="attr1" column="attr1" />
|
||||||
<result property="attr2" column="attr2" />
|
<result property="attr2" column="attr2" />
|
||||||
@ -26,7 +27,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDvCheckPlanVo">
|
<sql id="selectDvCheckPlanVo">
|
||||||
select plan_id, plan_code, plan_name,plan_type, start_date, end_date, cycle_type, cycle_count,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_plan
|
select p.plan_id, p.plan_code, p.plan_name, p.plan_type, p.start_date, p.end_date, p.cycle_type, p.cycle_count, p.status,
|
||||||
|
(select group_concat(distinct m.machinery_code order by m.machinery_code separator ',')
|
||||||
|
from dv_check_machinery m
|
||||||
|
where m.plan_id = p.plan_id) as machinery_codes,
|
||||||
|
p.remark, p.attr1, p.attr2, p.attr3, p.attr4, p.create_by, p.create_time, p.update_by, p.update_time
|
||||||
|
from dv_check_plan p
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDvCheckPlanList" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult">
|
<select id="selectDvCheckPlanList" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult">
|
||||||
|
|||||||
@ -37,7 +37,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="selectDvMachineryList" parameterType="DvMachinery" resultMap="DvMachineryResult">
|
<select id="selectDvMachineryList" parameterType="DvMachinery" resultMap="DvMachineryResult">
|
||||||
<include refid="selectDvMachineryVo"/>
|
<include refid="selectDvMachineryVo"/>
|
||||||
<where>
|
<where>
|
||||||
<if test="machineryCode != null and machineryCode != ''"> and machinery_code = #{machineryCode}</if>
|
<if test="machineryCode != null and machineryCode != ''"> and machinery_code like concat('%', #{machineryCode}, '%')</if>
|
||||||
<if test="machineryName != null and machineryName != ''"> and machinery_name like concat('%', #{machineryName}, '%')</if>
|
<if test="machineryName != null and machineryName != ''"> and machinery_name like concat('%', #{machineryName}, '%')</if>
|
||||||
<if test="machineryBrand != null and machineryBrand != ''"> and machinery_brand = #{machineryBrand}</if>
|
<if test="machineryBrand != null and machineryBrand != ''"> and machinery_brand = #{machineryBrand}</if>
|
||||||
<if test="machinerySpec != null and machinerySpec != ''"> and machinery_spec = #{machinerySpec}</if>
|
<if test="machinerySpec != null and machinerySpec != ''"> and machinery_spec = #{machinerySpec}</if>
|
||||||
|
|||||||
Reference in New Issue
Block a user