在数据表中使用计算公式,保存和预览均没有报错。但是在页面端使用时提示报错。
1、主子表结构,主表没有异常
2、子表字段设置计算公式,在搭建页面时出现报错
3、子表计算公式中,引用的其中一个字段也是计算公式计算得到。
4、毛坯生产周期(天)也是一个计算公式,但是它的计算公式引用的都是正常字段。
5、页面单独引用子表模型,也会报相同错误,应该可以确定就是子表的异常。
在数据表中使用计算公式,保存和预览均没有报错。但是在页面端使用时提示报错。
1、主子表结构,主表没有异常
2、子表字段设置计算公式,在搭建页面时出现报错
3、子表计算公式中,引用的其中一个字段也是计算公式计算得到。
4、毛坯生产周期(天)也是一个计算公式,但是它的计算公式引用的都是正常字段。
5、页面单独引用子表模型,也会报相同错误,应该可以确定就是子表的异常。
这个错误可以看下服务器日志信息查看报错,sql应该会在日志里面找到,然后把sql发出来看看
好的 ,我提供一下sql代码,但是我没有看出来什么问题。麻烦协助排查一下。
日志文件的代码如下:
('select "id", "clientName", "productionCondition", "productModelType", "planCategory", "clientNo", "clientInfo", "clientOrderNo", "clientGradeNo", "internalGradeNo", "clientSpec", "internalSpec", "clientDrawingNo", "reportSpec", "orderNum", "spareInventory", "allocateInventory", "requiredBlankNum", "singleWeight", "halfProcessedSingleWeight", "dimension", "orderWeight", "unitPriceByNum", "unitPriceByWeight", "totalAmount", "wishDeliveryDate", "saleDate", ( julianday(date()) - julianday("saleDate") ) as "orderDays" , "remarks", "approvalStatus", "clientDrawing", "productAccessory", "blankDrawing", "postProcessing", "isChamfer", "pricingMethod", "postProcessingDays", "processOptimizationDays", "newMixtureDays", "productionWeight", "shouldBuyRawMaterial", "wetGrindingProcess", "mixAvailableWeight", "materialPurchaseDays", "moldStatus", "needChangeMargin", "moldDays", "moldRepairDays", "moldSpec", "moldRemarks", "productCategory", "pressCategory", "pressingOutput", ( ("orderNum" / "pressingOutput") ) as "pressingPeriod" , "needPressureTest", "semiFinishedInventory", "semiProcessingSequence", "semiProcessedOutput", "semiProcessingPeriod", "sinteringSystem", "sinteringDays", "blankStorageInspectionDays", "blankInventoryWeight", "needDeepProcessing", "finishedProductInventory", "deepProcessingDays", "premiumDrawing", "deepProcessInspectDays", ( ("newMixtureDays" + "materialPurchaseDays") ) as "mixProductionDays" , ( ("moldDays" + "moldRepairDays") ) as "moldfreeNewDays" , "otherDays", ( ( ( ( ( ( ( ( ("processOptimizationDays" + "postProcessingDays") + ("newMixtureDays" + "materialPurchaseDays") ) + ("moldDays" + "moldRepairDays") ) + ("orderNum" / "pressingOutput") ) + "semiProcessingPeriod") + "sinteringDays") + "blankStorageInspectionDays") + "otherDays") ) as "blankProductionDays" , (CASE WHEN ("needDeepProcessing" != \'需要\') THEN ( ( ( ( ( ( ( ("processOptimizationDays" + "postProcessingDays") + ("newMixtureDays" + "materialPurchaseDays") ) + ("moldDays" + "moldRepairDays") ) + ("orderNum" / "pressingOutput") ) + "semiProcessingPeriod") + "sinteringDays") + "blankStorageInspectionDays") + "otherDays") ELSE ( ( ( ( ( ( ( ( ( ("processOptimizationDays" + "postProcessingDays") + ("newMixtureDays" + "materialPurchaseDays") ) + ("moldDays" + "moldRepairDays") ) + ("orderNum" / "pressingOutput") ) + "semiProcessingPeriod") + "sinteringDays") + "blankStorageInspectionDays") + "otherDays") + "deepProcessingDays") + "deepProcessInspectDays") END) as "premiumStorageDays" , (date("saleDate", \'+ ( ( ( ( ( ( ( ("processOptimizationDays" + "postProcessingDays") + ("newMixtureDays" + "materialPurchaseDays") ) + ("moldDays" + "moldRepairDays") ) + ("orderNum" / "pressingOutput") ) + "semiProcessingPeriod") + "sinteringDays") + "blankStorageInspectionDays") + "otherDays") days\')) as "roughDeliveryDate" , (date("saleDate", \'+CASE WHEN ("needDeepProcessing" != \'需要\') THEN ( ( ( ( ( ( ( ("processOptimizationDays" + "postProcessingDays") + ("newMixtureDays" + "materialPurchaseDays") ) + ("moldDays" + "moldRepairDays") ) + ("orderNum" / "pressingOutput") ) + "semiProcessingPeriod") + "sinteringDays") + "blankStorageInspectionDays") + "otherDays") ELSE ( ( ( ( ( ( ( ( ( ("processOptimizationDays" + "postProcessingDays") + ("newMixtureDays" + "materialPurchaseDays") ) + ("moldDays" + "moldRepairDays") ) + ("orderNum" / "pressingOutput") ) + "semiProcessingPeriod") + "sinteringDays") + "blankStorageInspectionDays") + "otherDays") + "deepProcessingDays") + "deepProcessInspectDays") END days\')) as "assessDeliveryDate" , "confirmDeliveryDate", "plannedProgress", "salesPerson", "serialNo", "technicalDevNo", (case when ("planCategory") is null then \'\' else "planCategory" end || case when ("clientNo") is null then \'\' else "clientNo" end || case when ("productCategory") is null then \'\' else "productCategory" end || case when ("serialNo") is null then \'\' else "serialNo" end) as "planNo" , "title", "planReview" from "PlanReviewDetail" "PlanReviewDetail" where ((0 = 1)) ```
我使用cahtgpt格式化之后的代码如下:
SELECT
"id",
"clientName",
"productionCondition",
"productModelType",
"planCategory",
"clientNo",
"clientInfo",
"clientOrderNo",
"clientGradeNo",
"internalGradeNo",
"clientSpec",
"internalSpec",
"clientDrawingNo",
"reportSpec",
"orderNum",
"spareInventory",
"allocateInventory",
"requiredBlankNum",
"singleWeight",
"halfProcessedSingleWeight",
"dimension",
"orderWeight",
"unitPriceByNum",
"unitPriceByWeight",
"totalAmount",
"wishDeliveryDate",
"saleDate",
(julianday(date()) - julianday("saleDate")) AS "orderDays",
"remarks",
"approvalStatus",
"clientDrawing",
"productAccessory",
"blankDrawing",
"postProcessing",
"isChamfer",
"pricingMethod",
"postProcessingDays",
"processOptimizationDays",
"newMixtureDays",
"productionWeight",
"shouldBuyRawMaterial",
"wetGrindingProcess",
"mixAvailableWeight",
"materialPurchaseDays",
"moldStatus",
"needChangeMargin",
"moldDays",
"moldRepairDays",
"moldSpec",
"moldRemarks",
"productCategory",
"pressCategory",
"pressingOutput",
("orderNum" / "pressingOutput") AS "pressingPeriod",
"needPressureTest",
"semiFinishedInventory",
"semiProcessingSequence",
"semiProcessedOutput",
"semiProcessingPeriod",
"sinteringSystem",
"sinteringDays",
"blankStorageInspectionDays",
"blankInventoryWeight",
"needDeepProcessing",
"finishedProductInventory",
"deepProcessingDays",
"premiumDrawing",
"deepProcessInspectDays",
(
"newMixtureDays" + "materialPurchaseDays"
) AS "mixProductionDays",
(
"moldDays" + "moldRepairDays"
) AS "moldfreeNewDays",
"otherDays",
(
(
(
(
(
(
(
(
("processOptimizationDays" + "postProcessingDays") +
("newMixtureDays" + "materialPurchaseDays")
) +
("moldDays" + "moldRepairDays")
) +
("orderNum" / "pressingOutput")
) +
"semiProcessingPeriod"
) +
"sinteringDays"
) +
"blankStorageInspectionDays"
) +
"otherDays"
)
) AS "blankProductionDays",
(
CASE
WHEN ("needDeepProcessing" != '需要') THEN
(
(
(
(
(
(
(
("processOptimizationDays" + "postProcessingDays") +
("newMixtureDays" + "materialPurchaseDays")
) +
("moldDays" + "moldRepairDays")
) +
("orderNum" / "pressingOutput")
) +
"semiProcessingPeriod"
) +
"sinteringDays"
) +
"blankStorageInspectionDays"
) +
"otherDays"
)
ELSE
(
(
(
(
(
(
(
(
(
("processOptimizationDays" + "postProcessingDays") +
("newMixtureDays" + "materialPurchaseDays")
) +
("moldDays" + "moldRepairDays")
) +
("orderNum" / "pressingOutput")
) +
"semiProcessingPeriod"
) +
"sinteringDays"
) +
"blankStorageInspectionDays"
) +
"otherDays"
) +
"deepProcessingDays"
) +
"deepProcessInspectDays"
)
END
) AS "premiumStorageDays",
date(
"saleDate",
'+' || (
(
(
(
(
(
("processOptimizationDays" + "postProcessingDays") +
("newMixtureDays" + "materialPurchaseDays")
) +
("moldDays" + "moldRepairDays")
) +
("orderNum" / "pressingOutput")
) +
"semiProcessingPeriod"
) +
"sinteringDays"
) +
"blankStorageInspectionDays" +
"otherDays"
) || ' days'
) AS "roughDeliveryDate",
date(
"saleDate",
'+' || (
CASE
WHEN ("needDeepProcessing" != '需要') THEN
(
(
(
(
(
(
("processOptimizationDays" + "postProcessingDays") +
("newMixtureDays" + "materialPurchaseDays")
) +
("moldDays" + "moldRepairDays")
) +
("orderNum" / "pressingOutput")
) +
"semiProcessingPeriod"
) +
"sinteringDays"
) +
"blankStorageInspectionDays" +
"otherDays"
)
ELSE
(
(
(
(
(
(
(
(
(
("processOptimizationDays" + "postProcessingDays") +
("newMixtureDays" + "materialPurchaseDays")
) +
("moldDays" + "moldRepairDays")
) +
("orderNum" / "pressingOutput")
) +
"semiProcessingPeriod"
) +
"sinteringDays"
) +
"blankStorageInspectionDays"
) +
"otherDays"
) +
"deepProcessingDays" +
"deepProcessInspectDays"
)
END || ' days'
)
) AS "assessDeliveryDate",
"confirmDeliveryDate",
"plannedProgress",
"salesPerson",
"serialNo",
"technicalDevNo",
(
COALESCE("planCategory", '') ||
COALESCE("clientNo", '') ||
COALESCE("productCategory", '') ||
COALESCE("serialNo", '')
) AS "planNo",
"title",
"planReview"
FROM
"PlanReviewDetail" AS "PlanReviewDetail"
WHERE
(0 = 1);
排查出来问题如下,可能需要平台修改。
是DATEADD语句中,引用了其他的计算公式。引用的计算公式中有一个IFS的判断条件使用了字符串。这个字符串在DATEADD引用时,变成单引号转义,与sqlite的date(,)函数的第二个参数字符串类型内部又引用单引号,导致语法有问题。 应该是需要极态平台进行修复。
修改成双引号执行就是正确的。
未修改前(平台直接生成的如下)
日志中的sql字符串如下
收到,我这边定位处理下
此bug已修复。
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.