fix 入窑流程和大屏数据
This commit is contained in:
@@ -273,16 +273,14 @@ public class LnshOutKilnTrussDeviceDriver extends AbstractOpcDeviceDriver implem
|
|||||||
if (result.getStatus() == HttpStatus.OK.value()) {
|
if (result.getStatus() == HttpStatus.OK.value()) {
|
||||||
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
JSONObject jsonObject = JSONObject.parseObject(result.body());
|
||||||
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
if (ObjectUtil.isNotEmpty(jsonObject) && "200".equals(jsonObject.getString("status"))) {
|
||||||
Boolean isPackage = jsonObject.getBoolean("data");
|
|
||||||
if (isPackage == null) {
|
|
||||||
this.writing(24);
|
|
||||||
} else {
|
|
||||||
// this.writing(isPackage ? 22 : 23);
|
// this.writing(isPackage ? 22 : 23);
|
||||||
//全部都是优先出窑
|
//全部都是优先出窑
|
||||||
this.writing(22);
|
this.writing(22);
|
||||||
}
|
|
||||||
this.setRequireSucess(true);
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
this.writing(24);
|
||||||
|
this.setRequireSucess(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -214,6 +214,7 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_putStation, "当前工位", "DB1.D4"));
|
list.add(new ItemDto(item_putStation, "当前工位", "DB1.D4"));
|
||||||
list.add(new ItemDto(item_material, "物料", "DB1.STRING8.50"));
|
list.add(new ItemDto(item_material, "物料", "DB1.STRING8.50"));
|
||||||
list.add(new ItemDto(item_qty, "拆/码垛数量", "DB1.D60"));
|
list.add(new ItemDto(item_qty, "拆/码垛数量", "DB1.D60"));
|
||||||
|
//砖块重量
|
||||||
list.add(new ItemDto(item_order_qty, "工单总数量", "DB1.D64"));
|
list.add(new ItemDto(item_order_qty, "工单总数量", "DB1.D64"));
|
||||||
list.add(new ItemDto(item_open_time, "开机时间", "DB1.STRING68.50"));
|
list.add(new ItemDto(item_open_time, "开机时间", "DB1.STRING68.50"));
|
||||||
list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D120"));
|
list.add(new ItemDto(item_standby_time, "待机时间", "DB1.D120"));
|
||||||
@@ -235,6 +236,7 @@ public class ItemProtocol {
|
|||||||
list.add(new ItemDto(item_to_error, "故障代码", "DB2.W2"));
|
list.add(new ItemDto(item_to_error, "故障代码", "DB2.W2"));
|
||||||
list.add(new ItemDto(item_to_material, "物料", "DB2.STRING4.50"));
|
list.add(new ItemDto(item_to_material, "物料", "DB2.STRING4.50"));
|
||||||
list.add(new ItemDto(item_to_order_No, "工单号", "DB2.STRING56.50"));
|
list.add(new ItemDto(item_to_order_No, "工单号", "DB2.STRING56.50"));
|
||||||
|
//下发重量
|
||||||
list.add(new ItemDto(item_to_order_qty, "工单数量", "DB2.D108"));
|
list.add(new ItemDto(item_to_order_qty, "工单数量", "DB2.D108"));
|
||||||
list.add(new ItemDto(item_to_product_code, "产品编号", "DB2.W112"));
|
list.add(new ItemDto(item_to_product_code, "产品编号", "DB2.W112"));
|
||||||
list.add(new ItemDto(item_to_AlongSide, "A长边", "DB2.W114"));
|
list.add(new ItemDto(item_to_AlongSide, "A长边", "DB2.W114"));
|
||||||
|
|||||||
@@ -262,6 +262,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
|
|
||||||
JSONObject json = orders.getJSONObject(i);
|
JSONObject json = orders.getJSONObject(i);
|
||||||
String producetask_code = json.getString("workorder_code");
|
String producetask_code = json.getString("workorder_code");
|
||||||
|
//分拣单重
|
||||||
|
String to_order_qty2 = json.getString("dz");
|
||||||
|
float floatValue = Float.parseFloat(to_order_qty2);
|
||||||
|
Float to_order_qty1=floatValue*1000;
|
||||||
|
String to_order_qty=to_order_qty1.toString();
|
||||||
String device_code = json.getString("device_code");
|
String device_code = json.getString("device_code");
|
||||||
String material_code = json.getString("material_number");
|
String material_code = json.getString("material_number");
|
||||||
String qty = json.getString("plan_qty");
|
String qty = json.getString("plan_qty");
|
||||||
@@ -339,7 +344,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
}
|
}
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
map.put("to_order_No", producetask_code);
|
map.put("to_order_No", producetask_code);
|
||||||
map.put("to_order_qty", qty);
|
map.put("to_order_qty", to_order_qty);
|
||||||
map.put("to_material", material_code);
|
map.put("to_material", material_code);
|
||||||
map.put("to_product_code", product_code);
|
map.put("to_product_code", product_code);
|
||||||
map.put("to_AlongSide", AlongSide);
|
map.put("to_AlongSide", AlongSide);
|
||||||
@@ -498,7 +503,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
status.put("weight", driver.getWeight());
|
status.put("weight", driver.getWeight());
|
||||||
status.put("material", driver.getMaterial());
|
status.put("material", driver.getMaterial());
|
||||||
status.put("barcode", driver.getBarcode());
|
status.put("barcode", driver.getBarcode());
|
||||||
status.put("qty", driver.getEncoder_qty()-1);
|
status.put("qty", driver.getEncoder_qty());
|
||||||
if(driver.getAlongSide()!=0) {
|
if(driver.getAlongSide()!=0) {
|
||||||
Integer dz=driver.getAlongSide();
|
Integer dz=driver.getAlongSide();
|
||||||
double weight=dz/1000.00;
|
double weight=dz/1000.00;
|
||||||
@@ -549,7 +554,11 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
|
|||||||
status.put("putStation", driver.getPut_station());
|
status.put("putStation", driver.getPut_station());
|
||||||
status.put("material", driver.getMaterial());
|
status.put("material", driver.getMaterial());
|
||||||
status.put("qty", driver.getQty());
|
status.put("qty", driver.getQty());
|
||||||
status.put("order_qty", driver.getOrder_qty());
|
//单重
|
||||||
|
Float dz= new Float(driver.getOrder_qty()/1000);
|
||||||
|
//总重
|
||||||
|
Float weight=dz*driver.getQty();
|
||||||
|
status.put("weight", weight);
|
||||||
status.put("open_time", driver.getOpen_time());
|
status.put("open_time", driver.getOpen_time());
|
||||||
status.put("standby_time", driver.getStandby_time());
|
status.put("standby_time", driver.getStandby_time());
|
||||||
status.put("production_time", driver.getProduction_time());
|
status.put("production_time", driver.getProduction_time());
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
mb.material_number like '%' 输入.material_number '%'
|
mb.material_number like '%' 输入.material_number '%'
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
OPTION 输入.material_name <> ""
|
OPTION 输入.material_name <> ""
|
||||||
mb.material_name = like '%' 输入.material_name '%'
|
mb.material_name like '%' 输入.material_name '%'
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDPAGEQUERY
|
ENDPAGEQUERY
|
||||||
|
|||||||
@@ -631,7 +631,12 @@ public class DashboardService {
|
|||||||
|
|
||||||
rowDatum = new JSONObject();
|
rowDatum = new JSONObject();
|
||||||
rowDatum.put("key", "数量");
|
rowDatum.put("key", "数量");
|
||||||
rowDatum.put("value", datum.getIntValue("qty") + "块");
|
if(datum.getIntValue("qty")==1){
|
||||||
|
Integer number=datum.getIntValue("qty")-1;
|
||||||
|
rowDatum.put("value", number + "块");
|
||||||
|
}else{
|
||||||
|
rowDatum.put("value", datum.getIntValue("qty") + "块");
|
||||||
|
}
|
||||||
rowData.add(rowDatum);
|
rowData.add(rowDatum);
|
||||||
rowDatum = new JSONObject();
|
rowDatum = new JSONObject();
|
||||||
rowDatum.put("key", "单重");
|
rowDatum.put("key", "单重");
|
||||||
|
|||||||
@@ -2,15 +2,19 @@ package org.nl.wms.pdm.service.impl;
|
|||||||
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.poi.excel.BigExcelWriter;
|
||||||
|
import cn.hutool.poi.excel.ExcelUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.xssf.streaming.SXSSFSheet;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.FileUtil;
|
import org.nl.modules.common.utils.FileUtil;
|
||||||
import org.nl.modules.common.utils.SecurityUtils;
|
import org.nl.modules.common.utils.SecurityUtils;
|
||||||
@@ -34,7 +38,9 @@ import org.springframework.http.HttpStatus;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import javax.servlet.ServletOutputStream;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -538,63 +544,104 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
return WQLObject.getWQLObject("md_me_materialbase").query().getResultJSONArray(0);
|
return WQLObject.getWQLObject("md_me_materialbase").query().getResultJSONArray(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
|
// public void downloadExcel(Map<String, Object> params, HttpServletResponse response) {
|
||||||
|
// String produceorder_code = MapUtil.getStr(params, "produceorder_code");
|
||||||
|
// String material = MapUtil.getStr(params, "material");
|
||||||
|
// String begin_time = MapUtil.getStr(params, "begin_time");
|
||||||
|
// String end_time = MapUtil.getStr(params, "end_time");
|
||||||
|
// String order_status = MapUtil.getStr(params, "order_status");
|
||||||
|
// JSONObject map = new JSONObject();
|
||||||
|
// map.put("flag", "7");
|
||||||
|
// if (StrUtil.isNotBlank(begin_time)) {
|
||||||
|
// map.put("begin_time", begin_time + " 00:00:00");
|
||||||
|
// }
|
||||||
|
// if (StrUtil.isNotBlank(end_time)) {
|
||||||
|
// map.put("end_time", end_time + " 23:59:59");
|
||||||
|
// }
|
||||||
|
// map.put("region_code", MapUtil.getStr(params, "region_code"));
|
||||||
|
// if (StrUtil.isNotEmpty(order_status)) {
|
||||||
|
// order_status = order_status.replace("[\"", "").replace("\"]", "").replace("\"", "");
|
||||||
|
// }
|
||||||
|
// map.put("order_status", order_status);
|
||||||
|
// //处理状态为未完成
|
||||||
|
// if (StrUtil.isNotEmpty(order_status) && order_status.contains("-1")) {
|
||||||
|
// map.put("unFinish", "-1");
|
||||||
|
// map.put("order_status", order_status.replace("-1", ""));
|
||||||
|
// }
|
||||||
|
// if (StrUtil.isNotEmpty(produceorder_code)) {
|
||||||
|
// map.put("produceorder_code", "%" + produceorder_code + "%");
|
||||||
|
// }
|
||||||
|
// if (StrUtil.isNotEmpty(material)) {
|
||||||
|
// map.put("material", "%" + material + "%");
|
||||||
|
// }
|
||||||
|
// JSONArray workorders = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).process().getResultJSONArray(0);
|
||||||
|
// List<Map<String, Object>> list = workorders.stream().map(o -> {
|
||||||
|
// JSONObject workorder = (JSONObject) o;
|
||||||
|
// Map<String, Object> workorder_map = new LinkedHashMap<>();
|
||||||
|
// workorder_map.put("工单号", workorder.getString("workorder_code"));
|
||||||
|
// workorder_map.put("工单状态", workorder.getString("order_status"));
|
||||||
|
// workorder_map.put("设备", workorder.getString("device_name"));
|
||||||
|
// workorder_map.put("物料编码", workorder.getString("material_number"));
|
||||||
|
// workorder_map.put("载具类型", workorder.getString("vehicle_type"));
|
||||||
|
// workorder_map.put("计划数量", workorder.getString("plan_qty"));
|
||||||
|
// workorder_map.put("计划生产日期", workorder.getString("plan_date"));
|
||||||
|
// workorder_map.put("实际开始时间", workorder.getString("realproducestart_date"));
|
||||||
|
// workorder_map.put("实际结束时间", workorder.getString("realproduceend_date"));
|
||||||
|
// workorder_map.put("实际生产数量", workorder.getString("real_qty"));
|
||||||
|
// workorder_map.put("合格数量", workorder.getString("qualified_qty"));
|
||||||
|
// workorder_map.put("不合格数量", workorder.getString("unqualified_qty"));
|
||||||
|
// return workorder_map;
|
||||||
|
// }).collect(Collectors.toList());
|
||||||
|
//
|
||||||
|
// try {
|
||||||
|
// FileUtil.downloadExcel(list, response);
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
@Override
|
||||||
public void downloadExcel(Map<String, Object> params, HttpServletResponse response) {
|
public void downloadExcel(Map<String, Object> params, HttpServletResponse response) {
|
||||||
String produceorder_code = MapUtil.getStr(params, "produceorder_code");
|
|
||||||
String material = MapUtil.getStr(params, "material");
|
|
||||||
String begin_time = MapUtil.getStr(params, "begin_time");
|
|
||||||
String end_time = MapUtil.getStr(params, "end_time");
|
|
||||||
String order_status = MapUtil.getStr(params, "order_status");
|
|
||||||
JSONObject map = new JSONObject();
|
|
||||||
map.put("flag", "7");
|
|
||||||
if (StrUtil.isNotBlank(begin_time)) {
|
|
||||||
map.put("begin_time", begin_time + " 00:00:00");
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(end_time)) {
|
|
||||||
map.put("end_time", end_time + " 23:59:59");
|
|
||||||
}
|
|
||||||
map.put("region_code", MapUtil.getStr(params, "region_code"));
|
|
||||||
if (StrUtil.isNotEmpty(order_status)) {
|
|
||||||
order_status = order_status.replace("[\"", "").replace("\"]", "").replace("\"", "");
|
|
||||||
}
|
|
||||||
map.put("order_status", order_status);
|
|
||||||
//处理状态为未完成
|
|
||||||
if (StrUtil.isNotEmpty(order_status) && order_status.contains("-1")) {
|
|
||||||
map.put("unFinish", "-1");
|
|
||||||
map.put("order_status", order_status.replace("-1", ""));
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(produceorder_code)) {
|
|
||||||
map.put("produceorder_code", "%" + produceorder_code + "%");
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotEmpty(material)) {
|
|
||||||
map.put("material", "%" + material + "%");
|
|
||||||
}
|
|
||||||
JSONArray workorders = WQL.getWO("MPS_PRODUCEDURE001").addParamMap(map).process().getResultJSONArray(0);
|
|
||||||
List<Map<String, Object>> list = workorders.stream().map(o -> {
|
|
||||||
JSONObject workorder = (JSONObject) o;
|
|
||||||
Map<String, Object> workorder_map = new LinkedHashMap<>();
|
|
||||||
workorder_map.put("工单号", workorder.getString("workorder_code"));
|
|
||||||
workorder_map.put("工单状态", workorder.getString("order_status"));
|
|
||||||
workorder_map.put("设备", workorder.getString("device_name"));
|
|
||||||
workorder_map.put("物料编码", workorder.getString("material_number"));
|
|
||||||
workorder_map.put("载具类型", workorder.getString("vehicle_type"));
|
|
||||||
workorder_map.put("计划数量", workorder.getString("plan_qty"));
|
|
||||||
workorder_map.put("计划生产日期", workorder.getString("plan_date"));
|
|
||||||
workorder_map.put("实际开始时间", workorder.getString("realproducestart_date"));
|
|
||||||
workorder_map.put("实际结束时间", workorder.getString("realproduceend_date"));
|
|
||||||
workorder_map.put("实际生产数量", workorder.getString("real_qty"));
|
|
||||||
workorder_map.put("合格数量", workorder.getString("qualified_qty"));
|
|
||||||
workorder_map.put("不合格数量", workorder.getString("unqualified_qty"));
|
|
||||||
return workorder_map;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
|
|
||||||
try {
|
|
||||||
FileUtil.downloadExcel(list, response);
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 导出excel
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* 系统临时目录
|
||||||
|
* <br>
|
||||||
|
* windows 包含路径分割符,但Linux 不包含,
|
||||||
|
* 在windows \\==\ 前提下,
|
||||||
|
* 为安全起见 同意拼装 路径分割符,
|
||||||
|
* <pre>
|
||||||
|
* java.io.tmpdir
|
||||||
|
* windows : C:\Users/xxx\AppData\Local\Temp\
|
||||||
|
* linux: /temp
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public static final String SYS_TEM_DIR = System.getProperty("java.io.tmpdir") + File.separator;
|
||||||
|
public static void downloadExcel(List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
|
||||||
|
String tempPath = SYS_TEM_DIR + IdUtil.fastSimpleUUID() + ".xlsx";
|
||||||
|
File file = new File(tempPath);
|
||||||
|
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
|
||||||
|
// 一次性写出内容,使用默认样式,强制输出标题
|
||||||
|
writer.write(list, true);
|
||||||
|
SXSSFSheet sheet = (SXSSFSheet)writer.getSheet();
|
||||||
|
//上面需要强转SXSSFSheet 不然没有trackAllColumnsForAutoSizing方法
|
||||||
|
sheet.trackAllColumnsForAutoSizing();
|
||||||
|
//列宽自适应
|
||||||
|
writer.autoSizeColumnAll();
|
||||||
|
//response为HttpServletResponse对象
|
||||||
|
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||||
|
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
|
||||||
|
response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
|
||||||
|
ServletOutputStream out = response.getOutputStream();
|
||||||
|
// 终止后删除临时文件
|
||||||
|
file.deleteOnExit();
|
||||||
|
writer.flush(out, true);
|
||||||
|
//此处记得关闭输出Servlet流
|
||||||
|
IoUtil.close(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void reportWorkOrderDaily(long workOrderId, int qty, int qualifiedQty, int unqualifiedQty, double weight, double avgPieceWeight) {
|
public void reportWorkOrderDaily(long workOrderId, int qty, int qualifiedQty, int unqualifiedQty, double weight, double avgPieceWeight) {
|
||||||
String today = DateUtil.today();
|
String today = DateUtil.today();
|
||||||
@@ -727,4 +774,5 @@ public class WorkorderServiceImpl implements WorkordeService {
|
|||||||
TaskUtils.addACSUpdateColum(workOrder);
|
TaskUtils.addACSUpdateColum(workOrder);
|
||||||
workOrderTable.update(workOrder);
|
workOrderTable.update(workOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -180,7 +180,8 @@
|
|||||||
material.h,
|
material.h,
|
||||||
material.w,
|
material.w,
|
||||||
device.region_code,
|
device.region_code,
|
||||||
workorder.vehicle_type
|
workorder.vehicle_type,
|
||||||
|
workorder.dz
|
||||||
FROM
|
FROM
|
||||||
pdm_bd_workorder workorder
|
pdm_bd_workorder workorder
|
||||||
LEFT JOIN md_me_materialbase material ON workorder.material_id = material.material_id
|
LEFT JOIN md_me_materialbase material ON workorder.material_id = material.material_id
|
||||||
|
|||||||
Reference in New Issue
Block a user