This commit is contained in:
2024-10-28 10:21:49 +08:00
8 changed files with 224 additions and 13 deletions

View File

@@ -2390,6 +2390,12 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
WmsCarryH wmsCarryH = items[0];
if (wmsCarryH.carry_status == "0")
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼待灭菌仓到灭菌线】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据");
break;
}
//锁定起点库位
await db_Floor4DMJ2MJX.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == wmsCarryH.location_id).ExecuteCommandAsync();
//锁定终点库位
@@ -2501,6 +2507,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
LoggerFloor4MJX2MJC.LogWarning($"【四楼灭菌线到解析仓】 托盘号{carry_code}在系统中不存在");
continue;
}
if (wmsCarryH.carry_status == "0")
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼灭菌线到解析仓】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据");
break;
}
//锁定起点库位
await db_Floor4MJX2MJC.Updateable<BasLocation>().SetColumns(r => new BasLocation { is_lock = 1 }).Where(r => r.id == startlocation.id).ExecuteCommandAsync();
//锁定终点库位
@@ -2634,7 +2645,11 @@ where carry_code = '{coderesult}' and status = '{WmsWareHouseConst.TASK_BILL_STA
await semaphoreSlim_CPK.WaitAsync();
WmsCarryH wmsCarryH = await db_Floor4DMC2CPK.Queryable<WmsCarryH>().Where(r => r.id == wmsSterilizationInstockH.carry_id).FirstAsync();
if (wmsCarryH.carry_status == "0")
{
LoggerFloor4DMJ2MJX.LogWarning($"【四楼灭菌仓到成品库】 载具{wmsCarryH.carry_code}状态为空闲,而当前业务中载具应该为占用状态,请检查数据");
break;
}
if (wmsCarryH.location_id != wmsSterilizationInstockH.location_id)
{
LoggerFloor4DMC2CPK.LogWarning($"【四楼灭菌仓到成品库】载具{wmsCarryH.carry_code}实际位置与灭菌入库记录位置不一致");

View File

@@ -119,7 +119,11 @@ public class ModuleConsts
/// <summary>
/// 模块标识-载具更换
/// </summary>
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";//26188532491557
public const string MODULE_WMSCARRYREPLACE_ID = "26188532491557";
/// <summary>
/// 模块标识-盘点
/// </summary>
public const string MODULE_WmsInventorycheck_ID = "37804588973589";
/// <summary>
/// 模块标识-人工扫码入库记录 todo
/// </summary>

View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tnb.WarehouseMgr.Entities.Consts;
namespace Tnb.WarehouseMgr.Entities.Dto.Inputs
{
public class WmsInventorycheckSubmitInput
{
public string erp_line_pk { get; set; }
public List<WmsInventorycheckSubmitDetailInput> details { get; set; }
}
public class WmsInventorycheckSubmitDetailInput
{
public string carry_code { get; set; }
public string material_id { get; set; }
public string code_batch { get; set; }
public string actual_qty { get; set; }
public string location_id { get; set; }
}
}

View File

@@ -3140,20 +3140,37 @@ namespace Tnb.WarehouseMgr
await db.Updateable<WmsCarryH>()
.SetColumns(x => x.carry_status == carryStatus)
.Where(x => clearCarryIds.Contains(x.id))
.ExecuteCommandAsync();
Logger.Information($"【TaskComplate】 更新载具状态 {JsonConvert.SerializeObject(clearCarryIds)}成功");
await db.Updateable<WmsCarryH>()
.SetColumns(x => x.is_check == isCheck)
.Where(x => clearCarryIds.Contains(x.id))
.ExecuteCommandAsync();
Logger.Information($"【TaskComplate】 更新载具检验 {JsonConvert.SerializeObject(clearCarryIds)}成功");
//await QTRK2BIP(dt, db);
// require_code是任务单
//string mo_task_code = dt.require_code;
}
else if (dt.biz_type ==WmsWareHouseConst.BIZTYPE_WMSMATERIALTRANSFER_ID)//长管签收
{
//自动签收投料更新载具状态
WmsCarryH carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.id == dt.carry_id);
List<string> clearCarryIds = new List<string>();
clearCarryIds.Add(carry.id);
List<string> memberCarryIds = new List<string>();
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID ||
carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
{
}
else
{
memberCarryIds = await db.Queryable<WmsCarryD>().Where(x=>x.carry_id==carry.id).Select(x=>x.membercarry_id).ToListAsync();
clearCarryIds.AddRange(memberCarryIds);
}
await db.Updateable<WmsCarryH>()
.SetColumns(x => x.carry_status == carryStatus)
.SetColumns(x => x.is_check == isCheck)
.Where(x => clearCarryIds.Contains(x.id))
.ExecuteCommandAsync();
}
else if (dt.biz_type == "erp_qtrk")
{
//await QTRK2BIP(dt, db);

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.EventBus;
using JNPF.FriendlyException;
using JNPF.Systems.Interfaces.System;
using JNPF.VisualDev;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Npgsql;
using SqlSugar;
using Tnb.BasicData.Interfaces;
using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Entities.Entity;
using Tnb.WarehouseMgr.Entities.Enums;
using Tnb.WarehouseMgr.Interfaces;
namespace Tnb.WarehouseMgr
{
[OverideVisualDev(ModuleConsts.MODULE_WmsInventorycheck_ID)]
public class WmsInventorycheckService : BaseWareHouseService
{
private readonly ISqlSugarClient _db;
private readonly IDictionaryDataService _dictionaryDataService;
private readonly IUserManager _userManager;
private readonly IWareHouseService _wareHouseService;
private readonly IBillRullService _billRullService;
private readonly IPrdInstockService _prdInstockService;
private readonly IThirdApiRecordService _thirdApiRecordService;
private static Dictionary<string, object> _dicBillCodes = new();
public WmsInventorycheckService(
ISqlSugarRepository<WmsInventorycheckH> repository,
IDictionaryDataService dictionaryDataService,
IUserManager userManager,
IBillRullService billRullService,
IWareHouseService wareHouseService,
IPrdInstockService prdInstockService,
IThirdApiRecordService thirdApiRecordService,
IEventPublisher eventPublisher
)
{
_db = repository.AsSugarClient();
_dictionaryDataService = dictionaryDataService;
_userManager = userManager;
_billRullService = billRullService;
_wareHouseService = wareHouseService;
_thirdApiRecordService = thirdApiRecordService;
_prdInstockService = prdInstockService;
}
/// <summary>
/// 盘点单提交
/// </summary>
/// <param name="input"></param>
/// <exception cref="ArgumentNullException"></exception>
[HttpPost]
public async Task<dynamic> Submit(WmsInventorycheckSubmitInput input)
{
try
{
return await ToApiResult(HttpStatusCode.OK, "成功");
}
catch (PostgresException ex)
{
Logger.LogError(ex.Message);
Logger.LogError(ex.StackTrace);
throw new AppFriendlyException($"{ex.Message}", 500);
}
catch (Exception ex)
{
Logger.LogInformation(ex.Message);
Logger.LogInformation(ex.StackTrace);
return await ToApiResult(HttpStatusCode.InternalServerError, ex.Message);
}
}
}
}

View File

@@ -2606,6 +2606,8 @@ namespace Tnb.WarehouseMgr
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(moTask.workstation_id, DictConst.RegionCategoryWorkshopCode);
List<PrdMaterialReceiptH> insertHList = new List<PrdMaterialReceiptH>();
List<PrdMaterialReceiptD> insertDList = new List<PrdMaterialReceiptD>();
List<PrdFeedingH> insertFHList = new List<PrdFeedingH>();
List<PrdFeedingD> insertFDList = new List<PrdFeedingD>();
string orgId = WmsWareHouseConst.AdministratorOrgId;
// string userId = moTask.worker_id;
string userId = WmsWareHouseConst.AdministratorUserId;
@@ -2635,6 +2637,26 @@ namespace Tnb.WarehouseMgr
org_id = orgId
};
insertHList.Add(prdMaterialReceiptH);
string feedCode = await _billRullService.GetBillNumber(CodeTemplateConst.FEEDING_CODE);
PrdFeedingH prdFeedingH = new PrdFeedingH()
{
code = feedCode,
station_id = moTask.workstation_id,
mo_task_id = moTask.id,
process_id = moTask.process_id,
// equip_id = input.equip_id,
workshop_id = workshop?.Id,
carry_id = carry.id,
workline_id = moTask.workline_id,
carry_code = carry.carry_code,
// remark = input.remark,
mbom_process_id = moTask.mbom_process_id,
create_id = userId,
create_time = DateTime.Now,
org_id = orgId
};
insertFHList.Add(prdFeedingH);
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(x => x.carry_id == carry.id).ToListAsync();
if (wmsCarryCodes != null && wmsCarryCodes.Count > 0)
@@ -2643,7 +2665,7 @@ namespace Tnb.WarehouseMgr
foreach (var item in wmsCarryCodes)
{
insertDList.Add(new PrdMaterialReceiptD
PrdMaterialReceiptD dItem = new PrdMaterialReceiptD
{
material_receipt_id = prdMaterialReceiptH.id,
material_id = item.material_id,
@@ -2659,6 +2681,20 @@ namespace Tnb.WarehouseMgr
supplier_id = item.supplier_id,
instock_time = item.instock_time,
// check_conclusion = item.check_conclusion,
};
insertDList.Add(dItem);
insertFDList.Add(new PrdFeedingD
{
feeding_id = prdFeedingH.id,
material_receipt_detail_id = dItem?.id,
material_id = item.material_id,
num = item.codeqty,
batch = item.code_batch,
unit_id = item.unit_id,
carry_id = carry.id,
status = "0",
use_num = 0,
});
}
}
@@ -2666,6 +2702,24 @@ namespace Tnb.WarehouseMgr
{
throw Oops.Bah("未找到物料明细");
}
if (carry.carrystd_id == WmsWareHouseConst.CARRY_ZYXCSTD_ID || carry.carrystd_id == WmsWareHouseConst.CARRY_ZYLJSTD_ID)
{
Tnb.WarehouseMgr.Entities.Dto.Outputs.Result result = await _wmsCarryUnbindService.CarryCodeUnbindWithoutTran(new CarryCodeUnbindInput()
{
carry_id = carry.id
},_db);
if (result.code != HttpStatusCode.OK)
{
throw Oops.Bah(result.msg);
}
//deleteCarryCodeIds.Add(carry.id);
// int row = await db.Deleteable<WmsCarryCode>().Where(r => r.carry_id == carry.id).ExecuteCommandAsync();
// Log.Information($"载具{carry.id}已解绑,解绑条数{row}");
}
}
@@ -2676,7 +2730,9 @@ namespace Tnb.WarehouseMgr
int row1 = await _db.Insertable(insertHList).ExecuteCommandAsync();
int row2 = await _db.Insertable(insertDList).ExecuteCommandAsync();
if (row1 <= 0 || row2 <= 0)
int row3 = await _db.Insertable(insertFHList).ExecuteCommandAsync();
int row4 = await _db.Insertable(insertFDList).ExecuteCommandAsync();
if (row1 <= 0 || row2 <= 0 || row3<=0 || row4<=0)
{
throw Oops.Bah(ErrorCode.COM1000);
}

View File

@@ -198,8 +198,9 @@ namespace Tnb.WarehouseMgr
}
await _db.Ado.BeginTranAsync();
//入库取终点 //出库起点
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 1 };
InStockStrategyQuery inStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_MJC_ID, Size = 9999 };
List<BasLocation> endLocations = await _wareHouseService.InStockStrategy(inStockStrategyInput);
endLocations = endLocations.Where(r => r.location_code.Contains("MJWC-C")).ToList();
if (endLocations.Count == 0)
{
throw new AppFriendlyException("没有可用的入库库位", 500);

View File

@@ -218,11 +218,14 @@ namespace Tnb.WarehouseMgr
}
IEnumerable<dynamic> result = null;
result = await _db.Queryable<WmsOutinStockDetail>()
.InnerJoin<WmsOutinStockCode>((a, b) => a.id == b.bill_d_id)
.InnerJoin<BasWarehouse>((a, b, c) => a.warehouse_id == c.id)
.Select((a,b,c) => new
.InnerJoin<BasMaterial>((a, b, c, d) => b.material_id == d.id)
.WhereIF(!string.IsNullOrEmpty(code_batch), (a, b, c, d) => b.code_batch.Contains(code_batch))
.WhereIF(!string.IsNullOrEmpty(material_specification), (a, b, c, d) => b.material_specification.Contains(material_specification))
.Select((a, b, c) => new
{
act_start_date = a.act_start_date,
act_end_date = a.act_end_date,