diff --git a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
index 139dc1b..fffd724 100644
--- a/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
+++ b/backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
@@ -7425,6 +7425,11 @@
主键
+
+
+ 个数
+
+
名 称 :
diff --git a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkBatchDto.cs b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkBatchDto.cs
index 5de92ca..6d35b08 100644
--- a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkBatchDto.cs
+++ b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Dtos/WorkBatchDto.cs
@@ -73,6 +73,10 @@
/// 主键
///
public string Id { get; set; }
+ ///
+ /// 个数
+ ///
+ public int Count { get; set; }
}
}
\ No newline at end of file
diff --git a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkBatchService.cs b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkBatchService.cs
index a4c4719..ed4927e 100644
--- a/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkBatchService.cs
+++ b/backend/BPA.MES.Base.Application/Services/WorkInfoService/Services/WorkBatchService.cs
@@ -25,7 +25,19 @@
public async Task Del(WorkBatchDelInput input)
{
- var res = await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync();
+ var res = false;
+ try
+ {
+ _dbContext.Ado.BeginTran();
+ await _dbContext.Deleteable().Where(x => x.Id == input.Id).ExecuteCommandHasChangeAsync();
+ await _dbContext.Deleteable().Where(x => x.BatchId == input.Id).ExecuteCommandAsync();
+ _dbContext.Ado.CommitTran();
+ res = true;
+ }
+ catch (Exception)
+ {
+ _dbContext.Ado.RollbackTran();
+ }
return res;
}
@@ -40,13 +52,17 @@
{
var entity = await _dbContext.Queryable()
.OrderByDescending(x => x.CreateTime)
+ .Select((x)=>new WorkBatchOutput
+ {
+ Id = x.Id.SelectAll(),
+ Count = SqlFunc.Subqueryable().Where(d=>d.BatchId==x.Id).Count()
+ })
.ToPagedListAsync(input.PageIndex, input.PageSize);
//foreach (var item in entity.Items)
//{
// item.Status = WorkOrderStatusEnum.Started
//}
- SqlSugarPagedList output = entity.Adapt>();
- return output;
+ return entity;
}
public async Task Update(WorkBatchUpdateInput input)
diff --git a/backend/BPA.MES.Base.Web.Entry/appsettings.json b/backend/BPA.MES.Base.Web.Entry/appsettings.json
index e6469bc..c8ad527 100644
--- a/backend/BPA.MES.Base.Web.Entry/appsettings.json
+++ b/backend/BPA.MES.Base.Web.Entry/appsettings.json
@@ -10,8 +10,8 @@
"AllowedHosts": "*",
"ConnectionConfigs": [
{
- //"ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=BapAdmin123456.;",
- "ConnectionString": "server=192.168.1.231;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=pztj8127;",
+ "ConnectionString": "server=10.2.1.254;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=BapAdmin123456.;",
+ //"ConnectionString": "server=192.168.1.231;Port=3306;Database=bpa_pztj_mes;Uid=root;Pwd=pztj8127;",
"DbType": "MySql",
"IsAutoCloseConnection": true
}
diff --git a/frontend/src/pages/workInfo/index.tsx b/frontend/src/pages/workInfo/index.tsx
index 7a5ef59..1da311b 100644
--- a/frontend/src/pages/workInfo/index.tsx
+++ b/frontend/src/pages/workInfo/index.tsx
@@ -194,6 +194,7 @@ export default () => {
WorkInfoAPI.Del(EnablejsonData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
+ batchActionRef.current?.reload();
actionRef.current?.reload();
}
});
@@ -347,6 +348,14 @@ export default () => {
align: 'center',
width: 180
},
+ {
+ title: '工单个数',
+ dataIndex: 'count',
+ ellipsis: true,
+ hideInSearch: true,
+ align: 'center',
+ width: 80
+ },
{
title: '批次状态',
dataIndex: 'status',
@@ -416,7 +425,7 @@ export default () => {
>
新增工单
,
-
+ record.count>0?
{
cancelText="关闭"
>
-
+ :""
,
{
WorkInfoAPI.DelBatch(EnablejsonData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
- actionRef.current?.reload();
+ batchActionRef.current?.reload();
}
});
}}
@@ -514,7 +523,7 @@ export default () => {
,
{
const EnablejsonData: WorkInfoTypes.WorkInfoDelInput = {
id: record.id,
@@ -522,7 +531,7 @@ export default () => {
WorkInfoAPI.DelBatch(EnablejsonData).then((r) => {
if (r.statusCode === 200) {
message.success(r.statusCode === 200 ? '删除成功' : r.message);
- actionRef.current?.reload();
+ batchActionRef.current?.reload();
}
});
}}
@@ -570,7 +579,7 @@ const OnBatchSubmit= async (values:any)=>{
const response = await WorkInfoAPI.UpdateBatch(values);
if (response.statusCode === 200) {
message.success('修改成功');
- actionRef.current?.reload();
+ batchActionRef.current?.reload();
setIsBatchModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '修改失败');
@@ -580,7 +589,7 @@ const OnBatchSubmit= async (values:any)=>{
console.log('response', response);
if (response.statusCode === 200) {
message.success('添加成功');
- actionRef.current?.reload();
+ batchActionRef.current?.reload();
setIsBatchModalOpen(false);
} else {
message.error(JSON.stringify(response.errors) || '添加失败');
@@ -608,6 +617,7 @@ const OnBatchSubmit= async (values:any)=>{
console.log('response', response);
if (response.statusCode === 200) {
message.success('添加成功');
+ batchActionRef.current?.reload();
actionRef.current?.reload();
setIsModalOpen(false);
} else {
@@ -682,6 +692,7 @@ const OnBatchSubmit= async (values:any)=>{
console.log('record',record);
}}}
+
columns={batchColumns}
actionRef={batchActionRef}
cardBordered