/// <summary> /// 开始分拣产品 /// </summary> /// <param name="productCode"></param> private void SortProductBegin(string barCode) { //0.验证 if (SlaveInfoService.SlaveInfo.LatticeStatus == LatticeStatus.PutError) { if (SlaveInfoService.LatticeInfoList.Exists(o => o.Status == LatticeStatus.WaitPut && o.Product.Exists(p => p.BarCode == barCode))) { var latticePutError = SlaveInfoService.LatticeInfoList.Where(o => o.Status == LatticeStatus.PutError).ToList(); UpDownService.RemovePutError(new UpDownMessage() { LatticeByUpDown = latticePutError.Select(l => new LatticeByUpDown { LatticeNo = l.LatticeNo }).ToList() }); lblMsg.Text = string.Format(Resources.RemovePutError, barCode); } else { lblMsg.Text = string.Format(Resources.PleaseSolvePutError, barCode); SoundService.PlaySound(SoundType.PutError); } return; } if (SlaveInfoService.SlaveInfo.LatticeStatus == LatticeStatus.BlockError) { lblMsg.Text = string.Format(Resources.PleaseSolveBlockError, barCode); SoundService.PlaySound(SoundType.BlockError); return; } if (SlaveInfoService.SlaveInfo.LatticeStatus == LatticeStatus.WaitPut) { lblMsg.Text = string.Format(Resources.PleaseWait, barCode); UpDownService.SetText("存在待投递的产品!"); SoundService.PlaySoundAsny(SoundType.WaitPut); return; } //1.装载格口 var waveApiList = WaveApiService.GetOrderApiList(SlaveInfoService.SlaveInfo.WaveNo, barCode); if (waveApiList.Count == 0) { UpDownService.ProductNotFound(); lblMsg.Text = string.Format(Resources.ProductError, SlaveInfoService.SlaveInfo.WaveNo, barCode); return; } waveApiList.ForEach(o => { if (!SlaveInfoService.LatticeInfoList.Exists(s => s.OrderNo == o.OrderNo)) { SlaveInfoService.LoadLattice(o); } }); if (!SlaveInfoService.SlaveInfo.LatticeInfo.SelectMany(o => o.Product).Where(o => o.BarCode == barCode).Any(o => !o.IsComplete)) { lblMsg.Text = $"货物已配足:{barCode}"; UpDownService.SetText($"货物已配足:{barCode}"); SoundService.PlaySoundAsny(SoundType.ProductOver); return; } //2.更新格口为待投递 string orderNo = waveApiList.First().OrderNo; var waitPutLattice = SlaveInfoService.LatticeInfoList.Where(o => !o.IsComplete && waveApiList.Select(s => s.OrderNo).Contains(o.OrderNo)).ToList(); UpDownService.WaitPut(waitPutLattice, barCode); }