예제 #1
0
 static void onEveryWorkingUnit(int unitTime)
 {
     if (stopWhenNoTask && taskCount == 0)
     {
         ConveyorBasicController.mrS(0);
         ConveyorCleverController.cleanDelegate();
         RfidCleverController.cleanDelegate();
         running = false;
     }
     else if (!stopWhenNoTask)
     {
         for (int t = 0; t < ChQueue.Length; t++)
         {
             goodPositionBetweenSpecificNumber__minLimit = ChTime[t] - TimeD;
             goodPositionBetweenSpecificNumber__maxLimit = goodPositionBetweenSpecificNumber__minLimit + unitTime;
             GoodOnConveyor good = Goods.Find(goodPositionBetweenSpecificNumber);
             if (good != null && good.rfidTag != null && GoodsHandleMethod.ContainsKey(good.rfidTag))
             {
                 HandleMethod handleMethod = GoodsHandleMethod[good.rfidTag];
                 if (handleMethod.exitPoint == t)
                 {
                     handleGood(ChQueue[t], good, handleMethod.upload);
                 }
             }
         }
     }
 }
        public void onReceiveGoodDetails(Good good, HandleMethod handleMethod)
        {
            ListViewItem item = new ListViewItem();

            item.Text = good.id.ToString();
            item.SubItems.Add(good.rfid_tag);
            item.SubItems.Add(handleMethod.exitPoint.ToString());
            item.Tag = good;
            _list_view_goods_allocation.Invoke(new AddItemToListViewGoodsAllocation(addItemToListViewGoodsAllocation), item);
            Invoke(new AutoChangeDisplayGood(autoChangeDisplayGood), good);
        }
예제 #3
0
        public void onRfidScannedThreadMain(object po)
        {
            object[]       pa             = (object[])po;
            GoodOnConveyor goodOnConveyor = (GoodOnConveyor)pa[0];
            // parameters deserialization finished
            string rfidTag = goodOnConveyor.rfidTag;
            Good   good;

            if (GoodDetails.ContainsKey(rfidTag))
            {
                good = GoodDetails[rfidTag];
            }
            else
            {
                Console.WriteLine("Post get goods details : {0}", rfidTag);
                NameValueCollection parameters = new NameValueCollection();
                parameters["rfid"] = goodOnConveyor.rfidTag;
                string result = Encoding.Default.GetString(new WebClient().UploadValues(urlGetGoodDetails, parameters));
                Console.WriteLine("Receive goods details of {0} : {1}", rfidTag, result);
                if ((bool)JsonMapper.ToObject(result)["success"])
                {
                    good          = JsonMapper.ToObject <Good>(result);
                    good.rfid_tag = rfidTag;
                    GoodDetails.Add(rfidTag, good);
                }
                else
                {
                    Console.Beep();
                    //ArtificialIntelligence.stop();
                    return;
                }
            }
            if (!ArtificialIntelligence.GoodsHandleMethod.ContainsKey(rfidTag))
            {
                HandleMethod handleMethod = new HandleMethod(exitPoint(good), false);
                ArtificialIntelligence.GoodsHandleMethod.Add(rfidTag, handleMethod);
                if (onReceiveGoodDetails != null)
                {
                    onReceiveGoodDetails(good, handleMethod);
                }
            }
        }