diff --git a/ZR.Admin.WebApi/Controllers/mes/md/WorkshopController.cs b/ZR.Admin.WebApi/Controllers/mes/md/WorkshopController.cs new file mode 100644 index 00000000..2af23df8 --- /dev/null +++ b/ZR.Admin.WebApi/Controllers/mes/md/WorkshopController.cs @@ -0,0 +1,77 @@ +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; + +namespace ZR.Admin.WebApi.Controllers.mes.md +{ + [Route("mes/md/workshop")] + public class WorkshopController : BaseController + { + IMdWorkshopService mdWorkshopService; + + public WorkshopController(IMdWorkshopService mdWorkshopService) + { + this.mdWorkshopService = mdWorkshopService; + } + /// + /// 获取车间列表信息 + /// + /// + /// + /// + /// + /// + /// + [HttpGet("list")] + public IActionResult List(int pageNum, int pageSize, string workshopId = "", string workshopName = "", string workshopPosition = "") + { + + (int, List) data = mdWorkshopService.GetAll(workshopId, workshopName, workshopPosition, pageNum, pageSize); + + return ToResponse(new ApiResult(200, "success", data)); + + } + /// + /// 插入车间 + /// + /// + /// + [HttpPost("addWorkshop")] + public IActionResult AddWorkshop([FromBody] MdWorkshop workshop) + { + if (workshop != null) + workshop.ToCreate(HttpContext); + int result = mdWorkshopService.AddWorkshop(workshop); + return SUCCESS(result); + } + + + [HttpPost("updateWorkshop")] + public IActionResult UpdateWorkshop([FromBody] MdWorkshop workshop) + { + + int result = mdWorkshopService.UpdateWorkshop(workshop); + return SUCCESS(result); + } + + + [HttpPost("delWorkshop")] + public IActionResult deleteWorkshop([FromBody] List ids) + { + if (ids != null) + { + int result = mdWorkshopService.deleteWorkshop(ids.ToArray()); + return ToResponse(result); + } + return null; + } + + + + + } +} diff --git a/ZR.Service/mes/md/IService/IMdWorkshopService.cs b/ZR.Service/mes/md/IService/IMdWorkshopService.cs new file mode 100644 index 00000000..37ab9afc --- /dev/null +++ b/ZR.Service/mes/md/IService/IMdWorkshopService.cs @@ -0,0 +1,19 @@ +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 IMdWorkshopService + { + int AddWorkshop(MdWorkshop workshop); + + public (int, List) GetAll(string workshopId, string workshopName, string workshopPosition, int pageNum, int pageSize); + public int UpdateWorkshop(MdWorkshop workshop); + + public int deleteWorkshop(int[] ids); + } +} diff --git a/ZR.Service/mes/md/MdProductDefineService.cs b/ZR.Service/mes/md/MdProductDefineService.cs index 2e2114c7..c97cdc12 100644 --- a/ZR.Service/mes/md/MdProductDefineService.cs +++ b/ZR.Service/mes/md/MdProductDefineService.cs @@ -64,8 +64,8 @@ namespace ZR.Service.mes.md public MdProductDefine GetProductDefinebyPK(int measure) { - MdProductDefine product=GetId(measure); - MdUnit unit= Context.Queryable().Where(it=>it.MeasureId == product.ProductUnit).First(); + MdProductDefine product=GetId(measure); + MdUnit unit = Context.Queryable().Where(it=>it.MeasureId == product.ProductUnit).First(); product.ProductUnitName= unit.MeasureName; return product; } @@ -86,7 +86,7 @@ namespace ZR.Service.mes.md return Insert(jo); } - public int UpdateProductDefine(MdUnit paramss) + public int UpdateProductDefine(MdWorkshop paramss) { throw new NotImplementedException(); } diff --git a/ZR.Service/mes/md/MdWorkshopService.cs b/ZR.Service/mes/md/MdWorkshopService.cs new file mode 100644 index 00000000..03a47c92 --- /dev/null +++ b/ZR.Service/mes/md/MdWorkshopService.cs @@ -0,0 +1,53 @@ +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 System.Xml.Linq; +using ZR.Model.mes.md; +using ZR.Model.mes.md.DTO; +using ZR.Service.mes.md.IService; +using static Org.BouncyCastle.Crypto.Engines.SM2Engine; + +namespace ZR.Service.mes.md +{ + [AppService(ServiceType = typeof(IMdWorkshopService), ServiceLifetime = LifeTime.Transient)] + public class MdWorkshopService : BaseService, IMdWorkshopService + { + public int AddWorkshop(MdWorkshop workshop) + { + return Add(workshop); + + + } + + public int deleteWorkshop(int[] ids) + { + return Delete(ids); + } + + public (int, List) GetAll(string workshopId, string workshopName, string workshopPosition, int pageNum, int pageSize) + { + int totalNum = 0; + var predicate = Expressionable.Create() + .AndIF(!string.IsNullOrEmpty(workshopId), it => it.WorkshopId.Contains(workshopId)) + .AndIF(!string.IsNullOrEmpty(workshopName), it => it.WorkshopName.Contains(workshopName)) + .AndIF(!string.IsNullOrEmpty(workshopPosition), it => it.WorkshopPosition.Contains(workshopPosition)) + .ToExpression(); + + + List data = Context.Queryable().Where(predicate).ToPageList(pageNum, pageSize, ref totalNum); + + return (totalNum, data); + } + + public int UpdateWorkshop(MdWorkshop workshop) + { + return Update(workshop, true); + } + + } +} diff --git a/ZR.Vue/package.json b/ZR.Vue/package.json index 87c3a419..c6cf955d 100644 --- a/ZR.Vue/package.json +++ b/ZR.Vue/package.json @@ -48,7 +48,9 @@ "vue-router": "3.4.9", "vue-seamless-scroll": "^1.1.23", "vuedraggable": "2.20.0", - "vuex": "3.6.0" + "vuex": "3.6.0", + "vxe-table": "^3.6.13", + "xe-utils": "^3.5.11" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.4", diff --git a/ZR.Vue/src/api/basisManagement/workshop.js b/ZR.Vue/src/api/basisManagement/workshop.js new file mode 100644 index 00000000..f37546ac --- /dev/null +++ b/ZR.Vue/src/api/basisManagement/workshop.js @@ -0,0 +1,39 @@ +import request from '@/utils/request' +import { downFile } from '@/utils/request' + +export function getWorkshopList(query) { + return request({ + url: '/mes/md/workshop/list', + method: 'get', + params: query, + }) +} + +export function insertworkshop(data) { + return request({ + url: '/mes/md/workshop/addWorkshop', + method: 'post', + data: data, + contextType:"application/json" + }) +} + + +export function updateWorkshop(data) { + return request({ + url: '/mes/md/workshop/updateWorkshop', + method: 'post', + data: data, + contextType:"application/json" + }) +} + + +export function delWorkshop(data) { + return request({ + url: '/mes/md/workshop/delWorkshop', + method: 'post', + data: data, + contextType:"application/json" + }) +} diff --git a/ZR.Vue/src/main.js b/ZR.Vue/src/main.js index 4d874f35..37bf2f09 100644 --- a/ZR.Vue/src/main.js +++ b/ZR.Vue/src/main.js @@ -35,6 +35,11 @@ import UploadFile from '@/components/FileUpload/index'; // 字典数据组件 import DictData from '@/components/DictData' +import VXETable from 'vxe-table' +import 'vxe-table/lib/style.css' + + + // 全局方法挂载 Vue.prototype.getDicts = getDicts Vue.prototype.getConfigKey = getConfigKey @@ -73,6 +78,7 @@ Vue.use(plugins) Vue.use(Element, { size: Cookies.get('size') || 'small' // set element-ui default size }) +Vue.use(VXETable) diff --git a/ZR.Vue/src/views/basisManagement/workshop.vue b/ZR.Vue/src/views/basisManagement/workshop.vue index 90478e92..8e44408c 100644 --- a/ZR.Vue/src/views/basisManagement/workshop.vue +++ b/ZR.Vue/src/views/basisManagement/workshop.vue @@ -1,17 +1,282 @@ - + - + + + + + + + + + + + + + + + + + + 增加 + + + 修改 + + + 删除 + + + + + + + + + + + + + + + + 修改 + 删除 + + + + + + + + + + + + + + + + + + + + - +