fix:合并代码后部分SQL不兼容shardingsphereSQL

This commit is contained in:
zhouz
2026-02-04 09:55:30 +08:00
parent 8bc1783734
commit 0ff15043b9
15 changed files with 219 additions and 82 deletions

View File

@@ -119,6 +119,7 @@ public class TwoOutTask extends AbstractAcsTask {
.vehicle_code(json.getString("vehicle_code2"))
.vehicle_code2(json.getString("vehicle_code"))
.interaction_json(json.getJSONObject("request_param"))
.storage_task_type(StrUtil.isNotEmpty(json.getJSONObject("request_param").getString("storage_task_type")) ? json.getJSONObject("request_param").getString("storage_task_type") : null)
.route_plan_code(getRoutePlanCode(json.getString("point_code1")))
.priority(json.getString("zdepth"))
.class_type(json.getString("task_type"))

View File

@@ -129,16 +129,16 @@
</select>
<select id="getDisStructSet" resultType="org.nl.b_lms.storage_manage.ios.service.iostorInv.dto.StructAllsetDto">
select st_ivt_structattr.sect_id,
st_ivt_structattr.block_num,
st_ivt_structattr.row_num,
st_ivt_structattr.out_order_seq,
st_ivt_structattr.struct_code,
st_ivt_structattr.placement_type
select sa.sect_id,
sa.block_num,
sa.row_num,
sa.out_order_seq,
sa.struct_code,
sa.placement_type
from st_ivt_iostorinvdis dis
left join st_ivt_structattr on st_ivt_iostorinvdis.struct_code = st_ivt_structattr.struct_code
where st_ivt_iostorinvdis.work_status = '00'
and st_ivt_iostorinvdis.iostorinv_id = #{iostorinvId}
left join st_ivt_structattr sa on dis.struct_code = sa.struct_code
where dis.work_status = '00'
and dis.iostorinv_id = #{iostorinvId}
<if test="iostorinvDtlId != null and iostorinvDtlId != ''">
AND dis.iostorinvdtl_id = #{iostorinvDtlId}
</if>

View File

@@ -1995,6 +1995,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
);
request_param.put("containerType", boxDao.getVehicle_type());
jsonTaskParam.put("request_param", request_param);
jsonTaskParam.put("storage_task_type","1");
jsonTaskParam.put("table_fk", disDaoList.get(0).getIostorinv_id().toString());
if (json.getString("zdepth").equals(IOSEnum.ZDEPTH_STRUCT.code("")) ||
@@ -2005,7 +2006,7 @@ public class StIvtIostorinvOutServiceImpl extends ServiceImpl<StIvtIostorinvOutM
}
jsonTaskParam.put("request_param", jsonTaskParam);
TwoOutTask twoOutTask = new TwoOutTask();
TwoOutTask twoOutTask = SpringContextHolder.getBean(TwoOutTask.class);
String task_id = twoOutTask.createTask(jsonTaskParam);
// 更新分配明细

View File

@@ -26,7 +26,7 @@ public class CodeUtil {
try {
if (tryLock) {
String flag = "1";
String code = HttpUtil.get("http://127.0.0.1:8013/api/codeDetail/getNewCode?code=" + ruleCode + "&flag=" + flag);
String code = HttpUtil.get("http://10.1.3.90:8011/api/codeDetail/getNewCode?code=" + ruleCode + "&flag=" + flag);
if (code.contains("status")){
throw new BadRequestException(code);
}

View File

@@ -30,6 +30,7 @@
输入.sub_type TYPEAS s_string
输入.quality_scode TYPEAS s_string
输入.control TYPEAS s_string
输入.limit_date TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
@@ -647,6 +648,10 @@
ivt.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.limit_date <> ""
ivt.instorage_time <= 输入.limit_date
ENDOPTION
OPTION 输入.sap_pcsn <> ""
sub.sap_pcsn like 输入.sap_pcsn
ENDOPTION

View File

@@ -4,7 +4,17 @@
<select id="queryAll" resultType="java.util.Map">
SELECT
mst.*,
mst.control_id,
mst.control_code,
mst.biz_date,
mst.stor_id,
mst.total_qty,
mst.detail_count,
mst.bill_type,
mst.remark,
mst.input_optid,
mst.input_optname,
mst.input_time,
attr.stor_code,
attr.stor_name
FROM

View File

@@ -218,7 +218,7 @@ public class BakingServiceImpl implements BakingService {
param.put("product_area", jsonPointZc.getString("product_area"));
param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60));
InHotTask inHotTask = new InHotTask();
InHotTask inHotTask = SpringContextHolder.getBean(InHotTask.class);
String task_id = inHotTask.createTask(param);
// 3.插入主表
@@ -343,14 +343,14 @@ public class BakingServiceImpl implements BakingService {
param.put("request_param", NumberUtil.mul(Double.parseDouble(hours), 60));
// 创建冷却区 --> 暂存位的任务
InHotTask inHotTask = new InHotTask();
InHotTask inHotTask = SpringContextHolder.getBean(InHotTask.class);
String task_id = inHotTask.createTask(param);
// 4.插入烘箱区出入主表
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料");
throw new BadRequestException("物料基础信息中无此物料,联系海亮信息部人员补充【"+jsonRaw.getString("product_name")+"】物料信息");
}
JSONObject hotParam = new JSONObject();
@@ -430,7 +430,7 @@ public class BakingServiceImpl implements BakingService {
}
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料");
throw new BadRequestException("物料基础信息中无此物料,联系海亮信息部人员补充【"+jsonRaw.getString("product_name")+"】物料信息!");
}
//查询当前点位为空且没有任务的桁架内缓存点
@@ -562,7 +562,7 @@ public class BakingServiceImpl implements BakingService {
}
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料!");
throw new BadRequestException("物料基础信息中无此物料,联系海亮信息部人员补充【"+jsonRaw.getString("product_name")+"】物料信息");
}
//查询该母卷对应最近的一条入烘箱记录
@@ -739,7 +739,7 @@ public class BakingServiceImpl implements BakingService {
JSONObject jsonRaw = rawTab.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料!");
throw new BadRequestException("物料基础信息中无此物料,联系海亮信息部人员补充【"+jsonRaw.getString("product_name")+"】物料信息");
}
JSONObject jsonCool = new JSONObject();

View File

@@ -64,7 +64,7 @@ public class HandleBakingServiceImpl implements HandleBakingService {
JSONObject jsonRaw = pdmBiRawfoilworkorderService.query("container_name = '" + container_name + "' and is_delete = '0'").uniqueResult(0);
JSONObject jsonMater = materTab.query("material_code = '" + jsonRaw.getString("product_name") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) {
throw new BadRequestException("物料基础信息中无此物料");
throw new BadRequestException("物料基础信息中无此物料,联系海亮信息部人员补充【"+jsonRaw.getString("product_name")+"】物料信息");
}
if (StrUtil.equals(option, "1")) {

View File

@@ -145,4 +145,6 @@ public class AcsTaskDto {
private String barcode;
private String car_no;
private String storage_task_type;
}

View File

@@ -2,6 +2,7 @@ package org.nl.wms.sch.manage;
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;
@@ -14,7 +15,10 @@ import org.nl.modules.common.config.FileProperties;
import org.nl.modules.common.utils.FileUtil;
import org.nl.modules.common.utils.StringUtils;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.util.SpringContextHolder;
import org.nl.system.service.param.impl.SysParamServiceImpl;
import org.nl.system.service.tools.IToolLocalStorageService;
import org.nl.system.service.tools.dao.ToolLocalStorage;
import org.redisson.api.RLock;
@@ -68,10 +72,15 @@ public class AutoSaveIvtExcelTwo {
row.createCell(15).setCellValue("管件类型");
row.createCell(16).setCellValue("管件描述");
String limitDate = SpringContextHolder.getBean(SysParamServiceImpl.class).findByCode("limit_date").getValue();
//查询库存明细
JSONObject map = new JSONObject();
map.put("flag", "22");
map.put("ivt_status", "canuse_qty");
if (StrUtil.isNotEmpty(limitDate)) {
map.put("limit_date", limitDate);
}
JSONArray resultJSONArray = WQL.getWO("QST_STRUCTIVT001").addParamMap(map).process().getResultJSONArray(0);
@@ -99,9 +108,16 @@ public class AutoSaveIvtExcelTwo {
String type = FileUtil.getFileType("xls");
Date date = new Date();
String nowStr = "";
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String nowStr = format.format(date) + "-";
if (StrUtil.isNotEmpty(limitDate)){
SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = originalFormat.parse(limitDate);
nowStr = format.format(date) + "-";
}else {
Date date = new Date();
nowStr = format.format(date) + "-";
}
String path = properties.getPath().getPath() + type + File.separator + nowStr + "8库存报表.xls";
FileOutputStream fileOut = new FileOutputStream(path);
ToolLocalStorage localStorage = new ToolLocalStorage(

View File

@@ -4849,8 +4849,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
map.put("remark", "%" + map.get("remark") + "%");
}
JSONArray jo = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "3")
.addParam("material_id", map.get("material_id"))
.addParam("flag", "33")
.addParam("pcsn", map.get("pcsn"))
.addParam("sap_pcsn", map.get("sap_pcsn"))
.addParam("iostorinv_id", map.get("iostorinv_id"))
@@ -4926,7 +4925,7 @@ public class CheckOutBillServiceImpl implements CheckOutBillService {
for (String box_no : boxSet) {
JSONArray boxIvtArr = WQL.getWO("QST_IVT_CHECKOUTBILL")
.addParam("flag", "3")
.addParam("flag", "33")
.addParam("box_no", box_no)
.process()
.getResultJSONArray(0);

View File

@@ -603,6 +603,58 @@
ENDQUERY
ENDIF
IF 输入.flag = "33"
QUERY
SELECT
ivt2.*,
'0' AS plan_qty,
mb.material_code,
mb.material_name,
struct.sect_id,
struct.sect_name,
struct.sect_code,
struct.storagevehicle_id,
struct.storagevehicle_code,
point.point_id,
sub.sap_pcsn,
CASE
WHEN SUBSTRING(sub.container_name,1,1) = 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '180'
THEN '1'
WHEN SUBSTRING(sub.container_name,1,1) != 'B' AND DATEDIFF( NOW(), sub.date_of_production ) > '90'
THEN '1'
ELSE '0'
END AS is_overdue
FROM
ST_IVT_StructIvt ivt2
LEFT JOIN st_ivt_structattr struct ON struct.struct_id = ivt2.struct_id
LEFT JOIN md_me_materialbase mb ON mb.material_id = ivt2.material_id
LEFT JOIN SCH_BASE_Point point ON struct.struct_id = point.source_id
LEFT JOIN pdm_bi_subpackagerelation sub ON struct.storagevehicle_code = sub.package_box_sn and ivt2.pcsn = sub.container_name
WHERE
struct.lock_type='1'
OPTION 输入.sale_order_name <> ""
sub.sale_order_name = 输入.sale_order_name
ENDOPTION
OPTION 输入.pcsn <> ""
ivt2.pcsn = 输入.pcsn
ENDOPTION
OPTION 输入.sect_id <> ""
struct.sect_id = 输入.sect_id
ENDOPTION
OPTION 输入.stor_id <> ""
struct.stor_id = 输入.stor_id
ENDOPTION
OPTION 输入.box_no <> ""
sub.package_box_sn = 输入.box_no
ENDOPTION
OPTION 输入.sap_pcsn <> ""
sub.sap_pcsn = 输入.sap_pcsn
ENDOPTION
order by ivt2.canuse_qty,ivt2.pcsn desc
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "4"
QUERY
SELECT

View File

@@ -46,7 +46,7 @@
start-placeholder="开始日期"
end-placeholder="结束日期"
:default-time="['00:00:00', '23:59:59']"
@change="crud.toQuery"
@change="mytoQuery"
/>
</el-form-item>
@@ -192,6 +192,7 @@ export default {
del: ['admin', 'inbill:del']
},
storlist: [],
query_flag: true,
tableDataDtl: [],
open_type: null,
lock_type: null,
@@ -214,6 +215,38 @@ export default {
this.initQuery()
},
methods: {
[CRUD.HOOK.beforeRefresh]() {
debugger
if (this.query_flag) {
const end = new Date()
const start = new Date()
const endYear = end.getFullYear()
var endMonth = end.getMonth() + 1
if (end.getMonth() + 1 < 10) {
endMonth = '0' + endMonth.toString()
}
var endDay = end.getDate()
if (end.getDate() < 10) {
endDay = '0' + endDay.toString()
}
const endDate = endYear + '-' + endMonth + '-' + endDay + ' 23:59:59'
start.setTime(start.getTime() - 3600 * 1000 * 24 * 7)
const startYear = start.getFullYear()
var startMonth = start.getMonth() + 1
if (start.getMonth() + 1 < 10) {
startMonth = '0' + startMonth.toString()
}
var startDay = start.getDate()
if (start.getDate() < 10) {
startDay = '0' + startDay.toString()
}
const startDate = startYear + '-' + startMonth + '-' + startDay + ' 00:00:00'
this.crud.query.createTime = [startDate, endDate]
this.crud.query.begin_time = startDate
this.crud.query.end_time = endDate
this.query_flag = false
}
},
/* 搜索框创建时间默认最近一周*/
initQuery() {
const end = new Date()
@@ -240,6 +273,15 @@ export default {
}
const startDate = startYear + '-' + startMonth + '-' + startDay + ' 00:00:00'
this.$set(this.query, 'createTime', [startDate, endDate])
},
mytoQuery(array1) {
if (array1 === null) {
this.crud.query.begin_time = ''
this.crud.query.end_time = ''
} else {
this.crud.query.begin_time = array1[0]
this.crud.query.end_time = array1[1]
}
this.crud.toQuery()
},
addDialog(type) {

View File

@@ -273,32 +273,41 @@ export default {
const today = new Date()
const threeDaysAgo = new Date(today)
threeDaysAgo.setDate(today.getDate() - 3)
const year = today.getFullYear()
const month = String(today.getMonth() + 1).padStart(2, '0')
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0')
const day = String(today.getDate()).padStart(2, '0')
// 从 threeDaysAgo 提取完整日期信息
const beforeYear = threeDaysAgo.getFullYear();
const beforeMonth = String(threeDaysAgo.getMonth() + 1).padStart(2, '0');
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0');
// 2. 构造固定时分秒的时间字符串符合datetime-local格式
const startTime = `${year}-${month}-${beforeDay} 00:00:00`
const endTime = `${year}-${month}-${day} 23:59:59`
// 从 today 提取完整日期信息
const currentYear = today.getFullYear();
const currentMonth = String(today.getMonth() + 1).padStart(2, '0');
const currentDay = String(today.getDate()).padStart(2, '0');
// 构造正确的时间范围
const startTime = `${beforeYear}-${beforeMonth}-${beforeDay} 00:00:00`;
const endTime = `${currentYear}-${currentMonth}-${currentDay} 23:59:59`;
this.crud.query.createTime = [startTime, endTime]
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
debugger
if (this.query_flag) {
const today = new Date()
const threeDaysAgo = new Date(today) // 复制今天日期,避免修改原对象
threeDaysAgo.setDate(today.getDate() - 3) // 正确减去3天
const year = today.getFullYear()
const month = String(today.getMonth() + 1).padStart(2, '0')
const day = String(today.getDate()).padStart(2, '0')
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0')
const threeDaysAgo = new Date(today)
threeDaysAgo.setDate(today.getDate() - 3)
// 从 threeDaysAgo 提取完整日期信息
const beforeYear = threeDaysAgo.getFullYear();
const beforeMonth = String(threeDaysAgo.getMonth() + 1).padStart(2, '0');
const beforeDay = String(threeDaysAgo.getDate()).padStart(2, '0');
// 2. 构造固定时分秒的时间字符串符合datetime-local格式
const startTime = `${year}-${month}-${beforeDay} 00:00:00`
const endTime = `${year}-${month}-${day} 23:59:59`
// 从 today 提取完整日期信息
const currentYear = today.getFullYear();
const currentMonth = String(today.getMonth() + 1).padStart(2, '0');
const currentDay = String(today.getDate()).padStart(2, '0');
// 构造正确的时间范围
const startTime = `${beforeYear}-${beforeMonth}-${beforeDay} 00:00:00`;
const endTime = `${currentYear}-${currentMonth}-${currentDay} 23:59:59`;
this.crud.query.createTime = [startTime, endTime]
this.crud.query.begin_time = startTime
this.crud.query.end_time = endTime