private void btnSave_Click(object sender, EventArgs e) { try { int printNum = int.Parse(txt_PrintNum.Text); if (string.IsNullOrWhiteSpace(txtLatticeId.Text)) { throw new Exception("格号禁止为空!"); } if (txtLatticeId.Text != _latticesetting.LatticeId && OrderSortService.IsLatticeIdExists(txtLatticeId.Text)) { throw new Exception("存在重复格号" + txtLatticeId.Text); } if (printNum <= 0) { throw new Exception("打印数量必须大于0!"); } _latticesetting.PrintNum = printNum; _latticesetting.LatticeId = txtLatticeId.Text; _latticesetting.LEDIndex = Convert.ToInt32(txtLEDIndex.Text); _latticesetting.GratingIndex = Convert.ToInt32(txtGratingIndex.Text); _latticesetting.ButtonIndex = Convert.ToInt32(txtButtonIndex.Text); _latticesetting.IsEnable = cbIsEnable.Checked.ToString(); OrderSortService.SaveLatticeSetting(_latticesetting); DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); Invoke((MethodInvoker) delegate() { MessageBox.Show(ex.Message); }); } }
private void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtOrderId.Text)) { return; } string [] orderIdArray = txtOrderId.Text.Split(Environment.NewLine.ToArray()); string[] scan = OrderSortService.GetSystemSettingCache().Scanner?.Split(','); if (scan.Length > 1) { orderIdArray = orderIdArray.Where(o => o != "").Select(o => o.Substring(1)).ToArray(); } string result = OrderSortService.DeleteOrderCacheByOrderId(orderIdArray); MessageBox.Show(result); if (result.IndexOf("失败") < 0) { txtOrderId.Text = string.Empty; } txtOrderId.Focus(); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void LoadModbusSetting() { _systemSetting = OrderSortService.GetSystemSettingCache(); txtPortName.Text = _systemSetting.ModbusSetting.PortName; txtBaudRate.Text = _systemSetting.ModbusSetting.BaudRate.ToString(); cbParity.SelectedValue = _systemSetting.ModbusSetting.Parity; txtDataBits.Text = _systemSetting.ModbusSetting.DataBits.ToString(); cbStopBits.SelectedValue = _systemSetting.ModbusSetting.StopBits; txtLEDStartAddress.Text = _systemSetting.ModbusSetting.LEDStartAddress.ToString(); txtGratingStartAddress.Text = _systemSetting.ModbusSetting.GratingStartAddress.ToString(); txtButtonStartAddress.Text = _systemSetting.ModbusSetting.ButtonStartAddress.ToString(); txtResetGratingStartAddress.Text = _systemSetting.ModbusSetting.ResetGratingStartAddress.ToString(); txtWarningRedLightStartAddress.Text = _systemSetting.ModbusSetting.WarningRedLightStartAddress.ToString(); txtWarningGreenLightStartAddress.Text = _systemSetting.ModbusSetting.WarningGreenLightStartAddress.ToString(); txtWarningYellowLightStartAddress.Text = _systemSetting.ModbusSetting.WarningYellowLightStartAddress.ToString(); txtWarningBuzzerStartAddress.Text = _systemSetting.ModbusSetting.WarningBuzzerStartAddress.ToString(); txtNumberOfPoints.Text = _systemSetting.ModbusSetting.NumberOfPoints.ToString(); cbSortingPatten.SelectedValue = _systemSetting.SortingPatten; cbSortingSolution.SelectedValue = _systemSetting.SortingSolution; cbCabinetNumber.Text = _systemSetting.CabinetNumber.ToString(); cbWarningCabinetId.Text = _systemSetting.WarningCabinetId.ToString(); txtCriticalWeight.Text = _systemSetting.CriticalWeight.ToString("0.000"); txtBoxWeight.Text = _systemSetting.BoxWeight.ToString("0.000"); cbLogStorageDays.SelectedValue = _systemSetting.LogStorageDays; cbIsInterfaceType.SelectedValue = (int)_systemSetting.InterfaceType; txtCabinetId1_SlaveAddress.Text = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 1).SlaveAddress.ToString(); txtCabinetId2_SlaveAddress.Text = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 2).SlaveAddress.ToString(); txtCabinetId3_SlaveAddress.Text = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 3).SlaveAddress.ToString(); txtCabinetId4_SlaveAddress.Text = _systemSetting.SlaveConfigs.Find(s => s.CabinetId == 4).SlaveAddress.ToString(); cmbPrintFormat.SelectedValue = _systemSetting.PrintFormat; }
private void frmLatticeSettingSearch_Load(object sender, EventArgs e) { try { Task.Run(() => { //获取从机信息 _SlaveConfig = OrderSortService.GetSlaveConfig(); //获取格口信息 _LatticesettingList = OrderSortService.GetLatticeSettingList(); //获取界面按钮 _ButtonList = OrderSortService.CreateButtonList(Width, Height); }).ContinueWith(cw => { //把按钮显示到界面上 _ButtonList.ForEach(btn => { btn.Click += new EventHandler(button_Click); Invoke((MethodInvoker) delegate() { Controls.Add(btn); }); }); }).ContinueWith(cw => { _IsLoaded = true; }); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
/// <summary> /// 断电恢复 /// </summary> private void RestoringFromPowerOff() { try { //获取最新的一条分拣记录 var log = OrderSortService.GetTheLastOrderSortingLog(); if (log != null && log.Status == 3) { switch (log.Status) { case 3: //3投递异常 Invoke((MethodInvoker) delegate() { //目标柜格,亮绿灯 _TargetLattice = _LatticesettingList.Find(s => s.CabinetId == Convert.ToInt32(log.TargetCabinetId) && s.LatticeId == log.TargetLatticeId); if (OrderSortService.SetLED(_TargetLattice, 0)) { _ButtonList.FirstOrDefault(b => b.TabIndex == _TargetLattice.ID).BackColor = GetColor(0); } //投入柜格,亮红灯 _ResultLattice = _LatticesettingList.Find(s => s.CabinetId == Convert.ToInt32(log.ResultCabinetId) && s.LatticeId == log.ResultLatticeId); if (OrderSortService.SetLED(_ResultLattice, 1)) { _ButtonList.FirstOrDefault(b => b.TabIndex == _ResultLattice.ID).BackColor = GetColor(1); } lblOrderId.Text = log.OrderId; _TargetLattice = null; _IsError = true; }); break; case 4: //4重复扫描 Invoke((MethodInvoker) delegate() { _LastSuccessOrderId = log.OrderId; _LastOrderId = string.Empty; //目标柜格,亮绿灯 _TargetLattice = _LatticesettingList.Find(s => s.CabinetId == Convert.ToInt32(log.TargetCabinetId) && s.LatticeId == log.TargetLatticeId); OrderSortService.SetLED(_TargetLattice, 1); //准备进行重复扫描异常处理 _LatticeOrdersList = OrderSortService.GetLatticeOrdersListByLatticesettingId(_TargetLattice.ID); if (_LatticeOrdersList != null && _LatticeOrdersList.Count > 0) { _ButtonList.FirstOrDefault(b => b.TabIndex == _TargetLattice.ID).BackColor = GetColor(1); _IsRepeatError = true; _TargetLattice = null; _IsError = true; return; } }); break; } } } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void 全部清除重扫ToolStripMenuItem_Click(object sender, EventArgs e) { if (MessageBox.Show("请先把分拣架内的货物全部取回!") != DialogResult.OK) { return; } //Task.Run(() => //{ OrderSortService.ClearLatticeOrdersCache(); OrderSortService.ReSetGratingOrButton(3); OrderSortService.ReSetLED(); OrderSortService.ReSetWarningLight(); //按钮颜色恢复 _ButtonList.ForEach(b => b.BackColor = GetColor(3)); _TargetLattice = null; _ResultLattice = null; _BlockLattice = null; _IsBlocked = false; _ButtonLattice = null; _Orderinfo = null; _IsCheckButtonRunning = false; _CheckBlockNumber = 0; _CheckUnblockNumber = 0; _IsRepeatError = false; _IsCheckGratingRunning = false; _IsCheckUnblockRunning = false; _IsCheckBlockRunning = false; _IsError = false; //Invoke((MethodInvoker)delegate () { ResetLabelTest(); }); ResetLabelTest(); //}); }
private void DataLoad() { lbSolution.DataSource = OrderSortService.GetSortingSolutionsList(); lbSolution.ValueMember = "Id"; lbSolution.DisplayMember = "Name"; lbSolution.SelectedValue = sortingSolution; }
/// <summary> /// 打开格口设置窗口 /// </summary> private void button_Click(object sender, EventArgs e) { try { if (_IsRepeatError || _TargetLattice != null) { MessageBox.Show("分拣作业运行中,禁止修改格口设置!"); return; } SetTimerEnabled(false); var btn = sender as Button; var frm = new frmLatticeSettingEdit(btn.TabIndex); if (frm.ShowDialog() != DialogResult.OK) { return; } _LatticesettingList = OrderSortService.LoadLatticeSetting(); var ls = _LatticesettingList.First(l => l.ID == Convert.ToInt32(btn.Name)); btn.Text = OrderSortService.GetLatticeNewText(ls); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void btn_Save_Click(object sender, EventArgs e) { string qu = this.cmb_qu.Text; string PostTypeId = txtPostTypeId.Text; string PostTypeName = txtPostTypes.Text; bool isEnable = cbIsEnable.Checked; ls.IsEnable = isEnable.ToString(); OrderSortService.SaveLatticeSetting(ls); if (sz == null) { sz = new SolutionZipType { CabinetId = ls.CabinetId, LatticeSettingId = ls.ID, ZipName = qu == "请选择" ? "" : qu, SortingSolutionId = OrderSortService.GetSystemSettingCache().SortingSolution, Id = Guid.NewGuid().ToString(), PostTypeId = PostTypeId, PostTypeName = PostTypeName }; } else { sz.ZipName = qu == "请选择" ? "" : qu; sz.PostTypeId = PostTypeId; sz.PostTypeName = PostTypeName; } OrderSortService.SaveSolutionZipType(sz); this.DialogResult = DialogResult.OK; }
private void SetDefaultChecked() { try { var solution = OrderSortService.GetSolutionCountryListByLatticeSettingId(_latticesetting.ID); if (solution == null || solution.Count < 1) { return; } //选项 for (int i = 0; i < clsCountrys.Items.Count; i++) { var pt = clsCountrys.Items[i] as Countrys; if (solution.Exists(s => s.CountryId == pt.ID)) { clsCountrys.SetItemChecked(i, true); clsCountrys.SetSelected(i, true); } } } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } finally { txtSearch.Focus(); } }
/// <summary> /// 根据订单号获取订单信息,并获取目标格口 /// </summary> private bool CheckOrderinfo(string orderid) { var msg = string.Empty; //根据订单号获取订单信 _Orderinfo = OrderSortService.GetOrderInfoById(orderid, _UserInfo, ref msg); if (!string.IsNullOrWhiteSpace(msg)) { ResetLabelTest(); lblMsg.Text = string.Format("获取订单数据:{0}失败,{1}", orderid, msg); return(false); } //获取目标格口 _TargetLattice = OrderSortService.GetLatticeSettingByOrderinfo(_Orderinfo); if (_TargetLattice == null) { ResetLabelTest(); lblMsg.Text = string.Format("获取目标格口信息失败,订单号:{0}", orderid); return(false); } //判断格口是否已满 if (OrderSortService.IsFullLattice(_TargetLattice.ID)) { int cabinetId = _TargetLattice.CabinetId; int index = _TargetLattice.LEDIndex; _TargetLattice = null; OrderSortService.SetLED(cabinetId, index, 1); Thread.Sleep(500); OrderSortService.SetLED(cabinetId, index, 3); lblMsg.Text = string.Format("格口:{0} 已满", _TargetLattice.CabinetId); return(false); } return(true); }
private void frmSelectPostTypes_Load(object sender, EventArgs e) { try { var sysSetting = OrderSortService.GetSystemSettingCache(); //clsPosttypes var posttypeList = OrderSortService.GetPostTypesList(); if (sysSetting.InterfaceType == BLL.Model.InterfaceType.SigleFlyt) { posttypeList = posttypeList.FindAll(o => o.PostID == o.EnPostCode); } else { posttypeList = posttypeList.FindAll(o => o.PostID != o.EnPostCode); } clsPosttypes.DataSource = posttypeList; clsPosttypes.ValueMember = "PostID"; clsPosttypes.DisplayMember = "CnPostName"; SetDefaultChecked(); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void SetDefaultChecked() { try { var solution = OrderSortService.GetSolutionZipType(latticesettingId); if (solution == null) { return; } //选项 for (int i = 0; i < clsPosttypes.Items.Count; i++) { var pt = clsPosttypes.Items[i] as Posttypes; if (solution.PostTypeId == pt.PostID) { clsPosttypes.SetItemChecked(i, true); clsPosttypes.SetSelected(i, true); } } } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } finally { txtSearch.Focus(); } }
private void btnReprintByPkg_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtPkg.Text)) { return; } var pkg = OrderSortService.GetPackingLog("", txtPkg.Text); //打印包牌 if (OrderSortService.GetSystemSettingCache().PrintFormat == 0) { new PackingLabelPrintDocument().PrintSetup(pkg); } else { new PackingLabelPrintDocument2().PrintSetup(pkg); } } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void LoadSolutionCountry() { var solution = OrderSortService.GetSolutionCountryListByLatticeSettingId(_latticesetting.ID); txtCountrys.Text = string.Join(",", solution.Select(s => s.CountryName)); btnCountrys.Enabled = true; }
//private static void LEDTest() //{ // Console.WriteLine("从机(1,2,3),格口索引(0-11),LED(0绿、1红、2闪、3熄)"); // string str = Console.ReadLine(); // var strArray = str.Split(','); // OrderSortService.SetLED(Convert.ToUInt16(strArray[0]), Convert.ToUInt16(strArray[1]), Convert.ToUInt16(strArray[2])); // LEDTest(); //} private static void GratingTest() { SystemSetting systemSetting = OrderSortService.GetSystemSettingCache(); var slaveConfig = systemSetting.SlaveConfigs;//.Where(s => s.SlaveAddress > 0 && s.CabinetId <= systemSetting.CabinetNumber).ToList(); int i = 1; ReadGratingTest(i, slaveConfig); }
/// <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; } })); }
public void LoginStart(string name, string pwd) { try { CommonLib.SetEnable(this, btnSubmit); string ErrorMsg = ""; userInfo = LoginService.CheckLogin(name, pwd, ref ErrorMsg); if (name == "admin") { userInfo = new UserInfo { Pcid = "1067", PcName = "7", UserName = "******", ReceivePointId = "7", RepName = "7", UserId = 7 }; } else if (userInfo == null) { MessageBox.Show(ErrorMsg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtPwd.Text = ""; CommonLib.SetEnable(this, btnSubmit); return; } if (chbSaveUser.Checked) { //保存用户名 string Name = this.cmbUsers.Text.Trim(); string Pwd = this.txtPwd.Text.Trim(); if (!lst_LoginCache.Any(p => p.Email == Name)) { lst_LoginCache.RemoveAll(p => p.Email == Name); LoginData Lm = new LoginData(); Lm.Email = Name; lst_LoginCache.Add(Lm); SaveLoginName(); } } OrderSortService.AddLoginLog(name); this.Hide(); //this.DialogResult = DialogResult.OK; MDIParent m = new MDIParent(this); m.Show(); CommonLib.SetEnable(this, btnSubmit); } catch (Exception ex) { CommonLib.ShowErrorMsg(this, ex); } CommonLib.SetEnable(this, btnSubmit); }
private void frmLogin_Load(object sender, EventArgs e) { try { cmbUsers.Select(); cmbUsers.Focus(); Task.Run(() => LoadLoginName()).ContinueWith(cw => OrderSortService.Initialize()); } catch (Exception ex) { CommonLib.ShowErrorMsg(this, ex); } }
protected override void OnPrintPage(PrintPageEventArgs e) { //条码高度和宽度 try { StringFormat sf = new StringFormat(); sf.Alignment = StringAlignment.Center; sf.LineAlignment = StringAlignment.Center; Font Regularfont = new System.Drawing.Font("Times New Roman, Times, serif", 25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont1 = new System.Drawing.Font("Times New Roman, Times, serif", 40F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont2 = new System.Drawing.Font("Times New Roman, Times, serif", 30F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont3 = new System.Drawing.Font("Times New Roman, Times, serif", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont4 = new System.Drawing.Font("Times New Roman, Times, serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont5 = new System.Drawing.Font("Times New Roman, Times, serif", 17F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont6 = new System.Drawing.Font("Times New Roman, Times, serif", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont7 = new System.Drawing.Font("Times New Roman, Times, serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont8 = new System.Drawing.Font("Times New Roman, Times, serif", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont9 = new System.Drawing.Font("Times New Roman, Times, serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); Font Regularfont10 = new System.Drawing.Font("Times New Roman, Times, serif", 7F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); BarcodeLib.Barcode b = new BarcodeLib.Barcode(); BarcodeLib.TYPE type = BarcodeLib.TYPE.CODE128; b.IncludeLabel = false; if (_packingLog.PostTypeNames.Length > 12) { _packingLog.PostTypeNames = _packingLog.PostTypeNames.Insert(12, "\n"); } string _countryArea = "BG国家/分区 : "; if (_packingLog.CountryNames.IndexOf(",") < 0) { _countryArea += _packingLog.CountryNames; } var PostTypeNames = OrderSortService.GetPostTypeName(_packingLog.PostTypeIds); e.Graphics.DrawString(_countryArea, Regularfont4, Brushes.Black, 30, 30); string _dayPackage = _packingLog.OperationTime.ToString("MM/dd"); e.Graphics.DrawImage(b.Encode(type, _packingLog.PackNumber, 150, 30), 80, 90); e.Graphics.DrawString(_packingLog.PackNumber, Regularfont7, Brushes.Black, 105, 125); e.Graphics.DrawString("运输方式:" + PostTypeNames, Regularfont4, Brushes.Black, 30, 150); e.Graphics.DrawString("日期:" + _dayPackage, Regularfont4, Brushes.Black, 30, 190); e.Graphics.DrawString("操作人:", Regularfont4, Brushes.Black, 30, 220); e.Graphics.DrawString("件数:" + _packingLog.OrderQty, Regularfont4, Brushes.Black, 30, 250); e.Graphics.DrawString("BGHZ " + _packingLog.LatticeId, Regularfont4, Brushes.Black, 30, 280); e.Graphics.DrawString("重量:", Regularfont4, Brushes.Black, 130, 280); var image = GenerateQRByQrCodeNet(_packingLog.PackNumber); e.Graphics.DrawImage(image, 130, 170, 100, 100); this.Dispose(); } catch (Exception ex) { throw; } }
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); } }
private void 开始分拣ToolStripMenuItem_Click(object sender, EventArgs e) { try { SetTimerEnabled(true); OrderSortService.ReSetGratingOrButton(3); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
/// <summary> /// 针对阻挡的格口,检测对应光栅是否有感应到有物体阻挡,如果连续两次没有感应到阻挡,则解除警报 /// </summary> private Task CheckUnblockAsync() { return(Task.Run(() => { try { if (IsCheckUnblockSuspending) { return; } _IsCheckUnblockRunning = true; if (_CheckUnblockNumber < 1) { _CheckUnblockNumber++; OrderSortService.ReSetGratingOrButton(1); return; } var registersGrating = OrderSortService.ReadGratingRegisters(_SlaveConfig.Find(sc => sc.CabinetId == _BlockLattice.CabinetId).SlaveAddress); if (registersGrating[_BlockLattice.GratingIndex] > 1) { OrderSortService.ReSetGratingOrButton(1); return; } _CheckUnblockNumber++; if (_CheckUnblockNumber > 1) { if (OrderSortService.ReSetLED()) { OrderSortService.ReSetWarningLight(); //_TargetLattice = null; _ResultLattice = null; _BlockLattice = null; _IsError = false; _IsBlocked = false; //按钮颜色恢复 _ButtonList.ForEach(b => b.BackColor = GetColor(3)); Invoke((MethodInvoker) delegate() { ResetLabelTest(); }); OrderSortService.ReSetGratingOrButton(1); } } } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); } finally { _IsCheckUnblockRunning = false; } })); }
private void ThreadLoadData(object pageIndex) { try { this.Invoke((MethodInvoker) delegate() { pagerMain.PageIndex = (int)pageIndex; //订单号 var orderId = txtOrderId.Text.Trim(); //问题类型 var operationType = (int)cbOperationType.SelectedValue; //状态 var status = (int)cbStatus.SelectedValue; var startDate = dtpStartDate.Value; var endDate = dtpEndDate.Value; var recordCount = 0; //获取数据 var orderResult = OrderSortService.GetOrderSortingLogByPageSize(orderId, operationType, status, startDate, endDate, pagerMain.PageIndex, pagerMain.PageSize, ref recordCount); if (orderResult == null || !orderResult.Any()) { MessageBox.Show("查询无数据"); return; } pagerMain.RecordCount = recordCount; var data = (from os in orderResult orderby os.OperationTime select new OrderSortingLogViewModel { 订单号 = os.OrderId, 目标柜号 = os.TargetCabinetId, 目标格号 = os.TargetLatticeId, 投入柜号 = os.ResultCabinetId, 投入格号 = os.ResultLatticeId, 操作类型 = typeList.FirstOrDefault(t => t.Key == os.OperationType).Value, 状态 = statusList.FirstOrDefault(t => t.Key == os.Status).Value, 操作时间 = os.OperationTime.ToString("yyyy/MM/dd HH:mm:ss") }); dgvContent.DataSource = new SortableBindingList <OrderSortingLogViewModel>(data.OrderByDescending(d => d.操作时间).ToList()); pagerMain.SetBtnEnabled(); pagerMain.Refresh(); dgvContent.Focus(); }); } catch (Exception) { throw; } }
private void frmLatticeSettingSearch_SizeChanged(object sender, EventArgs e) { if (_IsLoaded && _ButtonList != null) { //窗口大小改变后,重新设定按钮的大小 var buttonPointList = OrderSortService.CreateButtonPointModelList(Width, Height); _ButtonList.ForEach(btn => { var bpc = buttonPointList.Find(bp => bp.LatticesettingId == Convert.ToInt32(btn.Name)); btn.Location = bpc.ButtonLocation; btn.Size = bpc.ButtonSize; btn.Font = bpc.ButtonFont; }); } }
//初始化渠道地区 private void LoadSolutionPostType() { //渠道 var solution = OrderSortService.GetSolutionPostTypeListByLatticeSettingId(_latticesetting.ID); txtPostTypes.Text = string.Join(",", solution.Select(s => s.PostTypeName)); PostTypeId = string.Join(",", solution.Select(s => s.PostTypeId)); //地区 var solutionArea = OrderSortService.GetSolutionPostAreaListByLatticeSettingId(solution.FirstOrDefault()?.PostTypeId, _latticesettingId); txtPostAreas.Text = string.Join(",", solutionArea.Select(s => s.Area)); btnPostTypes.Enabled = true; btnPostAreas.Enabled = true; }
private void frmSelectAreaTypes_Load(object sender, EventArgs e) { try { //clsPosttypes var posttypeList = OrderSortService.GetPostAreaList(_postTypeId); clsPosttypes.DataSource = posttypeList; clsPosttypes.ValueMember = "Flag"; clsPosttypes.DisplayMember = "Area"; SetDefaultChecked(); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void ThreadLoadData(object pageIndex) { try { this.Invoke((MethodInvoker) delegate() { pagerMain.PageIndex = (int)pageIndex; var startDate = dtpStartDate.Value; var endDate = dtpEndDate.Value; var recordCount = 0; //获取数据 var orderResult = OrderSortService.GetPackingLogByPageSize(startDate, endDate, pagerMain.PageIndex, pagerMain.PageSize, ref recordCount); if (orderResult == null || !orderResult.Any()) { MessageBox.Show("查询无数据"); return; } pagerMain.RecordCount = recordCount; var data = (from os in orderResult orderby os.OperationTime select new PackingLogViewModel { 包牌号 = os.PackNumber, 柜号 = os.CabinetId, 格号 = os.LatticeId, 道 = os.PostTypeNames, 地区 = os.CountryNames, 操作员 = os.UserName, 订单数量 = os.OrderQty + "Kg", 操作类型 = typeList.FirstOrDefault(t => t.Key == os.OperationType).Value, 操作时间 = os.OperationTime.ToString("yyyy/MM/dd HH:mm:ss") }); dgvContent.DataSource = new SortableBindingList <PackingLogViewModel>(data.OrderByDescending(d => d.操作时间).ToList()); pagerMain.SetBtnEnabled(); pagerMain.Refresh(); dgvContent.Focus(); }); } catch (Exception) { throw; } }
private void btnSave_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtSolutionName.Text)) { return; } OrderSortService.CreateNewSolution(txtSolutionName.Text); DialogResult = DialogResult.OK; Close(); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }
private void btnRetract_Click(object sender, EventArgs e) { try { if (string.IsNullOrWhiteSpace(txtLatticeId.Text)) { return; } MessageBox.Show(OrderSortService.DeleteOrderCacheByLatticeId(txtLatticeId.Text)); txtLatticeId.Text = string.Empty; txtLatticeId.Focus(); } catch (Exception ex) { SaveErrLogHelper.SaveErrorLog(string.Empty, ex.ToString()); MessageBox.Show(ex.Message); } }