Browse Source

[fix]统一400数据格式

master
贾荣国Home 3 years ago
parent
commit
ba76232428
  1. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDtoValidator.cs
  2. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDtoValidator.cs
  3. 5
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs
  4. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs
  5. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs
  6. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs
  7. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs
  8. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs
  9. 1
      WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs
  10. 8
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs
  11. 2912
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081547_UpdateReceipt.Designer.cs
  12. 75
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081547_UpdateReceipt.cs
  13. 2912
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081630_UpdatePart.Designer.cs
  14. 57
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081630_UpdatePart.cs
  15. 17
      WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs
  16. 2
      WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Parts/PartCreateDtoValidator.cs

@ -8,7 +8,7 @@ public class PartCreateDtoValidator : AbstractValidator<PartCreateDto>
public PartCreateDtoValidator()
{
RuleFor(x => x.Code).MaximumLength(64).NotEmpty();
RuleFor(x => x.Name).MaximumLength(1024).NotNull();
RuleFor(x => x.Name).MaximumLength(64).NotNull();
RuleFor(x => x.Desc1).MaximumLength(1024).NotNull();
RuleFor(x => x.Desc2).MaximumLength(1024);
RuleFor(x => x.Status).MaximumLength(64).NotNull();

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application.Contracts/Receipts/ReceiptCreateDtoValidator.cs

@ -1,3 +1,4 @@
using System;
using FluentValidation;
namespace Win_in.Sfs.Scp.WebApi;
@ -17,8 +18,8 @@ public class ReceiptCreateDtoValidator : AbstractValidator<ReceiptCreateDTO>
RuleFor(q => q.ReceiveTime);
RuleFor(q => q.PoLine).MaximumLength(64);
RuleFor(q => q.PartCode).MaximumLength(64).NotEmpty();
RuleFor(q => q.Lot).MaximumLength(64).NotNull();
RuleFor(q => q.SupplierLot).MaximumLength(64).NotNull();
RuleFor(q => q.Lot).MaximumLength(64);
RuleFor(q => q.SupplierLot).MaximumLength(64);
RuleFor(q => q.Uom).MaximumLength(64).NotNull();
RuleFor(q => q.ReceiveQty).NotNull();
RuleFor(q => q.SupplierPackConvertRate).NotNull();

5
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Parts/PartAppService.cs

@ -4,6 +4,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
using AutoMapper;
using AutoMapper.Configuration;
using FluentValidation;
@ -13,6 +14,7 @@ using Volo.Abp.Domain.Repositories;
using Volo.Abp.Uow;
using Win_in.Sfs.Scp.v1.Domain;
using Microsoft.Extensions.Configuration;
using Volo.Abp.Clients;
using Volo.Abp.Validation;
using IConfiguration = Microsoft.Extensions.Configuration.IConfiguration;
@ -82,6 +84,7 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSite(_validSites,entity.Company);
await UpsertTaPartAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();
}
@ -95,7 +98,7 @@ namespace Win_in.Sfs.Scp.WebApi
var ret = await _partRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Part, PartDTO>(ret);
dto.CreationTime = Clock.Now;
if (dto.ErrorCode != 0)
{
throw new AbpValidationException(new List<ValidationResult>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/PurchaseOrders/PurchaseOrderAppService.cs

@ -91,6 +91,7 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSite(_validSites,entity.Company);
Validator.CheckSupplierCode(_taVenderRepository,entity.Site, entity.SupplierCode);
await UpsertTbPoAndTbPoDetailAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();
@ -104,6 +105,7 @@ namespace Win_in.Sfs.Scp.WebApi
}
var ret = await _purchaseOrderRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<PurchaseOrder, PurchaseOrderDTO>(ret);
dto.CreationTime = Clock.Now;
if (dto.ErrorCode != 0)
{
throw new AbpValidationException(new List<ValidationResult>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Receipts/ReceiptAppService.cs

@ -85,6 +85,7 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSite(_validSites,entity.Company);
Validator.CheckSupplierCode(_taVenderRepository,entity.Site, entity.SupplierCode);
await UpsertTbReceiptAndTbReceiptDetailAsync(entity);
await CurrentUnitOfWork.SaveChangesAsync();
@ -99,6 +100,7 @@ namespace Win_in.Sfs.Scp.WebApi
var ret = await _receiptRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Receipt, ReceiptDTO>(ret);
dto.CreationTime = Clock.Now;
if (dto.ErrorCode != 0)
{
throw new AbpValidationException(new List<ValidationResult>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/ScpV1AutoMapperProfile.cs

@ -128,7 +128,7 @@ namespace Win_in.Sfs.Scp.WebApi
// .ForMember(p => p.IsDeleted, p => p.MapFrom(q => false))//默认值
.ForMember(p => p.GUID, p => p.MapFrom(q => Guid.NewGuid()))//默认值
.ForMember(p => p.BillType, p => p.MapFrom(q => string.IsNullOrWhiteSpace(q.RcType) ? 0 : 1))//0:收货 1:退货
.ForMember(p => p.VendBatch, p => p.MapFrom(q => string.IsNullOrEmpty(q.SupplierLot)?"":q.Lot))
.ForMember(p => p.VendBatch, p => p.MapFrom(q => string.IsNullOrEmpty(q.SupplierLot)?"":q.SupplierLot))
.ForMember(p => p.PoUnit, p => p.MapFrom(q => q.Uom))
.ForMember(p => p.LocUnit, p => p.MapFrom(q => q.Uom))
.ForMember(p => p.PurCost, p => p.MapFrom(q => 0))//默认值

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/Suppliers/SuppliersAppService.cs

@ -93,6 +93,7 @@ namespace Win_in.Sfs.Scp.WebApi
var ret = await _supplierRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<Supplier, SupplierDTO>(ret);
dto.CreationTime = Clock.Now;
if (dto.ErrorCode != 0)
{
throw new AbpValidationException(new List<ValidationResult>

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/UnplannedReceipts/UnplannedReceiptAppService.cs

@ -85,6 +85,7 @@ namespace Win_in.Sfs.Scp.WebApi
try
{
Validator.CheckSite(_validSites,entity.Site);
Validator.CheckSite(_validSites,entity.Company);
Validator.CheckSupplierCode(_taVenderRepository,entity.Site, entity.Address);
await UpsertTbReceiptAndTbReceiptDetailAsync(entity);
@ -101,6 +102,7 @@ namespace Win_in.Sfs.Scp.WebApi
var ret = await _unplannedReceiptRepository.InsertAsync(entity);
var dto = ObjectMapper.Map<UnplannedReceipt, UnplannedReceiptDTO>(ret);
dto.CreationTime = Clock.Now;
if (dto.ErrorCode != 0)
{
throw new AbpValidationException(new List<ValidationResult>

1
WebApiService/src/Win_in.Sfs.Scp.WebApi.Application/WebApiApplicationAutoMapperProfile.cs

@ -1,5 +1,6 @@
using AutoMapper;
using Volo.Abp.AutoMapper;
using Volo.Abp.Timing;
namespace Win_in.Sfs.Scp.WebApi
{

8
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/DbContext/WebApiDbContextModelCreatingExtensions.cs

@ -65,8 +65,8 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
b.ConfigureByConvention();
b.Property(x => x.Code).IsRequired().HasMaxLength(64);
b.Property(x => x.Name).IsRequired().HasMaxLength(1024);
b.Property(x => x.Desc1).HasMaxLength(1024);
b.Property(x => x.Desc2).HasMaxLength(1024);
b.Property(x => x.Desc1).HasMaxLength(64);
b.Property(x => x.Desc2).HasMaxLength(64);
b.Property(x => x.Status).IsRequired().HasMaxLength(64);
b.Property(x => x.IsBuyPart).IsRequired();
b.Property(x => x.IsMakePart).IsRequired();
@ -174,8 +174,8 @@ namespace Win_in.Sfs.Scp.WebApi.EntityFrameworkCore
b.Property(q => q.ReceiveTime);
b.Property(q => q.PoLine).HasMaxLength(64);
b.Property(q => q.PartCode).IsRequired().HasMaxLength(64);
b.Property(q => q.Lot).IsRequired().HasMaxLength(64);
b.Property(q => q.SupplierLot).IsRequired();
b.Property(q => q.Lot).HasMaxLength(64);
b.Property(q => q.SupplierLot).HasMaxLength(64);
b.Property(q => q.Uom).IsRequired().HasMaxLength(64);
b.Property(q => q.ReceiveQty).IsRequired().HasPrecision(18, 6);
b.Property(q => q.SupplierPackConvertRate).IsRequired().HasPrecision(18, 6);

2912
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081547_UpdateReceipt.Designer.cs

File diff suppressed because it is too large

75
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081547_UpdateReceipt.cs

@ -0,0 +1,75 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class UpdateReceipt : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SupplierLot",
table: "WebApi_Receipt",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(max)");
migrationBuilder.AlterColumn<string>(
name: "Lot",
table: "WebApi_Receipt",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "WebApi_Part",
type: "nvarchar(1024)",
maxLength: 1024,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "SupplierLot",
table: "WebApi_Receipt",
type: "nvarchar(max)",
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Lot",
table: "WebApi_Receipt",
type: "nvarchar(64)",
maxLength: 64,
nullable: false,
defaultValue: "",
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Name",
table: "WebApi_Part",
type: "nvarchar(64)",
maxLength: 64,
nullable: false,
oldClrType: typeof(string),
oldType: "nvarchar(1024)",
oldMaxLength: 1024);
}
}
}

2912
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081630_UpdatePart.Designer.cs

File diff suppressed because it is too large

57
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/20220315081630_UpdatePart.cs

@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace Win_in.Sfs.Scp.WebApi.Migrations
{
public partial class UpdatePart : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Desc2",
table: "WebApi_Part",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(1024)",
oldMaxLength: 1024,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Desc1",
table: "WebApi_Part",
type: "nvarchar(64)",
maxLength: 64,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(1024)",
oldMaxLength: 1024,
oldNullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "Desc2",
table: "WebApi_Part",
type: "nvarchar(1024)",
maxLength: 1024,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
migrationBuilder.AlterColumn<string>(
name: "Desc1",
table: "WebApi_Part",
type: "nvarchar(1024)",
maxLength: 1024,
nullable: true,
oldClrType: typeof(string),
oldType: "nvarchar(64)",
oldMaxLength: 64,
oldNullable: true);
}
}
}

17
WebApiService/src/Win_in.Sfs.Scp.WebApi.EntityFrameworkCore/Migrations/WebApiDbContextModelSnapshot.cs

@ -1967,12 +1967,12 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasColumnName("CreatorId");
b.Property<string>("Desc1")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Desc2")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("ErrorCode")
.HasColumnType("int");
@ -1996,8 +1996,8 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<string>("ProductLine")
.HasMaxLength(64)
@ -2244,7 +2244,6 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasColumnName("ExtraProperties");
b.Property<string>("Lot")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
@ -2296,8 +2295,8 @@ namespace Win_in.Sfs.Scp.WebApi.Migrations
.HasColumnType("nvarchar(64)");
b.Property<string>("SupplierLot")
.IsRequired()
.HasColumnType("nvarchar(max)");
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<decimal>("SupplierPackConvertRate")
.HasPrecision(18, 6)

2
WebApiService/src/Win_in.Sfs.Scp.WebApi.HttpApi.Host/appsettings.json

@ -34,6 +34,6 @@
}
}
},
"AlwaysAllowAuthorization": true,
"AlwaysAllowAuthorization": false,
"ValidSites": "T8,JZ1"
}
Loading…
Cancel
Save