出库签收业务回更全部出
This commit is contained in:
@@ -35,6 +35,5 @@ namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ public partial class WmsOutstockCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public int barcode_qty { get; set; }
|
||||
public decimal codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Tnb.WarehouseMgr
|
||||
.ToListAsync();
|
||||
if (carryCodesPart?.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
carryCodes.AddRange(carryCodesPart);
|
||||
var codeQty = carryCodes.Sum(x => x.codeqty);
|
||||
if (codeQty < os.pr_qty)
|
||||
@@ -249,5 +249,77 @@ namespace Tnb.WarehouseMgr
|
||||
it => it.line_status = dic.ContainsKey(it.line_status) ? dic[it.line_status]?.ToString()! : "");
|
||||
return items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 测试
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public async Task Testxx()
|
||||
{
|
||||
var carryCodePropNames = typeof(WmsCarryCode).GetProperties().Select(p => p.Name);
|
||||
var outStockCodePropNames = typeof(WmsOutstockCode).GetProperties().Select(p => p.Name);
|
||||
var intersects = carryCodePropNames.Intersect(outStockCodePropNames).ToList();
|
||||
var excepts = carryCodePropNames.Except(outStockCodePropNames).ToList();
|
||||
var excepts2 = outStockCodePropNames.Except(carryCodePropNames).ToList();
|
||||
|
||||
//bill_id,bill_line,bill_d_id,bill_d_line,code_qty
|
||||
var str = "";
|
||||
}
|
||||
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
var carryId = input.carryIds[^input.carryIds.Count];
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
if (carry != null)
|
||||
{
|
||||
var outStatus = carry.out_status.ToEnum<EnumOutStatus>();
|
||||
if (outStatus == EnumOutStatus.全部出)
|
||||
{
|
||||
//当前载具对应的所有条码插入
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
var outStockCodes = carryCodes.Adapt<List<WmsOutstockCode>>();
|
||||
var otds = await _db.Queryable<WmsOutstockD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
outStockCodes.ForEach(x =>
|
||||
{
|
||||
var billDId = otds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_id = input.requireId;
|
||||
x.bill_d_id = billDId;
|
||||
x.org_id = _userManager.User.OrganizeId;
|
||||
x.create_id = _userManager.UserId;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
await _db.Insertable(outStockCodes).ExecuteCommandAsync();
|
||||
|
||||
var detailIds = outStockCodes.Select(x => x.bill_d_id).ToList();
|
||||
var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id));
|
||||
var dic = outStockCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList());
|
||||
foreach (var osd in curOutstockDetails)
|
||||
{
|
||||
if (dic.ContainsKey(osd.id))
|
||||
{
|
||||
osd.qty += dic[osd.id].Sum(d => d);
|
||||
if (osd.qty >= osd.pr_qty)
|
||||
{
|
||||
osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Updateable(curOutstockDetails).ExecuteCommandAsync();
|
||||
if (otds.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
}
|
||||
}
|
||||
else if (outStatus == EnumOutStatus.分拣出)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -293,7 +293,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
await _db.Updateable(instockDetails).ExecuteCommandAsync();
|
||||
if (instockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
var allInstockDetails = await _db.Queryable<WmsInstockD>().Where(it=>it.bill_id ==input.requireId).ToListAsync();
|
||||
if (allInstockDetails.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Tnb.WarehouseMgr
|
||||
private readonly IWareHouseService _wareHouseService;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly IUserManager _userManager;
|
||||
private const string BizTypeId = "26172520979237";
|
||||
private const string BizTypeId = "26186830379045";
|
||||
|
||||
public WmsSetSortingService(ISqlSugarRepository<WmsSetsortingH> repository, IWareHouseService wareHouseService, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
@@ -198,7 +198,7 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.齐套, location_id = "", location_code = "" }).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { carry_status = (int)EnumCarryStatus.齐套, location_id = null, location_code = null }).ExecuteCommandAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = (int)EnumCarryStatus.空闲 }).ExecuteCommandAsync();
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Tnb.WarehouseMgr
|
||||
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == carry.location_id);
|
||||
loc.is_use = (int)EnumCarryStatus.空闲;
|
||||
await _db.Updateable(loc).UpdateColumns(it => it.is_use).ExecuteCommandAsync();
|
||||
WareHouseUpInput upInput = new() { bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
||||
WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
||||
await DoUpdate(upInput); //回更业务
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.FriendlyException;
|
||||
@@ -14,6 +15,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Enums;
|
||||
@@ -24,12 +26,14 @@ namespace Tnb.WarehouseMgr
|
||||
/// <summary>
|
||||
/// 齐套出库服务类
|
||||
/// </summary>
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmskittingOutService : BaseWareHouseService, IWmskittingOutService
|
||||
{
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IWareHouseService _warehouseService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private const string BizTypeId = "26169472620837";
|
||||
public WmskittingOutService(ISqlSugarRepository<WmsKittingoutH> repository, IWareHouseService warehouseService, IUserManager userManager, IBillRullService billRullService)
|
||||
{
|
||||
_db = repository.AsSugarClient();
|
||||
@@ -185,6 +189,14 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||
var isOk = await _db.Updateable<WmsKittingoutH>().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user