11/29/2016

Axapta : คำสั่งผลิต Update Costing ไม่ได้

Axapta : คำสั่งผลิต Update Costing ไม่ได้ Error : Calculating production Cost value mosh be positive upon receipt in inventory.
น่าจะเกิดจากมีการทำ Packing list ติดลบคืน แล้ว ทำรายการ Packing List เพิ่ม และน่าจะเกิดปัญหาตอน Cost แล้วค้าง ทำให้เกิดปัญหาดังกล่าว

PD จะเป็น Start 18 , Reports 6 , Costing 4 แต่จะ Costing เพิ่มไม่ได้

แก้โดย

1. ยกเลิกการจอง จาก เอกสาร TIP03 ที่มีการจอง Item นั้น ๆ ไว้ ยกเลิกออกให้หมด
2. เข้าไปที่คำสั่งผลิตนั้น แล้ว Report ยอดติดลบ ออก ใส่ทีล่ะ -1 ใส่ วันที่ และ Serial number ให้ตรงกับตอนที่ Report ยอดที่เพิ่มที่มีปัญหา รายละเอียดให้เหมือนกันหมดยกเว้นยอด ให้ใส่ติดลบ
Validate และ Post
3. ทำ Packing list ติดลบ ใส่วันที่และ Batch ให้ตรงกัน เข้าดูได้ใน Transaction ของ Item นั่น ๆ ใส่จำนวน ติด - เท่ากับจำนวนที่ตัดไป รายละเอียดให้เหมือนกันหมด ยกเว้นยอดให้ติดลบ Validate และ Post
4. Update Costing ใส่วันที่ให้ตรงกับวันที่ Update Costing ล่าสุด

PD จะเป็น Start 18 , Reports จำนวนที่ Report ติดลบลงไป , Costing 4 แต่จะ Costing เพิ่มไม่ได้

5. ตัด Packing List , Reports ใหม่ ข้อมูลเหมือนเดิม แล้วทดลง Update Costing
6. จอง TIP03 ใหม่
วิธีนี้จะมี Transaction ของ Valve ที่เข้าและออก ไม่มีต้นทุน และจะมี Valve ที่เกิดขึ้นใหม่ที่มีต้นทุน ที่เรา Report เพิ่มตามข้อ 5.

หรืออีกวิธีที่ง่ายกว่า สอบถามผู้ทำคำสั่งผลิต ว่าคำสั่งผลิตจะทำเสร็จหรือรายงานเพิ่มวันไหน ถ้าภายในวันนั้นหรือ ไม่นานให้รอ Reports เพิ่มตัด Packing List เพิ่ม และจำ Update Costing ได้

Arduino : ติดตั้ง Arduino Ubuntu + Code Connect WIFI , NTP , Loop Function, SonOff Tick เปิดปิดตามเวลา

Arduino : ติดตั้ง Arduino Ubuntu + Code Connect WIFI , NTP , Loop Function, SonOff Tick เปิดปิดตามเวลา

อ้างอิง : https://github.com/esp8266/Arduino#using-git-version
1.Download IDE (https://www.arduino.cc/en/Main/Software)
2.แตกไฟล์แล้วเข้าไปใน folder
3.ติดตั้งสิ่งที่จำเป็นเพิ่มเติมจาก terminal
  1. cd hardware
  2. mkdir esp8266com
  3. cd esp8266com
  4. git clone https://github.com/esp8266/Arduino.git esp8266
  5. cd esp8266/tools
  6. python get.py

4.restart Arduino
5.เพิ่มบอร์ดจากเมนู File > Preferences แล้วเพิ่ม http://arduino.esp8266.com/stable/packa ... index.json ตรงช่อง Additional Boards Manager URLs
6.เข้าเมนู Tools > Board... > Boards Manager แล้วค้นหา board ที่ต้องการ เช่น esp8266 แล้วคลิก install
7.เพิ่มสิทธิให้ user อ่าน/เขียน USB ได้ (http://playground.arduino.cc/Linux/All#Permission)
  1. usermod -a -G dialout username

*re-login


All Code Language Reference
https://www.arduino.cc/en/Reference/HomePage

Code : ต่อ WIFI
  1.  
  2. #include <ESP8266WiFi.h>
  3.  
  4. const char* ssid     = "SCI_EMP";
  5. const char* password = "619513b917";
  6.  
  7.  
  8. void setup() {
  9.   Serial.begin(115200);
  10.   delay(10);
  11.  
  12.   // We start by connecting to a WiFi network
  13.  
  14.   Serial.println();
  15.   Serial.println();
  16.   Serial.print("Connecting to ");
  17.   Serial.println(ssid);
  18.  
  19.   /* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
  20.      would try to act as both a client and an access-point and could cause
  21.      network-issues with your other WiFi-devices on your WiFi-network. */
  22.   WiFi.mode(WIFI_STA);
  23.   WiFi.begin(ssid, password);
  24.  
  25.   while (WiFi.status() != WL_CONNECTED) {
  26.     delay(500);
  27.     Serial.print(".");
  28.   }
  29.  
  30.   Serial.println("");
  31.   Serial.println("WiFi connected");  
  32.   Serial.println("IP address: ");
  33.   Serial.println(WiFi.localIP());
  34. }
  35.  
  36.  
  37. int value = 0;
  38.  
  39. void loop() {
  40.   delay(5000);
  41.   ++value;
  42.  
  43. } 

Code : ต่อ WIFI + NTP + Check Open Led

  1. #include <ESP8266WiFi.h>
  2. #include <time.h>
  3.  
  4. const char* ssid = "SCI_EMP";                
  5. const char* password = "619513b917";          
  6.  
  7. int timezone = 7 * 3600;                  
  8. int dst = 0;  
  9. //public variable.
  10. struct tm* p_tm ;
  11. int CountSec;
  12. int ContMin;
  13. int ContHour;      
  14.  
  15. void setup()
  16. {
  17.  Serial.begin(115200);
  18.  Serial.setDebugOutput(true);
  19.   pinMode(LED_BUILTIN, OUTPUT);
  20.  
  21.   WiFi.mode(WIFI_STA);                                        
  22.   WiFi.begin(ssid, password);
  23.   Serial.println("\nConnecting to WiFi");
  24.   while (WiFi.status() != WL_CONNECTED) {
  25.      Serial.print(",");
  26.      delay(1000);
  27.    }
  28.     //configTime(timezone, dst, "time.nist.gov");  
  29.     configTime(timezone, dst, "192.168.0.2");  
  30.     Serial.println("\nWaiting for time");
  31.     while (!time(nullptr)) {
  32.       Serial.print(".");
  33.       delay(1000);
  34.     }
  35.     Serial.println("");
  36.  
  37. //Keep time now.
  38. time_t now = time(nullptr);
  39. p_tm = localtime(&now);
  40.  
  41. CountSec = p_tm->tm_sec;
  42. ContMin = p_tm->tm_min;
  43. ContHour = p_tm->tm_hour;
  44.  
  45. }
  46.  
  47.        
  48. void loop()
  49. {
  50.  
  51.   /*configTime(timezone, dst, "pool.ntp.org", "time.nist.gov");  
  52.   time_t now = time(nullptr);
  53.   struct tm* p_tm = localtime(&now);
  54.   delay(1000);*/
  55.  
  56.   //time_t now = time(nullptr);
  57.   //struct tm* p_tm = localtime(&now);
  58.  
  59.   if(CountSec == 60){
  60.     CountSec = 0;
  61.     ContMin = ContMin + 1;    
  62.   }
  63.  
  64.   if(ContMin == 60){
  65.     ContMin = 0;
  66.     ContHour = ContHour + 1;    
  67.   }  
  68.  
  69.   if(ContHour == 24){
  70.     ContHour = 0;    
  71.   }
  72.  
  73.   if(ContHour == 0 && ContMin == 30){
  74.     time_t now = time(nullptr);
  75.     p_tm = localtime(&now);
  76.    
  77.     CountSec = p_tm->tm_sec;
  78.     ContMin = p_tm->tm_min;
  79.     ContHour = p_tm->tm_hour;  
  80.   }
  81.  
  82.   Serial.print("Hour = ");
  83.   Serial.print(ContHour);
  84.   Serial.println("");
  85.  
  86.   Serial.print("Min = ");
  87.   Serial.print(ContMin);
  88.   Serial.println("");
  89.  
  90.   Serial.print("Sec = ");
  91.   Serial.print(CountSec);
  92.   Serial.println("");
  93.  
  94.   /*Serial.print("Hour = ");
  95.   Serial.print(p_tm->tm_hour);
  96.   Serial.println("");
  97.  
  98.   Serial.print("Min = ");
  99.   Serial.print(p_tm->tm_min);
  100.   Serial.println("");
  101.  
  102.   Serial.print("Sec = ");
  103.   Serial.print(p_tm->tm_sec);
  104.   Serial.println("");*/
  105.  
  106.   //### Test ###//
  107.  
  108.   if((ContHour == 13) && (ContMin == 53) && (CountSec == 0)){
  109.     Serial.print("Open");
  110.     digitalWrite(LED_BUILTIN, HIGH);
  111.     delay(8000);
  112.     CountSec = CountSec + 8;
  113.    
  114.   }
  115.  
  116.   if((ContHour == 13) && (ContMin == 55) && (CountSec == 0)){
  117.     Serial.print("Open");
  118.     digitalWrite(LED_BUILTIN, HIGH);
  119.     delay(8000);
  120.     CountSec = CountSec + 8;
  121.    
  122.   }  
  123.  
  124.   //### Test ###//
  125.  
  126.   //0:00
  127.   if((ContHour == 0) && (ContMin == 0) && (CountSec == 0)){
  128.     Serial.print("Open");
  129.     digitalWrite(LED_BUILTIN, HIGH);
  130.     delay(8000);
  131.     CountSec = CountSec + 8;
  132.   }
  133.   //0:30
  134.   if((ContHour == 0) && (ContMin == 30) && (CountSec == 0)){
  135.     Serial.print("Open");
  136.     digitalWrite(LED_BUILTIN, HIGH);
  137.     delay(8000);
  138.     CountSec = CountSec + 8;
  139.   }
  140.   //5:30
  141.   if((ContHour == 5) && (ContMin == 30) && (CountSec == 0)){
  142.     Serial.print("Open");
  143.     digitalWrite(LED_BUILTIN, HIGH);
  144.     delay(8000);
  145.     CountSec = CountSec + 8;
  146.   }
  147.   //6:00
  148.   if((ContHour == 6) && (ContMin == 0) && (CountSec == 0)){
  149.     Serial.print("Open");
  150.     digitalWrite(LED_BUILTIN, HIGH);
  151.     delay(8000);
  152.     CountSec = CountSec + 8;
  153.   }
  154.   //7:50
  155.   if((ContHour == 7) && (ContMin == 50) && (CountSec == 0)){
  156.     Serial.print("Open");
  157.     digitalWrite(LED_BUILTIN, HIGH);
  158.     delay(8000);
  159.     CountSec = CountSec + 8;
  160.   }
  161.   //8:00
  162.   if((ContHour == 8) && (ContMin == 0) && (CountSec == 0)){
  163.     Serial.print("Open");
  164.     digitalWrite(LED_BUILTIN, HIGH);
  165.     delay(8000);
  166.     CountSec = CountSec + 8;
  167.   }
  168.  //10:20
  169.   if((ContHour == 10) && (ContMin == 20) && (CountSec == 0)){
  170.     Serial.print("Open");
  171.     digitalWrite(LED_BUILTIN, HIGH);
  172.     delay(8000);
  173.     CountSec = CountSec + 8;
  174.   }
  175.   //12:00
  176.   if((ContHour == 12) && (ContMin == 0) && (CountSec == 0)){
  177.     Serial.print("Open");
  178.     digitalWrite(LED_BUILTIN, HIGH);
  179.     delay(8000);
  180.     CountSec = CountSec + 8;
  181.   }
  182.   //12:50
  183.   if((ContHour == 12) && (ContMin == 50) && (CountSec == 0)){
  184.     Serial.print("Open");
  185.     digitalWrite(LED_BUILTIN, HIGH);
  186.     delay(8000);
  187.     CountSec = CountSec + 8;
  188.   }
  189.   //13:00
  190.   if((ContHour == 13) && (ContMin == 0) && (CountSec == 0)){
  191.     Serial.print("Open");
  192.     digitalWrite(LED_BUILTIN, HIGH);
  193.     delay(8000);
  194.     CountSec = CountSec + 8;
  195.   }
  196.   //17:40
  197.   if((ContHour == 17) && (ContMin == 40) && (CountSec == 0)){
  198.     Serial.print("Open");
  199.     digitalWrite(LED_BUILTIN, HIGH);
  200.     delay(8000);
  201.     CountSec = CountSec + 8;
  202.   }
  203.   //18:00
  204.   if((ContHour == 18) && (ContMin == 0) && (CountSec == 0)){
  205.     Serial.print("Open");
  206.     digitalWrite(LED_BUILTIN, HIGH);
  207.     delay(8000);
  208.     CountSec = CountSec + 8;
  209.   }
  210.   //21:00
  211.   if((ContHour == 21) && (ContMin == 0) && (CountSec == 0)){
  212.     Serial.print("Open");
  213.     digitalWrite(LED_BUILTIN, HIGH);
  214.     delay(8000);
  215.     CountSec = CountSec + 8;
  216.   }                
  217.          
  218.   digitalWrite(LED_BUILTIN, LOW);   // turn the LED on (HIGH is the voltage level)
  219.  
  220.   CountSec = CountSec + 1;
  221.   delay(1000);
  222. }


Code : ต่อ WIFI + NTP แบบ Loop Function
ต้องใช้ Timer.h ติดตั้งเพิ่มเติม
http://playground.arduino.cc/Code/Timer
Install :
You can download the library from here:
https://github.com/JChristensen/Timer

As with all libraries, unzip the file into the 'libraries' folder in your Arduino directory, which will be in something like 'My Documents\Arduino' on Windows, 'Documents/Arduino' on Mac etc. If this is the first library you have installed, you will need to create a directory there called 'libraries'.
  1. #include <ESP8266WiFi.h>
  2. #include <time.h>
  3. #include "Timer.h"
  4.  
  5. Timer t;
  6.  
  7. const char* ssid = "SCI_EMP";                
  8. const char* password = "619513b917";          
  9.  
  10. int timezone = 7 * 3600;                  
  11. int dst = 0;  
  12. //public variable.
  13. struct tm* p_tm ;
  14. int CountSec;
  15. int CountMin;
  16. int CountHour;      
  17.  
  18. void setup()
  19. {
  20.  Serial.begin(115200);
  21.  Serial.setDebugOutput(true);
  22.   pinMode(LED_BUILTIN, OUTPUT);
  23.  
  24.   WiFi.mode(WIFI_STA);                                        
  25.   WiFi.begin(ssid, password);
  26.   Serial.println("\nConnecting to WiFi");
  27.   while (WiFi.status() != WL_CONNECTED) {
  28.      Serial.print(",");
  29.      delay(1000);
  30.    }
  31.     //configTime(timezone, dst, "time.nist.gov");  
  32.     configTime(timezone, dst, "192.168.0.2");  
  33.     Serial.println("\nWaiting for time");
  34.     while (!time(nullptr)) {
  35.       Serial.print(".");
  36.       delay(1000);
  37.     }
  38.     Serial.println("");
  39.    
  40.  
  41.   //Keep time now.
  42.   time_t now = time(nullptr);
  43.   p_tm = localtime(&now);
  44.  
  45.   CountSec = p_tm->tm_sec;
  46.   CountMin = p_tm->tm_min;
  47.   CountHour = p_tm->tm_hour;
  48.  
  49.   int tickEvent = t.every(1000, loopTime);
  50.  
  51. }
  52.  
  53.        
  54. void loop()
  55. {
  56.   t.update();
  57. }
  58.  
  59.  
  60. void loopTime()
  61. {
  62.   CountSec = CountSec + 1;
  63.  
  64.   if(CountSec == 60){
  65.     CountSec = 0;
  66.     CountMin = CountMin + 1;  
  67.  
  68.     if(CountMin == 60){
  69.       CountMin = 0;
  70.       CountHour = CountHour + 1;    
  71.     }  
  72.  
  73.   }
  74.  
  75.   if(CountHour == 24){
  76.     CountHour = 0;    
  77.   }
  78.  
  79.   if(CountHour == 0 && CountMin == 30){
  80.     time_t now = time(nullptr);
  81.     p_tm = localtime(&now);
  82.    
  83.     CountSec = p_tm->tm_sec;
  84.     CountMin = p_tm->tm_min;
  85.     CountHour = p_tm->tm_hour;  
  86.   }
  87.  
  88.   Serial.print("Hour = ");
  89.   Serial.print(CountHour);
  90.   Serial.println("");
  91.  
  92.   Serial.print("Min = ");
  93.   Serial.print(CountMin);
  94.   Serial.println("");
  95.  
  96.   Serial.print("Sec = ");
  97.   Serial.print(CountSec);
  98.   Serial.println("");
  99.  
  100.  
  101.   //### Test ###//
  102.   if((CountHour == 8) && (CountMin == 45) && (CountSec == 0)){
  103.     Serial.print("Open");
  104.     digitalWrite(LED_BUILTIN, HIGH);
  105.     delay(8000);
  106.     CountSec = CountSec + 8;
  107.    
  108.   }
  109.  
  110.   if((CountHour == 8) && (CountMin == 46) && (CountSec == 0)){
  111.     Serial.print("Open");
  112.     digitalWrite(LED_BUILTIN, HIGH);
  113.     delay(8000);
  114.     CountSec = CountSec + 8;
  115.    
  116.   }  
  117.  
  118.   //### Test ###//
  119.  
  120.   //0:00
  121.   if((CountHour == 0) && (CountMin == 0) && (CountSec == 0)){
  122.     Serial.print("Open");
  123.     digitalWrite(LED_BUILTIN, HIGH);
  124.     delay(8000);
  125.     CountSec = CountSec + 8;
  126.   }
  127.   //0:30
  128.   if((CountHour == 0) && (CountMin == 30) && (CountSec == 0)){
  129.     Serial.print("Open");
  130.     digitalWrite(LED_BUILTIN, HIGH);
  131.     delay(8000);
  132.     CountSec = CountSec + 8;
  133.   }
  134.   //5:30
  135.   if((CountHour == 5) && (CountMin == 30) && (CountSec == 0)){
  136.     Serial.print("Open");
  137.     digitalWrite(LED_BUILTIN, HIGH);
  138.     delay(8000);
  139.     CountSec = CountSec + 8;
  140.   }
  141.   //6:00
  142.   if((CountHour == 6) && (CountMin == 0) && (CountSec == 0)){
  143.     Serial.print("Open");
  144.     digitalWrite(LED_BUILTIN, HIGH);
  145.     delay(8000);
  146.     CountSec = CountSec + 8;
  147.   }
  148.   //7:50
  149.   if((CountHour == 7) && (CountMin == 50) && (CountSec == 0)){
  150.     Serial.print("Open");
  151.     digitalWrite(LED_BUILTIN, HIGH);
  152.     delay(8000);
  153.     CountSec = CountSec + 8;
  154.   }
  155.   //8:00
  156.   if((CountHour == 8) && (CountMin == 0) && (CountSec == 0)){
  157.     Serial.print("Open");
  158.     digitalWrite(LED_BUILTIN, HIGH);
  159.     delay(8000);
  160.     CountSec = CountSec + 8;
  161.   }
  162.  //10:20
  163.   if((CountHour == 10) && (CountMin == 20) && (CountSec == 0)){
  164.     Serial.print("Open");
  165.     digitalWrite(LED_BUILTIN, HIGH);
  166.     delay(8000);
  167.     CountSec = CountSec + 8;
  168.   }
  169.   //12:00
  170.   if((CountHour == 12) && (CountMin == 0) && (CountSec == 0)){
  171.     Serial.print("Open");
  172.     digitalWrite(LED_BUILTIN, HIGH);
  173.     delay(8000);
  174.     CountSec = CountSec + 8;
  175.   }
  176.   //12:50
  177.   if((CountHour == 12) && (CountMin == 50) && (CountSec == 0)){
  178.     Serial.print("Open");
  179.     digitalWrite(LED_BUILTIN, HIGH);
  180.     delay(8000);
  181.     CountSec = CountSec + 8;
  182.   }
  183.   //13:00
  184.   if((CountHour == 13) && (CountMin == 0) && (CountSec == 0)){
  185.     Serial.print("Open");
  186.     digitalWrite(LED_BUILTIN, HIGH);
  187.     delay(8000);
  188.     CountSec = CountSec + 8;
  189.   }
  190.   //17:40
  191.   if((CountHour == 17) && (CountMin == 40) && (CountSec == 0)){
  192.     Serial.print("Open");
  193.     digitalWrite(LED_BUILTIN, HIGH);
  194.     delay(8000);
  195.     CountSec = CountSec + 8;
  196.   }
  197.   //18:00
  198.   if((CountHour == 18) && (CountMin == 0) && (CountSec == 0)){
  199.     Serial.print("Open");
  200.     digitalWrite(LED_BUILTIN, HIGH);
  201.     delay(8000);
  202.     CountSec = CountSec + 8;
  203.   }
  204.   //21:00
  205.   if((CountHour == 21) && (CountMin == 0) && (CountSec == 0)){
  206.     Serial.print("Open");
  207.     digitalWrite(LED_BUILTIN, HIGH);
  208.     delay(8000);
  209.     CountSec = CountSec + 8;
  210.   }                
  211.        
  212.   digitalWrite(LED_BUILTIN, LOW);   // turn the LED on (HIGH is the voltage level)
  213.    
  214. }
  215.  
  216.  

Code : WIFI+NTP+SonOff เปิดปิดตามเวลา
  1. #include <ESP8266WiFi.h>
  2. #include <time.h>
  3. #include "Timer.h"
  4.  
  5. Timer t;
  6. int pin = 12;
  7.  
  8. const char* ssid = "SCI_EMP";                
  9. const char* password = "619513b917";          
  10.  
  11. int timezone = 7 * 3600;                  
  12. int dst = 0;  
  13.  
  14. //public variable.
  15. struct tm* p_tm ;
  16. int CountSec;
  17. int CountMin;
  18. int CountHour;      
  19.  
  20. void setup()
  21. {
  22.  Serial.begin(115200);
  23.  Serial.setDebugOutput(true);
  24.  //pinMode(LED_BUILTIN, OUTPUT);
  25.  pinMode(pin, OUTPUT);
  26.  
  27.   WiFi.mode(WIFI_STA);                                        
  28.   WiFi.begin(ssid, password);
  29.   Serial.println("\nConnecting to WiFi");
  30.   while (WiFi.status() != WL_CONNECTED) {
  31.      Serial.print(",");
  32.      delay(1000);
  33.    }
  34.     //configTime(timezone, dst, "time.nist.gov");  
  35.     configTime(timezone, dst, "192.168.0.2");  
  36.     Serial.println("\nWaiting for time");
  37.     while (!time(nullptr)) {
  38.       Serial.print(".");
  39.       delay(1000);
  40.     }
  41.     Serial.println("");
  42.    
  43.  
  44.   //Keep time now.
  45.   time_t now = time(nullptr);
  46.   p_tm = localtime(&now);
  47.  
  48.   CountSec = p_tm->tm_sec;
  49.   CountMin = p_tm->tm_min;
  50.   CountHour = p_tm->tm_hour;
  51.  
  52.   int tickEvent = t.every(1000, loopTime);
  53. }
  54.  
  55.        
  56. void loop()
  57. {
  58.   t.update();
  59. }
  60.  
  61.  
  62. void loopTime()
  63. {
  64.   CountSec = CountSec + 1;
  65.  
  66.   if(CountSec == 60){
  67.     CountSec = 0;
  68.     CountMin = CountMin + 1;  
  69.  
  70.     if(CountMin == 60){
  71.       CountMin = 0;
  72.       CountHour = CountHour + 1;    
  73.     }  
  74.  
  75.   }
  76.  
  77.   if(CountHour == 24){
  78.     CountHour = 0;    
  79.   }
  80.  
  81.   // 12:30 Connet NTP New.
  82.   if(CountHour == 0 && CountMin == 30){
  83.     time_t now = time(nullptr);
  84.     p_tm = localtime(&now);
  85.    
  86.     CountSec = p_tm->tm_sec;
  87.     CountMin = p_tm->tm_min;
  88.     CountHour = p_tm->tm_hour;  
  89.   }
  90.  
  91.   Serial.print("Hour = ");
  92.   Serial.print(CountHour);
  93.   Serial.println("");
  94.  
  95.   Serial.print("Min = ");
  96.   Serial.print(CountMin);
  97.   Serial.println("");
  98.  
  99.   Serial.print("Sec = ");
  100.   Serial.print(CountSec);
  101.   Serial.println("");
  102.  
  103.  
  104.   //### Test ###//
  105.  /*
  106.   if(CountSec == 10){
  107.     digitalWrite(pin, HIGH);
  108.     delay(8000);
  109.   }
  110.  
  111.   if((CountHour == 8) && (CountMin == 56) && (CountSec == 0)){
  112.     Serial.print("Open");
  113.     digitalWrite(pin, HIGH);
  114.     delay(8000);
  115.     CountSec = CountSec + 8;
  116.    
  117.   }
  118.  
  119.   if((CountHour == 8) && (CountMin == 57) && (CountSec == 0)){
  120.     Serial.print("Open");
  121.     digitalWrite(pin, HIGH);
  122.     delay(8000);
  123.     CountSec = CountSec + 8;
  124.    
  125.   }  
  126.   */
  127.   //### Test ###//
  128.  
  129.   //0:00
  130.   if((CountHour == 0) && (CountMin == 0) && (CountSec == 0)){
  131.     Serial.print("Open");
  132.     digitalWrite(pin, HIGH);
  133.     delay(8000);
  134.     CountSec = CountSec + 8;
  135.   }
  136.   //0:30
  137.   if((CountHour == 0) && (CountMin == 30) && (CountSec == 0)){
  138.     Serial.print("Open");
  139.     digitalWrite(pin, HIGH);
  140.     delay(8000);
  141.     CountSec = CountSec + 8;
  142.   }
  143.   //5:30
  144.   if((CountHour == 5) && (CountMin == 30) && (CountSec == 0)){
  145.     Serial.print("Open");
  146.     digitalWrite(pin, HIGH);
  147.     delay(8000);
  148.     CountSec = CountSec + 8;
  149.   }
  150.   //6:00
  151.   if((CountHour == 6) && (CountMin == 0) && (CountSec == 0)){
  152.     Serial.print("Open");
  153.     digitalWrite(pin, HIGH);
  154.     delay(8000);
  155.     CountSec = CountSec + 8;
  156.   }
  157.   //7:50
  158.   if((CountHour == 7) && (CountMin == 50) && (CountSec == 0)){
  159.     Serial.print("Open");
  160.     digitalWrite(pin, HIGH);
  161.     delay(8000);
  162.     CountSec = CountSec + 8;
  163.   }
  164.   //8:00
  165.   if((CountHour == 8) && (CountMin == 0) && (CountSec == 0)){
  166.     Serial.print("Open");
  167.     digitalWrite(pin, HIGH);
  168.     delay(8000);
  169.     CountSec = CountSec + 8;
  170.   }
  171.  //10:20
  172.   if((CountHour == 10) && (CountMin == 20) && (CountSec == 0)){
  173.     Serial.print("Open");
  174.     digitalWrite(pin, HIGH);
  175.     delay(8000);
  176.     CountSec = CountSec + 8;
  177.   }
  178.   //12:00
  179.   if((CountHour == 12) && (CountMin == 0) && (CountSec == 0)){
  180.     Serial.print("Open");
  181.     digitalWrite(pin, HIGH);
  182.     delay(8000);
  183.     CountSec = CountSec + 8;
  184.   }
  185.   //12:50
  186.   if((CountHour == 12) && (CountMin == 50) && (CountSec == 0)){
  187.     Serial.print("Open");
  188.     digitalWrite(pin, HIGH);
  189.     delay(8000);
  190.     CountSec = CountSec + 8;
  191.   }
  192.   //13:00
  193.   if((CountHour == 13) && (CountMin == 0) && (CountSec == 0)){
  194.     Serial.print("Open");
  195.     digitalWrite(pin, HIGH);
  196.     delay(8000);
  197.     CountSec = CountSec + 8;
  198.   }
  199.   //17:40
  200.   if((CountHour == 17) && (CountMin == 40) && (CountSec == 0)){
  201.     Serial.print("Open");
  202.     digitalWrite(pin, HIGH);
  203.     delay(8000);
  204.     CountSec = CountSec + 8;
  205.   }
  206.   //18:00
  207.   if((CountHour == 18) && (CountMin == 0) && (CountSec == 0)){
  208.     Serial.print("Open");
  209.     digitalWrite(pin, HIGH);
  210.     delay(8000);
  211.     CountSec = CountSec + 8;
  212.   }
  213.   //21:00
  214.   if((CountHour == 21) && (CountMin == 0) && (CountSec == 0)){
  215.     Serial.print("Open");
  216.     digitalWrite(pin, HIGH);
  217.     delay(8000);
  218.     CountSec = CountSec + 8;
  219.   }  
  220.              
  221.   digitalWrite(pin, LOW);  
  222. }
  223.