入库申请模块代码提交
This commit is contained in:
@@ -71,6 +71,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
||||
/// </summary>
|
||||
public const string BILLSTATUS_ON_ID = "25065143245845";
|
||||
/// <summary>
|
||||
/// 单据状态-完成
|
||||
/// </summary>
|
||||
public const string BILLSTATUS_COMPLETE_ID = "25065149810453";
|
||||
/// <summary>
|
||||
/// 任务类型-入库TypeId
|
||||
/// </summary>
|
||||
public const string WMS_PRETASK_INSTOCK_TYPE_ID = "26126748597797";
|
||||
|
||||
@@ -19,5 +19,7 @@ namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||
/// 任务执行Ids
|
||||
/// </summary>
|
||||
public List<string> disTaskIds { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,5 +19,11 @@ namespace Tnb.WarehouseMgr.Entities.Dto
|
||||
/// 单据业务类型Id
|
||||
/// </summary>
|
||||
public string bizTypeId { get; set; }
|
||||
/// <summary>
|
||||
/// 任务执行条码表
|
||||
/// </summary>
|
||||
public List<WmsDistaskCode> distaskCodes { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,11 +441,12 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
foreach (var dt in disTasks)
|
||||
{
|
||||
if (_userManager.User.LoginType == "App")
|
||||
if (_userManager.UserOrigin.Equals("app", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
dt.biz_type = $"pda{dt.biz_type}";
|
||||
}
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id };
|
||||
var disTaskCodes = await _db.Queryable<WmsDistaskCode>().Where(it => it.bill_id == dt.id).ToListAsync();
|
||||
var upInput = new WareHouseUpInput { bizTypeId = dt.biz_type, requireId = dt.require_id, distaskCodes = disTaskCodes };
|
||||
if (dt.is_chain == 0)
|
||||
{
|
||||
await DoUpdate(upInput);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace Tnb.WarehouseMgr
|
||||
[ServiceModule(BizTypeId)]
|
||||
public class WmsPDACarryMoveInStockService : BaseWareHouseService
|
||||
{
|
||||
private const string BizTypeId = "26121988909861";
|
||||
private const string BizTypeId = "pda26121988909861";
|
||||
private const string ModuleId = "26476127634469";
|
||||
private readonly ISqlSugarClient _db;
|
||||
private readonly IRunService _runService;
|
||||
@@ -116,7 +116,7 @@ namespace Tnb.WarehouseMgr
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks,null);
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||
if (isOk)
|
||||
{
|
||||
var preTaskUpInput = new GenPreTaskUpInput();
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Tnb.WarehouseMgr
|
||||
var b = items.Find(x => x.material_code == materialCode && x.code_batch == codeBatch);
|
||||
if (b != null)
|
||||
{
|
||||
b.barcode = jo.Value<string>(nameof(WmsInstockCode.barcode));
|
||||
b.barcode = jo.Value<string>(nameof(WmsInstockCode.barcode))!;
|
||||
b.barcode_qty = jo.Value<int>(nameof(WmsInstockCode.barcode_qty));
|
||||
instockCOdes.Add(b);
|
||||
}
|
||||
@@ -245,7 +245,39 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
public override async Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
if (input == null) throw new ArgumentNullException("input");
|
||||
//更具distaskCode的barcode 更新 instockcode 的 is_end 为 1
|
||||
if (input.distaskCodes?.Count > 0)
|
||||
{
|
||||
var barCodes = input.distaskCodes.Select(x => x.barcode);
|
||||
await _db.Updateable<WmsInstockCode>().SetColumns(it => new WmsInstockCode { is_end = 1 }).Where(it => barCodes.Contains(it.barcode)).ExecuteCommandAsync();
|
||||
var instockCodes = await _db.Queryable<WmsInstockCode>().Where(it => barCodes.Contains(it.barcode)).Select(it => new
|
||||
{
|
||||
id = it.bill_d_id,
|
||||
barcode_qty = it.barcode_qty,
|
||||
}).ToListAsync();
|
||||
var dic = instockCodes.GroupBy(g => g.id).ToDictionary(x => x.Key, x => x.Select(d => d.barcode_qty).ToList());
|
||||
var ids = instockCodes.Select(it => it.id).ToList();
|
||||
var instockDetails = await _db.Queryable<WmsInstockD>().Where(it => ids.Contains(it.id)).ToListAsync();
|
||||
|
||||
foreach (var item in instockDetails)
|
||||
{
|
||||
if (dic.ContainsKey(item.id))
|
||||
{
|
||||
item.qty += dic[item.id].Sum(x => x);
|
||||
if (item.qty >= item.pr_qty)
|
||||
{
|
||||
item.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Updateable(instockDetails).ExecuteCommandAsync();
|
||||
if (instockDetails.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();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,11 @@ namespace JNPF.Systems.Entitys.Permission;
|
||||
/// <summary>
|
||||
/// 用户信息基类.
|
||||
/// </summary>
|
||||
public partial class UserEntity
|
||||
public partial class UserEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录类型
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public string LoginType { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user