|
|
|
@ -81,7 +81,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
string epc = "A123456";
|
|
|
|
|
_mesProductPlanService.GetStartedProdPlan(out MesProductPlanDto productPlanDto);
|
|
|
|
|
string bigCode = GenerateBigBarcode(productPlanDto, epc);
|
|
|
|
|
BindingBarCode(bigCode, epc);
|
|
|
|
|
// BindingBarCode(bigCode, epc);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -121,14 +121,18 @@ namespace SlnMesnac.Business
|
|
|
|
|
Thread.Sleep(3000);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// plc.writeStringByAddress(GetPlcAddressByConfigKey("2楼码垛出口RFID条码地址"), "JYHB01010125", 12);
|
|
|
|
|
|
|
|
|
|
if (plc.readByteByAddress(GetPlcAddressByConfigKey("2楼小包出口到位信号")) != 1)
|
|
|
|
|
|
|
|
|
|
if (!plc.readBoolByAddress(GetPlcAddressByConfigKey("2楼小包出口到位信号")))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("等待小包出口信号触发......");
|
|
|
|
|
Thread.Sleep(5000);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
string rfid = plc.readStringByAddress(GetPlcAddressByConfigKey("2楼码垛出口RFID条码地址"),12).Replace("\0","");
|
|
|
|
|
|
|
|
|
|
string rfid = plc.readStringByAddress(GetPlcAddressByConfigKey("2楼码垛出口RFID条码地址"),12).Replace("\0","");
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(rfid))
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation("小包出口已经有RFID了,无需再读");
|
|
|
|
@ -181,10 +185,11 @@ namespace SlnMesnac.Business
|
|
|
|
|
sqlSugarClient.AsTenant().BeginTran();
|
|
|
|
|
//1.生成大条码插入mes_barcode_info;
|
|
|
|
|
string bigCode = GenerateBigBarcode(productPlanDto, epcStr);
|
|
|
|
|
//2.40个小条码及大条码绑定托盘号,小条码绑定大条码
|
|
|
|
|
BindingBarCode(bigCode, epcStr);
|
|
|
|
|
//2.40个小条码及大条码绑定托盘号,小条码绑定大条码,,托盘绑定大条码
|
|
|
|
|
BindingBarCode(bigCode, epcStr, productPlanDto);
|
|
|
|
|
//3.更新mes_product_plan及mes_product_order表,更新已生产数量
|
|
|
|
|
UpdatePlanInfoAndOrder(productPlanDto);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 删除正在使用的数据库托盘号
|
|
|
|
|
RealPalletTask realPallet = _realPalletTaskService.Query(x => x.PalletCode == epcStr).FirstOrDefault();
|
|
|
|
@ -193,7 +198,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
sqlSugarClient.AsTenant().GetConnection("mes").Deleteable(realPallet).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
// 写入PLC RFID号供调度使用
|
|
|
|
|
plc.writeStringByAddress(GetPlcAddressByConfigKey("2楼码垛出口RFID条码地址"), epcStr);
|
|
|
|
|
plc.writeStringByAddress(GetPlcAddressByConfigKey("2楼码垛出口RFID条码地址"), epcStr,12);
|
|
|
|
|
// plc.writeByteByAddress(GetPlcAddressByConfigKey("2楼小包出口到位信号"), 2);
|
|
|
|
|
readRfidAmount = 0;
|
|
|
|
|
sqlSugarClient.AsTenant().CommitTran();
|
|
|
|
@ -334,7 +339,7 @@ namespace SlnMesnac.Business
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="bigBarcode"></param>
|
|
|
|
|
/// <param name="epcStr"></param>
|
|
|
|
|
private void BindingBarCode(string bigBarcode, string epcStr)
|
|
|
|
|
private void BindingBarCode(string bigBarcode, string epcStr, MesProductPlanDto productPlanDto)
|
|
|
|
|
{
|
|
|
|
|
List<MesPrdBarcodeInfo> list = _mesPrdBarCodeService.GetUseBarCodeList();
|
|
|
|
|
if (list == null || list.Count == 0)
|
|
|
|
@ -355,6 +360,16 @@ namespace SlnMesnac.Business
|
|
|
|
|
item.BindStatus = 1;
|
|
|
|
|
}
|
|
|
|
|
sqlSugarClient.AsTenant().GetConnection("mes").Updateable(list).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
//托盘绑定大条码信息
|
|
|
|
|
BasePalletInfo palletInfo = sqlSugarClient.AsTenant().GetConnection("mes").Queryable<BasePalletInfo>().Where(x => x.PalletInfoCode == epcStr).First();
|
|
|
|
|
if (palletInfo != null)
|
|
|
|
|
{
|
|
|
|
|
palletInfo.MaterialBarcode = bigBarcode;
|
|
|
|
|
palletInfo.MaterialId = productPlanDto.MaterialId;
|
|
|
|
|
}
|
|
|
|
|
sqlSugarClient.AsTenant().GetConnection("mes").Updateable(palletInfo).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void UpdatePlanInfoAndOrder(MesProductPlanDto productPlanDto)
|
|
|
|
|