| | |
| | | using System.Threading.Tasks; |
| | | using AutoMapper; |
| | | using AutoMapper.Configuration.Conventions; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using SqlSugar; |
| | | using WIDESEA_ISerialPortRepository; |
| | | using WIDESEA_SerialPortRepository; |
| | |
| | | { |
| | | try |
| | | { |
| | | //æ ¹æ®ç»åä»»å¡å·è·å¾top表å
¨é¨æ°æ® |
| | | Dt_Process proNow = new Dt_Process(); |
| | | //æ ¹æ®ç»åä»»å¡å·è·å¾torqueOp表å
¨é¨æ°æ® |
| | | var torp = _torqueOpRepository.QueryData(x => x.GroupOp == group && x.TakeId == takeid); |
| | | |
| | | |
| | | //è·åModifier ="true" 表示æ¯å¼ºå¶æ§è¡ |
| | | var Mod = torp.Select(x => x.Modifier).FirstOrDefault(); |
| | | //var Mod = torp.Select(x => x.Modifier).FirstOrDefault(); |
| | | |
| | | //æ¥åºå·¥èºè¡¨ |
| | | var process = BaseDal.QueryData(x => x.CraftType == group); |
| | |
| | | |
| | | |
| | | //æ¿å°å·¥èºè¡¨ä¸æ¥éª¤ä¸º1ç |
| | | var proNoe = process.Where(x => x.SetpNum == 1);//è·å¾å·¥èºè¡¨ä¸çç¬¬ä¸æ¥ |
| | | //var proNoe = process.Where(x => x.SetpNum == 1);//è·å¾å·¥èºè¡¨ä¸çç¬¬ä¸æ¥ |
| | | if (torp.Count == 0) |
| | | { |
| | | return new WebResponseContent { Status = true, Message = "è¿åå·¥èºè¡¨ä¸çç¬¬ä¸æ¡", Data = new { proNoe, maxproce } }; |
| | | proNow = process.Where(x => x.SetpNum == 1).First(); |
| | | return new WebResponseContent { Status = true, Message = "è¿åå·¥èºè¡¨ä¸çç¬¬ä¸æ¡", Data = new { proNow, maxproce } }; |
| | | } |
| | | |
| | | var nowNum = torp.Max(x => x.ProcessSte);//è·å¾å½åæå¤§æ¥éª¤ |
| | | |
| | | var flag = torp.Where(a => a.ProcessSte == nowNum && a.Modifier == "true").FirstOrDefault(); |
| | | //op.Modifier="true" 表示æ¯å¼ºå¶æ§è¡ï¼å°±ä¸éè¦å¤æåºæç次æ°ï¼ç´æ¥è¿å op.ProcessSte+1 |
| | | if (Mod == "true") |
| | | //if (Mod == "true") |
| | | //{ |
| | | // var now = maxproce + 1; |
| | | // return new WebResponseContent { Status = true, Data = new { proNoe, maxproce, now } }; |
| | | //} |
| | | if (flag != null) |
| | | { |
| | | var now = maxproce + 1; |
| | | return new WebResponseContent { Status = true, Data = new { proNoe, maxproce, now } }; |
| | | proNow = process.Where(x => x.SetpNum == now).First(); |
| | | var finish= process.Where(x => x.SetpNum > now); |
| | | return new WebResponseContent { Status = true, Data = new { proNow, maxproce, now, finish } }; |
| | | } |
| | | |
| | | //妿åå¼è¡¨ä¸ææ°æ®å°±è¿åç»ä»å½åå·¥èºæ¥éª¤ |
| | | var maxpro = process.Where(x => x.SetpNum == nowNum); |
| | | |
| | | var maxpro = process.Where(x => x.SetpNum == nowNum).FirstOrDefault(); |
| | | if (maxpro != null) |
| | | { |
| | | if (maxpro.TorqueOneQuantity + maxpro.TorqueTwoQuantity > torp.Where(a => a.ProcessSte == nowNum).Count()) |
| | | { |
| | | proNow = maxpro; |
| | | var finish = process.Where(x => x.SetpNum < nowNum); |
| | | return new WebResponseContent { Status = true, Message = "è¿åå½åä»»å¡åå°ç大æ¥éª¤", Data = new { proNow, maxproce, finish } }; |
| | | } |
| | | else |
| | | { |
| | | var now = nowNum + 1; |
| | | proNow = process.Where(x => x.SetpNum == now).First(); |
| | | var finish = process.Where(x => x.SetpNum < now); |
| | | return new WebResponseContent { Status = true, Message = "è¿åå½åä»»å¡åå°ç大æ¥éª¤", Data = new { proNow, maxproce, finish } }; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | return new WebResponseContent { Status = false, Message = "å·¥èºæ°æ®æè¯¯"}; |
| | | } |
| | | |
| | | //夿å½åæ¥éª¤çæåæ¬¡æ°æ¯å¦å®æï¼æ²¡å®æè¿åå½åæ¥éª¤ï¼å®æè¿åop.ProcessSte+1ï¼ç¶æå¼ç»false |
| | | |
| | | return new WebResponseContent { Status = true, Message = "è¿åå½åä»»å¡åå°ç大æ¥éª¤", Data = new { maxpro, maxproce } }; |
| | | //return new WebResponseContent { Status = true, Message = "è¿åå½åä»»å¡åå°ç大æ¥éª¤", Data = new { maxpro, maxproce } }; |
| | | |
| | | } |
| | | catch (Exception ex) |
| | |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// å·¥èºä¸ä¸æ¥è·³è½¬ |
| | | /// </summary> |
| | | /// <param name="setpDTO">å½åçç»çä»»å¡å½åæ¥éª¤</param> |
| | | /// <param name="flag">æ¯å¦å¼ºå¶æ§è¡ï¼æ¯trueï¼å¦false</param> |
| | | /// <returns>è¿å1ãå½åæ¥éª¤ï¼2ãæå¤§æ¥éª¤ï¼3ã已宿çå·¥èº</returns> |
| | | public WebResponseContent Nextprocess(SetpDTO setpDTO, bool flag)//å¼ºå¶æ§è¡ç»ætrue |
| | | { |
| | | try |
| | |
| | | { |
| | | return new WebResponseContent { Status = true, Message = "没æå®æå½åæ¥éª¤", Data = new { nowdate, maxproce } }; |
| | | } |
| | | else if (practiceCount == TargetCount || (practiceCount != TargetCount && flag))//å¼ºå¶æ§è¡ åç«¯ç»æä¸ä¸ªflag=tureæ¶ |
| | | else if ((practiceCount == TargetCount && TargetCount == 0) || (practiceCount != TargetCount && flag))//å¼ºå¶æ§è¡ åç«¯ç»æä¸ä¸ªflag=tureæ¶ |
| | | { |
| | | //强å¶è·³è½¬ä¸ä¸æ¥ï¼æå
¥op表å½åæ¥éª¤ |
| | | op.TakeId = setpDTO.takeid; |
| | |
| | | int num = setpDTO.setnum + 1; |
| | | |
| | | //è¿åä¸ä¸æ¥æ¥éª¤ |
| | | var nex = process.Where(x => x.CraftType == setpDTO.group && x.SetpNum == num).FirstOrDefault(); |
| | | |
| | | var nex = process.Where(x => x.SetpNum == num).FirstOrDefault(); |
| | | var finish = process.Where(x => x.SetpNum < num).ToList(); |
| | | |
| | | _torqueOpRepository.AddData(op); |
| | | return new WebResponseContent { Status = true, Message = $"ä½ å·²å®æå½å第{setpDTO.setnum}ï¼åå¤ç¬¬{num}æ¥ä»»å¡", Data = new { nex, maxproce } }; |
| | | return new WebResponseContent { Status = true, Message = $"ä½ å·²å®æå½å第{setpDTO.setnum}ï¼åå¤ç¬¬{num}æ¥ä»»å¡", Data = new { nex, maxproce, finish } }; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | public WebResponseContent PreviousProcess(SetpDTO setpDTO) |
| | | { |
| | | try |