齐套出库,齐套分拣,更新明细条码表,再更新明细,最后更新主表
This commit is contained in:
@@ -24,10 +24,6 @@ public partial class WmsKittingoutCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string bill_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int bill_line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物品ID
|
||||
@@ -62,7 +58,7 @@ public partial class WmsKittingoutCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public int barcode_qty { get; set; }
|
||||
public decimal codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
@@ -113,10 +109,4 @@ public partial class WmsKittingoutCode : BaseEntity<string>
|
||||
/// 出库单明细ID
|
||||
/// </summary>
|
||||
public string bill_d_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 出库单明细行号
|
||||
/// </summary>
|
||||
public int bill_d_line { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -109,5 +109,9 @@ public partial class WmsKittingoutD : BaseEntity<string>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
/// <summary>
|
||||
/// 明细状态
|
||||
/// </summary>
|
||||
public string line_status { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
|
||||
@@ -24,10 +24,6 @@ public partial class WmsSetsortingCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string bill_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int bill_line { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 物品ID
|
||||
@@ -62,7 +58,7 @@ public partial class WmsSetsortingCode : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 条码数量
|
||||
/// </summary>
|
||||
public int barcode_qty { get; set; }
|
||||
public int codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
@@ -104,9 +100,4 @@ public partial class WmsSetsortingCode : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string bill_d_id { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 出库单明细行号
|
||||
/// </summary>
|
||||
public int bill_d_line { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -98,5 +98,9 @@ public partial class WmsSetsortingD : BaseEntity<string>
|
||||
/// 修改时间
|
||||
/// </summary>
|
||||
public DateTime? modify_time { get; set; }
|
||||
/// <summary>
|
||||
/// 明细状态
|
||||
/// </summary>
|
||||
public string line_status { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@@ -282,8 +282,8 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpGet]
|
||||
public async Task Testxx()
|
||||
{
|
||||
var carryCodePropNames = typeof(WmsDistaskCode).GetProperties().Select(p => p.Name);
|
||||
var outStockCodePropNames = typeof(WmsOutstockCode).GetProperties().Select(p => p.Name);
|
||||
var carryCodePropNames = typeof(WmsCarryCode).GetProperties().Select(p => p.Name);
|
||||
var outStockCodePropNames = typeof(WmsSetsortingCode).GetProperties().Select(p => p.Name);
|
||||
var intersects = carryCodePropNames.Intersect(outStockCodePropNames).ToList();
|
||||
var excepts = carryCodePropNames.Except(outStockCodePropNames).ToList();
|
||||
var excepts2 = outStockCodePropNames.Except(carryCodePropNames).ToList();
|
||||
|
||||
@@ -240,6 +240,44 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
var carryId = input.carryIds[^input.carryIds.Count];
|
||||
var ssds = await _db.Queryable<WmsSetsortingD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
|
||||
var sortingCoees = carryCodes.Adapt<List<WmsSetsortingCode>>();
|
||||
sortingCoees.ForEach(x =>
|
||||
{
|
||||
var billDId = ssds?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
|
||||
if (billDId.IsNullOrEmpty())
|
||||
{
|
||||
billDId = ssds?.Find(xx => xx.material_id == x.material_id)?.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(sortingCoees).ExecuteCommandAsync();
|
||||
var detailIds = sortingCoees.Select(x => x.bill_d_id).ToList();
|
||||
var curSortingDetails = ssds.FindAll(x => detailIds.Contains(x.id));
|
||||
var dic = sortingCoees.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList());
|
||||
foreach (var osd in curSortingDetails)
|
||||
{
|
||||
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;
|
||||
}
|
||||
else
|
||||
{
|
||||
osd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Updateable(curSortingDetails).ExecuteCommandAsync();
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
if (carry != null)
|
||||
{
|
||||
@@ -251,7 +289,7 @@ namespace Tnb.WarehouseMgr
|
||||
carry.carry_status = ((int)EnumCarryStatus.齐套).ToString();
|
||||
carry.location_id = null;
|
||||
carry.location_code = null;
|
||||
await _db.Updateable(carry).UpdateColumns(it => new { it.out_status,it.carry_status, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||
await _db.Updateable(carry).UpdateColumns(it => new { it.out_status, it.carry_status, it.location_id, it.location_code }).ExecuteCommandAsync();
|
||||
await _db.Deleteable<WmsCarryMat>().Where(it => it.carry_id == carryId).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
|
||||
@@ -202,12 +202,50 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
var isOk = await _db.Updateable<WmsKittingoutH>().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
var carryId = input.carryIds[^input.carryIds.Count];
|
||||
var kods = await _db.Queryable<WmsKittingoutD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
//当前载具对应的所有条码插入
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
var kittingoutCodes = carryCodes.Adapt<List<WmsKittingoutCode>>();
|
||||
kittingoutCodes.ForEach(x =>
|
||||
{
|
||||
var billDId = kods?.Find(xx => xx.material_id == x.material_id && xx.code_batch == x.code_batch)?.id;
|
||||
if (billDId.IsNullOrEmpty())
|
||||
{
|
||||
billDId = kods?.Find(xx => xx.material_id == x.material_id)?.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;
|
||||
});
|
||||
var row = await _db.Insertable(kittingoutCodes).ExecuteCommandAsync();
|
||||
var detailIds = kittingoutCodes.Select(x => x.bill_d_id).ToList();
|
||||
var curKittingoutDetails = kods.FindAll(x => detailIds.Contains(x.id));
|
||||
var dic = kittingoutCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList());
|
||||
foreach (var kod in curKittingoutDetails)
|
||||
{
|
||||
if (dic.ContainsKey(kod.id))
|
||||
{
|
||||
kod.qty += dic[kod.id].Sum(d => d);
|
||||
if (kod.qty >= kod.pr_qty)
|
||||
{
|
||||
kod.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
kod.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Updateable(curKittingoutDetails).ExecuteCommandAsync();
|
||||
var isOk = await _db.Updateable<WmsKittingoutH>().SetColumns(it => new WmsKittingoutH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandHasChangeAsync();
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
if (carry != null)
|
||||
{
|
||||
var row = await _carryService.UpdateNullCarry(carry);
|
||||
row = await _carryService.UpdateNullCarry(carry);
|
||||
isOk = row > 0;
|
||||
}
|
||||
if (!isOk) throw Oops.Oh(ErrorCode.COM1001);
|
||||
|
||||
Reference in New Issue
Block a user