예제 #1
0
파일: Adapter.cs 프로젝트: uwitec/wms_rfid
        public void Reset()
        {
            if (elOpertor.GetShowModeName() == "mode3")  // 数显标签 显示模式 《数显标签》 复位方式不同
            {
                ////设置按键灯
                elOpertor.SetKeysState(FuntionState.Close, Convert.ToInt32(0),
                    (FuntionState)0, Convert.ToInt32(0),
                    (FuntionState)0, Convert.ToInt32(0));
                elOpertor.SendData(0,new string [] {"          "});
                ////设置按键灯
                elOpertor.SetKeysState(FuntionState.Start, Convert.ToInt32(0),
                    (FuntionState)0, Convert.ToInt32(0),
                    (FuntionState)0, Convert.ToInt32(0));
                return;
            }
            else
            {
                elOpertor.ClearDataQueue();

                IHashOrmAccesser storagesAccesser = DBFactory.NewHashOrmAccesser();
                IFilter filter1 = new Filter(Storages._Port, _Port.ToString(), ComparisonOperators.Equal);

                IList<Storages> storages = storagesAccesser.Select<Storages>(filter1, Storages._Address);
                IEnumerable<Storages> storageslist = storages.Distinct();
                foreach (Storages storage in storageslist)
                {
                    elOpertor.ResetElectronicLabel(int.Parse(storage.Address.Substring(storage.Address.Length - 3, 3)));
                }
            }
        }
예제 #2
0
파일: Server.cs 프로젝트: uwitec/wms_rfid
        private void btResent_Click(object sender, EventArgs e)
        {
            IHashOrmAccesser sy_showinfosAccesser = DBFactory.NewHashOrmAccesser();

            IFilter filter = new Filter(Sy_ShowInfo._OrderMasterID, txtOrderID.Text.Trim(), ComparisonOperators.Equal);

            IList<Sy_ShowInfo> sy_showInfo = sy_showinfosAccesser.Select<Sy_ShowInfo>(filter);

            if (sy_showInfo.Count == 0)
            {
                MessageBox.Show("订单号不存在,请检查订单号是否正确!或数据发送失败!", "电子标签服务", MessageBoxButtons.OK);
                return;
            }
            sy_showinfosAccesser.ExecuteNonQuery("update Sy_ShowInfo set ReadState = 0 ,HardwareReadState = 0 ,ConfirmState = 0 where OrderMasterID = '" + txtOrderID.Text.Trim() + "'");

            MessageBox.Show("订单重发成功!如无显示请检查订单号是否正确!", "电子标签服务", MessageBoxButtons.OK);
        }
예제 #3
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);
            }
        }