Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -124,6 +124,10 @@ namespace Tnb.WarehouseMgr.Entities.Consts
|
|||||||
/// 预任务生成业务类型-配送申请
|
/// 预任务生成业务类型-配送申请
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string BIZTYPE_WMSDELIVERY_ID = "26585291847957";
|
public const string BIZTYPE_WMSDELIVERY_ID = "26585291847957";
|
||||||
|
/// <summary>
|
||||||
|
/// 条码打印状态-已完成
|
||||||
|
/// </summary>
|
||||||
|
public const string BARCODE_PRINT_STATUS_COMPLETE_ID = "26191372853541";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 条码打印输入参数
|
||||||
|
/// </summary>
|
||||||
|
public class BarCodePrintInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 入库申请单Id列表
|
||||||
|
/// </summary>
|
||||||
|
public List<string> BillIds { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 扫码入库输入参数
|
||||||
|
/// </summary>
|
||||||
|
public class SacnBarCodeInStockInput
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 入库单ID
|
||||||
|
/// </summary>
|
||||||
|
public string bill_id { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
107
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTempCode.cs
Normal file
107
WarehouseMgr/Tnb.WarehouseMgr.Entities/Entity/WmsTempCode.cs
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
using JNPF.Common.Contracts;
|
||||||
|
using JNPF.Common.Security;
|
||||||
|
using SqlSugar;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 条码临时表
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("wms_temp_code")]
|
||||||
|
public partial class WmsTempCode : BaseEntity<string>
|
||||||
|
{
|
||||||
|
public WmsTempCode()
|
||||||
|
{
|
||||||
|
id = SnowflakeIdHelper.NextId();
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 所属组织
|
||||||
|
/// </summary>
|
||||||
|
public string? org_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料ID
|
||||||
|
/// </summary>
|
||||||
|
public string? material_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 物料编号
|
||||||
|
/// </summary>
|
||||||
|
public string? material_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 条码编号
|
||||||
|
/// </summary>
|
||||||
|
public string? barcode { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 批次
|
||||||
|
/// </summary>
|
||||||
|
public string? code_batch { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 条码数量
|
||||||
|
/// </summary>
|
||||||
|
public int? codeqty { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 单位ID
|
||||||
|
/// </summary>
|
||||||
|
public string? unit_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否锁定
|
||||||
|
/// </summary>
|
||||||
|
public int? is_lock { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 是否结束
|
||||||
|
/// </summary>
|
||||||
|
public string? is_end { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 需求单据ID
|
||||||
|
/// </summary>
|
||||||
|
public string? require_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 需求单据代码
|
||||||
|
/// </summary>
|
||||||
|
public string? require_code { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
public string? remark { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 扩展
|
||||||
|
/// </summary>
|
||||||
|
public string? extras { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建用户
|
||||||
|
/// </summary>
|
||||||
|
public string? create_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? create_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改用户
|
||||||
|
/// </summary>
|
||||||
|
public string? modify_id { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 修改时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? modify_time { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 时间戳
|
||||||
|
/// </summary>
|
||||||
|
public DateTime? time_stamp { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,11 +3,15 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JNPF.Common.Core.Manager;
|
||||||
using JNPF.Systems.Interfaces.System;
|
using JNPF.Systems.Interfaces.System;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Minio.DataModel;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Consts;
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
namespace Tnb.WarehouseMgr
|
namespace Tnb.WarehouseMgr
|
||||||
@@ -19,10 +23,12 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
private readonly ISqlSugarClient _db;
|
private readonly ISqlSugarClient _db;
|
||||||
private readonly IDictionaryDataService _dictionaryDataService;
|
private readonly IDictionaryDataService _dictionaryDataService;
|
||||||
public WmsInStockService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService)
|
private readonly IUserManager _userManager;
|
||||||
|
public WmsInStockService(ISqlSugarRepository<WmsInstockH> repository, IDictionaryDataService dictionaryDataService, IUserManager userManager)
|
||||||
{
|
{
|
||||||
_db = repository.AsSugarClient();
|
_db = repository.AsSugarClient();
|
||||||
_dictionaryDataService = dictionaryDataService;
|
_dictionaryDataService = dictionaryDataService;
|
||||||
|
_userManager = userManager;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据入库申请单ID获取申请单明细信息
|
/// 根据入库申请单ID获取申请单明细信息
|
||||||
@@ -41,9 +47,66 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 条码打印
|
/// 条码打印
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="input">
|
||||||
|
/// <br/>{
|
||||||
|
/// <br/> BillIds:入库申请单Id列表
|
||||||
|
/// <br/>}
|
||||||
|
/// </param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <exception cref="ArgumentNullException"></exception>
|
||||||
|
/// <exception cref="ArgumentException"></exception>
|
||||||
|
[HttpPost]
|
||||||
|
public async Task BarCodePrint(BarCodePrintInput input)
|
||||||
|
{
|
||||||
|
if (input == null) throw new ArgumentNullException("input");
|
||||||
|
if (input.BillIds == null || input.BillIds.Count == 0) throw new ArgumentException($"parameter {nameof(input.BillIds)} not be null or zero");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
|
||||||
|
var inStockDetails = await _db.Queryable<WmsInstockD>().Where(it => input.BillIds.Contains(it.bill_id)).ToListAsync();
|
||||||
|
if (inStockDetails?.Count > 0)
|
||||||
|
{
|
||||||
|
List<WmsTempCode> wmsTempCodes = new();
|
||||||
|
for (int i = 0; i < inStockDetails.Count; i++)
|
||||||
|
{
|
||||||
|
WmsTempCode barCode = new();
|
||||||
|
barCode.org_id = inStockDetails[i].org_id;
|
||||||
|
barCode.material_id = inStockDetails[i].material_id;
|
||||||
|
barCode.material_code = inStockDetails[i].material_code;
|
||||||
|
var code = $"{inStockDetails[i].material_code}{inStockDetails[i].code_batch}{(i + 1).ToString().PadLeft(4, '0')}";
|
||||||
|
barCode.barcode = code;
|
||||||
|
barCode.code_batch = inStockDetails[i].code_batch;
|
||||||
|
barCode.codeqty = (int?)(await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == inStockDetails[i].material_id))?.minpacking;
|
||||||
|
barCode.unit_id = inStockDetails[i].unit_id;
|
||||||
|
barCode.is_lock = 0;
|
||||||
|
barCode.is_end = "0";
|
||||||
|
barCode.require_id = input.BillIds[i];
|
||||||
|
barCode.require_code = (await _db.Queryable<WmsInstockH>().SingleAsync(it => it.id == input.BillIds[i])).bill_code;
|
||||||
|
barCode.create_id = _userManager.UserId;
|
||||||
|
barCode.create_time = DateTime.Now;
|
||||||
|
wmsTempCodes.Add(barCode);
|
||||||
|
}
|
||||||
|
var row = await _db.Insertable(wmsTempCodes).ExecuteCommandAsync();
|
||||||
|
if (row > 0)
|
||||||
|
{
|
||||||
|
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { print_status = WmsWareHouseConst.BARCODE_PRINT_STATUS_COMPLETE_ID }).Where(it => input.BillIds.Contains(it.id)).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 扫码入库
|
||||||
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task BarCodePrint()
|
public async Task SacnBarCodeInStock()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user