| | |
| | | using CMS.Plugin.HIAWms.Domain.Shared.Enums; |
| | | using Volo.Abp.Application.Dtos; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Contracts.Dtos.WmsMaterials; |
| | |
| | | /// Gets or sets the name. |
| | | /// </summary> |
| | | public string Name { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料编码(唯一标识) |
| | | /// </summary> |
| | | public string MaterialCode { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料名称 |
| | | /// </summary> |
| | | public string MaterialName { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 采购类型(枚举值) |
| | | /// </summary> |
| | | public PurchaseTypeEnum PurchaseType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 物料类型(枚举值) |
| | | /// </summary> |
| | | public MaterialTypeEnum MaterialType { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 主单位(如:kg、m、个) |
| | | /// </summary> |
| | | public string PrimaryUnit { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 规格/标准(如:GB/T 8163-2018) |
| | | /// </summary> |
| | | public string Standard { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 外径(单位:mm) |
| | | /// </summary> |
| | | public decimal OuterDiameter { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 壁厚(单位:mm) |
| | | /// </summary> |
| | | public decimal WallThickness { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 材质(如:304不锈钢) |
| | | /// </summary> |
| | | public string MaterialQuality { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 长度(单位:m) |
| | | /// </summary> |
| | | public decimal Length { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 是否为主支管(true: 主支管, false: 非主支管) |
| | | /// </summary> |
| | | public YesNoEnum IsMainBranch { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 生产工厂 |
| | | /// </summary> |
| | | public string Factory { get; set; } |
| | | |
| | | /// <summary> |
| | | /// 证书编号(如:压力容器认证) |
| | | /// </summary> |
| | | public string Certification { get; set; } |
| | | } |
| | |
| | | using Volo.Abp.Application.Dtos; |
| | | using Volo.Abp.Data; |
| | | using Volo.Abp.ObjectExtending; |
| | | using Volo.Abp.ObjectMapping; |
| | | |
| | | namespace CMS.Plugin.HIAWms.Application.Implements; |
| | | |
| | |
| | | } |
| | | |
| | | var specification = new WmsMaterialSpecification(input.Name); |
| | | var count = await _wmsmaterialRepository.GetCountAsync(input.Filter, specification); |
| | | var list = await _wmsmaterialRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification); |
| | | var material = ObjectMapper.Map<GetWmsMaterialsInput, WmsMaterial>(input); |
| | | var count = await _wmsmaterialRepository.GetCountAsync(material,input.Filter, specification); |
| | | |
| | | var list = await _wmsmaterialRepository.GetListAsync(material,input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification); |
| | | |
| | | return new PagedResultDto<WmsMaterialDto>(count, ObjectMapper.Map<List<WmsMaterial>, List<WmsMaterialDto>>(list)); |
| | | } |
| | |
| | | /// <inheritdoc /> |
| | | public virtual async Task AdjustSortAsync(Guid id, int sort) |
| | | { |
| | | var list = await _wmsmaterialRepository.GetListAsync(nameof(WmsMaterial.Sort)); |
| | | var list = await _wmsmaterialRepository.GetListAsync(null, nameof(WmsMaterial.Sort)); |
| | | if (list != null && list.Any()) |
| | | { |
| | | var initSort = 1; |
| | |
| | | } |
| | | |
| | | var specification = new WmsMaterialSpecification(input.Name); |
| | | var list = await _wmsmaterialRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true); |
| | | |
| | | var material = ObjectMapper.Map<GetWmsMaterialsInput, WmsMaterial>(input); |
| | | var list = await _wmsmaterialRepository.GetListAsync(material,input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter, specification, includeDetails: true); |
| | | var result = ObjectMapper.Map<List<WmsMaterial>, List<WmsMaterialDto>>(list); |
| | | |
| | | var sheets = new Dictionary<string, object> |
| | |
| | | * into multiple profile classes for a better organization. */ |
| | | CreateMap<WmsMaterial, WmsMaterialDto>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<WmsMaterialCreateDto, WmsMaterial>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | CreateMap<GetWmsMaterialsInput, WmsMaterial>(MemberList.None).MapExtraProperties(MappingPropertyDefinitionChecks.None); |
| | | } |
| | | } |
| | |
| | | /// /自制 |
| | | /// </summary> |
| | | [Description("自制")] |
| | | SelfMade, |
| | | SelfMade = 1, |
| | | |
| | | /// <summary> |
| | | /// 采购 |
| | | /// </summary> |
| | | [Description("采购")] |
| | | Purchased, |
| | | Purchased = 2, |
| | | |
| | | /// <summary> |
| | | /// 均可 |
| | | /// </summary> |
| | | [Description("均可")] |
| | | Both |
| | | Both = 3 |
| | | } |
| | | } |
| | |
| | | /// <param name="includeDetails">if set to <c>true</c> [include details].</param> |
| | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | /// <returns></returns> |
| | | Task<List<WmsMaterial>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default); |
| | | Task<List<WmsMaterial>> GetListAsync(WmsMaterial material, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default); |
| | | |
| | | /// <summary> |
| | | /// Gets the count asynchronous. |
| | |
| | | /// <param name="specification">The specification.</param> |
| | | /// <param name="cancellationToken">The cancellation token.</param> |
| | | /// <returns></returns> |
| | | Task<long> GetCountAsync(string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default); |
| | | Task<long> GetCountAsync(WmsMaterial material, string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default); |
| | | } |
| | |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Linq.Dynamic.Core; |
| | | using System.Linq.Expressions; |
| | | using CMS.Plugin.HIAWms.Domain.WmsMaterials; |
| | | using CMS.Plugin.HIAWms.EntityFrameworkCore.Extensions; |
| | | using Microsoft.EntityFrameworkCore; |
| | |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<List<WmsMaterial>> GetListAsync(string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | public async Task<List<WmsMaterial>> GetListAsync(WmsMaterial? material, string sorting = null, int maxResultCount = int.MaxValue, int skipCount = 0, string filter = null, Specification<WmsMaterial> specification = null, bool includeDetails = false, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsMaterialSpecification(); |
| | | return await (await GetDbSetAsync()) |
| | | .IncludeDetails(includeDetails) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode)) |
| | | .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType) |
| | | .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType) |
| | | .Where(x => !x.IsDeleted) |
| | | .OrderBy(sorting.IsNullOrEmpty() ? nameof(WmsMaterial.Sort) : sorting) |
| | | .PageBy(skipCount, maxResultCount) |
| | | .ToListAsync(GetCancellationToken(cancellationToken)); |
| | | } |
| | | |
| | | /// <inheritdoc /> |
| | | public async Task<long> GetCountAsync(string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default) |
| | | /// <summary> |
| | | /// 获取总数 |
| | | /// </summary> |
| | | /// <param name="material"></param> |
| | | /// <param name="filter"></param> |
| | | /// <param name="specification"></param> |
| | | /// <param name="cancellationToken"></param> |
| | | /// <returns></returns> |
| | | public async Task<long> GetCountAsync(WmsMaterial? material, string filter = null, Specification<WmsMaterial> specification = null, CancellationToken cancellationToken = default) |
| | | { |
| | | specification ??= new WmsMaterialSpecification(); |
| | | return await (await GetQueryableAsync()) |
| | | .Where(specification.ToExpression()) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialName), u => u.MaterialName.Contains(material.MaterialName)) |
| | | .WhereIf(!string.IsNullOrEmpty(material.MaterialCode), u => u.MaterialName.Contains(material.MaterialCode)) |
| | | .WhereIf(material.MaterialType > 0, u => u.MaterialType == material.MaterialType) |
| | | .WhereIf(material.PurchaseType > 0, u => u.PurchaseType == material.PurchaseType) |
| | | .Where(x => !x.IsDeleted) |
| | | .WhereIf(!filter.IsNullOrWhiteSpace(), u => u.MaterialCode.Contains(filter)) |
| | | .CountAsync(cancellationToken: GetCancellationToken(cancellationToken)); |
| | |
| | | /// <param name="input">输入.</param> |
| | | /// <returns></returns> |
| | | [HttpGet] |
| | | [Route("Page")] |
| | | public virtual Task<PagedResultDto<WmsMaterialDto>> GetListAsync([FromQuery] GetWmsMaterialsInput input) |
| | | { |
| | | return _wmsmaterialAppService.GetListAsync(input); |
| | |
| | | setRow, |
| | | clearSelectEvent, |
| | | getList, |
| | | getTableList, |
| | | getParams, |
| | | getPaginationParams, |
| | | setSelectRowByObj, |
| | |
| | | export const getWmsEnumData = (data: any) => { |
| | | return request.post('/api/v1/hIAWms/WmsEnum', data) |
| | | } |
| | | |
| | | /** |
| | | * 获取物料基础列表 |
| | | * @returns |
| | | */ |
| | | export const getWmsDataList = (data: any) => { |
| | | return request.post('/api/v1/hIAWms/wmsmaterial/page', data) |
| | | } |
| | |
| | | for (const i in entityNames) { |
| | | const name = entityNames[i] |
| | | const module = await import(`./Pages/${name}/${name}.tsx`) |
| | | const WmsPlaces = markRaw(module.default) |
| | | const WmsMaterial = markRaw(module.default) |
| | | const foundLabel = |
| | | nameToLabelMap.find((item) => item.name === name)?.label || name |
| | | tabData.value.push({ |
| | | label: foundLabel, |
| | | name, |
| | | component: WmsPlaces, |
| | | component: WmsMaterial, |
| | | }) |
| | | } |
| | | } |
| | |
| | | .hideBlock { |
| | | display: none; |
| | | } |
| | | .queryForm { |
| | | padding: 10px; |
| | | background: #f5f7fa; |
| | | margin-bottom: 0px; |
| | | border-radius: 4px; |
| | | |
| | | .el-form-item { |
| | | margin-right: 20px; |
| | | margin-bottom: 0; |
| | | |
| | | // 统一输入框和选择框的宽度 |
| | | .el-input, .el-select { |
| | | width: 200px; // 设置统一的宽度 |
| | | } |
| | | |
| | | // 选择框内部输入框样式 |
| | | .el-select .el-input__wrapper { |
| | | height: 32px; // 与输入框高度一致 |
| | | padding: 1px 11px; // 与输入框内边距一致 |
| | | } |
| | | |
| | | // 日期选择器宽度 |
| | | .el-date-editor { |
| | | width: 220px; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 如果需要更精确的控制,可以单独设置 |
| | | .formItem { |
| | | width: 200px; |
| | | |
| | | &.el-input, &.el-select { |
| | | width: 100%; |
| | | } |
| | | } |
| | |
| | | import { defineComponent } from 'vue' |
| | | import { computed, defineComponent, onMounted, reactive, ref } from 'vue' |
| | | import type { Ref } from 'vue' |
| | | import BaseTable from '@/components/Table/Table' |
| | | import styles from './WmsMaterial.module.scss' |
| | |
| | | import { columns } from './Config' |
| | | import TdButton from '@/components/TdButton/TdButton' |
| | | import { vPermission } from '@/libs/Permission/Permission' |
| | | import { |
| | | getWmsEnumData, |
| | | getWmsDataList, |
| | | } from '@/widgets/HIAWms/Models/Service/WmsMaterialDrawer' |
| | | import { |
| | | ElInput, |
| | | ElSelect, |
| | | ElOption, |
| | | ElDatePicker, |
| | | ElForm, |
| | | ElFormItem, |
| | | } from 'element-plus' |
| | | import { injectModel } from '@/libs/Provider/Provider' |
| | | |
| | | interface RenderTableType { |
| | | url?: string |
| | |
| | | onSuccess, |
| | | onBeforeUpload, |
| | | } = useWmsMaterial(props, ctx) |
| | | |
| | | // 新增的查询条件 |
| | | const queryForm = ref({ |
| | | materialCode: '', |
| | | materialName: '', |
| | | materialType: '', |
| | | purchaseType: '', |
| | | filter: '', |
| | | }) |
| | | |
| | | const queryParams = computed(() => ({ |
| | | ...queryForm.value, |
| | | materialType: queryForm.value.materialType || '', // 处理下拉 |
| | | purchaseType: queryForm.value.purchaseType || '', |
| | | })) |
| | | |
| | | // 动态枚举选项 |
| | | const enumOptions = reactive({ |
| | | materialType: [] as Array<{ label: string; value: any }>, |
| | | purchaseType: [] as Array<{ label: string; value: any }>, |
| | | isMainBranch: [] as Array<{ label: string; value: any }>, |
| | | }) |
| | | |
| | | // 获取枚举数据 |
| | | const fetchEnumData = async () => { |
| | | try { |
| | | // 获取物料类型枚举 |
| | | const materialTypeData = await getWmsEnumData({ |
| | | EnumName: 'MaterialTypeEnum', |
| | | }) |
| | | enumOptions.materialType = materialTypeData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | |
| | | // 获取采购类型枚举 |
| | | const purchaseTypeData = await getWmsEnumData({ |
| | | EnumName: 'PurchaseTypeEnum', |
| | | }) |
| | | enumOptions.purchaseType = purchaseTypeData.map((item) => ({ |
| | | label: item.description, |
| | | value: item.value, |
| | | })) |
| | | } catch (error) { |
| | | console.error('获取枚举数据失败:', error) |
| | | } |
| | | } |
| | | |
| | | // 组件挂载时获取枚举数据 |
| | | onMounted(() => { |
| | | fetchEnumData() |
| | | }) |
| | | |
| | | // 新增的查询方法 |
| | | const handleQuery = async () => { |
| | | console.log('查询条件:', queryParams.value) |
| | | tableRef.value.getTableList() |
| | | // tableRef.value.getList(queryParams.value) |
| | | } |
| | | |
| | | // 重置查询条件 |
| | | const resetQuery = () => { |
| | | queryForm.value = { |
| | | materialCode: '', |
| | | materialName: '', |
| | | materialType: '', |
| | | purchaseType: '', |
| | | filter: '', |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @returns 表格 |
| | |
| | | </div> |
| | | ) |
| | | } |
| | | |
| | | return () => { |
| | | return ( |
| | | <div class={styles.wmsMaterialContent}> |
| | |
| | | sort={sort.value} |
| | | onConfirm={onConfirmWmsMaterial} |
| | | /> |
| | | |
| | | {/* 新增的查询表单 */} |
| | | <ElForm |
| | | inline |
| | | model={queryForm.value} |
| | | class={styles.queryForm} |
| | | label-width="80px" |
| | | > |
| | | <ElFormItem label="关键字"> |
| | | <ElInput |
| | | v-model={queryForm.value.filter} |
| | | placeholder="请输入关键字搜索" |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </ElFormItem> |
| | | <ElFormItem label="物料编码"> |
| | | <ElInput |
| | | v-model={queryForm.value.materialCode} |
| | | placeholder="请输入物料编码" |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </ElFormItem> |
| | | <ElFormItem label="物料名称"> |
| | | <ElInput |
| | | v-model={queryForm.value.materialName} |
| | | placeholder="请输入物料名称" |
| | | clearable |
| | | class={styles.formItem} |
| | | /> |
| | | </ElFormItem> |
| | | <ElFormItem label="物料类型"> |
| | | <ElSelect |
| | | v-model={queryForm.value.materialType} |
| | | placeholder="请选择物料类型" |
| | | clearable |
| | | loading={enumOptions.materialType.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.materialType.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | <ElFormItem label="采购类型"> |
| | | <ElSelect |
| | | v-model={queryForm.value.purchaseType} |
| | | placeholder="请选择采购类型" |
| | | clearable |
| | | loading={enumOptions.purchaseType.length === 0} |
| | | class={styles.formItem} |
| | | > |
| | | {enumOptions.purchaseType.map((option) => ( |
| | | <ElOption |
| | | key={option.value} |
| | | label={option.label} |
| | | value={option.value} |
| | | /> |
| | | ))} |
| | | </ElSelect> |
| | | </ElFormItem> |
| | | {/* <ElFormItem label="日期范围"> |
| | | <ElDatePicker |
| | | v-model={queryForm.value.dateRange} |
| | | type="daterange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期" |
| | | value-format="YYYY-MM-DD" |
| | | /> |
| | | </ElFormItem> */} |
| | | <ElFormItem> |
| | | <IconButton type="primary" icon="search" onClick={handleQuery}> |
| | | 查询 |
| | | </IconButton> |
| | | <IconButton |
| | | style="margin-left: 10px;" |
| | | icon="refresh" |
| | | onClick={resetQuery} |
| | | > |
| | | 重置 |
| | | </IconButton> |
| | | </ElFormItem> |
| | | </ElForm> |
| | | |
| | | <div class={styles.headerContent}> |
| | | <div class={styles.header}> |
| | | <IconButton |
| | |
| | | 导出 |
| | | </IconButton> |
| | | </div> |
| | | <Search |
| | | {/* <Search |
| | | placeholder="请输入关键字" |
| | | v-model={search.value} |
| | | onConfirm={onSearch} |
| | | style={{ marginTop: '-1px' }} |
| | | /> |
| | | /> */} |
| | | </div> |
| | | |
| | | <RenderBaseTable |
| | | url="/api/v1/hIAWms/wmsMaterial" |
| | | url="/api/v1/hIAWms/wmsMaterial/page" |
| | | dataSource={dataSource} |
| | | isChecked={true} |
| | | isDrag={true} |
| | |
| | | params, |
| | | autoHeight, |
| | | } = props |
| | | |
| | | console.log(dataSource.value) |
| | | return ( |
| | | <div |
| | | class={{ |