fix:新增飞书接口
This commit is contained in:
@@ -153,4 +153,11 @@ public class LmsToMesController {
|
||||
public ResponseEntity<Object> GetInspectionResult(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.getInspectionResult(jo), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/EditSheetApi")
|
||||
@Log("LMS获取MES称重后子卷信息")
|
||||
@SaIgnore
|
||||
public ResponseEntity<Object> EditSheetApi(@RequestBody JSONObject jo) {
|
||||
return new ResponseEntity<>(lmsToMesService.EditSheetApi(jo), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -186,4 +186,6 @@ public interface LmsToMesService {
|
||||
JSONObject BoxDataCollectionSubmit2(JSONObject jo);
|
||||
|
||||
JSONObject getInspectionResult(JSONObject jo);
|
||||
|
||||
JSONObject EditSheetApi(JSONObject jo);
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import org.nl.b_lms.storage_manage.database.service.IBstIvtBoxinfoService;
|
||||
import org.nl.common.enums.SpecEnum;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.wql.WQL;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.modules.wql.util.SpringContextHolder;
|
||||
import org.nl.system.service.param.impl.SysParamServiceImpl;
|
||||
@@ -30,6 +31,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -981,9 +985,9 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
if ("E".equals(RTYPE)) {
|
||||
throw new BadRequestException(result.getString("RTMSG"));
|
||||
}
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.BZ_MES,param,Boolean.TRUE,null,list);
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.BZ_MES, param, Boolean.TRUE, null, list);
|
||||
} catch (Exception e) {
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.BZ_MES,param,Boolean.FALSE,e.getMessage(),list);
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.BZ_MES, param, Boolean.FALSE, e.getMessage(), list);
|
||||
throw new BadRequestException("MES提示错误:" + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
@@ -1022,25 +1026,25 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
JSONArray rows = new JSONArray();
|
||||
|
||||
JSONObject row1 = new JSONObject();
|
||||
row1.put("DataPointName","保护棉是否填充");
|
||||
row1.put("DataType","7");
|
||||
row1.put("DataValue","true");
|
||||
row1.put("DataCollectionDefId","001c61800000004f");
|
||||
row1.put("DataCollectionDefName","PACKAGE");
|
||||
row1.put("DataPointName", "保护棉是否填充");
|
||||
row1.put("DataType", "7");
|
||||
row1.put("DataValue", "true");
|
||||
row1.put("DataCollectionDefId", "001c61800000004f");
|
||||
row1.put("DataCollectionDefName", "PACKAGE");
|
||||
rows.add(row1);
|
||||
JSONObject row2 = new JSONObject();
|
||||
row2.put("DataPointName","信息核对准确");
|
||||
row2.put("DataType","7");
|
||||
row2.put("DataValue","true");
|
||||
row2.put("DataCollectionDefId","001c61800000004f");
|
||||
row2.put("DataCollectionDefName","PACKAGE");
|
||||
row2.put("DataPointName", "信息核对准确");
|
||||
row2.put("DataType", "7");
|
||||
row2.put("DataValue", "true");
|
||||
row2.put("DataCollectionDefId", "001c61800000004f");
|
||||
row2.put("DataCollectionDefName", "PACKAGE");
|
||||
rows.add(row2);
|
||||
JSONObject row3 = new JSONObject();
|
||||
row3.put("DataPointName","木箱是否防护");
|
||||
row3.put("DataType","7");
|
||||
row3.put("DataValue","true");
|
||||
row3.put("DataCollectionDefId","001c61800000004f");
|
||||
row3.put("DataCollectionDefName","PACKAGE");
|
||||
row3.put("DataPointName", "木箱是否防护");
|
||||
row3.put("DataType", "7");
|
||||
row3.put("DataValue", "true");
|
||||
row3.put("DataCollectionDefId", "001c61800000004f");
|
||||
row3.put("DataCollectionDefName", "PACKAGE");
|
||||
rows.add(row3);
|
||||
param.put("DataPoints", rows);
|
||||
log.info("BoxDataCollectionSubmit2接口请求参数为:-------------------" + param.toString());
|
||||
@@ -1054,13 +1058,13 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
|
||||
String RTYPE = result.getString("RTYPE");
|
||||
if ("E".equals(RTYPE)) {
|
||||
throw new BadRequestException("MES提示错误:" +result.getString("RTMSG"));
|
||||
throw new BadRequestException("MES提示错误:" + result.getString("RTMSG"));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.YX_MES,param,Boolean.FALSE,e.getMessage(),containerName);
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.YX_MES, param, Boolean.FALSE, e.getMessage(), containerName);
|
||||
throw new BadRequestException("MES错误:" + e.getMessage());
|
||||
}
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.YX_MES,param,Boolean.TRUE,null,containerName);
|
||||
PdmProductSpecServiceImpl.doRecord(SpecEnum.YX_MES, param, Boolean.TRUE, null, containerName);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1225,4 +1229,34 @@ public class LmsToMesServiceImpl implements LmsToMesService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject EditSheetApi(JSONObject jo) {
|
||||
JSONObject feishu_json = new JSONObject();
|
||||
feishu_json.put("app_token", "B6r1bVaHmak3xQsL8kMc9gM5nxf");
|
||||
feishu_json.put("tableid", "tbluPCwWQcvOprcx");
|
||||
|
||||
// 获取当前时间
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 1. 当天早上 8 点:将当前时间的时、分、秒、纳秒设为 8:00:00
|
||||
LocalDateTime today8AM = now.withHour(7)
|
||||
.withMinute(59)
|
||||
.withSecond(59)
|
||||
.withNano(0);
|
||||
|
||||
// 2. 前一天早上 8 点:当天 8 点减去 1 天
|
||||
LocalDateTime yesterday8AM = today8AM.minus(1, ChronoUnit.DAYS).plusSeconds(1);
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
//String begin_time = yesterday8AM.format(formatter);
|
||||
String begin_time = "2025-06-24 08:00:00";
|
||||
//String end_time = today8AM.format(formatter);
|
||||
String end_time = "2025-06-25 07:59:59";
|
||||
JSONArray rows = WQL.getWO("ST_IVT_INBILLQUERY").addParam("flag", "7")
|
||||
.addParam("begin_time", begin_time)
|
||||
.addParam("end_time", end_time)
|
||||
.process().getResultJSONArray(0);
|
||||
feishu_json.put("MsgList", rows);
|
||||
log.info(feishu_json.toString());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -955,7 +955,7 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
}
|
||||
String Status = param.getJSONObject(0).getString("Status");
|
||||
String ResourceName = param.getJSONObject(0).getString("ResourceName");
|
||||
String Attribute1 = param.getJSONObject(0).getString("Attribute1");
|
||||
String Attribute2 = param.getJSONObject(0).getString("Attribute2");
|
||||
JSONObject cut_jo = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("ext_code = '" + ResourceName + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isEmpty(cut_jo)) {
|
||||
throw new BadRequestException("分切计划对应的分切机不存在:" + ResourceName);
|
||||
@@ -1006,8 +1006,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
plan_jo.put("is_parent_ok", "1");
|
||||
plan_jo.put("is_child_tz_ok", "1");
|
||||
plan_jo.put("is_child_ps_ok", "1");
|
||||
if (StrUtil.isNotEmpty(Attribute1)) {
|
||||
plan_jo.put("foil_container_name", Attribute1);
|
||||
if (StrUtil.isNotEmpty(Attribute2)) {
|
||||
plan_jo.put("foil_container_name", Attribute2);
|
||||
}
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
}
|
||||
@@ -1087,8 +1087,8 @@ public class MesToLmsServiceImpl implements MesToLmsService {
|
||||
plan_jo.put("is_child_tz_ok", "1");
|
||||
plan_jo.put("is_child_ps_ok", "1");
|
||||
plan_jo.put("is_paper_ok", "2");
|
||||
if (StrUtil.isNotEmpty(Attribute1)) {
|
||||
plan_jo.put("foil_container_name", Attribute1);
|
||||
if (StrUtil.isNotEmpty(Attribute2)) {
|
||||
plan_jo.put("foil_container_name", Attribute2);
|
||||
}
|
||||
WQLObject.getWQLObject("pdm_bi_slittingproductionplan").update(plan_jo);
|
||||
}
|
||||
|
||||
@@ -386,12 +386,6 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String a = "A1_FQSS_IN";
|
||||
String substring = a.substring(0, 2);
|
||||
System.out.printf(substring);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public JSONObject returnVehicle(JSONObject whereJson) {
|
||||
@@ -413,8 +407,8 @@ public class ShippingServiceImpl implements ShippingService {
|
||||
sm_json.put("product_area", request_area);
|
||||
JSONObject jsonObject = AcsUtil.notifyAcsObject("api/wms/getBarcode", sm_json);
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && !jsonObject.getString("device_code").equals(vehicle_code)) {
|
||||
throw new BadRequestException("扫码器返回的托盘码【" + jsonObject.getString("device_code") + "】与手持扫码不一致!");
|
||||
if (ObjectUtil.isNotEmpty(jsonObject) && !jsonObject.getString("vehicle_code").equals(vehicle_code)) {
|
||||
throw new BadRequestException("扫码器返回的托盘码【" + jsonObject.getString("vehicle_code") + "】与手持扫码不一致!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1295,3 +1295,126 @@
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
IF 输入.flag = "7"
|
||||
QUERY
|
||||
SELECT
|
||||
FLOOR(UNIX_TIMESTAMP(DATE_FORMAT(NOW(), '%Y-%m-%d 08:00:00'))) AS '日期',
|
||||
CASE
|
||||
WHEN DATE_FORMAT(mst.confirm_time, '%H:%i:%s') >= '08:00:00'
|
||||
AND DATE_FORMAT(mst.confirm_time, '%H:%i:%s') <= '19:59:59' THEN '白班'
|
||||
WHEN DATE_FORMAT(mst.confirm_time, '%H:%i:%s') >= '20:00:00'
|
||||
AND DATE_FORMAT(mst.confirm_time, '%H:%i:%s') <= '23:59:59' OR
|
||||
DATE_FORMAT(mst.confirm_time, '%H:%i:%s') >= '00:00:00'
|
||||
AND DATE_FORMAT(mst.confirm_time, '%H:%i:%s') <= '07:59:59' THEN '晚班'
|
||||
END AS '班次',
|
||||
SUBSTRING_INDEX(sub.sale_order_name, '-', '1') AS '销售订单',
|
||||
SUBSTRING_INDEX(sub.sale_order_name, '-', '-1') AS '行号',
|
||||
'生产入库' AS '业务类型',
|
||||
cust.cust_name AS '客户编码',
|
||||
sub.customer_description AS '客户名称',
|
||||
cust.sales_owner AS '业务员',
|
||||
sub.thickness AS '规格',
|
||||
sub.width_standard AS '尺寸(mm)(客户要求幅宽)',
|
||||
sub.width AS '实际尺寸(mm)(实际幅宽)',
|
||||
CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX(mb.material_name, '|', 3), '|', -1), '*',
|
||||
SUBSTRING_INDEX(SUBSTRING_INDEX(mb.material_name, '|', 4), '|', -1)) AS '木箱规格|尺寸',
|
||||
sub.box_weight AS '毛重合计',
|
||||
sub.container_name AS '小卷号',
|
||||
sub.sap_pcsn AS 'SAP批次号',
|
||||
sub.net_weight AS '净重',
|
||||
sub.quanlity_in_box AS '卷数',
|
||||
'A' AS '品级',
|
||||
sub.package_box_sn AS '箱号',
|
||||
sub.sale_order_name AS '销售订单及行号',
|
||||
CASE
|
||||
|
||||
WHEN plan.parent_container_name <> '' THEN
|
||||
plan.parent_container_name
|
||||
ELSE plan.restruct_container_name
|
||||
END AS '母卷号',
|
||||
sub.mass_per_unit_area AS '基重(g|m³)(面密度)',
|
||||
'±1' AS '居中度(mm)',
|
||||
'≤10' AS '塌边(mm)',
|
||||
sub.length AS '米数(长度)',
|
||||
CASE
|
||||
|
||||
WHEN plan.paper_tube_or_FRP = '1' THEN
|
||||
'纸管'
|
||||
WHEN plan.paper_tube_or_FRP = '2' THEN
|
||||
'FRP管'
|
||||
END AS '管件类型',
|
||||
CASE
|
||||
|
||||
WHEN plan.paper_tube_or_FRP = '1' THEN
|
||||
plan.paper_tube_material
|
||||
WHEN plan.paper_tube_or_FRP = '2' THEN
|
||||
plan.FRP_material
|
||||
END AS '管件编码',
|
||||
CASE
|
||||
|
||||
WHEN plan.paper_tube_or_FRP = '1' THEN
|
||||
plan.paper_tube_description
|
||||
WHEN plan.paper_tube_or_FRP = '2' THEN
|
||||
plan.FRP_description
|
||||
END AS '管件描述',
|
||||
sub.actual_value AS '生产实际抗拉值',
|
||||
sub.standard_limit AS '内控标准抗拉下限',
|
||||
sub.demand_limit AS '客户需求抗拉下限',
|
||||
FLOOR(UNIX_TIMESTAMP(sub.date_of_production) * 1000) AS '生产日期',
|
||||
FLOOR(UNIX_TIMESTAMP(mst.confirm_time) * 1000) AS '入库日期',
|
||||
substr(sub.container_name, 1, 2) AS '生产区域'
|
||||
FROM (SELECT MIN(a.iostorinvdis_id) AS iostorinvdis_id
|
||||
FROM st_ivt_iostorinvdis a
|
||||
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
|
||||
WHERE b.io_type = '0'
|
||||
AND b.bill_type = '0001'
|
||||
AND b.confirm_time >= '2025-06-24 08:00:00'
|
||||
AND b.confirm_time <= '2025-06-25 07:59:59'
|
||||
AND b.bill_status = '99'
|
||||
GROUP BY pcsn
|
||||
UNION
|
||||
SELECT MIN(a.iostorinvdis_id) AS iostorinvdis_id
|
||||
FROM st_ivt_iostorinvdis a
|
||||
LEFT JOIN st_ivt_iostorinv b ON a.iostorinv_id = b.iostorinv_id
|
||||
WHERE b.io_type = '0'
|
||||
AND b.bill_type = '0007'
|
||||
AND b.confirm_time >= 输入.begin_time
|
||||
AND b.confirm_time <= 输入.end_time
|
||||
AND b.bill_status = '99'
|
||||
GROUP BY pcsn) c
|
||||
LEFT JOIN st_ivt_iostorinvdis dis ON dis.iostorinvdis_id = c.iostorinvdis_id
|
||||
LEFT JOIN st_ivt_iostorinv mst ON mst.iostorinv_id = dis.iostorinv_id
|
||||
LEFT JOIN st_ivt_sectattr sect ON sect.sect_id = dis.sect_id
|
||||
LEFT JOIN md_me_materialbase mater ON mater.material_id = dis.material_id
|
||||
INNER JOIN pdm_bi_subpackagerelationrecord sub ON sub.container_name = dis.pcsn
|
||||
AND sub.package_box_sn = dis.box_no
|
||||
AND sub.bill_id = dis.iostorinv_id
|
||||
LEFT JOIN md_cs_customerbase cust ON cust.cust_code = sub.customer_name
|
||||
LEFT JOIN (SELECT container_name,
|
||||
MAX(paper_tube_or_FRP) AS paper_tube_or_FRP,
|
||||
MAX(paper_tube_material) AS paper_tube_material,
|
||||
MAX(paper_tube_description) AS paper_tube_description,
|
||||
MAX(paper_tube_model) AS paper_tube_model,
|
||||
MAX(FRP_material) AS FRP_material,
|
||||
MAX(parent_container_name) AS parent_container_name,
|
||||
MAX(restruct_container_name) AS restruct_container_name,
|
||||
MAX(FRP_description) AS FRP_description,
|
||||
MAX(FRP_model) AS FRP_model,
|
||||
MAX(foil_container_name) AS foil_container_name
|
||||
FROM pdm_bi_slittingproductionplan plan1
|
||||
WHERE plan1.is_delete = '0'
|
||||
GROUP BY container_name) plan ON plan.container_name = sub.container_name
|
||||
LEFT JOIN md_me_materialbase mb ON mb.material_code = sub.box_type
|
||||
WHERE mst.io_type = '0'
|
||||
AND mst.is_delete = '0'
|
||||
AND mst.bill_status = '99'
|
||||
AND IFNULL(sub.sub_type, '') = ''
|
||||
AND mst.confirm_time >= 输入.begin_time
|
||||
AND mst.confirm_time <= 输入.end_time
|
||||
ORDER BY mst.confirm_time DESC,
|
||||
dis.box_no
|
||||
ENDSELECT
|
||||
ENDQUERY
|
||||
ENDIF
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user