|
|
|
|
@@ -1,8 +1,10 @@
|
|
|
|
|
package org.nl.wms.dashboard.service;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.nl.wms.sch.manage.WorkOrderEnum;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@@ -13,9 +15,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
public class DashboardService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 大屏首页数据
|
|
|
|
|
* 大屏首页报表
|
|
|
|
|
*
|
|
|
|
|
* @return 大屏首页数据
|
|
|
|
|
* @return 大屏首页报表数据
|
|
|
|
|
*/
|
|
|
|
|
public JSONObject homepageData() {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@@ -28,7 +30,7 @@ public class DashboardService {
|
|
|
|
|
currentEquipmentCondition.put("pausing", 4);
|
|
|
|
|
currentEquipmentCondition.put("shutdown", 1);
|
|
|
|
|
currentEquipmentCondition.put("inTrouble", 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 每月故障统计---------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject monthlyFailureStatistics = new JSONObject();
|
|
|
|
|
result.put("monthlyFailureStatistics", monthlyFailureStatistics);
|
|
|
|
|
@@ -41,7 +43,7 @@ public class DashboardService {
|
|
|
|
|
currentMonth.put("press", 8);
|
|
|
|
|
currentMonth.put("dry", 4);
|
|
|
|
|
currentMonth.put("sort", 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 平均次数
|
|
|
|
|
JSONObject average = new JSONObject();
|
|
|
|
|
monthlyFailureStatistics.put("average", average);
|
|
|
|
|
@@ -63,12 +65,12 @@ public class DashboardService {
|
|
|
|
|
mix.put("completed", 32.25);
|
|
|
|
|
|
|
|
|
|
// 困料
|
|
|
|
|
JSONObject standing = new JSONObject();
|
|
|
|
|
dailyProductionStatistics.put("standing", standing);
|
|
|
|
|
JSONObject stand = new JSONObject();
|
|
|
|
|
dailyProductionStatistics.put("stand", stand);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
standing.put("onStanding", 32.25);
|
|
|
|
|
standing.put("completed", 16.25);
|
|
|
|
|
|
|
|
|
|
stand.put("onStanding", 32.25);
|
|
|
|
|
stand.put("completed", 16.25);
|
|
|
|
|
|
|
|
|
|
// 压制
|
|
|
|
|
JSONObject press = new JSONObject();
|
|
|
|
|
dailyProductionStatistics.put("press", press);
|
|
|
|
|
@@ -109,7 +111,7 @@ public class DashboardService {
|
|
|
|
|
/**
|
|
|
|
|
* 大屏首页设备
|
|
|
|
|
*
|
|
|
|
|
* @return 大屏首页设备
|
|
|
|
|
* @return 大屏首页设备数据
|
|
|
|
|
*/
|
|
|
|
|
public JSONObject homepageEquipment() {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
@@ -117,15 +119,15 @@ public class DashboardService {
|
|
|
|
|
// 混料区--------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject mix = new JSONObject();
|
|
|
|
|
result.put("mix", mix);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 混料机
|
|
|
|
|
JSONArray mixingMachine = new JSONArray();
|
|
|
|
|
mix.put("mixingMachine", mixingMachine);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 16; i++) {
|
|
|
|
|
for (int i = 1; i <= 14; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "混料机" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
mixingMachine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -133,11 +135,11 @@ public class DashboardService {
|
|
|
|
|
JSONArray unloadLocation = new JSONArray();
|
|
|
|
|
mix.put("unloadLocation", unloadLocation);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 16; i++) {
|
|
|
|
|
for (int i = 1; i <= 14; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "混料机" + i + "下料位1");
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
mixingMachine.add(row);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
unloadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 困料货架------------------------------------------------------------------------------------------------------
|
|
|
|
|
@@ -151,15 +153,15 @@ public class DashboardService {
|
|
|
|
|
for (int i = 1; i <= 8; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "困料货位" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
String isHasGoods = this.random(0, 1);
|
|
|
|
|
row.put("isHasGoods", isHasGoods);
|
|
|
|
|
if ("1".equals(isHasGoods)) {
|
|
|
|
|
row.put("standStatus", this.random(1, 5));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
String pointStatus = this.randomFrom1To(3);
|
|
|
|
|
row.put("pointStatus", pointStatus);
|
|
|
|
|
if ("3".equals(pointStatus)) {
|
|
|
|
|
row.put("standStatus", this.randomFrom1To(5));
|
|
|
|
|
}
|
|
|
|
|
storageLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 压制区--------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject press = new JSONObject();
|
|
|
|
|
result.put("press", press);
|
|
|
|
|
@@ -171,7 +173,7 @@ public class DashboardService {
|
|
|
|
|
for (int i = 1; i <= 10; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "压机" + i + "上料位1");
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
loadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -182,7 +184,7 @@ public class DashboardService {
|
|
|
|
|
for (int i = 1; i <= 10; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "压机" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
pressMachine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -193,7 +195,7 @@ public class DashboardService {
|
|
|
|
|
for (int i = 1; i <= 5; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "码垛机械手" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
palletizingRobot.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -205,7 +207,7 @@ public class DashboardService {
|
|
|
|
|
for (int j = 1; j <= 2; j++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "压机" + i + "下料位" + j);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
unloadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -221,22 +223,22 @@ public class DashboardService {
|
|
|
|
|
for (int i = 1; i <= 28; i += 2) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑前货位" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("isHasGoods", this.random(0, 1));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
row.put("pointStatus", this.randomFrom1To(3));
|
|
|
|
|
storageLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
for (int i = 2; i <= 28; i += 2) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑前货位" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("isHasGoods", this.random(0, 1));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
row.put("pointStatus", this.randomFrom1To(3));
|
|
|
|
|
storageLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 干燥区--------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject dry = new JSONObject();
|
|
|
|
|
result.put("dry", dry);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 输送线
|
|
|
|
|
JSONArray conveyorLine = new JSONArray();
|
|
|
|
|
dry.put("conveyorLine", conveyorLine);
|
|
|
|
|
@@ -244,17 +246,265 @@ public class DashboardService {
|
|
|
|
|
for (int i = 1; i <= 4; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑前输送线" + i);
|
|
|
|
|
row.put("status", this.random(1, 4));
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
conveyorLine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 桁架
|
|
|
|
|
JSONArray gantryRobot = new JSONArray();
|
|
|
|
|
dry.put("gantryRobot", gantryRobot);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑前桁架1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
gantryRobot.add(row);
|
|
|
|
|
row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑后桁架1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
gantryRobot.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 窑
|
|
|
|
|
JSONArray kiln = new JSONArray();
|
|
|
|
|
dry.put("kiln", kiln);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 4; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑" + i);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
kiln.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 回车道
|
|
|
|
|
JSONArray emptyVehicleConveyorLine = new JSONArray();
|
|
|
|
|
dry.put("emptyVehicleConveyorLine", emptyVehicleConveyorLine);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "回车道1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
emptyVehicleConveyorLine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 冷却道
|
|
|
|
|
JSONArray coolingConveyorLine = new JSONArray();
|
|
|
|
|
dry.put("coolingConveyorLine", coolingConveyorLine);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 3; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "冷却道" + i);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
coolingConveyorLine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 窑后货架------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject backWarehouse = new JSONObject();
|
|
|
|
|
result.put("backWarehouse", backWarehouse);
|
|
|
|
|
|
|
|
|
|
// 窑后货位
|
|
|
|
|
storageLocation = new JSONArray();
|
|
|
|
|
backWarehouse.put("storageLocation", storageLocation);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 24; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "窑后货位" + i);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
row.put("pointStatus", this.randomFrom1To(3));
|
|
|
|
|
storageLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 分拣区--------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject sort = new JSONObject();
|
|
|
|
|
result.put("sort", sort);
|
|
|
|
|
|
|
|
|
|
// 拆垛对接位
|
|
|
|
|
loadLocation = new JSONArray();
|
|
|
|
|
sort.put("loadLocation", loadLocation);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 2; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "分拣拆垛1对接位" + i);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
loadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 分拣拆垛机械手
|
|
|
|
|
JSONArray depalletizingRobot = new JSONArray();
|
|
|
|
|
sort.put("depalletizingRobot", depalletizingRobot);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "分拣拆垛机械手1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
depalletizingRobot.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 分拣码垛机械手
|
|
|
|
|
palletizingRobot = new JSONArray();
|
|
|
|
|
sort.put("palletizingRobot", palletizingRobot);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "分拣码垛机械手1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
palletizingRobot.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 码垛对接位
|
|
|
|
|
unloadLocation = new JSONArray();
|
|
|
|
|
sort.put("unloadLocation", unloadLocation);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= 2; i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "分拣码垛1对接位" + i);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
unloadLocation.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 覆膜机
|
|
|
|
|
JSONArray laminatingMachine = new JSONArray();
|
|
|
|
|
sort.put("laminatingMachine", laminatingMachine);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "覆膜机1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
laminatingMachine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 托盘输送线-----------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject vehicleConveyorLine = new JSONObject();
|
|
|
|
|
result.put("vehicleConveyorLine", vehicleConveyorLine);
|
|
|
|
|
|
|
|
|
|
// 叠托机
|
|
|
|
|
JSONArray trayStacker = new JSONArray();
|
|
|
|
|
vehicleConveyorLine.put("trayStacker", trayStacker);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "叠托机1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
trayStacker.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 输送线
|
|
|
|
|
conveyorLine = new JSONArray();
|
|
|
|
|
vehicleConveyorLine.put("conveyorLine", conveyorLine);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 5; i >= 5; i--) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "拆盘机1对接位" + i);
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
conveyorLine.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 拆盘机
|
|
|
|
|
JSONArray trayDestacker = new JSONArray();
|
|
|
|
|
vehicleConveyorLine.put("trayDestacker", trayDestacker);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
{
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("equipment", "拆盘机1");
|
|
|
|
|
row.put("status", this.randomFrom1To(4));
|
|
|
|
|
trayDestacker.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String random(int from, int to) {
|
|
|
|
|
return String.valueOf(from + (int) (Math.random() * (to - from + 1)));
|
|
|
|
|
/**
|
|
|
|
|
* 生产统计
|
|
|
|
|
*
|
|
|
|
|
* @return 大屏生产统计页面数据
|
|
|
|
|
*/
|
|
|
|
|
public JSONObject productionStatistics() {
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
|
|
// 总量----------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject total = new JSONObject();
|
|
|
|
|
result.put("total", total);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
total.put("pressWeight", 30.25);
|
|
|
|
|
total.put("dryWeight", 20.25);
|
|
|
|
|
total.put("sortWeight", 16.25);
|
|
|
|
|
|
|
|
|
|
// 混碾生产------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONArray mixProduction = new JSONArray();
|
|
|
|
|
result.put("mixProduction", mixProduction);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= Integer.parseInt(this.randomFrom1To(8)); i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("name", "物料" + i);
|
|
|
|
|
row.put("value", Integer.parseInt(this.randomFrom1To(10)) * 100 + 0.25);
|
|
|
|
|
mixProduction.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 在制品设备生产量------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONObject pressProduction = new JSONObject();
|
|
|
|
|
result.put("pressProduction", pressProduction);
|
|
|
|
|
|
|
|
|
|
// 当日产量
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
pressProduction.put("dailyProductionQty", 32.25);
|
|
|
|
|
|
|
|
|
|
// 当班产量
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
pressProduction.put("dailyProductionWeight", 64.25);
|
|
|
|
|
|
|
|
|
|
// 设备产量
|
|
|
|
|
JSONArray equipmentProduction = new JSONArray();
|
|
|
|
|
pressProduction.put("equipmentProduction", equipmentProduction);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= Integer.parseInt(this.randomFrom1To(10)); i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("name", "压机" + i);
|
|
|
|
|
row.put("qty", Integer.parseInt(this.randomFrom1To(20)) * 1000);
|
|
|
|
|
row.put("weight", Integer.parseInt(this.randomFrom1To(20)) * 1000);
|
|
|
|
|
equipmentProduction.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 成品完成率-----------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONArray finishedProductCompletionRate = new JSONArray();
|
|
|
|
|
result.put("finishedProductCompletionRate", finishedProductCompletionRate);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= Integer.parseInt(this.randomFrom1To(5)); i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("name", "物料" + i);
|
|
|
|
|
row.put("completed", Integer.parseInt(this.randomFrom1To(5)) * 1000);
|
|
|
|
|
row.put("uncompleted", Integer.parseInt(this.randomFrom1To(5)) * 1000);
|
|
|
|
|
finishedProductCompletionRate.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 生产任务------------------------------------------------------------------------------------------------------
|
|
|
|
|
JSONArray workOrder = new JSONArray();
|
|
|
|
|
result.put("workOrder", workOrder);
|
|
|
|
|
// todo 现在是假数据,后期更新。
|
|
|
|
|
for (int i = 1; i <= Integer.parseInt(this.randomFrom1To(10)); i++) {
|
|
|
|
|
JSONObject row = new JSONObject();
|
|
|
|
|
row.put("workOrderCode", "DD" + String.format("%03d", i));
|
|
|
|
|
row.put("equipment", i % 2 == 0 ? "混料机" + i : "压机" + i);
|
|
|
|
|
row.put("materialCode", "WL" + String.format("%02d", i));
|
|
|
|
|
row.put("customer", "厂家" + i);
|
|
|
|
|
int qty = Integer.parseInt(this.randomFrom1To(9)) * 1000;
|
|
|
|
|
row.put("planned", qty + "kg");
|
|
|
|
|
row.put("completed", qty - Integer.parseInt(this.randomFrom1To(qty)) + "kg");
|
|
|
|
|
WorkOrderEnum status = WorkOrderEnum.get(this.randomFrom1To(5));
|
|
|
|
|
row.put("status", status.label());
|
|
|
|
|
row.put("planStartTime", DateUtil.now());
|
|
|
|
|
if (Integer.parseInt(status.value()) > 1) {
|
|
|
|
|
row.put("startTime", DateUtil.now());
|
|
|
|
|
}
|
|
|
|
|
if (Integer.parseInt(status.value()) > 4) {
|
|
|
|
|
row.put("endTime", DateUtil.now());
|
|
|
|
|
}
|
|
|
|
|
workOrder.add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private String randomFrom1To(int to) {
|
|
|
|
|
return String.valueOf(1 + (int) (Math.random() * to));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|