增加工位路线模块,关联工序

master
wg 4 weeks ago
parent c85e3e704d
commit 761440b8d6

@ -0,0 +1,159 @@
package com.ruoyi.web.controller.nanjing;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
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.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.nanjing.domain.ProcessRoute;
import com.ruoyi.nanjing.service.IProcessRouteService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 线Controller
*
* @author limy
* @date 2024-10-18
*/
@Controller
@RequestMapping("/nanjing/ProcessRoute")
public class ProcessRouteController extends BaseController
{
private String prefix = "nanjing/ProcessRoute";
@Autowired
private IProcessRouteService processRouteService;
@RequiresPermissions("nanjing:ProcessRoute:view")
@GetMapping()
public String ProcessRoute()
{
return prefix + "/ProcessRoute";
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ProcessRoute processRoute)
{
startPage();
List<ProcessRoute> list = processRouteService.selectProcessRouteList(processRoute);
return getDataTable(list);
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:view")
@GetMapping("/detail/{RouteId}")
public String detail(@PathVariable("RouteId") Long RouteId, ModelMap mmap) {
ProcessRoute processRoute = processRouteService.selectProcessRouteById(RouteId);
mmap.put("processRoute", processRoute);
return prefix + "/detail";
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:export")
@Log(title = "工艺路线", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ProcessRoute processRoute)
{
List<ProcessRoute> list = processRouteService.selectProcessRouteList(processRoute);
ExcelUtil<ProcessRoute> util = new ExcelUtil<ProcessRoute>(ProcessRoute.class);
return util.exportExcel(list, "ProcessRoute");
}
/**
* 线
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:add")
@Log(title = "工艺路线", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ProcessRoute processRoute)
{
return toAjax(processRouteService.insertProcessRoute(processRoute));
}
/**
* 线
*/
@GetMapping("/edit/{RouteId}")
public String edit(@PathVariable("RouteId") Long RouteId, ModelMap mmap)
{
ProcessRoute processRoute = processRouteService.selectProcessRouteById(RouteId);
mmap.put("processRoute", processRoute);
return prefix + "/edit";
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:edit")
@Log(title = "工艺路线", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ProcessRoute processRoute)
{
return toAjax(processRouteService.updateProcessRoute(processRoute));
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:remove")
@Log(title = "工艺路线", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(processRouteService.deleteProcessRouteByIds(ids));
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:addStation")
@Log(title = "工艺路线", businessType = BusinessType.INSERT)
@PostMapping("/addStation")
@ResponseBody
public AjaxResult addStation(Long routeId, Long[] stationIds) {
return toAjax(processRouteService.insertProcessRouteStation(routeId, stationIds));
}
/**
* 线
*/
@RequiresPermissions("nanjing:ProcessRoute:removeStation")
@Log(title = "工艺路线", businessType = BusinessType.DELETE)
@PostMapping("/removeStation")
@ResponseBody
public AjaxResult removeStation(Long routeId, Long stationId) {
return toAjax(processRouteService.deleteProcessRouteStation(routeId, stationId));
}
}

@ -6,9 +6,9 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:sqlserver://127.0.0.1:1433;SelectMethod=cursor;DatabaseName=JYD_shengjie
url: jdbc:sqlserver://119.45.202.115;SelectMethod=cursor;DatabaseName=JYD_shengjie
username: sa
password: 123456
password: haiwei@123
# master:
# url: jdbc:sqlserver://192.168.3.109:1433;SelectMethod=cursor;DatabaseName=JYD_shengjie
# username: sa

@ -0,0 +1,202 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增危库信息')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-storeInfo-add">
<div class="form-group">
<label class="col-sm-3 control-label">危库编号:</label>
<div class="col-sm-8">
<input name="storeCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">危库名称:</label>
<div class="col-sm-8">
<input name="storeName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">危库面积 ㎡:</label>
<div class="col-sm-8">
<input name="storeVolume" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">危库描述:</label>
<div class="col-sm-8">
<input name="storeDescribe" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">危库类别:</label>
<div class="col-sm-8">
<select name="storeType" class="form-control m-b" th:with="type=${@materialTypeService.selectFirstMaterialType()}">
<option th:each="dict : ${type}" th:text="${dict.materialtypeName}" th:value="${dict.materialtypeCode}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">容积阈值:</label>
<div class="col-sm-8">
<input name="thresholdValue" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否标识:</label>
<div class="col-sm-8">
<select name="isFlag" class="form-control m-b" th:with="type=${@dict.getType('is_Flag')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">货物体积:</label>
<div class="col-sm-8">
<input name="volume" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<input name="remark" class="form-control" type="text">
</div>
</div>
<!--<div class="form-group">
<label class="col-sm-3 control-label">创建人:</label>
<div class="col-sm-8">
<input name="createdBy" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">创建时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="createdTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">更新人:</label>
<div class="col-sm-8">
<input name="updatedBy" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">更新时间:</label>
<div class="col-sm-8">
<div class="input-group date">
<input name="updatedTime" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>-->
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "base/storeInfo"
var prefix2 = ctx + "demo/table";
$("#form-storeInfo-add").validate({
focusCleanup: true
});
function submitHandler() {
checkItem();
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-storeInfo-add').serialize());
}
}
$("input[name='createdTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='updatedTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
var datas = [[${@dict.getType('sys_normal_disable')}]];
$(function() {
var options = {
url: prefix2 + "/list",
rememberSelected: true,
columns: [{
field: 'state',
checkbox: true
},
{
field : 'userId',
title : '用户ID'
},
{
field : 'userCode',
title : '用户编号'
},
{
field : 'userName',
title : '用户姓名'
},
{
field : 'userPhone',
title : '用户手机'
},
{
field : 'userEmail',
title : '用户邮箱'
},
{
field : 'userBalance',
title : '用户余额'
},
{
field: 'status',
title: '用户状态',
align: 'center',
formatter: function(value, row, index) {
return $.table.selectDictLabel(datas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs" href="#"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs" href="#"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
// 选中数据
function checkItem(){
// var arrays = $.table.selectColumns("userId");
var arrays = $.table.selectColumns("userId");
alert(arrays);
}
</script>
</body>
</html>

@ -0,0 +1,111 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('工艺路线列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>路线编号:</label>
<input type="text" name="RouteCode"/>
</li>
<li>
<label>路线名称:</label>
<input type="text" name="RouteName"/>
</li>
<li>
<label>是否启用:</label>
<input type="text" name="IsEnabled" placeholder="请输入是否启用"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="nanjing:ProcessRoute:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="nanjing:ProcessRoute:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="nanjing:ProcessRoute:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="nanjing:ProcessRoute:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('nanjing:ProcessRoute:edit')}]];
var removeFlag = [[${@permission.hasPermi('nanjing:ProcessRoute:remove')}]];
var prefix = ctx + "nanjing/ProcessRoute";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "工艺路线",
columns: [{
checkbox: true
},
{
field: 'routeId',
title: '工艺路线Id',
visible: false
},
{
field: 'routeCode',
title: '工艺路线编号'
},
{
field: 'routeName',
title: '工艺路线名称'
},
{
field: 'routeDescription',
title: '工艺路线说明'
},
{
field: 'remarks',
title: '工艺路线备注'
},
{
field: 'isEnabled',
title: '是否启用'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.routeId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.routeId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

@ -0,0 +1,194 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增工艺路线')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-ProcessRoute-add">
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线编号:</label>
<div class="col-sm-8">
<input name="RouteCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线名称:</label>
<div class="col-sm-8">
<input name="RouteName" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线说明:</label>
<div class="col-sm-8">
<input name="RouteDescription" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线备注:</label>
<div class="col-sm-8">
<input name="Remarks" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
<input name="IsEnabled" class="form-control" type="text">
</div>
</div>
<div class="container-div">
<div class="row">
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "nanjing/ProcessRoute"
var prefix2 = ctx + "nanjing/SubStation"
$("#form-ProcessRoute-add").validate({
focusCleanup: true
});
function submitHandler() {
checkItem();
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-ProcessRoute-add').serialize());
}
}
var editFlag = [[${@permission.hasPermi('nanjing:SubStation:edit')}]];
var removeFlag = [[${@permission.hasPermi('nanjing:SubStation:remove')}]];
var paramFlag = [[${@permission.hasPermi('nanjing:SubStation:param')}]];
// var datas = [[${@dict.getType('T_BD_SubStation')}]];
function shifou(isng){
if (isng==0){
return
}
}
$(function() {
var options = {
url: prefix2 + "/list",
createUrl: prefix2 + "/add",
updateUrl: prefix2 + "/edit/{id}",
removeUrl: prefix2 + "/remove",
exportUrl: prefix2 + "/export",
editParamUrl:prefix2+"/editParam/{id}",
modalName: "工位管理",
columns: [
{
checkbox: true
},
{
field: 'orderID',
title: '排序id'
},
{
field: 'stationCode',
title: '工位代码'
},
{
field: 'stationName',
title: '工位名称'
},
{
field: 'stationtype.typeName',
title: '工位类型'
},
{
field: 'paraCount',
title: '参数个数'
},
{
field: 'linetype.lineTypeName',
title: '线路名称'
},
{
field: 'isNGStation',
title: '是否ng工位',
align: 'center',
formatter:function (value, row, index){
if (value==1){
return "是";
}
else if(value==0){
return "否";
}
}
},
{
field: 'plcname',
title: 'PLC名称'
},
{
field: 'plcblock',
title: 'PLC块号'
},
{
field: 'isShow',
title: '是否启用MES控制',
formatter:function (value, row, index){
if (value==1){
return "是";
}
else if(value==0){
return "否";
}
}
},
// {新增字段 PreStationID 自连接查询 返回一个string },
{
field:'preStationID',
title:'上一个工位',
formatter:function (value,row,index){
if (value!=null){
var data2;
$.ajax({
url:prefix2+"/shangyi/?value="+value,
type:'get',
async : false,
success:function (result){
// console.log(result)
data2 = result;
}
})
return data2;
}
else if(value==null || value == undefined){
return "无";
}
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>修改</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
actions.push('<a class="btn btn-info btn-xs ' + paramFlag + '" href="javascript:void(0)" onclick="jmpParam(\'' + row.id + '\')"><i class="fa fa-anchor"></i>参数设置</a>');
return actions.join('');
}
}]
};
$.table.init(options);
console.log(options)
});
function jmpParam(id) {
var url = table.options.editParamUrl.replace("{id}", id);
// console.log(url);
$.modal.open("修改工位参数", url);
}
</script>
</body>
</html>

@ -0,0 +1,56 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改工艺路线')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-ProcessRoute-edit" th:object="${processRoute}">
<input name="RouteId" th:field="*{RouteId}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线编号:</label>
<div class="col-sm-8">
<input name="RouteCode" th:field="*{RouteCode}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线名称:</label>
<div class="col-sm-8">
<input name="RouteName" th:field="*{RouteName}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线说明:</label>
<div class="col-sm-8">
<input name="RouteDescription" th:field="*{RouteDescription}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">工艺路线备注:</label>
<div class="col-sm-8">
<input name="Remarks" th:field="*{Remarks}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否启用:</label>
<div class="col-sm-8">
<input name="IsEnabled" th:field="*{IsEnabled}" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "nanjing/ProcessRoute";
$("#form-ProcessRoute-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-ProcessRoute-edit').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,113 @@
package com.ruoyi.nanjing.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import java.util.List;
/**
* 线 ProcessRoute
*
* @author limy
* @date 2024-10-18
*/
public class ProcessRoute extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 工艺路线编号(主键,自增) */
private Long RouteId;
/** 工艺路线编号 */
@Excel(name = "工艺路线编号")
private String RouteCode;
/** 工艺路线名称 */
@Excel(name = "工艺路线名称")
private String RouteName;
/** 工艺路线说明 */
@Excel(name = "工艺路线说明")
private String RouteDescription;
/** 工艺路线备注 */
@Excel(name = "工艺路线备注")
private String Remarks;
/** 是否启用,默认启用 */
@Excel(name = "是否启用,默认启用")
private Long IsEnabled;
public void setRouteId(Long RouteId)
{
this.RouteId = RouteId;
}
public Long getRouteId()
{
return RouteId;
}
public void setRouteCode(String RouteCode)
{
this.RouteCode = RouteCode;
}
public String getRouteCode()
{
return RouteCode;
}
public void setRouteName(String RouteName)
{
this.RouteName = RouteName;
}
public String getRouteName()
{
return RouteName;
}
public void setRouteDescription(String RouteDescription)
{
this.RouteDescription = RouteDescription;
}
public String getRouteDescription()
{
return RouteDescription;
}
public void setRemarks(String Remarks)
{
this.Remarks = Remarks;
}
public String getRemarks()
{
return Remarks;
}
public void setIsEnabled(Long IsEnabled)
{
this.IsEnabled = IsEnabled;
}
public Long getIsEnabled()
{
return IsEnabled;
}
private List<TBdSubstation> stations;
public List<TBdSubstation> getStations() {
return stations;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("RouteId", getRouteId())
.append("RouteCode", getRouteCode())
.append("RouteName", getRouteName())
.append("RouteDescription", getRouteDescription())
.append("Remarks", getRemarks())
.append("IsEnabled", getIsEnabled())
.toString();
}
}

@ -0,0 +1,65 @@
package com.ruoyi.nanjing.domain;
/**
* 线
*
* @author limy
* @date 2024-10-18
*/
public class ProcessRouteStation {
private static final long serialVersionUID = 1L;
/** 工艺路线工序关联ID */
private Long routeStationId;
/** 工艺路线ID */
private Long routeId;
/** 工序ID */
private Long stationId;
/** 序号 */
private Integer sequence;
public Long getRouteStationId() {
return routeStationId;
}
public void setRouteStationId(Long routeStationId) {
this.routeStationId = routeStationId;
}
public Long getRouteId() {
return routeId;
}
public void setRouteId(Long routeId) {
this.routeId = routeId;
}
public Long getStationId() {
return stationId;
}
public void setStationId(Long stationId) {
this.stationId = stationId;
}
public Integer getSequence() {
return sequence;
}
public void setSequence(Integer sequence) {
this.sequence = sequence;
}
@Override
public String toString() {
return new StringBuilder().append(getClass().getSimpleName())
.append(" [").append("routeStationId=").append(routeStationId)
.append(", routeId=").append(routeId)
.append(", stationId=").append(stationId)
.append(", sequence=").append(sequence)
.append("]").toString();
}
}

@ -170,6 +170,14 @@ public class TBdSubstation extends BaseEntity
@Excel(name = "PLCBlock")
private Long PLCBlock;
private Integer Sequence;
public Integer getSequence() {
return Sequence;
}
public void setSequence(Integer Sequence) {
this.Sequence = Sequence;
}
public void setID(Long ID)
{
this.ID = ID;

@ -0,0 +1,80 @@
package com.ruoyi.nanjing.mapper;
import java.util.List;
import com.ruoyi.nanjing.domain.ProcessRoute;
import com.ruoyi.nanjing.domain.ProcessRouteStation;
/**
* 线Mapper
*
* @author limy
* @date 2024-10-18
*/
public interface ProcessRouteMapper
{
/**
* 线
*
* @param RouteId 线ID
* @return 线
*/
public ProcessRoute selectProcessRouteById(Long RouteId);
/**
* 线
*
* @param processRoute 线
* @return 线
*/
public List<ProcessRoute> selectProcessRouteList(ProcessRoute processRoute);
/**
* 线
*
* @param processRoute 线
* @return
*/
public int insertProcessRoute(ProcessRoute processRoute);
/**
* 线
*
* @param processRoute 线
* @return
*/
public int updateProcessRoute(ProcessRoute processRoute);
/**
* 线
*
* @param RouteId 线ID
* @return
*/
public int deleteProcessRouteById(Long RouteId);
/**
* 线
*
* @param RouteIds ID
* @return
*/
public int deleteProcessRouteByIds(String[] RouteIds);
/**
* 线
*
* @param processRouteStation 线
* @return
*/
public int insertProcessRouteStation(ProcessRouteStation processRouteStation);
/**
* 线
*
* @param processRouteStation 线
* @return
*/
public int deleteProcessRouteStation(ProcessRouteStation processRouteStation);
}

@ -0,0 +1,82 @@
package com.ruoyi.nanjing.service;
import java.util.List;
import com.ruoyi.nanjing.domain.ProcessRoute;
/**
* 线Service
*
* @author limy
* @date 2024-10-18
*/
public interface IProcessRouteService
{
/**
* 线
*
* @param RouteId 线ID
* @return 线
*/
public ProcessRoute selectProcessRouteById(Long RouteId);
/**
* 线
*
* @param processRoute 线
* @return 线
*/
public List<ProcessRoute> selectProcessRouteList(ProcessRoute processRoute);
/**
* 线
*
* @param processRoute 线
* @return
*/
public int insertProcessRoute(ProcessRoute processRoute);
/**
* 线
*
* @param processRoute 线
* @return
*/
public int updateProcessRoute(ProcessRoute processRoute);
/**
* 线
*
* @param ids ID
* @return
*/
public int deleteProcessRouteByIds(String ids);
/**
* 线
*
* @param RouteId 线ID
* @return
*/
public int deleteProcessRouteById(Long RouteId);
/**
* 线
*
* @param routeId 线ID
* @param stationIds ID
* @return
*/
public int insertProcessRouteStation(Long routeId, Long[] stationIds);
/**
* 线
*
* @param routeId 线ID
* @param stationId ID
* @return
*/
public int deleteProcessRouteStation(Long routeId, Long stationId);
}

@ -0,0 +1,130 @@
package com.ruoyi.nanjing.service.impl;
import java.util.List;
import com.ruoyi.nanjing.domain.ProcessRouteStation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.nanjing.mapper.ProcessRouteMapper;
import com.ruoyi.nanjing.domain.ProcessRoute;
import com.ruoyi.nanjing.service.IProcessRouteService;
import com.ruoyi.common.core.text.Convert;
/**
* 线Service
*
* @author limy
* @date 2024-10-18
*/
@Service
public class ProcessRouteServiceImpl implements IProcessRouteService
{
@Autowired
private ProcessRouteMapper processRouteMapper;
/**
* 线
*
* @param RouteId 线ID
* @return 线
*/
@Override
public ProcessRoute selectProcessRouteById(Long RouteId)
{
return processRouteMapper.selectProcessRouteById(RouteId);
}
/**
* 线
*
* @param processRoute 线
* @return 线
*/
@Override
public List<ProcessRoute> selectProcessRouteList(ProcessRoute processRoute)
{
return processRouteMapper.selectProcessRouteList(processRoute);
}
/**
* 线
*
* @param processRoute 线
* @return
*/
@Override
public int insertProcessRoute(ProcessRoute processRoute)
{
return processRouteMapper.insertProcessRoute(processRoute);
}
/**
* 线
*
* @param processRoute 线
* @return
*/
@Override
public int updateProcessRoute(ProcessRoute processRoute)
{
return processRouteMapper.updateProcessRoute(processRoute);
}
/**
* 线
*
* @param ids ID
* @return
*/
@Override
public int deleteProcessRouteByIds(String ids)
{
return processRouteMapper.deleteProcessRouteByIds(Convert.toStrArray(ids));
}
/**
* 线
*
* @param RouteId 线ID
* @return
*/
@Override
public int deleteProcessRouteById(Long RouteId)
{
return processRouteMapper.deleteProcessRouteById(RouteId);
}
/**
* 线
*
* @param routeId 线ID
* @param stationIds ID
* @return
*/
@Override
public int insertProcessRouteStation(Long routeId, Long[] stationIds) {
int result = 0;
for (Long stationId : stationIds) {
ProcessRouteStation processRouteStation = new ProcessRouteStation();
processRouteStation.setRouteId(routeId);
processRouteStation.setStationId(stationId);
processRouteStation.setSequence(0); // 默认序号,您可以根据实际情况进行调整
result += processRouteMapper.insertProcessRouteStation(processRouteStation);
}
return result;
}
/**
* 线
*
* @param routeId 线ID
* @param stationId ID
* @return
*/
@Override
public int deleteProcessRouteStation(Long routeId, Long stationId) {
ProcessRouteStation processRouteStation = new ProcessRouteStation();
processRouteStation.setRouteId(routeId);
processRouteStation.setStationId(stationId);
return processRouteMapper.deleteProcessRouteStation(processRouteStation);
}
}

@ -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.ruoyi.nanjing.mapper.ProcessRouteMapper">
<resultMap type="ProcessRoute" id="ProcessRouteResult">
<result property="RouteId" column="RouteId" />
<result property="RouteCode" column="RouteCode" />
<result property="RouteName" column="RouteName" />
<result property="RouteDescription" column="RouteDescription" />
<result property="Remarks" column="Remarks" />
<result property="IsEnabled" column="IsEnabled" />
</resultMap>
<sql id="selectProcessRouteVo">
select RouteId, RouteCode, RouteName, RouteDescription, Remarks, IsEnabled from ProcessRoute
</sql>
<select id="selectProcessRouteList" parameterType="ProcessRoute" resultMap="ProcessRouteResult">
<include refid="selectProcessRouteVo"/>
<where>
<if test="RouteCode != null and RouteCode != ''"> and RouteCode = #{RouteCode}</if>
<if test="RouteName != null and RouteName != ''"> and RouteName like ('%' + #{RouteName} + '%')</if>
<if test="IsEnabled != null "> and IsEnabled = #{IsEnabled}</if>
</where>
</select>
<!-- <select id="selectProcessRouteById" parameterType="Long" resultMap="ProcessRouteResult">-->
<!-- <include refid="selectProcessRouteVo"/>-->
<!-- where RouteId = #{RouteId}-->
<!-- </select>-->
<insert id="insertProcessRoute" parameterType="ProcessRoute">
insert into ProcessRoute
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="RouteId != null">RouteId,</if>
<if test="RouteCode != null">RouteCode,</if>
<if test="RouteName != null">RouteName,</if>
<if test="RouteDescription != null">RouteDescription,</if>
<if test="Remarks != null">Remarks,</if>
<if test="IsEnabled != null">IsEnabled,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="RouteId != null">#{RouteId},</if>
<if test="RouteCode != null">#{RouteCode},</if>
<if test="RouteName != null">#{RouteName},</if>
<if test="RouteDescription != null">#{RouteDescription},</if>
<if test="Remarks != null">#{Remarks},</if>
<if test="IsEnabled != null">#{IsEnabled},</if>
</trim>
</insert>
<update id="updateProcessRoute" parameterType="ProcessRoute">
update ProcessRoute
<trim prefix="SET" suffixOverrides=",">
<if test="RouteCode != null">RouteCode = #{RouteCode},</if>
<if test="RouteName != null">RouteName = #{RouteName},</if>
<if test="RouteDescription != null">RouteDescription = #{RouteDescription},</if>
<if test="Remarks != null">Remarks = #{Remarks},</if>
<if test="IsEnabled != null">IsEnabled = #{IsEnabled},</if>
</trim>
where RouteId = #{RouteId}
</update>
<delete id="deleteProcessRouteById" parameterType="Long">
delete from ProcessRoute where RouteId = #{RouteId}
</delete>
<delete id="deleteProcessRouteByIds" parameterType="String">
delete from ProcessRoute where RouteId in
<foreach item="RouteId" collection="array" open="(" separator="," close=")">
#{RouteId}
</foreach>
</delete>
<!-- 新增接口 -->
<!-- 添加工序到工艺路线 -->
<insert id="insertProcessRouteStation" parameterType="ProcessRouteStation">
insert into ProcessRouteStation(RouteId, StationID, Sequence)
values (#{RouteId}, #{StationID}, #{Sequence})
</insert>
<!-- 删除工艺路线中的工序 -->
<delete id="deleteProcessRouteStation" parameterType="ProcessRouteStation">
delete from ProcessRouteStation
where RouteId = #{RouteId} and StationID = #{StationID}
</delete>
<!-- 查询工艺路线及其关联的工序 -->
<select id="selectProcessRouteWithStations" parameterType="Long" resultMap="ProcessRouteStationResult">
select pr.RouteId, pr.RouteCode, pr.RouteName, pr.RouteDescription, pr.Remarks, pr.IsEnabled,
prs.Sequence, ss.*
from ProcessRoute pr
left join ProcessRouteStation prs on pr.RouteId = prs.RouteId
left join T_BD_SubStation ss on prs.StationID = ss.ID
where pr.RouteId = #{RouteId}
order by prs.Sequence
</select>
<!-- 工艺路线及其关联的工序结果映射 -->
<resultMap type="ProcessRoute" id="ProcessRouteStationResult" extends="ProcessRouteResult">
<collection property="stations" ofType="TBdSubStation">
<id column="StationID" property="ID"/>
<result column="StationCode" property="StationCode"/>
<result column="StationType" property="StationType"/>
<result column="MachineID" property="MachineID"/>
<result column="UniteID" property="UniteID"/>
<result column="CustomerCode" property="CustomerCode"/>
<result column="StationName" property="StationName"/>
<result column="ParentStationID" property="ParentStationID"/>
<result column="ParentStationCode" property="ParentStationCode"/>
<result column="ParentStationName" property="ParentStationName"/>
<result column="PreStationID" property="PreStationID"/>
<result column="PreStationCode" property="PreStationCode"/>
<result column="Reamark" property="Reamark"/>
<result column="UserID" property="UserID"/>
<result column="UpdateTime" property="UpdateTime"/>
<result column="TableName" property="TableName"/>
<result column="IsSemi" property="IsSemi"/>
<result column="IsNGStation" property="IsNGStation"/>
<result column="HaveData" property="HaveData"/>
<result column="IsShow" property="IsShow"/>
<result column="UseFlag" property="UseFlag"/>
<result column="paraCount" property="paraCount"/>
<result column="OrderID" property="OrderID"/>
<result column="LimitID" property="LimitID"/>
<result column="ImageUrl" property="ImageUrl"/>
<result column="LineID" property="LineID"/>
<result column="PLCName" property="PLCName"/>
<result column="PLCBlock" property="PLCBlock"/>
<result column="Sequence" property="Sequence"/>
</collection>
</resultMap>
<!-- 查询工艺路线详情及其关联的工序 -->
<!-- <select id="selectProcessRouteById" parameterType="Long" resultMap="ProcessRouteStationResult">-->
<!-- <include refid="selectProcessRouteVo"/>-->
<!-- where pr.RouteId = #{RouteId}-->
<!-- </select>-->
<select id="selectProcessRouteById" parameterType="Long" resultMap="ProcessRouteStationResult">
select pr.RouteId, pr.RouteCode, pr.RouteName, pr.RouteDescription, pr.Remarks, pr.IsEnabled,
prs.Sequence, ss.*
from ProcessRoute pr
left join ProcessRouteStation prs on pr.RouteId = prs.RouteId
left join T_BD_SubStation ss on prs.StationID = ss.ID
where pr.RouteId = #{RouteId}
order by prs.Sequence
</select>
</mapper>
Loading…
Cancel
Save