| | |
| | | private readonly IProcessInfoDetailService _processDetailInfoService;
|
| | | private readonly IUnitOfWorkManage _unitOfWorkManage;
|
| | | private readonly IScanStationService _scanStationService;
|
| | | //private readonly string PalletCode = "PL107";
|
| | |
|
| | | public PLCJob(IBoxingService boxingService,
|
| | | IBoxingDetailService boxingDetailService,
|
| | |
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation8ScanDone,true);
|
| | | }
|
| | | else
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation8ScanDone, false);
|
| | | }
|
| | |
|
| | | device.SetValue(W_PLCDBName.wrealProductLength, dt_Formula.ProductLength);
|
| | | device.SetValue(W_PLCDBName.wrealProductWidth, dt_Formula.ProductWidth);
|
| | | device.SetValue(W_PLCDBName.wrealProductHeight, dt_Formula.ProductHeight);
|
| | | device.SetValue(W_PLCDBName.wrealProductHeight, dt_Formula.ProductHeight + dt_Formula.GasketHeight);
|
| | | device.SetValue(W_PLCDBName.wrealScrewDownsetDistance, dt_Formula.ScrewDownsetDistance);
|
| | | //ä¸å¿é«åº¦
|
| | | device.SetValue(W_PLCDBName.wrealScrewTorque, dt_Formula.ScrewTorqueOutput);
|
| | | device.SetValue(W_PLCDBName.wrealScrewTorque, dt_Formula.ScrewTorqueOutput + dt_Formula.GasketHeight);
|
| | | device.SetValue(W_PLCDBName.wrealAutoScrewProgramNo, dt_Formula.DintAutoScrewOn);
|
| | | device.SetValue(W_PLCDBName.wrealPressPressure, dt_Formula.PressPressureDiff);
|
| | | device.SetValue(W_PLCDBName.wrealTighteningTorque, dt_Formula.PressTorqueDiff);
|
| | | device.SetValue(W_PLCDBName.wrealFastenTorque, dt_Formula.PressFastenTorque);
|
| | |
|
| | |
|
| | | //åè£
æ«ç 宿
|
| | | device.SetValue(W_PLCDBName.wboolLocation2ScanDone, true);
|
| | |
|
| | |
| | |
|
| | |
|
| | | //æ¥æ¶æ°æ®
|
| | | decimal PressHeight = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectPressHeight);
|
| | | decimal ScrewTorque = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectScrewTorque);
|
| | | decimal ScrewAngle = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectScrewAngle);
|
| | | decimal PressPressure = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectPressForce);
|
| | | bool PressTightenNg = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rrealPressScrewByScrewNG);
|
| | | bool PressTightenOk = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rrealPressScrewByScrewOK);
|
| | | bool PressTightenUnfinished = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rrealPressScrewByProcessUnfinished);
|
| | |
|
| | | |
| | |
|
| | |
|
| | | //æ·»å å°æ°æ®åº
|
| | | Dt_ProcessInfo dt_ProcessInfo = new Dt_ProcessInfo()
|
| | |
| | | ProductCode = dt_Formula.ProductCode,
|
| | | ProductName = dt_Formula.ProductName,
|
| | | ProductSn = dt_Boxing.BoxingNo,
|
| | | PressTightenNg = PressTightenNg?1:0,
|
| | | PressTightenOk = PressTightenOk?1:0,
|
| | | PressTightenUnfinished = PressTightenUnfinished?1:0,
|
| | | PressHeight = PressHeight,
|
| | | ProductStatus = 1,
|
| | | PressTightenOk = PressTightenOk ? 1 : 0,
|
| | | PressTightenUnfinished = PressTightenUnfinished ? 1 : 0,
|
| | | ScrewTorque = ScrewTorque,
|
| | | ScrewAngle = ScrewAngle,
|
| | | PressPressure = PressPressure,
|
| | | };
|
| | |
|
| | | if (
|
| | | PressPressure > dt_Formula.ScrewDownsetDistance + dt_Formula.PressPressureDiff || PressPressure < dt_Formula.ScrewDownsetDistance - dt_Formula.PressPressureDiff ||
|
| | | ScrewTorque > dt_Formula.PressFastenTorque + dt_Formula.PressTorqueDiff || ScrewTorque < dt_Formula.PressFastenTorque - dt_Formula.PressTorqueDiff
|
| | | )
|
| | | {
|
| | | dt_ProcessInfo.ProductStatus = 0;
|
| | | }
|
| | |
|
| | | _processInfoService.Repository.AddData(dt_ProcessInfo);
|
| | |
|
| | | // åè£
ä¿¡æ¯ä¸ä¼ 宿
|
| | |
| | | return;
|
| | | }
|
| | | Dt_Formula dt_Formula = _formulaService.Repository.QueryFirst(x => x.ProductCode == dt_Boxing.ProductCode);
|
| | | if(dt_Formula.PressNoCheckBottomPlate == 1)
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation9ScanDone, true);
|
| | | }
|
| | | else
|
| | | {
|
| | | device.SetValue(W_PLCDBName.wboolLocation9ScanDone, false);
|
| | | }
|
| | |
|
| | | //åå
¥PLC
|
| | | device.SetValue(W_PLCDBName.wrealCheckPalletCode, dt_Boxing.Id % 100);
|
| | | device.SetValue(W_PLCDBName.wrealP0P1Width, dt_Formula.P0P1Width);
|
| | | device.SetValue(W_PLCDBName.wrealP0P2Width, dt_Formula.P0P2Width);
|
| | | device.SetValue(W_PLCDBName.wrealP0P3Width, dt_Formula.P0P3Width);
|
| | | device.SetValue(W_PLCDBName.wrealP0P3Width, dt_Formula.P0P3Width);
|
| | | device.SetValue(W_PLCDBName.wrealP1P3Height, dt_Formula.P1P3Height);
|
| | | device.SetValue(W_PLCDBName.wrealP2P3Height, dt_Formula.P2P3Height);
|
| | | device.SetValue(W_PLCDBName.wrealP1P3Height, dt_Formula.ScrewTorqueOutput + dt_Formula.GasketHeight);
|
| | | device.SetValue(W_PLCDBName.wrealP2P3Height, dt_Formula.ProductHeight + dt_Formula.GasketHeight);
|
| | | device.SetValue(W_PLCDBName.wrealProdHeightDiff, dt_Formula.DetectHeightDiff);
|
| | | device.SetValue(W_PLCDBName.wrealScrewHeight, dt_Formula.ScrewPositionDiff);
|
| | | |
| | |
|
| | |
|
| | |
|
| | | //æ£æµæ«ç 宿
|
| | | device.SetValue(W_PLCDBName.wboolLocation3ScanDone, true);
|
| | |
| | | decimal Height1 = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectHeight1);//113
|
| | | decimal Height2 = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectHeight2);//92
|
| | | decimal Height3 = (decimal)device.GetValue<R_PLCDBName, float>(R_PLCDBName.rrealDetectHeight3);//11
|
| | | bool CheckUnfinished = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rrealDetectByInspectUnfinished);
|
| | | if(dt_Formula.PressNoCheckBottomPlate == 1)
|
| | | {
|
| | | Height3 = 0;
|
| | | }
|
| | |
|
| | | //bool CheckUnfinished = device.GetValue<R_PLCDBName, bool>(R_PLCDBName.rrealDetectByInspectUnfinished);
|
| | |
|
| | | |
| | |
|
| | | Dt_ProcessInfo dt_ProcessInfo = _processInfoService.Repository.QueryFirst(x => x.PalletCode == dt_Boxing.PalletCode);
|
| | | int id = 0;
|
| | |
| | | ProductCode = dt_Formula.ProductCode,
|
| | | ProductName = dt_Formula.ProductName,
|
| | | ProductSn = dt_Boxing.BoxingNo,
|
| | | CheckUnfinished = CheckUnfinished?1:0,
|
| | | };
|
| | | id = _processInfoService.Repository.AddData(dt_ProcessInfo);
|
| | | }
|
| | |
| | | {
|
| | | id = dt_ProcessInfo.Id;
|
| | | }
|
| | | decimal? ThreadPositionHeight = Height1 - Height3 - dt_Formula.GasketHeight;
|
| | | decimal? ProductCheckHeight = Height2 - Height3 - dt_Formula.GasketHeight;
|
| | |
|
| | | dt_ProcessInfo.Id = id;
|
| | | dt_ProcessInfo.Height1 = Height1 = Height1 - Height3;
|
| | | dt_ProcessInfo.Height2 = Height2 = Height2 - Height3;
|
| | | dt_ProcessInfo.ThreadPositionHeight = ThreadPositionHeight;
|
| | | dt_ProcessInfo.ProductCheckHeight = ProductCheckHeight;
|
| | | dt_ProcessInfo.Height1 = Height1;
|
| | | dt_ProcessInfo.Height2 = Height2;
|
| | | dt_ProcessInfo.Height3 = Height3;
|
| | |
|
| | | if(
|
| | | ProductCheckHeight > dt_Formula.ProductHeight + dt_Formula.DetectHeightDiff || ProductCheckHeight < dt_Formula.ProductHeight - dt_Formula.DetectHeightDiff ||
|
| | | ThreadPositionHeight > dt_Formula.ScrewTorqueOutput + dt_Formula.ScrewPositionDiff || ThreadPositionHeight < dt_Formula.ScrewTorqueOutput - dt_Formula.ScrewPositionDiff
|
| | | )
|
| | | {
|
| | | dt_ProcessInfo.ProductStatus = 0;
|
| | | }
|
| | |
|
| | | _processInfoService.Repository.UpdateData(dt_ProcessInfo);
|
| | | //æ£æµä¿¡æ¯ä¸ä¼ 宿
|
| | |
| | | throw new InvalidOperationException("æç为空");
|
| | | }
|
| | | Dt_Boxing dt_Boxing = _boxingService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | WriteInfo("ä¸çº¿æ«ç ç»çæ°æ®",$"{PalletCode}_boxingServiceæ¥è¯¢{dt_Boxing}");
|
| | |
|
| | | if (dt_Boxing != null)
|
| | | {
|
| | | WriteInfo("ä¸çº¿æ«ç ç»çæ°æ®", $"{PalletCode}_boxingServiceå é¤{dt_Boxing}");
|
| | | _boxingService.Repository.DeleteData(dt_Boxing);
|
| | | |
| | | List<Dt_BoxingDetail> dt_BoxingDetails = _boxingDetailService.Repository.QueryData(x => x.BoxingId == dt_Boxing.Id);
|
| | | if (dt_BoxingDetails != null)
|
| | | {
|
| | | WriteInfo("ä¸çº¿æ«ç ç»çæ°æ®", $"{PalletCode}_boxingServiceå é¤{dt_BoxingDetails}");
|
| | | _boxingDetailService.Repository.DeleteData(dt_BoxingDetails);
|
| | | }
|
| | | }
|
| | | Dt_ProcessInfo dt_ProcessInfo = _processInfoService.Repository.QueryFirst(x => x.PalletCode == PalletCode);
|
| | | WriteInfo("ä¸çº¿æ«ç ç»çæ°æ®", $"{PalletCode}_processInfoServiceæ¥è¯¢{dt_ProcessInfo}");
|
| | | if (dt_ProcessInfo != null)
|
| | | {
|
| | | Dt_ProcessInfoDetail dt_ProcessInfoDetail = new Dt_ProcessInfoDetail()
|
| | |
| | | ProductCode = dt_ProcessInfo.ProductCode?.ToString() ?? "",
|
| | | ProductName = dt_ProcessInfo.ProductName?.ToString() ?? "",
|
| | | ProductSn = dt_ProcessInfo.ProductSn,
|
| | | PressTightenNg = dt_ProcessInfo.PressTightenNg,
|
| | | PressTightenOk = dt_ProcessInfo.PressTightenOk,
|
| | | PressTightenUnfinished = dt_ProcessInfo.PressTightenUnfinished,
|
| | | CheckUnfinished = dt_ProcessInfo.CheckUnfinished,
|
| | | PressHeight = dt_ProcessInfo.PressHeight,
|
| | | ProductStatus = dt_ProcessInfo.ProductStatus,
|
| | | ScrewTorque = dt_ProcessInfo.ScrewTorque,
|
| | | ScrewAngle = dt_ProcessInfo.ScrewAngle,
|
| | | PressPressure = dt_ProcessInfo.PressPressure,
|
| | | ThreadPositionHeight = dt_ProcessInfo.ThreadPositionHeight,
|
| | | ProductCheckHeight = dt_ProcessInfo.ProductCheckHeight,
|
| | | Height1 = dt_ProcessInfo.Height1,
|
| | | Height2 = dt_ProcessInfo.Height2,
|
| | | Height3 = dt_ProcessInfo.Height3,
|
| | |
| | | CreateDate = DateTime.Now
|
| | | };
|
| | | _processDetailInfoService.Repository.AddData(dt_ProcessInfoDetail);
|
| | | WriteInfo("ä¸çº¿æ«ç ç»çæ°æ®", $"{PalletCode}_processInfoServiceå é¤{dt_ProcessInfo}");
|
| | | _processInfoService.DeleteData(dt_ProcessInfo);
|
| | | |
| | | }
|
| | | uow.Commit();
|
| | | //ä¸çº¿æ«ç 宿
|