You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
494 lines
26 KiB
494 lines
26 KiB
package com.spring.ifs.api;
|
|
|
|
import com.spring.common.utils.DateUtils;
|
|
import com.spring.ifs.data.*;
|
|
import com.spring.ifs.utils.IfsConverterToMap;
|
|
import com.spring.ifs.utils.IfsPlsqlUtils;
|
|
import com.spring.modules.base.entity.WorkCenterCost;
|
|
import com.spring.modules.part.vo.InventoryPartUnitCostSumVo;
|
|
import ifs.fnd.ap.APException;
|
|
import ifs.fnd.ap.RecordCollection;
|
|
import ifs.fnd.ap.Server;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
/**
|
|
* @description: 基础查询的api
|
|
* @author LR
|
|
* @date 2024/12/12 10:44
|
|
* @version 1.0
|
|
*/
|
|
public class BaseSearchApiTest {
|
|
|
|
/**
|
|
* @description: 查询IFS的加工中心
|
|
* @author LR
|
|
* @date 2024/12/12 11:02
|
|
* @version 1.0
|
|
*/
|
|
public static List<WorkCenter> getWorkCenterNos(Server srv, String siteCon, String ifsRowVersion) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT wc.contract site, wc.work_center_no, wc.description work_center_desc, wc.work_center_code_db,");
|
|
searchSql.append(" (CASE WHEN work_center_code_db='I' THEN '内部' ELSE '外部' END) work_center_type, 100 efficiency,");
|
|
searchSql.append(" TO_CHAR(NVL(wc.average_capacity, 0), 'FM99999999999999999999999999999999999999.999999') averageCapacity,");
|
|
searchSql.append(" NVL(wc.utilization, 0) utilization, wc.sched_capacity_db capacity_type_db,");
|
|
searchSql.append(" (CASE WHEN sched_capacity_db = 'I' THEN '无限产能' ELSE '有限产能' END) capacity_type, wc.uom um_id,");
|
|
searchSql.append(" (CASE WHEN wc.objstate = 'Active' THEN 'Y' ELSE 'N' END) active, wc.note_text remark, wc.create_date created_date,");
|
|
searchSql.append(" wc.PRODUCTION_LINE pro_line_no, 'N' can_create_new_roll_flag, 'N' need_setup_flag, wc.objid ifsRowId, wc.OBJVERSION ifsRowVersion");
|
|
searchSql.append(" FROM ifsapp.WORK_CENTER wc");
|
|
searchSql.append(" WHERE wc.work_center_code_db IN ('I','O')");
|
|
//添加判断的查询条件
|
|
if(!(null == siteCon || "".equals(siteCon))) {
|
|
searchSql.append(" AND wc.contract IN "+siteCon);
|
|
}
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
|
|
searchSql.append(" AND wc.OBJVERSION >= :ifsRowVersion");
|
|
inParam.put("ifsRowVersion", ifsRowVersion);
|
|
}
|
|
//添加排序语句
|
|
searchSql.append(" ORDER BY wc.OBJVERSION, wc.contract, wc.work_center_no");
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<WorkCenter> resultItems = new ArrayList<>();
|
|
//调用通用的处理方法 返回Map
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//判断是否存在数据
|
|
if(resultList == null) {
|
|
return resultItems;
|
|
}
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
WorkCenter tempItem = new WorkCenter();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setSite(tempMap.get("SITE"));
|
|
tempItem.setWorkCenterNo(tempMap.get("WORK_CENTER_NO"));
|
|
tempItem.setWorkCenterDesc(tempMap.get("WORK_CENTER_DESC"));
|
|
tempItem.setWorkCenterTypeDb(tempMap.get("WORK_CENTER_CODE_DB"));
|
|
tempItem.setWorkCenterType(tempMap.get("WORK_CENTER_TYPE"));
|
|
tempItem.setAverageCapacity(tempMap.get("AVERAGECAPACITY"));
|
|
tempItem.setEfficiency(tempMap.get("EFFICIENCY"));
|
|
tempItem.setUtilization(tempMap.get("UTILIZATION"));
|
|
tempItem.setCapacityTypeDb(tempMap.get("CAPACITY_TYPE_DB"));
|
|
tempItem.setCapacityType(tempMap.get("CAPACITY_TYPE"));
|
|
tempItem.setUmId(tempMap.get("UM_ID"));
|
|
tempItem.setActive(tempMap.get("ACTIVE"));
|
|
tempItem.setRemark(tempMap.get("REMARK"));
|
|
tempItem.setCreatedDate(tempMap.get("CREATED_DATE"));
|
|
tempItem.setProLineNo(tempMap.get("PRO_LINE_NO"));
|
|
tempItem.setCanCreateNewRollFlag(tempMap.get("CAN_CREATE_NEW_ROLL_FLAG"));
|
|
tempItem.setNeedSetupFlag(tempMap.get("NEED_SETUP_FLAG"));
|
|
//添加对象
|
|
resultItems.add(tempItem);
|
|
}
|
|
return resultItems;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 查询机台的信息
|
|
* @author LR
|
|
* @date 2024/12/12 11:23
|
|
* @version 1.0
|
|
*/
|
|
public static List<WarehouseLocation> getWarehouseLocations(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT wbb.contract site, wbb.location_no location_id, wbb.description location_name, wbb.warehouse_id, 'Y' active, NULL create_date, 'admin' create_by,");
|
|
searchSql.append(" NULL update_date, NULL update_by, ilt.inventory_location_type location_type, wbb.objid ifsRowId, wbb.OBJVERSION ifsRowVersion");
|
|
searchSql.append(" FROM ifsapp.WAREHOUSE_BAY_BIN wbb, ifsapp.INVENTORY_LOCATION_GROUP ilt");
|
|
searchSql.append(" WHERE wbb.location_group = ilt.LOCATION_GROUP");
|
|
//添加判断的查询条件
|
|
if(!(null == siteCon || "".equals(siteCon))) {
|
|
searchSql.append(" AND wbb.contract IN "+siteCon);
|
|
}
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
|
|
searchSql.append(" AND wbb.OBJVERSION >= :ifsRowVersion");
|
|
inParam.put("ifsRowVersion", ifsRowVersion);
|
|
}
|
|
//添加排序语句
|
|
searchSql.append(" ORDER BY wbb.OBJVERSION, wbb.contract, wbb.location_no");
|
|
//添加分页的查询语句
|
|
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<WarehouseLocation> resultItems = new ArrayList<>();
|
|
//调用通用的处理方法 返回Map
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//判断是否存在数据
|
|
if(resultList == null) {
|
|
return resultItems;
|
|
}
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
WarehouseLocation tempItem = new WarehouseLocation();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setSite(tempMap.get("SITE"));
|
|
tempItem.setLocationId(tempMap.get("LOCATION_ID"));
|
|
tempItem.setLocationName(tempMap.get("LOCATION_NAME"));
|
|
tempItem.setWarehouseId(tempMap.get("WAREHOUSE_ID"));
|
|
tempItem.setActive(tempMap.get("ACTIVE"));
|
|
tempItem.setCreateDate(tempMap.get("CREATE_DATE")); // 从tempMap获取值,不再直接设为null
|
|
tempItem.setCreateBy(tempMap.get("CREATE_BY")); // 注意:字段名也改为大写
|
|
tempItem.setUpdateDate(tempMap.get("UPDATE_DATE")); // 从tempMap获取值,不再直接设为null
|
|
tempItem.setUpdateBy(tempMap.get("UPDATE_BY"));//直接设为null,因为SQL中对应字段是NULL
|
|
tempItem.setLocationType(tempMap.get("LOCATION_TYPE"));
|
|
//添加对象
|
|
resultItems.add(tempItem);
|
|
}
|
|
return resultItems;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 查询人员等级
|
|
* @author LR
|
|
* @date 2024/12/12 11:27
|
|
* @version 1.0
|
|
*/
|
|
public static List<LaborClass> getIfsLaborClasss(Server srv, String siteCon, String ifsRowVersion) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT lc.contract site, lc.labor_class_no level_id, lc.labor_class_description level_desc,");
|
|
searchSql.append(" (CASE WHEN lc.objstate = 'Active' THEN 'Y' ELSE 'N' END) active, sysdate create_date, 'Admin' create_by,");
|
|
searchSql.append(" NULL update_date, NULL update_by, 100 level_cost, lc.objid ifsRowId, lc.OBJVERSION ifsRowVersion");
|
|
searchSql.append(" FROM ifsapp.labor_class lc");
|
|
//添加判断的查询条件
|
|
if(!(null == siteCon || "".equals(siteCon))) {
|
|
searchSql.append(" WHERE lc.contract IN "+siteCon);
|
|
}
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
|
|
searchSql.append(" AND lc.OBJVERSION >= :ifsRowVersion");
|
|
inParam.put("ifsRowVersion", ifsRowVersion);
|
|
}
|
|
//添加排序语句
|
|
searchSql.append(" ORDER BY lc.OBJVERSION, lc.contract, lc.labor_class_no");
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<LaborClass> resultItems = new ArrayList<>();
|
|
//调用通用的处理方法 返回Map
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//判断是否存在数据
|
|
if(resultList == null) {
|
|
return resultItems;
|
|
}
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
LaborClass tempItem = new LaborClass();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setSite(tempMap.get("SITE"));
|
|
tempItem.setLevelId(tempMap.get("LEVEL_ID"));
|
|
tempItem.setLevelDesc(tempMap.get("LEVEL_DESC"));
|
|
tempItem.setActive(tempMap.get("ACTIVE"));
|
|
tempItem.setCreateDate(tempMap.get("CREATE_DATE")); // 从tempMap获取值
|
|
tempItem.setCreateBy(tempMap.get("CREATE_BY")); // 注意:字段名也改为大写
|
|
tempItem.setUpdateDate(tempMap.get("UPDATE_DATE")); // 从tempMap获取值
|
|
tempItem.setUpdateBy(tempMap.get("UPDATE_BY")); // 从tempMap获取值
|
|
tempItem.setLevelCost(tempMap.get("LEVEL_COST")); // 获取成本值
|
|
//添加对象
|
|
resultItems.add(tempItem);
|
|
}
|
|
return resultItems;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 获取物料件的数据
|
|
* @author LR
|
|
* @date 2024/12/12 11:34
|
|
* @version 1.0
|
|
*/
|
|
public static List<PartCatalog> getPartCatalogs(Server srv, String ifsRowVersion, int startIndex, int pageSize) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT PART_NO, DESCRIPTION partDesc, INFO_TEXT, STD_NAME_ID, UNIT_CODE,");
|
|
searchSql.append(" LOT_TRACKING_CODE, WEIGHT_NET, UOM_FOR_WEIGHT_NET, VOLUME_NET, UOM_FOR_VOLUME_NET,");
|
|
searchSql.append(" OBJID ifsRowId, OBJVERSION ifsRowVersion");
|
|
searchSql.append(" FROM IFSAPP.PART_CATALOG pc");
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
|
|
searchSql.append(" AND pc.OBJVERSION >= :ifsRowVersion");
|
|
inParam.put("ifsRowVersion", ifsRowVersion);
|
|
}
|
|
//添加排序语句
|
|
searchSql.append(" ORDER BY pc.OBJVERSION, pc.PART_NO, pc.DESCRIPTION");
|
|
//添加分页的查询语句
|
|
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<PartCatalog> resultItems = new ArrayList<>();
|
|
//调用通用的处理方法 返回Map
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
PartCatalog tempItem = new PartCatalog();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setPartNo(tempMap.get("PART_NO"));
|
|
tempItem.setPartDesc(tempMap.get("PARTDESC")); // 注意:使用小写的partDesc以匹配属性名
|
|
tempItem.setInfoText(tempMap.get("INFO_TEXT"));
|
|
tempItem.setStdNameId(tempMap.get("STD_NAME_ID"));
|
|
tempItem.setUnitCode(tempMap.get("UNIT_CODE"));
|
|
tempItem.setLotTrackingCode(tempMap.get("LOT_TRACKING_CODE"));
|
|
tempItem.setWeightNet(tempMap.get("WEIGHT_NET"));
|
|
tempItem.setUomForWeightNet(tempMap.get("UOM_FOR_WEIGHT_NET"));
|
|
tempItem.setVolumeNet(tempMap.get("VOLUME_NET"));
|
|
tempItem.setUomForVolumeNet(tempMap.get("UOM_FOR_VOLUME_NET"));
|
|
//添加对象
|
|
resultItems.add(tempItem);
|
|
}
|
|
return resultItems;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 查询库存件的属性值
|
|
* @author LR
|
|
* @date 2024/12/12 11:38
|
|
* @version 1.0
|
|
*/
|
|
public static List<InventoryValue> getInventoryValues(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT site, PART_NO, CONFIGURATION_ID, LOT_BATCH_NO, SERIAL_NO,");
|
|
searchSql.append(" ifsapp.Inventory_Part_Unit_Cost_API.Get_Inventory_Value_By_Method(CONTRACT,PART_NO,CONFIGURATION_ID,LOT_BATCH_NO,SERIAL_NO) inventoryValue");
|
|
searchSql.append(" FROM ifsapp.INVENTORY_PART_UNIT_COST_SUM pcs");
|
|
searchSql.append(" WHERE pcs.CONFIGURATION_ID = '*'");
|
|
//添加判断的查询条件
|
|
if(!(null == siteCon || "".equals(siteCon))) {
|
|
searchSql.append(" AND pcs.contract IN "+siteCon);
|
|
}
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
if(!(null == ifsRowVersion || "".equals(ifsRowVersion))) {
|
|
searchSql.append(" AND pcs.OBJVERSION >= :ifsRowVersion");
|
|
inParam.put("ifsRowVersion", ifsRowVersion);
|
|
}
|
|
//添加排序语句
|
|
searchSql.append(" ORDER BY pcs.OBJVERSION, pcs.contract, pcs.PART_NO");
|
|
//添加分页的查询语句
|
|
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<InventoryValue> resultItems = new ArrayList<>();
|
|
//调用通用的处理方法 返回Map
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
InventoryValue tempItem = new InventoryValue();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setSite(tempMap.get("SITE"));
|
|
tempItem.setPartNo(tempMap.get("PART_NO"));
|
|
tempItem.setConfigurationId(tempMap.get("CONFIGURATION_ID"));
|
|
tempItem.setLotBatchNo(tempMap.get("LOT_BATCH_NO"));
|
|
tempItem.setSerialNo(tempMap.get("SERIAL_NO"));
|
|
tempItem.setInventoryValue(tempMap.get("INVENTORYVALUE"));
|
|
//添加对象
|
|
resultItems.add(tempItem);
|
|
}
|
|
return resultItems;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 根据条件查询库存件的成本价
|
|
* @author LR
|
|
* @date 2025/1/17 11:36
|
|
* @version 1.0
|
|
*/
|
|
public static InventoryValue getInventoryValueByPartNo(Server srv, String contract, String partNo) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT site, PART_NO, CONFIGURATION_ID, LOT_BATCH_NO, SERIAL_NO,");
|
|
searchSql.append(" ifsapp.Inventory_Part_Unit_Cost_API.Get_Inventory_Value_By_Method(CONTRACT,PART_NO,CONFIGURATION_ID,LOT_BATCH_NO,SERIAL_NO) inventoryValue");
|
|
searchSql.append(" FROM ifsapp.INVENTORY_PART_UNIT_COST_SUM pcs");
|
|
searchSql.append(" WHERE pcs.CONTRACT = : contract AND pcs.PART_NO = :partNo AND pcs.CONFIGURATION_ID = '*'");
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
inParam.put("contract", contract);
|
|
inParam.put("partNo", partNo);
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return null;
|
|
} else {
|
|
//调用通用的处理方法 返回Map
|
|
Map<String, String> resultMap = IfsConverterToMap.ConverterIfsToMap(recordCollection.get(0));
|
|
InventoryValue resultRow = new InventoryValue();
|
|
//设置参数
|
|
resultRow.setIfsRowId(resultMap.get("IFSROWID"));
|
|
resultRow.setIfsRowVersion(resultMap.get("IFSROWVERSION"));
|
|
resultRow.setSite(resultMap.get("SITE"));
|
|
resultRow.setPartNo(resultMap.get("PART_NO"));
|
|
resultRow.setConfigurationId(resultMap.get("CONFIGURATION_ID"));
|
|
resultRow.setLotBatchNo(resultMap.get("LOT_BATCH_NO"));
|
|
resultRow.setSerialNo(resultMap.get("SERIAL_NO"));
|
|
resultRow.setInventoryValue(resultMap.get("INVENTORYVALUE"));
|
|
return resultRow;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @description: 查询技术等级的属性列表
|
|
* @author LR
|
|
* @date 2025/1/17 14:12
|
|
* @version 1.0
|
|
*/
|
|
public static List<TechnicalAttribute> getTechnicalAttributesByCon(Server srv, String technicalSpecNo) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, TECHNICAL_SPEC_NO, TECHNICAL_CLASS, ATTRIB_NUMBER, ATTRIBUTE,");
|
|
searchSql.append(" VALUE_NO, LOWER_LIMIT, UPPER_LIMIT, INFO, ALT_VALUE_NO, ALT_UNIT,");
|
|
searchSql.append(" CASE WHEN objtype = 'TechnicalSpecNumeric' THEN 'Numeric'");
|
|
searchSql.append(" WHEN objtype = 'TechnicalSpecAlphanum' THEN 'Alpha' ELSE '' END attributeType");
|
|
searchSql.append(" FROM ifsapp.TECHNICAL_SPECIFICATION_BOTH");
|
|
searchSql.append(" WHERE TECHNICAL_SPEC_NO = :technicalSpecNo");
|
|
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
inParam.put("technicalSpecNo", technicalSpecNo);
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<TechnicalAttribute> technicalAttributes = new ArrayList<>();
|
|
//处理结果集
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
TechnicalAttribute tempItem = new TechnicalAttribute();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setTechnicalSpecNo(tempMap.get("TECHNICAL_SPEC_NO"));
|
|
tempItem.setTechnicalClass(tempMap.get("TECHNICAL_CLASS"));
|
|
tempItem.setAttribute(tempMap.get("ATTRIBUTE"));
|
|
tempItem.setValueNo(tempMap.get("VALUE_NO"));
|
|
tempItem.setLowerLimit(tempMap.get("LOWER_LIMIT"));
|
|
tempItem.setUpperLimit(tempMap.get("UPPER_LIMIT"));
|
|
tempItem.setInfo(tempMap.get("INFO"));
|
|
tempItem.setAttributeType(tempMap.get("ATTRIBUTETYPE"));
|
|
//添加对象
|
|
technicalAttributes.add(tempItem);
|
|
}
|
|
return technicalAttributes;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* @description: 加工中心成本
|
|
* @author LR
|
|
* @date 2025/2/10 15:17
|
|
* @version 1.0
|
|
*/
|
|
public static List<WorkCenterCost> getWorkCenterCosts(Server srv, String siteCon, String ifsRowVersion, int startIndex, int pageSize) throws APException {
|
|
StringBuilder searchSql = new StringBuilder();
|
|
searchSql.append("SELECT OBJID ifsRowId, OBJVERSION ifsRowVersion, CONTRACT, WORK_CENTER_NO,");
|
|
searchSql.append(" ifsapp.WORK_CENTER_API.Get_Description(CONTRACT, WORK_CENTER_NO) workCenterDesc,");
|
|
searchSql.append(" COST_SET, ifsapp.COST_SET_API.Get_Description(CONTRACT,COST_SET) costSetDesc, WC_RATE, WC_COST_CODE,");
|
|
searchSql.append(" OVERHEAD1_FAC, OVERHEAD1_APPL, OVERHEAD2_FAC, OVERHEAD2_APPL,");
|
|
searchSql.append(" to_char(START_DATE, 'yyyy-MM-dd') START_DATE, to_char(END_DATE, 'yyyy-MM-dd') END_DATE");
|
|
searchSql.append(" FROM ifsapp.WORK_CENTER_COST");
|
|
searchSql.append(" WHERE ifsapp.Work_Center_API.Get_Work_Center_Code_Db(contract, work_center_no) = 'I'");
|
|
searchSql.append(" AND COST_SET = '1' AND END_DATE IS NULL");
|
|
|
|
//设置查询的入参
|
|
Map<String, String> inParam = new HashMap<>();
|
|
//判断是否存在入参
|
|
if (!(ifsRowVersion == null || "".equals(ifsRowVersion))){
|
|
searchSql.append(" AND OBJVERSION >= :ifsRowVersion");
|
|
inParam.put("ifsRowVersion", ifsRowVersion);
|
|
}
|
|
//添加排序语句
|
|
searchSql.append(" ORDER BY CONTRACT, WORK_CENTER_NO, COST_SET, START_DATE");
|
|
//添加分页的查询语句
|
|
searchSql.append(" OFFSET "+startIndex+" ROWS FETCH NEXT "+pageSize+" ROWS ONLY");
|
|
//调用查询的通用方法
|
|
RecordCollection recordCollection = IfsPlsqlUtils.execSqlSearchGetRecordCollection(srv, searchSql, inParam);
|
|
//判断能否返回
|
|
if (recordCollection == null) {
|
|
return new ArrayList<>();
|
|
} else {
|
|
List<WorkCenterCost> technicalAttributes = new ArrayList<>();
|
|
//处理结果集
|
|
List<Map<String, String>> resultList = IfsConverterToMap.ConverterIfsToList(recordCollection);
|
|
//获取数据转bean
|
|
for (int i = 0; i < resultList.size(); i++) {
|
|
Map<String, String> tempMap = resultList.get(i);
|
|
WorkCenterCost tempItem = new WorkCenterCost();
|
|
//设置参数
|
|
tempItem.setIfsRowId(tempMap.get("IFSROWID"));
|
|
tempItem.setIfsRowVersion(tempMap.get("IFSROWVERSION"));
|
|
tempItem.setSite(tempMap.get("CONTRACT"));
|
|
tempItem.setWorkCenterNo(tempMap.get("WORK_CENTER_NO"));
|
|
tempItem.setWorkCenterDesc(tempMap.get("WORKCENTERDESC"));
|
|
tempItem.setCostSet(tempMap.get("COST_SET"));
|
|
tempItem.setWcRate(tempMap.get("WC_RATE"));
|
|
tempItem.setCostSetDesc(tempMap.get("COSTSETDESC"));
|
|
tempItem.setWcCostCode(tempMap.get("WC_COST_CODE"));
|
|
tempItem.setOverhead1Fac(tempMap.get("OVERHEAD1_FAC"));
|
|
tempItem.setOverhead2Fac(tempMap.get("OVERHEAD2_FAC"));
|
|
tempItem.setOverhead1Appl(tempMap.get("OVERHEAD1_APPL"));
|
|
tempItem.setOverhead2Appl(tempMap.get("OVERHEAD2_APPL"));
|
|
String startDate = tempMap.get("START_DATE");
|
|
if (!(null == startDate || "".equals(startDate))){
|
|
tempItem.setBeginDate(DateUtils.getStringToDate(startDate, "yyyy-MM-dd"));
|
|
}else{
|
|
tempItem.setBeginDate(null);
|
|
}
|
|
String endDate = tempMap.get("END_DATE");
|
|
if (!(null == endDate || "".equals(endDate))) {
|
|
tempItem.setEndDate(DateUtils.getStringToDate(endDate, "yyyy-MM-dd"));
|
|
}else{
|
|
tempItem.setEndDate(null);
|
|
}
|
|
//添加对象
|
|
technicalAttributes.add(tempItem);
|
|
}
|
|
return technicalAttributes;
|
|
}
|
|
}
|
|
|
|
}
|