提交
This commit is contained in:
@@ -229,6 +229,10 @@ public class HaiLiangLabelingDeviceDriver extends AbstractOpcDeviceDriver implem
|
|||||||
last_order = order;
|
last_order = order;
|
||||||
last_order_detail = order_detail;
|
last_order_detail = order_detail;
|
||||||
last_detail_qty = detail_qty;
|
last_detail_qty = detail_qty;
|
||||||
|
last_one_qty = one_qty;
|
||||||
|
last_labeling_index = labeling_index;
|
||||||
|
last_detail_qualified_qty = detail_qualified_qty;
|
||||||
|
detail_qty = last_detail_qty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ import com.spire.xls.Workbook;
|
|||||||
import com.spire.xls.Worksheet;
|
import com.spire.xls.Worksheet;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.nl.acs.config.AcsConfig;
|
||||||
|
import org.nl.acs.config.server.AcsConfigService;
|
||||||
import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver;
|
import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver;
|
||||||
import org.nl.acs.device_driver.hailiang.hailiang_labeling.HaiLiangLabelingDeviceDriver;
|
import org.nl.acs.device_driver.hailiang.hailiang_labeling.HaiLiangLabelingDeviceDriver;
|
||||||
import org.nl.acs.opc.DeviceAppService;
|
import org.nl.acs.opc.DeviceAppService;
|
||||||
@@ -65,6 +67,9 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
@Autowired
|
@Autowired
|
||||||
ProduceshiftorderdetailService produceshiftorderdetailService;
|
ProduceshiftorderdetailService produceshiftorderdetailService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AcsConfigService acsConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void autoInitial() throws Exception {
|
public void autoInitial() throws Exception {
|
||||||
this.reload();
|
this.reload();
|
||||||
@@ -310,6 +315,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
WQLObject wo = WQLObject.getWQLObject("acs_produceshiftorder");
|
||||||
JSONObject json = (JSONObject) JSONObject.toJSON(orderDto);
|
JSONObject json = (JSONObject) JSONObject.toJSON(orderDto);
|
||||||
wo.insert(json);
|
wo.insert(json);
|
||||||
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -498,7 +504,7 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!StrUtil.equals(entity.getOrder_id(), "07") && !StrUtil.equals(entity.getOrder_id(), "08") && !StrUtil.equals(entity.getOrder_id(), "09")) {
|
if (!StrUtil.equals(entity.getOrder_status(), "07") && !StrUtil.equals(entity.getOrder_status(), "08") && !StrUtil.equals(entity.getOrder_status(), "09")) {
|
||||||
order.add(entity);
|
order.add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -539,9 +545,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!StrUtil.equals(entity.getOrder_id(), "07") && !StrUtil.equals(entity.getOrder_id(), "08") && !StrUtil.equals(entity.getOrder_id(), "09")) {
|
if (!StrUtil.equals(entity.getOrder_status(), "07") && !StrUtil.equals(entity.getOrder_status(), "08") && !StrUtil.equals(entity.getOrder_status(), "09")) {
|
||||||
order.add(entity);
|
order.add(entity);
|
||||||
}
|
}
|
||||||
|
produceshiftorderdetailService.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -644,9 +651,10 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
jo.put("inspector",detaildto.getInspector());
|
jo.put("inspector",detaildto.getInspector());
|
||||||
jo.put("mg_weight",detaildto.getMg_weight());
|
jo.put("mg_weight",detaildto.getMg_weight());
|
||||||
//打印纸张大小
|
//打印纸张大小
|
||||||
//1cm = 118px
|
jo.put("page_length","500");
|
||||||
jo.put("page_length",590);
|
jo.put("page_height","400");
|
||||||
jo.put("page_height",472);
|
jo.put("labeling_template",detaildto.getLabeling_template());
|
||||||
|
|
||||||
print(jo);
|
print(jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1000,81 +1008,117 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Boolean print(JSONObject whereJson) {
|
public Boolean print(JSONObject whereJson) {
|
||||||
String order_id = whereJson.getString("order_id");
|
// String order_id = whereJson.getString("order_id");
|
||||||
String template_id = whereJson.getString("template_id");
|
// String template_id = whereJson.getString("template_id");
|
||||||
|
//
|
||||||
|
// WQLObject mst = WQLObject.getWQLObject("acs_produceshiftorder"); // 主表
|
||||||
|
//
|
||||||
|
// // 1.根据明细找主表
|
||||||
|
// JSONObject jsonMst = mst.query("order_id = '" + order_id + "' and is_deleted ='0'").uniqueResult(0);
|
||||||
|
//
|
||||||
|
// // 2.根据明细template_id 找到对应的模板
|
||||||
|
// JSONObject jsonStor = WQL.getWO("QPRODUCESHIFTORDER").addParam("flag", "3").addParam("storage_id", template_id).process().uniqueResult(0);
|
||||||
|
//
|
||||||
|
// // 3.创建模板工作簿 并指定储存路径
|
||||||
|
// String path = jsonStor.getString("path");
|
||||||
|
// String pathName = whereJson.getString("url");
|
||||||
|
// ExcelWriter workBook = EasyExcel.write(pathName).withTemplate(path).build();
|
||||||
|
// // 获取第一个sheet
|
||||||
|
// WriteSheet sheet = EasyExcel.writerSheet().build();
|
||||||
|
//
|
||||||
|
// // 4.将主表当中的属性填充到excel当中
|
||||||
|
// HashMap<String, String> map = new HashMap<>();
|
||||||
|
// map.put("alloy",whereJson.getString("alloy"));
|
||||||
|
// map.put("temper",whereJson.getString("temper"));
|
||||||
|
// map.put("material_spec",whereJson.getString("material_spec"));
|
||||||
|
// map.put("number",whereJson.getString("number"));
|
||||||
|
// map.put("outer_diameter",whereJson.getString("outer_diameter"));
|
||||||
|
// map.put("standard",whereJson.getString("standard"));
|
||||||
|
// map.put("batch",whereJson.getString("batch"));
|
||||||
|
// map.put("prod_date",whereJson.getString("prod_date"));
|
||||||
|
// map.put("present_strap_pack_number",whereJson.getString("present_strap_pack_number"));
|
||||||
|
// map.put("inspector",whereJson.getString("inspector"));
|
||||||
|
// map.put("mg_weight",whereJson.getString("mg_weight"));
|
||||||
|
// workBook.fill(map, sheet);
|
||||||
|
// workBook.finish();
|
||||||
|
// Book book=new Book();
|
||||||
|
// Workbook loDoc = new Workbook();
|
||||||
|
// loDoc.loadFromFile(pathName);
|
||||||
|
// Worksheet worksheet = loDoc.getWorksheets().get(0);
|
||||||
|
// PageSetup pageSetup = worksheet.getPageSetup();
|
||||||
|
// String printArea="A2:B8";
|
||||||
|
// pageSetup.setPrintArea(printArea);
|
||||||
|
// pageSetup.setLeftMargin(0);
|
||||||
|
// pageSetup.setRightMargin(0);
|
||||||
|
// pageSetup.setTopMargin(0);
|
||||||
|
// pageSetup.setBottomMargin(0);
|
||||||
|
// CellRange cellRanges = worksheet.getCellRange(printArea);
|
||||||
|
// int height=0;
|
||||||
|
// for (CellRange row : cellRanges.getRows()) {
|
||||||
|
// height+= worksheet.getRowHeightPixels(row.getRow());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// int width=0;
|
||||||
|
// for (CellRange column : cellRanges.getColumns()) {
|
||||||
|
// width+=worksheet.getColumnWidthPixels(column.getColumn());
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
|
||||||
|
// PageFormat loPageFormat = loPrinterJob.defaultPage();
|
||||||
|
// Paper loPaper = loPageFormat.getPaper();
|
||||||
|
//
|
||||||
|
// loPaper.setImageableArea(0, 0, loPageFormat.getWidth(), loPageFormat.getHeight());
|
||||||
|
//
|
||||||
|
// String page_height = whereJson.getString("page_height");
|
||||||
|
// String page_length = whereJson.getString("page_length");
|
||||||
|
//
|
||||||
|
// loPaper.setSize(Double.parseDouble(page_length),Double.parseDouble(page_height));
|
||||||
|
//// loPaper.setSize(width/96.0*72,height/96.0*72);
|
||||||
|
// loPageFormat.setPaper(loPaper);
|
||||||
|
// loPrinterJob.setCopies(1);
|
||||||
|
// loPrinterJob.setPrintable(loDoc, loPageFormat);
|
||||||
|
// book.append(loDoc,loPageFormat);
|
||||||
|
// loPrinterJob.setPageable(book);
|
||||||
|
// try {
|
||||||
|
// // 执行打印
|
||||||
|
// loPrinterJob.print();
|
||||||
|
// } catch (PrinterException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
|
|
||||||
WQLObject mst = WQLObject.getWQLObject("acs_produceshiftorder"); // 主表
|
String url = acsConfigService.findConfigFromCache().get(AcsConfig.PRINTURL);
|
||||||
|
String printName = acsConfigService.findConfigFromCache().get(AcsConfig.PRINTNAME);
|
||||||
// 1.根据明细找主表
|
String labeling_template = whereJson.get("labeling_template").toString();
|
||||||
JSONObject jsonMst = mst.query("order_id = '" + order_id + "' and is_deleted ='0'").uniqueResult(0);
|
String alloy = whereJson.getString("alloy");
|
||||||
|
String temper = whereJson.getString("temper");
|
||||||
// 2.根据明细template_id 找到对应的模板
|
String material_spec =whereJson.getString("material_spec");
|
||||||
JSONObject jsonStor = WQL.getWO("QPRODUCESHIFTORDER").addParam("flag", "3").addParam("storage_id", template_id).process().uniqueResult(0);
|
String number = whereJson.getString("number");
|
||||||
|
String outer_diameter= whereJson.getString("outer_diameter");
|
||||||
// 3.创建模板工作簿 并指定储存路径
|
String standard = whereJson.getString("standard");
|
||||||
String path = jsonStor.getString("path");
|
String batch = whereJson.getString("batch");
|
||||||
String pathName = whereJson.getString("url");
|
String prod_date = whereJson.getString("prod_date");
|
||||||
ExcelWriter workBook = EasyExcel.write(pathName).withTemplate(path).build();
|
String present_strap_pack_number= whereJson.getString("present_strap_pack_number");
|
||||||
// 获取第一个sheet
|
String inspector = whereJson.getString("inspector");
|
||||||
WriteSheet sheet = EasyExcel.writerSheet().build();
|
String mg_weight = whereJson.getString("mg_weight");
|
||||||
|
Process printProcess;
|
||||||
// 4.将主表当中的属性填充到excel当中
|
try
|
||||||
HashMap<String, String> map = new HashMap<>();
|
{
|
||||||
map.put("alloy",whereJson.getString("alloy"));
|
printProcess = Runtime
|
||||||
map.put("temper",whereJson.getString("temper"));
|
.getRuntime()
|
||||||
map.put("material_spec",whereJson.getString("material_spec"));
|
.exec(new String[] {
|
||||||
map.put("number",whereJson.getString("number"));
|
url,
|
||||||
map.put("outer_diameter",whereJson.getString("outer_diameter"));
|
"PrinterName=" + printName,
|
||||||
map.put("standard",whereJson.getString("standard"));
|
"LabelName=Label" + labeling_template + ".ct",
|
||||||
map.put("batch",whereJson.getString("batch"));
|
"alloy="+ alloy ,"temper="+temper,"size="+material_spec,"pcs="+number,"outer_diameter="+outer_diameter,
|
||||||
map.put("prod_date",whereJson.getString("prod_date"));
|
"standard="+standard, "batch="+batch,"prod_date="+prod_date,"present_strap_pack_number="+present_strap_pack_number,
|
||||||
map.put("present_strap_pack_number",whereJson.getString("present_strap_pack_number"));
|
"inspector="+inspector,"mg_weight="+mg_weight});
|
||||||
map.put("inspector",whereJson.getString("inspector"));
|
|
||||||
map.put("mg_weight",whereJson.getString("mg_weight"));
|
|
||||||
workBook.fill(map, sheet);
|
|
||||||
workBook.finish();
|
|
||||||
|
|
||||||
Book book=new Book();
|
|
||||||
Workbook loDoc = new Workbook();
|
|
||||||
loDoc.loadFromFile(pathName);
|
|
||||||
Worksheet worksheet = loDoc.getWorksheets().get(0);
|
|
||||||
PageSetup pageSetup = worksheet.getPageSetup();
|
|
||||||
String printArea="A2:B8";
|
|
||||||
pageSetup.setPrintArea(printArea);
|
|
||||||
pageSetup.setLeftMargin(0);
|
|
||||||
pageSetup.setRightMargin(0);
|
|
||||||
pageSetup.setTopMargin(0);
|
|
||||||
pageSetup.setBottomMargin(0);
|
|
||||||
CellRange cellRanges = worksheet.getCellRange(printArea);
|
|
||||||
int height=0;
|
|
||||||
for (CellRange row : cellRanges.getRows()) {
|
|
||||||
height+= worksheet.getRowHeightPixels(row.getRow());
|
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
int width=0;
|
{
|
||||||
for (CellRange column : cellRanges.getColumns()) {
|
|
||||||
width+=worksheet.getColumnWidthPixels(column.getColumn());
|
|
||||||
}
|
|
||||||
|
|
||||||
PrinterJob loPrinterJob = PrinterJob.getPrinterJob();
|
|
||||||
PageFormat loPageFormat = loPrinterJob.defaultPage();
|
|
||||||
Paper loPaper = loPageFormat.getPaper();
|
|
||||||
|
|
||||||
loPaper.setImageableArea(0, 0, loPageFormat.getWidth(), loPageFormat.getHeight());
|
|
||||||
|
|
||||||
loPaper.setSize(142,113);
|
|
||||||
// loPaper.setSize(width/96.0*72,height/96.0*72);
|
|
||||||
loPageFormat.setPaper(loPaper);
|
|
||||||
loPrinterJob.setCopies(1);
|
|
||||||
loPrinterJob.setPrintable(loDoc, loPageFormat);
|
|
||||||
book.append(loDoc,loPageFormat);
|
|
||||||
loPrinterJob.setPageable(book);
|
|
||||||
try {
|
|
||||||
// 执行打印
|
|
||||||
loPrinterJob.print();
|
|
||||||
} catch (PrinterException e) {
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
System.out.println("aaa");
|
||||||
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -206,7 +206,7 @@ public class ProduceshiftorderdetailServiceImpl implements Produceshiftorderdeta
|
|||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void reload() {
|
public synchronized void reload() {
|
||||||
this.detail = this.queryAllOrderDteail(" (order_detail_status != '05' and and order_detail_status != '06' and order_detail_status != '07') and is_deleted =0 order by order_detail_code");
|
this.detail = this.queryAllOrderDteail(" (order_detail_status != '05' and order_detail_status != '06' and order_detail_status != '07') and is_deleted =0 order by order_detail_code");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ public class Test {
|
|||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
Process printProcess;
|
Process printProcess;
|
||||||
String printName ="PDF24";
|
String printName ="Zebra ZE500-4 RH (300 dpi)";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
printProcess = Runtime
|
printProcess = Runtime
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user