PDA扫码入库逻辑修改

This commit is contained in:
alex
2023-09-06 09:53:12 +08:00
parent 589803f1d9
commit 10a907d927
2 changed files with 22 additions and 8 deletions

View File

@@ -24,6 +24,7 @@ using JNPF.VisualDev;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
@@ -96,9 +97,18 @@ namespace Tnb.WarehouseMgr
if (locDest == null) throw new ArgumentNullException(nameof(locDest));
if (!carry.carrystd_id.IsNullOrEmpty() && !locDest.carrystd_id.IsNullOrEmpty())
{
var jsonArr = JArray.Parse(locDest.carrystd_id);
var locCarryStdArr = jsonArr.Select(x => x.ToObject<string>()).ToArray();
isMatch = locCarryStdArr.Contains(carry.carrystd_id);
JArray? jsonArr = null;
try
{
jsonArr = JArray.Parse(locDest.carrystd_id);
var locCarryStdArr = jsonArr.Select(x => x.ToObject<string>()).ToArray();
isMatch = locCarryStdArr.Contains(carry.carrystd_id);
}
catch (Exception ex) when (ex is JsonException jex)
{
isMatch = carry.carrystd_id.Equals(locDest.carrystd_id, StringComparison.OrdinalIgnoreCase);
}
}
return Task.FromResult(isMatch);
}

View File

@@ -12,6 +12,7 @@ using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using SqlSugar;
using Tnb.BasicData.Entities;
using Tnb.ProductionMgr.Interfaces;
@@ -55,8 +56,8 @@ namespace Tnb.WarehouseMgr
_prdInstockService = prdInstockService;
OverideFuncs.CreateAsync = ScanInStock;
}
private async Task<dynamic> ScanInStock(VisualDevModelDataCrInput input)
[HttpPost("xxx")]
public async Task<dynamic> ScanInStock(VisualDevModelDataCrInput input)
{
try
{
@@ -84,8 +85,8 @@ namespace Tnb.WarehouseMgr
bill_date = DateTime.Today,
warehouse_id = "26103372441637",
status = WmsWareHouseConst.BILLSTATUS_ADD_ID,
generate_type = "1",
sync_status = "0",
generate_type = "0",
sync_status = "",
print_status = "0",
is_check = 1,
create_id = _userManager.UserId,
@@ -101,6 +102,7 @@ namespace Tnb.WarehouseMgr
unit_id = mat.unit_id,
pr_qty = item.codeqty,
qty = 0,
code_batch= item.code_batch,
warehouse_id = "26103372441637",
print_qty = item.codeqty,
scan_qty = item.codeqty,
@@ -134,6 +136,7 @@ namespace Tnb.WarehouseMgr
var endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
WmsPointH sPoint = new();
WmsPointH ePoint = new();
if (endLocations?.Count > 0)
{
var eloc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == endLocations[0].id);
@@ -141,6 +144,7 @@ namespace Tnb.WarehouseMgr
if (!isMatch) throw new AppFriendlyException("库位与载具规格不匹配", 500);
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == endLocations[0].id);
}
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == loc.id && it.area_id == ePoint.area_id);
if (sPoint != null && ePoint != null)
{
@@ -168,7 +172,7 @@ namespace Tnb.WarehouseMgr
preTask.endpoint_code = ePoint?.point_code!;
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
preTask.biz_type = WmsWareHouseConst.BIZTYPE_CARRYMOVEINSTOCK_ID;
preTask.biz_type = WmsWareHouseConst.BIZTYPE_WMSINSTOCK_ID;
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
preTask.carry_id = carry.id;
preTask.carry_code = carry.carry_code;