コード例 #1
0
ファイル: BaseTaskForm.cs プロジェクト: uwitec/wms_rfid
        private void ConfirmMethod(DataGridViewRow row, BillDetail billDetail, IList<BillDetail> billDetails, string rfidID)
        {
            if (row.Cells["StatusName"].Value.ToString() == "������")
            {
                billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                billDetail.Operator = Environment.MachineName;
                billDetail.StorageRfid = rfidID;//����rfid
                billDetail.OperatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                billDetail.OperateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);

                operateStorageName = row.Cells["Storage"].Value.ToString();
                targetStorageName = row.Cells["TargetStorage"].Value.ToString();
                operateName = row.Cells["BillTypeName"].Value.ToString();
                operateProductName = row.Cells["ProductName"].Value.ToString();
                operatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                operateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
            }

            ConfirmDialog confirmForm = new ConfirmDialog(BillTypes, operateStorageName, targetStorageName, operateName, operateProductName);
            confirmForm.Piece = operatePieceQuantity;
            confirmForm.Item = operateBarQuantity;
            if (confirmForm.ShowDialog() == DialogResult.OK)
            {
                DisplayPlWailt();

                if (BillTypes == "4")
                {
                    billDetail.OperatePieceQuantity = confirmForm.Piece;
                    billDetail.OperateBarQuantity = confirmForm.Item;
                }

                //todo RFID ȷ�ϣ���RFID ��¼��

                billDetails.Add(billDetail);
                BillDetail[] tmp = new BillDetail[billDetails.Count];
                billDetails.CopyTo(tmp, 0);

                Task task = new Task(url);
                task.ExecuteCompleted += new Task.ExecuteCompletedEventHandler(delegate(bool isSuccess, string msg)
                {
                    if (!isSuccess)
                        MessageBox.Show(msg);
                    RefreshData();
                });
                task.Execute(tmp, UseTag);
            }
        }
コード例 #2
0
ファイル: Adapter.cs プロジェクト: uwitec/wms_rfid
        /// <summary>
        /// KeyRaised (int address,int keyNo ,string recv);
        /// 按键触发事件
        /// </summary>
        /// <param name="address">address:电子标签地址</param>
        /// <param name="keyNo">keyNo:按键号,共3个按键</param>
        /// <param name="recv">recv:控制板返回的数据,供调试用</param>
        private void elOpertor_KeyRaised(int address, int keyNo, string recv)
        {
            try
            {
                IHashOrmAccesser sy_showinfosAccesser = DBFactory.NewHashOrmAccesser();
                IHashOrmAccesser storagesAccesser = DBFactory.NewHashOrmAccesser();
                IFilter filter1 = new Filter(Storages._Sign, 2, ComparisonOperators.Equal);
                IFilter filter2 = new Filter(Storages._Address, _Port.ToString() + address.ToString().PadLeft(3, "0"[0]), ComparisonOperators.Equal);
                IFilter filter3 = new Filter(Storages._Row,(keyNo - 4).ToString().Substring(1, 1),ComparisonOperators.Equal);

                if (elOpertor.GetShowModeName() == "mode3")
                {
                    filter3 = new Filter("1","1", ComparisonOperators.Equal);
                }
                IList<Storages> storages = storagesAccesser.Select<Storages>(new FilterTree ("{0} and {1} and {2}",new IFilter [] {filter1,filter2,filter3}));
                if (storages.Count == 1)
                {
                    Storages storage = storages.First();
                    storage.Act = "";
                    storage.ProductName = "";
                    storage.Contents = "";
                    storage.Sign = 0;
                    storage.Err = 0;
                    storage.NumberShow = "";
                    storagesAccesser.Update(storage);
                    storagesAccesser.ExecuteNonQuery("Update [Storages] Set [Sign] = 1 where [Address] = '" + _Port.ToString() + address.ToString().PadLeft(3, "0"[0]) + "' and [Sign] = 3 ");

                    //++
                    IFilter filter4 = new Filter(Sy_ShowInfo._HardwareReadState, 1, ComparisonOperators.Equal);
                    IFilter filter5 = new Filter(Sy_ShowInfo._StorageID,storage.StorageID, ComparisonOperators.Equal);
                    IFilter filter6 = new Filter(Sy_ShowInfo._ConfirmState, 0, ComparisonOperators.Equal);
                    IList<Sy_ShowInfo> sy_showinfos = sy_showinfosAccesser.Select<Sy_ShowInfo>(new FilterTree("{0} and {1} and {2}", filter4, filter5, filter6));
                    if (sy_showinfos.Count == 1)
                    {
                        Sy_ShowInfo sy_showinfo = sy_showinfos.First();
                        sy_showinfo.ConfirmState = 1;
                        sy_showinfosAccesser.Update(sy_showinfo);

                        url = configUtil.GetConfig("URL")["URL"];
                        IList<BillDetail> billDetails = new List<BillDetail>();
                        BillDetail billDetail = new BillDetail();
                        billDetail.BillNo = sy_showinfo.OrderMasterID.ToString();
                        billDetail.BillType = sy_showinfo.OperateType.ToString();
                        billDetail.DetailID = Convert.ToInt32(sy_showinfo.OrderDetailID.ToString());
                        billDetail.Operator = Environment.MachineName;
                        billDetail.OperatePieceQuantity = Convert.ToInt32(sy_showinfo.OperatePiece);
                        billDetail.OperateBarQuantity = Convert.ToInt32(sy_showinfo.OperateItem);
                        billDetails.Add(billDetail);
                        BillDetail[] tmp = new BillDetail[billDetails.Count];
                        billDetails.CopyTo(tmp, 0);
                        Task task = new Task(null, url);
                        task.Execute(tmp, "1");
                    }
                    //++

                    sy_showinfosAccesser.ExecuteNonQuery("Update [Sy_ShowInfo] set [ConfirmState] = 1 where HardwareReadState =1 and [StorageID] = '" + storage.StorageID + "'");
                    Service.SendData();
                    if (false)
                    {
                        string[] data = new string[5];
                        for (int i = 0; i < 5; i++)
                            data[i] = "";
                        data[keyNo - 1] = "按钮返回成功!!!";
                        elOpertor.SendData(int.Parse(storage.Address.Substring(storage.Address.Length - 2, 2)), data);
                    }
                    if (false)
                    {
                        DataRabbit.HashOrm.IHashOrmAccesser delAccesser = DataRabbit.HashOrm.DBFactory.NewHashOrmAccesser(DataRabbit.HashOrm.DBFactory.NewTransactionScopeFactory("ServerDataConfig").NewTransactionScope());
                        delAccesser.ExecuteNonQuery("");
                    }
                }
            }
            catch (Exception e)
            {
                WriteLog(e.Message);
            }
        }
コード例 #3
0
ファイル: BaseTaskForm.cs プロジェクト: uwitec/wms_rfid
        //����ȷ��
        private void btnBatConfirm_Click(object sender, EventArgs e)
        {
            sp.Stop();
            if (!UseRfid.Equals("0"))
            {
                MessageBox.Show("ʹ��RFID�޷�������ɣ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (MessageBox.Show("��ǰ����������ȷ��ѡ������������������", "��ʾ",
                MessageBoxButtons.YesNo, MessageBoxIcon.Information) != DialogResult.Yes)
            {
                return;
            }
            try
            {
                if (dgvMain.SelectedRows.Count != 0)
                {
                    DisplayPlWailt();
                    IList<BillDetail> billDetails = new List<BillDetail>();
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        BillDetail billDetail = new BillDetail();
                        billDetail.BillNo = row.Cells["@BillNo"].Value.ToString();
                        billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                        billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                        billDetail.Operator = Environment.MachineName;

                        billDetail.OperatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                        billDetail.OperateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);

                        billDetails.Add(billDetail);
                    }
                    BillDetail[] tmp = new BillDetail[billDetails.Count];
                    billDetails.CopyTo(tmp, 0);

                    Task task = new Task(url);
                    task.ExecuteCompleted += new Task.ExecuteCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            MessageBox.Show(msg);
                        RefreshData();
                    });
                    task.Execute(tmp, UseTag);
                }
                else
                    MessageBox.Show("��ѡ��Ҫִ�еIJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ִ��ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #4
0
ファイル: BaseTaskForm.cs プロジェクト: 397152971/wms_rfid
        //ȷ��
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                if (dgvMain.SelectedRows.Count > 1)
                {
                    MessageBox.Show("��ǰ����ֻ�������һ������", "��ʾ",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                if (dgvMain.SelectedRows.Count == 1)
                {
                    IList<BillDetail> billDetails = new List<BillDetail>();
                    BillDetail billDetail = new BillDetail();
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        if (row.Cells["StatusName"].Value.ToString() == "������")
                        {
                            billDetail.BillNo = row.Cells["BillNo"].Value.ToString();
                            billDetail.BillType = row.Cells["@BillType"].Value.ToString();
                            billDetail.DetailID = Convert.ToInt32(row.Cells["DetailID"].Value);
                            billDetail.Operator = Environment.MachineName;

                            billDetail.OperatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                            billDetail.OperateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);

                            operateStorageName = row.Cells["Storage"].Value.ToString();
                            targetStorageName = row.Cells["TargetStorage"].Value.ToString();
                            operateName = row.Cells["BillTypeName"].Value.ToString();
                            operateProductName = row.Cells["ProductName"].Value.ToString();
                            operatePieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                            operateBarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                        }
                    }

                    ConfirmDialog confirmForm = new ConfirmDialog(BillTypes, operateStorageName, targetStorageName, operateName, operateProductName);
                    confirmForm.Piece = operatePieceQuantity;
                    confirmForm.Item = operateBarQuantity;

                    if (confirmForm.ShowDialog() == DialogResult.OK)
                    {
                        DisplayPlWailt();

                        if (BillTypes == "4")
                        {
                            billDetail.OperatePieceQuantity = confirmForm.Piece;
                            billDetail.OperateBarQuantity = confirmForm.Item;
                        }

                        //todo RFID ȷ�ϣ���RFID ��¼��

                        billDetails.Add(billDetail);
                        BillDetail[] tmp = new BillDetail[billDetails.Count];
                        billDetails.CopyTo(tmp, 0);

                        Task task = new Task(url);
                        task.ExecuteCompleted += new Task.ExecuteCompletedEventHandler(delegate(bool isSuccess, string msg)
                        {
                            if (!isSuccess)
                                MessageBox.Show(msg);
                            RefreshData();
                        });
                        task.Execute(tmp, UseTag);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ִ��ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }