internal void Complete() { if (!ScanManagerView.InitCigaretteScanInfoStack()) { return; } string productCode = gridView.GetSelectedRows().Count() > 0 ? gridView.GetRowCellValue(gridView.GetSelectedRows()[0], "ProductCode").ToString() : ""; CigaretteScanInfo info = CigaretteScanInfoStack.Keys.Contains(productCode) ? CigaretteScanInfoStack[productCode] : null; if (info == null) { XtraMessageBox.Show("请选择要完成扫码的品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (info.State != "3") { XtraMessageBox.Show("请选择正在扫码的品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string productName = gridView.GetSelectedRows().Count() > 0 ? gridView.GetRowCellValue(gridView.GetSelectedRows()[0], "ProductName").ToString() : ""; if (XtraMessageBox.Show("确认完成扫码吗?当前[" + productName + "]码盘是否确实已完成!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { info.Index = 0; info.State = "4"; lock (CigaretteScanInfoStack) { CigaretteScanInfoStack.Remove(info.ProductCode); } AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack); } Refresh(); }
public UpdateBarcodeDialog(CigaretteScanInfo[] table) { InitializeComponent(); lookUpEdit1.Properties.DataSource = table; lookUpEdit1.Properties.ValueMember = "ProductCode"; lookUpEdit1.Properties.DisplayMember = "ProductName"; }
internal void Pause() { if (!ScanManagerView.InitCigaretteScanInfoStack()) { return; } string productCode = gridView.GetSelectedRows().Count() > 0 ? gridView.GetRowCellValue(gridView.GetSelectedRows()[0], "ProductCode").ToString() : ""; CigaretteScanInfo info = CigaretteScanInfoStack.Keys.Contains(productCode) ? CigaretteScanInfoStack[productCode] : null; if (info == null) { XtraMessageBox.Show("请选择要停止扫码的品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (info.State == "0" || info.State == "1" || info.State == "4") { XtraMessageBox.Show("请选择等待扫码或正在扫码的品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } string productName = gridView.GetSelectedRows().Count() > 0 ? gridView.GetRowCellValue(gridView.GetSelectedRows()[0], "ProductName").ToString() : ""; if (XtraMessageBox.Show("确认暂停扫码?当前[" + productName + "]码盘会清空!", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { info.Index = 0; info.State = "1"; AutomationContext.Write(plcServiceName, O_StockIn_Scan_Cancel, info.ProductNo); lock (CigaretteScanInfoStack) { CigaretteScanInfoStack.Remove(info.ProductCode); } AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack); } Refresh(); }
internal void UploadSize() { foreach (var cigaretteScanInfo in CigaretteScanInfoStack.Values) { ProductDal productDal = new ProductDal(); CigaretteScanInfo info = productDal.FindProductForScan(cigaretteScanInfo.ProductCode); cigaretteScanInfo.ProductNo = info.ProductNo; cigaretteScanInfo.Length = info.Length; cigaretteScanInfo.Width = info.Width; cigaretteScanInfo.Height = info.Height; cigaretteScanInfo.Barcode = info.Barcode; } AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack); }
internal void Scan() { if (!ScanManagerView.InitCigaretteScanInfoStack()) { return; } string productCode = gridView.GetSelectedRows().Count() > 0 ? gridView.GetRowCellValue(gridView.GetSelectedRows()[0], "ProductCode").ToString() : ""; CigaretteScanInfo info = CigaretteScanInfoStack.Keys.Contains(productCode) ? CigaretteScanInfoStack[productCode] : null; if (info == null) { XtraMessageBox.Show("请选择要扫码的品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (info.State == "2" || info.State == "3" || info.State == "4") { XtraMessageBox.Show("请选择未扫码的品牌!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int[] data = new int[] { info.ProductNo, info.Quantity - info.ScanQuantity, info.Length, info.Width, info.Height, info.AreaNo, 1 }; if (AutomationContext.Write(plcServiceName, O_StockIn_Scan_Info, data)) { Thread.Sleep(1000); object obj = AutomationContext.Read(plcServiceName, I_StockIn_Scan_Info); if (obj is Array) { Array arrayObj = (Array)obj; if (arrayObj.Length == 7 && data[0] == Convert.ToInt32(arrayObj.GetValue(0)) && data[1] == Convert.ToInt32(arrayObj.GetValue(1)) && data[2] == Convert.ToInt32(arrayObj.GetValue(2)) && data[3] == Convert.ToInt32(arrayObj.GetValue(3)) && data[4] == Convert.ToInt32(arrayObj.GetValue(4)) && data[5] == Convert.ToInt32(arrayObj.GetValue(5)) && data[6] == Convert.ToInt32(arrayObj.GetValue(6))) { if (AutomationContext.Write(plcServiceName, O_StockIn_Scan_Complete, 1)) { info.Index = CigaretteScanInfoStack.Values.Max(c => c.Index) + 1; info.State = "2"; AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack); } } } } Refresh(); }
internal void Read() { if (!ScanManagerView.InitCigaretteScanInfoStack()) { return; } TaskDal task = new TaskDal(); var table = task.FindStockInProduct(); if (table.Rows.Count > 0) { foreach (DataRow row in table.Rows) { ProductDal productDal = new ProductDal(); CigaretteScanInfo info = productDal.FindProductForScan(Convert.ToString(row["product_code"])); if (info != null && !CigaretteScanInfoStack.Keys.Contains(Convert.ToString(row["product_code"]))) { info.ProductCode = Convert.ToString(row["product_code"]); info.ProductName = Convert.ToString(row["product_name"]); info.Quantity = Convert.ToInt32(row["task_quantity"]); info.Index = 0; info.State = "0"; lock (CigaretteScanInfoStack) { CigaretteScanInfoStack.Add(info.ProductCode, info); } } else if (info == null) { XtraMessageBox.Show(string.Format("当前卷烟 {0} : {1} 没有尺寸信息,请先行进行维护!", Convert.ToString(row["product_code"]), Convert.ToString(row["product_name"])) , "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show(string.Format("当前卷烟 {0} : {1} 已有扫码任务!", Convert.ToString(row["product_code"]), Convert.ToString(row["product_name"])) , "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack); } else { XtraMessageBox.Show("当前没有卷烟入库任务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } Refresh(); }
internal void New() { if (!ScanManagerView.InitCigaretteScanInfoStack()) { return; } TaskDal task = new TaskDal(); var table = task.FindStockInProduct(); if (table.Rows.Count > 0) { CreateScanTaskDialog createScanTaskDialog = new CreateScanTaskDialog(table); if (createScanTaskDialog.ShowDialog() == DialogResult.OK && createScanTaskDialog.Quantity > 0) { ProductDal productDal = new ProductDal(); CigaretteScanInfo info = productDal.FindProductForScan(createScanTaskDialog.SelectedCigaretteCode); if (info != null && !CigaretteScanInfoStack.Keys.Contains(createScanTaskDialog.SelectedCigaretteCode)) { info.ProductCode = createScanTaskDialog.SelectedCigaretteCode; info.ProductName = createScanTaskDialog.SelectedCigaretteName; info.Quantity = createScanTaskDialog.Quantity; info.Index = 0; info.State = "0"; lock (CigaretteScanInfoStack) { CigaretteScanInfoStack.Add(info.ProductCode, info); } AutomationContext.Write(memoryServiceName, memoryItemName, CigaretteScanInfoStack); } else if (info == null) { XtraMessageBox.Show("当前卷烟没有尺寸信息,请先行进行维护!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { XtraMessageBox.Show("当前卷烟已有扫码任务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else { XtraMessageBox.Show("当卷烟没有入库任务!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } Refresh(); }
public CigaretteScanInfo FindProductForScan(string productCode) { var ra = TransactionScopeManager[Global.THOK_WCS_DB_NAME].NewRelationAccesser(); string sql = string.Format(@"select b.piece_barcode,a.product_no,a.area_no,a.size_no,a.length,a.width,a.height from wcs_product_size a left join wms_product b on a.product_code = b.product_code where a.product_code = '{0}'", productCode); var set = ra.DoQuery(sql); if (set.Tables.Count == 1 && set.Tables[0].Rows.Count == 1) { CigaretteScanInfo info = new CigaretteScanInfo(); info.ProductNo = Convert.ToInt32(ra.DoQuery(sql).Tables[0].Rows[0]["product_no"]); info.Barcode = ra.DoQuery(sql).Tables[0].Rows[0]["piece_barcode"].ToString(); info.AreaNo = Convert.ToInt32(ra.DoQuery(sql).Tables[0].Rows[0]["area_no"]); info.SizeNo = Convert.ToInt32(ra.DoQuery(sql).Tables[0].Rows[0]["size_no"]); info.Length = Convert.ToInt32(ra.DoQuery(sql).Tables[0].Rows[0]["length"]); info.Width = Convert.ToInt32(ra.DoQuery(sql).Tables[0].Rows[0]["width"]); info.Height = Convert.ToInt32(ra.DoQuery(sql).Tables[0].Rows[0]["height"]); return info; } return null; }