Beispiel #1
0
 //��������ѡ���ϸ����
 public void Apply(BillDetail[] billDetails, string useTag)
 {
     taskType = "apply";
     WebClient client = new WebClient();
     client.Headers["Content-Type"] = @"application/x-www-form-urlencoded; charset=UTF-8";
     string parameter = JsonMapper.ToJson(billDetails);
     client.UploadStringAsync(url, "post", @"Parameter={'Method':'apply','UseTag':'" + useTag + "','BillDetails':" + parameter + "}");
     client.UploadStringCompleted += new UploadStringCompletedEventHandler(client_UploadStringCompleted);
 }
Beispiel #2
0
        private void ConfirmPubliceMethod()
        {
            string errString = string.Empty;
            try
            {
                bool isRfid = true;
                decimal quantity = 0;
                List<string> listRfid = new List<string>();
                if (UseRfid != "0")
                {
                    foreach (DataGridViewRow row in dgvMain.SelectedRows)
                    {
                        quantity = Convert.ToDecimal(row.Cells["PieceQuantity"].Value);
                    }
                    if (quantity == 30)
                    {
                        while (listRfid.Count == 0 || listRfid == null)
                        {
                            DisplayPlWailt();
                            listRfid = rRfid.ReadTrayRfid(port, 115200, out errString);
                            Application.DoEvents();
                        }
                    }
                }
                if (dgvMain.SelectedRows.Count > 1)
                {
                    MessageBox.Show("��ǰ����ֻ�������һ������", "��ʾ",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (listRfid.Count == 0 && !UseRfid.Equals("0") && quantity==30)
                {
                    MessageBox.Show("��ȡRFID��Ϣʧ�ܣ���ȡ�������������룡", "��ʾ",
                          MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;

                }

                if (dgvMain.SelectedRows.Count == 0)
                {
                    MessageBox.Show("��ǰ����ʧ�ܣ�ԭ��û��ѡ�����ݣ���ѡ��", "��ʾ",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }

                IList<BillDetail> billDetails = new List<BillDetail>();
                BillDetail billDetail = new BillDetail();
                switch (UseRfid)
                {
                    case "0":
                        if (dgvMain.SelectedRows.Count == 1)
                        {
                            foreach (DataGridViewRow row in dgvMain.SelectedRows)
                            {
                                ConfirmMethod(row, billDetail, billDetails, RfidCode);
                                isRfid = false;
                            }
                        }
                        break;
                    case "1":
                        if (dgvMain.SelectedRows.Count == 1)
                        {
                            foreach (DataGridViewRow row in dgvMain.SelectedRows)
                            {
                                string cellRfid = row.Cells["CellRfid"].Value.ToString();
                                if (BillTypes == "3")
                                {
                                    if (!listRfid.Contains(row.Cells["StorageRfid"].Value.ToString())&& quantity==30)//�Ƴ��Ŀ��(����)��rfid
                                    {
                                        MessageBox.Show("��ȡRFID��Ϣ�����ݲ�һ�£��������̾����������Ƿ���ϣ�", "��ʾ",
                                                            MessageBoxButtons.OK, MessageBoxIcon.Information);
                                        return;
                                    }
                                    cellRfid = row.Cells["TargetStorageRfid"].Value.ToString();//����Ļ�λrfid
                                }
                                if (listRfid.Contains(cellRfid) || listRfid.Count==0)
                                {
                                    ConfirmMethod(row, billDetail, billDetails, RfidCode);
                                    isRfid = false;
                                }
                            }
                        }
                        break;
                    case "2":
                        foreach (DataGridViewRow row in dgvMain.Rows)
                        {
                            string cellRfid = row.Cells["CellRfid"].Value.ToString();
                            if (BillTypes == "3")
                            {
                                if (!listRfid.Contains(row.Cells["StorageRfid"].Value.ToString()) && quantity == 30)
                                {
                                    MessageBox.Show("��ȡRFID��Ϣʧ�ܣ���ȡ�������������룡", "��ʾ",
                                                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    return;
                                }
                                cellRfid = row.Cells["TargetStorageRfid"].Value.ToString();
                            }
                            if (listRfid.Contains(cellRfid) || listRfid.Count == 0)
                            {
                                ConfirmMethod(row, billDetail, billDetails, RfidCode);
                                isRfid = false;
                                break;
                            }
                        }
                        break;
                    default:
                        errInfo = "��鿴ʹ��RFID���ò����Ƿ���ȷ��";
                        break;
                }
                if (isRfid)
                    MessageBox.Show("���ȷ��ʧ�ܣ�ԭ���Ҳ������λRFID��ȵ����ݣ���������" + errInfo + " ," + errString);
                else
                    RfidCode = "";
            }
            catch (Exception ex)
            {
                MessageBox.Show("ִ��ʧ�ܣ�ԭ��" + ex.Message + "," + errString, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
        //ȡ������
        private void btnCancel_Click(object sender, EventArgs e)
        {
            try
            {
                sp.Stop();
                if (dgvMain.SelectedRows.Count != 0)
                {
                    DisplayPlWailt();
                    rRfid.CloseCom();
                    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;
                        billDetails.Add(billDetail);
                    }
                    BillDetail[] tmp = new BillDetail[billDetails.Count];
                    billDetails.CopyTo(tmp, 0);

                    Task task = new Task(url);
                    task.CancelCompleted += new Task.CancelCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            MessageBox.Show(msg);
                        RefreshData();
                    });
                    task.Cancel(tmp, UseTag);
                    RfidCode = "";
                }
                else
                    MessageBox.Show("��ѡ��Ҫȡ���IJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("ȡ��ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #5
0
        //����ȷ��
        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);
            }
        }
Beispiel #6
0
        private void ApplyPublicMethod()
        {
            try
            {
                string storageRfide = "";
                if (dgvMain.SelectedRows.Count > 1 && !UseRfid.Equals("0"))
                {
                    MessageBox.Show("��ǰ����ֻ�������һ������", "��ʾ",
                        MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                foreach (DataGridViewRow row in dgvMain.Rows)
                {
                    if (row.Cells["Status"].Value.ToString().Equals("1") && !UseRfid.Equals("0"))
                    {
                        MessageBox.Show("ʹ��RFID,ֻ������һ�����ݡ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        return;
                    }
                }
                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.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                        billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                        billDetail.Operator = Environment.MachineName;
                        billDetails.Add(billDetail);
                        if (!UseRfid.Equals("0"))
                        {
                            storageRfide = row.Cells["StorageRfid"].Value.ToString();
                        }
                    }

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

                    Task task = new Task(url);
                    task.ApplyCompleted += new Task.ApplyCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            MessageBox.Show(msg);
                        RefreshData();
                    });
                    task.Apply(tmp, UseTag);
                }
                else
                    MessageBox.Show("��ѡ��Ҫִ�еIJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);

                //if (!RfidCode.Equals(storageRfide))
                //    MessageBox.Show("��ȡ��rfid��Ϣ�������������Ϣ��һ�£�����������", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RefreshData();
            }
        }
Beispiel #7
0
        public void ApplyPublicMethod(string uRfid, string rfidId, string rfidProductCode, decimal rfidQuantity)
        {
            try
            {
                errInfo = "";
                bool isRfid = true;
                RfidCode = rfidId;
                decimal rfidQty = Convert.ToInt32(rfidQuantity);
                if (dgvMain.SelectedRows.Count != 0)
                {
                    foreach (DataGridViewRow row in dgvMain.Rows)
                    {
                        if (row.Cells["Status"].Value.ToString().Equals("1") && !uRfid.Equals("0"))
                        {
                            MessageBox.Show("ʹ��RFID,ֻ������һ�����ݡ�", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            return;
                        }
                    }
                    DisplayPlWailt();
                    IList<BillDetail> billDetails = new List<BillDetail>();

                    switch (uRfid)
                    {
                        case "0":
                            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.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                                billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                                billDetail.Operator = Environment.MachineName;
                                billDetails.Add(billDetail);
                            }
                            isRfid = false;
                            break;
                        case "1":
                            foreach (DataGridViewRow row in dgvMain.SelectedRows)
                            {
                                if (rfidProductCode.Equals(row.Cells["ProductCode"].Value.ToString())
                                && rfidQty == Convert.ToInt32(row.Cells["PieceQuantity"].Value)
                                && row.Cells["Status"].Value.ToString().Equals("0"))
                                {
                                    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.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                                    billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                                    billDetail.Operator = Environment.MachineName;
                                    billDetails.Add(billDetail);
                                    isRfid = false;
                                    break;
                                }
                            }
                            break;
                        case "2":
                            foreach (DataGridViewRow row in dgvMain.Rows)
                            {
                                //�жϾ��̺��������ȡ���Ƿ�һ��������״̬�ų��Ѿ�����Ļ�λ��
                                if (rfidProductCode.Equals(row.Cells["ProductCode"].Value.ToString())
                                    && rfidQty == Convert.ToInt32(row.Cells["PieceQuantity"].Value)
                                    && row.Cells["Status"].Value.ToString().Equals("0"))
                                {
                                    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.PieceQuantity = Convert.ToInt32(row.Cells["PieceQuantity"].Value);
                                    billDetail.BarQuantity = Convert.ToInt32(row.Cells["BarQuantity"].Value);
                                    billDetail.Operator = Environment.MachineName;
                                    billDetails.Add(billDetail);
                                    isRfid = false;
                                    break;
                                }
                            }
                            break;
                        default:
                            errInfo = "��鿴ʹ��RFID���ò����Ƿ���ȷ��";
                            break;
                    }

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

                    Task task = new Task(url);
                    task.ApplyCompleted += new Task.ApplyCompletedEventHandler(delegate(bool isSuccess, string msg)
                    {
                        if (!isSuccess)
                            errInfo += "  " + msg;
                        RefreshData();
                    });
                    task.Apply(tmp, UseTag);

                    if (isRfid)
                        MessageBox.Show("����ʧ�ܣ�ԭ�򣺵�ǰ���̾��̺���������ҵ���ݲ�ƥ����� ��������:  " + errInfo, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                    MessageBox.Show("��ѡ��Ҫִ�еIJֿ���ҵ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show("����ʧ�ܣ�ԭ��" + ex.Message, "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #8
0
 /// <summary>
 /// ȡ����ҵ
 /// </summary>
 /// <param name="billDetails"></param>
 /// <param name="useTag"></param>
 public void Cancel(BillDetail billDetail)
 {
     string parameter = @"Parameter={'Method':'cancel','UseTag':'" + "0" + "','BillDetails':" + JsonConvert.SerializeObject(new BillDetail[] { billDetail }) + "}";
     string msg = util.GetDataFromServer(parameter);
     //Result r = JsonConvert.DeserializeObject<Result>(msg);
 }
Beispiel #9
0
 /// <summary>
 /// �����ҵ
 /// </summary>
 /// <returns></returns>
 public void Execute(BillDetail billDetail)
 {
     string parameter = @"Parameter={'Method':'execute','UseTag':'" + "0" + "','BillDetails':" + JsonConvert.SerializeObject(new BillDetail[] { billDetail}) + "}";
     string msg = util.GetDataFromServer(parameter);
 }
Beispiel #10
0
        /// <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);
            }
        }
Beispiel #11
0
        private void btnComplete_Click(object sender, EventArgs e)
        {
            WaitCursor.Set();
            try
            {
                if (SystemCache.ConnetionType == "USB����")
                {
                    new XMLBillDal().UpdateBill(billID, detailID, lbPiece.Text, lbItem.Text);
                }
                else
                {
                    BillDetail billDetail = new BillDetail();

                    billDetail.BillNo = billID;
                    billDetail.BillType = billType;
                    billDetail.DetailID = Convert.ToInt32(lbID.Text);
                    billDetail.Operator = Dns.GetHostName();
                    billDetail.OperatePieceQuantity = Convert.ToDecimal(lbPiece.Text);
                    billDetail.OperateBarQuantity = Convert.ToDecimal(lbItem.Text);
                    httpDataDal.Execute(billDetail);
                }
                MessageBox.Show("ȷ�ϳɹ�!");
                BaseTaskForm baseTaskForm = new BaseTaskForm(this.billType, billID);
                if (this.Index > 0)
                {
                     baseTaskForm.index = this.Index;
                }
                baseTaskForm.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                WaitCursor.Restore();
                MessageBox.Show(ex.Message);
                this.Close();
                SystemCache.MainFrom.Visible = true;
            }
        }
Beispiel #12
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            WaitCursor.Set();
            try
            {
                if (SystemCache.ConnetionType == "USB����")
                {

                }
                else
                {
                    BillDetail billDetail = new BillDetail();

                    billDetail.BillNo = billID;
                    billDetail.BillType = billType;
                    billDetail.DetailID = Convert.ToInt32(lbID.Text);
                    billDetail.Operator = Dns.GetHostName();
                    billDetail.OperatePieceQuantity = Convert.ToDecimal(lbPiece.Text);
                    billDetail.OperateBarQuantity = Convert.ToDecimal(lbItem.Text);
                    httpDataDal.Cancel(billDetail);

                }

                BaseTaskForm baseTaskForm = new BaseTaskForm(this.billType, billID);
                baseTaskForm.index = this.Index;
                baseTaskForm.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                WaitCursor.Restore();
                MessageBox.Show("��ȡ����ʧ��!" + ex.Message);
            }
        }
Beispiel #13
0
        //ȷ��
        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);
            }
        }
Beispiel #14
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            WaitCursor.Set();
            try
            {
                if (!(SystemCache.ConnetionType == "USB����"))
                {
                    BillDetail billDetail = new BillDetail();
                    billDetail.BillNo = billId;
                    billDetail.BillType = billType;
                    billDetail.DetailID = int.Parse(this.dgInfo[this.dgInfo.CurrentCell.RowNumber, 0].ToString());
                    billDetail.PieceQuantity = decimal.Parse(this.dgInfo[this.dgInfo.CurrentCell.RowNumber, 5].ToString());
                    billDetail.BarQuantity = decimal.Parse(this.dgInfo[this.dgInfo.CurrentCell.RowNumber, 6].ToString());
                    billDetail.Operator = Dns.GetHostName();
                    httpDataDal.Apply(billDetail);
                    //�޸��ڴ��ж�Ӧ��ҵ��״̬Ϊ��������
                    DataRow[] rows = detailTable.Select(string.Format("DetailID = {0}", this.dgInfo[this.dgInfo.CurrentCell.RowNumber, 0].ToString()));
                    rows[0]["StatusName"] = "������";

                }

                BillDetailForm billDetailForm = new BillDetailForm(billType, this.dgInfo[this.dgInfo.CurrentCell.RowNumber, 0].ToString(), billId, detailTable);
                billDetailForm.Index = this.index;
                billDetailForm.Show();
                this.Close();
            }
            catch (Exception ex)
            {
                WaitCursor.Restore();
                MessageBox.Show(ex.Message);
            }
        }