Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
namespace Tnb.BasicData.Entities.Dto
|
||||
{
|
||||
public class DefectOutput
|
||||
{
|
||||
public string id { get; set; }
|
||||
public string defect_code { get; set; }
|
||||
public string defect_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities.Dto;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.BasicData.Interfaces;
|
||||
|
||||
@@ -33,11 +34,22 @@ namespace Tnb.BasicData
|
||||
public async Task<dynamic> GetDefectListByProcessId(Dictionary<string, string> dic)
|
||||
{
|
||||
string processId = dic["processId"];
|
||||
return await _repository.AsSugarClient().Queryable<BasProcessDefective>()
|
||||
.LeftJoin<BasProcess>((a, b) => a.process_id == b.id)
|
||||
.LeftJoin<BasDefect>((a, b, c) => a.defective_id == c.id)
|
||||
.Where((a, b, c) => a.process_id == processId)
|
||||
.Select((a, b, c) => c).ToListAsync();
|
||||
var db = _repository.AsSugarClient();
|
||||
List<string> defectIds = await db.Queryable<BasProcessDefective>().Where(x=>x.process_id==processId).Select(x=>x.defective_id).ToListAsync();
|
||||
List<string> defectTypeIds = await db.Queryable<BasDefect>().Where(x=>defectIds.Contains(x.id) && x.enabled==1).Select(x=>x.defect_type_id).ToListAsync();
|
||||
return await _repository.AsSugarClient().Queryable<BasDefectType>()
|
||||
.Where((a) => defectTypeIds.Contains(a.id))
|
||||
.Select(a => new
|
||||
{
|
||||
defect_type_id = a.id,
|
||||
defect_type_name = a.defect_type_name,
|
||||
children = SqlFunc.Subqueryable<BasDefect>().Where(x=>x.defect_type_id==a.id && defectIds.Contains(x.id)).ToList(x=>new DefectOutput()
|
||||
{
|
||||
id = x.id,
|
||||
defect_code = x.defect_code,
|
||||
defect_name = x.defect_name,
|
||||
})
|
||||
}).ToListAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -49,11 +49,6 @@ public partial class WmsCarryCode : BaseEntity<string>, IWmsCarryEntity
|
||||
/// </summary>
|
||||
public decimal codeqty { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 行号
|
||||
/// </summary>
|
||||
public int no { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否出库
|
||||
/// </summary>
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
protected async Task DoUpdate(WareHouseUpInput input)
|
||||
{
|
||||
if (_stroageMap.ContainsKey(input.loginType))
|
||||
@@ -44,7 +44,7 @@ namespace Tnb.WarehouseMgr
|
||||
await _stroageMap[input.loginType].Do(input);
|
||||
}
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public virtual Task ModifyAsync(WareHouseUpInput input)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
|
||||
@@ -485,7 +485,7 @@ namespace Tnb.WarehouseMgr
|
||||
var carryStatus = multis[i].carry_status;
|
||||
if (multis[i].carry_status == ((int)EnumCarryStatus.空闲).ToString())
|
||||
{
|
||||
carryStatus = ((int)EnumCarryStatus.空闲).ToString();
|
||||
carryStatus = ((int)EnumCarryStatus.占用).ToString();
|
||||
}
|
||||
var cStatus = carryStatus.ParseToInt();
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = cStatus, is_lock = 0 }).Where(it => it.id == multis[i].endlocation_id).ExecuteCommandAsync();
|
||||
|
||||
@@ -199,6 +199,10 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
}
|
||||
else {
|
||||
//任务没有结束,更新状态为工作中
|
||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
|
||||
await _db.Ado.CommitTranAsync();
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Dtos.VisualDev;
|
||||
using JNPF.Common.Extension;
|
||||
@@ -223,7 +224,20 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||
List<WmsPretaskCode> pretaskCodes = new();
|
||||
foreach (var pt in preTasks)
|
||||
{
|
||||
var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
|
||||
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
|
||||
curPreTaskCodes.ForEach(x =>
|
||||
{
|
||||
x.id=SnowflakeIdHelper.NextId();
|
||||
x.bill_id = pt.id;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||
@@ -329,6 +343,10 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
osd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Updateable(curOutstockDetails).ExecuteCommandAsync();
|
||||
@@ -337,6 +355,11 @@ namespace Tnb.WarehouseMgr
|
||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
}
|
||||
else
|
||||
{
|
||||
//如果没有完成,修改为工作中
|
||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
}
|
||||
await _wareCarryService.UpdateNullCarry(carry);
|
||||
}
|
||||
else if (outStatus == EnumOutStatus.分拣出)
|
||||
@@ -359,6 +382,36 @@ namespace Tnb.WarehouseMgr
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
await _db.Insertable(osCodes).ExecuteCommandAsync();
|
||||
// 更新主表
|
||||
var detailIds = osCodes.Select(x => x.bill_d_id).ToList();
|
||||
var curOutstockDetails = otds.FindAll(x => detailIds.Contains(x.id));
|
||||
var dic = osCodes.GroupBy(g => g.bill_d_id).ToDictionary(x => x.Key, x => x.Select(x => x.codeqty).ToList());
|
||||
foreach (var osd in curOutstockDetails)
|
||||
{
|
||||
if (dic.ContainsKey(osd.id))
|
||||
{
|
||||
osd.qty += dic[osd.id].Sum(d => d);
|
||||
if (osd.qty >= osd.pr_qty)
|
||||
{
|
||||
osd.line_status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID;
|
||||
}
|
||||
else
|
||||
{
|
||||
osd.line_status = WmsWareHouseConst.BILLSTATUS_ON_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
await _db.Updateable(curOutstockDetails).ExecuteCommandAsync();
|
||||
if (otds.All(x => x.line_status == WmsWareHouseConst.BILLSTATUS_COMPLETE_ID))
|
||||
{
|
||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_COMPLETE_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
//如果是自动单据,需要回更上层系统
|
||||
}
|
||||
else
|
||||
{
|
||||
//如果没有完成,修改为工作中
|
||||
await _db.Updateable<WmsOutstockH>().SetColumns(it => new WmsOutstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.requireId).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => input.carryIds.Contains(it.carry_id)).ToListAsync();
|
||||
var dicCodeQty = carryCodes.GroupBy(g => g.barcode).ToDictionary(x => x.Key, x => x.First().codeqty);
|
||||
@@ -382,9 +435,12 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
foreach (var pair in dicUpdate)
|
||||
{
|
||||
WmsCarryCode carryCode = new();
|
||||
WmsCarryCode? carryCode = carryCodes.Find(x => x.barcode == pair.Key);
|
||||
if (carryCode != null)
|
||||
{
|
||||
carryCode.codeqty = pair.Value;
|
||||
await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).Where(it => it.barcode == pair.Key).ExecuteCommandAsync();
|
||||
await _db.Updateable(carryCode).UpdateColumns(it => it.codeqty).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(it => new WmsCarryH { out_status = ((int)EnumOutStatus.正常).ToString() }).Where(it => input.carryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
await _db.Deleteable<WmsCarryMat>().Where(it => input.carryIds.Contains(it.carry_id)).ExecuteCommandAsync();
|
||||
@@ -402,7 +458,11 @@ namespace Tnb.WarehouseMgr
|
||||
[nameof(InStockStrategyQuery.warehouse_id)] = outStockH.warehouse_id,
|
||||
[nameof(WmsPointH.location_id)] = outStockH.location_id,
|
||||
[nameof(WmsCarryD.carry_id)] = input.carryIds.First(),
|
||||
[nameof(WmsCarryH.carry_code)] = carry.carry_code,
|
||||
[nameof(WmsHandleH.biz_type)] = input.bizTypeId,
|
||||
[nameof(WmsHandleH.create_id)] = _userManager.UserId,
|
||||
[nameof(WmsHandleH.create_time)] = DateTime.Now,
|
||||
[nameof(WmsMoveInstock.status)] = WmsWareHouseConst.BILLSTATUS_ADD_ID,
|
||||
[nameof(WmsHandleH.bill_code)] = _billRullService.GetBillNumber(WmsWareHouseConst.WMS_CARRYMOINSTK_ENCODE).GetAwaiter().GetResult(),
|
||||
};
|
||||
await _wmsCarryMoveInStockService.CarryMoveIn(visulDevInput);
|
||||
|
||||
@@ -247,6 +247,7 @@ namespace Tnb.WarehouseMgr
|
||||
if (instockCOdes?.Count > 0)
|
||||
{
|
||||
await _db.Updateable<WmsInstockD>().SetColumns(it => new WmsInstockD { line_status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => instockCOdes.Select(x => x.bill_d_id).Contains(it.id)).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsInstockH>().SetColumns(it => new WmsInstockH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == input.data[nameof(WmsHandleH.require_id)].ToString()).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,20 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
await _genPreTask(carrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
||||
}
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, null);
|
||||
List<WmsPretaskCode> pretaskCodes = new();
|
||||
foreach (var pt in preTasks)
|
||||
{
|
||||
var partCodes = carryCodes.FindAll(x => x.carry_id == pt.carry_id).Distinct().ToList();
|
||||
var curPreTaskCodes = partCodes.Adapt<List<WmsPretaskCode>>();
|
||||
curPreTaskCodes.ForEach(x =>
|
||||
{
|
||||
x.id = SnowflakeIdHelper.NextId();
|
||||
x.bill_id = pt.id;
|
||||
x.create_time = DateTime.Now;
|
||||
});
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
var isOk = await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||
|
||||
@@ -79,27 +79,35 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
if (_dicBizType.ContainsKey(disTask.biz_type))
|
||||
{
|
||||
switch (_dicBizType[disTask.biz_type])
|
||||
{
|
||||
case "空载具出库":
|
||||
case "寄存出库":
|
||||
case "齐套出库":
|
||||
case "一般出库":
|
||||
{
|
||||
WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
||||
WareHouseUpInput upInput = new() {
|
||||
loginType = "web",
|
||||
bizTypeId = disTask.biz_type,
|
||||
requireId = disTask.require_id,
|
||||
carryIds = new List<string> { input.carryId },
|
||||
distaskCodes = input.distaskCodes };
|
||||
await DoUpdate(upInput); //回更业务
|
||||
//switch (_dicBizType[disTask.biz_type])
|
||||
//{
|
||||
// case "空载具出库":
|
||||
// case "寄存出库":
|
||||
// case "齐套出库":
|
||||
// case "一般出库":
|
||||
// {
|
||||
|
||||
// WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId }, distaskCodes = input.distaskCodes };
|
||||
// await DoUpdate(upInput); //回更业务
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case "载具移出":
|
||||
{
|
||||
WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId } };
|
||||
await DoUpdate(upInput); //回更业务
|
||||
}
|
||||
break;
|
||||
// }
|
||||
// break;
|
||||
// case "载具移出":
|
||||
// {
|
||||
// WareHouseUpInput upInput = new() { loginType = "web", bizTypeId = disTask.biz_type, requireId = disTask.require_id, carryIds = new List<string> { input.carryId }, distaskCodes = input.distaskCodes };
|
||||
// await DoUpdate(upInput); //回更业务
|
||||
// }
|
||||
// break;
|
||||
|
||||
}
|
||||
//}
|
||||
}
|
||||
disTask.is_sign = 1;
|
||||
await _db.Updateable(disTask).UpdateColumns(it => it.is_sign).ExecuteCommandAsync();
|
||||
|
||||
@@ -90,9 +90,10 @@ public class PrintDevService : IDynamicApiController, ITransient
|
||||
[HttpGet("")]
|
||||
public async Task<dynamic> GetList_Api([FromQuery] PrintDevListInput input)
|
||||
{
|
||||
var list = await _repository.AsSugarClient().Queryable<PrintDevEntity, UserEntity, UserEntity, DictionaryDataEntity>((a, b, c, d) =>
|
||||
new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId, JoinType.Left, a.Category == d.EnCode))
|
||||
.Where((a, b, c, d) => a.DeleteMark == null && d.DictionaryTypeId == "202931027482510597").WhereIF(input.category.IsNotEmptyOrNull(), a => a.Category == input.category)
|
||||
var list = await _repository.AsSugarClient().Queryable<PrintDevEntity, UserEntity, UserEntity, DictionaryTypeEntity,DictionaryDataEntity>((a, b, c, d,e) =>
|
||||
new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId,JoinType.Left,d.EnCode=="printDev", JoinType.Left, a.Category == e.EnCode && d.Id==e.DictionaryTypeId))
|
||||
.Where((a, b, c, d,e) => a.DeleteMark == null )
|
||||
.WhereIF(input.category.IsNotEmptyOrNull(), a => a.Category == input.category)
|
||||
.WhereIF(input.keyword.IsNotEmptyOrNull(), a => a.FullName.Contains(input.keyword) || a.EnCode.Contains(input.keyword))
|
||||
.OrderBy(a => a.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc)
|
||||
.Select((a, b, c, d) => new PrintDevListOutput
|
||||
@@ -119,10 +120,10 @@ public class PrintDevService : IDynamicApiController, ITransient
|
||||
[HttpGet("Selector")]
|
||||
public async Task<dynamic> GetList_Api([FromQuery] string type)
|
||||
{
|
||||
var list = await _repository.AsSugarClient().Queryable<PrintDevEntity, UserEntity, UserEntity, DictionaryDataEntity>((a, b, c, d) => new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId, JoinType.Left, a.Category == d.EnCode))
|
||||
.Where((a, b, c, d) => a.DeleteMark == null && d.DictionaryTypeId == "202931027482510597" && a.EnabledMark == 1).OrderBy(a => a.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc)
|
||||
var list = await _repository.AsSugarClient().Queryable<PrintDevEntity, UserEntity, UserEntity, DictionaryTypeEntity,DictionaryDataEntity>((a, b, c, d,e) => new JoinQueryInfos(JoinType.Left, b.Id == a.CreatorUserId, JoinType.Left, c.Id == a.LastModifyUserId, JoinType.Left, d.EnCode=="printDev", JoinType.Left, a.Category == e.EnCode && d.Id==e.DictionaryTypeId))
|
||||
.Where((a, b, c, d) => a.DeleteMark == null && a.EnabledMark == 1).OrderBy(a => a.SortCode).OrderBy(a => a.CreatorTime, OrderByType.Desc)
|
||||
.WhereIF(type.IsNotEmptyOrNull(), (a) => a.Type == type.ParseToInt())
|
||||
.Select((a, b, c, d) => new PrintDevListOutput
|
||||
.Select((a, b, c, d,e) => new PrintDevListOutput
|
||||
{
|
||||
category = a.Category,
|
||||
id = a.Id,
|
||||
@@ -135,7 +136,7 @@ public class PrintDevService : IDynamicApiController, ITransient
|
||||
lastModifyUser = SqlFunc.MergeString(c.RealName, "/", c.Account),
|
||||
sortCode = a.SortCode,
|
||||
type = a.Type,
|
||||
parentId = d.Id,
|
||||
parentId = e.Id,
|
||||
}).ToListAsync();
|
||||
|
||||
// 数据库分类
|
||||
|
||||
Reference in New Issue
Block a user