瀏覽代碼

产线管理

master
Yanko 2 月之前
父節點
當前提交
321ea976df
共有 24 個文件被更改,包括 445 次插入1157 次删除
  1. +58
    -0
      backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
  2. +4
    -0
      backend/BPA.MES.Base.Application/Entitys/App/Pztj_LineDevicesEntity.cs
  3. +35
    -0
      backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineDeviceDto.cs
  4. +4
    -0
      backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineStepsDto.cs
  5. +6
    -0
      backend/BPA.MES.Base.Application/Services/ProductLineService/Services/IProductLineService.cs
  6. +40
    -2
      backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineService.cs
  7. +5
    -0
      backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineStepsService.cs
  8. +0
    -519
      frontend/dist/550.26374af7.async.js
  9. +0
    -6
      frontend/dist/715.8ca32649.async.js
  10. +0
    -82
      frontend/dist/865.5becc75b.async.js
  11. +2
    -2
      frontend/dist/index.html
  12. +0
    -1
      frontend/dist/p__craftInfo__pot.d395d8d9.async.js
  13. +0
    -2
      frontend/dist/p__deviceProductInfo__index.ab3fbfed.async.js
  14. +0
    -1
      frontend/dist/p__plantModel__process.ae647f4d.async.js
  15. +0
    -1
      frontend/dist/p__productLine__line.22ddcd1b.async.js
  16. +0
    -1
      frontend/dist/p__recipe__index.101f5df6.async.js
  17. +0
    -1
      frontend/dist/p__system__role__index.eede85e8.async.js
  18. +0
    -1
      frontend/dist/p__system__user__index.f6e08770.async.js
  19. +0
    -1
      frontend/dist/p__workInfo__index.8432356b.async.js
  20. +0
    -1
      frontend/dist/preload_helper.2b894109.js
  21. +0
    -301
      frontend/dist/umi.c553e74a.js
  22. +12
    -0
      frontend/src/api/productlineInfo/dto.d.ts
  23. +19
    -1
      frontend/src/api/productlineInfo/service.ts
  24. +260
    -234
      frontend/src/pages/productLine/line.tsx

+ 58
- 0
backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml 查看文件

@@ -435,6 +435,11 @@
产线设备
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Entitys.Pztj_LineDevicesEntity.StepId">
<summary>
工序Id
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Entitys.Pztj_LineStocksEntity">
<summary>
名 称 :产线料仓
@@ -6655,6 +6660,26 @@
产线设备
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceDto.StepId">
<summary>
产线工艺流程Id
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceBatchAddInput.Id">
<summary>
工艺流程主键
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceBatchAddInput.DeviceId">
<summary>
绑定设备
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceBatchAddInput.LineId">
<summary>
产线主键
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Services.ProductLineDeviceQueryInput">
<summary>
产线设备不分页
@@ -6670,6 +6695,11 @@
产线Id
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceQueryInput.StepId">
<summary>
产线工艺流程Id
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Services.ProductLineDeviceQueryPageInput">
<summary>
产线设备分页
@@ -6685,6 +6715,11 @@
产线Id
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceQueryPageInput.StepId">
<summary>
产线工艺流程Id
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Services.ProductLineDeviceDelInput">
<summary>
删除产线设备
@@ -6727,6 +6762,11 @@
</summary>
<example>设备描述</example>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineDeviceOutput.StepName">
<summary>
产线工艺流程名称
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Services.ProductLineDto">
<summary>
名 称 :产线管理
@@ -6880,6 +6920,11 @@
主键
</summary>
</member>
<member name="P:BPA.MES.Base.Application.Services.ProductLineStepsOutput.DeviceId">
<summary>
设备
</summary>
</member>
<member name="T:BPA.MES.Base.Application.Services.ProductLineStockDto">
<summary>
名 称 :
@@ -7146,6 +7191,13 @@
</summary>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.IProductLineService.AddBatchDevice(BPA.MES.Base.Application.Services.ProductLineDeviceBatchAddInput)">
<summary>
产线批量添加设备
</summary>
<param name="input"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.IProductLineService.DeleteDevice(BPA.MES.Base.Application.Services.ProductLineDeviceDelInput)">
<summary>
产线删除设备
@@ -7304,6 +7356,12 @@
</summary>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.ProductLineService.AddBatchDevice(BPA.MES.Base.Application.Services.ProductLineDeviceBatchAddInput)">
<summary>
产线添加设备
</summary>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.ProductLineService.DeleteDevice(BPA.MES.Base.Application.Services.ProductLineDeviceDelInput)">
<summary>
产线删除设备


+ 4
- 0
backend/BPA.MES.Base.Application/Entitys/App/Pztj_LineDevicesEntity.cs 查看文件

@@ -17,5 +17,9 @@
/// 产线设备
/// </summary>
public string DeviceId { get; set; }
/// <summary>
/// 工序Id
/// </summary>
public string StepId { get;set; }
}
}

+ 35
- 0
backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineDeviceDto.cs 查看文件

@@ -16,10 +16,32 @@
/// 产线设备
/// </summary>
public string DeviceId { get; set; }
/// <summary>
/// 产线工艺流程Id
/// </summary>
public string StepId { get; set; }
}
public class ProductLineDeviceAddInput: ProductLineDeviceDto {

}

public class ProductLineDeviceBatchAddInput
{
/// <summary>
/// 工艺流程主键
/// </summary>
public string Id { get; set; }
/// <summary>
/// 绑定设备
/// </summary>
public string[] DeviceId { get; set; }
/// <summary>
/// 产线主键
/// </summary>
public string LineId { get; set; }

}
/// <summary>
/// 产线设备不分页
@@ -34,6 +56,10 @@
/// 产线Id
/// </summary>
public string LineId { get; set; }
/// <summary>
/// 产线工艺流程Id
/// </summary>
public string StepId { get; set; }
}
/// <summary>
/// 产线设备分页
@@ -48,6 +74,11 @@
/// 产线Id
/// </summary>
public string LineId { get; set; }

/// <summary>
/// 产线工艺流程Id
/// </summary>
public string StepId { get; set; }
}
/// <summary>
/// 删除产线设备
@@ -86,5 +117,9 @@
/// </summary>
/// <example>设备描述</example>
public string Describe { get; set; }
/// <summary>
/// 产线工艺流程名称
/// </summary>
public string StepName { get; set; }
}
}

+ 4
- 0
backend/BPA.MES.Base.Application/Services/ProductLineService/Dtos/ProductLineStepsDto.cs 查看文件

@@ -89,6 +89,10 @@
/// 主键
/// </summary>
public string Id { get; set; }
/// <summary>
/// 设备
/// </summary>
public string[] DeviceId { get; set; }
}

}

+ 6
- 0
backend/BPA.MES.Base.Application/Services/ProductLineService/Services/IProductLineService.cs 查看文件

@@ -50,6 +50,12 @@
/// <returns></returns>
Task<bool> AddDevice(ProductLineDeviceAddInput input);
/// <summary>
/// 产线批量添加设备
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
Task<bool> AddBatchDevice(ProductLineDeviceBatchAddInput input);
/// <summary>
/// 产线删除设备
/// </summary>
/// <returns></returns>


+ 40
- 2
backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineService.cs 查看文件

@@ -1,4 +1,6 @@
namespace BPA.MES.Base.Application.Services
using ServiceStack;

namespace BPA.MES.Base.Application.Services
{
/// <summary>
/// 名 称 :产线服务
@@ -132,6 +134,40 @@
return await _dbContext.Insertable(entity).IgnoreColumns(ignoreNullColumn: true).ExecuteCommandIdentityIntoEntityAsync();
}
/// <summary>
/// 产线添加设备
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<bool> AddBatchDevice(ProductLineDeviceBatchAddInput input)
{

bool result = false;
List<Pztj_LineDevicesEntity> entitys = new();
foreach (var item in input.DeviceId)
{
Pztj_LineDevicesEntity entity = new();
entity.LineId = input.LineId;
entity.StepId = input.Id;
entity.DeviceId = item;
entitys.Add(entity);
}
try
{
_dbContext.Ado.BeginTran();
await _dbContext.Deleteable<Pztj_LineDevicesEntity>().Where(x => x.LineId == input.LineId && x.StepId==input.Id).ExecuteCommandAsync();
await _dbContext.Insertable(entitys).ExecuteCommandAsync();
_dbContext.Ado.CommitTran();
result = true;
}
catch (Exception ex)
{
_dbContext.Ado.RollbackTran();
throw Oops.Bah("保存失败!");
}
return result;
}
/// <summary>
/// 产线删除设备
/// </summary>
/// <returns></returns>
@@ -152,6 +188,7 @@
.LeftJoin<Pztj_DevicesInfoEntity>((a, b) => a.DeviceId == b.Id)
.WhereIF(!string.IsNullOrEmpty(input.Name), (a, b) => b.Name.Contains(input.Name))
.WhereIF(!string.IsNullOrEmpty(input.LineId), (a, b) => a.LineId == input.LineId)
.WhereIF(!string.IsNullOrEmpty(input.StepId), (a, b) => a.StepId == input.StepId)
.Select((a, b) => new ProductLineDeviceOutput
{
DeviceId = a.DeviceId,
@@ -160,7 +197,8 @@
Describe = b.Describe,
DeviceType = b.DeviceType,
Id = a.Id,
LineId = a.LineId
LineId = a.LineId,
StepId = a.StepId
}).
ToListAsync();
return output;


+ 5
- 0
backend/BPA.MES.Base.Application/Services/ProductLineService/Services/ProductLineStepsService.cs 查看文件

@@ -70,6 +70,11 @@ namespace BPA.MES.Base.Application.Services
{
var entity = await _dbContext.Queryable<ProductLineStepsEntity>().WhereIF(!string.IsNullOrEmpty(input.LineId),x=>x.LineId==input.LineId).OrderBy(x => x.Step).ToListAsync();
List<ProductLineStepsOutput> output = entity.Adapt<List<ProductLineStepsOutput>>();
foreach (var item in output)
{
var devicelist = await _dbContext.Queryable<Pztj_LineDevicesEntity>().Where(x => x.StepId==item.Id).ToListAsync();
item.DeviceId = devicelist.Select(e => e.DeviceId).ToArray();
}
return output;
}
/// <summary>


+ 0
- 519
frontend/dist/550.26374af7.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 6
frontend/dist/715.8ca32649.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 82
frontend/dist/865.5becc75b.async.js
文件差異過大導致無法顯示
查看文件


+ 2
- 2
frontend/dist/index.html 查看文件

@@ -5,10 +5,10 @@
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="/umi.54f62417.css">
<script src="/preload_helper.2b894109.js"></script>
<script src="/preload_helper.88a63e67.js"></script>
</head>
<body>
<div id="root"></div>
<script src="/umi.c553e74a.js"></script>
<script src="/umi.68d4bbe9.js"></script>
</body>
</html>

+ 0
- 1
frontend/dist/p__craftInfo__pot.d395d8d9.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 2
frontend/dist/p__deviceProductInfo__index.ab3fbfed.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__plantModel__process.ae647f4d.async.js 查看文件

@@ -1 +0,0 @@
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[988],{24493:function(I,f,e){var D=e(97857),o=e.n(D),a=e(56002);f.Z={Add:function(r){return(0,a.request)("/api/process/add",{method:"POST",data:o()({},r)})},Del:function(r){return(0,a.request)("/api/process/del",{method:"POST",data:o()({},r)})},Update:function(r){return(0,a.request)("/api/process/update",{method:"POST",data:o()({},r)})},Detail:function(r){return(0,a.request)("/api/process/detail?id=".concat(r),{method:"GET"})},List:function(r){return(0,a.request)("/api/process/list",{method:"POST",data:o()({},r)})},PagedList:function(r){return(0,a.request)("/api/process/pagedlist",{method:"POST",data:o()({},r)})},Selectlist:function(){return(0,a.request)("/api/process/selectlist",{method:"GET"})}}},60744:function(I,f,e){e.r(f);var D=e(15009),o=e.n(D),a=e(99289),u=e.n(a),r=e(5574),T=e.n(r),j=e(51042),v=e(86550),C=e(42075),R=e(86738),i=e(45360),B=e(14726),M=e(67294),L=e(27484),b=e.n(L),E=e(24493),_=e(85893);f.default=function(){var g=(0,M.useState)("table"),O=T()(g,2),p=O[0],c=O[1],P=(0,M.useRef)(),A=(0,M.useRef)(),h=function(){var t,n;(t=P.current)===null||t===void 0||t.resetFields(),(n=A.current)===null||n===void 0||n.reload()},S=[{title:"\u4E3B\u952E",dataIndex:"id",width:160,hideInForm:!0,hideInSearch:!0},{title:"\u540D\u79F0",dataIndex:"name",ellipsis:!0,width:120,formItemProps:{rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879!"}]}},{title:"\u7C7B\u578B",hideInDescriptions:!0,dataIndex:"processType",width:120,search:!1,valueEnum:{0:{text:"\u4EBA\u5DE5"},1:{text:"\u8BBE\u5907"}},formItemProps:{rules:[{required:!0,message:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879!"}]}},{title:"\u63CF\u8FF0",dataIndex:"des",search:!1},{title:"\u521B\u5EFA\u65F6\u95F4",dataIndex:"createTime",render:function(t,n){return(0,_.jsx)(_.Fragment,{children:b()(n.createTime).format("YYYY-MM-DD HH:mm:ss")})},search:!1,hideInForm:!0},{title:"\u64CD\u4F5C",valueType:"option",dataIndex:"id",render:function(t,n){return[(0,_.jsxs)(C.Z,{children:[(0,_.jsx)("a",{onClick:function(){var s;c("form"),(s=P.current)===null||s===void 0||s.setFieldsValue(n)},target:"_blank",rel:"noopener noreferrer",children:"\u7F16\u8F91"},+new Date+Math.random()),(0,_.jsx)(R.Z,{title:"\u786E\u5B9A\u8981\u5220\u9664\u6B64\u6761\u6570\u636E\u5417\uFF1F",onConfirm:function(){E.Z.Del(n).then(function(s){s.statusCode===200?(i.ZP.info("\u5220\u9664\u6210\u529F!"),h()):i.ZP.error(s.errors)})},onCancel:function(){i.ZP.info("\u5DF2\u53D6\u6D88\u5220\u9664")},okText:"\u786E\u8BA4",cancelText:"\u5173\u95ED",children:(0,_.jsx)("a",{children:"\u5220\u9664"})},"del")]},+new Date+Math.random())]}}];return(0,_.jsx)(_.Fragment,{children:(0,_.jsx)(v.Z,{columns:S,type:p,formRef:P,actionRef:A,onSubmit:function(t){console.log(t),p==="form"&&(t.id?E.Z.Update(t).then(function(n){n.statusCode===200?(i.ZP.info("\u66F4\u65B0\u6210\u529F!"),c("table"),h()):i.ZP.error(n.errors)}):E.Z.Add(t).then(function(n){n.statusCode===200?(i.ZP.info("\u65B0\u589E\u6210\u529F!"),c("table"),h()):i.ZP.error(n.errors)}))},form:{ignoreRules:!0,submitter:{onReset:function(){var t;(t=P.current)===null||t===void 0||t.resetFields(),c("table")},searchConfig:{resetText:p==="form"?"\u8FD4\u56DE":"\u91CD\u7F6E"}}},request:u()(o()().mark(function l(){var t,n,m,s=arguments;return o()().wrap(function(d){for(;;)switch(d.prev=d.next){case 0:return t=s.length>0&&s[0]!==void 0?s[0]:{},n={pageIndex:t.current||1,pageSize:t.pageSize||10,name:t.name||""},d.next=4,E.Z.PagedList(n);case 4:if(m=d.sent,m.statusCode!==200){d.next=9;break}return d.abrupt("return",{data:m.data.items,success:!0,total:m.data.total});case 9:return d.abrupt("return",{data:[],success:!1,total:0});case 10:case"end":return d.stop()}},l)})),pagination:{pageSize:10,showSizeChanger:!1},rowKey:"id",dateFormatter:"string",headerTitle:"\u5217\u8868",toolBarRender:function(){return[(0,_.jsxs)(B.ZP,{type:"primary",onClick:function(){c("form")},children:[(0,_.jsx)(j.Z,{}),"\u65B0\u5EFA"]},"3")]}})})}}}]);

+ 0
- 1
frontend/dist/p__productLine__line.22ddcd1b.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__recipe__index.101f5df6.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__system__role__index.eede85e8.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__system__user__index.f6e08770.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/p__workInfo__index.8432356b.async.js
文件差異過大導致無法顯示
查看文件


+ 0
- 1
frontend/dist/preload_helper.2b894109.js 查看文件

@@ -1 +0,0 @@
!function(){"use strict";var t="/".replace(/([^/])$/,"$1/"),e=location.pathname,n=e.startsWith(t)&&decodeURI("/".concat(e.slice(t.length)));if(n){var a=document,c=a.head,r=a.createElement.bind(a),i=function(t,e,n){var a,c=e.r[t]||(null===(a=Object.entries(e.r).find((function(e){var n=e[0];return new RegExp("^".concat(n.replace(/\/:[^/]+/g,"/[^/]+").replace("/*","/.+"),"$")).test(t)})))||void 0===a?void 0:a[1]);return null==c?void 0:c.map((function(t){var a=e.f[t][1],c=e.f[t][0];return{type:c.split(".").pop(),url:"".concat(n.publicPath).concat(c),attrs:[["data-".concat(e.b),"".concat(e.p,":").concat(a)]]}}))}(n,{"p":"ant-design-pro","b":"webpack","f":[["p__system__role__index.eede85e8.async.js",24],["p__deviceInfo__index.ff2808b7.async.js",36],["p__user__login__index.26100c69.chunk.css",37],["p__user__login__index.b934e735.async.js",37],["119.4e6a5656.async.js",119],["p__recipe__index.101f5df6.async.js",187],["222.4d9ce06a.async.js",222],["p__system__module__index.ef46db37.chunk.css",257],["p__system__module__index.4ef32e9c.async.js",257],["p__materials__index.0233f7a0.async.js",262],["t__plugin-layout__Layout.5012e1ab.chunk.css",301],["t__plugin-layout__Layout.bb77edb1.async.js",301],["390.c53868f3.async.js",390],["393.e127e60f.async.js",393],["p__deviceProductInfo__index.835c0c6c.chunk.css",402],["p__deviceProductInfo__index.ab3fbfed.async.js",402],["p__workInfo__index.8432356b.async.js",420],["p__welcome__index.dde73410.async.js",446],["p__final__index.0c5211d3.async.js",460],["p__system__user__index.695d982e.chunk.css",472],["p__system__user__index.f6e08770.async.js",472],["550.26374af7.async.js",550],["t__plugin-maxtabs__Layout.b832af3b.async.js",558],["563.9aeac478.async.js",563],["p__404.a52587bb.async.js",571],["635.dbb47eab.async.js",635],["715.8ca32649.async.js",715],["821.b970c16a.async.js",821],["865.5becc75b.async.js",865],["p__craftInfo__pot.b10f2cd8.chunk.css",869],["p__craftInfo__pot.d395d8d9.async.js",869],["p__plantModel__process.ae647f4d.async.js",988],["p__productLine__line.22ddcd1b.async.js",990]],"r":{"/*":[24,27],"/":[13,17,22,4,10,11,27,28],"/work":[4,6,13,16,21,27,22,10,11,28],"/user/login":[2,3],"/system/user":[4,19,20,21,27,22,10,11,28],"/system/role":[0,4,21,27,22,10,11,28],"/system/module":[4,7,8,21,27,22,10,11,28],"/wmx/deviceProduct":[4,14,15,21,27,22,10,11,28],"/wmx/deviceinfo":[1,4,21,27,22,10,11,28],"/base/process":[4,21,27,31,22,10,11,28],"/base/materials":[4,9,21,27,22,10,11,28],"/base/final":[4,18,21,23,27,22,10,11,28],"/base/line":[4,21,25,26,27,32,22,10,11,28],"/recipeCraft/recipe":[4,5,21,23,27,22,10,11,28],"/recipeCraft/pot":[4,13,21,25,27,29,30,22,10,11,28]}},{publicPath:"/"});null==i||i.forEach((function(t){var e,n=t.type,a=t.url;if("js"===n)(e=r("script")).src=a,e.async=!0;else{if("css"!==n)return;(e=r("link")).href=a,e.rel="preload",e.as="style"}t.attrs.forEach((function(t){e.setAttribute(t[0],t[1]||"")})),c.appendChild(e)}))}}();

+ 0
- 301
frontend/dist/umi.c553e74a.js
文件差異過大導致無法顯示
查看文件


+ 12
- 0
frontend/src/api/productlineInfo/dto.d.ts 查看文件

@@ -68,4 +68,16 @@ declare namespace productlineInfoTypes {
*/
id: string
}
/**
* 添加产线工序所需设备
*/
interface batchDevice{
id:string;
lineId:string;
deviceId:string[];
}
interface deviceQuery{
lineId:string,
stepId:string,
}
}

+ 19
- 1
frontend/src/api/productlineInfo/service.ts 查看文件

@@ -77,6 +77,24 @@ export default {
...parms,
},
});
}
},
// 产线添加设备
Batchdevice(parms: productlineInfoTypes.batchDevice) {
return request('/api/productline/addbatchdevice', {
method: 'POST',
data: {
...parms,
}
})
},
// 产线设备列表
devicelist(parms: productlineInfoTypes.deviceQuery) {
return request('/api/productline/devicelist', {
method: 'POST',
data: {
...parms
}
})
},
}


+ 260
- 234
frontend/src/pages/productLine/line.tsx 查看文件

@@ -38,7 +38,7 @@ export default () => {

const [deviceOpen, setDeviceOpen] = useState<boolean>(false)

const [selectProcess,setSelectProcess] =useState<any>(0)
const [selectProcess, setSelectProcess] = useState<any>(0)

const columns: ProColumns<productlineInfoTypes.output>[] = [
{
@@ -110,14 +110,9 @@ export default () => {
setFlowOpen(true)
setStepparams({ lineId: row.id })
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer">
配置工艺流程
</a>
<a onClick={() => {
// setDeviceOpen(true)
// setStepparams({ lineId: row.id })
}} key={+new Date() + Math.random()} target="_blank" rel="noopener noreferrer">
配置设备
配置工艺流程与设备
</a>
<Popconfirm
key="del"
title="确定要删除此条数据吗?"
@@ -166,9 +161,10 @@ export default () => {
const [proList, setProList] = useState<any[]>([]);
const [deviceList, setDeviceList] = useState<any[]>([]);
const [form] = Form.useForm();
const [deviceform] = Form.useForm();
const processIdFlag = Form.useWatch('processId', form);
useEffect(() => {
processAPI.List({name:''}).then((v: MyResponse.Content) => {
processAPI.List({ name: '' }).then((v: MyResponse.Content) => {
if (v.statusCode === 200) {
console.log('processAPI.List', v.data);
setProList(v.data)
@@ -264,176 +260,216 @@ export default () => {
</Button>,
]}
/>
<Modal open={flowOpen} maskClosable={false} footer={null} width={"50%"} height={"50%"} title='配置工艺流程' onOk={() => { setFlowOpen(false) }} onCancel={_ => setFlowOpen(false)}>
<Flex vertical={false} >
<div style={{ width: '300px', margin: 'auto' }}>
<Steps
progressDot
direction="vertical"
items={
processList?.map((element: any) => {
return { ...element, title: proList.find((x) => x.key == element.processId)?.value, status: 'finish', }
<Modal open={flowOpen} maskClosable={false} footer={null} width={"80%"} height={"80%"} title='配置工艺流程' onOk={() => { setFlowOpen(false) }} onCancel={_ => setFlowOpen(false)}>

})
}
/>
</div>
<div style={{ margin: "auto" }}>
<DragSortTable<productlinestepsTypes.base_dto>
style={{ width: '600px' }}
toolBarRender={() => [
<Button
key={new Date().toDateString()}
type="primary"
onClick={() => {
form.resetFields();

setFlowItemOpen(true)
}}
>
添加步骤
</Button>,
]}
actionRef={sortActionRef}

columns={[

{
title: '工序',
dataIndex: 'step',
align: 'center',
hideInSearch: true,
render: (dom, rowData, index) => {
return (
<span className="customRender">{`${index + 1}`}</span>
);
},
},
{
title: 'Id',
dataIndex: 'id',
align: 'center',
<DragSortTable<productlinestepsTypes.base_dto>
toolBarRender={() => [
<Button
key={new Date().toDateString()}
type="primary"
onClick={() => {
form.resetFields();

hideInSearch: true,
},
{
title: '工艺名称',
dataIndex: 'processId',
align: 'center',
hideInSearch: true,
render(dom, entity, index, action, schema) {
return <>{proList.find((x) => x.id == entity.processId)?.name}</>
},
},
{
title: '操作',
align: 'center',

valueType: 'option',

key: 'option',
render: (_, record, index, action) => [
<Space key={uuid()} size="middle">
<Button
key={uuid()}
type='primary' ghost
onClick={async () => {
// setIsModalOpen(true)
const copyFormData = JSON.parse(JSON.stringify(record));
form.setFieldsValue(copyFormData);
setFlowItemOpen(true)
// setIsSetpModalOpen(true);
}}
>
编辑
</Button>

<Popconfirm
key={uuid()}
title="确定要删除此条数据吗?"
onConfirm={() => {
const delData: productlinestepsTypes.delInput = {
id: record.id,
};
productlineInfoStepsAPI.Del(delData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
action?.reload();
}
});
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<Button type='primary' danger ghost>删除</Button>
</Popconfirm>
</Space>
],
},
]}
rowKey="step"
search={false}
pagination={{ pageSize: 100, showSizeChanger: false }}

params={stepparams}
request={async (params = {}) => {
// if (!params.lineId) {
// return {
// data: [],
// success: false,
// total: 0,
// };
// }
const jsonData: productlinestepsTypes.queryParms = {
lineId: params.lineId
};
const response = await productlineInfoStepsAPI.List(jsonData);
if (response.statusCode === 200) {
setProcessList(response.data)

return {
data: response.data,
success: true,
};
} else {
return {
data: [],
success: false,
total: 0,
};
}
setFlowItemOpen(true)
}}
dragSortKey="step"
onDragSortEnd={(beforeIndex: number, afterIndex: number, newDataSource: any[]) => {

console.log('newDataSource', newDataSource);

// 模拟将排序后数据发送到服务器的场景
// remoteData = newDataSource;
// 请求成功之后刷新列表
newDataSource.map((item, index) => {
item.step = index + 1;
})
console.log('排序后的数据', newDataSource);
productlineInfoStepsAPI.BatchUpdateStep(newDataSource).then((res: MyResponse.Content) => {
if (res.data) {
sortActionRef.current?.reload();
message.success('修改列表排序成功');
}
});
>
添加步骤
</Button>,
]}
actionRef={sortActionRef}

columns={[

{
title: '工序',
dataIndex: 'step',
tooltip:"拖拽更改顺序",
align: 'center',
hideInSearch: true,
render: (dom, rowData, index) => {
return (
<span className="customRender">{`${index + 1}`}</span>
);
},
},
{
title: '主键',
dataIndex: 'id',
align: 'center',

}}
/>
</div>
hideInSearch: true,
},
{
title: '工艺名称',
dataIndex: 'processId',
align: 'center',
width:120,
hideInSearch: true,
render(dom, entity, index, action, schema) {
return <>{proList.find((x) => x.id == entity.processId)?.name}</>
},
},
{
title: '工艺类型',
dataIndex: 'processType',
align: 'center',
width:120,
hideInSearch: true,
render(dom, entity, index, action, schema) {
return <>{proList.find((x) => x.id == entity.processId)?.processType == 0 ? "人工" : "设备"}</>
},
},
{
title: '工艺设备',
dataIndex: 'deviceId',
align: 'center',
hideInSearch: true,
valueType:'select',
request:async ()=>{
const data: MyResponse.Content = await deviceAPI.selectlist()
const chan: any[] = data.data;
chan.map((item) => (
item.label = item.value,
item.value = item.key
))
return chan;
},
},
{
title: '操作',
align: 'center',

valueType: 'option',

key: 'option',
render: (_, record, index, action) => [
<Space key={uuid()} size="middle">
<Button
key={uuid()}
type='primary' ghost
onClick={async () => {
// setIsModalOpen(true)
const copyFormData = JSON.parse(JSON.stringify(record));
form.setFieldsValue(copyFormData);

setFlowItemOpen(true)
// setIsSetpModalOpen(true);
}}
>
编辑
</Button>
<Button disabled={proList.find((x) => x.id == record.processId)?.processType == 0}
key={uuid()}
type='primary' ghost
onClick={async () => {
// setIsModalOpen(true)


productlineInfoAPI.devicelist({stepId:record.id,lineId:''}).then((res:MyResponse.Content)=>{
if (res.statusCode===200) {
const copyFormData = JSON.parse(JSON.stringify(record));
copyFormData.deviceId = res.data.map((item:any)=>item.deviceId)
deviceform.setFieldsValue(copyFormData);
console.log('配置设备',copyFormData);
setDeviceOpen(true)
}else{
const copyFormData = JSON.parse(JSON.stringify(record));
deviceform.setFieldsValue(copyFormData);
console.log('配置设备',copyFormData);
setDeviceOpen(true)
}
})
// setIsSetpModalOpen(true);
}}
>
配置设备
</Button>
<Popconfirm
key={uuid()}
title="确定要删除此条数据吗?"
onConfirm={() => {
const delData: productlinestepsTypes.delInput = {
id: record.id,
};
productlineInfoStepsAPI.Del(delData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
action?.reload();
}
});
}}
onCancel={() => {
message.info('已取消删除');
}}
okText="确认"
cancelText="关闭"
>
<Button type='primary' danger ghost>删除</Button>
</Popconfirm>
</Space>
],
},
]}
rowKey="step"
search={false}
pagination={{ pageSize: 100, showSizeChanger: false }}

params={stepparams}
request={async (params = {}) => {
// if (!params.lineId) {
// return {
// data: [],
// success: false,
// total: 0,
// };
// }
const jsonData: productlinestepsTypes.queryParms = {
lineId: params.lineId
};
const response = await productlineInfoStepsAPI.List(jsonData);
if (response.statusCode === 200) {
setProcessList(response.data)

return {
data: response.data,
success: true,
};
} else {
return {
data: [],
success: false,
total: 0,
};
}
}}
dragSortKey="step"
onDragSortEnd={(beforeIndex: number, afterIndex: number, newDataSource: any[]) => {

console.log('newDataSource', newDataSource);

// 模拟将排序后数据发送到服务器的场景
// remoteData = newDataSource;
// 请求成功之后刷新列表
newDataSource.map((item, index) => {
item.step = index + 1;
})
console.log('排序后的数据', newDataSource);
productlineInfoStepsAPI.BatchUpdateStep(newDataSource).then((res: MyResponse.Content) => {
if (res.data) {
sortActionRef.current?.reload();
message.success('修改列表排序成功');
}
});

</Flex>
}}
/>

</Modal>
<Modal open={flowItemOpen} maskClosable={false} width={500} title='添加步骤'
<Modal open={flowItemOpen} maskClosable={false} title='添加步骤'
footer={[
<Button
key="back"
@@ -495,11 +531,7 @@ export default () => {
</Form.Item>
<Form.Item label="工艺"
name="processId" rules={[{ required: true, message: '此项为必填项!' }]} >
<Select onChange={(v:processType.output)=>{
// console.log(proList.find(x=>x.id==v)?.processType);
// setSelectProcess(v.processType)
<Select onChange={(v: processType.output) => {
}} placeholder='请选择工艺' style={{ width: 375 }}>
{
proList.map((item: processType.output) => {
@@ -510,52 +542,57 @@ export default () => {
}
</Select>
</Form.Item>
{proList.find(x=>x.id==processIdFlag)?.processType}
{proList.find(x=>x.id==processIdFlag)?.processType===0?processIdFlag:
<Form.List name="finalsl" >
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }) => (
<Space key={key} align="baseline">
<Form.Item
shouldUpdate={true}
>
{() => (
<Form.Item
{...restField}
label="请选择设备"
name={[name, 'finalslId']}
rules={[
{
required: true,
message: '请选择设备',
},
]}
>
<Select style={{ width: 400, }} >
{deviceList.map((item) => (
<Select.Option key={item.key} value={item.key}>
{item.value}
</Select.Option>
))}
</Select>
</Form.Item>
)}
</Form.Item>
</Space>
))}
<Form.Item>
<Button type="dashed" onClick={() => add()} block icon={<PlusOutlined />}>
添加设备
</Button>
</Form.Item>
</>
)}
</Form.List>
}
{/* {proList.find(x=>x.id==intranetFlag)?.processType===0 ?"": <Form.Item label="请选择设备"
</Form>
</Modal >

<Modal open={deviceOpen} maskClosable={false} width={500} title='配置工艺所需设备'
footer={[
<Button
key="back"
onClick={() => {
setFlowItemOpen(false)
}}
>
返回
</Button>,
<Button key="submit" form="adddeviceForm" type="primary" htmlType="submit">
提交
</Button>,
]}
onOk={() => { setDeviceOpen(false) }} onCancel={() => { setDeviceOpen(false) }}>
{/*
工艺
*/}
<Form
form={deviceform}
id='adddeviceForm'
onFinish={(v) => {
console.log(v,stepparams);
const jsonData:productlineInfoTypes.batchDevice = {
id: v.id,
lineId:stepparams.lineId,
deviceId: v.deviceId
}
productlineInfoAPI.Batchdevice(jsonData).then((res:MyResponse.Content)=>{
if (res.statusCode===200) {
message.info("更新成功!");
setDeviceOpen(false)
sortActionRef.current?.reload();
}else{
message.info(res.errors);
sortActionRef.current?.reload();
}
})

}}>
<Form.Item label="主键"
name="id"
hidden={true}>
</Form.Item>
<Form.Item label="请选择设备"
name="deviceId" rules={[{ required: true, message: '此项为必填项!' }]} >
<Select placeholder='请选择设备' style={{ width: 375 }}>
<Select mode="multiple" placeholder='请选择设备' style={{ width: 375 }}>
{
deviceList.map((item: MySelectType.Select) => {
return <Select.Option value={item.key} key={item.key}>
@@ -565,19 +602,8 @@ export default () => {
}
</Select>
</Form.Item>
} */}
</Form>
</Modal >

<Modal open={deviceOpen} maskClosable={false} width={500} title='设置设备工艺'>
{/*
工艺
*/}



</Form>
</Modal>
</>
);

Loading…
取消
儲存