This commit is contained in:
2024-06-26 14:25:50 +08:00
2 changed files with 29 additions and 11 deletions

View File

@@ -1,5 +1,6 @@
using JNPF;
using JNPF.Common.Core.Manager;
using JNPF.Common.Enums;
using JNPF.DependencyInjection;
using JNPF.DynamicApiController;
using JNPF.Extras.CollectiveOAuth.Models;
@@ -20,6 +21,7 @@ using Tnb.ProductionMgr.Interfaces;
using Tnb.WarehouseMgr;
using Tnb.WarehouseMgr.Entities;
using Tnb.WarehouseMgr.Entities.Attributes;
using Tnb.WarehouseMgr.Entities.Consts;
using Tnb.WarehouseMgr.Entities.Dto;
using Tnb.WarehouseMgr.Entities.Dto.Inputs;
using Tnb.WarehouseMgr.Interfaces;
@@ -403,7 +405,13 @@ namespace Tnb.ProductionMgr
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(moTask.workstation_id, DictConst.RegionCategoryWorkshopCode);
List<PrdMaterialReceiptH> insertHList = new List<PrdMaterialReceiptH>();
List<PrdMaterialReceiptD> insertDList = new List<PrdMaterialReceiptD>();
string orgId = _userManager.GetUserInfo().Result.organizeId;
string orgId = WmsWareHouseConst.AdministratorOrgId;
string userId = WmsWareHouseConst.AdministratorUserId;
if (_userManager != null && _userManager.GetUserInfo() != null && _userManager.GetUserInfo().Result!=null)
{
orgId = _userManager.GetUserInfo().Result.organizeId;
userId = _userManager.UserId;
}
foreach(string carryId in input.carryIds)
{
WmsCarryH carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
@@ -420,7 +428,7 @@ namespace Tnb.ProductionMgr
workline_id = moTask.workline_id,
carry_code = carry.carry_code,
mbom_process_id = moTask.mbom_process_id,
create_id = _userManager.UserId,
create_id = userId,
create_time = DateTime.Now,
org_id = orgId
};
@@ -457,15 +465,17 @@ namespace Tnb.ProductionMgr
}
}
if (insertHList.Count <= 0 || insertDList.Count <= 0)
{
throw Oops.Bah(ErrorCode.COM1000);
}
DbResult<bool> result = await db.Ado.UseTranAsync(async () =>
int row1 = await db.Insertable(insertHList).ExecuteCommandAsync();
int row2 = await db.Insertable(insertDList).ExecuteCommandAsync();
if (row1 <= 0 || row2 <= 0)
{
await db.Insertable(insertHList).ExecuteCommandAsync();
await db.Insertable(insertDList).ExecuteCommandAsync();
});
if (!result.IsSuccess)
{
throw Oops.Bah(result.ErrorMessage);
throw Oops.Bah(ErrorCode.COM1000);
}
}
}

View File

@@ -237,7 +237,11 @@ namespace Tnb.ProductionMgr
public async Task<string> FixedPointDelivery()
{
string state = await _redisData.TryGetValueByKeyField<string>("YTCS", "State");
if ("OK" != state) return "YTCS没开机";
if ("OK" != state)
{
Log.Error($"TCS没开机");
return "YTCS没开机";
}
string stateHxja = await _redisData.TryGetValueByKeyField<string>("hxjA", "State");
string stateHxjc = await _redisData.TryGetValueByKeyField<string>("hxjC", "State");
List<String> hxjList = new List<string>();
@@ -250,7 +254,11 @@ namespace Tnb.ProductionMgr
hxjList.Add("hxjC");
}
if (hxjList.IsEmpty()) return "hxjA,hxjC不正常";
if (hxjList.IsEmpty())
{
Log.Error($"hxjA,hxjC不正常");
return "hxjA,hxjC不正常";
}
string msg = "";
List<EqpEquipment> equipments = await _db.Queryable<EqpEquipType>()
.InnerJoin<EqpEquipment>((x, y) => x.id == y.equip_type_id)