工作单元关系确认
This commit is contained in:
73
ZR.Admin.WebApi/Controllers/mes/md/MdWorklineController.cs
Normal file
73
ZR.Admin.WebApi/Controllers/mes/md/MdWorklineController.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
using ZR.Service.MES.md.IService;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.mes.md
|
||||
{
|
||||
|
||||
[Route("mes/md/workline")]
|
||||
public class MdWorklineController : BaseController
|
||||
{
|
||||
IMdWorklineService worklineService;
|
||||
public MdWorklineController(IMdWorklineService worklineService)
|
||||
{
|
||||
this.worklineService = worklineService;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="pageNum"></param>
|
||||
/// <param name="pageSize"></param>
|
||||
/// <param name="deviceCode"></param>
|
||||
/// <param name="deviceName"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
public IActionResult List(int pageNum, int pageSize, string lineCode = "", string lineName = "")
|
||||
{
|
||||
(int, List<MdWorkline>) data = worklineService.GetAll(lineCode, lineName, pageNum, pageSize);
|
||||
return ToResponse(new ApiResult(200, "success", data));
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("addWorkline")]
|
||||
public IActionResult AddWorkline([FromBody] MdWorkline workline)
|
||||
{
|
||||
if (workline != null)
|
||||
workline.ToCreate(HttpContext);
|
||||
int result = worklineService.AddWorkline(workline);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
[HttpPost("updateWorkline")]
|
||||
public IActionResult UpdateWorkline([FromBody] MdWorkline workline)
|
||||
{
|
||||
if (workline != null)
|
||||
{
|
||||
workline.ToUpdate(HttpContext);
|
||||
}
|
||||
|
||||
int result = worklineService.UpdateWorkline(workline);
|
||||
return SUCCESS(result);
|
||||
}
|
||||
|
||||
|
||||
[HttpPost("delWorkline")]
|
||||
public IActionResult DelWorkline([FromBody] List<int> ids)
|
||||
{
|
||||
if (ids != null)
|
||||
{
|
||||
int result = worklineService.deleteWorkline(ids.ToArray());
|
||||
return ToResponse(result);
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,10 @@ namespace ZR.Model.mes.md
|
||||
[SugarColumn(ColumnName="line_name" )]
|
||||
public string LineName { get; set; }
|
||||
/// <summary>
|
||||
/// fk_工艺流程
|
||||
/// fk_工作车间
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="fk_tech_process_id" )]
|
||||
public int? FkTechProcessId { get; set; }
|
||||
[SugarColumn(ColumnName= "pk_workshop_id")]
|
||||
public int? FkWorkShopId { get; set; }
|
||||
/// <summary>
|
||||
/// 租户号
|
||||
///</summary>
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace ZR.Model.mes.md
|
||||
/// <summary>
|
||||
/// fk_工序id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName="fk_worksort_id" )]
|
||||
[SugarColumn(ColumnName= "fk_workline_id")]
|
||||
public int? FkWorksortId { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToOne, nameof(FkWorksortId))]
|
||||
|
||||
20
ZR.Service/mes/md/IService/IMdWorklineService.cs
Normal file
20
ZR.Service/mes/md/IService/IMdWorklineService.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md;
|
||||
|
||||
namespace ZR.Service.MES.md.IService
|
||||
{
|
||||
|
||||
public interface IMdWorklineService
|
||||
{
|
||||
int AddWorkline(MdWorkline workline);
|
||||
|
||||
public (int, List<MdWorkline>) GetAll(string lineCode, string lineName, int pageNum, int pageSize);
|
||||
public int UpdateWorkline(MdWorkline workline);
|
||||
|
||||
public int deleteWorkline(int[] ids);
|
||||
}
|
||||
}
|
||||
44
ZR.Service/mes/md/MdWorklineService.cs
Normal file
44
ZR.Service/mes/md/MdWorklineService.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using Infrastructure.Attribute;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using ZR.Model.mes.md;
|
||||
using ZR.Service.mes.md.IService;
|
||||
using ZR.Service.MES.md.IService;
|
||||
|
||||
namespace ZR.Service.MES.md
|
||||
{
|
||||
[AppService(ServiceType = typeof(IMdWorklineService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class MdWorklineService : BaseService<MdWorkline>, IMdWorklineService
|
||||
{
|
||||
int IMdWorklineService.AddWorkline(MdWorkline workline)
|
||||
{
|
||||
return Insert(workline);
|
||||
}
|
||||
|
||||
int IMdWorklineService.deleteWorkline(int[] ids)
|
||||
{
|
||||
return Delete(ids);
|
||||
}
|
||||
|
||||
(int, List<MdWorkline>) IMdWorklineService.GetAll(string lineCode, string lineName, int pageNum, int pageSize)
|
||||
{
|
||||
int totalNum = 0;
|
||||
var predicate = Expressionable.Create<MdWorkline>()
|
||||
.AndIF(!string.IsNullOrEmpty(lineCode), it => it.LineCode.Contains(lineCode))
|
||||
.AndIF(!string.IsNullOrEmpty(lineName), it => it.LineName.Contains(lineName))
|
||||
.ToExpression();
|
||||
List<MdWorkline> data = Context.Queryable<MdWorkline>().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum);
|
||||
return (totalNum, data);
|
||||
}
|
||||
|
||||
int IMdWorklineService.UpdateWorkline(MdWorkline workline)
|
||||
{
|
||||
return Update(workline, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
39
ZR.Vue/src/api/basisManagement/workLine.js
Normal file
39
ZR.Vue/src/api/basisManagement/workLine.js
Normal file
@@ -0,0 +1,39 @@
|
||||
import request from '@/utils/request'
|
||||
import { downFile } from '@/utils/request'
|
||||
|
||||
export function getWorklineList(query) {
|
||||
return request({
|
||||
url: '/mes/md/workline/list',
|
||||
method: 'get',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
export function insertworkline(data) {
|
||||
return request({
|
||||
url: '/mes/md/workline/addWorkline',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function updateWorkline(data) {
|
||||
return request({
|
||||
url: '/mes/md/workline/updateWorkline',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
export function delWorkline(data) {
|
||||
return request({
|
||||
url: '/mes/md/workline/delWorkline',
|
||||
method: 'post',
|
||||
data: data,
|
||||
contextType:"application/json"
|
||||
})
|
||||
}
|
||||
@@ -3,11 +3,11 @@
|
||||
<!-- 搜索部分 -->
|
||||
<div>
|
||||
<el-form :model="search" inline v-show="search.showSearch">
|
||||
<el-form-item label="设备编码 ">
|
||||
<el-input v-model="search.deviceCode" placeholder="输入设备编号"></el-input>
|
||||
<el-form-item label="线体编码 ">
|
||||
<el-input v-model="search.lineCode" placeholder="输入线体编号"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称 ">
|
||||
<el-input v-model="search.deviceName" placeholder="输入设备名称"></el-input>
|
||||
<el-form-item label="线体名称 ">
|
||||
<el-input v-model="search.lineName" placeholder="输入线体名称"></el-input>
|
||||
</el-form-item>
|
||||
<el-button icon="el-icon-search" circle @click="getList"></el-button>
|
||||
</el-form>
|
||||
@@ -40,14 +40,14 @@
|
||||
<vxe-table
|
||||
border
|
||||
ref="xTable1"
|
||||
:data="table.workshopList"
|
||||
:data="table.worklineList"
|
||||
:loading="table.loading"
|
||||
@checkbox-change="selectChangeEvent"
|
||||
:row-config="{ isHover: true }"
|
||||
>
|
||||
<vxe-column type="checkbox" width="60"></vxe-column>
|
||||
<vxe-column field="deviceCode" title="设备编码" sortable></vxe-column>
|
||||
<vxe-column field="deviceName" title="设备名称" sortable></vxe-column>
|
||||
<vxe-column field="lineCode" title="线体编码" sortable></vxe-column>
|
||||
<vxe-column field="lineName" title="线体名称" sortable></vxe-column>
|
||||
|
||||
<vxe-column title="操作" show-overflow>
|
||||
<template slot-scope="scope">
|
||||
@@ -70,11 +70,11 @@
|
||||
<!-- 弹窗-- 修改和删除 -->
|
||||
<el-dialog :title="DMLdialog.title" :visible.sync="DMLdialog.visiable" width="600px" append-to-body>
|
||||
<el-form ref="DMLdialog" :model="DMLdialog.form" label-width="150px" label-position="left" :rules="DMLdialog.rules">
|
||||
<el-form-item label="设备编码 " prop="deviceCode">
|
||||
<el-input v-model="DMLdialog.form.deviceCode" placeholder="输入设备编码"></el-input>
|
||||
<el-form-item label="线体编码 " prop="lineCode">
|
||||
<el-input v-model="DMLdialog.form.lineCode" placeholder="输入线体编码"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="设备名称 " prop="deviceName">
|
||||
<el-input v-model="DMLdialog.form.deviceName" placeholder="输入设备名称"></el-input>
|
||||
<el-form-item label="线体名称 " prop="lineName">
|
||||
<el-input v-model="DMLdialog.form.lineName" placeholder="输入线体名称"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
@@ -86,21 +86,21 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getDeviceList, insertDevice, updateDevice, delDevice } from '@/api/basisManagement/device.js'
|
||||
import { getWorklineList, insertworkline, updateWorkline, delWorkline } from '@/api/basisManagement/workLine.js'
|
||||
export default {
|
||||
name: 'workshop',
|
||||
name: 'workLine',
|
||||
data() {
|
||||
return {
|
||||
//搜索框配置
|
||||
search: {
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
lineCode: '',
|
||||
lineName: '',
|
||||
showSearch: true,
|
||||
},
|
||||
//表格
|
||||
table: {
|
||||
loading: true,
|
||||
workshopList: [],
|
||||
worklineList: [],
|
||||
},
|
||||
//分页
|
||||
pagination: {
|
||||
@@ -113,12 +113,12 @@ export default {
|
||||
title: '',
|
||||
visiable: false,
|
||||
form: {
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
lineCode: '',
|
||||
lineName: '',
|
||||
},
|
||||
rules: {
|
||||
deviceCode: [{ required: true, message: '设备编码不能为空', trigger: 'blur' }],
|
||||
deviceName: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
|
||||
lineCode: [{ required: true, message: '线体编码不能为空', trigger: 'blur' }],
|
||||
lineName: [{ required: true, message: '线体名称不能为空', trigger: 'blur' }],
|
||||
},
|
||||
},
|
||||
//修改按钮
|
||||
@@ -136,11 +136,11 @@ export default {
|
||||
getList() {
|
||||
const query = { ...this.search, ...this.pagination }
|
||||
delete query.showSearch
|
||||
getDeviceList(query).then((res) => {
|
||||
getWorklineList(query).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.table.loading = false
|
||||
this.pagination.total = res.data.item1
|
||||
this.table.workshopList = res.data.item2
|
||||
this.table.worklineList = res.data.item2
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -171,7 +171,7 @@ export default {
|
||||
//新增确认
|
||||
submitForm() {
|
||||
if (this.flag == 'update') {
|
||||
updateDevice(this.DMLdialog.form).then((res) => {
|
||||
updateWorkline(this.DMLdialog.form).then((res) => {
|
||||
if (res.code == 200 && res.data == 1) {
|
||||
this.$notify.success('修改成功')
|
||||
this.getList()
|
||||
@@ -182,7 +182,7 @@ export default {
|
||||
} else if (this.flag == 'add') {
|
||||
this.$refs['DMLdialog'].validate((valid) => {
|
||||
if (valid) {
|
||||
insertDevice(this.DMLdialog.form).then((res) => {
|
||||
insertworkline(this.DMLdialog.form).then((res) => {
|
||||
if (res.code == 200) {
|
||||
this.getList()
|
||||
this.DMLdialog.visiable = false
|
||||
@@ -199,8 +199,8 @@ export default {
|
||||
},
|
||||
reset() {
|
||||
this.DMLdialog.form = {
|
||||
deviceCode: '',
|
||||
deviceName: '',
|
||||
lineCode: '',
|
||||
lineName: '',
|
||||
}
|
||||
this.DMLdialog.form.reset()
|
||||
},
|
||||
@@ -210,14 +210,14 @@ export default {
|
||||
this.DMLdialog.visiable = true
|
||||
this.flag = 'update'
|
||||
if (!flag) {
|
||||
this.DMLdialog.form.deviceCode = row.deviceCode
|
||||
this.DMLdialog.form.deviceName = row.deviceName
|
||||
this.DMLdialog.form.lineCode = row.lineCode
|
||||
this.DMLdialog.form.lineName = row.lineName
|
||||
this.DMLdialog.form.id = row.id
|
||||
} else {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length == 1) {
|
||||
this.DMLdialog.form.deviceCode = records[0].deviceCode
|
||||
this.DMLdialog.form.deviceName = records[0].deviceName
|
||||
this.DMLdialog.form.lineCode = records[0].lineCode
|
||||
this.DMLdialog.form.lineName = records[0].lineName
|
||||
this.DMLdialog.form.id = records[0].id
|
||||
}
|
||||
}
|
||||
@@ -226,11 +226,11 @@ export default {
|
||||
deleteItem(flag, row) {
|
||||
if (!flag) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备名称为"' + row.deviceName + '"的数据项?')
|
||||
.confirm('是否确认删除线体名称为"' + row.lineName + '"的数据项?')
|
||||
.then(function () {
|
||||
const array = []
|
||||
array.push(row.id)
|
||||
return delDevice(array)
|
||||
return delWorkline(array)
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
@@ -241,9 +241,9 @@ export default {
|
||||
const records = this.$refs.xTable1.getCheckboxRecords()
|
||||
if (records.length > 0) {
|
||||
this.$modal
|
||||
.confirm('是否确认删除设备名称为"' + records.map((it) => it.deviceName) + '"的数据项?')
|
||||
.confirm('是否确认删除线体名称为"' + records.map((it) => it.lineName) + '"的数据项?')
|
||||
.then(function () {
|
||||
return delDevice(records.map((it) => it.id))
|
||||
return delWorkline(records.map((it) => it.id))
|
||||
})
|
||||
.then(() => {
|
||||
this.getList()
|
||||
Reference in New Issue
Block a user