生产大屏

This commit is contained in:
18188916393
2022-07-29 11:08:39 +08:00
parent f47a3646f9
commit 76aaf154ad
4 changed files with 311 additions and 136 deletions

View File

@@ -2,6 +2,7 @@ package org.nl.wms.ext.bigScreen.service.impl;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
@@ -17,14 +18,10 @@ import java.util.Map;
@RequiredArgsConstructor
@Slf4j
public class ProductServiceImpl implements ProductService {
private String now = "2022-07-26 23:59:59";
private String today = "2022-07-26";
//一个月的开始时间
DateTime beginMonthDateTime = DateUtil.offsetDay(DateUtil.parse(now), 30);
//一天的开始时间
DateTime beginTimeOfDay = DateUtil.beginOfDay(DateUtil.parse(now));
//一天的结束时间
DateTime endTimeOfDay = DateUtil.endOfDay(DateUtil.parseDate(now));
private String now = DateUtil.now();
private String today = DateUtil.today();
//一个月的开始日期
private String beginOfMonth = DateUtil.formatTime(DateUtil.beginOfMonth(DateUtil.parseDate(today)));
@Override
public Map<String, Object> planReached(Map<String, String> param) {
@@ -32,12 +29,33 @@ public class ProductServiceImpl implements ProductService {
//01-弯头工段、02-综合工段、03-成品工段
Map map = new HashMap();
map.put("flag", "1");
map.put("begin_time", beginTimeOfDay);
map.put("end_time", endTimeOfDay);
JSONArray dayResult = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
map.put("produce_date", today);
map.put("worksection_type_scode","01");
JSONObject jo1 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
map.put("worksection_type_scode","02");
JSONObject jo2 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
map.put("worksection_type_scode","03");
JSONObject jo3 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
JSONObject dayResult = new JSONObject();
dayResult.put("jo1",jo1);
dayResult.put("jo2",jo2);
dayResult.put("jo3",jo3);
//计算一个月的计划达成
map.put("begin_time", beginMonthDateTime);
JSONArray monthResult = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
JSONObject monthResult = new JSONObject();
map.put("flag", "14");
map.put("end_produce_date", today);
map.put("begin_produce_date", beginOfMonth);
map.put("worksection_type_scode","01");
JSONObject joo1 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
map.put("worksection_type_scode","02");
JSONObject joo2 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
map.put("worksection_type_scode","03");
JSONObject joo3 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
monthResult.put("joo1",joo1);
monthResult.put("joo2",joo2);
monthResult.put("joo3",joo3);
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("desc", "操作成功!");
@@ -51,8 +69,7 @@ public class ProductServiceImpl implements ProductService {
//今日排产生产进度跟踪
Map map = new HashMap();
map.put("flag", "2");
map.put("begin_time", beginTimeOfDay);
map.put("end_time", endTimeOfDay);
map.put("produce_date", today);
JSONArray result = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
@@ -67,8 +84,7 @@ public class ProductServiceImpl implements ProductService {
Map map = new HashMap();
// map.put("flag", "3");
map.put("flag", "7");
map.put("begin_time", beginTimeOfDay);
map.put("end_time", endTimeOfDay);
map.put("produce_date", today);
//统计产量方式一: 1 计算工单物料 2 计算每个物料清洗前一个工序 3拿着工序+物料 关联工单表 统计总数
//1激光下料——推弯——清洗
//2旋压-清洗
@@ -83,7 +99,7 @@ public class ProductServiceImpl implements ProductService {
map.put("flag", "4");
int sum_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("count");
//统计延时工单
map.put("now_time", now);
map.put("product_date",today);
map.put("flag", "5");
int delayed_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("count");
@@ -105,20 +121,28 @@ public class ProductServiceImpl implements ProductService {
//获取一周的日期
JSONArray dataArr = new JSONArray();
JSONArray results = new JSONArray();
for (int i = 1; i < 9; i++) {
for (int i = 0; i < 7; i++) {
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), -i);
dataArr.add(dateTime.toString().substring(0, 10));
}
for (int i = 0; i < dataArr.size(); i++) {
JSONObject jo = new JSONObject();
JSONObject datejo = dataArr.getJSONObject(i);
String date = datejo.get(i).toString();
jo.put("date", date);
String date = dataArr.get(( dataArr.size()-i-1)).toString();
//01-弯头工段、02-综合工段、03-成品工段
Map map = new HashMap();
map.put("flag", "8");
map.put("flag", "15");
map.put("produce_date", date);
JSONArray arr = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
jo.put("data", arr);
map.put("worksection_type_scode", "01");
int elbow_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("real_qty");
jo.put("elbow_qty", elbow_qty);
map.put("worksection_type_scode", "02");
int comprehensive_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("real_qty");
jo.put("comprehensive_qty", comprehensive_qty);
map.put("worksection_type_scode", "03");
int end_product_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("real_qty");
jo.put("end_product_qty", end_product_qty);
jo.put("date",date.substring(5,date.length()));
results.add(jo);
}
JSONObject returnjo = new JSONObject();
@@ -147,20 +171,24 @@ public class ProductServiceImpl implements ProductService {
//30天产量走势
JSONArray dataArr = new JSONArray();
JSONArray results = new JSONArray();
for (int i = 1; i < 31; i++) {
for (int i = 0; i < 30; i++) {
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), -i);
dataArr.add(dateTime.toString().substring(0, 10));
}
for (int i = 0; i < dataArr.size(); i++) {
JSONObject jo = new JSONObject();
JSONObject datejo = dataArr.getJSONObject(i);
String date = datejo.get(i).toString();
jo.put("date", date);
String date = dataArr.get(dataArr.size()-i-1).toString();
Map map = new HashMap();
map.put("flag", "9");
map.put("produce_date", date);
int real_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("real_qty");
int real_qty = 0;
JSONObject jsonObject = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonObject)) {
real_qty = jsonObject.getIntValue("real_qty");
}
jo.put("real_qty", real_qty);
jo.put("date", date.substring(5,date.length()));
results.add(jo);
}
JSONObject returnjo = new JSONObject();
@@ -189,6 +217,8 @@ public class ProductServiceImpl implements ProductService {
Map map = new HashMap();
map.put("flag", "12");
map.put("produce_date", today);
map.put("end_produce_date", today);
map.put("begin_produce_date", beginOfMonth);
JSONArray results = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
//计算所有的产能
map.put("flag", "13");
@@ -204,6 +234,7 @@ public class ProductServiceImpl implements ProductService {
if (count_num_flag < sum_count) {
JSONObject joo = new JSONObject();
joo.put("material_name", "其他");
joo.put("material_spec", "其他");
joo.put("real_qty", sum_count - count_num_flag);
results.add(joo);
}

View File

@@ -19,6 +19,9 @@
输入.end_time TYPEAS s_string
输入.now_time TYPEAS s_string
输入.produce_date TYPEAS s_string
输入.end_produce_date TYPEAS s_string
输入.begin_produce_date TYPEAS s_string
输入.worksection_type_scode TYPEAS s_string
@@ -47,7 +50,7 @@
IF 输入.flag = "1"
QUERY
SELECT
workprocedure.worksection_type_scode,
sum( shiftorder.real_qty ) AS real_qty,
sum( shiftorder.plan_qty ) AS plan_qty ,
convert(sum( shiftorder.real_qty )/sum( shiftorder.plan_qty ),DECIMAL(10,2))*100 as finish_rate
@@ -56,18 +59,15 @@
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
where
1=1
shiftorder.is_delete='0'
OPTION 输入.worksection_type_scode <> ""
workprocedure.worksection_type_scode = 输入.worksection_type_scode
ENDOPTION
OPTION 输入.begin_time <> ""
shiftorder.planproduceend_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
shiftorder.planproduceend_date <= 输入.end_time
ENDOPTION
GROUP BY
worksection_type_scode
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
@@ -79,16 +79,13 @@
shiftorder.plan_qty,
shiftorder.real_qty,
(shiftorder.plan_qty - shiftorder.real_qty) AS gap_qty,
CONVERT ( ( shiftorder.real_qty / shiftorder.plan_qty ), DECIMAL ( 10, 2 ) ) * 100 AS finish_rate
CONVERT ( ( shiftorder.real_qty / shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100 AS finish_rate
FROM
mps_bd_produceshiftorder shiftorder
where
1=1
OPTION 输入.begin_time <> ""
shiftorder.planproduceend_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
shiftorder.planproduceend_date <= 输入.end_time
shiftorder.is_delete='0'
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
@@ -101,7 +98,7 @@ IF 输入.flag = "3"
SELECT
sum( shiftorder.real_qty ) AS real_qty,
sum( shiftorder.plan_qty ) AS plan_qty,
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 2 ) ) * 100 AS finish_rate
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100 AS finish_rate
FROM
mps_bd_produceshiftorder shiftorder
RIGHT JOIN (
@@ -118,12 +115,9 @@ IF 输入.flag = "3"
AND a.workprocedure_id = shiftorder.workprocedure_id
where
1=1
OPTION 输入.begin_time <> ""
shiftorder.planproduceend_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
shiftorder.planproduceend_date <= 输入.end_time
ENDOPTION
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
@@ -135,13 +129,10 @@ ENDIF
FROM
mps_bd_produceshiftorder shiftorder
where
1=1
OPTION 输入.begin_time <> ""
shiftorder.planproduceend_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
shiftorder.planproduceend_date <= 输入.end_time
ENDOPTION
shiftorder.is_delete='0'
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
@@ -154,12 +145,9 @@ ENDIF
mps_bd_produceshiftorder shiftorder
where
shiftorder.realproduceend_date > shiftorder.planproduceend_date
OPTION 输入.begin_time <> ""
shiftorder.planproduceend_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
shiftorder.planproduceend_date <= 输入.end_time
ENDOPTION
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
@@ -170,18 +158,16 @@ ENDIF
SELECT
sum( real_qty ) AS real_qty,
sum( plan_qty ) AS plan_qty,
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 2 ) ) * 100 AS finish_rate
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100 AS finish_rate
FROM
mps_bd_produceshiftorder shiftorder
LEFT JOIN pdm_bi_workprocedure workprocedure ON workprocedure.workprocedure_id = shiftorder.workprocedure_id
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.begin_time <> ""
shiftorder.planproduceend_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
shiftorder.planproduceend_date <= 输入.end_time
ENDOPTION
shiftorder.is_delete='0'
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
@@ -193,17 +179,18 @@ IF 输入.flag = "8"
workprocedure.worksection_type_scode,
sum( real_qty ) AS real_qty,
sum( plan_qty ) AS plan_qty,
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 2 ) ) * 100 AS finish_rate
shiftorder.produce_date as date,
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100 AS finish_rate
FROM
mps_bd_produceshiftorder shiftorder
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
shiftorder.is_delete='0'
OPTION 输入.produce_date <> ""
shiftorder.produce_date >= 输入.produce_date
shiftorder.produce_date = 输入.produce_date
ENDOPTION
GROUP BY worksection_type_scode
GROUP BY worksection_type_scode,shiftorder.produce_date
ENDSELECT
ENDQUERY
ENDIF
@@ -217,9 +204,10 @@ IF 输入.flag = "9"
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
shiftorder.is_delete='0'
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.produce_date <> ""
shiftorder.produce_date >= 输入.produce_date
shiftorder.produce_date = 输入.produce_date
ENDOPTION
GROUP BY worksection_type_scode
ENDSELECT
@@ -232,6 +220,7 @@ IF 输入.flag = "10"
shiftorder.material_id,
material.material_code,
material.material_name,
material.material_spec,
sum( real_qty ) AS real_qty
FROM
mps_bd_produceshiftorder shiftorder
@@ -239,14 +228,16 @@ IF 输入.flag = "10"
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
left join md_me_materialbase material on material.material_id =shiftorder.material_id
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
shiftorder.is_delete='0'
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.produce_date <> ""
shiftorder.produce_date >= 输入.produce_date
shiftorder.produce_date = 输入.produce_date
ENDOPTION
GROUP BY
shiftorder.material_id,
material.material_code,
material.material_name
material.material_name,
material.material_spec
ORDER BY real_qty
LIMIT 0,10
ENDSELECT
@@ -265,17 +256,18 @@ IF 输入.flag = "11"
shiftorder. real_qty,
shiftorder.plan_qty,
shiftorder.plan_qty -shiftorder. real_qty as gap_qty,
curdate() as date
shiftorder.produce_date as date
FROM
mps_bd_produceshiftorder shiftorder
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
left join md_me_materialbase material on material.material_id =shiftorder.material_id
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
shiftorder.is_delete='0'
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
and shiftorder. real_qty < shiftorder.plan_qty
OPTION 输入.produce_date <> ""
shiftorder.produce_date >= 输入.produce_date
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
@@ -288,6 +280,7 @@ IF 输入.flag = "12"
shiftorder.material_id,
material.material_code,
material.material_name,
material.material_spec,
sum( real_qty ) AS real_qty
FROM
mps_bd_produceshiftorder shiftorder
@@ -295,13 +288,18 @@ IF 输入.flag = "12"
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
left join md_me_materialbase material on material.material_id =shiftorder.material_id
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.produce_date <> ""
shiftorder.produce_date >= 输入.produce_date
ENDOPTION
shiftorder.is_delete='0'
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.end_produce_date <> ""
shiftorder.produce_date <= 输入.end_produce_date
ENDOPTION
OPTION 输入.begin_produce_date <> ""
shiftorder.produce_date >= 输入.begin_produce_date
ENDOPTION
GROUP BY
shiftorder.material_id,
material.material_code,
material.material_spec,
material.material_name
ORDER BY real_qty
LIMIT 0,9
@@ -319,11 +317,67 @@ IF 输入.flag = "13"
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
left join md_me_materialbase material on material.material_id =shiftorder.material_id
WHERE
workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.produce_date <> ""
shiftorder.produce_date >= 输入.produce_date
shiftorder.is_delete='0'
and workprocedure.workprocedure_code IN ( '07', '06', '02' )
OPTION 输入.end_produce_date <> ""
shiftorder.produce_date <= 输入.end_produce_date
ENDOPTION
OPTION 输入.begin_produce_date <> ""
shiftorder.produce_date >= 输入.begin_produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
ENDIF
IF 输入.flag = "14"
QUERY
SELECT
sum( shiftorder.real_qty ) AS real_qty,
sum( shiftorder.plan_qty ) AS plan_qty ,
convert(sum( shiftorder.real_qty )/sum( shiftorder.plan_qty ),DECIMAL(10,2))*100 as finish_rate
FROM
mps_bd_produceshiftorder shiftorder
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
where
shiftorder.is_delete='0'
OPTION 输入.worksection_type_scode <> ""
workprocedure.worksection_type_scode = 输入.worksection_type_scode
ENDOPTION
OPTION 输入.end_produce_date <> ""
shiftorder.produce_date <= 输入.end_produce_date
ENDOPTION
OPTION 输入.begin_produce_date <> ""
shiftorder.produce_date >= 输入.begin_produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "15"
QUERY
SELECT
sum( real_qty ) AS real_qty,
sum( plan_qty ) AS plan_qty,
CONVERT ( sum( shiftorder.real_qty ) / sum( shiftorder.plan_qty ), DECIMAL ( 10, 3 ) ) * 100 AS finish_rate
FROM
mps_bd_produceshiftorder shiftorder
LEFT JOIN pdm_bi_workprocedure workprocedure ON shiftorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict_detail sys ON sys.VALUE= workprocedure.worksection_type_scode AND sys.dict_id = '87'
WHERE
shiftorder.is_delete='0'
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
OPTION 输入.worksection_type_scode <> ""
workprocedure.worksection_type_scode = 输入.worksection_type_scode
ENDOPTION
OPTION 输入.produce_date <> ""
shiftorder.produce_date = 输入.produce_date
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -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");
}
//初始化xy坐标
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);
}
}