Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.material_code TYPEAS s_string
|
||||
输入.processroute_uuid TYPEAS s_string
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
@@ -197,4 +198,29 @@ IF 输入.flag = "14"
|
||||
AND sys.sysdic_type = 'IF_WCS_DEVICESERIES'
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
IF 输入.flag = "15"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
PDM_BI_ProduceProcessRoute route
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "16"
|
||||
QUERY
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
PDM_BI_ProduceProcessRoute route
|
||||
LEFT JOIN PDM_BI_ProduceProcessRouteDtl dtl ON route.processroute_uuid = dtl.processroute_uuid
|
||||
route.processroute_uuid = 输入.processroute_uuid
|
||||
order by workprocedure_number
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
@@ -0,0 +1,84 @@
|
||||
|
||||
package org.nl.wms.ext.bigScreen.rest;
|
||||
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.annotation.Log;
|
||||
|
||||
import org.nl.wms.ext.bigScreen.service.ProductService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author ldjun
|
||||
* @date 2021-07-26
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "大屏生产监控中心")
|
||||
@RequestMapping("/api/bigscreen/product")
|
||||
@Slf4j
|
||||
public class ProductController {
|
||||
|
||||
private final ProductService pdaBindingService;
|
||||
|
||||
@PostMapping("/planReached")
|
||||
@Log("计划达成")
|
||||
@ApiOperation("计划达成")
|
||||
public ResponseEntity<Object> planReached(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.planReached(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/productSchedule")
|
||||
@Log("今日排产生产进度跟踪")
|
||||
@ApiOperation("今日排产生产进度跟踪")
|
||||
public ResponseEntity<Object> productSchedule(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.productSchedule(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/output")
|
||||
@Log("今日产量")
|
||||
@ApiOperation("今日产量")
|
||||
public ResponseEntity<Object> output(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.output(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/worksectionHarvest")
|
||||
@Log("近一周工段产量")
|
||||
@ApiOperation("近一周工段产量")
|
||||
public ResponseEntity<Object> worksectionHarvest(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.worksectionHarvest(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/topHarvest")
|
||||
@Log("今日Top10产量")
|
||||
@ApiOperation("今日Top10产量")
|
||||
public ResponseEntity<Object> topHarvest(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.topHarvest(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/monthHarvest")
|
||||
@Log("30天产量走势")
|
||||
@ApiOperation("30天产量走势")
|
||||
public ResponseEntity<Object> monthHarvest(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.monthHarvest(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/unfinishOrder")
|
||||
@Log("今日未完成订单")
|
||||
@ApiOperation("今日未完成订单")
|
||||
public ResponseEntity<Object> unfinishOrder(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.unfinishOrder(param), HttpStatus.OK);
|
||||
}
|
||||
@PostMapping("/monthOrder")
|
||||
@Log("30天生产订单分布")
|
||||
@ApiOperation("30天生产订单分布")
|
||||
public ResponseEntity<Object> monthOrder(@RequestBody Map<String, String> param) {
|
||||
return new ResponseEntity<>(pdaBindingService.monthOrder(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package org.nl.wms.ext.bigScreen.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public interface ProductService {
|
||||
/**
|
||||
* 计划达成
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> planReached(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 今日排产生产进度跟踪
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> productSchedule(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 今日产量
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> output(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 近一周工段产量
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> worksectionHarvest(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 今日Top10产量
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> topHarvest(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 30天产量走势
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> monthHarvest(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 今日未完成订单
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> unfinishOrder(@RequestBody Map<String, String> param);
|
||||
/**
|
||||
* 30天生产订单分布
|
||||
* @param param 条件
|
||||
* @return Map<String,Object>
|
||||
*
|
||||
*/
|
||||
Map<String, Object> monthOrder(@RequestBody Map<String, String> param);
|
||||
|
||||
|
||||
}
|
||||
@@ -6,12 +6,18 @@ import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.bigScreen.service.DeviceScreenService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class DeviceScreenServiceImpl implements DeviceScreenService {
|
||||
@Override
|
||||
public JSONObject deviceStatus(JSONObject param) {
|
||||
|
||||
@@ -0,0 +1,216 @@
|
||||
package org.nl.wms.ext.bigScreen.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.wms.ext.bigScreen.service.ProductService;
|
||||
import org.nl.wql.WQL;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@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));
|
||||
|
||||
@Override
|
||||
public Map<String, Object> planReached(Map<String, String> param) {
|
||||
//计算当天的计划达成
|
||||
//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("begin_time", beginMonthDateTime);
|
||||
JSONArray monthResult = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("dayResult", dayResult);
|
||||
returnjo.put("monthResult", monthResult);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> productSchedule(Map<String, String> param) {
|
||||
//今日排产生产进度跟踪
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "2");
|
||||
map.put("begin_time", beginTimeOfDay);
|
||||
map.put("end_time", endTimeOfDay);
|
||||
JSONArray result = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", result);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> output(Map<String, String> param) {
|
||||
JSONObject result = new JSONObject();
|
||||
Map map = new HashMap();
|
||||
// map.put("flag", "3");
|
||||
map.put("flag", "7");
|
||||
map.put("begin_time", beginTimeOfDay);
|
||||
map.put("end_time", endTimeOfDay);
|
||||
//统计产量方式一: 1 计算工单物料 2 计算每个物料清洗前一个工序 3拿着工序+物料 关联工单表 统计总数
|
||||
//1激光下料——推弯——清洗
|
||||
//2旋压-清洗
|
||||
//3盘管无屑下料-三通拉伸-镗孔-清洗
|
||||
//4直管无屑下料-镗孔-清洗
|
||||
//统计产量方式二: 只需要统计 推弯,旋压。镗孔 3个工序工单的数量 ('07','06','02')
|
||||
JSONObject joo = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
|
||||
result.put("real_qty", joo.getString("real_qty"));
|
||||
result.put("plan_qty", joo.getString("plan_qty"));
|
||||
result.put("finish_rate", joo.getString("finish_rate"));
|
||||
//统计工单个数
|
||||
map.put("flag", "4");
|
||||
int sum_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("count");
|
||||
//统计延时工单
|
||||
map.put("now_time", now);
|
||||
map.put("flag", "5");
|
||||
|
||||
int delayed_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("count");
|
||||
result.put("sum_qty", sum_qty);
|
||||
result.put("delayed_qty", delayed_qty);
|
||||
result.put("normal_qty", sum_qty - delayed_qty);
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", result);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> worksectionHarvest(Map<String, String> param) {
|
||||
//近一周工段产量
|
||||
//获取一周的日期
|
||||
JSONArray dataArr = new JSONArray();
|
||||
JSONArray results = new JSONArray();
|
||||
for (int i = 1; i < 9; 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);
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "8");
|
||||
map.put("produce_date", date);
|
||||
JSONArray arr = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
jo.put("data", arr);
|
||||
results.add(jo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> topHarvest(Map<String, String> param) {
|
||||
//今日Top10产量
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "10");
|
||||
map.put("produce_date", today);
|
||||
JSONArray results = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> monthHarvest(Map<String, String> param) {
|
||||
//30天产量走势
|
||||
JSONArray dataArr = new JSONArray();
|
||||
JSONArray results = new JSONArray();
|
||||
for (int i = 1; i < 31; 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);
|
||||
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");
|
||||
jo.put("real_qty", real_qty);
|
||||
results.add(jo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> unfinishOrder(Map<String, String> param) {
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "11");
|
||||
map.put("produce_date", today);
|
||||
JSONArray results = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> monthOrder(Map<String, String> param) {
|
||||
//计算前9种物料产能
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "12");
|
||||
map.put("produce_date", today);
|
||||
JSONArray results = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().getResultJSONArray(0);
|
||||
//计算所有的产能
|
||||
map.put("flag", "13");
|
||||
int sum_count = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("real_qty");
|
||||
//前几种物料的总和
|
||||
int count_num_flag = 0;
|
||||
//如果有9种物料则需要计算其他
|
||||
if (results.size() == 9) {
|
||||
for (int i = 0; i < results.size(); i++) {
|
||||
count_num_flag = count_num_flag + results.getJSONObject(i).getIntValue("real_qty");
|
||||
}
|
||||
}
|
||||
if (count_num_flag < sum_count) {
|
||||
JSONObject joo = new JSONObject();
|
||||
joo.put("material_name", "其他");
|
||||
joo.put("real_qty", sum_count - count_num_flag);
|
||||
results.add(joo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
returnjo.put("result", results);
|
||||
return returnjo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,329 @@
|
||||
[交易说明]
|
||||
交易名: bom查询
|
||||
所属模块:
|
||||
功能简述:
|
||||
版权所有:
|
||||
表引用:
|
||||
版本经历:
|
||||
|
||||
[数据库]
|
||||
--指定数据库,为空采用默认值,默认为db.properties中列出的第一个库
|
||||
|
||||
[IO定义]
|
||||
#################################################
|
||||
## 表字段对应输入参数
|
||||
#################################################
|
||||
输入.flag TYPEAS s_string
|
||||
输入.workprocedure TYPEAS s_string
|
||||
输入.begin_time TYPEAS s_string
|
||||
输入.end_time TYPEAS s_string
|
||||
输入.now_time TYPEAS s_string
|
||||
输入.produce_date TYPEAS s_string
|
||||
|
||||
|
||||
|
||||
[临时表]
|
||||
--这边列出来的临时表就会在运行期动态创建
|
||||
|
||||
[临时变量]
|
||||
--所有中间过程变量均可在此处定义
|
||||
|
||||
[业务过程]
|
||||
|
||||
##########################################
|
||||
# 1、输入输出检查 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 2、主过程前处理 #
|
||||
##########################################
|
||||
|
||||
|
||||
##########################################
|
||||
# 3、业务主过程 #
|
||||
##########################################
|
||||
|
||||
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
|
||||
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
|
||||
1=1
|
||||
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
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "2"
|
||||
QUERY
|
||||
SELECT
|
||||
shiftorder.produceorder_code,
|
||||
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
|
||||
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
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
IF 输入.flag = "3"
|
||||
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
|
||||
RIGHT JOIN (
|
||||
SELECT
|
||||
route.material_id,
|
||||
dtl.workprocedure_id
|
||||
FROM
|
||||
PDM_BI_ProductProcessRoute route
|
||||
LEFT JOIN PDM_BI_ProductProcessRouteDtl dtl ON route.productprocess_id = dtl.productprocess_id
|
||||
WHERE
|
||||
route.material_id IN ( SELECT DISTINCT shiftorder.material_id FROM mps_bd_produceshiftorder shiftorder )
|
||||
AND dtl.nextworkprocedure_id = '1535144552481034240'
|
||||
) a ON a.material_id = shiftorder.material_id
|
||||
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
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "4"
|
||||
QUERY
|
||||
SELECT
|
||||
count(*) as count
|
||||
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
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "5"
|
||||
QUERY
|
||||
SELECT
|
||||
count(*) as count
|
||||
FROM
|
||||
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
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "7"
|
||||
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, 2 ) ) * 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
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "8"
|
||||
QUERY
|
||||
SELECT
|
||||
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
|
||||
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' )
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date >= 输入.produce_date
|
||||
ENDOPTION
|
||||
GROUP BY worksection_type_scode
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "9"
|
||||
QUERY
|
||||
SELECT
|
||||
sum( real_qty ) AS real_qty
|
||||
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' )
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date >= 输入.produce_date
|
||||
ENDOPTION
|
||||
GROUP BY worksection_type_scode
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "10"
|
||||
QUERY
|
||||
SELECT
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
sum( real_qty ) AS real_qty
|
||||
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' )
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date >= 输入.produce_date
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name
|
||||
ORDER BY real_qty
|
||||
LIMIT 0,10
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "11"
|
||||
QUERY
|
||||
SELECT
|
||||
shiftorder.produceorder_code,
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
material.material_spec,
|
||||
shiftorder. real_qty,
|
||||
shiftorder.plan_qty,
|
||||
shiftorder.plan_qty -shiftorder. real_qty as gap_qty,
|
||||
curdate() 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' )
|
||||
and shiftorder. real_qty < shiftorder.plan_qty
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date >= 输入.produce_date
|
||||
ENDOPTION
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
IF 输入.flag = "12"
|
||||
QUERY
|
||||
SELECT
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name,
|
||||
sum( real_qty ) AS real_qty
|
||||
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' )
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date >= 输入.produce_date
|
||||
ENDOPTION
|
||||
GROUP BY
|
||||
shiftorder.material_id,
|
||||
material.material_code,
|
||||
material.material_name
|
||||
ORDER BY real_qty
|
||||
LIMIT 0,9
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "13"
|
||||
QUERY
|
||||
SELECT
|
||||
sum( real_qty ) AS real_qty
|
||||
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' )
|
||||
OPTION 输入.produce_date <> ""
|
||||
shiftorder.produce_date >= 输入.produce_date
|
||||
ENDOPTION
|
||||
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
Binary file not shown.
Binary file not shown.
@@ -41,6 +41,7 @@ public class CallMaterialTask extends AbstractAcsTask {
|
||||
//更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
jsonTask.put("car_no", taskObj.getString("car_no"));
|
||||
taskTab.update(jsonTask);
|
||||
HashMap map = new HashMap();
|
||||
map.put("bill_status", "40");
|
||||
|
||||
@@ -25,6 +25,7 @@ public class PointToPointTask extends AbstractAcsTask {
|
||||
//1:执行中,2:完成 ,3:acs取消
|
||||
if (status.equals("1")) {
|
||||
map.put("task_status", "03");
|
||||
map.put("car_no", taskObj.getString("car_no"));
|
||||
}
|
||||
if (status.equals("2")) {
|
||||
map.put("lock_type", "00");
|
||||
|
||||
@@ -50,6 +50,7 @@ public class SendMaterialTask extends AbstractAcsTask {
|
||||
//更新任务状态为执行中
|
||||
jsonTask.put("task_status", TaskStatusEnum.EXECUTING.getCode());
|
||||
jsonTask.put("update_time", DateUtil.now());
|
||||
jsonTask.put("car_no", taskObj.getString("car_no"));
|
||||
taskTab.update(jsonTask);
|
||||
HashMap map = new HashMap();
|
||||
map.put("update_optid", SecurityUtils.getCurrentUserId());
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
server:
|
||||
port: 8010
|
||||
#海亮sqlserver
|
||||
erp:
|
||||
sqlserver:
|
||||
enabled: false
|
||||
jdbcurl: jdbc:sqlserver://192.168.81.156;DatabaseName=hllg
|
||||
username: sa
|
||||
password: root
|
||||
|
||||
|
||||
#配置数据源
|
||||
spring:
|
||||
@@ -9,9 +17,11 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
#url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
#password: ${DB_PWD:P@ssw0rd}
|
||||
#password: ${DB_PWD:root}
|
||||
password: ${DB_PWD:Root.123456}
|
||||
# 初始连接数
|
||||
initial-size: 5
|
||||
@@ -163,5 +173,5 @@ jetcache:
|
||||
maxIdle: 200
|
||||
maxTotal: 1000
|
||||
uri:
|
||||
- redis://47.111.78.178:6379
|
||||
- redis://localhost:6379
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ spring:
|
||||
druid:
|
||||
db-type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.46.225}:${DB_PORT:3306}/${DB_NAME:hl_one_mes}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true&useSSL=false
|
||||
username: ${DB_USER:root}
|
||||
password: ${DB_PWD:123456}
|
||||
#password: ${DB_PWD:Root.123456}
|
||||
@@ -162,5 +162,5 @@ jetcache:
|
||||
maxIdle: 200
|
||||
maxTotal: 1000
|
||||
uri:
|
||||
- redis://192.168.46.225:6379
|
||||
- redis://localhost:6379
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ spring:
|
||||
freemarker:
|
||||
check-template-location: false
|
||||
profiles:
|
||||
active: prod
|
||||
active: dev
|
||||
jackson:
|
||||
time-zone: GMT+8
|
||||
data:
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
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.ObjectUtil;
|
||||
@@ -12,6 +13,7 @@ import org.nl.wql.WQL;
|
||||
import org.nl.wql.core.bean.WQLObject;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
public class Test3 extends BaseTest {
|
||||
@Test
|
||||
@@ -1055,8 +1057,78 @@ public class Test3 extends BaseTest {
|
||||
joo.put("lock_type","00");
|
||||
joo.put("material_height_type","1");
|
||||
structtable.insert(joo);
|
||||
}
|
||||
}
|
||||
//同步产品工艺路线
|
||||
@Test
|
||||
public void PDM_BI_ProductProcessRoute() {
|
||||
WQLObject routeTable = WQLObject.getWQLObject("PDM_BI_ProductProcessRoute");
|
||||
WQLObject dtlTable = WQLObject.getWQLObject("PDM_BI_ProductProcessRouteDtl");
|
||||
WQLObject materialTable = WQLObject.getWQLObject("md_me_materialbase");
|
||||
JSONArray ja = WQL.getWO("QLK01").setDbname("dataSource2").addParam("flag", "15").process().getResultJSONArray(0);
|
||||
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++) {
|
||||
JSONObject dtljo = dtlja.getJSONObject(i);
|
||||
JSONObject routejoo = new JSONObject();
|
||||
JSONObject routeDtljoo = new JSONObject();
|
||||
long productprocess_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
String material_code = dtljo.getString("material_code");
|
||||
JSONObject material_jo = materialTable.query("material_code='" + material_code + "'").uniqueResult(0);
|
||||
String material_id = material_jo.getString("material_id");
|
||||
|
||||
}
|
||||
long sale_id = IdUtil.getSnowflake(1, 1).nextId();
|
||||
String sale_code = jo.getString("Vbeln");
|
||||
String seq_no = jo.getString("Posnr");
|
||||
String sale_type = jo.getString("VtextLf");
|
||||
//物料编码
|
||||
JSONObject matrOBj = findMaterialByid(jo.getString("Matnr"));
|
||||
String material_id = matrOBj.getString("material_id");
|
||||
String status = "10";
|
||||
String sale_qty = jo.getString("Lfimg");
|
||||
String produce_seq = "1";
|
||||
String cust_code = jo.getString("Kunag");
|
||||
String cust_name = jo.getString("Name");
|
||||
//计量单位
|
||||
String Vrkme = jo.getString("Vrkme");
|
||||
JSONObject unitObj = finduntiByid(Vrkme);
|
||||
String qty_unit_id = unitObj.getString("measure_unit_id");
|
||||
String plandeliver_date = jo.getString("WadatIst");
|
||||
String create_id = "1";
|
||||
String create_name = "qinx";
|
||||
String create_time = "2021-12-9 14:15";
|
||||
|
||||
// caTable.insert(pcsjo);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main1231(String[] args) {
|
||||
String now ="2022-06-30";
|
||||
DateTime dateTime = DateUtil.offsetDay(DateUtil.parse(now), 30);
|
||||
System.out.println(dateTime.toString().substring(0,10));
|
||||
JSONArray dataArr = new JSONArray();
|
||||
for (int i = 1; i <9 ; i++) {
|
||||
DateTime dateTime11 = DateUtil.offsetDay(DateUtil.parse(now), -i);
|
||||
dataArr.add(dateTime11.toString().substring(0,10));
|
||||
}
|
||||
System.out.println("cesw");
|
||||
}
|
||||
|
||||
public static void main(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");
|
||||
System.out.println("12313");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user