Compare commits
No commits in common. "4623d4780ed28fb129086d34a2dac148127fcd15" and "6cf4381c534d05496d9842b06e0460af333fc0ac" have entirely different histories.
4623d4780e
...
6cf4381c53
|
@ -24,21 +24,21 @@ public class Invoice : EntityTenant
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
[SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)]
|
[SugarColumn(ColumnName = "BusinessType", ColumnDescription = "业务类型", Length = 32)]
|
||||||
public string? BusinessType { get; set; }
|
public string BusinessType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户
|
/// 客户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
[SugarColumn(ColumnName = "Custom", ColumnDescription = "客户", Length = 32)]
|
[SugarColumn(ColumnName = "Custom", ColumnDescription = "客户", Length = 32)]
|
||||||
public string? Custom { get; set; }
|
public string Custom { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 仓库
|
/// 仓库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Required]
|
[Required]
|
||||||
[SugarColumn(ColumnName = "Warehouse", ColumnDescription = "仓库", Length = 32)]
|
[SugarColumn(ColumnName = "Warehouse", ColumnDescription = "仓库", Length = 32)]
|
||||||
public string? Warehouse { get; set; }
|
public string Warehouse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 部门
|
/// 部门
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
using Admin.NET.Core;
|
|
||||||
namespace Admin.NET.Application.Entity;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表
|
|
||||||
/// </summary>
|
|
||||||
[SugarTable("MaterialList","物料列表")]
|
|
||||||
public class MaterialList : EntityBaseId
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 物料ID
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "MaterialsId", ColumnDescription = "物料ID")]
|
|
||||||
public long? MaterialsId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "Unit", ColumnDescription = "单位", Length = 32)]
|
|
||||||
public string? Unit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数量
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "Count", ColumnDescription = "数量")]
|
|
||||||
public int? Count { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 来源ID
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "SourceId", ColumnDescription = "来源ID")]
|
|
||||||
public long? SourceId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
[SugarColumn(ColumnName = "Remarks", ColumnDescription = "备注", Length = 32)]
|
|
||||||
public string? Remarks { get; set; }
|
|
||||||
|
|
||||||
}
|
|
|
@ -21,17 +21,17 @@ public class InvoiceBaseInput
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 业务类型
|
/// 业务类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string? BusinessType { get; set; }
|
public virtual string BusinessType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 客户
|
/// 客户
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string? Custom { get; set; }
|
public virtual string Custom { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 仓库
|
/// 仓库
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual string? Warehouse { get; set; }
|
public virtual string Warehouse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 仓库ID
|
/// 仓库ID
|
||||||
|
@ -220,16 +220,30 @@ public class InvoiceInput : BasePageInput
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class AddInvoiceInput : InvoiceBaseInput
|
public class AddInvoiceInput : InvoiceBaseInput
|
||||||
{
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 业务类型
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "业务类型不能为空")]
|
||||||
|
public override string BusinessType { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 客户
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "客户不能为空")]
|
||||||
|
public override string Custom { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 仓库
|
||||||
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "仓库不能为空")]
|
||||||
|
public override string Warehouse { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 软删除
|
/// 软删除
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Required(ErrorMessage = "软删除不能为空")]
|
||||||
public override bool IsDelete { get; set; }
|
public override bool IsDelete { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表
|
|
||||||
/// </summary>
|
|
||||||
public List<AddMaterialListInput> TableData { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -250,10 +264,6 @@ public class UpdateInvoiceInput : InvoiceBaseInput
|
||||||
[Required(ErrorMessage = "主键Id不能为空")]
|
[Required(ErrorMessage = "主键Id不能为空")]
|
||||||
public long Id { get; set; }
|
public long Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表
|
|
||||||
/// </summary>
|
|
||||||
public List<AddMaterialListInput> TableData { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -3,7 +3,6 @@ using Admin.NET.Application.Const;
|
||||||
using Admin.NET.Application.Entity;
|
using Admin.NET.Application.Entity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using NewLife.Reflection;
|
using NewLife.Reflection;
|
||||||
using Nest;
|
|
||||||
|
|
||||||
namespace Admin.NET.Application;
|
namespace Admin.NET.Application;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -19,15 +18,13 @@ public class InvoiceService : IDynamicApiController, ITransient
|
||||||
private readonly OutboundService _outboundService;
|
private readonly OutboundService _outboundService;
|
||||||
private readonly OutboundDetailService _outboundDetailService;
|
private readonly OutboundDetailService _outboundDetailService;
|
||||||
private readonly UserManager _userManager;
|
private readonly UserManager _userManager;
|
||||||
private readonly MaterialListService _materialListService;
|
|
||||||
public InvoiceService(SqlSugarRepository<Invoice> rep,
|
public InvoiceService(SqlSugarRepository<Invoice> rep,
|
||||||
UserManager userManager,
|
UserManager userManager,
|
||||||
PrintCodeDetailService codeDetailService,
|
PrintCodeDetailService codeDetailService,
|
||||||
ReportTableService reportTableService,
|
ReportTableService reportTableService,
|
||||||
OutboundService outboundService,
|
OutboundService outboundService,
|
||||||
OutboundDetailService outboundDetailService,
|
OutboundDetailService outboundDetailService,
|
||||||
ProductRetrospectService productRetrospect,
|
ProductRetrospectService productRetrospect)
|
||||||
MaterialListService materialListService)
|
|
||||||
{
|
{
|
||||||
_rep = rep;
|
_rep = rep;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
@ -36,7 +33,6 @@ public class InvoiceService : IDynamicApiController, ITransient
|
||||||
_reportTableService = reportTableService;
|
_reportTableService = reportTableService;
|
||||||
_outboundService = outboundService;
|
_outboundService = outboundService;
|
||||||
_outboundDetailService = outboundDetailService;
|
_outboundDetailService = outboundDetailService;
|
||||||
_materialListService = materialListService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -106,16 +102,7 @@ public class InvoiceService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
var entity = input.Adapt<Invoice>();
|
var entity = input.Adapt<Invoice>();
|
||||||
await _rep.InsertAsync(entity);
|
await _rep.InsertAsync(entity);
|
||||||
var id = entity.Id;
|
return entity.Id;
|
||||||
if (input.TableData!=null&&input.TableData.Count>0)
|
|
||||||
{
|
|
||||||
foreach (var item in input.TableData)
|
|
||||||
{
|
|
||||||
item.SourceId = id;
|
|
||||||
await _materialListService.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -143,22 +130,6 @@ public class InvoiceService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
var entity = input.Adapt<Invoice>();
|
var entity = input.Adapt<Invoice>();
|
||||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
||||||
if (input.TableData != null && input.TableData.Count > 0)
|
|
||||||
{
|
|
||||||
var list = await _materialListService.ListBySourceId(input.Id);
|
|
||||||
if (list!=null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < list.Count; i++)
|
|
||||||
{
|
|
||||||
await _materialListService.Delete(new DeleteMaterialListInput() { Id = list[i].Id });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
foreach (var item in input.TableData)
|
|
||||||
{
|
|
||||||
item.SourceId = input.Id;
|
|
||||||
await _materialListService.Add(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -283,34 +254,32 @@ public class InvoiceService : IDynamicApiController, ITransient
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
var report = await GetReport(item.ReportTableId);
|
var report = await GetReport(item.ReportTableId);
|
||||||
//var retrospect1 = new AddProductRetrospectInput()
|
var retrospect1 = new AddProductRetrospectInput()
|
||||||
//{
|
{
|
||||||
// BaseCount = item.BaseCount,
|
BaseCount = item.BaseCount,
|
||||||
// BaseUnit = item.BaseUnit,
|
BaseUnit = item.BaseUnit,
|
||||||
// //Batch = report.Batch,
|
//Batch = report.Batch,
|
||||||
// BusinessType = report.ProductType,
|
BusinessType = report.ProductType,
|
||||||
// CodeType = item.CodeName,
|
CodeType = item.CodeName,
|
||||||
// Location=addOutbound.Consignee,
|
Location=addOutbound.Consignee,
|
||||||
// Department = report.ProductionLine,
|
Department = report.ProductionLine,
|
||||||
// //WarehouseID = input.WarehouseId,
|
//WarehouseID = input.WarehouseId,
|
||||||
// WarehousingDate = DateTime.Now,
|
WarehousingDate = DateTime.Now,
|
||||||
// Count = 1,
|
Count = 1,
|
||||||
// CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
// ScanCodeTime = DateTime.Now,
|
ScanCodeTime = DateTime.Now,
|
||||||
// CreateUserId = userId,
|
CreateUserId = userId,
|
||||||
// CreateUserName = userName,
|
CreateUserName = userName,
|
||||||
// MaterialsId = report.MaterialsId,
|
MaterialsId = report.MaterialsId,
|
||||||
// OddNumber = report.OddNumber,
|
OddNumber = report.OddNumber,
|
||||||
// Receipt = "发货通知单",
|
Receipt = "发货通知单",
|
||||||
// SourceId = outbound,
|
SourceId = outbound,
|
||||||
// Unit = item.Unit,
|
Unit = item.Unit,
|
||||||
// Name = item.CodeName,
|
Name = item.CodeName,
|
||||||
// Code = item.Code,
|
Code = item.Code,
|
||||||
// Destination = invoice.Consignee
|
Destination = invoice.Consignee
|
||||||
//};
|
};
|
||||||
//await _productRetrospect.Add(retrospect1);
|
await _productRetrospect.Add(retrospect1);
|
||||||
|
|
||||||
await _productRetrospect.AddRetrospect(item.Adapt<PrintCodeDetail>(), report, "发货通知单", addOutbound.Consignee, outbound, input.WarehousingTableId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//var report = await _reportTableService.GetBySource(input.WarehousingTableId);
|
//var report = await _reportTableService.GetBySource(input.WarehousingTableId);
|
||||||
|
@ -344,16 +313,5 @@ public class InvoiceService : IDynamicApiController, ITransient
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取物料列表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
[ApiDescriptionSettings(Name = "MaterialListById")]
|
|
||||||
public async Task<List<MaterialListOutput>> MaterialListById(long? id)
|
|
||||||
{
|
|
||||||
return await _materialListService.ListBySourceId(id);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,38 +0,0 @@
|
||||||
namespace Admin.NET.Application;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表输出参数
|
|
||||||
/// </summary>
|
|
||||||
public class MaterialListDto
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 主键Id
|
|
||||||
/// </summary>
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料ID
|
|
||||||
/// </summary>
|
|
||||||
public long? MaterialsId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
public string? Unit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数量
|
|
||||||
/// </summary>
|
|
||||||
public int? Count { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 来源ID
|
|
||||||
/// </summary>
|
|
||||||
public long? SourceId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
public string? Remarks { get; set; }
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,108 +0,0 @@
|
||||||
using Admin.NET.Core;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Admin.NET.Application;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表基础输入参数
|
|
||||||
/// </summary>
|
|
||||||
public class MaterialListBaseInput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 物料ID
|
|
||||||
/// </summary>
|
|
||||||
public virtual long? MaterialsId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
public virtual string? Unit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数量
|
|
||||||
/// </summary>
|
|
||||||
public virtual int? Count { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 来源ID
|
|
||||||
/// </summary>
|
|
||||||
public virtual long? SourceId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
public virtual string? Remarks { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表分页查询输入参数
|
|
||||||
/// </summary>
|
|
||||||
public class MaterialListInput : BasePageInput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 关键字查询
|
|
||||||
/// </summary>
|
|
||||||
public string? SearchKey { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料ID
|
|
||||||
/// </summary>
|
|
||||||
public long? MaterialsId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
public string? Unit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数量
|
|
||||||
/// </summary>
|
|
||||||
public int? Count { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 来源ID
|
|
||||||
/// </summary>
|
|
||||||
public long? SourceId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
public string? Remarks { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表增加输入参数
|
|
||||||
/// </summary>
|
|
||||||
public class AddMaterialListInput : MaterialListBaseInput
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表删除输入参数
|
|
||||||
/// </summary>
|
|
||||||
public class DeleteMaterialListInput : BaseIdInput
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表更新输入参数
|
|
||||||
/// </summary>
|
|
||||||
public class UpdateMaterialListInput : MaterialListBaseInput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 主键Id
|
|
||||||
/// </summary>
|
|
||||||
[Required(ErrorMessage = "主键Id不能为空")]
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表主键查询输入参数
|
|
||||||
/// </summary>
|
|
||||||
public class QueryByIdMaterialListInput : DeleteMaterialListInput
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
namespace Admin.NET.Application;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表输出参数
|
|
||||||
/// </summary>
|
|
||||||
public class MaterialListOutput
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 主键Id
|
|
||||||
/// </summary>
|
|
||||||
public long Id { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 物料ID
|
|
||||||
/// </summary>
|
|
||||||
public long? MaterialsId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 单位
|
|
||||||
/// </summary>
|
|
||||||
public string? Unit { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 数量
|
|
||||||
/// </summary>
|
|
||||||
public int? Count { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 来源ID
|
|
||||||
/// </summary>
|
|
||||||
public long? SourceId { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 备注
|
|
||||||
/// </summary>
|
|
||||||
public string? Remarks { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,120 +0,0 @@
|
||||||
using Admin.NET.Core.Service;
|
|
||||||
using Admin.NET.Application.Const;
|
|
||||||
using Admin.NET.Application.Entity;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
namespace Admin.NET.Application;
|
|
||||||
/// <summary>
|
|
||||||
/// 物料列表服务
|
|
||||||
/// </summary>
|
|
||||||
[ApiDescriptionSettings(ApplicationConst.GroupName, Order = 100)]
|
|
||||||
public class MaterialListService : IDynamicApiController, ITransient
|
|
||||||
{
|
|
||||||
private readonly SqlSugarRepository<MaterialList> _rep;
|
|
||||||
public MaterialListService(SqlSugarRepository<MaterialList> rep)
|
|
||||||
{
|
|
||||||
_rep = rep;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 分页查询物料列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ApiDescriptionSettings(Name = "Page")]
|
|
||||||
public async Task<SqlSugarPagedList<MaterialListOutput>> Page(MaterialListInput input)
|
|
||||||
{
|
|
||||||
var query = _rep.AsQueryable()
|
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchKey), u =>
|
|
||||||
u.Unit.Contains(input.SearchKey.Trim())
|
|
||||||
|| u.Remarks.Contains(input.SearchKey.Trim())
|
|
||||||
)
|
|
||||||
.WhereIF(input.MaterialsId>0, u => u.MaterialsId == input.MaterialsId)
|
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Unit), u => u.Unit.Contains(input.Unit.Trim()))
|
|
||||||
.WhereIF(input.Count>0, u => u.Count == input.Count)
|
|
||||||
.WhereIF(input.SourceId>0, u => u.SourceId == input.SourceId)
|
|
||||||
.WhereIF(!string.IsNullOrWhiteSpace(input.Remarks), u => u.Remarks.Contains(input.Remarks.Trim()))
|
|
||||||
.Select<MaterialListOutput>();
|
|
||||||
return await query.OrderBuilder(input).ToPagedListAsync(input.Page, input.PageSize);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 增加物料列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ApiDescriptionSettings(Name = "Add")]
|
|
||||||
public async Task<long> Add(AddMaterialListInput input)
|
|
||||||
{
|
|
||||||
var entity = input.Adapt<MaterialList>();
|
|
||||||
await _rep.InsertAsync(entity);
|
|
||||||
return entity.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 删除物料列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ApiDescriptionSettings(Name = "Delete")]
|
|
||||||
public async Task Delete(DeleteMaterialListInput input)
|
|
||||||
{
|
|
||||||
var entity = await _rep.GetFirstAsync(u => u.Id == input.Id) ?? throw Oops.Oh(ErrorCodeEnum.D1002);
|
|
||||||
//await _rep.FakeDeleteAsync(entity); //假删除
|
|
||||||
await _rep.DeleteAsync(entity); //真删除
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 更新物料列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
|
||||||
[ApiDescriptionSettings(Name = "Update")]
|
|
||||||
public async Task Update(UpdateMaterialListInput input)
|
|
||||||
{
|
|
||||||
var entity = input.Adapt<MaterialList>();
|
|
||||||
await _rep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取物料列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
[ApiDescriptionSettings(Name = "Detail")]
|
|
||||||
public async Task<MaterialList> Detail([FromQuery] QueryByIdMaterialListInput input)
|
|
||||||
{
|
|
||||||
return await _rep.GetFirstAsync(u => u.Id == input.Id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取物料列表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
[ApiDescriptionSettings(Name = "List")]
|
|
||||||
public async Task<List<MaterialListOutput>> List()
|
|
||||||
{
|
|
||||||
return await _rep.AsQueryable().Select<MaterialListOutput>().ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取物料列表列表
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
[ApiDescriptionSettings(Name = "ListBySourceId")]
|
|
||||||
public async Task<List<MaterialListOutput>> ListBySourceId(long? sourceId)
|
|
||||||
{
|
|
||||||
return await _rep.AsQueryable().WhereIF(sourceId > 0, u => u.SourceId == sourceId).Select<MaterialListOutput>().ToListAsync();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -163,6 +163,5 @@ public class PrintCodeDetailService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
return await _rep.GetFirstAsync(a => a.Code == productCode);
|
return await _rep.GetFirstAsync(a => a.Code == productCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -151,7 +151,6 @@ public class ProductRetrospectService : IDynamicApiController, ITransient
|
||||||
return await _rep.AsQueryable().Select<ProductRetrospectOutput>().Where(a => !a.IsDelete).ToListAsync();
|
return await _rep.AsQueryable().Select<ProductRetrospectOutput>().Where(a => !a.IsDelete).ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取商品追溯列表
|
/// 获取商品追溯列表
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -164,42 +163,7 @@ public class ProductRetrospectService : IDynamicApiController, ITransient
|
||||||
return await _rep.AsQueryable().Where(u => !u.IsDelete && u.Code == productCode).Select<ProductRetrospectOutput>().ToListAsync();
|
return await _rep.AsQueryable().Where(u => !u.IsDelete && u.Code == productCode).Select<ProductRetrospectOutput>().ToListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task AddRetrospect(PrintCodeDetail item ,ReportTable report,string receipt, string location ,long? sourceId)
|
||||||
/// <summary>
|
|
||||||
/// 查询打印条码状态
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="productCode"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet]
|
|
||||||
[ApiDescriptionSettings(Name = "CheckCodeStatus")]
|
|
||||||
public async Task<int> CheckCodeStatus(string? productCode)
|
|
||||||
{
|
|
||||||
var codeEnt = await _rep.AsQueryable().Where(u => !u.IsDelete && u.Code == productCode).Select<ProductRetrospectOutput>().ToListAsync();
|
|
||||||
if (codeEnt == null || codeEnt.Count<1)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
var last = codeEnt.OrderBy(a => a.WarehousingDate).FirstOrDefault();
|
|
||||||
var receipt = last.Receipt == null ? "" : last.Receipt;
|
|
||||||
if (receipt.Contains("汇报单"))
|
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else if (receipt.Contains("仓库"))
|
|
||||||
{
|
|
||||||
return 2;
|
|
||||||
}
|
|
||||||
else if (receipt.Contains("发货"))
|
|
||||||
{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
else if (receipt.Contains("分销"))
|
|
||||||
{
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
public async Task AddRetrospect(PrintCodeDetail item ,ReportTable report,string receipt, string location ,long? sourceId,long? warehousingId)
|
|
||||||
{
|
{
|
||||||
var userId = _userManager.UserId;
|
var userId = _userManager.UserId;
|
||||||
var userName = _userManager.RealName;
|
var userName = _userManager.RealName;
|
||||||
|
@ -212,7 +176,7 @@ public class ProductRetrospectService : IDynamicApiController, ITransient
|
||||||
CodeType = item.CodeName,
|
CodeType = item.CodeName,
|
||||||
Location = location,
|
Location = location,
|
||||||
Department = report.ProductionLine,
|
Department = report.ProductionLine,
|
||||||
WarehouseID = warehousingId,
|
//WarehouseID = input.WarehouseId,
|
||||||
WarehousingDate = DateTime.Now,
|
WarehousingDate = DateTime.Now,
|
||||||
Count = 1,
|
Count = 1,
|
||||||
CreateTime = DateTime.Now,
|
CreateTime = DateTime.Now,
|
||||||
|
|
|
@ -190,40 +190,6 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
var userId = _userManager.UserId;
|
var userId = _userManager.UserId;
|
||||||
var userName = _userManager.RealName;
|
var userName = _userManager.RealName;
|
||||||
var topDatas = input.CodeDatas.FindAll(a => string.IsNullOrEmpty(a.FatherCode));
|
var topDatas = input.CodeDatas.FindAll(a => string.IsNullOrEmpty(a.FatherCode));
|
||||||
long reprotId = 0;
|
|
||||||
var report = await _reportTableService.GetBySource(input.WarehousingTableId);
|
|
||||||
if (report == null)
|
|
||||||
{
|
|
||||||
var newReport = new AddReportTableInput()
|
|
||||||
{
|
|
||||||
CreateTime = DateTime.Now,
|
|
||||||
IsDelete = false,
|
|
||||||
OddNumber = warehousing.OddNumber,
|
|
||||||
State = 0,
|
|
||||||
MaterialsId = warehousing.MaterialsId,
|
|
||||||
SourceId = input.WarehousingTableId,
|
|
||||||
ProductType = warehousing.ProductType,
|
|
||||||
ProductionLine = warehousing.ProductionLine,
|
|
||||||
BaseProductCount = repeatCodes.Count,
|
|
||||||
ProductCount = repeatCodes.Count,
|
|
||||||
Batch = warehousing.Batch,
|
|
||||||
CodeNum = materials.CodeNum,
|
|
||||||
Name = materials.Name,
|
|
||||||
CreateUserId = userId,
|
|
||||||
CreateUserName = userName,
|
|
||||||
StartDate = DateTime.Now,
|
|
||||||
SourceNumber = warehousing.SourceNumber,
|
|
||||||
Unit = warehousing.Unit,
|
|
||||||
Remarks = warehousing.Remarks
|
|
||||||
};
|
|
||||||
reprotId = await _reportTableService.Add(newReport);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reprotId = report.Id;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Dictionary<AddPrintCodeDetailInput, long> list = new Dictionary<AddPrintCodeDetailInput, long>();
|
Dictionary<AddPrintCodeDetailInput, long> list = new Dictionary<AddPrintCodeDetailInput, long>();
|
||||||
foreach (var item in topDatas)
|
foreach (var item in topDatas)
|
||||||
{
|
{
|
||||||
|
@ -233,7 +199,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
|
|
||||||
var detail = new AddPrintCodeDetailInput()
|
var detail = new AddPrintCodeDetailInput()
|
||||||
{
|
{
|
||||||
ReportTableId = reprotId,
|
ReportTableId = input.WarehousingTableId,
|
||||||
Code = code,
|
Code = code,
|
||||||
CodeName = codeType,
|
CodeName = codeType,
|
||||||
ChildCount = unit.ChildUnitCount,
|
ChildCount = unit.ChildUnitCount,
|
||||||
|
@ -255,7 +221,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
var unit2 = units.Find(a => a.Name == child.PackageName);
|
var unit2 = units.Find(a => a.Name == child.PackageName);
|
||||||
var detail2 = new AddPrintCodeDetailInput()
|
var detail2 = new AddPrintCodeDetailInput()
|
||||||
{
|
{
|
||||||
ReportTableId = reprotId,
|
ReportTableId = input.WarehousingTableId,
|
||||||
Code = code2,
|
Code = code2,
|
||||||
CodeName = codeType,
|
CodeName = codeType,
|
||||||
ChildCount = unit2.ChildUnitCount,
|
ChildCount = unit2.ChildUnitCount,
|
||||||
|
@ -279,7 +245,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
var unit3 = units.Find(a => a.Name == child3.PackageName);
|
var unit3 = units.Find(a => a.Name == child3.PackageName);
|
||||||
var detail3 = new AddPrintCodeDetailInput()
|
var detail3 = new AddPrintCodeDetailInput()
|
||||||
{
|
{
|
||||||
ReportTableId = reprotId,
|
ReportTableId = input.WarehousingTableId,
|
||||||
Code = code3,
|
Code = code3,
|
||||||
CodeName = codeType,
|
CodeName = codeType,
|
||||||
ChildCount = unit3.ChildUnitCount,
|
ChildCount = unit3.ChildUnitCount,
|
||||||
|
@ -304,7 +270,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
var unit4 = units.Find(a => a.Name == child4.PackageName);
|
var unit4 = units.Find(a => a.Name == child4.PackageName);
|
||||||
var detail4 = new AddPrintCodeDetailInput()
|
var detail4 = new AddPrintCodeDetailInput()
|
||||||
{
|
{
|
||||||
ReportTableId = reprotId,
|
ReportTableId = input.WarehousingTableId,
|
||||||
Code = code4,
|
Code = code4,
|
||||||
CodeName = codeType,
|
CodeName = codeType,
|
||||||
ChildCount = unit4.ChildUnitCount,
|
ChildCount = unit4.ChildUnitCount,
|
||||||
|
@ -329,7 +295,7 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
var unit5 = units.Find(a => a.Name == child5.PackageName);
|
var unit5 = units.Find(a => a.Name == child5.PackageName);
|
||||||
var detail5 = new AddPrintCodeDetailInput()
|
var detail5 = new AddPrintCodeDetailInput()
|
||||||
{
|
{
|
||||||
ReportTableId = reprotId,
|
ReportTableId = input.WarehousingTableId,
|
||||||
Code = code5,
|
Code = code5,
|
||||||
CodeName = codeType,
|
CodeName = codeType,
|
||||||
ChildCount = unit5.ChildUnitCount,
|
ChildCount = unit5.ChildUnitCount,
|
||||||
|
@ -382,6 +348,13 @@ public class ReportDetailTableService : IDynamicApiController, ITransient
|
||||||
await _productRetrospect.Add(retrospect1);
|
await _productRetrospect.Add(retrospect1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var report = await _reportTableService.GetBySource(input.WarehousingTableId);
|
||||||
|
if (report == null)
|
||||||
|
{
|
||||||
|
var newReport = new AddReportTableInput() { CreateTime = DateTime.Now, IsDelete = false, OddNumber = warehousing.OddNumber, State = 0, MaterialsId = warehousing.MaterialsId, SourceId = input.WarehousingTableId, ProductType = warehousing.ProductType, ProductionLine = warehousing.ProductionLine };
|
||||||
|
var addReport = await _reportTableService.Add(newReport);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//var details = await _warehouseDetails.List();
|
//var details = await _warehouseDetails.List();
|
||||||
//if (details != null && details.Any(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit))
|
//if (details != null && details.Any(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit))
|
||||||
|
|
|
@ -229,5 +229,4 @@ public class UpdateReportTableInput : ReportTableBaseInput
|
||||||
public class QueryByIdReportTableInput : DeleteReportTableInput
|
public class QueryByIdReportTableInput : DeleteReportTableInput
|
||||||
{
|
{
|
||||||
public string? Code { get; set; }
|
public string? Code { get; set; }
|
||||||
public long? SourceId { get; set; }
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
item.ReportTableId = entity.Id;
|
item.ReportTableId = entity.Id;
|
||||||
var ent = item.Adapt<PrintCodeDetail>();
|
var ent = item.Adapt<PrintCodeDetail>();
|
||||||
await _codeDetailService.UpdateByEntity(ent);
|
await _codeDetailService.UpdateByEntity(ent);
|
||||||
await _productRetrospectService.AddRetrospect(ent, entity, "汇报单", entity.ProductionLine, entity.Id, null);
|
await _productRetrospectService.AddRetrospect(ent, entity, "汇报单", entity.ProductionLine, entity.Id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
[ApiDescriptionSettings(Name = "Detail")]
|
[ApiDescriptionSettings(Name = "Detail")]
|
||||||
public async Task<ReportTable> Detail([FromQuery] QueryByIdReportTableInput input)
|
public async Task<ReportTable> Detail([FromQuery] QueryByIdReportTableInput input)
|
||||||
{
|
{
|
||||||
return await _rep.GetFirstAsync(u => u.Id == input.Id || (input.SourceId > 0 && u.SourceId == input.SourceId));
|
return await _rep.GetFirstAsync(u => u.Id == input.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -261,9 +261,9 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(unitGroup));
|
throw new ArgumentNullException(nameof(unitGroup));
|
||||||
}
|
}
|
||||||
var unit = units.Find(a => a.Name == input.Package);
|
var unit = units.Find(a => a.Name == input.Name);
|
||||||
if (unit == null)
|
if (unit == null)
|
||||||
throw new ArgumentNullException(nameof(unit));
|
throw new ArgumentNullException(nameof(unitGroup));
|
||||||
|
|
||||||
var newReport = new AddPrintRecordsInput() { CreateTime = DateTime.Now, Unit = input.Package, Name = input.Name, IsDelete = false, Batch = input.Batch, ProductDate = input.ProductDate, LoseDate = input.LoseDate, ProductCount = input.PrintDatas?.Count, MaterialsId = input.MaterialsId };
|
var newReport = new AddPrintRecordsInput() { CreateTime = DateTime.Now, Unit = input.Package, Name = input.Name, IsDelete = false, Batch = input.Batch, ProductDate = input.ProductDate, LoseDate = input.LoseDate, ProductCount = input.PrintDatas?.Count, MaterialsId = input.MaterialsId };
|
||||||
var addReport = await _printRecordsService.Add(newReport);
|
var addReport = await _printRecordsService.Add(newReport);
|
||||||
|
@ -292,7 +292,6 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
BaseUnit = baseUnit,
|
BaseUnit = baseUnit,
|
||||||
PrintCodeTime = DateTime.Now,
|
PrintCodeTime = DateTime.Now,
|
||||||
CreateUserId = userId,
|
CreateUserId = userId,
|
||||||
MaterialsId = input.MaterialsId,
|
|
||||||
CreateUserName = userName
|
CreateUserName = userName
|
||||||
};
|
};
|
||||||
var detailId = await _codeDetailService.Add(detail);
|
var detailId = await _codeDetailService.Add(detail);
|
||||||
|
@ -308,7 +307,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
foreach (var dt in printDatas)
|
foreach (var dt in printDatas)
|
||||||
{
|
{
|
||||||
var code2 = CodeHelper.GetCode(dt.BarCode, dt.QrCode);
|
var code2 = CodeHelper.GetCode(dt.BarCode, dt.QrCode);
|
||||||
var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, MaterialsId = input.MaterialsId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
var detail2 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code, FatherId = detailId, Code = code2, ChildCount = currUnit.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit.Name, BaseCount = currUnit.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
||||||
var detailId2 = await _codeDetailService.Add(detail2);
|
var detailId2 = await _codeDetailService.Add(detail2);
|
||||||
var treeData2 = detail2.Adapt<PrintCodeTreeData>();
|
var treeData2 = detail2.Adapt<PrintCodeTreeData>();
|
||||||
if (tempUnits.Count > 1)
|
if (tempUnits.Count > 1)
|
||||||
|
@ -319,7 +318,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
foreach (var dt3 in printDatas3)
|
foreach (var dt3 in printDatas3)
|
||||||
{
|
{
|
||||||
var code3 = CodeHelper.GetCode(dt3.BarCode, dt3.QrCode);
|
var code3 = CodeHelper.GetCode(dt3.BarCode, dt3.QrCode);
|
||||||
var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, MaterialsId = input.MaterialsId, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
var detail3 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code2, FatherId = detailId2, Code = code3, ChildCount = currUnit3.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit3.Name, BaseCount = currUnit3.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
||||||
var detailId3 = await _codeDetailService.Add(detail3);
|
var detailId3 = await _codeDetailService.Add(detail3);
|
||||||
var treeData3 = detail3.Adapt<PrintCodeTreeData>();
|
var treeData3 = detail3.Adapt<PrintCodeTreeData>();
|
||||||
if (tempUnits.Count > 2)
|
if (tempUnits.Count > 2)
|
||||||
|
@ -330,7 +329,7 @@ public class ReportTableService : IDynamicApiController, ITransient
|
||||||
foreach (var dt4 in printDatas4)
|
foreach (var dt4 in printDatas4)
|
||||||
{
|
{
|
||||||
var code4 = CodeHelper.GetCode(dt4.BarCode, dt4.QrCode);
|
var code4 = CodeHelper.GetCode(dt4.BarCode, dt4.QrCode);
|
||||||
var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, MaterialsId = input.MaterialsId, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
var detail4 = new AddPrintCodeDetailInput() { TempListId = addReport, FatherCode = code3, FatherId = detailId3, Code = code4, ChildCount = currUnit4.ChildUnitCount, CodeName = codeType, Count = 1, Unit = currUnit4.Name, BaseCount = currUnit4.Rate, BaseUnit = baseUnit, PrintCodeTime = DateTime.Now, CreateUserId = userId, CreateUserName = userName };
|
||||||
var treeData4 = detail4.Adapt<PrintCodeTreeData>();
|
var treeData4 = detail4.Adapt<PrintCodeTreeData>();
|
||||||
treeData3.Children.Add(treeData4);
|
treeData3.Children.Add(treeData4);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
using Admin.NET.Application.Const;
|
using Admin.NET.Application.Const;
|
||||||
using Admin.NET.Application.Entity;
|
using Admin.NET.Application.Entity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using SqlSugar;
|
|
||||||
|
|
||||||
namespace Admin.NET.Application;
|
namespace Admin.NET.Application;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 调库出库服务
|
/// 调库出库服务
|
||||||
|
@ -132,7 +130,7 @@ public class WarehouseTransferService : IDynamicApiController, ITransient
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 商品调库
|
/// 商品出货
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="input"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
@ -229,8 +227,34 @@ public class WarehouseTransferService : IDynamicApiController, ITransient
|
||||||
foreach (var item in list)
|
foreach (var item in list)
|
||||||
{
|
{
|
||||||
var report = await GetReport(item.ReportTableId);
|
var report = await GetReport(item.ReportTableId);
|
||||||
await _productRetrospect.AddRetrospect(item.Adapt<PrintCodeDetail>(), report, "调库出库单", "", item.ReportTableId, input.WarehousingTableId);
|
var retrospect1 = new AddProductRetrospectInput()
|
||||||
|
{
|
||||||
|
BaseCount = item.BaseCount,
|
||||||
|
BaseUnit = item.BaseUnit,
|
||||||
|
//Batch = report.Batch,
|
||||||
|
BusinessType = report.ProductType,
|
||||||
|
CodeType = item.CodeName,
|
||||||
|
Location = addOutbound.Consignee,
|
||||||
|
Department = report.ProductionLine,
|
||||||
|
//WarehouseID = input.WarehouseId,
|
||||||
|
WarehousingDate = DateTime.Now,
|
||||||
|
Count = 1,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
ScanCodeTime = DateTime.Now,
|
||||||
|
CreateUserId = userId,
|
||||||
|
CreateUserName = userName,
|
||||||
|
MaterialsId = report.MaterialsId,
|
||||||
|
OddNumber = report.OddNumber,
|
||||||
|
Receipt = "调库出库单",
|
||||||
|
SourceId = outbound,
|
||||||
|
Unit = item.Unit,
|
||||||
|
Name = item.CodeName,
|
||||||
|
Code = item.Code,
|
||||||
|
//Destination = invoice.Consignee
|
||||||
|
};
|
||||||
|
await _productRetrospect.Add(retrospect1);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Dictionary<long, ReportTable> reportDic = new Dictionary<long, ReportTable>();
|
static Dictionary<long, ReportTable> reportDic = new Dictionary<long, ReportTable>();
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
using Admin.NET.Application.Const;
|
using Admin.NET.Application.Const;
|
||||||
using Admin.NET.Application.Entity;
|
using Admin.NET.Application.Entity;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Mapster;
|
|
||||||
|
|
||||||
namespace Admin.NET.Application;
|
namespace Admin.NET.Application;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 入库统计服务
|
/// 入库统计服务
|
||||||
|
@ -15,12 +13,12 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
private readonly WarehouseDetailsService _warehouseDetails;
|
private readonly WarehouseDetailsService _warehouseDetails;
|
||||||
private readonly MaterialsService _materialsService;
|
private readonly MaterialsService _materialsService;
|
||||||
private readonly SysUnitService _sysUnitService;
|
private readonly SysUnitService _sysUnitService;
|
||||||
|
private readonly MaterialClassifyService _materialClassifyService;
|
||||||
private readonly PrintCodeDetailService _codeDetailService;
|
private readonly PrintCodeDetailService _codeDetailService;
|
||||||
private readonly ProductRetrospectService _productRetrospect;
|
private readonly ProductRetrospectService _productRetrospect;
|
||||||
|
//private readonly ProductWarehousingService _productWarehousing;
|
||||||
private readonly ReportDetailTableService _reportDetailTable;
|
private readonly ReportDetailTableService _reportDetailTable;
|
||||||
private readonly UserManager _userManager;
|
private readonly UserManager _userManager;
|
||||||
private readonly ReportTableService _reportTableService;
|
|
||||||
private readonly WarehouseService _warehouseService;
|
|
||||||
|
|
||||||
public WarehousingStatisticsService(SqlSugarRepository<WarehousingStatistics> rep,
|
public WarehousingStatisticsService(SqlSugarRepository<WarehousingStatistics> rep,
|
||||||
UserManager userManager,
|
UserManager userManager,
|
||||||
|
@ -29,9 +27,8 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
SysUnitService sysUnitService,
|
SysUnitService sysUnitService,
|
||||||
PrintCodeDetailService codeDetailService,
|
PrintCodeDetailService codeDetailService,
|
||||||
ProductRetrospectService productRetrospect,
|
ProductRetrospectService productRetrospect,
|
||||||
ReportDetailTableService reportDetailTable,
|
MaterialClassifyService materialClassifyService,
|
||||||
ReportTableService reportTableService,
|
ReportDetailTableService reportDetailTable)
|
||||||
WarehouseService warehouseService)
|
|
||||||
{
|
{
|
||||||
_rep = rep;
|
_rep = rep;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
@ -40,9 +37,9 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
_sysUnitService = sysUnitService;
|
_sysUnitService = sysUnitService;
|
||||||
_codeDetailService = codeDetailService;
|
_codeDetailService = codeDetailService;
|
||||||
_productRetrospect = productRetrospect;
|
_productRetrospect = productRetrospect;
|
||||||
|
_materialClassifyService = materialClassifyService;
|
||||||
|
//_productWarehousing = productWarehousing;
|
||||||
_reportDetailTable = reportDetailTable;
|
_reportDetailTable = reportDetailTable;
|
||||||
_reportTableService = reportTableService;
|
|
||||||
_warehouseService = warehouseService;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -179,9 +176,7 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
var details = await _warehouseDetails.List();
|
var details = await _warehouseDetails.List();
|
||||||
var userId = _userManager.UserId;
|
var userId = _userManager.UserId;
|
||||||
var userName = _userManager.RealName;
|
var userName = _userManager.RealName;
|
||||||
ReportTable reportTable = null;
|
ReportDetailTable reportTable = null;
|
||||||
var warehouse = await _warehouseService.Detail(new QueryByIdWarehouseInput() { Id = input.WarehouseId.Value });
|
|
||||||
var warehouseName = warehouse == null ? "" : warehouse.Name;
|
|
||||||
foreach (var item in input.CodeDatas)
|
foreach (var item in input.CodeDatas)
|
||||||
{
|
{
|
||||||
var product = await _codeDetailService.GetByProductCode(item);
|
var product = await _codeDetailService.GetByProductCode(item);
|
||||||
|
@ -190,44 +185,16 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
//product.WarehouseID = input.WarehouseId;
|
//product.WarehouseID = input.WarehouseId;
|
||||||
reportTable = await _reportTableService.Detail(new QueryByIdReportTableInput() { Id = product.ReportTableId.Value,SourceId=product.ReportTableId });
|
reportTable = await _reportDetailTable.Detail(new QueryByIdReportDetailTableInput() { Id = product.ReportTableId.Value });
|
||||||
if (reportTable==null)
|
|
||||||
{
|
|
||||||
var table = await _reportDetailTable.Detail(new QueryByIdReportDetailTableInput() { Id = product.ReportTableId.Value });
|
|
||||||
if (table!=null)
|
|
||||||
{
|
|
||||||
reportTable = new ReportTable()
|
|
||||||
{
|
|
||||||
BaseProductCount = table.BaseProductCount,
|
|
||||||
Batch = table.Batch,
|
|
||||||
CodeNum = table.CodeNum,
|
|
||||||
CreateTime = table.CreateTime,
|
|
||||||
CreateUser = table.CreateUser,
|
|
||||||
CreateUserId = table.CreateUserId,
|
|
||||||
CreateUserName = table.CreateUserName,
|
|
||||||
MaterialsId = table.MaterialsId,
|
|
||||||
OddNumber = table.OddNumber,
|
|
||||||
ProductCount = table.ProductCount,
|
|
||||||
ProductionLine = table.ProductionLine,
|
|
||||||
ProductType = table.ProductType,
|
|
||||||
SourceNumber = table.SourceNumber,
|
|
||||||
StartDate = table.ProductDate,
|
|
||||||
Unit = table.Unit,
|
|
||||||
Remarks = table.Remarks
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (reportTable!=null)
|
if (reportTable!=null)
|
||||||
{
|
{
|
||||||
var materials = await _materialsService.GetById(reportTable.MaterialsId);
|
var materials = await _materialsService.GetById(reportTable.MaterialsId);
|
||||||
if (materials == null)
|
if (materials == null)
|
||||||
continue;
|
continue;
|
||||||
var units = await _sysUnitService.ListByGroupId(materials.UnitGroupId);
|
var units = await _sysUnitService.ListByGroupId(materials.UnitGroupId);
|
||||||
var baseUnit = units.FirstOrDefault().Name;
|
var baseUnit = units.LastOrDefault().Name;
|
||||||
|
|
||||||
var unit = units.Find(a => a.Name == reportTable.Unit);
|
var unit = units.Find(a => a.Name == reportTable.Unit);
|
||||||
if (unit == null)
|
|
||||||
unit = units.FirstOrDefault();
|
|
||||||
if (details != null && details.Any(a => a.MaterialsId == reportTable.MaterialsId && a.Unit == reportTable.Unit))
|
if (details != null && details.Any(a => a.MaterialsId == reportTable.MaterialsId && a.Unit == reportTable.Unit))
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -247,11 +214,36 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
newEnt.BaseCount = unit.Rate;
|
newEnt.BaseCount = unit.Rate;
|
||||||
newEnt.WarehouseId = input.WarehouseId;
|
newEnt.WarehouseId = input.WarehouseId;
|
||||||
newEnt.GoodCode = item;
|
newEnt.GoodCode = item;
|
||||||
newEnt.MaterialsNum = materials.CodeNum;
|
newEnt.MaterialsNum = reportTable.ProductCodeNum;
|
||||||
var addId = await _warehouseDetails.Add(newEnt);
|
var addId = await _warehouseDetails.Add(newEnt);
|
||||||
}
|
}
|
||||||
|
|
||||||
await _productRetrospect.AddRetrospect(product, reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
|
|
||||||
|
|
||||||
|
var retrospect1 = new AddProductRetrospectInput()
|
||||||
|
{
|
||||||
|
BaseCount = unit.Rate,
|
||||||
|
BaseUnit = baseUnit,
|
||||||
|
Batch = reportTable.Batch,
|
||||||
|
BusinessType = "入库单",
|
||||||
|
CodeType = input.WarehousingType,
|
||||||
|
Department = reportTable.ProductionLine,
|
||||||
|
//WarehouseID = input.WarehouseId,
|
||||||
|
WarehousingDate = DateTime.Now,
|
||||||
|
Count = 1,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
ScanCodeTime = DateTime.Now,
|
||||||
|
CreateUserId = userId,
|
||||||
|
CreateUserName = userName,
|
||||||
|
MaterialsId = reportTable.MaterialsId,
|
||||||
|
OddNumber = reportTable.OddNumber,
|
||||||
|
Receipt = "汇报单",
|
||||||
|
SourceId = reportTable.Id,
|
||||||
|
Unit = unit.Name,
|
||||||
|
Name = materials.Name,
|
||||||
|
Code = item
|
||||||
|
};//Destination = warehousing.Supplier,
|
||||||
|
await _productRetrospect.Add(retrospect1);
|
||||||
|
|
||||||
var childs = codeDetails.FindAll(a => a.FatherCode == item);
|
var childs = codeDetails.FindAll(a => a.FatherCode == item);
|
||||||
if (childs.Count>0)
|
if (childs.Count>0)
|
||||||
|
@ -259,7 +251,30 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
var currentUnit = units.FirstOrDefault(a => a.Name == childs.FirstOrDefault().Unit);
|
var currentUnit = units.FirstOrDefault(a => a.Name == childs.FirstOrDefault().Unit);
|
||||||
foreach (var c1 in childs)
|
foreach (var c1 in childs)
|
||||||
{
|
{
|
||||||
await _productRetrospect.AddRetrospect(c1.Adapt<PrintCodeDetail>(), reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
|
var retrospect2 = new AddProductRetrospectInput()
|
||||||
|
{
|
||||||
|
BaseCount = currentUnit.Rate,
|
||||||
|
BaseUnit = baseUnit,
|
||||||
|
Batch = reportTable.Batch,
|
||||||
|
BusinessType = "入库单",
|
||||||
|
CodeType = input.WarehousingType,
|
||||||
|
Department = reportTable.ProductionLine,
|
||||||
|
//WarehouseID = input.WarehouseId,
|
||||||
|
WarehousingDate = DateTime.Now,
|
||||||
|
Count = 1,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
ScanCodeTime = DateTime.Now,
|
||||||
|
CreateUserId = userId,
|
||||||
|
CreateUserName = userName,
|
||||||
|
MaterialsId = reportTable.MaterialsId,
|
||||||
|
OddNumber = reportTable.OddNumber,
|
||||||
|
Receipt = "汇报单",
|
||||||
|
SourceId = reportTable.Id,
|
||||||
|
Unit = currentUnit.Name,
|
||||||
|
Name = materials.Name,
|
||||||
|
Code = c1.Code
|
||||||
|
};//Destination = warehousing.Supplier,
|
||||||
|
await _productRetrospect.Add(retrospect2);
|
||||||
|
|
||||||
var childs3 = codeDetails.FindAll(a => a.FatherCode == c1.Code);
|
var childs3 = codeDetails.FindAll(a => a.FatherCode == c1.Code);
|
||||||
if (childs3.Count > 0)
|
if (childs3.Count > 0)
|
||||||
|
@ -267,30 +282,100 @@ public class WarehousingStatisticsService : IDynamicApiController, ITransient
|
||||||
var currentUnit3 = units.FirstOrDefault(a => a.Name == childs3.FirstOrDefault().Unit);
|
var currentUnit3 = units.FirstOrDefault(a => a.Name == childs3.FirstOrDefault().Unit);
|
||||||
foreach (var c3 in childs3)
|
foreach (var c3 in childs3)
|
||||||
{
|
{
|
||||||
await _productRetrospect.AddRetrospect(c3.Adapt<PrintCodeDetail>(), reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
|
var retrospect3 = new AddProductRetrospectInput()
|
||||||
|
{
|
||||||
|
BaseCount = currentUnit3.Rate,
|
||||||
|
BaseUnit = baseUnit,
|
||||||
|
Batch = reportTable.Batch,
|
||||||
|
BusinessType = "入库单",
|
||||||
|
CodeType = input.WarehousingType,
|
||||||
|
Department = reportTable.ProductionLine,
|
||||||
|
//WarehouseID = input.WarehouseId,
|
||||||
|
WarehousingDate = DateTime.Now,
|
||||||
|
Count = 1,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
ScanCodeTime = DateTime.Now,
|
||||||
|
CreateUserId = userId,
|
||||||
|
CreateUserName = userName,
|
||||||
|
MaterialsId = reportTable.MaterialsId,
|
||||||
|
OddNumber = reportTable.OddNumber,
|
||||||
|
Receipt = "汇报单",
|
||||||
|
SourceId = reportTable.Id,
|
||||||
|
Unit = currentUnit3.Name,
|
||||||
|
Name = materials.Name,
|
||||||
|
Code = c3.Code
|
||||||
|
};//Destination = warehousing.Supplier,
|
||||||
|
await _productRetrospect.Add(retrospect3);
|
||||||
|
|
||||||
var childs4 = codeDetails.FindAll(a => a.FatherCode == c3.Code);
|
var childs4 = codeDetails.FindAll(a => a.FatherCode == c3.Code);
|
||||||
if (childs4.Count > 0)
|
if (childs4.Count > 0)
|
||||||
{
|
{
|
||||||
var currentUnit4 = units.FirstOrDefault(a => a.Name == childs4.FirstOrDefault().Unit);
|
var currentUnit4 = units.FirstOrDefault(a => a.Name == childs4.FirstOrDefault().Unit);
|
||||||
foreach (var c4 in childs4)
|
foreach (var c4 in childs4)
|
||||||
{
|
{
|
||||||
await _productRetrospect.AddRetrospect(c4.Adapt<PrintCodeDetail>(), reportTable, "入库单", warehouseName, reportTable.Id, input.WarehouseId);
|
var retrospect4 = new AddProductRetrospectInput()
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
var newDetail = reportTable.Adapt<AddWarehousingStatisticsInput>();
|
|
||||||
if (reportTable!=null)
|
|
||||||
{
|
{
|
||||||
newDetail.SourceId = reportTable?.Id;
|
BaseCount = currentUnit4.Rate,
|
||||||
|
BaseUnit = baseUnit,
|
||||||
|
Batch = reportTable.Batch,
|
||||||
|
BusinessType = "入库单",
|
||||||
|
CodeType = input.WarehousingType,
|
||||||
|
Department = reportTable.ProductionLine,
|
||||||
|
//WarehouseID = input.WarehouseId,
|
||||||
|
WarehousingDate = DateTime.Now,
|
||||||
|
Count = 1,
|
||||||
|
CreateTime = DateTime.Now,
|
||||||
|
ScanCodeTime = DateTime.Now,
|
||||||
|
CreateUserId = userId,
|
||||||
|
CreateUserName = userName,
|
||||||
|
MaterialsId = reportTable.MaterialsId,
|
||||||
|
OddNumber = reportTable.OddNumber,
|
||||||
|
Receipt = "汇报单",
|
||||||
|
SourceId = reportTable.Id,
|
||||||
|
Unit = currentUnit4.Name,
|
||||||
|
Name = materials.Name,
|
||||||
|
Code = c4.Code
|
||||||
|
};//Destination = warehousing.Supplier,
|
||||||
|
await _productRetrospect.Add(retrospect4);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//var warehousing = await Detail(new QueryByIdReportDetailTableInput() { Id = input.WarehousingTableId.Value });
|
||||||
|
//if (warehousing == null)
|
||||||
|
//{
|
||||||
|
// throw Oops.Oh(ErrorCodeEnum.xg1002);
|
||||||
|
//}
|
||||||
|
|
||||||
|
//var details = await _warehouseDetails.List();
|
||||||
|
//if (details != null && details.Any(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit))
|
||||||
|
//{
|
||||||
|
// var unit = units.Find(a => a.Name == warehousing.Unit);
|
||||||
|
// var detail = details.Find(a => a.MaterialsId == warehousing.MaterialsId && a.Unit == warehousing.Unit);
|
||||||
|
// detail.Count += warehousing.Count;
|
||||||
|
// if (unit != null)
|
||||||
|
// {
|
||||||
|
// detail.BaseCount = detail.Count * unit.Rate;
|
||||||
|
// }
|
||||||
|
// await _warehouseDetails.UpdateByEntity(detail.Adapt<WarehouseDetails>());
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// var newEnt = warehousing.Adapt<AddWarehouseDetailsInput>();
|
||||||
|
// newEnt.SourceId = warehousing.Id;
|
||||||
|
// var addId = await _warehouseDetails.Add(newEnt);
|
||||||
|
//}
|
||||||
|
|
||||||
|
var newDetail = reportTable.Adapt<AddWarehousingStatisticsInput>();
|
||||||
|
newDetail.SourceId = reportTable.Id;
|
||||||
await Add(newDetail);
|
await Add(newDetail);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ enum Api {
|
||||||
PageMaterials = '/api/materials/page',
|
PageMaterials = '/api/materials/page',
|
||||||
DetailMaterials = '/api/materials/detail',
|
DetailMaterials = '/api/materials/detail',
|
||||||
ListMaterials = '/api/materials/list',
|
ListMaterials = '/api/materials/list',
|
||||||
MtListBySourceId = '/api/materialList/listBySourceId'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 增加物料
|
// 增加物料
|
||||||
|
@ -57,11 +56,3 @@ export const listMaterials = () =>
|
||||||
data: { },
|
data: { },
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// 附带的物料列表
|
|
||||||
export const materialListBySourceId = (sourceId: any) =>
|
|
||||||
request({
|
|
||||||
url: Api.MtListBySourceId,
|
|
||||||
method: 'get',
|
|
||||||
data: { sourceId },
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="invoice-container">
|
<div class="invoice-container">
|
||||||
<el-dialog v-model="isShowDialog" :width="860" draggable="">
|
<el-dialog v-model="isShowDialog" :width="800" draggable="">
|
||||||
<template #header>
|
<template #header>
|
||||||
<div style="color: #fff">
|
<div style="color: #fff">
|
||||||
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
|
<!--<el-icon size="16" style="margin-right: 3px; display: inline; vertical-align: middle"> <ele-Edit /> </el-icon>-->
|
||||||
<span>{{ props.title }}</span>
|
<span>{{ props.title }}</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" >
|
<el-form :model="ruleForm" ref="ruleFormRef" label-width="auto" :rules="rules">
|
||||||
<el-row :gutter="35">
|
<el-row :gutter="35">
|
||||||
<el-form-item v-show="false">
|
<el-form-item v-show="false">
|
||||||
<el-input v-model="ruleForm.id" />
|
<el-input v-model="ruleForm.id" />
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="业务类型" prop="businessType" :rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
|
<el-form-item label="业务类型" prop="businessType">
|
||||||
<el-select v-model="ruleForm.businessType" placeholder="请选择" clearable>
|
<el-select v-model="ruleForm.businessType" placeholder="请选择" clearable>
|
||||||
<el-option label="销售出库" value="销售出库" />
|
<el-option label="销售出库" value="销售出库" />
|
||||||
<el-option label="其他出库" value="其他出库" />
|
<el-option label="其他出库" value="其他出库" />
|
||||||
|
@ -39,9 +39,9 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
<el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb20">
|
||||||
<el-form-item label="仓库" prop="warehouseId" :rules="[{ required: true, message: '仓库不能为空', trigger: 'blur' }]">
|
<el-form-item label="仓库" prop="warehouse" :rules="[{ required: true, message: '仓库不能为空', trigger: 'blur' }]">
|
||||||
<el-select v-model="ruleForm.warehouseId" placeholder="请选择" clearable @change="warehouseChange">
|
<el-select v-model="ruleForm.warehouse" placeholder="请选择" clearable >
|
||||||
<el-option :label="item.name" :value="item.id" v-for="item, index in warehouses"
|
<el-option :label="item.name" :value="item.name" v-for="item, index in warehouses"
|
||||||
:key="index" />
|
:key="index" />
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -97,52 +97,6 @@
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-card class="full-table" shadow="hover" style="margin-top: 5px">
|
|
||||||
<el-table
|
|
||||||
:data="ruleForm.tableData"
|
|
||||||
style="width: 100%"
|
|
||||||
v-loading="loading"
|
|
||||||
tooltip-effect="light"
|
|
||||||
row-key="id"
|
|
||||||
border="">
|
|
||||||
<el-table-column prop="materialsId" label="物料" width="180" align="center">
|
|
||||||
<template #default="scope">
|
|
||||||
<el-select v-model="scope.row.materialsId" placeholder="请选择" autocomplete="off" controls-position="right" clearable @change="materialsChange">
|
|
||||||
<el-option :label="item.name" :value="item.id" v-for="item, index in materials" :key="index" />
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="unit" label="单位" width="120" show-overflow-tooltip="" >
|
|
||||||
<template #default="scope">
|
|
||||||
<el-select v-model="scope.row.unit" placeholder="请选择" clearable autocomplete="off" >
|
|
||||||
<el-option :label="item.name" :value="item.name" v-for="item, index in units" :key="index" />
|
|
||||||
</el-select>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="count" label="数量" width="100" show-overflow-tooltip="" >
|
|
||||||
<template #default="scope">
|
|
||||||
<el-input-number v-model="scope.row.count" autocomplete="off" controls-position="right"/>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column prop="remarks" label="备注" width="140" show-overflow-tooltip="" >
|
|
||||||
<template #default="scope">
|
|
||||||
<el-input v-model="scope.row.remarks" autocomplete="off" />
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column label="操作" width="140" align="center" fixed="right" show-overflow-tooltip="" >
|
|
||||||
<template #default="scope">
|
|
||||||
<el-button link type="primary" icon="el-icon-delete" @click.prevent="handleColDelete(scope.$index)">删除</el-button>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
</el-table>
|
|
||||||
<div style="text-align: left; margin-top: 10px">
|
|
||||||
<el-button icon="ele-Plus" @click="addColumn">新增物料</el-button>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</el-card>
|
|
||||||
|
|
||||||
|
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<span class="dialog-footer">
|
<span class="dialog-footer">
|
||||||
|
@ -160,7 +114,7 @@
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref, onMounted, reactive } from 'vue';
|
import { ref,onMounted } from "vue";
|
||||||
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
|
import { getDictDataItem as di, getDictDataList as dl } from '/@/utils/dict-utils';
|
||||||
import { ElMessage } from "element-plus";
|
import { ElMessage } from "element-plus";
|
||||||
import type { FormRules } from "element-plus";
|
import type { FormRules } from "element-plus";
|
||||||
|
@ -168,9 +122,6 @@
|
||||||
import { listWarehouse } from '/@/api/main/warehouse';
|
import { listWarehouse } from '/@/api/main/warehouse';
|
||||||
import { listSupplier } from '/@/api/main/supplier';
|
import { listSupplier } from '/@/api/main/supplier';
|
||||||
import { listCustom } from '/@/api/main/custom';
|
import { listCustom } from '/@/api/main/custom';
|
||||||
import { listMaterials, detailMaterials, materialListBySourceId } from '/@/api/main/materials';
|
|
||||||
import { listUnitGroup } from '/@/api/main/unit';
|
|
||||||
import { getCurrentDate } from '/@/utils/formatTime';
|
|
||||||
|
|
||||||
//父级传递来的参数
|
//父级传递来的参数
|
||||||
var props = defineProps({
|
var props = defineProps({
|
||||||
|
@ -187,36 +138,23 @@
|
||||||
const warehouses = ref<any>([]);
|
const warehouses = ref<any>([]);
|
||||||
const suppliers = ref<any>([]);
|
const suppliers = ref<any>([]);
|
||||||
const customs = ref<any>([]);
|
const customs = ref<any>([]);
|
||||||
const loading = ref(false);
|
|
||||||
var colIndex = 0;
|
|
||||||
const materials = ref<any>([]);
|
|
||||||
const units = ref<any>([]);
|
|
||||||
const tableData = ref<any>([]);
|
|
||||||
|
|
||||||
//自行添加其他规则
|
//自行添加其他规则
|
||||||
const rules = ref<FormRules>({
|
const rules = ref<FormRules>({
|
||||||
// businessType: [{required: true, message: '请输入业务类型!', trigger: 'blur',},],
|
businessType: [{required: true, message: '请输入业务类型!', trigger: 'blur',},],
|
||||||
// custom: [{required: true, message: '请输入客户!', trigger: 'blur',},],
|
custom: [{required: true, message: '请输入客户!', trigger: 'blur',},],
|
||||||
// warehouse: [{required: true, message: '请输入仓库!', trigger: 'blur',},],
|
warehouse: [{required: true, message: '请输入仓库!', trigger: 'blur',},],
|
||||||
});
|
});
|
||||||
|
|
||||||
// 打开弹窗
|
// 打开弹窗
|
||||||
const openDialog = async (row: any) => {
|
const openDialog = async (row: any) => {
|
||||||
// ruleForm = JSON.parse(JSON.stringify(row));
|
// ruleForm.value = JSON.parse(JSON.stringify(row));
|
||||||
// 改用detail获取最新数据来编辑
|
// 改用detail获取最新数据来编辑
|
||||||
let rowData = JSON.parse(JSON.stringify(row));
|
let rowData = JSON.parse(JSON.stringify(row));
|
||||||
if (rowData.id)
|
if (rowData.id)
|
||||||
{
|
|
||||||
ruleForm.value = (await detailInvoice(rowData.id)).data.result;
|
ruleForm.value = (await detailInvoice(rowData.id)).data.result;
|
||||||
ruleForm.value.tableData = (await materialListBySourceId(rowData.id)).data.result;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
|
||||||
ruleForm.value = rowData;
|
ruleForm.value = rowData;
|
||||||
ruleForm.value.codeNum = getCurrentDate();
|
|
||||||
}
|
|
||||||
|
|
||||||
materials.value = (await listMaterials()).data.result;
|
|
||||||
isShowDialog.value = true;
|
isShowDialog.value = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -235,7 +173,6 @@
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
ruleFormRef.value.validate(async (isValid: boolean, fields?: any) => {
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
console.log('true');
|
|
||||||
let values = ruleForm.value;
|
let values = ruleForm.value;
|
||||||
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
|
if (ruleForm.value.id == undefined || ruleForm.value.id == null || ruleForm.value.id == "" || ruleForm.value.id == 0) {
|
||||||
await addInvoice(values);
|
await addInvoice(values);
|
||||||
|
@ -244,7 +181,6 @@
|
||||||
}
|
}
|
||||||
closeDialog();
|
closeDialog();
|
||||||
} else {
|
} else {
|
||||||
console.log('flase');
|
|
||||||
ElMessage({
|
ElMessage({
|
||||||
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
message: `表单有${Object.keys(fields).length}处验证失败,请修改后再提交`,
|
||||||
type: "error",
|
type: "error",
|
||||||
|
@ -253,37 +189,11 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料值变更
|
|
||||||
* @param clearBindUserId 是否清空
|
|
||||||
*/
|
|
||||||
const materialsChange = async (value : any) => {
|
|
||||||
//ruleForm.value.materialsId=value.id;
|
|
||||||
let material = (await detailMaterials(value)).data.result;
|
|
||||||
//console.log(material);
|
|
||||||
if(material.id){
|
|
||||||
var res = await listUnitGroup(material.unitGroupId ?? 0);
|
|
||||||
units.value = res.data.result ?? [];
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// 增加列
|
|
||||||
function addColumn() {
|
|
||||||
//console.log('object');
|
|
||||||
tableData.value.push({
|
|
||||||
materialsId: 0,
|
|
||||||
unit: '箱',
|
|
||||||
count:1,
|
|
||||||
remarks: '',
|
|
||||||
sourceId:0,
|
|
||||||
index: tableData.value.length+1,
|
|
||||||
});
|
|
||||||
|
|
||||||
ruleForm.value.tableData = tableData.value;
|
|
||||||
colIndex++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 页面加载时
|
// 页面加载时
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
|
@ -292,43 +202,6 @@ function addColumn() {
|
||||||
customs.value = (await listCustom()).data.result;
|
customs.value = (await listCustom()).data.result;
|
||||||
});
|
});
|
||||||
|
|
||||||
const warehouseChange = async (value : any) => {
|
|
||||||
//ruleForm.value.materialsId=value.id;
|
|
||||||
let dir = warehouses.value.find((item) => item.id === value);
|
|
||||||
// console.log(dir.name);
|
|
||||||
ruleForm.value.warehouse = dir.name;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
function handleColDelete(index: number) {
|
|
||||||
tableData.value.splice(index, 1);
|
|
||||||
ruleForm.value.tableData = tableData.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上移
|
|
||||||
function handleColUp(record: any, index: number) {
|
|
||||||
if (record) {
|
|
||||||
var data1 = ChangeExForArray(index, index - 1, ruleForm.value.tableData);
|
|
||||||
return data1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 下移
|
|
||||||
function handleColDown(record: any, index: number) {
|
|
||||||
if (record) {
|
|
||||||
return ChangeExForArray(index, index + 1, ruleForm.value.tableData);
|
|
||||||
}
|
|
||||||
//console.log(record);
|
|
||||||
}
|
|
||||||
|
|
||||||
function ChangeExForArray(index1: number, index2: number, array: Array<any>) {
|
|
||||||
//console.log(array);
|
|
||||||
let temp = array[index1];
|
|
||||||
array[index1] = array[index2];
|
|
||||||
array[index2] = temp;
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
//将属性或者函数暴露给父组件
|
//将属性或者函数暴露给父组件
|
||||||
defineExpose({ openDialog });
|
defineExpose({ openDialog });
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue