Conflicts:
This commit is contained in:
2024-09-16 17:22:56 +08:00
2 changed files with 29 additions and 21 deletions

View File

@@ -125,19 +125,19 @@ namespace Tnb.ProductionMgr
// Log.Information($"{device},{eqpDaq3.label_name}称重完成返回结果:{responseresult}");
// }
// }
string equipStatus = await _redisData.GetHash(device, "1 启动 2 停止 3手动 4 急停");
int equipStatus = await _redisData.TryGetValueByKeyField<int>(device, "1 启动 2 停止 3手动 4 急停");
Log.Information($"换箱机状态:{equipStatus}");
if (equipStatus != "1")
if (equipStatus.ToString() != "1")
{
if (equipStatus.Trim() == "2")
if (equipStatus.ToString().Trim() == "2")
{
throw Oops.Bah("换箱机状态为停止");
}
if (equipStatus.Trim() == "3")
if (equipStatus.ToString().Trim() == "3")
{
throw Oops.Bah("换箱机状态为手动");
}
if (equipStatus.Trim() == "4")
if (equipStatus.ToString().Trim() == "4")
{
throw Oops.Bah("换箱机状态为急停");
}

View File

@@ -334,8 +334,15 @@ namespace Tnb.WarehouseMgr
await _db.Ado.BeginTranAsync();
OutStockStrategyQuery outStockStrategyInput = new() { warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID, material_id = wmsMaterialTransferD.material_id,
code_batch = input.code_batch, Size = input.palletCount,Region_id = WmsWareHouseConst.REGION_Purchase_ID,PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK};
OutStockStrategyQuery outStockStrategyInput = new()
{
warehouse_id = WmsWareHouseConst.WAREHOUSE_YCL_ID,
material_id = wmsMaterialTransferD.material_id,
code_batch = input.code_batch,
Size = input.palletCount,
Region_id = WmsWareHouseConst.REGION_Purchase_ID,
PolicyCode = WmsWareHouseConst.POLICY_YCLOUTSTOCK
};
List<WmsCarryH> items = await _wareHouseService.OutStockStrategy(outStockStrategyInput);
if (items.Count == 0)
@@ -384,7 +391,7 @@ namespace Tnb.WarehouseMgr
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1GLSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
}
// 中储仓三工位
else if(wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID || wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZZXBK_ID || wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZCC_ID)
else if (wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZC_ID || wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZZXBK_ID || wmsMaterialTransfer.warehouse_instock == WmsWareHouseConst.WAREHOUSE_ZCC_ID)
{
// 根据三工位任务数平均分配任务 暂定
endLocation = await _db.Queryable<BasLocation>().Where(r => _wareHouseService.GetFloor1WXSGWOutstockLocation().Contains(r.id) && r.is_lock == 0 && r.is_use == "0").OrderBy("is_lock, task_nums, location_code").FirstAsync();
@@ -930,7 +937,7 @@ namespace Tnb.WarehouseMgr
WmsMaterialTransfer wmsMaterialTransfer = await _db.Queryable<WmsMaterialTransfer>().SingleAsync(x => x.id == wmsMaterialTransferd.bill_id);
Logger.LogInformation($"开始执行转库单业务 {input.carryIds[0]} 转库单 {wmsMaterialTransfer.bill_code}");
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(r => r.carry_id == input.carryIds[0]
&& r.material_id == wmsMaterialTransferd.material_id && r.code_batch == wmsMaterialTransferd.code_batch).ToListAsync();
bool isOk = false;
@@ -1032,10 +1039,11 @@ namespace Tnb.WarehouseMgr
if (wmsMaterialTransfer.warehouse_outstock != WmsWareHouseConst.WAREHOUSE_YCL_ID)
{
Logger.LogInformation("【WmsMaterialTransferService ModifyAsync】同步其它出库单到erp...");
List<WmsMaterialTransferD> dList = await _db.Queryable<WmsMaterialTransferD>().Where(x => x.bill_id == wmsMaterialTransferd.bill_id).OrderBy(x => x.id).ToListAsync();
DictionaryDataEntity unitData = await _db.Queryable<DictionaryTypeEntity>()
.LeftJoin<DictionaryDataEntity>((x, y) => x.Id == y.DictionaryTypeId)
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && y.EnCode == wmsMaterialTransferd.unit_id)
.Where((x, y) => x.EnCode == DictConst.MeasurementUnit && (y.EnCode == wmsMaterialTransferd.unit_id || y.Id == wmsMaterialTransferd.unit_id))
.Select((x, y) => y)
.FirstAsync();
string unitId = unitData?.Id ?? "";
@@ -1124,7 +1132,7 @@ namespace Tnb.WarehouseMgr
}
}
}
catch(Exception ex)
catch (Exception ex)
{
Logger.LogError("【WmsMaterialTransferService ModifyAsync】" + ex.Message);
Logger.LogError("【WmsMaterialTransferService ModifyAsync】" + ex.StackTrace);
@@ -1261,7 +1269,7 @@ namespace Tnb.WarehouseMgr
await _db.Ado.CommitTranAsync();
}
catch(Exception ex)
catch (Exception ex)
{
await _db.Ado.RollbackTranAsync();
Logger.LogError("【DistributeToZCC】" + ex.Message);
@@ -1330,7 +1338,7 @@ namespace Tnb.WarehouseMgr
code_batch = wmsMaterialTransferD.code_batch,
needOut = needOut,
material_code = wmsMaterialTransferD.material_code,
endlocations = new string[] {WmsWareHouseConst.ZZCSSX021007 }
endlocations = new string[] { WmsWareHouseConst.ZZCSSX021007 }
};
List<Tuple<WmsCarryH, decimal, BasLocation>>? carrys = await _wareHouseService.OutStockStrategyZCC2Floor2(OutStockStrategyInput);
@@ -1984,7 +1992,7 @@ namespace Tnb.WarehouseMgr
PrdMoTask moTask = await _db.Queryable<PrdMoTask>().SingleAsync(x => x.id == input.requireId);
if (moTask == null)
{
throw Oops.Bah($"未找到来源id为{input.requireId}的生产任务单");
throw Oops.Bah($"未找到来源id为{input.requireId}的生产任务单");
}
string code = await _billRullService.GetBillNumber(Tnb.BasicData.CodeTemplateConst.MATERIAL_RECEIPT_CODE);
OrganizeEntity workshop = await _organizeService.GetAnyParentByWorkstationId(moTask.workstation_id, DictConst.RegionCategoryWorkshopCode);
@@ -1997,11 +2005,11 @@ namespace Tnb.WarehouseMgr
{
userId = _userManager.UserId;
}
foreach(string carryId in input.carryIds)
foreach (string carryId in input.carryIds)
{
WmsCarryH carry = await _db.Queryable<WmsCarryH>().SingleAsync(x => x.id == carryId);
PrdMaterialReceiptH prdMaterialReceiptH = new PrdMaterialReceiptH()
{
code = code,
@@ -2020,13 +2028,13 @@ namespace Tnb.WarehouseMgr
};
insertHList.Add(prdMaterialReceiptH);
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(x=>x.carry_id==carry.id).ToListAsync();
List<WmsCarryCode> wmsCarryCodes = await _db.Queryable<WmsCarryCode>().Where(x => x.carry_id == carry.id).ToListAsync();
if (wmsCarryCodes != null && wmsCarryCodes.Count > 0)
{
JNPF.Logging.Log.Information($"签收载具信息{JsonConvert.SerializeObject(wmsCarryCodes)}");
foreach (var item in wmsCarryCodes)
{
insertDList.Add(new PrdMaterialReceiptD
{
material_receipt_id = prdMaterialReceiptH.id,
@@ -2050,14 +2058,14 @@ namespace Tnb.WarehouseMgr
{
throw Oops.Bah("未找到物料明细");
}
}
if (insertHList.Count <= 0 || insertDList.Count <= 0)
{
throw Oops.Bah(ErrorCode.COM1000);
}
int row1 = await _db.Insertable(insertHList).ExecuteCommandAsync();
int row2 = await _db.Insertable(insertDList).ExecuteCommandAsync();
if (row1 <= 0 || row2 <= 0)