bug
This commit is contained in:
@@ -406,12 +406,7 @@ namespace Tnb.ProductionMgr
|
||||
List<PrdMaterialReceiptH> insertHList = new List<PrdMaterialReceiptH>();
|
||||
List<PrdMaterialReceiptD> insertDList = new List<PrdMaterialReceiptD>();
|
||||
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;
|
||||
}
|
||||
string userId = moTask.worker_id;
|
||||
foreach(string carryId in input.carryIds)
|
||||
{
|
||||
WmsCarryH carry = await db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
|
||||
|
||||
@@ -74,55 +74,47 @@ namespace Tnb.WarehouseMgr
|
||||
}
|
||||
|
||||
CarryQueryOutput data = new();
|
||||
try
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().FirstAsync(a => a.carry_code == input.carry_code && a.status == 1);
|
||||
if (carry.IsNull())
|
||||
{
|
||||
WmsCarryH carry = await _db.Queryable<WmsCarryH>().FirstAsync(a => a.carry_code == input.carry_code && a.status == 1);
|
||||
if (carry.IsNull())
|
||||
throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在或被禁用", 500);
|
||||
}
|
||||
|
||||
Dictionary<string, object> mCarryIdDic = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToDictionaryAsync(x => x.membercarry_id, x => x.membercarry_code);
|
||||
Expression<Func<WmsCarryCode, bool>> whereExp = carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic.Keys?.Count > 0
|
||||
? a => mCarryIdDic.Keys.Contains(a.carry_id)
|
||||
: a => a.carry_id == carry.id;
|
||||
|
||||
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).LeftJoin<WmsInstockH>((a, b, c) => a.carry_id == c.carry_id)
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsCarryCode
|
||||
{
|
||||
check_conclusion = SqlFunc.IsNull(b.check_conclusion, 1),
|
||||
instock_time = b.create_time,
|
||||
}, true)
|
||||
.ToListAsync();
|
||||
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic?.Count > 0)
|
||||
{
|
||||
if (carryCodes.Count < mCarryIdDic.Keys?.Count)
|
||||
{
|
||||
throw new AppFriendlyException($"编号{input.carry_code},对应载具不存在或被禁用", 500);
|
||||
throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500);
|
||||
}
|
||||
|
||||
Dictionary<string, object> mCarryIdDic = await _db.Queryable<WmsCarryD>().Where(it => it.carry_id == carry.id).ToDictionaryAsync(x => x.membercarry_id, x => x.membercarry_code);
|
||||
Expression<Func<WmsCarryCode, bool>> whereExp = carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic.Keys?.Count > 0
|
||||
? a => mCarryIdDic.Keys.Contains(a.carry_id)
|
||||
: a => a.carry_id == carry.id;
|
||||
|
||||
List<WmsCarryCode> carryCodes = await _db.Queryable<WmsCarryCode>().InnerJoin<WmsCarryH>((a, b) => a.carry_id == b.id).LeftJoin<WmsInstockH>((a, b, c) => a.carry_id == c.carry_id)
|
||||
.Where(whereExp)
|
||||
.Select((a, b, c) => new WmsCarryCode
|
||||
{
|
||||
check_conclusion = SqlFunc.IsNull(b.check_conclusion, 1),
|
||||
instock_time = b.create_time,
|
||||
}, true)
|
||||
.ToListAsync();
|
||||
|
||||
if (carry.carrystd_id == WmsWareHouseConst.CARRY_LJSTD_ID && mCarryIdDic?.Count > 0)
|
||||
int i = 0;
|
||||
foreach ((string mCarryId, object v) in mCarryIdDic)
|
||||
{
|
||||
if (carryCodes.Count < mCarryIdDic.Keys?.Count)
|
||||
carryCodes[i].member_carrycode = v?.ToString() ?? string.Empty;
|
||||
var carryCode = carryCodes.Find(x => x.carry_id == mCarryId);
|
||||
if (carryCode != null)
|
||||
{
|
||||
throw new AppFriendlyException("载具条码数据异常,有料箱为空", 500);
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
foreach ((string mCarryId, object v) in mCarryIdDic)
|
||||
{
|
||||
carryCodes[i].member_carrycode = v?.ToString() ?? string.Empty;
|
||||
var carryCode = carryCodes.Find(x => x.carry_id == mCarryId);
|
||||
if (carryCode != null)
|
||||
{
|
||||
carryCodes[i].material_name = s_materialMap.ContainsKey(carryCode.material_id) ? s_materialMap[carryCode.material_id]?.ToString() ?? "" : "";
|
||||
}
|
||||
i++;
|
||||
carryCodes[i].material_name = s_materialMap.ContainsKey(carryCode.material_id) ? s_materialMap[carryCode.material_id]?.ToString() ?? "" : "";
|
||||
}
|
||||
i++;
|
||||
}
|
||||
data = carry.Adapt<CarryQueryOutput>();
|
||||
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
await _db.Ado.RollbackTranAsync();
|
||||
throw;
|
||||
}
|
||||
data = carry.Adapt<CarryQueryOutput>();
|
||||
data.wmsCarryCodes = carryCodes.Adapt<List<CarryCodeQueryOutput>>();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user