bug
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Tnb.ProductionMgr
|
|||||||
//扫码入库
|
//扫码入库
|
||||||
private void ScanInStock(object state)
|
private void ScanInStock(object state)
|
||||||
{
|
{
|
||||||
var carry_code = "carry_code";//从数采读取
|
var carry_code = "TestLX0001";//从数采读取
|
||||||
WmsCarryH? carry = _repository.AsSugarClient().Queryable<WmsCarryH>().Single(it => it.carry_code == carry_code);
|
WmsCarryH? carry = _repository.AsSugarClient().Queryable<WmsCarryH>().Single(it => it.carry_code == carry_code);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
@@ -168,7 +168,7 @@ namespace Tnb.ProductionMgr
|
|||||||
input.data.Add("barcode", carry_code);
|
input.data.Add("barcode", carry_code);
|
||||||
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
|
input.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
|
||||||
input.data.Add("material_code", WmsCarryCode.material_code);
|
input.data.Add("material_code", WmsCarryCode.material_code);
|
||||||
input.data.Add("extras", WmsCarryCode.location_code);//location_code
|
input.data.Add("extras", carry.location_code!);//location_code
|
||||||
input.data.Add("warehouse_id", WmsCarryCode.warehouse_id!);
|
input.data.Add("warehouse_id", WmsCarryCode.warehouse_id!);
|
||||||
input.data.Add("bill_code", "");//采购收货单号
|
input.data.Add("bill_code", "");//采购收货单号
|
||||||
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
|
input.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
|
||||||
|
{
|
||||||
|
public class BarCodeInput
|
||||||
|
{
|
||||||
|
public string? BillId { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -101,9 +101,11 @@ public partial class WmsPurchaseD : BaseEntity<string>
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 规格型号
|
/// 规格型号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string? material_specification { get; set; }
|
public string? material_specification { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 箱号
|
/// 箱号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[SugarColumn(IsIgnore = true)]
|
||||||
public string? container_no { get; set; }
|
public string? container_no { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -203,8 +203,18 @@ namespace Tnb.WarehouseMgr
|
|||||||
|
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
List<WmsPointH> points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
List<WmsPointH> points=new List<WmsPointH>();
|
||||||
if (points.Count <= 2)
|
try
|
||||||
|
{
|
||||||
|
points = await _wareHouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
points.Add(sPoint);
|
||||||
|
points.Add(ePoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (points.Count < 2)
|
||||||
{
|
{
|
||||||
throw new AppFriendlyException("该路径不存在", 500);
|
throw new AppFriendlyException("该路径不存在", 500);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,5 +148,73 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
return await UpdateChackStatus<WmsInstockH>(input);
|
return await UpdateChackStatus<WmsInstockH>(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public async Task BarCodePrint(BarCodeInput input)
|
||||||
|
{
|
||||||
|
if (input == null)
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException(nameof(input), 500);
|
||||||
|
}
|
||||||
|
List<string> barcodes = new();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await _db.Ado.BeginTranAsync();
|
||||||
|
if (_db.Queryable<WmsTempCode>().Where(it => input.BillId == it.require_id).Any())
|
||||||
|
{
|
||||||
|
throw new AppFriendlyException("条码已生成", 500);
|
||||||
|
};
|
||||||
|
WmsPurchaseD WmsPurchaseD = await _db.Queryable<WmsPurchaseD>().Where(it => input.BillId == it.id).FirstAsync();
|
||||||
|
List<WmsTempCode> wmsTempCodes = new();
|
||||||
|
decimal? minPacking = (await _db.Queryable<BasMaterial>().FirstAsync(it => it.id == WmsPurchaseD.material_id))?.minpacking;
|
||||||
|
int codeNum = 0;
|
||||||
|
|
||||||
|
if (minPacking.HasValue && minPacking.Value > 0)
|
||||||
|
{
|
||||||
|
int mod = (int)(WmsPurchaseD.purchase_arriveqty % minPacking.Value);
|
||||||
|
codeNum = (int)(mod > 0 ? (WmsPurchaseD.purchase_arriveqty / minPacking.Value) + 1 : WmsPurchaseD.purchase_arriveqty / minPacking.Value);
|
||||||
|
|
||||||
|
for (int j = 0; j < codeNum; j++)
|
||||||
|
{
|
||||||
|
int index = j + 1;
|
||||||
|
string code = $"{WmsPurchaseD.material_code}{WmsPurchaseD.code_batch}{index.ToString().PadLeft(4, '0')}";
|
||||||
|
WmsTempCode barCode = new()
|
||||||
|
{
|
||||||
|
material_id = WmsPurchaseD.material_id,
|
||||||
|
material_code = WmsPurchaseD.material_code,
|
||||||
|
barcode = code,
|
||||||
|
code_batch = WmsPurchaseD.code_batch,
|
||||||
|
material_specification = WmsPurchaseD.material_specification,
|
||||||
|
container_no = WmsPurchaseD.container_no,
|
||||||
|
codeqty = minPacking,
|
||||||
|
unit_id = WmsPurchaseD.unit_id,
|
||||||
|
is_lock = 0,
|
||||||
|
is_end = 0,
|
||||||
|
require_id = WmsPurchaseD.id,
|
||||||
|
require_code = WmsPurchaseD.id,
|
||||||
|
create_id = _userManager.UserId,
|
||||||
|
create_time = DateTime.Now
|
||||||
|
};
|
||||||
|
if (index == codeNum)
|
||||||
|
barCode.codeqty = mod == 0 ? minPacking : mod;
|
||||||
|
wmsTempCodes.Add(barCode);
|
||||||
|
}
|
||||||
|
await _db.Insertable(wmsTempCodes).ExecuteCommandAsync();
|
||||||
|
}
|
||||||
|
await _db.Ado.CommitTranAsync();
|
||||||
|
barcodes.AddRange(wmsTempCodes.Select(p => p.barcode).ToList());
|
||||||
|
if (barcodes?.Count > 0)
|
||||||
|
{
|
||||||
|
base.BarCodePrint(barcodes, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
await _db.Ado.RollbackTranAsync();
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user