Merge branch 'master' of http://121.40.234.130:8899/root/hl_one
This commit is contained in:
@@ -49,4 +49,18 @@ public class AcsToWmsController {
|
||||
public ResponseEntity<Object> orderFinish(@RequestBody String string) {
|
||||
return new ResponseEntity<>(acsToWmsService.orderFinish(string), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/feedDeviceStatusType")
|
||||
@Log("向wms反馈设备状态")
|
||||
@ApiOperation("向wms反馈设备状态")
|
||||
public ResponseEntity<Object> feedDeviceStatusType(@RequestBody String string) {
|
||||
return new ResponseEntity<>(acsToWmsService.feedDeviceStatusType(string), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/feedOrderRealQty")
|
||||
@Log("向wms反订单实施数量")
|
||||
@ApiOperation("向wms反订单实施数量")
|
||||
public ResponseEntity<Object> feedOrderRealQty(@RequestBody String string) {
|
||||
return new ResponseEntity<>(acsToWmsService.feedOrderRealQty(string), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,4 +39,18 @@ public interface AcsToWmsService {
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> orderFinish(String string);
|
||||
|
||||
/**
|
||||
* ACS给WMS反馈设备状态状态
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> feedDeviceStatusType(String string);
|
||||
|
||||
/**
|
||||
* ACS给WMS反馈订单实时数量
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> feedOrderRealQty(String string);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package org.nl.wms.ext.acs.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -132,22 +133,74 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
public Map<String, Object> orderFinish(String string) {
|
||||
JSONObject orderJson = JSONObject.parseObject(string);
|
||||
String ext_order_id = orderJson.getString("ext_order_id");
|
||||
// JSONArray array = JSONArray.parseArray(string);
|
||||
// JSONArray array = JSONArray.parseArray(string);
|
||||
String now = DateUtil.now();
|
||||
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("produceorder_id",ext_order_id);
|
||||
map.put("order_status","04");
|
||||
map.put("produceorder_id", ext_order_id);
|
||||
map.put("order_status", "04");
|
||||
map.put("update_optid", 1111111111);
|
||||
map.put("device_id", "");
|
||||
map.put("update_optname", "acs");
|
||||
map.put("update_time", now);
|
||||
map.put("realproduceend_date", now);
|
||||
wo.update(map,"produceorder_id = '"+ext_order_id+"'");
|
||||
wo.update(map, "produceorder_id = '" + ext_order_id + "'");
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "任务状态反馈成功!");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> feedDeviceStatusType(String string) {
|
||||
JSONObject param = JSONObject.parseObject(string);
|
||||
String device_code = param.getString("device_code");
|
||||
String status_type = param.getString("status_type");
|
||||
String start_time = param.getString("start_time");
|
||||
Integer error_code = Integer.parseInt(param.getString("error_code"));
|
||||
WQLObject wo = WQLObject.getWQLObject("pdm_bi_device");
|
||||
JSONObject device_json = wo.query("is_delete = '0' and is_active = '1' and device_code = '" + device_code + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(device_json)) {
|
||||
String device_id = device_json.getString("device_id");
|
||||
WQLObject wo_status = WQLObject.getWQLObject("PDM_BI_DeviceRunStatusRecord");
|
||||
JSONObject status_json = wo_status.query("device_id = '" + device_id + "' and (end_time is null or end_time = '' )").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(status_json)){
|
||||
status_json.put("end_time", start_time);
|
||||
wo_status.update(status_json);
|
||||
}
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("record_id", IdUtil.getSnowflake(1, 1).nextId());
|
||||
map.put("device_id", device_id);
|
||||
map.put("status_type", status_type);
|
||||
map.put("start_time", start_time);
|
||||
if (error_code > 0 && error_code < 50){
|
||||
map.put("err_status_id",error_code);
|
||||
} else if (error_code > 50){
|
||||
map.put("err_status_id", error_code - 50);
|
||||
} else {
|
||||
map.put("err_status_id", null);
|
||||
}
|
||||
wo_status.insert(map);
|
||||
}
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "设备状态反馈成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> feedOrderRealQty(String string) {
|
||||
JSONObject param = JSONObject.parseObject(string);
|
||||
String order_code = param.getString("order");
|
||||
String real_qty = param.getString("real_qty");
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
JSONObject map = new JSONObject();
|
||||
map.put("real_qty",real_qty);
|
||||
wo.update(map,"produceorder_code = '"+order_code+"'");
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("status", HttpStatus.OK.value());
|
||||
result.put("message", "设备状态反馈成功");
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,44 +18,42 @@ import java.util.Map;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class ProductServiceImpl implements ProductService {
|
||||
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) {
|
||||
String today = DateUtil.today();
|
||||
//计算当天的计划达成
|
||||
//01-弯头工段、02-综合工段、03-成品工段
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "1");
|
||||
map.put("produce_date", today);
|
||||
map.put("worksection_type_scode","01");
|
||||
map.put("worksection_type_scode", "01");
|
||||
JSONObject jo1 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
|
||||
map.put("worksection_type_scode","02");
|
||||
map.put("worksection_type_scode", "02");
|
||||
JSONObject jo2 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
|
||||
map.put("worksection_type_scode","03");
|
||||
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);
|
||||
dayResult.put("jo1", jo1);
|
||||
dayResult.put("jo2", jo2);
|
||||
dayResult.put("jo3", jo3);
|
||||
|
||||
//计算一个月的计划达成
|
||||
String beginOfMonth = DateUtil.formatTime(DateUtil.beginOfMonth(DateUtil.parseDate(today)));
|
||||
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");
|
||||
map.put("worksection_type_scode", "01");
|
||||
JSONObject joo1 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
|
||||
map.put("worksection_type_scode","02");
|
||||
map.put("worksection_type_scode", "02");
|
||||
JSONObject joo2 = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0);
|
||||
map.put("worksection_type_scode","03");
|
||||
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);
|
||||
monthResult.put("joo1", joo1);
|
||||
monthResult.put("joo2", joo2);
|
||||
monthResult.put("joo3", joo3);
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
@@ -66,6 +64,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> productSchedule(Map<String, String> param) {
|
||||
String today = DateUtil.today();
|
||||
//今日排产生产进度跟踪
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "2");
|
||||
@@ -81,6 +80,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
@Override
|
||||
public Map<String, Object> output(Map<String, String> param) {
|
||||
JSONObject result = new JSONObject();
|
||||
String today = DateUtil.today();
|
||||
Map map = new HashMap();
|
||||
// map.put("flag", "3");
|
||||
map.put("flag", "7");
|
||||
@@ -99,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("product_date",today);
|
||||
map.put("product_date", today);
|
||||
map.put("flag", "5");
|
||||
|
||||
int delayed_qty = WQL.getWO("BIGSCREENPRODUCT").addParamMap(map).process().uniqueResult(0).getIntValue("count");
|
||||
@@ -121,13 +121,14 @@ public class ProductServiceImpl implements ProductService {
|
||||
//获取一周的日期
|
||||
JSONArray dataArr = new JSONArray();
|
||||
JSONArray results = new JSONArray();
|
||||
String now = DateUtil.now();
|
||||
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();
|
||||
String date = dataArr.get(( dataArr.size()-i-1)).toString();
|
||||
String date = dataArr.get((dataArr.size() - i - 1)).toString();
|
||||
|
||||
//01-弯头工段、02-综合工段、03-成品工段
|
||||
Map map = new HashMap();
|
||||
@@ -142,7 +143,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
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()));
|
||||
jo.put("date", date.substring(5, date.length()));
|
||||
results.add(jo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
@@ -154,6 +155,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> topHarvest(Map<String, String> param) {
|
||||
String today = DateUtil.today();
|
||||
//今日Top10产量
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "10");
|
||||
@@ -169,6 +171,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
@Override
|
||||
public Map<String, Object> monthHarvest(Map<String, String> param) {
|
||||
//30天产量走势
|
||||
String now = DateUtil.now();
|
||||
JSONArray dataArr = new JSONArray();
|
||||
JSONArray results = new JSONArray();
|
||||
for (int i = 0; i < 30; i++) {
|
||||
@@ -177,7 +180,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
}
|
||||
for (int i = 0; i < dataArr.size(); i++) {
|
||||
JSONObject jo = new JSONObject();
|
||||
String date = dataArr.get(dataArr.size()-i-1).toString();
|
||||
String date = dataArr.get(dataArr.size() - i - 1).toString();
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "9");
|
||||
@@ -188,7 +191,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
real_qty = jsonObject.getIntValue("real_qty");
|
||||
}
|
||||
jo.put("real_qty", real_qty);
|
||||
jo.put("date", date.substring(5,date.length()));
|
||||
jo.put("date", date.substring(5, date.length()));
|
||||
results.add(jo);
|
||||
}
|
||||
JSONObject returnjo = new JSONObject();
|
||||
@@ -200,6 +203,7 @@ public class ProductServiceImpl implements ProductService {
|
||||
|
||||
@Override
|
||||
public Map<String, Object> unfinishOrder(Map<String, String> param) {
|
||||
String today = DateUtil.today();
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "11");
|
||||
map.put("produce_date", today);
|
||||
@@ -214,6 +218,9 @@ public class ProductServiceImpl implements ProductService {
|
||||
@Override
|
||||
public Map<String, Object> monthOrder(Map<String, String> param) {
|
||||
//计算前9种物料产能
|
||||
String today = DateUtil.today();
|
||||
String beginOfMonth = DateUtil.formatTime(DateUtil.beginOfMonth(DateUtil.parseDate(today)));
|
||||
|
||||
Map map = new HashMap();
|
||||
map.put("flag", "12");
|
||||
map.put("produce_date", today);
|
||||
@@ -230,14 +237,15 @@ public class ProductServiceImpl implements ProductService {
|
||||
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("material_spec", "其他");
|
||||
joo.put("real_qty", sum_count - count_num_flag);
|
||||
results.add(joo);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
JSONObject returnjo = new JSONObject();
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "操作成功!");
|
||||
|
||||
Reference in New Issue
Block a user