修改出入库业务更新判断

This commit is contained in:
2023-06-29 08:56:31 +08:00
parent 7350d0db89
commit c25310aa17
2 changed files with 36 additions and 1 deletions

View File

@@ -151,7 +151,7 @@ namespace Tnb.WarehouseMgr
barCode.codeqty = detail.pr_qty!.Value;
barCode.unit_id = detail.unit_id;
barCode.is_lock = 0;
barCode.is_end = "0";
barCode.is_end = 0;
barCode.require_id = detail.bill_id;
barCode.require_code = _dicBillCodes.ContainsKey(detail.bill_id) ? _dicBillCodes[detail.bill_id]?.ToString() : "";
barCode.create_id = _userManager.UserId;
@@ -199,6 +199,10 @@ namespace Tnb.WarehouseMgr
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
//如果是自动单据,需要回更上层系统
}
else {
//任务没有结束,更新状态为工作中
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
}
}
await _db.Ado.CommitTranAsync();

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Aop.Api.Domain;
using JNPF.Common.Core.Manager;
using JNPF.Common.Dtos.VisualDev;
using JNPF.Common.Extension;
@@ -337,6 +338,10 @@ namespace Tnb.WarehouseMgr
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
//如果是自动单据,需要回更上层系统
}
else {
//如果没有完成,修改为工作中
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
}
await _wareCarryService.UpdateNullCarry(carry);
}
else if (outStatus == EnumOutStatus.)
@@ -359,6 +364,32 @@ namespace Tnb.WarehouseMgr
x.create_time = DateTime.Now;
});
await _db.Insertable(osCodes).ExecuteCommandAsync();
// 更新主表
var detailIds = osCodes.Select(x => x.bill_d_id).ToList();
var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id));
var dic = osCodes.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
{
//如果没有完成,修改为工作中
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
}
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => input.carryIds.Contains(it.carry_id)).ToListAsync();
var dicCodeQty = carryCodes.GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.First().codeqty);