Merge branch 'dev' of https://git.tuotong-tech.com/tnb/tnb.server into dev
This commit is contained in:
16
BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs
Normal file
16
BasicData/Tnb.BasicData.Entities/Consts/WebApiConst.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
namespace Tnb.BasicData
|
||||
{
|
||||
public static class WebApiConst
|
||||
{
|
||||
#region wms
|
||||
|
||||
//mes生产入库接口
|
||||
public const string MES_CREATE_INSTOCK = "/api/wms/wms-in-stock/mes-create-instock";
|
||||
|
||||
//载具签收接口
|
||||
public const string MES_CARRY_SIGN = "/api/wms/wms-sign-for-delivery/mes-carry-sign";
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,10 @@ namespace Tnb.EquipMgr
|
||||
}
|
||||
var result = await db.Queryable<EqpDaq>()
|
||||
.LeftJoin<UserEntity>((a,b)=>a.create_id==b.Id)
|
||||
.WhereIF(input!=null,a=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("data_source"),a=>a.data_source==queryJson["data_source"])
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("label_name"),a=>a.label_name.Contains(queryJson["label_name"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("label_point"),a=>a.label_point.Contains(queryJson["label_point"]))
|
||||
.WhereIF(input!=null,a=>a.equip_id==input!.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("data_source"),a=>a.data_source==queryJson!["data_source"])
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("label_name"),a=>a.label_name.Contains(queryJson!["label_name"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("label_point"),a=>a.label_point.Contains(queryJson!["label_point"]))
|
||||
.Select((a,b) => new EquipDaqQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<UserEntity >((a, b,c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment >((a, b,c,d) => a.equip_id == d.id)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("file_name"),(a,b,c,d)=>a.file_name.Contains(queryJson["file_name"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("file_name"),(a,b,c,d)=>a.file_name.Contains(queryJson!["file_name"]))
|
||||
.Select((a, b, c,d) => new EquipFileQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Tnb.EquipMgr
|
||||
id = SnowflakeIdHelper.NextId(),
|
||||
equip_id = input.equip_id,
|
||||
spare_parts_id = spare_parts_id,
|
||||
create_id = _userManager.UserId,
|
||||
create_id = _userManager?.UserId ?? "",
|
||||
create_time = DateTime.Now,
|
||||
org_id = orgId,
|
||||
});
|
||||
@@ -71,8 +71,8 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<DictionaryTypeEntity>((a, b, c) => c.EnCode == Tnb.BasicData.DictConst.SparePartsType && c.DeleteMark == null)
|
||||
.LeftJoin<DictionaryDataEntity>((a, b,c,d) => d.DictionaryTypeId == c.Id && b.type_id == d.EnCode)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>b.code.Contains(queryJson["code"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>b.name.Contains(queryJson["name"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>b.code.Contains(queryJson!["code"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>b.name.Contains(queryJson!["name"]))
|
||||
.Select((a, b, c,d) => new EquipSparePartsQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
|
||||
@@ -43,8 +43,8 @@ namespace Tnb.EquipMgr
|
||||
.LeftJoin<UserEntity >((a, b,c) => a.modify_id == c.Id)
|
||||
.LeftJoin<EqpEquipment >((a, b,c,d) => a.equip_id == d.id)
|
||||
.Where((a,b,c,d)=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>a.code.Contains(queryJson["code"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>a.name.Contains(queryJson["name"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("code"),(a,b,c,d)=>a.code.Contains(queryJson!["code"]))
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),(a,b,c,d)=>a.name.Contains(queryJson!["name"]))
|
||||
.Select((a, b, c,d) => new SubEquipQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
|
||||
@@ -37,8 +37,8 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, string>>(input?.queryJson ?? "");
|
||||
}
|
||||
var result = await db.Queryable<EqpTechnologyParameter>()
|
||||
.WhereIF(input!=null,a=>a.equip_id==input.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson["name"]))
|
||||
.WhereIF(input!=null,a=>a.equip_id==input!.equip_id)
|
||||
.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson!["name"]))
|
||||
.Select(a => new EquipTechnologyParameterQueryOutput
|
||||
{
|
||||
id = a.id,
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Tnb.EquipMgr
|
||||
var result = await db.Queryable<EqpWorkshopChangeLog>()
|
||||
.LeftJoin<OrganizeEntity>((a,b)=>a.old_workshop_id==b.Id)
|
||||
.LeftJoin<OrganizeEntity>((a,b,c)=>a.new_workshop_id==c.Id)
|
||||
.WhereIF(input!=null,a=>a.equip_id==input.equip_id)
|
||||
.WhereIF(input!=null,a=>a.equip_id==input!.equip_id)
|
||||
//.WhereIF(queryJson!=null && queryJson.ContainsKey("name"),a=>a.name.Contains(queryJson["name"]))
|
||||
.Select((a,b,c) => new EquipWorkshopChangeQueryOutput
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace Tnb.EquipMgr
|
||||
private async Task<dynamic> GetList(VisualDevModelListQueryInput input)
|
||||
{
|
||||
Dictionary<string, object>? queryJson = new Dictionary<string, object>();
|
||||
string requisitionCode = "";
|
||||
string? requisitionCode = "";
|
||||
DateTime[] requisitionTimeArr = null;
|
||||
DateTime[] estimatedReturnArr = null;
|
||||
if (input!=null && !string.IsNullOrEmpty(input.queryJson))
|
||||
@@ -60,15 +60,15 @@ namespace Tnb.EquipMgr
|
||||
queryJson = JsonConvert.DeserializeObject<Dictionary<string, object>>(input?.queryJson ?? "");
|
||||
}
|
||||
|
||||
if (queryJson.TryGetValue("requisition_code", out var value))
|
||||
if (queryJson!.TryGetValue("requisition_code", out var value))
|
||||
{
|
||||
requisitionCode = value.ToString();
|
||||
}
|
||||
if (queryJson.TryGetValue("requisition_time", out var value1))
|
||||
if (queryJson!.TryGetValue("requisition_time", out var value1))
|
||||
{
|
||||
requisitionTimeArr = value1.ToObject<long[]>().Select(x=>DateTimeOffset.FromUnixTimeSeconds(x/1000).ToLocalTime().DateTime).ToArray();
|
||||
}
|
||||
if (queryJson.TryGetValue("estimated_return_time", out var value2))
|
||||
if (queryJson!.TryGetValue("estimated_return_time", out var value2))
|
||||
{
|
||||
estimatedReturnArr = value2.ToObject<long[]>().Select(x=>DateTimeOffset.FromUnixTimeSeconds(x/1000).ToLocalTime().DateTime).ToArray();
|
||||
}
|
||||
|
||||
@@ -49,15 +49,20 @@ namespace Tnb.EquipMgr
|
||||
await _runService.Create(templateEntity, input);
|
||||
|
||||
|
||||
string locationId = "";
|
||||
string? locationId = "";
|
||||
if (input.data.TryGetValue("location_id", out var value))
|
||||
{
|
||||
locationId = value.ToString();
|
||||
}
|
||||
await _db.Updateable<ToolMolds>()
|
||||
.SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.ZKTypeId)
|
||||
.SetColumnsIF(!string.IsNullOrEmpty(locationId),x=>x.location_id==locationId)
|
||||
.Where(X => X.id == input.data["mold_id"]).ExecuteCommandAsync();
|
||||
|
||||
string moldId = input.data.ContainsKey("mold_id") ? input.data["mold_id"].ToString() : "";
|
||||
if (!string.IsNullOrEmpty(moldId))
|
||||
{
|
||||
await _db.Updateable<ToolMolds>()
|
||||
.SetColumns(x => x.mold_status == Tnb.BasicData.DictConst.ZKTypeId)
|
||||
.SetColumnsIF(!string.IsNullOrEmpty(locationId),x=>x.location_id==locationId)
|
||||
.Where(X => X.id == moldId).ExecuteCommandAsync();
|
||||
}
|
||||
});
|
||||
|
||||
if (!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
namespace Tnb.ProductionMgr.Entities.Dto
|
||||
{
|
||||
public class PrdInstockInput
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 单据类型
|
||||
/// </summary>
|
||||
public string bill_type { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 载具编号
|
||||
/// </summary>
|
||||
public string carry_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 起始库位编号
|
||||
/// </summary>
|
||||
public string location_code { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检验(0-未检 1-已检)
|
||||
/// </summary>
|
||||
public int is_check { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子表明细
|
||||
/// </summary>
|
||||
public List<Dictionary<string,string>> details { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -36,7 +36,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// <summary>
|
||||
/// 物料规格型号
|
||||
/// </summary>
|
||||
public string material_standard { get; set; } = string.Empty;
|
||||
public string? material_standard { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 工单类型:1-正常工单、2-返工工单、3-试制工单
|
||||
@@ -51,32 +51,32 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// <summary>
|
||||
/// 计划生产数量
|
||||
/// </summary>
|
||||
public string plan_qty { get; set; } = string.Empty;
|
||||
public string? plan_qty { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 已投入数量
|
||||
/// </summary>
|
||||
public string input_qty { get; set; } = string.Empty;
|
||||
public string? input_qty { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 已完工数量
|
||||
/// </summary>
|
||||
public string complete_qty { get; set; } = string.Empty;
|
||||
public string? complete_qty { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 报废数量
|
||||
/// </summary>
|
||||
public string scrap_qty { get; set; } = string.Empty;
|
||||
public string? scrap_qty { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 计划开始时间
|
||||
/// </summary>
|
||||
public string plan_start_date { get; set; } = string.Empty;
|
||||
public string? plan_start_date { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 计划结束时间
|
||||
/// </summary>
|
||||
public string plan_end_date { get; set; } = string.Empty;
|
||||
public string? plan_end_date { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 是否生派工单
|
||||
@@ -112,7 +112,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public string create_time { get; set; } = string.Empty;
|
||||
public string? create_time { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 修改用户
|
||||
@@ -131,7 +131,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
/// <summary>
|
||||
/// 已排产数量
|
||||
/// </summary>
|
||||
public string scheduled_qty { get; set; } = string.Empty;
|
||||
public string? scheduled_qty { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 父工单id
|
||||
/// </summary>
|
||||
|
||||
@@ -3,7 +3,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public class PrdTaskManageListOutput
|
||||
{
|
||||
public string id { get; set; } = string.Empty;
|
||||
public string mo_task_code { get; set; } = string.Empty;
|
||||
public string? mo_task_code { get; set; } = string.Empty;
|
||||
public string material_id { get; set; } = string.Empty;
|
||||
public string mold_id { get; set; } = string.Empty;
|
||||
public string eqp_id { get; set; } = string.Empty;
|
||||
@@ -11,7 +11,7 @@ namespace Tnb.ProductionMgr.Entities.Dto.PrdManage
|
||||
public string plan_end_date { get; set; } = string.Empty;
|
||||
public int? plan_qty { get; set; }
|
||||
public int? complete_qty { get; set; }
|
||||
public string mo_task_status { get; set; } = string.Empty;
|
||||
public string schedule_type { get; set; } = string.Empty;
|
||||
public string? mo_task_status { get; set; } = string.Empty;
|
||||
public string? schedule_type { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public partial class PrdInstockD : BaseEntity<string>
|
||||
/// <summary>
|
||||
/// 数量
|
||||
/// </summary>
|
||||
public string quantity { get; set; } = string.Empty;
|
||||
public int quantity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 批次
|
||||
@@ -49,4 +49,9 @@ public partial class PrdInstockD : BaseEntity<string>
|
||||
/// </summary>
|
||||
public string barcode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 生产提报id
|
||||
/// </summary>
|
||||
public string report_id { get; set; } = string.Empty;
|
||||
|
||||
}
|
||||
@@ -38,16 +38,12 @@ public partial class PrdInstockH : BaseEntity<string>
|
||||
/// 起始库位编号
|
||||
/// </summary>
|
||||
public string location_code { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 来源单据ID
|
||||
/// </summary>
|
||||
public string source_id { get; set; } = string.Empty;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 检验(0-未检 1-已检)
|
||||
/// </summary>
|
||||
public string is_check { get; set; } = string.Empty;
|
||||
public int is_check { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建用户
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
|
||||
namespace Tnb.ProductionMgr.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
@@ -6,6 +8,13 @@ namespace Tnb.ProductionMgr.Interfaces
|
||||
public interface IPrdInstockService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 生产入库报错
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public Task<dynamic> SaveData(PrdInstockInput input);
|
||||
|
||||
/// <summary>
|
||||
/// 入库申请同步
|
||||
/// </summary>
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.Systems.Entitys.Permission;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.ClearScript.Util.Web;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
@@ -16,6 +19,7 @@ using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.ProductionMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -29,20 +33,20 @@ namespace Tnb.ProductionMgr
|
||||
private readonly ISqlSugarRepository<PrdFeedingH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
|
||||
// private readonly WmsSignForDeliveryService _wmsSignForDeliveryService;
|
||||
|
||||
|
||||
|
||||
public PrdFeedingService(
|
||||
ISqlSugarRepository<PrdFeedingH> repository,
|
||||
IBillRullService billRullService,
|
||||
WmsSignForDeliveryService wmsSignForDeliveryService,
|
||||
// WmsSignForDeliveryService wmsSignForDeliveryService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_wmsSignForDeliveryService = _wmsSignForDeliveryService;
|
||||
// _wmsSignForDeliveryService = _wmsSignForDeliveryService;
|
||||
_billRullService = billRullService;
|
||||
}
|
||||
|
||||
@@ -143,12 +147,12 @@ namespace Tnb.ProductionMgr
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
//签收后调用载具签收接口
|
||||
await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = input.carry_code ?? "",
|
||||
});
|
||||
// await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||
// {
|
||||
// org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
// create_id = _userManager.UserId,
|
||||
// carry_code = input.carry_code ?? "",
|
||||
// });
|
||||
}
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
@@ -257,12 +261,26 @@ namespace Tnb.ProductionMgr
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
//签收后调用载具签收接口
|
||||
await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||
// await _wmsSignForDeliveryService.MESCarrySign(new MESCarrySignInput()
|
||||
// {
|
||||
// org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
// create_id = _userManager.UserId,
|
||||
// carry_code = input.carry_code ?? "",
|
||||
// });
|
||||
|
||||
var mesCarrySignInput = new MESCarrySignInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = input.carry_code ?? "",
|
||||
});
|
||||
};
|
||||
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CARRY_SIGN,JsonConvert.SerializeObject(mesCarrySignInput),header);
|
||||
}
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(result.ErrorMessage);
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
using JNPF;
|
||||
using JNPF.Common.Core.Manager;
|
||||
using JNPF.Common.Enums;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Extras.CollectiveOAuth.Utils;
|
||||
using JNPF.FriendlyException;
|
||||
using JNPF.RemoteRequest;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.ProductionMgr.Entities;
|
||||
using Tnb.ProductionMgr.Entities.Dto;
|
||||
using Tnb.ProductionMgr.Interfaces;
|
||||
using Tnb.WarehouseMgr;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
|
||||
using Tnb.BasicData;
|
||||
|
||||
namespace Tnb.ProductionMgr
|
||||
{
|
||||
@@ -19,18 +31,112 @@ namespace Tnb.ProductionMgr
|
||||
{
|
||||
private readonly ISqlSugarRepository<PrdInstockH> _repository;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly IBillRullService _billRullService;
|
||||
|
||||
|
||||
public PrdInstockService(
|
||||
ISqlSugarRepository<PrdInstockH> repository,
|
||||
IBillRullService billRullService,
|
||||
IUserManager userManager
|
||||
)
|
||||
{
|
||||
_repository = repository;
|
||||
_userManager = userManager;
|
||||
_billRullService = billRullService;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<dynamic> SaveData(PrdInstockInput input)
|
||||
{
|
||||
var db = _repository.AsSugarClient();
|
||||
var location = await db.Queryable<BasLocation>().FirstAsync(x => x.location_code == input.location_code);
|
||||
PrdInstockH prdInstockH = null;
|
||||
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
|
||||
{
|
||||
prdInstockH = new PrdInstockH()
|
||||
{
|
||||
bill_type = input.bill_type,
|
||||
bill_date = DateTime.Now,
|
||||
create_id = _userManager.UserId,
|
||||
location_code = input.location_code,
|
||||
carry_code = input.carry_code,
|
||||
is_check = input.is_check,
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
warehouse_id = location?.wh_id,
|
||||
status = 0,
|
||||
};
|
||||
|
||||
List<PrdInstockD> prdInstockDs = new List<PrdInstockD>() { };
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
prdInstockDs.Add(new PrdInstockD()
|
||||
{
|
||||
instock_id = prdInstockH.id,
|
||||
report_id = item.ContainsKey("report_id") ? item["report_id"] : "",
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
quantity = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
}
|
||||
|
||||
await _repository.InsertAsync(prdInstockH);
|
||||
|
||||
if (prdInstockDs.Count > 0)
|
||||
{
|
||||
await db.Insertable<PrdInstockD>(prdInstockDs).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (result.IsSuccess)
|
||||
{
|
||||
MESCreateInstockInput mesCreateInstockInput = new MESCreateInstockInput();
|
||||
mesCreateInstockInput.instock = new MESWmsInstockHInput()
|
||||
{
|
||||
org_id = _userManager.GetUserInfo().Result.organizeId,
|
||||
bill_date = DateTime.Now,
|
||||
bill_type = input.bill_type,
|
||||
warehouse_id = location?.wh_id,
|
||||
source_id = prdInstockH.id,
|
||||
create_id = _userManager.UserId,
|
||||
carry_code = input.carry_code,
|
||||
location_code = input.location_code,
|
||||
is_check = input.is_check,
|
||||
};
|
||||
mesCreateInstockInput.instockds = new List<MESWmsInstockDInput>();
|
||||
mesCreateInstockInput.instockcodes = new List<MESWmsInstockCodeInput>();
|
||||
foreach (var item in input.details)
|
||||
{
|
||||
mesCreateInstockInput.instockds.Add(new MESWmsInstockDInput()
|
||||
{
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
pr_qty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
|
||||
mesCreateInstockInput.instockcodes.Add(new MESWmsInstockCodeInput()
|
||||
{
|
||||
material_id = item.ContainsKey("material_id") ? item["material_id"] : "",
|
||||
material_code = item.ContainsKey("material_code") ? item["material_code"] : "",
|
||||
unit_id = item.ContainsKey("unit_id") ? item["unit_id"] : "",
|
||||
code_batch = item.ContainsKey("batch") ? item["batch"] : "",
|
||||
barcode = item.ContainsKey("batch") ? item["batch"]+"0001" : "",
|
||||
codeqty = Convert.ToInt32(item.ContainsKey("quantity") ? item["quantity"] : "0"),
|
||||
});
|
||||
}
|
||||
string domain = (App.HttpContext.Request.IsHttps ? "https://" : "http://") + App.HttpContext.Request.Host;
|
||||
Dictionary<string, object> header = new Dictionary<string, object>()
|
||||
{
|
||||
["Authorization"] = App.HttpContext.Request.Headers["Authorization"]
|
||||
};
|
||||
var sendResult = HttpUtils.RequestPost(domain + WebApiConst.MES_CREATE_INSTOCK,JsonConvert.SerializeObject(mesCreateInstockInput),header);
|
||||
Console.WriteLine(sendResult);
|
||||
}
|
||||
|
||||
if(!result.IsSuccess) throw Oops.Oh(ErrorCode.COM1008);
|
||||
return result.IsSuccess ? "保存成功" : result.ErrorMessage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -144,8 +144,8 @@ namespace Tnb.ProductionMgr
|
||||
material_id = c.code+"/"+c.name,
|
||||
mold_id = d.mold_code+"/"+d.mold_name,
|
||||
eqp_id = b.code+"/"+b.name,
|
||||
plan_start_date = a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_end_date = a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_start_date = a.estimated_start_date==null ? "" : a.estimated_start_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_end_date = a.estimated_end_date==null ? "" : a.estimated_end_date.Value.ToString("yyyy-MM-dd"),
|
||||
plan_qty = a.scheduled_qty,
|
||||
complete_qty = a.reported_work_qty,
|
||||
mo_task_status = a.mo_task_status,
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<ProjectReference Include="..\..\taskschedule\Tnb.TaskScheduler\Tnb.TaskScheduler.csproj" />
|
||||
<ProjectReference Include="..\..\visualdev\Tnb.VisualDev.Engine\Tnb.VisualDev.Engine.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr.Entities\Tnb.WarehouseMgr.Entities.csproj" />
|
||||
<ProjectReference Include="..\..\WarehouseMgr\Tnb.WarehouseMgr\Tnb.WarehouseMgr.csproj" />
|
||||
<ProjectReference Include="..\Tnb.ProductionMgr.Interfaces\Tnb.ProductionMgr.Interfaces.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -12,9 +12,13 @@ using JNPF.Common.Enums;
|
||||
using JNPF.Common.Extension;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using JNPF.Systems.Interfaces.System;
|
||||
using JNPF.VisualDev;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Attributes;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Entities.Dto.Outputs;
|
||||
using Tnb.WarehouseMgr.Entities.Entity;
|
||||
@@ -43,6 +47,8 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[NonAction]
|
||||
protected async Task DoUpdate(WareHouseUpInput input)
|
||||
{
|
||||
|
||||
@@ -18,9 +18,6 @@ namespace Tnb.WarehouseMgr
|
||||
public class Dp
|
||||
{
|
||||
private HashSet<string> set = new HashSet<string>();
|
||||
private const int Max = int.MaxValue;
|
||||
private int Min = int.MaxValue;
|
||||
private int Deep = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 动态规划函数
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Tnb.WarehouseMgr
|
||||
warehouse_name = c.whname,
|
||||
})
|
||||
.ToListAsync();
|
||||
return items;
|
||||
return items ?? Enumerable.Empty<dynamic>();
|
||||
}
|
||||
/// <summary>
|
||||
/// 库房业务,入库、出库申请新增修改功能
|
||||
@@ -102,7 +102,7 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpPost]
|
||||
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)
|
||||
where TStockD : BaseEntity<string>, new()
|
||||
@@ -139,27 +139,10 @@ namespace Tnb.WarehouseMgr
|
||||
[HttpGet]
|
||||
public async Task<dynamic?> GetInOutStockCodesById([FromQuery] InOutStockDetailQuery input)
|
||||
{
|
||||
async Task<dynamic?> _fetchInOutStockCodesById<TStockD, TOutput, TStockCode>(string billDId)
|
||||
where TStockD : BaseEntity<string>, new()
|
||||
where TOutput : IInOutStockDetail<TStockCode>, new()
|
||||
where TStockCode : BaseEntity<string>, IInOutStockCode, new()
|
||||
{
|
||||
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
||||
var data = await _db.Queryable<TStockD>()
|
||||
.Where(a => a.id == billDId)
|
||||
.Select(a => new TOutput
|
||||
{
|
||||
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
||||
}, true)
|
||||
.Mapper(it => it.line_status = dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
||||
.ToListAsync();
|
||||
return data;
|
||||
}
|
||||
|
||||
dynamic? result = input.inoutStockType switch
|
||||
{
|
||||
EnumInOutStockType.In => await _fetchInOutStockCodesById<WmsInstockD, InStockDetailOutput, WmsInstockCode>(input.bill_d_id),
|
||||
EnumInOutStockType.Out => await _fetchInOutStockCodesById<WmsOutstockD, OutStockDetailOutput, WmsOutstockCode>(input.bill_d_id),
|
||||
EnumInOutStockType.In => await FetchInOutStockCodesById<WmsInstockD, InStockDetailOutput, WmsInstockCode>(input.bill_d_id),
|
||||
EnumInOutStockType.Out => await FetchInOutStockCodesById<WmsOutstockD, OutStockDetailOutput, WmsOutstockCode>(input.bill_d_id),
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(input.inoutStockType), $"Not expected EnumInOutStockType value: {input.inoutStockType}"),
|
||||
};
|
||||
return result ?? Enumerable.Empty<dynamic>();
|
||||
@@ -555,20 +538,13 @@ namespace Tnb.WarehouseMgr
|
||||
//根据载具ID,更新是否锁定和赋值起始库位
|
||||
if (setCarryColumnsExp != null)
|
||||
{
|
||||
if (input.CarryIds?.Count > 0)
|
||||
{
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(it => input.CarryIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
{
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(it => it.id == input.CarryId).ExecuteCommandAsync();
|
||||
}
|
||||
Expression<Func<WmsCarryH, bool>> whereExp = input.CarryIds?.Count > 0 ? it => input.CarryIds.Contains(it.id) : it => it.id == input.CarryId;
|
||||
await _db.Updateable<WmsCarryH>().SetColumns(setCarryColumnsExp).Where(whereExp).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
//根据所有库位更新库位的锁定状态为“锁定”
|
||||
if (setLocaionColumbExp != null)
|
||||
if (setLocaionColumbExp != null && input.LocationIds?.Count > 0)
|
||||
{
|
||||
await _db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds!.Contains(it.id)).ExecuteCommandAsync();
|
||||
await _db.Updateable<BasLocation>().SetColumns(setLocaionColumbExp).Where(it => input.LocationIds.Contains(it.id)).ExecuteCommandAsync();
|
||||
}
|
||||
await _db.Ado.CommitTranAsync();
|
||||
}
|
||||
@@ -744,7 +720,30 @@ namespace Tnb.WarehouseMgr
|
||||
return isOk;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 根据明细Id获取出入库明细信息
|
||||
/// </summary>
|
||||
/// <typeparam name="TStockD">出入库明细</typeparam>
|
||||
/// <typeparam name="TOutput">明细输出类</typeparam>
|
||||
/// <typeparam name="TStockCode">出入库条码</typeparam>
|
||||
/// <param name="billDId">明细Id</param>
|
||||
/// <returns></returns>
|
||||
private async Task<dynamic?> FetchInOutStockCodesById<TStockD, TOutput, TStockCode>(string billDId)
|
||||
where TStockD : BaseEntity<string>, new()
|
||||
where TOutput : IInOutStockDetail<TStockCode>, new()
|
||||
where TStockCode : BaseEntity<string>, IInOutStockCode, new()
|
||||
{
|
||||
var dic = await _dictionaryDataService.GetDictionaryByTypeId(WmsWareHouseConst.WMS_INSTOCK_D_BILL_STATUS_TYPEID);
|
||||
var data = await _db.Queryable<TStockD>()
|
||||
.Where(a => a.id == billDId)
|
||||
.Select(a => new TOutput
|
||||
{
|
||||
CodeDetails = SqlFunc.Subqueryable<TStockCode>().Where(it => it.bill_d_id == a.id).ToList(),
|
||||
}, true)
|
||||
.Mapper(it => it.line_status = it.line_status != null && dic.ContainsKey(key: it.line_status) ? dic[it.line_status]?.ToString() : "")
|
||||
.ToListAsync();
|
||||
return data;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.DynamicApiController;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SqlSugar;
|
||||
using Tnb.BasicData.Entities;
|
||||
using Tnb.WarehouseMgr.Entities;
|
||||
using Tnb.WarehouseMgr.Entities.Consts;
|
||||
using Tnb.WarehouseMgr.Entities.Dto;
|
||||
using Tnb.WarehouseMgr.Interfaces;
|
||||
|
||||
@@ -38,18 +41,19 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
dicMaterial = await _db.Queryable<BasMaterial>().ToDictionaryAsync(x => x.id, x => x.name);
|
||||
}
|
||||
var 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();
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
List<string> carryMIds = new();
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||
{
|
||||
var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
carryMIds = carryDs.Select(x => x.membercarry_id).ToList();
|
||||
}
|
||||
Expression<Func<WmsCarryCode, bool>> whereExp = carryMIds?.Count > 0 ? a => carryMIds.Contains(a.carry_id) : a => a.carry_id == carryId;
|
||||
var items = await _db.Queryable<WmsCarryCode>().Where(whereExp)
|
||||
.Select<CarryCodeDetailOutput>()
|
||||
.Mapper(it => it.material_name = (it.material_id != null && dicMaterial.ContainsKey(it.material_id)) ? dicMaterial[it.material_id].ToString() : "")
|
||||
.ToListAsync();
|
||||
|
||||
return items ?? Enumerable.Empty<dynamic>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Tnb.WarehouseMgr
|
||||
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch })
|
||||
.Select(x =>
|
||||
{
|
||||
WmsCarryMat? carryMat = x.FirstOrDefault();
|
||||
WmsCarryMat carryMat = new();
|
||||
carryMat.need_qty = x.Sum(d => d.need_qty);
|
||||
return carryMat;
|
||||
})
|
||||
@@ -353,11 +353,19 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
List<WmsCarryMat> carryMats = new();
|
||||
List<WmsCarryCode> carryCodes = new();
|
||||
var whereExp = Expressionable.Create<WmsCarryH, WmsCarryCode, BasLocation>()
|
||||
.And((a, b, c) => a.is_lock == 0)
|
||||
.And((a, b, c) => !string.IsNullOrEmpty(a.location_id))
|
||||
.And((a, b, c) => a.status == (int)EnumCarryStatus.占用)
|
||||
.And((a, b, c) => c.is_type == ((int)EnumLocationType.存储库位).ToString());
|
||||
|
||||
foreach (var os in outStockDList)
|
||||
{
|
||||
whereExp.And((a, b, c) => b.material_id == os.material_id)
|
||||
.AndIF(!string.IsNullOrEmpty(os.code_batch), (a, b, c) => b.code_batch == os.code_batch);
|
||||
|
||||
var carryCodesPart = await _db.Queryable<WmsCarryH>().InnerJoin<WmsCarryCode>((a, b) => a.id == b.carry_id).InnerJoin<BasLocation>((a, b, c) => a.location_id == c.id)
|
||||
.Where((a, b, c) => b.material_id == os.material_id && a.is_lock == 0 && !string.IsNullOrEmpty(a.location_id) && a.status == (int)EnumCarryStatus.占用 && c.is_type == ((int)EnumLocationType.存储库位).ToString())
|
||||
.WhereIF(!string.IsNullOrEmpty(os.code_batch), (a, b) => b.code_batch == os.code_batch)
|
||||
.Where(whereExp.ToExpression())
|
||||
.Select<WmsCarryCode>()
|
||||
.ToListAsync();
|
||||
if (carryCodesPart?.Count > 0)
|
||||
@@ -399,7 +407,7 @@ namespace Tnb.WarehouseMgr
|
||||
carryMats = carryMats.OrderBy(o => o.create_time).GroupBy(g => new { g.carry_id, g.material_id, g.code_batch })
|
||||
.Select(x =>
|
||||
{
|
||||
WmsCarryMat? carryMat = x.FirstOrDefault()!;
|
||||
WmsCarryMat carryMat = new();
|
||||
carryMat.need_qty = x.Sum(d => d.need_qty);
|
||||
return carryMat;
|
||||
})
|
||||
@@ -435,10 +443,8 @@ namespace Tnb.WarehouseMgr
|
||||
List<string> locIds = new();
|
||||
foreach (var carry in carrys)
|
||||
{
|
||||
WmsPointH sPoint = null!;
|
||||
WmsPointH ePoint = null!;
|
||||
sPoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == carry.location_id);
|
||||
ePoint = await _db.Queryable<WmsPointH>().FirstAsync(it => it.location_id == outstock.location_id.ToString());
|
||||
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 == outstock.location_id.ToString());
|
||||
|
||||
if (sPoint != null && ePoint != null)
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task PackSortingByAdd()
|
||||
public async Task PackSortingByAdd(WmsCarryMat? carryMat)
|
||||
{
|
||||
var setSortings = await _db.Queryable<WmsSetsortingH>()
|
||||
.Where(a => a.status == WmsWareHouseConst.BILLSTATUS_ADD_ID).OrderBy(a => a.seq)
|
||||
@@ -142,10 +142,11 @@ namespace Tnb.WarehouseMgr
|
||||
List<WmsPretaskH> preTasks = new();
|
||||
List<string> locIds = new();
|
||||
string firstLocationId = "27010980724501", secondLocationId = "27010987857941";
|
||||
if (carrys.Length > 6)
|
||||
var mid = 6;
|
||||
if (carrys.Length > mid)
|
||||
{
|
||||
var leftCarrys = carrys[..6];
|
||||
var rightCarrys = carrys[6..];
|
||||
var leftCarrys = carrys[..mid];
|
||||
var rightCarrys = carrys[mid..];
|
||||
await InnerGenPreTask(leftCarrys, locIds, firstLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
||||
await InnerGenPreTask(rightCarrys, locIds, secondLocationId, singleSorting.id, singleSorting.bill_code, preTasks);
|
||||
}
|
||||
@@ -167,7 +168,7 @@ namespace Tnb.WarehouseMgr
|
||||
pretaskCodes.AddRange(curPreTaskCodes);
|
||||
}
|
||||
await _wareHouseService.GenPreTask(preTasks, pretaskCodes);
|
||||
await _db.Updateable<WmsSetsortingH>().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it=> it.id == singleSorting.id).ExecuteCommandAsync();
|
||||
await _db.Updateable<WmsSetsortingH>().SetColumns(it => new WmsSetsortingH { status = WmsWareHouseConst.BILLSTATUS_ON_ID }).Where(it => it.id == singleSorting.id).ExecuteCommandAsync();
|
||||
GenPreTaskUpInput genPreTaskAfterUpInput = new();
|
||||
genPreTaskAfterUpInput.CarryIds = preTasks.Select(x => x.carry_id).ToList();
|
||||
genPreTaskAfterUpInput.LocationIds = new HashSet<string>(locIds).ToList();
|
||||
@@ -298,7 +299,7 @@ namespace Tnb.WarehouseMgr
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
if (carry != null)
|
||||
{
|
||||
if (carry!.location_id!.IsNotEmptyOrNull())
|
||||
if (carry.location_id?.IsNotEmptyOrNull() ?? false)
|
||||
{
|
||||
await _db.Updateable<BasLocation>().SetColumns(it => new BasLocation { is_use = ((int)EnumCarryStatus.空闲).ToString() }).Where(it => it.id == carry.location_id).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.Common;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Aop.Api.Domain;
|
||||
@@ -72,15 +74,19 @@ namespace Tnb.WarehouseMgr
|
||||
{
|
||||
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)
|
||||
{
|
||||
var firstCarry = carrys.FirstOrDefault();
|
||||
GenPreTaskUpInput genPreTaskInput = new() { CarryId = firstCarry!.id! };
|
||||
GenPreTaskUpInput genPreTaskInput = new() { CarryId = firstCarry?.id };
|
||||
await _warehouseService.GenInStockTaskHandleAfter(genPreTaskInput, it => new WmsCarryH { is_lock = 1 }, null!);
|
||||
ko.status = WmsWareHouseConst.BILLSTATUS_TOBESHIPPED_ID;
|
||||
ko.carry_id = firstCarry.id;
|
||||
ko.carry_code = firstCarry.carry_code;
|
||||
ko.carry_id = firstCarry?.id;
|
||||
ko.carry_code = firstCarry?.carry_code;
|
||||
await _db.Updateable(ko).UpdateColumns(it => new { it.status, it.carry_id, it.carry_code }).ExecuteCommandAsync();
|
||||
}
|
||||
else
|
||||
@@ -131,7 +137,7 @@ namespace Tnb.WarehouseMgr
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task KittingOutByIsToBeShipped(IDbTransaction? tran = null)
|
||||
public async Task KittingOutByIsToBeShipped()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -152,10 +158,13 @@ namespace Tnb.WarehouseMgr
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == ko.carry_id);
|
||||
if (carry != null)
|
||||
{
|
||||
|
||||
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);
|
||||
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);
|
||||
if (points.Count <= 2) throw new AppFriendlyException("该路径不存在", 500);
|
||||
if (points?.Count > 0)
|
||||
@@ -187,12 +196,16 @@ namespace Tnb.WarehouseMgr
|
||||
preTask.create_time = DateTime.Now;
|
||||
return preTask;
|
||||
}).ToList();
|
||||
if (loc.is_sign == 0)
|
||||
{
|
||||
preTasks[^1].is_sign = 0; // 修改最后一个元素的是否签收值
|
||||
}
|
||||
await _warehouseService.GenPreTask(preTasks, null!);
|
||||
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();
|
||||
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 _db.Updateable<WmsKittingoutH>().SetColumns(it => it.status == WmsWareHouseConst.BILLSTATUS_ON_ID).Where(it => it.id == ko.id).ExecuteCommandAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -223,10 +236,18 @@ namespace Tnb.WarehouseMgr
|
||||
|
||||
var carryId = input.carryIds[^input.carryIds.Count];
|
||||
var carry = await _db.Queryable<WmsCarryH>().SingleAsync(it => it.id == carryId);
|
||||
|
||||
var kods = await _db.Queryable<WmsKittingoutD>().Where(it => it.bill_id == input.requireId).ToListAsync();
|
||||
//当前载具对应的所有条码插入
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
//载具为料架时,取所有料箱的条码
|
||||
List<string> carryMIds = new();
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||
{
|
||||
var carryDs = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carryId).ToListAsync();
|
||||
carryMIds = carryDs.Select(x => x.membercarry_id).ToList();
|
||||
}
|
||||
//当前载具对应的所有条码插入
|
||||
Expression<Func<WmsCarryCode, bool>> whereExp = carryMIds?.Count > 0 ? a => carryMIds.Contains(a.carry_id) : a => a.carry_id == carryId;
|
||||
|
||||
var carryCodes = await _db.Queryable<WmsCarryCode>().Where(whereExp).ToListAsync();
|
||||
var kittingoutCodes = carryCodes.Adapt<List<WmsKittingoutCode>>();
|
||||
kittingoutCodes.ForEach(x =>
|
||||
{
|
||||
@@ -271,9 +292,7 @@ namespace Tnb.WarehouseMgr
|
||||
//判断当前载具是否为料架,如果是料架 清空所有料架/料箱数据,
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID)
|
||||
{
|
||||
var carryds = await _db.Queryable<WmsCarryD>().Where(it => it.id == carryId).ToListAsync();
|
||||
var mids = carryds.Select(x => x.membercarry_id).ToList();
|
||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => mids.Contains(it.id)).ToListAsync();
|
||||
var carrys = await _db.Queryable<WmsCarryH>().Where(it => carryMIds.Contains(it.id)).ToListAsync();
|
||||
carrys.Add(carry);
|
||||
if (carrys?.Count > 0)
|
||||
{
|
||||
@@ -309,7 +328,7 @@ namespace Tnb.WarehouseMgr
|
||||
if (input.IsNull()) throw new ArgumentNullException("input");
|
||||
try
|
||||
{
|
||||
|
||||
|
||||
await _db.Ado.BeginTranAsync();
|
||||
List<WmsKittingoutD> kittingOutDs = new();
|
||||
var kittingOuts = input.Adapt<List<WmsKittingoutH>>();
|
||||
|
||||
Reference in New Issue
Block a user