齐套出库修改,PDA出库签收接口修改
This commit is contained in:
@@ -5,10 +5,12 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using JNPF.DependencyInjection;
|
using JNPF.DependencyInjection;
|
||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
|
using Mapster;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using SqlSugar;
|
using SqlSugar;
|
||||||
using Tnb.BasicData.Entities;
|
using Tnb.BasicData.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities;
|
using Tnb.WarehouseMgr.Entities;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.WarehouseMgr.Interfaces;
|
using Tnb.WarehouseMgr.Interfaces;
|
||||||
|
|
||||||
@@ -38,7 +40,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
dicMaterial = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
dicMaterial = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
||||||
}
|
}
|
||||||
var items = await _db.Queryable<WmsCarryCode>().Where(a => a.carry_id == carryId)
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it=>it.id == carryId);
|
||||||
|
List<CarryCodeDetailOutput> items = new();
|
||||||
|
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||||
|
{
|
||||||
|
var carryDs = await _db.Queryable<WmsCarryD>().Where(it=>it.carry_id == carryId).ToListAsync();
|
||||||
|
var carryMIds = carryDs.Select(x=>x.membercarry_id).ToList();
|
||||||
|
items = await _db.Queryable<WmsCarryCode>().Where(a => carryMIds.Contains(a.carry_id))
|
||||||
.Select(a => new CarryCodeDetailOutput
|
.Select(a => new CarryCodeDetailOutput
|
||||||
{
|
{
|
||||||
barcode = a.barcode,
|
barcode = a.barcode,
|
||||||
@@ -50,6 +58,23 @@ namespace Tnb.WarehouseMgr
|
|||||||
})
|
})
|
||||||
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items = await _db.Queryable<WmsCarryCode>().Where(a => a.carry_id == carryId)
|
||||||
|
.Select(a => new CarryCodeDetailOutput
|
||||||
|
{
|
||||||
|
barcode = a.barcode,
|
||||||
|
code_batch = a.code_batch!,
|
||||||
|
codeqty = a.codeqty,
|
||||||
|
material_code = a.material_code,
|
||||||
|
material_id = a.material_id,
|
||||||
|
unit_id = a.unit_id,
|
||||||
|
})
|
||||||
|
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
||||||
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
|
||||||
return items ?? Enumerable.Empty<dynamic>();
|
return items ?? Enumerable.Empty<dynamic>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Data.Common;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -72,7 +73,11 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
foreach (var ko in kittingOuts)
|
foreach (var ko in kittingOuts)
|
||||||
{
|
{
|
||||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => it.collocation_scheme_id == ko.collocation_scheme_id && it.is_lock == 0).ToListAsync();
|
var carrys = await _db.Queryable<WmsCarryH>()
|
||||||
|
.InnerJoin<WmsCollocationSchemeH>((a,b) => a.collocation_scheme_id == b.id)
|
||||||
|
.Where(a => a.collocation_scheme_id == ko.collocation_scheme_id && a.is_lock == 0)
|
||||||
|
.OrderBy((a,b)=>b.seq)
|
||||||
|
.ToListAsync();
|
||||||
if (carrys?.Count > 0)
|
if (carrys?.Count > 0)
|
||||||
{
|
{
|
||||||
var firstCarry = carrys.FirstOrDefault();
|
var firstCarry = carrys.FirstOrDefault();
|
||||||
@@ -131,7 +136,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task KittingOutByIsToBeShipped(IDbTransaction? tran = null)
|
public async Task KittingOutByIsToBeShipped()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -152,10 +157,13 @@ namespace Tnb.WarehouseMgr
|
|||||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||||
if (carry != null)
|
if (carry != null)
|
||||||
{
|
{
|
||||||
|
|
||||||
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
WmsPointH sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||||
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
WmsPointH ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == ko.location_id);
|
||||||
if (sPoint != null && ePoint != null)
|
if (sPoint != null && ePoint != null)
|
||||||
{
|
{
|
||||||
|
//判断目标库位是否自动签收
|
||||||
|
var loc = await _db.Queryable<BasLocation>().SingleAsync(it => it.id == ePoint.location_id);
|
||||||
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
var points = await _warehouseService.PathAlgorithms(sPoint.id, ePoint.id);
|
||||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||||
if (points?.Count > 0)
|
if (points?.Count > 0)
|
||||||
@@ -176,7 +184,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||||
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||||
preTask.biz_type = ko.biz_type;
|
preTask.biz_type = ko.biz_type;
|
||||||
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_OUTSTOCK_TYPE_ID;
|
||||||
preTask.carry_id = ko!.carry_id!;
|
preTask.carry_id = ko!.carry_id!;
|
||||||
preTask.carry_code = ko!.carry_code!;
|
preTask.carry_code = ko!.carry_code!;
|
||||||
preTask.area_id = sPoint?.area_id!;
|
preTask.area_id = sPoint?.area_id!;
|
||||||
@@ -187,12 +195,16 @@ namespace Tnb.WarehouseMgr
|
|||||||
preTask.create_time = DateTime.Now;
|
preTask.create_time = DateTime.Now;
|
||||||
return preTask;
|
return preTask;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
if (loc.is_sign == 0)
|
||||||
|
{
|
||||||
|
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||||
|
}
|
||||||
await _warehouseService.GenPreTask(preTasks, null!);
|
await _warehouseService.GenPreTask(preTasks, null!);
|
||||||
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
var subCarrys = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == ko.carry_id).ToListAsync();
|
||||||
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
var carryIds = subCarrys.Select(x => x.carry_id).Concat(new[] { ko.carry_id }).Distinct().ToList();
|
||||||
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds!, LocationIds = new List<string> { carry.location_id!, ko.location_id! } };
|
GenPreTaskUpInput genPreTaskInput = new() { CarryIds = carryIds!, LocationIds = new List<string> { carry.location_id!, ko.location_id! } };
|
||||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1, carry_status = ((int)EnumCarryStatus.齐套).ToString() }, it => new BasLocation { is_lock = 1 });
|
||||||
|
await _db.Updateable<WmsKittingoutH>().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == ko.id).ExecuteCommandAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user