diff --git a/src/main/java/com/gaotao/modules/pms/controller/QcController.java b/src/main/java/com/gaotao/modules/pms/controller/QcController.java index 24933aa..cb05f26 100644 --- a/src/main/java/com/gaotao/modules/pms/controller/QcController.java +++ b/src/main/java/com/gaotao/modules/pms/controller/QcController.java @@ -1386,6 +1386,144 @@ public class QcController { return R.ok().put("code", 0).put("importCount", importCount); } + // ======================== IQC检验项目操作和模板导入 ======================== + /** + * 获取IQC检验项目列表(可选+已选) + */ + @PostMapping("/getIQCItemList") + public R getIQCItemList(@RequestBody Map params){ + Map result = qcService.getIQCItemList(params); + return R.ok().put("code", result.get("code")).put("row1", result.get("row1")).put("row2", result.get("row2")); + } + + /** + * 添加IQC检验项目 + */ + @PostMapping("/addIQCItemDetails") + public R addIQCItemDetails(@RequestBody Map params){ + qcService.addIQCItemDetails(params); + return R.ok(); + } + + /** + * 删除IQC检验项目(级联删除子明细) + */ + @PostMapping("/deleteIQCItemDetails") + public R deleteIQCItemDetails(@RequestBody Map params){ + qcService.deleteIQCItemDetails(params); + return R.ok(); + } + + /** + * 获取IQC模板列表 + */ + @PostMapping("/getIQCTemplateList") + public R getIQCTemplateList(@RequestBody Map params){ + List> list = qcService.getIQCTemplateList(params); + return R.ok().put("code", 0).put("rows", list); + } + + /** + * 导入IQC模板项目到检验单 + */ + @PostMapping("/importIQCTemplateItems") + public R importIQCTemplateItems(@RequestBody Map params){ + int importCount = qcService.importIQCTemplateItems(params); + return R.ok().put("code", 0).put("importCount", importCount); + } + + // ======================== FQC检验项目操作和模板导入 ======================== + /** + * 获取FQC检验项目列表(可选+已选) + */ + @PostMapping("/getFQCItemList") + public R getFQCItemList(@RequestBody Map params){ + Map result = qcService.getFQCItemList(params); + return R.ok().put("code", result.get("code")).put("row1", result.get("row1")).put("row2", result.get("row2")); + } + + /** + * 添加FQC检验项目 + */ + @PostMapping("/addFQCItemDetails") + public R addFQCItemDetails(@RequestBody Map params){ + qcService.addFQCItemDetails(params); + return R.ok(); + } + + /** + * 删除FQC检验项目(级联删除子明细) + */ + @PostMapping("/deleteFQCItemDetails") + public R deleteFQCItemDetails(@RequestBody Map params){ + qcService.deleteFQCItemDetails(params); + return R.ok(); + } + + /** + * 获取FQC模板列表 + */ + @PostMapping("/getFQCTemplateList") + public R getFQCTemplateList(@RequestBody Map params){ + List> list = qcService.getFQCTemplateList(params); + return R.ok().put("code", 0).put("rows", list); + } + + /** + * 导入FQC模板项目到检验单 + */ + @PostMapping("/importFQCTemplateItems") + public R importFQCTemplateItems(@RequestBody Map params){ + int importCount = qcService.importFQCTemplateItems(params); + return R.ok().put("code", 0).put("importCount", importCount); + } + + // ======================== OQC检验项目操作和模板导入 ======================== + /** + * 获取OQC检验项目列表(可选+已选) + */ + @PostMapping("/getOQCItemList") + public R getOQCItemList(@RequestBody Map params){ + Map result = qcService.getOQCItemList(params); + return R.ok().put("code", result.get("code")).put("row1", result.get("row1")).put("row2", result.get("row2")); + } + + /** + * 添加OQC检验项目 + */ + @PostMapping("/addOQCItemDetails") + public R addOQCItemDetails(@RequestBody Map params){ + qcService.addOQCItemDetails(params); + return R.ok(); + } + + /** + * 删除OQC检验项目(级联删除子明细) + */ + @PostMapping("/deleteOQCItemDetails") + public R deleteOQCItemDetails(@RequestBody Map params){ + qcService.deleteOQCItemDetails(params); + return R.ok(); + } + + /** + * 获取OQC模板列表 + */ + @PostMapping("/getOQCTemplateList") + public R getOQCTemplateList(@RequestBody Map params){ + List> list = qcService.getOQCTemplateList(params); + return R.ok().put("code", 0).put("rows", list); + } + + /** + * 导入OQC模板项目到检验单 + */ + @PostMapping("/importOQCTemplateItems") + public R importOQCTemplateItems(@RequestBody Map params){ + int importCount = qcService.importOQCTemplateItems(params); + return R.ok().put("code", 0).put("importCount", importCount); + } + /** * 获取检验标准 */ diff --git a/src/main/java/com/gaotao/modules/pms/mapper/QcMapper.java b/src/main/java/com/gaotao/modules/pms/mapper/QcMapper.java index 76df74d..928979b 100644 --- a/src/main/java/com/gaotao/modules/pms/mapper/QcMapper.java +++ b/src/main/java/com/gaotao/modules/pms/mapper/QcMapper.java @@ -329,6 +329,60 @@ public interface QcMapper { List getExistingItemNos(Map params); + // IQC检验项目操作 + List getIQCAvailableItems(Map params); + + List getIQCSelectedItems(Map params); + + List getExistingIQCItems(Map params); + + void insertIQCItemDetail(Map params); + + void deleteIQCItemDetail(Map params); + + void deleteIQCSubDetailByItem(Map params); + + // IQC模板导入 + List> getIQCTemplateList(Map params); + + List getExistingIQCItemNos(Map params); + + // FQC检验项目操作 + List getFQCAvailableItems(Map params); + + List getFQCSelectedItems(Map params); + + List getExistingFQCItems(Map params); + + void insertFQCItemDetail(Map params); + + void deleteFQCItemDetail(Map params); + + void deleteFQCSubDetailByItem(Map params); + + // FQC模板导入 + List> getFQCTemplateList(Map params); + + List getExistingFQCItemNos(Map params); + + // OQC检验项目操作 + List getOQCAvailableItems(Map params); + + List getOQCSelectedItems(Map params); + + List getExistingOQCItems(Map params); + + void insertOQCItemDetail(Map params); + + void deleteOQCItemDetail(Map params); + + void deleteOQCSubDetailByItem(Map params); + + // OQC模板导入 + List> getOQCTemplateList(Map params); + + List getExistingOQCItemNos(Map params); + List getInspectionStandards(QcInspectionStandardData data); void deleteInspectionStandard(QcInspectionStandardData data); diff --git a/src/main/java/com/gaotao/modules/pms/service/Impl/QcServiceImpl.java b/src/main/java/com/gaotao/modules/pms/service/Impl/QcServiceImpl.java index 688a307..b250fa5 100644 --- a/src/main/java/com/gaotao/modules/pms/service/Impl/QcServiceImpl.java +++ b/src/main/java/com/gaotao/modules/pms/service/Impl/QcServiceImpl.java @@ -2906,6 +2906,470 @@ public class QcServiceImpl implements QcService { return importCount; } + // ======================== IQC检验项目操作和模板导入 ======================== + /** + * 获取IQC检验项目列表 + */ + @Override + public Map getIQCItemList(Map params) { + List availableItems = qcMapper.getIQCAvailableItems(params); + List selectedItems = qcMapper.getIQCSelectedItems(params); + + Map result = new HashMap<>(); + result.put("code", 0); + result.put("row1", availableItems); + result.put("row2", selectedItems); + return result; + } + + /** + * 添加IQC检验项目 + */ + @Override + @Transactional + public void addIQCItemDetails(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> itemList = (List>) params.get("itemList"); + + if (itemList != null && !itemList.isEmpty()) { + // 查询当前检验单是否已有检验项目 + Map queryParams = new HashMap<>(); + queryParams.put("site", site); + queryParams.put("buNo", buNo); + queryParams.put("inspectionNo", inspectionNo); + List existingItems = qcMapper.getExistingIQCItems(queryParams); + + // 确定template_id和foreign_flag + String templateId; + String foreignFlag = "Y"; // 后来添加的项目标记为Y + + if (existingItems != null && !existingItems.isEmpty()) { + templateId = existingItems.get(0).getTemplateId(); + } else { + templateId = "*"; + } + + for (Map item : itemList) { + Map insertParams = new HashMap<>(); + insertParams.put("site", site); + insertParams.put("buNo", buNo); + insertParams.put("inspectionNo", inspectionNo); + insertParams.put("itemNo", item.get("itemNo")); + insertParams.put("templateId", templateId); + insertParams.put("foreignFlag", foreignFlag); + + qcMapper.insertIQCItemDetail(insertParams); + } + } + } + + /** + * 删除IQC检验项目 + */ + @Override + @Transactional + public void deleteIQCItemDetails(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> itemList = (List>) params.get("itemList"); + + if (itemList != null && !itemList.isEmpty()) { + for (Map item : itemList) { + String itemNo = (String) item.get("itemNo"); + + Map deleteParams = new HashMap<>(); + deleteParams.put("site", site); + deleteParams.put("buNo", buNo); + deleteParams.put("inspectionNo", inspectionNo); + deleteParams.put("itemNo", itemNo); + + qcMapper.deleteIQCSubDetailByItem(deleteParams); + qcMapper.deleteIQCItemDetail(deleteParams); + } + } + } + + /** + * 获取IQC模板列表 + */ + @Override + public List> getIQCTemplateList(Map params) { + return qcMapper.getIQCTemplateList(params); + } + + /** + * 导入IQC模板项目 + */ + @Override + @Transactional + public int importIQCTemplateItems(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> templateList = (List>) params.get("templateList"); + + int importCount = 0; + + if (templateList != null && !templateList.isEmpty()) { + Map queryParams = new HashMap<>(); + queryParams.put("site", site); + queryParams.put("buNo", buNo); + queryParams.put("inspectionNo", inspectionNo); + List existingItems = qcMapper.getExistingIQCItems(queryParams); + + String targetTemplateId; + String foreignFlag = "Y"; + + if (existingItems != null && !existingItems.isEmpty()) { + targetTemplateId = existingItems.get(0).getTemplateId(); + } else { + targetTemplateId = "*"; + } + + for (Map template : templateList) { + String templateId = (String) template.get("templateId"); + + Map templateItemParams = new HashMap<>(); + templateItemParams.put("site", site); + templateItemParams.put("buNo", buNo); + templateItemParams.put("templateId", templateId); + List templateItems = qcMapper.getTemplateItems(templateItemParams); + + List existingItemNos = qcMapper.getExistingIQCItemNos(queryParams); + + for (EamPropertiesItemData item : templateItems) { + if (existingItemNos.contains(item.getItemNo())) { + continue; + } + + Map insertParams = new HashMap<>(); + insertParams.put("site", site); + insertParams.put("buNo", buNo); + insertParams.put("inspectionNo", inspectionNo); + insertParams.put("itemNo", item.getItemNo()); + insertParams.put("templateId", targetTemplateId); + insertParams.put("foreignFlag", foreignFlag); + + qcMapper.insertIQCItemDetail(insertParams); + importCount++; + } + } + } + + return importCount; + } + + // ======================== FQC检验项目操作和模板导入 ======================== + /** + * 获取FQC检验项目列表 + */ + @Override + public Map getFQCItemList(Map params) { + List availableItems = qcMapper.getFQCAvailableItems(params); + List selectedItems = qcMapper.getFQCSelectedItems(params); + + Map result = new HashMap<>(); + result.put("code", 0); + result.put("row1", availableItems); + result.put("row2", selectedItems); + return result; + } + + /** + * 添加FQC检验项目 + */ + @Override + @Transactional + public void addFQCItemDetails(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> itemList = (List>) params.get("itemList"); + + if (itemList != null && !itemList.isEmpty()) { + Map queryParams = new HashMap<>(); + queryParams.put("site", site); + queryParams.put("buNo", buNo); + queryParams.put("inspectionNo", inspectionNo); + List existingItems = qcMapper.getExistingFQCItems(queryParams); + + String templateId; + String foreignFlag = "Y"; + + if (existingItems != null && !existingItems.isEmpty()) { + templateId = existingItems.get(0).getTemplateId(); + } else { + templateId = "*"; + } + + for (Map item : itemList) { + Map insertParams = new HashMap<>(); + insertParams.put("site", site); + insertParams.put("buNo", buNo); + insertParams.put("inspectionNo", inspectionNo); + insertParams.put("itemNo", item.get("itemNo")); + insertParams.put("templateId", templateId); + insertParams.put("foreignFlag", foreignFlag); + + qcMapper.insertFQCItemDetail(insertParams); + } + } + } + + /** + * 删除FQC检验项目 + */ + @Override + @Transactional + public void deleteFQCItemDetails(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> itemList = (List>) params.get("itemList"); + + if (itemList != null && !itemList.isEmpty()) { + for (Map item : itemList) { + String itemNo = (String) item.get("itemNo"); + + Map deleteParams = new HashMap<>(); + deleteParams.put("site", site); + deleteParams.put("buNo", buNo); + deleteParams.put("inspectionNo", inspectionNo); + deleteParams.put("itemNo", itemNo); + + qcMapper.deleteFQCSubDetailByItem(deleteParams); + qcMapper.deleteFQCItemDetail(deleteParams); + } + } + } + + /** + * 获取FQC模板列表 + */ + @Override + public List> getFQCTemplateList(Map params) { + return qcMapper.getFQCTemplateList(params); + } + + /** + * 导入FQC模板项目 + */ + @Override + @Transactional + public int importFQCTemplateItems(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> templateList = (List>) params.get("templateList"); + + int importCount = 0; + + if (templateList != null && !templateList.isEmpty()) { + Map queryParams = new HashMap<>(); + queryParams.put("site", site); + queryParams.put("buNo", buNo); + queryParams.put("inspectionNo", inspectionNo); + List existingItems = qcMapper.getExistingFQCItems(queryParams); + + String targetTemplateId; + String foreignFlag = "Y"; + + if (existingItems != null && !existingItems.isEmpty()) { + targetTemplateId = existingItems.get(0).getTemplateId(); + } else { + targetTemplateId = "*"; + } + + for (Map template : templateList) { + String templateId = (String) template.get("templateId"); + + Map templateItemParams = new HashMap<>(); + templateItemParams.put("site", site); + templateItemParams.put("buNo", buNo); + templateItemParams.put("templateId", templateId); + List templateItems = qcMapper.getTemplateItems(templateItemParams); + + List existingItemNos = qcMapper.getExistingFQCItemNos(queryParams); + + for (EamPropertiesItemData item : templateItems) { + if (existingItemNos.contains(item.getItemNo())) { + continue; + } + + Map insertParams = new HashMap<>(); + insertParams.put("site", site); + insertParams.put("buNo", buNo); + insertParams.put("inspectionNo", inspectionNo); + insertParams.put("itemNo", item.getItemNo()); + insertParams.put("templateId", targetTemplateId); + insertParams.put("foreignFlag", foreignFlag); + + qcMapper.insertFQCItemDetail(insertParams); + importCount++; + } + } + } + + return importCount; + } + + // ======================== OQC检验项目操作和模板导入 ======================== + /** + * 获取OQC检验项目列表 + */ + @Override + public Map getOQCItemList(Map params) { + List availableItems = qcMapper.getOQCAvailableItems(params); + List selectedItems = qcMapper.getOQCSelectedItems(params); + + Map result = new HashMap<>(); + result.put("code", 0); + result.put("row1", availableItems); + result.put("row2", selectedItems); + return result; + } + + /** + * 添加OQC检验项目 + */ + @Override + @Transactional + public void addOQCItemDetails(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> itemList = (List>) params.get("itemList"); + + if (itemList != null && !itemList.isEmpty()) { + Map queryParams = new HashMap<>(); + queryParams.put("site", site); + queryParams.put("buNo", buNo); + queryParams.put("inspectionNo", inspectionNo); + List existingItems = qcMapper.getExistingOQCItems(queryParams); + + String templateId; + String foreignFlag = "Y"; + + if (existingItems != null && !existingItems.isEmpty()) { + templateId = existingItems.get(0).getTemplateId(); + } else { + templateId = "*"; + } + + for (Map item : itemList) { + Map insertParams = new HashMap<>(); + insertParams.put("site", site); + insertParams.put("buNo", buNo); + insertParams.put("inspectionNo", inspectionNo); + insertParams.put("itemNo", item.get("itemNo")); + insertParams.put("templateId", templateId); + insertParams.put("foreignFlag", foreignFlag); + + qcMapper.insertOQCItemDetail(insertParams); + } + } + } + + /** + * 删除OQC检验项目 + */ + @Override + @Transactional + public void deleteOQCItemDetails(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> itemList = (List>) params.get("itemList"); + + if (itemList != null && !itemList.isEmpty()) { + for (Map item : itemList) { + String itemNo = (String) item.get("itemNo"); + + Map deleteParams = new HashMap<>(); + deleteParams.put("site", site); + deleteParams.put("buNo", buNo); + deleteParams.put("inspectionNo", inspectionNo); + deleteParams.put("itemNo", itemNo); + + qcMapper.deleteOQCSubDetailByItem(deleteParams); + qcMapper.deleteOQCItemDetail(deleteParams); + } + } + } + + /** + * 获取OQC模板列表 + */ + @Override + public List> getOQCTemplateList(Map params) { + return qcMapper.getOQCTemplateList(params); + } + + /** + * 导入OQC模板项目 + */ + @Override + @Transactional + public int importOQCTemplateItems(Map params) { + String site = (String) params.get("site"); + String buNo = (String) params.get("buNo"); + String inspectionNo = (String) params.get("inspectionNo"); + List> templateList = (List>) params.get("templateList"); + + int importCount = 0; + + if (templateList != null && !templateList.isEmpty()) { + Map queryParams = new HashMap<>(); + queryParams.put("site", site); + queryParams.put("buNo", buNo); + queryParams.put("inspectionNo", inspectionNo); + List existingItems = qcMapper.getExistingOQCItems(queryParams); + + String targetTemplateId; + String foreignFlag = "Y"; + + if (existingItems != null && !existingItems.isEmpty()) { + targetTemplateId = existingItems.get(0).getTemplateId(); + } else { + targetTemplateId = "*"; + } + + for (Map template : templateList) { + String templateId = (String) template.get("templateId"); + + Map templateItemParams = new HashMap<>(); + templateItemParams.put("site", site); + templateItemParams.put("buNo", buNo); + templateItemParams.put("templateId", templateId); + List templateItems = qcMapper.getTemplateItems(templateItemParams); + + List existingItemNos = qcMapper.getExistingOQCItemNos(queryParams); + + for (EamPropertiesItemData item : templateItems) { + if (existingItemNos.contains(item.getItemNo())) { + continue; + } + + Map insertParams = new HashMap<>(); + insertParams.put("site", site); + insertParams.put("buNo", buNo); + insertParams.put("inspectionNo", inspectionNo); + insertParams.put("itemNo", item.getItemNo()); + insertParams.put("templateId", targetTemplateId); + insertParams.put("foreignFlag", foreignFlag); + + qcMapper.insertOQCItemDetail(insertParams); + importCount++; + } + } + } + + return importCount; + } + /** * 获取检验标准 */ diff --git a/src/main/java/com/gaotao/modules/pms/service/QcService.java b/src/main/java/com/gaotao/modules/pms/service/QcService.java index 04a0fdf..9f09e84 100644 --- a/src/main/java/com/gaotao/modules/pms/service/QcService.java +++ b/src/main/java/com/gaotao/modules/pms/service/QcService.java @@ -193,6 +193,42 @@ public interface QcService { int importIPQCTemplateItems(Map params); + // IQC检验项目操作 + Map getIQCItemList(Map params); + + void addIQCItemDetails(Map params); + + void deleteIQCItemDetails(Map params); + + // IQC模板导入 + List> getIQCTemplateList(Map params); + + int importIQCTemplateItems(Map params); + + // FQC检验项目操作 + Map getFQCItemList(Map params); + + void addFQCItemDetails(Map params); + + void deleteFQCItemDetails(Map params); + + // FQC模板导入 + List> getFQCTemplateList(Map params); + + int importFQCTemplateItems(Map params); + + // OQC检验项目操作 + Map getOQCItemList(Map params); + + void addOQCItemDetails(Map params); + + void deleteOQCItemDetails(Map params); + + // OQC模板导入 + List> getOQCTemplateList(Map params); + + int importOQCTemplateItems(Map params); + List getInspectionStandards(QcInspectionStandardData data); void saveInspectionStandard(QcInspectionStandardData data); diff --git a/src/main/resources/mapper/pms/QcMapper.xml b/src/main/resources/mapper/pms/QcMapper.xml index d187e22..ff7a98c 100644 --- a/src/main/resources/mapper/pms/QcMapper.xml +++ b/src/main/resources/mapper/pms/QcMapper.xml @@ -2583,6 +2583,408 @@ AND inspection_no = #{inspectionNo} + + + + + + + + + + + + + INSERT INTO qc_iqc_detailed_record ( + inspection_no, + template_id, + item_no, + item_desc, + default_value, + min_value, + max_value, + value_type_db, + value_type, + site, + bu_no, + foreign_flag + ) VALUES ( + #{inspectionNo}, + #{templateId}, + #{itemNo}, + (SELECT ItemDesc FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT DefaultValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT MinValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT MaxValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT ValueType_DB FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT ValueType FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + #{site}, + #{buNo}, + #{foreignFlag} + ) + + + + + DELETE FROM qc_iqc_detailed_record + WHERE site = #{site} + AND bu_no = #{buNo} + AND inspection_no = #{inspectionNo} + AND item_no = #{itemNo} + + + + + DELETE FROM qc_iqc_sub_detail_record + WHERE site = #{site} + AND bu_no = #{buNo} + AND inspection_no = #{inspectionNo} + AND item_no = #{itemNo} + + + + + + + + + + + + + + + + + + + + + INSERT INTO qc_fqc_detailed_record ( + inspection_no, + template_id, + item_no, + item_desc, + default_value, + min_value, + max_value, + value_type_db, + value_type, + site, + bu_no, + foreign_flag + ) VALUES ( + #{inspectionNo}, + #{templateId}, + #{itemNo}, + (SELECT ItemDesc FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT DefaultValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT MinValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT MaxValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT ValueType_DB FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT ValueType FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + #{site}, + #{buNo}, + #{foreignFlag} + ) + + + + + DELETE FROM qc_fqc_detailed_record + WHERE site = #{site} + AND bu_no = #{buNo} + AND inspection_no = #{inspectionNo} + AND item_no = #{itemNo} + + + + + DELETE FROM qc_fqc_sub_detail_record + WHERE site = #{site} + AND bu_no = #{buNo} + AND inspection_no = #{inspectionNo} + AND item_no = #{itemNo} + + + + + + + + + + + + + + + + + + + + + INSERT INTO qc_oqc_detailed_record ( + inspection_no, + template_id, + item_no, + item_desc, + default_value, + min_value, + max_value, + value_type_db, + value_type, + site, + bu_no, + foreign_flag + ) VALUES ( + #{inspectionNo}, + #{templateId}, + #{itemNo}, + (SELECT ItemDesc FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT DefaultValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT MinValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT MaxValue FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT ValueType_DB FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + (SELECT ValueType FROM eam_properties_item WHERE site = #{site} AND bu_no = #{buNo} AND ItemNo = #{itemNo}), + #{site}, + #{buNo}, + #{foreignFlag} + ) + + + + + DELETE FROM qc_oqc_detailed_record + WHERE site = #{site} + AND bu_no = #{buNo} + AND inspection_no = #{inspectionNo} + AND item_no = #{itemNo} + + + + + DELETE FROM qc_oqc_sub_detail_record + WHERE site = #{site} + AND bu_no = #{buNo} + AND inspection_no = #{inspectionNo} + AND item_no = #{itemNo} + + + + + + + +