let in_process = global.get(‘in_process’);if (in_process == false){ let total = msg.payload[5]; let good = msg.payload[6]; msg.payload = Math.floor((good / total) * 100); return msg;}
Register 40108 could be defined as any of these 16-bit data types: A 16-bit unsigned integer (a whole number between 0 and 65535) register 40108 contains AE41 = 44,609 (hex to decimal conversion)
A 16-bit signed integer (a whole number between -32768 and 32767) AE41 = -20,927 (hex to decimal conversion that wraps, if its over 32767 then subtract 65536)
A two character ASCII string (2 typed letters) AE41 = ® A
A discrete on/off value (this works the same as 16-bit integers with a value of 0 or 1. The hex data would be 0000 or 0001)
Register 40108 could also be combined with 40109 to form any of these 32-bit data types: A 32-bit unsigned integer (a number between 0 and 4,294,967,295) 40108,40109 = AE41 5652 = 2,923,517,522
A 32-bit signed integer (a number between -2,147,483,648 and 2,147,483,647) AE41 5652 = -1,371,449,774
A 32-bit single precision IEEE floating point number. This is a mathematical formula that allows any real number (a number with decimal points) to represented by 32 bits with an accuracy of about seven digits. AE41 5652 = -4.395978 E-11
Here is a spreadsheet IEEE float calculator for inputs of 4 bytes or 2 words. To download a copy, right click and select Save Target As…
A four character ASCII string (4 typed letters) AE41 5652 = ® A V R
More registers can be combined to form longer ASCII strings. Each register being used to store two ASCII characters (two bytes).
msg.topic = “select concat(lastname, firstname) as ‘客戶名稱’, order_id as ‘訂單編號’, total as ‘金額’, date_added as ‘下單日期’ from oc_order where order_status_id =1”;
return msg;
var msg1 = {}
msg1.payload = msg.payload
msg1.topic = “select oc_order_product.name as ‘產品名稱’, oc_order_product.quantity as ‘數量’, oc_product_attribute.text as ‘蓋印次數’ \
from oc_order_product \
join oc_product_attribute on oc_order_product.product_id = oc_product_attribute.product_id \
join oc_attribute_description on oc_product_attribute.attribute_id = oc_attribute_description.attribute_id \
where oc_order_product.order_id = ” + msg.payload[“訂單編號”] + “”
msg.topic = “select concat(lastname, firstname) as ‘客戶名稱’, order_id as ‘訂單編號’, total as ‘金額’, date_added as ‘下單日期’ from oc_order where order_status_id =17”;
return msg;
msg.topic = “select concat(lastname, firstname) as ‘客戶名稱’, order_id as ‘訂單編號’, total as ‘金額’, date_added as ‘下單日期’ from oc_order where order_status_id =17”;