Parcourir la source

统计添加

shengtang
gwbvipvip il y a 1 an
Parent
révision
159afba92d
9 fichiers modifiés avec 184 ajouts et 6 suppressions
  1. +14
    -0
      backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml
  2. +15
    -0
      backend/BPA.MES.Base.Application/Services/ReportService/Dtos/MaterialsOutDto.cs
  3. +7
    -0
      backend/BPA.MES.Base.Application/Services/ReportService/IReportService.cs
  4. +33
    -3
      backend/BPA.MES.Base.Application/Services/ReportService/ReportService.cs
  5. +1
    -0
      frontend/config/routes.ts
  6. +15
    -1
      frontend/src/api/reportService.ts
  7. +90
    -0
      frontend/src/pages/report/material/index.tsx
  8. +1
    -1
      frontend/src/pages/report/product/index.tsx
  9. +8
    -1
      frontend/src/types/ReportType.ts

+ 14
- 0
backend/BPA.MES.Base.Application/BPA.MES.Base.Application.xml Voir le fichier

@@ -5867,6 +5867,13 @@
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.ReportService.IReportService.GetMaterialsReport(BPA.MES.Base.Application.Services.ReportService.Dtos.MaterialsInputDto)">
<summary>
获取物料统计
</summary>
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.ReportService.ReportService.GetProductReport(BPA.MES.Base.Application.Services.ReportService.Dtos.ProductInputDto)">
<summary>
获取成品生产统计
@@ -5874,6 +5881,13 @@
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="M:BPA.MES.Base.Application.Services.ReportService.ReportService.GetMaterialsReport(BPA.MES.Base.Application.Services.ReportService.Dtos.MaterialsInputDto)">
<summary>
获取物料统计
</summary>
<param name="inputDto"></param>
<returns></returns>
</member>
<member name="T:BPA.MES.Base.Application.Services.StockInfoDto">
<summary>
名 称 : 料仓服务


+ 15
- 0
backend/BPA.MES.Base.Application/Services/ReportService/Dtos/MaterialsOutDto.cs Voir le fichier

@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.MES.Base.Application.Services.ReportService.Dtos
{
public class MaterialsOutDto
{
public string MaterialId { get; set; }
public string MaterialName { get; set; }
public decimal Count { get; set; }
}
}

+ 7
- 0
backend/BPA.MES.Base.Application/Services/ReportService/IReportService.cs Voir le fichier

@@ -15,5 +15,12 @@ namespace BPA.MES.Base.Application.Services.ReportService
/// <param name="inputDto"></param>
/// <returns></returns>
Task<List<ProductOutDto>> GetProductReport(ProductInputDto inputDto);

/// <summary>
/// 获取物料统计
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
Task<List<MaterialsOutDto>> GetMaterialsReport(MaterialsInputDto inputDto);
}
}

+ 33
- 3
backend/BPA.MES.Base.Application/Services/ReportService/ReportService.cs Voir le fichier

@@ -46,8 +46,16 @@ namespace BPA.MES.Base.Application.Services.ReportService
return res;
}

public async Task<object> GetMaterialsReport(MaterialsInputDto inputDto)

/// <summary>
/// 获取物料统计
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost]
public async Task<List<MaterialsOutDto>> GetMaterialsReport(MaterialsInputDto inputDto)
{
var result = new List<MaterialsOutDto>();
var res = await _dbContext.Queryable<Pztj_WorkInfoEntity, Pztj_WorkInfoStatusEntity, Pztj_FinalsInfoEntity>
((a, b, c) =>
new JoinQueryInfos(
@@ -72,13 +80,35 @@ namespace BPA.MES.Base.Application.Services.ReportService
{
x.MaterialId,
x.Weight,
x.RecipesId
}) .ToListAsync();

var materialsId= recipes.Select(x => x.MaterialId).ToList();

var materials = await _dbContext.Queryable<Pztj_MaterialsInfoEntity>()
.Where(x=> materialsId.Contains(x.Id))
.WhereIF(!string.IsNullOrEmpty(inputDto.MaterialsName),x=>x.Name.Contains(inputDto.MaterialsName))
.ToListAsync();

foreach (var item in materials)
{
var count = 0;
foreach (var item2 in res.GroupBy(x=>x.RecipeId))
{
var data = recipes.Where(x=>x.RecipesId==item2.Key &&x.MaterialId==item.Id).FirstOrDefault();
count=item2.First().Count*Convert.ToInt32(data==null? 0: data.Weight);

}

result.Add(new MaterialsOutDto()
{
MaterialId=item.Id,
MaterialName=item.Name,
Count= count,
});
}

return null;
return result;
}

}


+ 1
- 0
frontend/config/routes.ts Voir le fichier

@@ -71,6 +71,7 @@
path: '/report', icon: 'SettingOutlined', name: '统计报表',
routes: [
{ path: '/report/product', name: '成品统计', component: './report/product' },
{ path: '/report/material', name: '原料统计', component: './report/material' },
]
},
{ path: '*', layout: false, component: './404' },


+ 15
- 1
frontend/src/api/reportService.ts Voir le fichier

@@ -8,13 +8,27 @@ export default {
* @param parms
* @returns
*/
PagedList(parms: ReportType.ProductReportInput) {
PagedList(parms: ReportType.ReportInput) {
return request('/api/report/getproductreport', {
method: 'POST',
data: {
...parms,
},
});
},

/**
* 获取原料统计
* @param parms
* @returns
*/
PagedMaterialList(parms: ReportType.ReportInput) {
return request('/api/report/getmaterialsreport', {
method: 'POST',
data: {
...parms,
},
});
}

}

+ 90
- 0
frontend/src/pages/report/material/index.tsx Voir le fichier

@@ -0,0 +1,90 @@
import { useEffect, useRef, useState } from 'react';
import { Button, Space } from 'antd';
import { ProTable } from '@ant-design/pro-components';
import type {
ActionType, ProColumns,
EditableFormInstance,
ProFormInstance,
} from '@ant-design/pro-components';
import api from '@/api/reportService';

export default () => {
const actionRef = useRef<ActionType>();
const columns: ProColumns<ReportType.MaterialReport>[] = [
{
title: 'materialId',
dataIndex: 'materialId',
hideInSearch: true,
hideInTable:true,
align: 'center',
},
{
title: '成品名称',
dataIndex: 'materialName',
align: 'center',
},
{
title: '生产数量',
dataIndex: 'count',
hideInSearch: true,
align: 'center',

},
{
title: '生产时间',
dataIndex: 'dateTime',
valueType: 'dateRange',
hideInTable:true,
align: 'center',

}

]

return (
<ProTable<ReportType.MaterialReport>
key="myTable"
columns={columns}
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const jsonData: ReportType.ReportInput = {
endTime:params.dateTime?params.dateTime[1]:undefined,
startTime:params.dateTime?params.dateTime[0]:undefined,
productName:params.productName||""
};
const response = await api.PagedMaterialList(jsonData);
if (response.statusCode === 200) {
return {
data: response.data,
success: true,
total: 1,
};
} else {
return {
data: [],
success: false,
total: 0,
};
}
}}
rowKey="productId"
pagination={{
pageSize: 10,
}}
dateFormatter="string"
headerTitle="工单列表"
toolBarRender={() => [
<Button
key="button"
type="primary"
onClick={() => {
}}
>
新建工单
</Button>,
]}
/>
);

};

+ 1
- 1
frontend/src/pages/report/product/index.tsx Voir le fichier

@@ -48,7 +48,7 @@ export default () => {
actionRef={actionRef}
cardBordered
request={async (params = {}) => {
const jsonData: ReportType.ProductReportInput = {
const jsonData: ReportType.ReportInput = {
endTime:params.dateTime?params.dateTime[1]:undefined,
startTime:params.dateTime?params.dateTime[0]:undefined,
productName:params.productName||""


+ 8
- 1
frontend/src/types/ReportType.ts Voir le fichier

@@ -1,7 +1,7 @@

declare namespace ReportType {

interface ProductReportInput {
interface ReportInput {
productName: string,
startTime?:string,
endTime?:string
@@ -13,5 +13,12 @@ declare namespace ReportType {
productName: string,
count: number,
}

// 原料统计
interface MaterialReport {
materialId: string,
materialName: string,
count: number,
}
}


Chargement…
Annuler
Enregistrer