diff --git a/lms/nladmin-system/pom.xml b/lms/nladmin-system/pom.xml
index b4c1322f2..470acd41e 100644
--- a/lms/nladmin-system/pom.xml
+++ b/lms/nladmin-system/pom.xml
@@ -373,6 +373,13 @@
poi-ooxml-schemas
3.17
+
+
+
+ jcifs
+ jcifs
+ 1.3.17
+
diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java
index b6f924c41..4d85e9ed7 100644
--- a/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java
+++ b/lms/nladmin-system/src/main/java/org/nl/wms/pda/st/service/impl/PrintServiceImpl.java
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import jcifs.smb.SmbFile;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.modules.common.exception.BadRequestException;
@@ -45,58 +46,65 @@ public class PrintServiceImpl implements PrintService {
public JSONObject customerPrint(JSONObject whereJson) {
JSONObject jo = new JSONObject();
- String box_no = whereJson.getString("box_no");
+ String box_no = whereJson.getString("box_no");
- JSONObject box_jo = WQL.getWO("PDA_ST_01").addParam("flag", "5").addParam("box_no", box_no).process().uniqueResult(0);
+ JSONObject box_jo = WQL.getWO("PDA_ST_01").addParam("flag", "5").addParam("box_no", box_no).process().uniqueResult(0);
- if (ObjectUtil.isEmpty(box_jo)) {
- throw new BadRequestException("未查询到木箱相关信息!");
- }
+ if (ObjectUtil.isEmpty(box_jo)) {
+ throw new BadRequestException("未查询到木箱相关信息!");
+ }
- //组织木箱打印信息
- //箱号
- String package_box_sn = box_jo.getString("package_box_sn");
- //订单号
- String sale_order_name = box_jo.getString("sale_order_name");
- //品名
- String product_description = box_jo.getString("product_description");
- //物料号
- String product_name = box_jo.getString("product_name");
- //规格
- String width = box_jo.getString("width");
- //批号
- String pcsn = "";
+ //组织木箱打印信息
+ //箱号
+ String package_box_sn = box_jo.getString("package_box_sn");
+ //订单号
+ String sale_order_name = box_jo.getString("sale_order_name");
+ //品名
+ String product_description = box_jo.getString("product_description");
+ //物料号
+ String product_name = box_jo.getString("product_name");
+ //规格
+ String width = box_jo.getString("width");
+ //批号
+ String pcsn = "";
- //入库日期
- String date_of_FG_inbound = box_jo.getString("date_of_FG_inbound");
- //毛重
- String box_weight = box_jo.getString("box_weight");
- //生产日期
- String date_of_production = box_jo.getString("date_of_production");
- //卷数
- String quanlity_in_box = box_jo.getString("quanlity_in_box");
- //保质期
- String quality_guaran_period = box_jo.getString("quality_guaran_period");
- //检验员
- String nspector = "";
- //储存条件
- String storage_conditions = "";
+ //入库日期
+ String date_of_FG_inbound = box_jo.getString("date_of_FG_inbound");
+ //毛重
+ String box_weight = box_jo.getString("box_weight");
+ //生产日期
+ String date_of_production = box_jo.getString("date_of_production");
+ //卷数
+ String quanlity_in_box = box_jo.getString("quanlity_in_box");
+ //保质期
+ String quality_guaran_period = box_jo.getString("quality_guaran_period");
+ //检验员
+ String nspector = "";
+ //储存条件
+ String storage_conditions = "";
- double weight = 0;
- JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag", "5").addParam("box_no", box_no).process().getResultJSONArray(0);
- for (int i = 0; i < rows.size(); i++) {
- JSONObject row = rows.getJSONObject(i);
- weight += row.getDoubleValue("net_weight");
- }
+ double weight = 0;
+ JSONArray rows = WQL.getWO("PDA_ST_01").addParam("flag", "5").addParam("box_no", box_no).process().getResultJSONArray(0);
+ for (int i = 0; i < rows.size(); i++) {
+ JSONObject row = rows.getJSONObject(i);
+ weight += row.getDoubleValue("net_weight");
+ }
- // 生成txt文件
- String filePath = "//10.1.3.21" + "/LMSPrinter" + "外包标签.txt";
- FileWriter fw = null;
+ // 生成txt文件
+ String filePath = "smb://10.1.3.21" + "/LMSPrinter" + "外包标签.txt";
+ FileWriter fw = null;
try {
- File file = new File(filePath);
+ /* File file = new File(filePath);
if (!file.exists()) {
+ // 判断此文件是否存在 不存在则创建 存在则覆盖
+ file.createNewFile();
+ }*/
+ SmbFile file = new SmbFile(filePath);
+ if (!file.exists()) {
+ // 判断此文件是否存在 不存在则创建 存在则覆盖
file.createNewFile();
}
+
fw = new FileWriter(filePath);
BufferedWriter bw = new BufferedWriter(fw);
bw.write("package_box_sn,sale_order_name,product_description,product_name,width,pcsn,date_of_FG_inbound,box_weight,date_of_production,quanlity_in_box,quality_guaran_period,nspector,storage_conditions,weight\n");
@@ -119,15 +127,18 @@ public class PrintServiceImpl implements PrintService {
bw.close();
} catch (Exception e) {
- jo.put("message", "打印失败!"+e.getMessage());
+ jo.put("message", "打印失败!" + e.getMessage());
+ return jo;
} finally {
try {
fw.close();
} catch (Exception e) {
- jo.put("message", "打印失败!"+e.getMessage());
+ jo.put("message", "打印失败!" + e.getMessage());
}
}
jo.put("message", "打印成功!");
return jo;
}
+
+
}