示例#1
0
 /// <summary>
 /// 检查分拣架后的按钮是否有按压动作
 /// </summary>
 /// <returns></returns>
 private Task CheckButtonAsync()
 {
     return(Task.Run(() =>
     {
         try
         {
             if (IsCheckButtonSuspending)
             {
                 return;
             }
             _IsCheckButtonRunning = true;
             foreach (var slave in _SlaveConfig)
             {
                 var registersButton = OrderSortService.ReadButtonRegisters(slave.SlaveAddress);
                 for (int i = 0; i < registersButton.Length; i++)
                 {
                     //是否有点击按钮
                     if (registersButton[i] < 15)
                     {
                         continue;
                     }
                     _ButtonLattice = _LatticesettingList.Find(lsc => lsc.CabinetId == slave.CabinetId && lsc.ButtonIndex == i);
                     //创建打包记录
                     var packingLog = OrderSortService.CreatePackingLog(_ButtonLattice, _UserInfo, 3);
                     if (packingLog != null)
                     {
                         //打印包牌
                         new PackingLabelPrintDocument().PrintSetup(packingLog);
                         //按钮颜色恢复
                         //_ButtonList.ForEach(b => b.BackColor = GetColor(3));
                         Invoke((MethodInvoker) delegate()
                         {
                             //更新格口统计信息
                             _ButtonList.FirstOrDefault(b => b.TabIndex == _ButtonLattice.ID).Text = OrderSortService.GetLatticeNewText(_ButtonLattice);
                         });
                         //_TargetLattice = null;
                         _ResultLattice = null;
                         _BlockLattice = null;
                         _ButtonLattice = null;
                         _CheckBlockNumber = 0;
                     }
                     //重置按钮计数器
                     OrderSortService.ReSetGratingOrButton(2);
                     return;
                 }
             }
         }
         catch (Exception ex)
         {
             SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString());
             MessageBox.Show(ex.Message);
         }
         finally
         {
             _IsCheckButtonRunning = false;
         }
     }));
 }
示例#2
0
 private void btnReprintByLatticeId_Click(object sender, EventArgs e)
 {
     try
     {
         if (string.IsNullOrWhiteSpace(txtLatticeId.Text))
         {
             return;
         }
         var printNum       = int.Parse(txtNum.Text.Trim());
         var latticeIdArray = txtLatticeId.Text.Split(Environment.NewLine.ToArray());
         List <LatticeOrdersCache> latticeInfo;
         var pkg = OrderSortService.CreatePackingLog(latticeIdArray, _UserInfo, out latticeInfo);
         if (pkg != null)
         {
             for (int i = 0; i < printNum; i++)
             {
                 //打印包牌
                 if (OrderSortService.GetSystemSettingCache().PrintFormat == 0)
                 {
                     new PackingLabelPrintDocument().PrintSetup(pkg);
                 }//打印二维码
                 else if (OrderSortService.GetSystemSettingCache().PrintFormat == 1)
                 {
                     new PackingLabelPrintDocument2().PrintSetup(pkg);
                 }
                 else if (OrderSortService.GetSystemSettingCache().PrintFormat == 2)
                 {
                     new PackingLabelPrintDocument().PrintSetup(pkg);
                 }
                 else if (OrderSortService.GetSystemSettingCache().PrintFormat == 3)
                 {
                     new PackingLabelPrintDocument2().PrintSetup(pkg);
                 }
             }
             if (OrderSortService.GetSystemSettingCache().PrintFormat == 2 || OrderSortService.GetSystemSettingCache().PrintFormat == 3)
             {
                 if (latticeInfo.Count > 1)
                 {
                     latticeInfo.Add(new LatticeOrdersCache
                     {
                         CountryName = "袋子(箱子)",
                         Weight      = OrderSortService.GetSystemSettingCache().BoxWeight
                     });
                     new PackingCountryItemsPrintDocument().PrintSetup(pkg, latticeInfo);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString());
         MessageBox.Show(ex.Message);
     }
 }