견적서 API 수정(회로구성도 추가 개발)

This commit is contained in:
LAPTOP-L3VE7KK2\USER 2025-01-13 15:01:27 +09:00
parent 8c2e191247
commit 5efa39fe64
12 changed files with 123 additions and 77 deletions

View File

@ -3,6 +3,7 @@ package com.interplug.qcast.batch;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.ExitStatus; import org.springframework.batch.core.ExitStatus;
import org.springframework.batch.core.Job; import org.springframework.batch.core.Job;
@ -19,7 +20,6 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import lombok.RequiredArgsConstructor;
@RestController @RestController
@RequiredArgsConstructor @RequiredArgsConstructor
@ -310,7 +310,7 @@ public class JobLauncherController {
* @throws JobParametersInvalidException * @throws JobParametersInvalidException
* @throws JobRestartException * @throws JobRestartException
*/ */
@Scheduled(cron = "1 0 0 * * *") @Scheduled(cron = "0 05 04 * * *")
public String planConfirmJob() throws JobInstanceAlreadyCompleteException, public String planConfirmJob() throws JobInstanceAlreadyCompleteException,
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException { JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {
@ -339,7 +339,7 @@ public class JobLauncherController {
* @throws JobParametersInvalidException * @throws JobParametersInvalidException
* @throws JobRestartException * @throws JobRestartException
*/ */
@Scheduled(cron = "1 20 0 * * *") @Scheduled(cron = "0 20 04 * * *")
public String estimateSyncJob() throws JobInstanceAlreadyCompleteException, public String estimateSyncJob() throws JobInstanceAlreadyCompleteException,
JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException { JobExecutionAlreadyRunningException, JobParametersInvalidException, JobRestartException {

View File

@ -79,7 +79,7 @@ public class EstimateController {
return estimateService.updateEstimateReset(estimateRequest); return estimateService.updateEstimateReset(estimateRequest);
} }
@Operation(description = "견적서 잠금여부를 저장한다.") @Operation(description = "견적서 잠금여부를 저장한다.")
@PostMapping("/save-estimate-lock") @PostMapping("/save-estimate-lock")
@ResponseStatus(HttpStatus.CREATED) @ResponseStatus(HttpStatus.CREATED)
public void updateEstimateLock(@RequestBody EstimateRequest estimateRequest) throws Exception { public void updateEstimateLock(@RequestBody EstimateRequest estimateRequest) throws Exception {

View File

@ -40,7 +40,7 @@ public interface EstimateMapper {
public List<RoofResponse> selectEstimateRoofItemList(EstimateRequest estimateRequest); public List<RoofResponse> selectEstimateRoofItemList(EstimateRequest estimateRequest);
// 견적서 지붕재 PC 목록 조회 // 견적서 지붕재 PC 목록 조회
public List<RoofResponse> selectEstimateRoofPcList(EstimateRequest estimateRequest); public List<ItemResponse> selectEstimateCircuitItemList(EstimateRequest estimateRequest);
// 견적서 지붕재 용량 목록 조회 // 견적서 지붕재 용량 목록 조회
public List<RoofResponse> selectEstimateRoofVolList(EstimateRequest estimateRequest); public List<RoofResponse> selectEstimateRoofVolList(EstimateRequest estimateRequest);
@ -78,6 +78,9 @@ public interface EstimateMapper {
// 견적서 지붕재 아이템 등록 // 견적서 지붕재 아이템 등록
public int insertEstimateRoofItem(ItemRequest itemRequest); public int insertEstimateRoofItem(ItemRequest itemRequest);
// 견적서 지붕재 회로구성 아이템 등록
public int insertEstimateCircuitItem(ItemRequest itemRequest);
// 견적서 도면 아이템 등록 // 견적서 도면 아이템 등록
public int insertEstimateDrawingItem(ItemRequest itemRequest); public int insertEstimateDrawingItem(ItemRequest itemRequest);
@ -93,6 +96,9 @@ public interface EstimateMapper {
// 견적서 지붕재 아이템 목록 삭제(물리 삭제) // 견적서 지붕재 아이템 목록 삭제(물리 삭제)
public int deleteEstimateRoofItemList(EstimateRequest estimateRequest); public int deleteEstimateRoofItemList(EstimateRequest estimateRequest);
// 견적서 회로구성 아이템 목록 삭제(물리 삭제)
public int deleteEstimateCircuitItemList(EstimateRequest estimateRequest);
// 견적서 도면 아이템 목록 삭제(물리 삭제) // 견적서 도면 아이템 목록 삭제(물리 삭제)
public int deleteEstimateDrawingItemList(EstimateRequest estimateRequest); public int deleteEstimateDrawingItemList(EstimateRequest estimateRequest);

View File

@ -272,14 +272,10 @@ public class EstimateService {
ErrorCode.INVALID_INPUT_VALUE, ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "Sale Store ID")); message.getMessage("common.message.required.data", "Sale Store ID"));
} }
if (StringUtils.isEmpty(estimateRequest.getSapSalesStoreCd())) {
throw new QcastException(
ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "Sap Sale Store Code"));
}
String splitStr = ""; String splitStr = "";
List<RoofRequest> roofList = new ArrayList<RoofRequest>(); List<RoofRequest> roofList = new ArrayList<RoofRequest>();
List<ItemRequest> circuitItemList = estimateRequest.getCircuitItemList();
List<ItemRequest> itemList = estimateRequest.getItemList(); List<ItemRequest> itemList = estimateRequest.getItemList();
estimateRequest.setTempFlg("0"); estimateRequest.setTempFlg("0");
@ -582,9 +578,10 @@ public class EstimateService {
// 도면 작성일 경우에만 지붕재, 도면 아이템 데이터 초기화 저장 // 도면 작성일 경우에만 지붕재, 도면 아이템 데이터 초기화 저장
if ("1".equals(estimateRequest.getDrawingFlg())) { if ("1".equals(estimateRequest.getDrawingFlg())) {
// 견적서 지붕면/아이템 제거 // 견적서 지붕면/아이템 PC 회로구성도 제거
estimateMapper.deleteEstimateRoofList(estimateRequest); estimateMapper.deleteEstimateRoofList(estimateRequest);
estimateMapper.deleteEstimateRoofItemList(estimateRequest); estimateMapper.deleteEstimateRoofItemList(estimateRequest);
estimateMapper.deleteEstimateCircuitItemList(estimateRequest);
// 견적서 지붕면/아이템 신규 추가 // 견적서 지붕면/아이템 신규 추가
for (RoofRequest roofRequest : roofList) { for (RoofRequest roofRequest : roofList) {
@ -604,6 +601,16 @@ public class EstimateService {
} }
} }
// 견적서 회로구성 아이템 신규 추가
for (ItemRequest circuitItemRequest : circuitItemList) {
circuitItemRequest.setObjectNo(estimateRequest.getObjectNo());
circuitItemRequest.setPlanNo(estimateRequest.getPlanNo());
circuitItemRequest.setItemId(circuitItemRequest.getItemId());
circuitItemRequest.setCircuitCfg(circuitItemRequest.getCircuitCfg());
estimateMapper.insertEstimateCircuitItem(circuitItemRequest);
}
// 견적서 도면 아이템 제거 // 견적서 도면 아이템 제거
estimateMapper.deleteEstimateDrawingItemList(estimateRequest); estimateMapper.deleteEstimateDrawingItemList(estimateRequest);
// 견적서 도면 아이템 등록 // 견적서 도면 아이템 등록
@ -806,6 +813,8 @@ public class EstimateService {
// [6]. 견적서 지붕재 복사 // [6]. 견적서 지붕재 복사
List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest); List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest);
List<RoofResponse> roofItemList = estimateMapper.selectEstimateRoofItemList(estimateRequest); List<RoofResponse> roofItemList = estimateMapper.selectEstimateRoofItemList(estimateRequest);
List<ItemResponse> circuitItemList =
estimateMapper.selectEstimateCircuitItemList(estimateRequest);
for (RoofResponse roofResponse : roofList) { for (RoofResponse roofResponse : roofList) {
List<RoofResponse> roofItemList2 = new ArrayList<RoofResponse>(); List<RoofResponse> roofItemList2 = new ArrayList<RoofResponse>();
@ -848,6 +857,17 @@ public class EstimateService {
} }
} }
for (ItemResponse itemResponse : circuitItemList) {
ItemRequest circuitItemRequest = new ItemRequest();
circuitItemRequest.setObjectNo(estimateCopyRequest.getCopyObjectNo());
circuitItemRequest.setPlanNo(estimateCopyRequest.getCopyPlanNo());
circuitItemRequest.setItemId(itemResponse.getItemId());
circuitItemRequest.setCircuitCfg(itemResponse.getCircuitCfg());
estimateMapper.insertEstimateCircuitItem(circuitItemRequest);
}
// [7]. 견적서 도면 복사 (추후 개발 필요) // [7]. 견적서 도면 복사 (추후 개발 필요)
// [8]. QSP Q.CAST SEND API // [8]. QSP Q.CAST SEND API
@ -1273,7 +1293,8 @@ public class EstimateService {
// 지붕재 목록 조회 // 지붕재 목록 조회
RoofInfoResponse roofInfoResponse = new RoofInfoResponse(); RoofInfoResponse roofInfoResponse = new RoofInfoResponse();
List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest); List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest);
List<RoofResponse> roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest); List<ItemResponse> circuitItemList =
estimateMapper.selectEstimateCircuitItemList(estimateRequest);
estimateRequest.setSchItemGroup("MODULE_"); estimateRequest.setSchItemGroup("MODULE_");
List<RoofResponse> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest); List<RoofResponse> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest);
@ -1300,7 +1321,7 @@ public class EstimateService {
roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw)); roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw));
roofInfoResponse.setRoofList(roofList); roofInfoResponse.setRoofList(roofList);
roofInfoResponse.setRoofPcList(roofPcList); roofInfoResponse.setCircuitItemList(circuitItemList);
roofInfoResponse.setRoofVolList(roofVolList); roofInfoResponse.setRoofVolList(roofVolList);
// 인증용량 구하기 (지붕면마다 모듈과 PCS의 용량을 서로 비교해 낮은쪽 용량으로 합산) // 인증용량 구하기 (지붕면마다 모듈과 PCS의 용량을 서로 비교해 낮은쪽 용량으로 합산)
@ -1885,17 +1906,17 @@ public class EstimateService {
elm = doc.getElementById("notStandItemList_detail"); elm = doc.getElementById("notStandItemList_detail");
elm.append(sb.toString()); elm.append(sb.toString());
if (data.getRoofInfo().getRoofPcList() != null) { if (data.getRoofInfo().getCircuitItemList() != null) {
no = 1; no = 1;
sb = new StringBuilder(); sb = new StringBuilder();
for (RoofResponse roofResponse : data.getRoofInfo().getRoofPcList()) { for (ItemResponse itemResponse : data.getRoofInfo().getCircuitItemList()) {
sb.append("<tr>"); sb.append("<tr>");
sb.append("<td>" + (no++) + "</td>"); sb.append("<td>" + (no++) + "</td>");
sb.append( sb.append(
"<td style='text-align:left;'>" "<td style='text-align:left;'>"
+ StringUtils.defaultString(roofResponse.getItemNo()) + StringUtils.defaultString(itemResponse.getItemNo())
+ " [" + " ["
+ roofResponse.getPcModuleAmount() + itemResponse.getCircuitCfg()
+ "]" + "]"
+ "</td>"); + "</td>");
sb.append("</tr>"); sb.append("</tr>");

View File

@ -195,6 +195,9 @@ public class EstimateRequest {
@Schema(description = "지붕재 목록") @Schema(description = "지붕재 목록")
List<RoofRequest> roofList; List<RoofRequest> roofList;
@Schema(description = "지붕재 목록")
List<ItemRequest> circuitItemList;
@Schema(description = "아이템 목록") @Schema(description = "아이템 목록")
List<ItemRequest> itemList; List<ItemRequest> itemList;

View File

@ -14,6 +14,9 @@ public class ItemRequest {
@Schema(description = "플랜번호") @Schema(description = "플랜번호")
private String planNo; private String planNo;
@Schema(description = "지붕재 아이템 번호")
private String roofItemNo;
@Schema(description = "지붕재 번호") @Schema(description = "지붕재 번호")
private String roofNo; private String roofNo;
@ -74,8 +77,11 @@ public class ItemRequest {
@Schema(description = "PC 아이템 ID") @Schema(description = "PC 아이템 ID")
private String pcItemId; private String pcItemId;
@Schema(description = "회로") @Schema(description = "회로번호")
private String circuit; private String circuitNo;
@Schema(description = "회로구성도")
private String circuitCfg;
@Schema(description = "W") @Schema(description = "W")
private String pnowW; private String pnowW;

View File

@ -79,4 +79,7 @@ public class ItemResponse {
@Schema(description = "모듈여부") @Schema(description = "모듈여부")
private String moduleFlg; private String moduleFlg;
@Schema(description = "회로구성도")
private String circuitCfg;
} }

View File

@ -21,8 +21,8 @@ public class RoofInfoResponse {
@Schema(description = "지붕면 목록") @Schema(description = "지붕면 목록")
private List<RoofResponse> roofList; private List<RoofResponse> roofList;
@Schema(description = "지붕면 파워컨디셔너 목록") @Schema(description = "파워컨디셔너 목록")
private List<RoofResponse> roofPcList; private List<ItemResponse> circuitItemList;
@Schema(description = "지붕면 용량 목록") @Schema(description = "지붕면 용량 목록")
private List<RoofResponse> roofVolList; private List<RoofResponse> roofVolList;

View File

@ -91,10 +91,4 @@ public class RoofResponse {
@Schema(description = "PC 아이템 ID") @Schema(description = "PC 아이템 ID")
private String pcItemId; private String pcItemId;
@Schema(description = "회로")
private String circuit;
@Schema(description = "Pc 모듈 매수")
private String pcModuleAmount;
} }

View File

@ -327,7 +327,7 @@
, ISNULL(( , ISNULL((
SELECT SELECT
SUM((AMOUNT * CAST(ISNULL(SPECIFICATION, 0) AS FLOAT) / 1000)) SUM((AMOUNT * CAST(ISNULL(SPECIFICATION, 0) AS FLOAT) / 1000))
FROM T_ROOF_ITEM_ESTIMATE (NOLOCK) FROM T_PART_ROOF_ITEM_ESTIMATE (NOLOCK)
WHERE OBJECT_NO = PE.OBJECT_NO WHERE OBJECT_NO = PE.OBJECT_NO
AND PLAN_NO = PE.PLAN_NO AND PLAN_NO = PE.PLAN_NO
AND PC_ITEM_ID = PE.ITEM_ID AND PC_ITEM_ID = PE.ITEM_ID
@ -364,7 +364,7 @@
, ISNULL(C2.CODE_NM, '') AS SUPPORT_METHOD_NAME , ISNULL(C2.CODE_NM, '') AS SUPPORT_METHOD_NAME
, ISNULL(C3.CODE_NM, '') AS CONSTRUCT_SPECIFICATION_NAME , ISNULL(C3.CODE_NM, '') AS CONSTRUCT_SPECIFICATION_NAME
FROM T_PLAN P WITH (NOLOCK) FROM T_PLAN P WITH (NOLOCK)
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK) INNER JOIN T_PART_ROOF_ESTIMATE RE WITH (NOLOCK)
ON P.OBJECT_NO = RE.OBJECT_NO ON P.OBJECT_NO = RE.OBJECT_NO
AND P.PLAN_NO = RE.PLAN_NO AND P.PLAN_NO = RE.PLAN_NO
LEFT OUTER JOIN M_COMM_L C1 WITH (NOLOCK) LEFT OUTER JOIN M_COMM_L C1 WITH (NOLOCK)
@ -392,48 +392,26 @@
, ISNULL(PIE.SPECIFICATION, '') AS SPECIFICATION , ISNULL(PIE.SPECIFICATION, '') AS SPECIFICATION
, PIE.AMOUNT , PIE.AMOUNT
, PIE.PC_ITEM_ID , PIE.PC_ITEM_ID
FROM T_ROOF_ITEM_ESTIMATE PIE WITH (NOLOCK) FROM T_PART_ROOF_ITEM_ESTIMATE PIE WITH (NOLOCK)
WHERE PIE.OBJECT_NO = #{objectNo} WHERE PIE.OBJECT_NO = #{objectNo}
AND PIE.PLAN_NO = #{planNo} AND PIE.PLAN_NO = #{planNo}
ORDER BY PIE.ROOF_NO ORDER BY PIE.ROOF_NO
</select> </select>
<select id="selectEstimateRoofPcList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse"> <select id="selectEstimateCircuitItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.ItemResponse">
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofPcList */ /* sqlid : com.interplug.qcast.biz.estimate.selectEstimateCircuitItemList */
SELECT SELECT
T.ITEM_ID PE.ITEM_ID
, T.ITEM_NO , PE.ITEM_NO
, SUM(T.AMOUNT) AS AMOUNT , PE.ITEM_NAME
, SUM(T.PC_AMOUNT) AS PC_MODULE_AMOUNT , PCIE.CIRCUIT_CFG
FROM FROM T_PART_ESTIMATE PE WITH (NOLOCK)
( INNER JOIN T_PART_CIRCUIT_ITEM_ESTIMATE PCIE WITH (NOLOCK)
SELECT ON PE.OBJECT_NO = PCIE.OBJECT_NO
P.OBJECT_NO AND PE.PLAN_NO = PCIE.PLAN_NO
, P.PLAN_NO AND PE.ITEM_ID = PCIE.ITEM_ID
, RE.ROOF_NO WHERE PE.OBJECT_NO = #{objectNo}
, RE.ROOF_SURFACE AND PE.PLAN_NO = #{planNo}
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
, RIE.AMOUNT
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
, I.ITEM_ID
, I.ITEM_NO
, I.ITEM_GROUP
, (SELECT SUM(AMOUNT) FROM T_ROOF_ITEM_ESTIMATE WHERE ROOF_NO = RIE.ROOF_NO AND OBJECT_NO = RIE.OBJECT_NO AND PLAN_NO = RIE.PLAN_NO AND PC_ITEM_ID = RIE.ITEM_ID) AS PC_AMOUNT
FROM T_PLAN P WITH (NOLOCK)
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
ON P.OBJECT_NO = RE.OBJECT_NO
AND P.PLAN_NO = RE.PLAN_NO
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
ON RE.ROOF_NO = RIE.ROOF_NO
AND RE.OBJECT_NO = RE.OBJECT_NO
AND RE.PLAN_NO = RE.PLAN_NO
INNER JOIN M_ITEM I WITH (NOLOCK)
ON RIE.ITEM_ID = I.ITEM_ID
WHERE P.OBJECT_NO = #{objectNo}
AND P.PLAN_NO = #{planNo}
AND I.ITEM_GROUP = 'PC_'
) T
GROUP BY T.ITEM_ID, T.ITEM_NO
</select> </select>
<select id="selectEstimateRoofVolList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse"> <select id="selectEstimateRoofVolList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
@ -463,10 +441,10 @@
, I.ITEM_ID , I.ITEM_ID
, I.ITEM_GROUP , I.ITEM_GROUP
FROM T_PLAN P WITH (NOLOCK) FROM T_PLAN P WITH (NOLOCK)
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK) INNER JOIN T_PART_ROOF_ESTIMATE RE WITH (NOLOCK)
ON P.OBJECT_NO = RE.OBJECT_NO ON P.OBJECT_NO = RE.OBJECT_NO
AND P.PLAN_NO = RE.PLAN_NO AND P.PLAN_NO = RE.PLAN_NO
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK) INNER JOIN T_PART_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
ON RE.ROOF_NO = RIE.ROOF_NO ON RE.ROOF_NO = RIE.ROOF_NO
AND RE.OBJECT_NO = RE.OBJECT_NO AND RE.OBJECT_NO = RE.OBJECT_NO
AND RE.PLAN_NO = RE.PLAN_NO AND RE.PLAN_NO = RE.PLAN_NO
@ -846,7 +824,7 @@
SELECT @@IDENTITY SELECT @@IDENTITY
</selectKey> </selectKey>
INSERT INTO T_ROOF_ESTIMATE INSERT INTO T_PART_ROOF_ESTIMATE
( (
OBJECT_NO OBJECT_NO
, PLAN_NO , PLAN_NO
@ -894,9 +872,14 @@
<insert id="insertEstimateRoofItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest"> <insert id="insertEstimateRoofItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoofItem */ /* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoofItem */
INSERT INTO T_ROOF_ITEM_ESTIMATE <selectKey resultType="String" keyProperty="roofItemNo" order="BEFORE">
SELECT CAST(ISNULL(MAX(ROOF_ITEM_NO), 0) + 1 AS NVARCHAR) FROM T_PART_ROOF_ITEM_ESTIMATE WHERE OBJECT_NO = #{objectNo} AND PLAN_NO = #{planNo}
</selectKey>
INSERT INTO T_PART_ROOF_ITEM_ESTIMATE
( (
ROOF_NO ROOF_ITEM_NO
, ROOF_NO
, OBJECT_NO , OBJECT_NO
, PLAN_NO , PLAN_NO
, ITEM_ID , ITEM_ID
@ -907,7 +890,8 @@
, PC_ITEM_ID , PC_ITEM_ID
) )
SELECT SELECT
#{roofNo} AS ROOF_NO #{roofItemNo} AS ROOF_ITEM_NO
, #{roofNo} AS ROOF_NO
, #{objectNo} AS OBJECT_NO , #{objectNo} AS OBJECT_NO
, #{planNo} AS PLAN_NO , #{planNo} AS PLAN_NO
, I.ITEM_ID , I.ITEM_ID
@ -920,16 +904,45 @@
WHERE I.ITEM_ID = #{itemId} WHERE I.ITEM_ID = #{itemId}
</insert> </insert>
<insert id="insertEstimateCircuitItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateCircuitItem */
<selectKey resultType="String" keyProperty="circuitNo" order="BEFORE">
SELECT CAST(ISNULL(MAX(CIRCUIT_NO), 0) + 1 AS NVARCHAR) FROM T_PART_CIRCUIT_ITEM_ESTIMATE WHERE OBJECT_NO = #{objectNo} AND PLAN_NO = #{planNo}
</selectKey>
INSERT INTO T_PART_CIRCUIT_ITEM_ESTIMATE
(
CIRCUIT_NO
, OBJECT_NO
, PLAN_NO
, ITEM_ID
, CIRCUIT_CFG
) VALUES (
#{circuitNo}
, #{objectNo}
, #{planNo}
, #{itemId}
, #{circuitCfg}
)
</insert>
<delete id="deleteEstimateRoofList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest"> <delete id="deleteEstimateRoofList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofList */ /* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofList */
DELETE FROM T_ROOF_ESTIMATE DELETE FROM T_PART_ROOF_ESTIMATE
WHERE OBJECT_NO = #{objectNo} WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo} AND PLAN_NO = #{planNo}
</delete> </delete>
<delete id="deleteEstimateRoofItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest"> <delete id="deleteEstimateRoofItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofItemList */ /* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofItemList */
DELETE FROM T_ROOF_ITEM_ESTIMATE DELETE FROM T_PART_ROOF_ITEM_ESTIMATE
WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo}
</delete>
<delete id="deleteEstimateCircuitItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateCircuitItemList */
DELETE FROM T_PART_CIRCUIT_ITEM_ESTIMATE
WHERE OBJECT_NO = #{objectNo} WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo} AND PLAN_NO = #{planNo}
</delete> </delete>

View File

@ -38,7 +38,7 @@
, A.CLASS_TYPE , A.CLASS_TYPE
, A.AZIMUTH , A.AZIMUTH
, (CASE WHEN A.CLASS_TYPE = 0 THEN A.SLOPE ELSE A.ANGLE END) AS SLOPE_ANGLE , (CASE WHEN A.CLASS_TYPE = 0 THEN A.SLOPE ELSE A.ANGLE END) AS SLOPE_ANGLE
FROM T_ROOF_ESTIMATE A WITH (NOLOCK) FROM T_PART_ROOF_ESTIMATE A WITH (NOLOCK)
WHERE A.OBJECT_NO = #{objectNo} WHERE A.OBJECT_NO = #{objectNo}
AND A.PLAN_NO = #{planNo} AND A.PLAN_NO = #{planNo}
</select> </select>
@ -85,8 +85,8 @@
, A.CLASS_TYPE , A.CLASS_TYPE
, A.AZIMUTH , A.AZIMUTH
, (CASE WHEN A.CLASS_TYPE = 0 THEN A.SLOPE ELSE A.ANGLE END) AS SLOPE_ANGLE , (CASE WHEN A.CLASS_TYPE = 0 THEN A.SLOPE ELSE A.ANGLE END) AS SLOPE_ANGLE
FROM T_ROOF_ESTIMATE A WITH (NOLOCK) FROM T_PART_ROOF_ESTIMATE A WITH (NOLOCK)
INNER JOIN T_ROOF_ITEM_ESTIMATE B WITH (NOLOCK) INNER JOIN T_PART_ROOF_ITEM_ESTIMATE B WITH (NOLOCK)
ON A.OBJECT_NO = B.OBJECT_NO ON A.OBJECT_NO = B.OBJECT_NO
AND A.PLAN_NO = B.PLAN_NO AND A.PLAN_NO = B.PLAN_NO
AND A.ROOF_NO = B.ROOF_NO AND A.ROOF_NO = B.ROOF_NO