weightChannelPrint method

Future<bool> weightChannelPrint(
  1. WeighPrintModel weighPrintModel
)

Implementation

static Future<bool> weightChannelPrint(WeighPrintModel weighPrintModel)  {


    //打印机状态正常
    //拼接打印参数
    HashMap hashMap = HashMap<String, String>();
    //标题
    hashMap.putIfAbsent(WeightConstants.PRINT_PARAM_TITLE, () => weighPrintModel?.skuName??'');
    //规格
    hashMap.putIfAbsent(
        WeightConstants.PRINT_PARAM_SPEC, () => weighPrintModel?.skuSpec??'');
    //净重
    hashMap.putIfAbsent(
        WeightConstants.PRINT_PARAM_NET_WEIGHT, () => weighPrintModel?.netWeigh??'');

    //生产时间
    String time = weighPrintModel?.createTime ?? '';
    String yyyy_MM_dd = '';
    String yyyyMMdd = '';
    //打印时间(必须是yyyyMMdd)
    if(weighPrintModel.createTime!=null){
      //当前获取到的是yyyy-MM-dd HH:mm:ss
      //打印时间(必须是YYYYMMDD)

      if (time.length >= 10) {
        yyyy_MM_dd = time.substring(0, 10);
        yyyyMMdd = yyyy_MM_dd.replaceAll('-', '');
      }
    }
    hashMap.putIfAbsent(WeightConstants.PRINT_PARAM_TIME, () => yyyyMMdd);

    // //包装时间
    // String packageTime = weighPrintModel?.packageTime ?? '';
    // String packageTime_yyyy_MM_dd = '';
    // String packageTime_yyyyMMdd = '';
    // //打印时间(必须是yyyyMMdd)
    // if(weighPrintModel.createTime!=null){
    //   //当前获取到的是yyyy-MM-dd HH:mm:ss
    //   //打印时间(必须是YYYYMMDD)
    //
    //   if (time.length >= 10) {
    //     packageTime_yyyy_MM_dd = packageTime.substring(0, 10);
    //     packageTime_yyyyMMdd = packageTime_yyyy_MM_dd.replaceAll('-', '');
    //   }
    // }
    // hashMap.putIfAbsent(WeightConstants.PRINT_PARAM_PACKAGE_TIME, () => packageTime_yyyyMMdd);

//
// //批次号
//     hashMap.putIfAbsent(
//         WeightConstants.PRINT_PARAM_BATCH_CODE, () => weighPrintModel?.batchCode??'');

  //存储条件
    hashMap.putIfAbsent(
        WeightConstants.PRINT_PARAM_STORE_CONDITION, () => weighPrintModel?.storeCondition??'');
    //原料码
    hashMap.putIfAbsent(
        WeightConstants.PRINT_PARAM_MATERIAL_CODE, () => weighPrintModel?.materialCode??'');
    //SKU码
    hashMap.putIfAbsent(
        WeightConstants.PRINT_PARAM_SKU_CODE, () => weighPrintModel?.skuCode??'');
    //唯一码
    hashMap.putIfAbsent(
        WeightConstants.PRINT_PARAM_PACKAGE_NUM, () => weighPrintModel?.snCode??'');
  //是否打印称重
  hashMap.putIfAbsent(
      WeightConstants.PRINT_PARAM_WEIGHT_REFUND_FLAG, () => weighPrintModel?.weightRefundFlag??'');


  //开始打印
 return  Weight.weightChannelPrintBitmap(hashMap);


}