This commit is contained in:
2022-12-03 09:37:21 +08:00
3 changed files with 60 additions and 24 deletions

View File

@@ -45,6 +45,7 @@ public class PrintServiceImpl implements PrintService {
public JSONObject customerPrint(JSONObject whereJson) {
JSONObject jo = new JSONObject();
WQLObject printTab = WQLObject.getWQLObject("pdm_bi_printinfo");
WQLObject custTab = WQLObject.getWQLObject("md_cs_customerbase");
String box_no = whereJson.getString("box_no");
@@ -87,6 +88,13 @@ public class PrintServiceImpl implements PrintService {
//储存条件
String storage_conditions = "";
// 根据客户条件选择对应模板
JSONObject jsonCust = custTab.query("cust_code = '" + box_jo.getString("customer_name") + "' and is_delete = '0' and is_used = '1'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonCust)) throw new BadRequestException("客户不存在或未启用");
if (ObjectUtil.isEmpty(jsonCust.getString("bz_print_no"))) throw new BadRequestException("请先设置客户打印模板");
String bz_print_no = jsonCust.getString("bz_print_no");
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++) {
@@ -107,9 +115,10 @@ public class PrintServiceImpl implements PrintService {
fw = new FileWriter(filePath);
OutputStreamWriter write = new OutputStreamWriter(new FileOutputStream(file), "utf-8");
BufferedWriter bw = new BufferedWriter(write);
bw.write("package_box_sn1,package_box_sn2,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");
bw.write("bz_print_no,package_box_sn1,package_box_sn2,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,customer_name,customer_description,thickness,mass_per_unit_area,length,box_type,sap_pcsn,box_length,box_width,box_high\n");
bw.write(package_box_sn1 + ","
bw.write(bz_print_no + ","
+package_box_sn1 + ","
+ package_box_sn2 + ","
+ sale_order_name + ","
+ product_description + ","
@@ -123,7 +132,17 @@ public class PrintServiceImpl implements PrintService {
+ quality_guaran_period + ","
+ nspector + ","
+ storage_conditions + ","
+ NumberUtil.round(weight,2).toString() + ",\n"
+ NumberUtil.round(weight,2).toString() + ","
+ box_jo.getString("customer_name") + ","
+ box_jo.getString("customer_description") + ","
+ box_jo.getString("thickness") + ","
+ box_jo.getString("mass_per_unit_area") + ","
+ box_jo.getString("length") + ","
+ box_jo.getString("box_type") + ","
+ box_jo.getString("sap_pcsn") + ","
+ box_jo.getString("box_length") + ","
+ box_jo.getString("box_width") + ","
+ box_jo.getString("box_high") + "\n"
);
bw.close();

View File

@@ -152,17 +152,7 @@
IF 输入.flag = "5"
QUERY
SELECT
sub.package_box_sn,
sub.quanlity_in_box,
sub.box_weight,
sub.sale_order_name,
sub.product_name,
sub.product_description,
sub.width,
sub.container_name,
sub.net_weight,
sub.date_of_FG_inbound,
sub.date_of_production
*
FROM
pdm_bi_subpackagerelation sub
WHERE