|
|
@@ -53,7 +53,7 @@ public class DictionaryQueryServiceImpl implements DictionaryQueryService {
|
|
|
private static final String ERP_PACKAGING_MATERIAL_COUNT_SQL = "select count(1) from DSDATA.pmaauc_t " +
|
|
|
"where pmaaucent = :ent and pmaauc016 is not null";
|
|
|
|
|
|
- // 料件视图直接返回视图完整字段,可按中文品名模糊筛选。
|
|
|
+ // 料件视图直接返回视图完整字段,可按料号或中文品名模糊筛选。
|
|
|
private static final String ERP_ITEM_VIEW_DICTIONARY_CODE = "erp-item-view";
|
|
|
private static final String ERP_ITEM_VIEW_DATA_SQL = "select * from DSDATA.erp_apmt440_imaauc_v " +
|
|
|
"where imaalent = :ent";
|
|
|
@@ -116,6 +116,83 @@ public class DictionaryQueryServiceImpl implements DictionaryQueryService {
|
|
|
"and xmda003 <> 'ML03020200' and xmdastus = 'Y' and xmdaownid in (:qx)";
|
|
|
private static final String ERP_PRODUCTION_ORDER_COUNT_SQL = "select count(1) from (" + ERP_PRODUCTION_ORDER_DATA_SQL + ")";
|
|
|
|
|
|
+ // 供应商禁用视图按据点和公司返回当前不可用的供应商记录,并支持按供应商名称筛选。
|
|
|
+ private static final String ERP_SUPPLIER_DISABLED_DICTIONARY_CODE = "erp-supplier-disabled";
|
|
|
+ private static final String ERP_SUPPLIER_DISABLED_DATA_SQL = "select * from DSDATA.ERP_APMT440_PMAAUC_N " +
|
|
|
+ "where pmabsite = :t100id and pmaaent = :ent";
|
|
|
+ private static final String ERP_SUPPLIER_DISABLED_COUNT_SQL = "select count(1) from DSDATA.ERP_APMT440_PMAAUC_N " +
|
|
|
+ "where pmabsite = :t100id and pmaaent = :ent";
|
|
|
+
|
|
|
+ // T100 有效料号固定查询明磊公司 ML 据点,排除停用料号,并支持按料号或中文品名筛选。
|
|
|
+ private static final String ERP_ACTIVE_ITEM_DICTIONARY_CODE = "erp-active-item";
|
|
|
+ private static final String ERP_ACTIVE_ITEM_DATA_SQL = "select imaa001, imaal003, imaal004 " +
|
|
|
+ "from DSDATA.imaa_t " +
|
|
|
+ "inner join DSDATA.imaf_t on imaaent = imafent and imaa001 = imaf001 and imafsite = 'ML' " +
|
|
|
+ "inner join DSDATA.imaal_t on imaaent = imaalent and imaa001 = imaal001 and imaal002 = 'zh_CN' " +
|
|
|
+ "where imaaent = 86 and imaa010 <> 'TY'";
|
|
|
+ private static final String ERP_ACTIVE_ITEM_COUNT_SQL = "select count(1) " +
|
|
|
+ "from DSDATA.imaa_t " +
|
|
|
+ "inner join DSDATA.imaf_t on imaaent = imafent and imaa001 = imaf001 and imafsite = 'ML' " +
|
|
|
+ "inner join DSDATA.imaal_t on imaaent = imaalent and imaa001 = imaal001 and imaal002 = 'zh_CN' " +
|
|
|
+ "where imaaent = 86 and imaa010 <> 'TY'";
|
|
|
+
|
|
|
+ // 范本料号开窗返回明磊公司所有未停用料号及其中文品名、规格,并支持按料号或中文品名筛选。
|
|
|
+ private static final String ERP_TEMPLATE_ITEM_DICTIONARY_CODE = "erp-template-item";
|
|
|
+ private static final String ERP_TEMPLATE_ITEM_DATA_SQL = "select imaa001, imaal003, imaal004 " +
|
|
|
+ "from DSDATA.imaa_t " +
|
|
|
+ "left join DSDATA.imaal_t on imaaent = imaalent and imaa001 = imaal001 and imaal002 = 'zh_CN' " +
|
|
|
+ "where imaaent = 86 and imaa010 <> 'TY'";
|
|
|
+ private static final String ERP_TEMPLATE_ITEM_COUNT_SQL = "select count(1) from DSDATA.imaa_t " +
|
|
|
+ "left join DSDATA.imaal_t on imaaent = imaalent and imaa001 = imaal001 and imaal002 = 'zh_CN' " +
|
|
|
+ "where imaaent = 86 and imaa010 <> 'TY'";
|
|
|
+
|
|
|
+ // 范本料号订单开窗按料号前缀返回 ML 据点中未作废的销售订单与料件明细,并支持按订单号筛选。
|
|
|
+ private static final String ERP_TEMPLATE_ORDERS_DICTIONARY_CODE = "erp-template-orders";
|
|
|
+ private static final String ERP_TEMPLATE_ORDERS_DATA_SQL =
|
|
|
+ "select case xmdastus when 'C' then '已结案' when 'N' then '未审核' when 'Y' then '已审核' " +
|
|
|
+ "when 'H' then '留置' else '其他' end xmdastus, " +
|
|
|
+ "xmdadocno, xmdadocdt, xmda002, " +
|
|
|
+ "(select ooag011 from DSDATA.ooag_t where ooagent = xmdaent and ooag001 = xmda002) xmda002_desc, " +
|
|
|
+ "xmda003, " +
|
|
|
+ "(select ooefl003 from DSDATA.ooefl_t where ooeflent = xmdaent and ooefl001 = xmda003 " +
|
|
|
+ "and ooefl002 = 'zh_CN') xmda003_desc, " +
|
|
|
+ "xmda004, " +
|
|
|
+ "(select pmaal003 from DSDATA.pmaal_t where pmaalent = xmdaent and pmaal001 = xmda004 " +
|
|
|
+ "and pmaal002 = 'zh_CN') xmda004_desc, " +
|
|
|
+ "xmdc001, xmdcud010, " +
|
|
|
+ "(select imaal003 from DSDATA.imaal_t where imaalent = xmdcent and imaal001 = xmdc001 " +
|
|
|
+ "and imaal002 = 'zh_CN') xmdc001_desc, " +
|
|
|
+ "(select imaal004 from DSDATA.imaal_t where imaalent = xmdcent and imaal001 = xmdc001 " +
|
|
|
+ "and imaal002 = 'zh_CN') xmdc001_spec, " +
|
|
|
+ "xmdc002, xmdc007 " +
|
|
|
+ "from DSDATA.xmda_t " +
|
|
|
+ "inner join DSDATA.xmdc_t on xmdaent = xmdcent and xmdasite = xmdcsite and xmdadocno = xmdcdocno " +
|
|
|
+ "where xmdastus <> 'X' and xmdcent = 86 and xmdcsite = 'ML' and xmdc001 like :bgfblh";
|
|
|
+ private static final String ERP_TEMPLATE_ORDERS_COUNT_SQL = "select count(1) from (" + ERP_TEMPLATE_ORDERS_DATA_SQL + ")";
|
|
|
+
|
|
|
+ // 料号上次价格按有效采购价格单的最新确认时间返回对应价格。
|
|
|
+ private static final String ERP_LAST_PRICE_DICTIONARY_CODE = "erp-last-price";
|
|
|
+ private static final String MAIN_PMDI004_FILTER = "main.pmdi004";
|
|
|
+ private static final String DETAIL_1_LJBH_FILTER = "detail_1.ljbh";
|
|
|
+ private static final String ERP_LAST_PRICE_DATA_SQL = "select distinct pmdj011 from (" +
|
|
|
+ "select to_char(pmdicnfdt, 'yyyy-mm-dd HH24:mi:ss') pmdicnfdt, pmdi015, " +
|
|
|
+ "case when pmdi016 is null then date '2025-12-31' else pmdi016 end pmdi016, pmdi004, pmdj002, pmdj011 " +
|
|
|
+ "from DSDATA.pmdi_t " +
|
|
|
+ "inner join DSDATA.pmdj_t on pmdient = pmdjent and pmdisite = pmdjsite and pmdidocno = pmdjdocno " +
|
|
|
+ "where pmdient = 86 and pmdisite = 'ML' and pmdistus = 'Y' and (pmdiud001 = 'N' or pmdiud001 is null) " +
|
|
|
+ "and sysdate >= pmdi015 and sysdate <= case when pmdi016 is null then date '2025-12-31' else pmdi016 end" +
|
|
|
+ ") t1 where t1.pmdicnfdt = (" +
|
|
|
+ "select max(t2.pmdicnfdt) from (" +
|
|
|
+ "select to_char(pmdicnfdt, 'yyyy-mm-dd HH24:mi:ss') pmdicnfdt, pmdi015, " +
|
|
|
+ "case when pmdi016 is null then date '2025-12-31' else pmdi016 end pmdi016, pmdi004, pmdj002, pmdj011 " +
|
|
|
+ "from DSDATA.pmdi_t " +
|
|
|
+ "inner join DSDATA.pmdj_t on pmdient = pmdjent and pmdisite = pmdjsite and pmdidocno = pmdjdocno " +
|
|
|
+ "where pmdient = 86 and pmdisite = 'ML' and pmdistus = 'Y' " +
|
|
|
+ "and sysdate >= pmdi015 and sysdate <= case when pmdi016 is null then date '2025-12-31' else pmdi016 end" +
|
|
|
+ ") t2 where t1.pmdi004 = t2.pmdi004 and t1.pmdj002 = t2.pmdj002) " +
|
|
|
+ "and t1.pmdi004 = :mainPmdi004 and t1.pmdj002 = :detail1Ljbh";
|
|
|
+ private static final String ERP_LAST_PRICE_COUNT_SQL = "select count(1) from (" + ERP_LAST_PRICE_DATA_SQL + ")";
|
|
|
+
|
|
|
// 委外采购单开窗固定查询明磊公司与 ML 据点,采购单号来自宜搭表单字段。
|
|
|
private static final String ERP_OUTSOURCED_PURCHASE_ORDER_WINDOW_DICTIONARY_CODE =
|
|
|
"erp-outsourced-purchase-order-window";
|
|
|
@@ -202,6 +279,21 @@ public class DictionaryQueryServiceImpl implements DictionaryQueryService {
|
|
|
if (ERP_PRODUCTION_ORDER_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
return queryErpProductionOrder(safeFilters);
|
|
|
}
|
|
|
+ if (ERP_SUPPLIER_DISABLED_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
+ return queryErpSupplierDisabled(safeFilters);
|
|
|
+ }
|
|
|
+ if (ERP_ACTIVE_ITEM_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
+ return queryErpActiveItem(safeFilters);
|
|
|
+ }
|
|
|
+ if (ERP_TEMPLATE_ITEM_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
+ return queryErpTemplateItem(safeFilters);
|
|
|
+ }
|
|
|
+ if (ERP_TEMPLATE_ORDERS_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
+ return queryErpTemplateOrders(safeFilters);
|
|
|
+ }
|
|
|
+ if (ERP_LAST_PRICE_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
+ return queryErpLastPrice(safeFilters);
|
|
|
+ }
|
|
|
if (ERP_OUTSOURCED_PURCHASE_ORDER_WINDOW_DICTIONARY_CODE.equals(dictionaryCode)) {
|
|
|
return queryErpOutsourcedPurchaseOrderWindow(safeFilters);
|
|
|
}
|
|
|
@@ -279,7 +371,7 @@ public class DictionaryQueryServiceImpl implements DictionaryQueryService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 查询 ERP 料件视图的全部字段,并可按中文品名模糊筛选。
|
|
|
+ * 查询 ERP 料件视图的全部字段,并可按料号或中文品名模糊筛选。
|
|
|
*
|
|
|
* @param filters 调用方传入的筛选条件
|
|
|
* @return ERP 料件视图分页记录
|
|
|
@@ -291,8 +383,9 @@ public class DictionaryQueryServiceImpl implements DictionaryQueryService {
|
|
|
String countSql = ERP_ITEM_VIEW_COUNT_SQL;
|
|
|
String keyword = optionalTextFilter(filters, "keyword");
|
|
|
if (keyword != null) {
|
|
|
- dataSql += " and imaal003 like :keyword";
|
|
|
- countSql += " and imaal003 like :keyword";
|
|
|
+ String keywordCondition = " and (imaa001 like :keyword or imaal003 like :keyword)";
|
|
|
+ dataSql += keywordCondition;
|
|
|
+ countSql += keywordCondition;
|
|
|
parameters.addValue("keyword", createLikeValue(keyword));
|
|
|
}
|
|
|
return queryPage(dataSql, countSql, parameters, createPageRequest());
|
|
|
@@ -325,6 +418,104 @@ public class DictionaryQueryServiceImpl implements DictionaryQueryService {
|
|
|
return queryPage(ERP_PRODUCTION_ORDER_DATA_SQL, ERP_PRODUCTION_ORDER_COUNT_SQL, parameters, createPageRequest());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询指定据点和公司的禁用供应商视图,并可按供应商名称模糊筛选。
|
|
|
+ *
|
|
|
+ * @param filters 调用方传入的筛选条件
|
|
|
+ * @return 禁用供应商分页记录
|
|
|
+ */
|
|
|
+ private Map<String, Object> queryErpSupplierDisabled(Map<String, String> filters) {
|
|
|
+ validateFilters(filters, ERP_SUPPLIER_DISABLED_DICTIONARY_CODE, "keyword");
|
|
|
+ MapSqlParameterSource parameters = createBaseParameters(filters);
|
|
|
+ String dataSql = ERP_SUPPLIER_DISABLED_DATA_SQL;
|
|
|
+ String countSql = ERP_SUPPLIER_DISABLED_COUNT_SQL;
|
|
|
+ String keyword = optionalTextFilter(filters, "keyword");
|
|
|
+ if (keyword != null) {
|
|
|
+ dataSql += " and pmaal004 like :keyword";
|
|
|
+ countSql += " and pmaal004 like :keyword";
|
|
|
+ parameters.addValue("keyword", createLikeValue(keyword));
|
|
|
+ }
|
|
|
+ return queryPage(dataSql, countSql, parameters, createPageRequest());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询固定范围内的 T100 有效料号,并可按料号或中文品名模糊筛选。
|
|
|
+ *
|
|
|
+ * @param filters 调用方传入的筛选条件
|
|
|
+ * @return 有效料号分页记录
|
|
|
+ */
|
|
|
+ private Map<String, Object> queryErpActiveItem(Map<String, String> filters) {
|
|
|
+ validateFilters(filters, ERP_ACTIVE_ITEM_DICTIONARY_CODE, "keyword");
|
|
|
+ MapSqlParameterSource parameters = new MapSqlParameterSource();
|
|
|
+ String dataSql = ERP_ACTIVE_ITEM_DATA_SQL;
|
|
|
+ String countSql = ERP_ACTIVE_ITEM_COUNT_SQL;
|
|
|
+ String keyword = optionalTextFilter(filters, "keyword");
|
|
|
+ if (keyword != null) {
|
|
|
+ String keywordCondition = " and (imaa001 like :keyword or imaal003 like :keyword)";
|
|
|
+ dataSql += keywordCondition;
|
|
|
+ countSql += keywordCondition;
|
|
|
+ parameters.addValue("keyword", createLikeValue(keyword));
|
|
|
+ }
|
|
|
+ return queryPage(dataSql, countSql, parameters, createPageRequest());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询固定范围内的范本料号,并可按料号或中文品名模糊筛选。
|
|
|
+ *
|
|
|
+ * @param filters 调用方传入的筛选条件
|
|
|
+ * @return 范本料号分页记录
|
|
|
+ */
|
|
|
+ private Map<String, Object> queryErpTemplateItem(Map<String, String> filters) {
|
|
|
+ validateFilters(filters, ERP_TEMPLATE_ITEM_DICTIONARY_CODE, "keyword");
|
|
|
+ MapSqlParameterSource parameters = new MapSqlParameterSource();
|
|
|
+ String dataSql = ERP_TEMPLATE_ITEM_DATA_SQL;
|
|
|
+ String countSql = ERP_TEMPLATE_ITEM_COUNT_SQL;
|
|
|
+ String keyword = optionalTextFilter(filters, "keyword");
|
|
|
+ if (keyword != null) {
|
|
|
+ String keywordCondition = " and (imaa001 like :keyword or imaal003 like :keyword)";
|
|
|
+ dataSql += keywordCondition;
|
|
|
+ countSql += keywordCondition;
|
|
|
+ parameters.addValue("keyword", createLikeValue(keyword));
|
|
|
+ }
|
|
|
+ return queryPage(dataSql, countSql, parameters, createPageRequest());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按范本料号前缀查询 ML 据点内未作废的关联订单,并可按订单号模糊筛选。
|
|
|
+ *
|
|
|
+ * @param filters 调用方传入的筛选条件
|
|
|
+ * @return 范本料号关联订单分页记录
|
|
|
+ */
|
|
|
+ private Map<String, Object> queryErpTemplateOrders(Map<String, String> filters) {
|
|
|
+ validateFilters(filters, ERP_TEMPLATE_ORDERS_DICTIONARY_CODE, "bgfblh", "keyword");
|
|
|
+ MapSqlParameterSource parameters = new MapSqlParameterSource();
|
|
|
+ parameters.addValue("bgfblh", requireTextFilter(filters, "bgfblh") + "%");
|
|
|
+ String dataSql = ERP_TEMPLATE_ORDERS_DATA_SQL;
|
|
|
+ String countSql = ERP_TEMPLATE_ORDERS_COUNT_SQL;
|
|
|
+ String keyword = optionalTextFilter(filters, "keyword");
|
|
|
+ if (keyword != null) {
|
|
|
+ String keywordCondition = " and xmdadocno like :keyword";
|
|
|
+ dataSql += keywordCondition;
|
|
|
+ countSql = "select count(1) from (" + dataSql + ")";
|
|
|
+ parameters.addValue("keyword", createLikeValue(keyword));
|
|
|
+ }
|
|
|
+ return queryPage(dataSql, countSql, parameters, createPageRequest());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按宜搭主表料号和子表料件编号查询有效采购价格单中的上次价格。
|
|
|
+ *
|
|
|
+ * @param filters 调用方传入的筛选条件
|
|
|
+ * @return 上次价格分页记录
|
|
|
+ */
|
|
|
+ private Map<String, Object> queryErpLastPrice(Map<String, String> filters) {
|
|
|
+ validateFilters(filters, ERP_LAST_PRICE_DICTIONARY_CODE, MAIN_PMDI004_FILTER, DETAIL_1_LJBH_FILTER);
|
|
|
+ MapSqlParameterSource parameters = new MapSqlParameterSource();
|
|
|
+ parameters.addValue("mainPmdi004", requireTextFilter(filters, MAIN_PMDI004_FILTER));
|
|
|
+ parameters.addValue("detail1Ljbh", requireTextFilter(filters, DETAIL_1_LJBH_FILTER));
|
|
|
+ return queryPage(ERP_LAST_PRICE_DATA_SQL, ERP_LAST_PRICE_COUNT_SQL, parameters, createPageRequest());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询指定委外采购单的明细料件信息。
|
|
|
*
|