134 lines
5.2 KiB
C#
134 lines
5.2 KiB
C#
using JNPF.Common.Core.Manager;
|
|
using JNPF.Common.Dtos.VisualDev;
|
|
using JNPF.Common.Enums;
|
|
using JNPF.Common.Extension;
|
|
using JNPF.Common.Filter;
|
|
using JNPF.Common.Security;
|
|
using JNPF.EventBus;
|
|
using JNPF.FriendlyException;
|
|
using JNPF.Systems.Interfaces.System;
|
|
using JNPF.VisualDev;
|
|
using JNPF.VisualDev.Entitys;
|
|
using JNPF.VisualDev.Interfaces;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using SqlSugar;
|
|
using Tnb.BasicData.Entities;
|
|
using Tnb.BasicData.Interfaces;
|
|
using Tnb.ProductionMgr.Entities.Dto.PrdManage;
|
|
using Tnb.WarehouseMgr.Entities;
|
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
|
using Tnb.WarehouseMgr.Entities.Consts;
|
|
using Tnb.WarehouseMgr.Entities.Dto;
|
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
|
using Tnb.WarehouseMgr.Entities.Enums;
|
|
using Tnb.WarehouseMgr.Interfaces;
|
|
|
|
namespace Tnb.WarehouseMgr
|
|
{
|
|
/// <summary>
|
|
/// 销售出库服务
|
|
/// </summary>
|
|
[OverideVisualDev(ModuleConsts.MODULE_WMSSORTINGTASK_ID)]
|
|
[ServiceModule(BizTypeId)]
|
|
public class WmsSortingtaskService : BaseWareHouseService, IPdaStroage
|
|
{
|
|
private const string BizTypeId = "34088685351445";
|
|
private readonly ISqlSugarClient _db;
|
|
private readonly IRunService _runService;
|
|
private readonly IVisualDevService _visualDevService;
|
|
private readonly IBasLocationService _basLocationService;
|
|
private readonly IWareHouseService _wareHouseService;
|
|
private readonly IBillRullService _billRullService;
|
|
private readonly IUserManager _userManager;
|
|
private readonly IWmsCarryBindService _wmsCarryBindService;
|
|
public WmsSortingtaskService(
|
|
ISqlSugarRepository<WmsDelivery> repository,
|
|
IRunService runService,
|
|
IVisualDevService visualDevService,
|
|
IBasLocationService basLocationService,
|
|
IBillRullService billRullService,
|
|
IWareHouseService wareHouseService,
|
|
IUserManager userManager,
|
|
IEventPublisher eventPublisher
|
|
)
|
|
{
|
|
_db = repository.AsSugarClient();
|
|
_runService = runService;
|
|
_visualDevService = visualDevService;
|
|
_basLocationService = basLocationService;
|
|
_billRullService = billRullService;
|
|
_wareHouseService = wareHouseService;
|
|
_userManager = userManager;
|
|
|
|
OverideFuncs.CreateAsync = Create;
|
|
}
|
|
|
|
private async Task<dynamic> Create(VisualDevModelDataCrInput input)
|
|
{
|
|
//在线开发
|
|
try
|
|
{
|
|
VisualDevEntity? templateEntity = await _visualDevService.GetInfoById(ModuleConsts.MODULE_WMSSORTINGTASK_ID, true);
|
|
await _runService.Create(templateEntity, input);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
return Task.FromResult(1);
|
|
}
|
|
public override async Task ModifyAsync(WareHouseUpInput input)
|
|
{
|
|
if (input == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(input));
|
|
}
|
|
|
|
int row = await _db.Updateable<WmsDelivery>().SetColumns(it => new WmsDelivery { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
|
if (row < 1)
|
|
{
|
|
throw Oops.Oh(ErrorCode.COM1001);
|
|
}
|
|
}
|
|
|
|
[HttpPost]
|
|
public async Task<dynamic> WmsSourtingtaskList(WmsSortingtaskListOutput input)
|
|
{
|
|
Dictionary<string, object> queryJson = string.IsNullOrEmpty(input.queryJson) ? new Dictionary<string, object>() : input.queryJson.ToObject<Dictionary<string, object>>();
|
|
string? status = queryJson.ContainsKey("status") ? queryJson["status"].ToString() : "";
|
|
if (string.IsNullOrEmpty(input.sidx))
|
|
{
|
|
input.sidx = "a.id";
|
|
}
|
|
else
|
|
{
|
|
input.sidx = input.sidx.Replace("create_time", "a.create_time").Replace("erp_bill_code", "e.erp_bill_code");
|
|
|
|
}
|
|
SqlSugarPagedList<WmsSortingtask> result = await _db.Queryable<WmsSortingtask>()
|
|
.InnerJoin<WmsCarryCode>((a, b) => a.carry_id == b.carry_id)
|
|
.InnerJoin<BasMaterial>((a, b, c) => b.material_id == c.id)
|
|
.InnerJoin<WmsSaleD>((a, b, c, d) => a.source_id == d.id)
|
|
.InnerJoin<WmsSaleH>((a, b, c, d, e) => e.id == d.bill_id)
|
|
.WhereIF(!string.IsNullOrEmpty(status), (a, b, c, d, e) => a.status == status)
|
|
.Select((a, b, c, d, e) => new WmsSortingtask
|
|
{
|
|
create_time = DateTime.Parse(a.create_time.ToString("yyyy-MM-dd HH:mm:ss")),
|
|
material_id = c.id,
|
|
material_code =c.code ,
|
|
material_name = c.name,
|
|
material_specification =c.material_specification,
|
|
code_batch = b.code_batch,
|
|
erp_bill_code = e.erp_bill_code
|
|
}, true)
|
|
.OrderBy($"{input.sidx} {input.sort}")
|
|
.ToPagedListAsync(input.currentPage, input.pageSize);
|
|
|
|
return PageResult<WmsSortingtask>.SqlSugarPageResult(result);
|
|
|
|
}
|
|
|
|
}
|
|
}
|