Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -14,7 +14,10 @@ using JNPF.DependencyInjection;
|
|||||||
using JNPF.DynamicApiController;
|
using JNPF.DynamicApiController;
|
||||||
using JNPF.VisualDev;
|
using JNPF.VisualDev;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using SqlSugar;
|
||||||
|
using Tnb.WarehouseMgr.Entities;
|
||||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||||
|
using Tnb.WarehouseMgr.Entities.Consts;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto;
|
using Tnb.WarehouseMgr.Entities.Dto;
|
||||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||||
using Tnb.WarehouseMgr.Entities.Entity;
|
using Tnb.WarehouseMgr.Entities.Entity;
|
||||||
@@ -43,6 +46,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[NonAction]
|
[NonAction]
|
||||||
protected async Task DoUpdate(WareHouseUpInput input)
|
protected async Task DoUpdate(WareHouseUpInput input)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
[HttpPost]
|
[HttpPost]
|
||||||
public async Task ApplyFor(InOutStockApplyforUpInput input)
|
public async Task ApplyFor(InOutStockApplyforUpInput input)
|
||||||
{
|
{
|
||||||
if (input == null) throw new ArgumentNullException("input");
|
if (input == null) throw new ArgumentNullException(nameof(input));
|
||||||
|
|
||||||
async Task<bool> _updateLocalFunc<TStockD, TStockCode>(InOutStockApplyforUpInput input)
|
async Task<bool> _updateLocalFunc<TStockD, TStockCode>(InOutStockApplyforUpInput input)
|
||||||
where TStockD : BaseEntity<string>, new()
|
where TStockD : BaseEntity<string>, new()
|
||||||
@@ -151,7 +151,7 @@ namespace Tnb.WarehouseMgr
|
|||||||
{
|
{
|
||||||
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
||||||
}, true)
|
}, true)
|
||||||
.Mapper(it => it.line_status = dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
.Mapper(it => it.line_status = it.line_status != null && dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Linq.Expressions;
|
||||||
using System.Text;
|
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,18 +41,21 @@ 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);
|
||||||
.Select(a => new CarryCodeDetailOutput
|
List<CarryCodeDetailOutput> items = new();
|
||||||
{
|
List<string> carryMIds = new();
|
||||||
barcode = a.barcode,
|
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||||
code_batch = a.code_batch!,
|
{
|
||||||
codeqty = a.codeqty,
|
var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||||
material_code = a.material_code,
|
carryMIds = carryDs.Select(x => x.membercarry_id).ToList();
|
||||||
material_id = a.material_id,
|
}
|
||||||
unit_id = a.unit_id,
|
Expression<Func<WmsCarryCode, bool>> whereExp = carryMIds?.Count > 0 ? a => carryMIds.Contains(a.carry_id) : a => a.carry_id == carryId;
|
||||||
})
|
items = await _db.Queryable<WmsCarryCode>().Where(whereExp)
|
||||||
.Mapper(it => it.material_name = dicMaterial.ContainsKey(it.material_id) ? dicMaterial[it.material_id].ToString()! : "")
|
.Select<CarryCodeDetailOutput>()
|
||||||
|
.Mapper(it => it.material_name = (it.material_id != null && dicMaterial.ContainsKey(it.material_id)) ? dicMaterial[it.material_id].ToString() : "")
|
||||||
.ToListAsync();
|
.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)
|
||||||
@@ -165,36 +173,38 @@ namespace Tnb.WarehouseMgr
|
|||||||
var sPoint = it.FirstOrDefault();
|
var sPoint = it.FirstOrDefault();
|
||||||
var ePoint = it.LastOrDefault();
|
var ePoint = it.LastOrDefault();
|
||||||
|
|
||||||
WmsPretaskH preTask = new()
|
WmsPretaskH preTask = new();
|
||||||
{
|
preTask.org_id = _userManager.User.OrganizeId;
|
||||||
org_id = _userManager.User.OrganizeId,
|
preTask.startlocation_id = sPoint?.location_id!;
|
||||||
startlocation_id = sPoint?.location_id!,
|
preTask.startlocation_code = sPoint?.location_code!;
|
||||||
startlocation_code = sPoint?.location_code!,
|
preTask.endlocation_id = ePoint?.location_id!;
|
||||||
endlocation_id = ePoint?.location_id!,
|
preTask.endlocation_code = ePoint?.location_code!;
|
||||||
endlocation_code = ePoint?.location_code!,
|
preTask.start_floor = sPoint?.floor.ToString();
|
||||||
start_floor = sPoint?.floor.ToString(),
|
preTask.end_floor = ePoint?.floor.ToString();
|
||||||
end_floor = ePoint?.floor.ToString(),
|
preTask.bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult();
|
||||||
bill_code = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_PRETASK_H_ENCODE).GetAwaiter().GetResult(),
|
preTask.status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID;
|
||||||
status = WmsWareHouseConst.PRETASK_BILL_STATUS_DXF_ID,
|
preTask.biz_type = ko.biz_type;
|
||||||
biz_type = ko.biz_type,
|
preTask.task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID;
|
||||||
task_type = WmsWareHouseConst.WMS_PRETASK_INSTOCK_TYPE_ID,
|
preTask.carry_id = ko!.carry_id!;
|
||||||
carry_id = ko!.carry_id!,
|
preTask.carry_code = ko!.carry_code!;
|
||||||
carry_code = ko!.carry_code!,
|
preTask.area_id = sPoint?.area_id!;
|
||||||
area_id = sPoint?.area_id!,
|
preTask.area_code = it.Key;
|
||||||
area_code = it.Key,
|
preTask.require_id = ko.id;
|
||||||
require_id = ko.id,
|
preTask.require_code = ko.bill_code;
|
||||||
require_code = ko.bill_code,
|
preTask.create_id = _userManager.UserId;
|
||||||
create_id = _userManager.UserId,
|
preTask.create_time = DateTime.Now;
|
||||||
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