生产大屏
This commit is contained in:
@@ -3,17 +3,22 @@ package org.nl;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.junit.Test;
|
||||
import org.nl.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
public class Test3 extends BaseTest {
|
||||
@Test
|
||||
@@ -965,13 +970,14 @@ public class Test3 extends BaseTest {
|
||||
String a = point_code.substring(0, 2);
|
||||
String b = point_code.substring(2, 4);
|
||||
String c = point_code.substring(4, 6);
|
||||
String new_point_code ="L"+ a + "-" + c + "-" + b;
|
||||
String new_point_code_name = a+"排"+c +"列"+b+"层";
|
||||
String new_point_code = "L" + a + "-" + c + "-" + b;
|
||||
String new_point_code_name = a + "排" + c + "列" + b + "层";
|
||||
jo.put("point_code", new_point_code);
|
||||
jo.put("point_name",new_point_code_name);
|
||||
jo.put("point_name", new_point_code_name);
|
||||
pointTable.update(jo);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化成品出库位
|
||||
@Test
|
||||
public void StructCKWCode() {
|
||||
@@ -980,7 +986,7 @@ public class Test3 extends BaseTest {
|
||||
for (int i = 0; i < resultArr.size(); i++) {
|
||||
JSONObject jo = resultArr.getJSONObject(i);
|
||||
String point_code = jo.getString("point_code");
|
||||
String new_point_code ="CPCKW"+point_code;
|
||||
String new_point_code = "CPCKW" + point_code;
|
||||
jo.put("point_code", new_point_code);
|
||||
pointTable.update(jo);
|
||||
}
|
||||
@@ -1003,31 +1009,31 @@ public class Test3 extends BaseTest {
|
||||
String sect_name = "";
|
||||
if (area_type.equals("KQ001")) {
|
||||
sect_id = "1528631043496742912";
|
||||
sect_name="成品库区";
|
||||
sect_name = "成品库区";
|
||||
}
|
||||
if (area_type.equals("KQ002")) {
|
||||
sect_id = "1528631044482404352";
|
||||
sect_name="半成品库区";
|
||||
sect_name = "半成品库区";
|
||||
}
|
||||
if (area_type.equals("KQ003")) {
|
||||
sect_id = "1528631044243329024";
|
||||
sect_name="半成品上料空框暂存区";
|
||||
sect_name = "半成品上料空框暂存区";
|
||||
}
|
||||
if (area_type.equals("KQ004")) {
|
||||
sect_id = "1528631042318143488";
|
||||
sect_name="半成品上下料暂存区";
|
||||
sect_name = "半成品上下料暂存区";
|
||||
}
|
||||
if (area_type.equals("KQ005")) {
|
||||
sect_id = "1528631044369158144";
|
||||
sect_name="半成品空框应急区";
|
||||
sect_name = "半成品空框应急区";
|
||||
}
|
||||
if (area_type.equals("KQ006")) {
|
||||
sect_id = "1528631043685486592";
|
||||
sect_name="成品出库暂存区";
|
||||
sect_name = "成品出库暂存区";
|
||||
}
|
||||
if (area_type.equals("KQ007")) {
|
||||
sect_id = "1528631044054585344";
|
||||
sect_name="半成品料箱区";
|
||||
sect_name = "半成品料箱区";
|
||||
}
|
||||
|
||||
|
||||
@@ -1043,22 +1049,23 @@ public class Test3 extends BaseTest {
|
||||
joo.put("width", "1");
|
||||
joo.put("height", "2");
|
||||
joo.put("zdepth", "1");
|
||||
joo.put("is_tempstruct","1");
|
||||
joo.put("create_id","1");
|
||||
joo.put("create_name","管理员");
|
||||
joo.put("create_time","2022-05-23 15:19:14");
|
||||
joo.put("is_delete","0");
|
||||
joo.put("back_ground_color","01");
|
||||
joo.put("front_ground_color","01");
|
||||
joo.put("font_direction_scode","01");
|
||||
joo.put("is_used","1");
|
||||
joo.put("is_emptyvehicle","0");
|
||||
joo.put("storagevehicle_qty","0");
|
||||
joo.put("lock_type","00");
|
||||
joo.put("material_height_type","1");
|
||||
joo.put("is_tempstruct", "1");
|
||||
joo.put("create_id", "1");
|
||||
joo.put("create_name", "管理员");
|
||||
joo.put("create_time", "2022-05-23 15:19:14");
|
||||
joo.put("is_delete", "0");
|
||||
joo.put("back_ground_color", "01");
|
||||
joo.put("front_ground_color", "01");
|
||||
joo.put("font_direction_scode", "01");
|
||||
joo.put("is_used", "1");
|
||||
joo.put("is_emptyvehicle", "0");
|
||||
joo.put("storagevehicle_qty", "0");
|
||||
joo.put("lock_type", "00");
|
||||
joo.put("material_height_type", "1");
|
||||
structtable.insert(joo);
|
||||
}
|
||||
}
|
||||
|
||||
//同步产品工艺路线
|
||||
@Test
|
||||
public void PDM_BI_ProductProcessRoute() {
|
||||
@@ -1069,8 +1076,8 @@ public class Test3 extends BaseTest {
|
||||
for (int i = 0; i < ja.size(); i++) {
|
||||
JSONObject jo = ja.getJSONObject(i);
|
||||
String processroute_uuid = jo.getString("processroute_uuid");
|
||||
JSONArray dtlja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("processroute_uuid",processroute_uuid).addParam("flag", "16").process().getResultJSONArray(0);
|
||||
for (int j = 0; j <dtlja.size() ; j++) {
|
||||
JSONArray dtlja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("processroute_uuid", processroute_uuid).addParam("flag", "16").process().getResultJSONArray(0);
|
||||
for (int j = 0; j < dtlja.size(); j++) {
|
||||
JSONObject dtljo = dtlja.getJSONObject(i);
|
||||
JSONObject routejoo = new JSONObject();
|
||||
JSONObject routeDtljoo = new JSONObject();
|
||||
@@ -1101,34 +1108,117 @@ public class Test3 extends BaseTest {
|
||||
String create_name = "qinx";
|
||||
String create_time = "2021-12-9 14:15";
|
||||
|
||||
// caTable.insert(pcsjo);
|
||||
// caTable.insert(pcsjo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main1231(String[] args) {
|
||||
String now ="2022-06-30";
|
||||
String now = "2022-06-30";
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), 30);
|
||||
System.out.println(dateTime.toString().substring(0,10));
|
||||
System.out.println(dateTime.toString().substring(0, 10));
|
||||
JSONArray dataArr = new JSONArray();
|
||||
for (int i = 1; i <9 ; i++) {
|
||||
for (int i = 1; i < 9; i++) {
|
||||
DateTime dateTime11 = DateUtil.offsetDay(DateUtil.parse(now), -i);
|
||||
dataArr.add(dateTime11.toString().substring(0,10));
|
||||
dataArr.add(dateTime11.toString().substring(0, 10));
|
||||
}
|
||||
System.out.println("cesw");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
public static void main123(String[] args) {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONArray ja = new JSONArray();
|
||||
JSONObject errjo1 =new JSONObject();
|
||||
JSONObject errjo2 =new JSONObject();
|
||||
errjo1.put("error","1号避障");
|
||||
errjo2.put("error","1号避障");
|
||||
ja.add(errjo1);
|
||||
ja.add(errjo2);
|
||||
jo.put("data",ja);
|
||||
jo.put("statys","1");
|
||||
JSONArray ja1 = new JSONArray();
|
||||
System.out.println("12313");
|
||||
}
|
||||
|
||||
//初始化x,y坐标
|
||||
public static void main2343(JSONObject jo) {
|
||||
//起点坐标
|
||||
BigDecimal start_x = NumberUtil.round(jo.getIntValue("start_x") / 100, 0);
|
||||
BigDecimal start_y = NumberUtil.round(jo.getIntValue("start_y") / 100, 0);
|
||||
int start_web_x = jo.getIntValue("start_web_x");
|
||||
int start_web_y = jo.getIntValue("start_web_y");
|
||||
//终点坐标
|
||||
BigDecimal end_x = NumberUtil.round(jo.getIntValue("end_x") / 100, 0);
|
||||
BigDecimal end_y = NumberUtil.round(jo.getIntValue("end_y") / 100, 0);
|
||||
int end_web_x = jo.getIntValue("end_web_x");
|
||||
int end_web_y = jo.getIntValue("end_web_y");
|
||||
//这个路线切割多少个线段,点数比线段多一个
|
||||
int n = jo.getIntValue("n");
|
||||
//单位x坐标的长度 (web长度 除以 实际长度)
|
||||
BigDecimal x = new BigDecimal(0);
|
||||
BigDecimal y = new BigDecimal(0);
|
||||
//算出每个线段的x实际距离
|
||||
BigDecimal real_x= new BigDecimal(0);
|
||||
//算出每个先段的y实际距离
|
||||
BigDecimal real_y = new BigDecimal(0);
|
||||
if (!end_x.equals(start_x)) {
|
||||
x = NumberUtil.div((end_web_x - start_web_x), NumberUtil.sub(end_x, start_x));
|
||||
real_x = NumberUtil.div((NumberUtil.sub(end_x, start_x)), n);
|
||||
}
|
||||
if (!end_y.equals(start_y)) {
|
||||
y = NumberUtil.div((end_web_y - start_web_y), NumberUtil.sub(end_y, start_y));
|
||||
real_y = NumberUtil.div((NumberUtil.sub(end_y, start_y)), n);
|
||||
}
|
||||
for (int i = 0; i < n + 1; i++) {
|
||||
//算出每个点对应的web坐标
|
||||
BigDecimal real_web_x = NumberUtil.add(start_web_x, NumberUtil.mul(x, real_x));
|
||||
BigDecimal real_web_y = NumberUtil.add(start_web_y, NumberUtil.mul(y, real_y));
|
||||
JSONObject Obj = new JSONObject();
|
||||
Obj.put("point_uuid",IdUtil.getSnowflake(1,1).nextId());
|
||||
Obj.put("point_code",IdUtil.getSnowflake(1,1).nextId());
|
||||
Obj.put("point_uuid",IdUtil.getSnowflake(1,1).nextId());
|
||||
}
|
||||
}
|
||||
|
||||
//工单造数据
|
||||
@Test
|
||||
public void shiftorder() {
|
||||
WQLObject shiftTable = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
String date = "2022-07-01";
|
||||
JSONArray dataArr = new JSONArray();
|
||||
for (int i = 1; i < 29; i++) {
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(date), i);
|
||||
dataArr.add(dateTime.toString().substring(0, 10));
|
||||
}
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
String newdate = (String) dataArr.get(i);
|
||||
JSONArray orderArr = shiftTable.query("produce_date='2022-07-01'").getResultJSONArray(0);
|
||||
for (int j = 0; j < orderArr.size(); j++) {
|
||||
JSONObject orderjo = orderArr.getJSONObject(j);
|
||||
JSONObject neworderjo = new JSONObject();
|
||||
neworderjo.put("produceorder_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
neworderjo.put("produceorder_code", CodeUtil.getNewCode("PDM_SHIFTORDER"));
|
||||
neworderjo.put("producedeviceorder_code", orderjo.getString("producedeviceorder_code"));
|
||||
neworderjo.put("shift_type_scode", orderjo.getString("shift_type_scode"));
|
||||
neworderjo.put("workprocedure_id", orderjo.getString("workprocedure_id"));
|
||||
neworderjo.put("produce_date", newdate);
|
||||
neworderjo.put("plan_qty", orderjo.getIntValue("plan_qty") + i * 100);
|
||||
neworderjo.put("real_qty", orderjo.getIntValue("real_qty") + i * 100);
|
||||
neworderjo.put("report_qty", orderjo.getIntValue("report_qty"));
|
||||
neworderjo.put("material_id", orderjo.getString("material_id"));
|
||||
neworderjo.put("material_weight", orderjo.getString("material_weight"));
|
||||
neworderjo.put("planproducestart_date", newdate + " " + "00:00:00");
|
||||
neworderjo.put("planproduceend_date", newdate + " " + "22:00:00");
|
||||
neworderjo.put("device_id", orderjo.getString("device_id"));
|
||||
neworderjo.put("is_canupdate_update", orderjo.getString("is_canupdate_update"));
|
||||
neworderjo.put("order_status", orderjo.getString("order_status"));
|
||||
neworderjo.put("is_needmove", orderjo.getString("is_needmove"));
|
||||
neworderjo.put("sale_id", orderjo.getString("sale_id"));
|
||||
neworderjo.put("create_id", orderjo.getString("create_id"));
|
||||
neworderjo.put("create_name", orderjo.getString("create_name"));
|
||||
neworderjo.put("create_time", orderjo.getString("create_time"));
|
||||
neworderjo.put("is_delete", orderjo.getString("is_delete"));
|
||||
shiftTable.insert(neworderjo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String date = "2022-07-28";
|
||||
date = date.substring(5,date.length());
|
||||
System.out.println(date);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user