fyxc
2025-05-22 09fcc4ec56a1ce6c0fcb308348d8dd5e2c08d336
src/main/java/com/zy/asrs/utils/Utils.java
@@ -18,29 +18,31 @@
import com.zy.core.model.protocol.ShuttleProtocol;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.ShuttleThread;
import java.text.DecimalFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
public class Utils {
    private static final DecimalFormat fmt = new DecimalFormat("##0.00");
    public static float scale(Float f){
    public static float scale(Float f) {
        if (f == null || f == 0f || Float.isNaN(f)) {
            return 0f;
        }
        return (float) Arith.multiplys(2, f, 1);
    }
    public static String zerofill(String msg, Integer count){
        if (msg.length() == count){
    public static String zerofill(String msg, Integer count) {
        if (msg.length() == count) {
            return msg;
        } else if (msg.length() > count){
        } else if (msg.length() > count) {
            return msg.substring(0, 16);
        } else {
            StringBuilder msgBuilder = new StringBuilder(msg);
            for (int i = 0; i<count-msg.length(); i++){
                msgBuilder.insert(0,"0");
            for (int i = 0; i < count - msg.length(); i++) {
                msgBuilder.insert(0, "0");
            }
            return msgBuilder.toString();
        }