调拨订单同步生成原材料/成品调拨出库 物料签收接口
This commit is contained in:
@@ -53,107 +53,5 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 人工扫码入库
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="ArgumentNullException"></exception>
|
||||
/// <exception cref="AppFriendlyException"></exception>
|
||||
[HttpPost]
|
||||
public async Task ArtificialInstock(ArtificialInstockInput input)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (input == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(input));
|
||||
}
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
|
||||
BasLocation startlocationn = await _db.Queryable<BasLocation>().Where(r => r.location_code == input.startlocation_code).FirstAsync();
|
||||
if (startlocationn == null)
|
||||
{
|
||||
throw new AppFriendlyException($"【ArtificialInstock】库位{input.startlocation_code}不存在", 500);
|
||||
}
|
||||
if (startlocationn.is_lock == 1)
|
||||
{
|
||||
throw new AppFriendlyException($"【ArtificialInstock】库位{input.startlocation_code}已锁定", 500);
|
||||
}
|
||||
WmsCarryH wmsCarryH = await _db.Queryable<WmsCarryH>().Where(r => r.carry_code == input.carry_code).FirstAsync();
|
||||
if (wmsCarryH == null)
|
||||
{
|
||||
throw new AppFriendlyException($"【ArtificialInstock】载具{input.carry_code}不存在", 500);
|
||||
}
|
||||
if (wmsCarryH.is_lock == 1)
|
||||
{
|
||||
throw new AppFriendlyException($"【ArtificialInstock】载具{input.carry_code}已锁定", 500);
|
||||
}
|
||||
if (wmsCarryH.carry_status != "1")
|
||||
{
|
||||
throw new AppFriendlyException($"【ArtificialInstock】载具{input.carry_code}未绑定物料", 500);
|
||||
}
|
||||
|
||||
BasLocation carrryLoc = await _db.Queryable<BasLocation>().Where(r => r.id == wmsCarryH.location_id).FirstAsync();
|
||||
if (carrryLoc != null && carrryLoc.is_type == "0")
|
||||
{
|
||||
throw new Exception($"托盘{wmsCarryH.carry_code}在存储库位中,不能绑定!");
|
||||
}
|
||||
|
||||
switch (input.warehouse_id)
|
||||
{
|
||||
case WmsWareHouseConst.WAREHOUSE_YCL_ID:
|
||||
{
|
||||
var WmsCarryCode = _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == wmsCarryH.id).OrderByDescending(it => it.id).First();
|
||||
|
||||
if (WmsCarryCode != null)
|
||||
{
|
||||
VisualDevModelDataCrInput input2 = new VisualDevModelDataCrInput();
|
||||
input2.data = new Dictionary<string, object>();
|
||||
input2.data.Add("barcode", input.carry_code);
|
||||
input2.data.Add("codeqty", WmsCarryCode.codeqty);//条码数量
|
||||
input2.data.Add("material_code", WmsCarryCode.material_code);
|
||||
input2.data.Add("extras", input.startlocation_code);//location_code
|
||||
input2.data.Add("warehouse_id", "1");//TEST
|
||||
input2.data.Add("bill_code", "");//采购收货单号
|
||||
input2.data.Add("code_batch", WmsCarryCode.code_batch!);//批次
|
||||
input2.data.Add("material_specification", WmsCarryCode.material_specification!);//规格型号
|
||||
input2.data.Add("container_no", WmsCarryCode.container_no!);//箱号
|
||||
input2.data.Add("material_id", WmsCarryCode.material_id);
|
||||
input2.data.Add("物料条码", WmsCarryCode.barcode);
|
||||
input2.data.Add("id", null);
|
||||
_wmsPDAScanInStock.ScanInStockByRedis(input2, _db).Wait();
|
||||
|
||||
WmsArtificialInstock wmsArtificialInstock = new WmsArtificialInstock();
|
||||
wmsArtificialInstock.carry_id = wmsCarryH.id;
|
||||
wmsArtificialInstock.carry_code = wmsCarryH.carry_code;
|
||||
wmsArtificialInstock.org_id = input.org;
|
||||
wmsArtificialInstock.create_id = input.create_id;
|
||||
wmsArtificialInstock.create_time = DateTime.Now;
|
||||
wmsArtificialInstock.location_id = startlocationn.id;
|
||||
wmsArtificialInstock.location_code = startlocationn.location_code;
|
||||
wmsArtificialInstock.warehouse_id = input.warehouse_id;
|
||||
await _db.Insertable(wmsArtificialInstock).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new AppFriendlyException($"【ArtificialInstock】载具 {input.carry_code} 未绑定物料条码!", 500);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError($"【ArtificialInstock】 {ex.Message}");
|
||||
Logger.LogError($"【ArtificialInstock】 {ex.StackTrace}");
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw new AppFriendlyException($"【ArtificialInstock】人工扫码入库失败 {ex.Message}", 500);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user