Compare commits
20 Commits
feature/ne
...
V202511110
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1c0e673068 | ||
|
|
ebc27216f4 | ||
| 690e60cd76 | |||
|
|
378a84c768 | ||
|
|
b01fafa0cd | ||
|
|
54cd8e811f | ||
|
|
eef9324a43 | ||
|
|
69d7f8aba6 | ||
| 8ba51a83b6 | |||
|
|
1530d643f2 | ||
|
|
8b3c8b182c | ||
|
|
ba78332607 | ||
| 65dc50ced8 | |||
| 8948073527 | |||
| 9f902a9e93 | |||
| 2b3177ead4 | |||
| 87c2fd8f14 | |||
| b719d20ca2 | |||
| 4dbc6eb887 | |||
| 2b79ef456e |
@@ -3197,4 +3197,12 @@ SELECT option_objid::VARCHAR AS CODE
|
||||
|
||||
ORDER BY CODE_ID
|
||||
</select>
|
||||
|
||||
<!-- 사용자 권한 체크 -->
|
||||
<select id="checkUserAuthority" parameterType="map" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM AUTHORITY_SUB_USER
|
||||
WHERE USER_ID = #{userId}
|
||||
AND MASTER_OBJID::varchar = #{masterObjid}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -755,35 +755,39 @@
|
||||
AND PAID_TYPE = #{paid_type}
|
||||
</if>
|
||||
|
||||
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
|
||||
<if test="search_partObjId != null and search_partObjId != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CONTRACT_ITEM CI
|
||||
WHERE CI.CONTRACT_OBJID = T.OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND CI.PART_OBJID = #{search_partObjId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
|
||||
<if test="search_partObjId != null and search_partObjId != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CONTRACT_ITEM CI
|
||||
WHERE CI.CONTRACT_OBJID = T.OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND CI.PART_OBJID = #{search_partObjId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="search_poNo != null and search_poNo != ''">
|
||||
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
|
||||
</if>
|
||||
|
||||
<if test="order_start_date != null and !''.equals(order_start_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="order_end_date != null and !''.equals(order_end_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
|
||||
<select id="contractList_bak" parameterType="map" resultType="map">
|
||||
@@ -1405,70 +1409,70 @@
|
||||
|
||||
<select id="getContractMgmtInfo" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
OBJID
|
||||
,CATEGORY_CD
|
||||
,CUSTOMER_OBJID
|
||||
,PRODUCT
|
||||
,CUSTOMER_PROJECT_NAME
|
||||
,STATUS_CD
|
||||
,DUE_DATE
|
||||
,LOCATION
|
||||
,SETUP
|
||||
,FACILITY
|
||||
,FACILITY_QTY
|
||||
,FACILITY_TYPE
|
||||
,FACILITY_DEPTH
|
||||
,PRODUCTION_NO
|
||||
,BUS_CAL_CD
|
||||
,CATEGORY1_CD
|
||||
,CHG_USER_ID
|
||||
,PLAN_DATE
|
||||
,COMPLETE_DATE
|
||||
,RESULT_CD
|
||||
,PROJECT_NO
|
||||
,PM_USER_ID
|
||||
,CONTRACT_PRICE
|
||||
,CONTRACT_PRICE_CURRENCY
|
||||
,CONTRACT_CURRENCY
|
||||
,REGDATE
|
||||
,WRITER
|
||||
,CONTRACT_NO
|
||||
,CUSTOMER_EQUIP_NAME
|
||||
,REQ_DEL_DATE
|
||||
,CONTRACT_DEL_DATE
|
||||
,CONTRACT_COMPANY
|
||||
,CONTRACT_DATE
|
||||
,PO_NO
|
||||
,MANUFACTURE_PLANT
|
||||
,CONTRACT_RESULT
|
||||
,PROJECT_NAME
|
||||
,SPEC_USER_ID
|
||||
,SPEC_PLAN_DATE
|
||||
,SPEC_COMP_DATE
|
||||
,SPEC_RESULT_CD
|
||||
,EST_USER_ID
|
||||
,EST_PLAN_DATE
|
||||
,EST_COMP_DATE
|
||||
,EST_RESULT_CD
|
||||
,AREA_CD
|
||||
,TARGET_PROJECT_NO
|
||||
,TARGET_PROJECT_NO_DIRECT
|
||||
,CUSTOMER_PRODUCTION_NO
|
||||
,MECHANICAL_TYPE
|
||||
,OVERHAUL_ORDER
|
||||
,PAID_TYPE
|
||||
,RECEIPT_DATE
|
||||
,PART_NO
|
||||
,PART_NAME
|
||||
,SERIAL_NO
|
||||
,QUANTITY
|
||||
,CUSTOMER_REQUEST
|
||||
,EXCHANGE_RATE
|
||||
,ORDER_DATE
|
||||
,ORDER_UNIT_PRICE
|
||||
,ORDER_SUPPLY_PRICE
|
||||
,ORDER_VAT
|
||||
,ORDER_TOTAL_AMOUNT
|
||||
A.OBJID
|
||||
,A.CATEGORY_CD
|
||||
,A.CUSTOMER_OBJID
|
||||
,A.PRODUCT
|
||||
,A.CUSTOMER_PROJECT_NAME
|
||||
,A.STATUS_CD
|
||||
,A.DUE_DATE
|
||||
,A.LOCATION
|
||||
,A.SETUP
|
||||
,A.FACILITY
|
||||
,A.FACILITY_QTY
|
||||
,A.FACILITY_TYPE
|
||||
,A.FACILITY_DEPTH
|
||||
,A.PRODUCTION_NO
|
||||
,A.BUS_CAL_CD
|
||||
,A.CATEGORY1_CD
|
||||
,A.CHG_USER_ID
|
||||
,A.PLAN_DATE
|
||||
,A.COMPLETE_DATE
|
||||
,A.RESULT_CD
|
||||
,A.PROJECT_NO
|
||||
,A.PM_USER_ID
|
||||
,A.CONTRACT_PRICE
|
||||
,A.CONTRACT_PRICE_CURRENCY
|
||||
,A.CONTRACT_CURRENCY
|
||||
,A.REGDATE
|
||||
,A.WRITER
|
||||
,A.CONTRACT_NO
|
||||
,A.CUSTOMER_EQUIP_NAME
|
||||
,A.REQ_DEL_DATE
|
||||
,A.CONTRACT_DEL_DATE
|
||||
,A.CONTRACT_COMPANY
|
||||
,A.CONTRACT_DATE
|
||||
,A.PO_NO
|
||||
,A.MANUFACTURE_PLANT
|
||||
,A.CONTRACT_RESULT
|
||||
,A.PROJECT_NAME
|
||||
,A.SPEC_USER_ID
|
||||
,A.SPEC_PLAN_DATE
|
||||
,A.SPEC_COMP_DATE
|
||||
,A.SPEC_RESULT_CD
|
||||
,A.EST_USER_ID
|
||||
,A.EST_PLAN_DATE
|
||||
,A.EST_COMP_DATE
|
||||
,A.EST_RESULT_CD
|
||||
,A.AREA_CD
|
||||
,A.TARGET_PROJECT_NO
|
||||
,A.TARGET_PROJECT_NO_DIRECT
|
||||
,A.CUSTOMER_PRODUCTION_NO
|
||||
,A.MECHANICAL_TYPE
|
||||
,A.OVERHAUL_ORDER
|
||||
,A.PAID_TYPE
|
||||
,A.RECEIPT_DATE
|
||||
,A.PART_NO
|
||||
,A.PART_NAME
|
||||
,A.SERIAL_NO
|
||||
,A.QUANTITY
|
||||
,A.CUSTOMER_REQUEST
|
||||
,A.EXCHANGE_RATE
|
||||
,A.ORDER_DATE
|
||||
,A.ORDER_UNIT_PRICE
|
||||
,A.ORDER_SUPPLY_PRICE
|
||||
,A.ORDER_VAT
|
||||
,A.ORDER_TOTAL_AMOUNT
|
||||
,(SELECT COUNT(1) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt01' AND UPPER(STATUS) = 'ACTIVE') AS FILE_CNT1
|
||||
,(SELECT COUNT(1) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt02' AND UPPER(STATUS) = 'ACTIVE') AS FILE_CNT2
|
||||
,(SELECT COUNT(1) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt03' AND UPPER(STATUS) = 'ACTIVE') AS FILE_CNT3
|
||||
@@ -1479,6 +1483,21 @@
|
||||
,(SELECT TO_CHAR(REGDATE, 'YYYY-MM-DD' ) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt03' AND UPPER(STATUS) = 'ACTIVE' ORDER BY REGDATE desc LIMIT 1) AS FILE_DATE3
|
||||
,(SELECT TO_CHAR(REGDATE, 'YYYY-MM-DD' ) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt04' AND UPPER(STATUS) = 'ACTIVE' ORDER BY REGDATE desc LIMIT 1) AS FILE_DATE4
|
||||
,(SELECT TO_CHAR(REGDATE, 'YYYY-MM-DD' ) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt05' AND UPPER(STATUS) = 'ACTIVE' ORDER BY REGDATE desc LIMIT 1) AS FILE_DATE5
|
||||
-- 결재 상태 추가
|
||||
,COALESCE(
|
||||
(SELECT CASE
|
||||
WHEN UPPER(AP.STATUS) = 'INPROCESS' THEN '결재중'
|
||||
WHEN UPPER(AP.STATUS) = 'COMPLETE' THEN '결재완료'
|
||||
WHEN UPPER(AP.STATUS) = 'REJECT' THEN '반려'
|
||||
WHEN UPPER(AP.STATUS) = 'CANCEL' THEN '취소'
|
||||
ELSE '작성중'
|
||||
END
|
||||
FROM APPROVAL AP
|
||||
WHERE AP.TARGET_OBJID::VARCHAR = (SELECT objid::VARCHAR FROM ESTIMATE_TEMPLATE WHERE CONTRACT_OBJID = A.OBJID ORDER BY REGDATE DESC LIMIT 1)
|
||||
AND AP.TARGET_TYPE = 'CONTRACT_ESTIMATE'
|
||||
LIMIT 1),
|
||||
'작성중'
|
||||
) AS APPR_STATUS
|
||||
FROM CONTRACT_MGMT A
|
||||
WHERE A.OBJID = #{objId}
|
||||
</select>
|
||||
@@ -2227,8 +2246,11 @@ SELECT
|
||||
,SUPPLY_TEL_NO
|
||||
,REG_ID
|
||||
,TO_CHAR(REG_DATE,'YYYY-MM-DD') REGDATE
|
||||
,STATUS
|
||||
,CHARGE_USER_NAME
|
||||
,STATUS
|
||||
,CHARGE_USER_NAME
|
||||
,COALESCE(NULLIF(MANAGER1_NAME, ''), NULLIF(MANAGER2_NAME, ''), NULLIF(MANAGER3_NAME, ''), NULLIF(MANAGER4_NAME, ''), MANAGER5_NAME) AS MANAGER1_NAME
|
||||
,COALESCE(NULLIF(MANAGER1_EMAIL, ''), NULLIF(MANAGER2_EMAIL, ''), NULLIF(MANAGER3_EMAIL, ''), NULLIF(MANAGER4_EMAIL, ''), MANAGER5_EMAIL) AS MANAGER1_EMAIL
|
||||
,(SELECT COUNT(*) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID = SUPPLY_MNG.OBJID::VARCHAR AND DOC_TYPE = 'BUS_REG_CERT' AND UPPER(STATUS) = 'ACTIVE') AS BUS_REG_FILE_CNT
|
||||
,case UPPER(STATUS)
|
||||
when 'ACTIVE' then '활성화'
|
||||
when 'INACTIVE' then '비활성화'
|
||||
@@ -2279,10 +2301,13 @@ SELECT
|
||||
,SUPPLY_BUSNAME
|
||||
,SUPPLY_STOCKNAME
|
||||
,SUPPLY_TEL_NO
|
||||
,REG_ID
|
||||
,TO_CHAR(REG_DATE,'YYYY-MM-DD') REGDATE
|
||||
,STATUS
|
||||
,CHARGE_USER_NAME
|
||||
,REG_ID
|
||||
,TO_CHAR(REG_DATE,'YYYY-MM-DD') REGDATE
|
||||
,STATUS
|
||||
,COALESCE(NULLIF(MANAGER1_NAME, ''), NULLIF(MANAGER2_NAME, ''), NULLIF(MANAGER3_NAME, ''), NULLIF(MANAGER4_NAME, ''), MANAGER5_NAME) AS MANAGER1_NAME
|
||||
,COALESCE(NULLIF(MANAGER1_EMAIL, ''), NULLIF(MANAGER2_EMAIL, ''), NULLIF(MANAGER3_EMAIL, ''), NULLIF(MANAGER4_EMAIL, ''), MANAGER5_EMAIL) AS MANAGER1_EMAIL
|
||||
,(SELECT COUNT(*) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID = SUPPLY_MNG.OBJID::VARCHAR AND DOC_TYPE = 'BUS_REG_CERT' AND UPPER(STATUS) = 'ACTIVE') AS BUS_REG_FILE_CNT
|
||||
,CHARGE_USER_NAME
|
||||
,case UPPER(STATUS)
|
||||
when 'ACTIVE' then '활성화'
|
||||
when 'INACTIVE' then '비활성화'
|
||||
@@ -2295,6 +2320,9 @@ SELECT
|
||||
<if test="supply_name != null and supply_name != ''">
|
||||
AND UPPER(SUPPLY_NAME) LIKE UPPER('%${supply_name}%')
|
||||
</if>
|
||||
<if test="manager_name != null and manager_name != ''">
|
||||
AND UPPER(MANAGER1_NAME) LIKE UPPER('%${manager_name}%')
|
||||
</if>
|
||||
<if test="searchStatus != null and searchStatus != ''">
|
||||
AND UPPER(STATUS) LIKE UPPER('%${searchStatus}%')
|
||||
</if>
|
||||
@@ -2357,6 +2385,16 @@ SELECT
|
||||
,OFFICE_NO
|
||||
,EMAIL
|
||||
,CUS_NO
|
||||
,MANAGER1_NAME
|
||||
,MANAGER1_EMAIL
|
||||
,MANAGER2_NAME
|
||||
,MANAGER2_EMAIL
|
||||
,MANAGER3_NAME
|
||||
,MANAGER3_EMAIL
|
||||
,MANAGER4_NAME
|
||||
,MANAGER4_EMAIL
|
||||
,MANAGER5_NAME
|
||||
,MANAGER5_EMAIL
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -2379,25 +2417,45 @@ SELECT
|
||||
,#{office_no }
|
||||
,#{email }
|
||||
,(SELECT 'CUS-' || LPAD((SELECT MAX(SUBSTR(CUS_NO,5,8))::INTEGER+1 FROM SUPPLY_MNG)::VARCHAR,4,'0'))
|
||||
,#{manager1_name }
|
||||
,#{manager1_email }
|
||||
,#{manager2_name }
|
||||
,#{manager2_email }
|
||||
,#{manager3_name }
|
||||
,#{manager3_email }
|
||||
,#{manager4_name }
|
||||
,#{manager4_email }
|
||||
,#{manager5_name }
|
||||
,#{manager5_email }
|
||||
)
|
||||
ON CONFLICT (OBJID) DO
|
||||
UPDATE
|
||||
SET
|
||||
SUPPLY_CODE =#{supply_code }
|
||||
,SUPPLY_NAME =#{supply_name }
|
||||
,REG_NO =#{reg_no }
|
||||
,SUPPLY_ADDRESS =#{supply_address }
|
||||
,SUPPLY_BUSNAME =#{supply_busname }
|
||||
,SUPPLY_STOCKNAME =#{supply_stockname }
|
||||
,SUPPLY_TEL_NO =#{supply_tel_no }
|
||||
,SUPPLY_FAX_NO =#{supply_fax_no }
|
||||
,CHARGE_USER_NAME =#{charge_user_name }
|
||||
,PAYMENT_METHOD =#{payment_method }
|
||||
,REG_ID =#{reg_id }
|
||||
,AREA_CD =#{area_cd }
|
||||
,BUS_REG_NO =#{bus_reg_no }
|
||||
,OFFICE_NO =#{office_no }
|
||||
,EMAIL =#{email }
|
||||
SUPPLY_CODE =#{supply_code }
|
||||
,SUPPLY_NAME =#{supply_name }
|
||||
,REG_NO =#{reg_no }
|
||||
,SUPPLY_ADDRESS =#{supply_address }
|
||||
,SUPPLY_BUSNAME =#{supply_busname }
|
||||
,SUPPLY_STOCKNAME =#{supply_stockname }
|
||||
,SUPPLY_TEL_NO =#{supply_tel_no }
|
||||
,SUPPLY_FAX_NO =#{supply_fax_no }
|
||||
,CHARGE_USER_NAME =#{charge_user_name }
|
||||
,PAYMENT_METHOD =#{payment_method }
|
||||
,REG_ID =#{reg_id }
|
||||
,AREA_CD =#{area_cd }
|
||||
,BUS_REG_NO =#{bus_reg_no }
|
||||
,OFFICE_NO =#{office_no }
|
||||
,EMAIL =#{email }
|
||||
,MANAGER1_NAME =#{manager1_name }
|
||||
,MANAGER1_EMAIL =#{manager1_email }
|
||||
,MANAGER2_NAME =#{manager2_name }
|
||||
,MANAGER2_EMAIL =#{manager2_email }
|
||||
,MANAGER3_NAME =#{manager3_name }
|
||||
,MANAGER3_EMAIL =#{manager3_email }
|
||||
,MANAGER4_NAME =#{manager4_name }
|
||||
,MANAGER4_EMAIL =#{manager4_email }
|
||||
,MANAGER5_NAME =#{manager5_name }
|
||||
,MANAGER5_EMAIL =#{manager5_email }
|
||||
</update>
|
||||
|
||||
|
||||
@@ -4257,33 +4315,40 @@ WHERE
|
||||
AND PAID_TYPE = #{paid_type}
|
||||
</if>
|
||||
|
||||
<if test="search_partNo != null and search_partNo != ''">
|
||||
AND UPPER(PART_NO) LIKE UPPER('%${search_partNo}%')
|
||||
</if>
|
||||
|
||||
<if test="search_partName != null and search_partName != ''">
|
||||
AND UPPER(PART_NAME) LIKE UPPER('%${search_partName}%')
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
|
||||
<if test="search_partObjId != null and search_partObjId != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CONTRACT_ITEM CI
|
||||
WHERE CI.CONTRACT_OBJID = T.OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND CI.PART_OBJID = #{search_partObjId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="search_poNo != null and search_poNo != ''">
|
||||
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
|
||||
</if>
|
||||
|
||||
<if test="order_start_date != null and !''.equals(order_start_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="order_end_date != null and !''.equals(order_end_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
|
||||
<!-- 영업정보 조회 (수주등록용) -->
|
||||
<select id="getContractInfo" parameterType="map" resultType="map">
|
||||
@@ -4436,10 +4501,20 @@ WHERE
|
||||
AND OBJID = #{partObjId}
|
||||
</if>
|
||||
<if test="searchTerm != null and searchTerm != ''">
|
||||
AND (
|
||||
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
)
|
||||
<choose>
|
||||
<when test="searchType == 'partNo'">
|
||||
AND UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
</when>
|
||||
<when test="searchType == 'partName'">
|
||||
AND UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (
|
||||
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
ORDER BY
|
||||
PART_NO
|
||||
|
||||
@@ -863,28 +863,46 @@
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CI.PART_OBJID = T.PART_OBJID
|
||||
AND CI.STATUS = 'ACTIVE') AS CUSTOMER_REQUEST,
|
||||
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
|
||||
T.PO_NO,
|
||||
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
|
||||
CASE WHEN EXISTS(
|
||||
SELECT 1 FROM ATTACH_FILE_INFO
|
||||
WHERE TARGET_OBJID = T.CONTRACT_OBJID
|
||||
AND DOC_TYPE='ORDER_DOC'
|
||||
AND UPPER(STATUS) = 'ACTIVE'
|
||||
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
|
||||
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
|
||||
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
|
||||
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
|
||||
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
|
||||
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
|
||||
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
|
||||
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
|
||||
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
|
||||
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
|
||||
(SELECT CM.PO_NO FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PO_NO,
|
||||
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
|
||||
CASE WHEN EXISTS(
|
||||
SELECT 1 FROM ATTACH_FILE_INFO
|
||||
WHERE TARGET_OBJID = T.CONTRACT_OBJID
|
||||
AND DOC_TYPE='ORDER_DOC'
|
||||
AND UPPER(STATUS) = 'ACTIVE'
|
||||
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
|
||||
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
|
||||
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
|
||||
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
|
||||
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
|
||||
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
|
||||
-- 잔량 계산: 수주수량 - 판매수량
|
||||
COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0) AS REMAINING_QUANTITY,
|
||||
-- 잔량원화총액 계산: (수주수량 - 판매수량) * 판매단가
|
||||
(COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0)) * COALESCE(SR.sales_unit_price, 0) AS REMAINING_AMOUNT_KRW,
|
||||
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
|
||||
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
|
||||
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
|
||||
-- 출하일 (분할출하 포함): 엑셀 다운로드용
|
||||
COALESCE(
|
||||
(SELECT
|
||||
CASE
|
||||
WHEN COUNT(DISTINCT shipping_date) = 0 THEN ''
|
||||
WHEN COUNT(DISTINCT shipping_date) = 1 THEN TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD')
|
||||
ELSE TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD') || '외' || (COUNT(DISTINCT shipping_date) - 1)::TEXT
|
||||
END
|
||||
FROM shipment_log
|
||||
WHERE target_objid = T.OBJID::VARCHAR
|
||||
AND shipping_date IS NOT NULL
|
||||
AND UPPER(COALESCE(shipping_status, '')) != 'CANCELLED'),
|
||||
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '')
|
||||
) AS SHIPPING_DATE_WITH_COUNT,
|
||||
COALESCE(SR.shipping_method, '') AS SHIPPING_METHOD,
|
||||
COALESCE(
|
||||
(SELECT USER_NAME FROM USER_INFO WHERE USER_ID = SR.manager_user_id),
|
||||
@@ -929,60 +947,103 @@
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
|
||||
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
|
||||
</select>
|
||||
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
|
||||
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
|
||||
AND (
|
||||
<if test="search_partNo != null and search_partNo != ''">
|
||||
T.PART_NO = #{search_partNo}
|
||||
</if>
|
||||
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
|
||||
OR
|
||||
</if>
|
||||
<if test="search_partName != null and search_partName != ''">
|
||||
T.PART_NAME = #{search_partName}
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CI.PART_OBJID = T.PART_OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
|
||||
)
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND SR.shipping_order_status = #{shippingStatus}
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="salesStatus != null and salesStatus != ''">
|
||||
<choose>
|
||||
<when test="salesStatus == 'NOT_CLOSED'">
|
||||
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND T.SALES_STATUS = #{salesStatus}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 매출마감 기간 검색 -->
|
||||
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
|
||||
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 그리드 목록 개수 - project_mgmt 테이블 기반 -->
|
||||
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="map">
|
||||
@@ -1023,58 +1084,113 @@
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
</select>
|
||||
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
|
||||
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
|
||||
AND (
|
||||
<if test="search_partNo != null and search_partNo != ''">
|
||||
T.PART_NO = #{search_partNo}
|
||||
</if>
|
||||
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
|
||||
OR
|
||||
</if>
|
||||
<if test="search_partName != null and search_partName != ''">
|
||||
T.PART_NAME = #{search_partName}
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CI.PART_OBJID = T.PART_OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
|
||||
)
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM sales_registration SR
|
||||
WHERE T.PROJECT_NO = SR.project_no
|
||||
AND SR.shipping_order_status = #{shippingStatus}
|
||||
)
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM sales_registration SR
|
||||
WHERE T.PROJECT_NO = SR.project_no
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM sales_registration SR
|
||||
WHERE T.PROJECT_NO = SR.project_no
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="salesStatus != null and salesStatus != ''">
|
||||
<choose>
|
||||
<when test="salesStatus == 'NOT_CLOSED'">
|
||||
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND T.SALES_STATUS = #{salesStatus}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 매출마감 기간 검색 -->
|
||||
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 합계 조회 (Total 공급가액, 부가세, 총액) -->
|
||||
<select id="getSalesMgmtTotals" parameterType="map" resultType="map">
|
||||
@@ -1393,5 +1509,115 @@
|
||||
WHERE T.PROJECT_NO = #{orderNo}
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 주문서 관리에서 수주 데이터 조회 (판매등록용)
|
||||
* CONTRACT_ITEM 테이블에서 수주 정보를 가져와 판매등록 폼에 자동 채우기
|
||||
* @since 2025.11.10
|
||||
* @author assistant
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<select id="getOrderDataForSale" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getOrderDataForSale - 주문서 관리에서 판매등록용 수주 데이터 조회 */
|
||||
SELECT
|
||||
-- 기본 정보
|
||||
CM.CONTRACT_NO AS ORDER_NO,
|
||||
CM.OBJID AS CONTRACT_OBJID,
|
||||
|
||||
-- 수주 금액 정보 (CONTRACT_ITEM 테이블에서 합산) - VARCHAR 타입이므로 NUMERIC으로 캐스팅
|
||||
COALESCE(SUM(CI.ORDER_QUANTITY::NUMERIC), 0) AS SALES_QUANTITY,
|
||||
COALESCE(ROUND(AVG(CI.ORDER_UNIT_PRICE::NUMERIC), 2), 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_SUPPLY_PRICE::NUMERIC), 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_VAT::NUMERIC), 0) AS SALES_VAT,
|
||||
COALESCE(SUM(CI.ORDER_TOTAL_AMOUNT::NUMERIC), 0) AS SALES_TOTAL_AMOUNT,
|
||||
|
||||
-- 환종 정보
|
||||
CM.CONTRACT_CURRENCY AS SALES_CURRENCY,
|
||||
CODE_NAME(CM.CONTRACT_CURRENCY) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(CM.EXCHANGE_RATE::NUMERIC, 0) AS SALES_EXCHANGE_RATE,
|
||||
|
||||
-- 수주 날짜 - VARCHAR 타입이므로 그대로 사용
|
||||
CM.ORDER_DATE AS SHIPPING_DATE,
|
||||
|
||||
-- 담당자
|
||||
CM.PM_USER_ID AS MANAGER
|
||||
|
||||
FROM CONTRACT_MGMT CM
|
||||
LEFT JOIN CONTRACT_ITEM CI ON CM.OBJID::VARCHAR = CI.CONTRACT_OBJID AND UPPER(CI.STATUS) = 'ACTIVE'
|
||||
WHERE CM.OBJID = #{contractObjId}::NUMERIC
|
||||
GROUP BY
|
||||
CM.CONTRACT_NO,
|
||||
CM.OBJID,
|
||||
CM.CONTRACT_CURRENCY,
|
||||
CM.EXCHANGE_RATE,
|
||||
CM.ORDER_DATE,
|
||||
CM.PM_USER_ID
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* orderNo(PROJECT_NO)로 수주 데이터 조회 (판매등록용)
|
||||
* PROJECT_MGMT에서 CONTRACT_OBJID를 찾아서 수주 데이터 조회
|
||||
* @since 2025.11.10
|
||||
* @author assistant
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<select id="getOrderDataByOrderNo" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getOrderDataByOrderNo - orderNo로 판매등록용 수주 데이터 조회 */
|
||||
SELECT
|
||||
-- 기본 정보
|
||||
CM.CONTRACT_NO AS ORDER_NO,
|
||||
CM.OBJID AS CONTRACT_OBJID,
|
||||
|
||||
-- 수주 금액 정보 (CONTRACT_ITEM 테이블에서 합산) - VARCHAR 타입이므로 NUMERIC으로 캐스팅
|
||||
COALESCE(SUM(CI.ORDER_QUANTITY::NUMERIC), 0) AS SALES_QUANTITY,
|
||||
COALESCE(ROUND(AVG(CI.ORDER_UNIT_PRICE::NUMERIC), 2), 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_SUPPLY_PRICE::NUMERIC), 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_VAT::NUMERIC), 0) AS SALES_VAT,
|
||||
COALESCE(SUM(CI.ORDER_TOTAL_AMOUNT::NUMERIC), 0) AS SALES_TOTAL_AMOUNT,
|
||||
|
||||
-- 환종 정보
|
||||
CM.CONTRACT_CURRENCY AS SALES_CURRENCY,
|
||||
CODE_NAME(CM.CONTRACT_CURRENCY) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(CM.EXCHANGE_RATE::NUMERIC, 0) AS SALES_EXCHANGE_RATE,
|
||||
|
||||
-- 수주 날짜 - VARCHAR 타입이므로 그대로 사용
|
||||
CM.ORDER_DATE AS SHIPPING_DATE,
|
||||
|
||||
-- 담당자
|
||||
CM.PM_USER_ID AS MANAGER
|
||||
|
||||
FROM PROJECT_MGMT PM
|
||||
INNER JOIN CONTRACT_MGMT CM ON PM.CONTRACT_OBJID = CM.OBJID
|
||||
LEFT JOIN CONTRACT_ITEM CI ON CM.OBJID::VARCHAR = CI.CONTRACT_OBJID AND UPPER(CI.STATUS) = 'ACTIVE'
|
||||
WHERE PM.PROJECT_NO = #{orderNo}
|
||||
GROUP BY
|
||||
CM.CONTRACT_NO,
|
||||
CM.OBJID,
|
||||
CM.CONTRACT_CURRENCY,
|
||||
CM.EXCHANGE_RATE,
|
||||
CM.ORDER_DATE,
|
||||
CM.PM_USER_ID
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 매출마감 처리
|
||||
* @since 2025.11.10
|
||||
* @author system
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<update id="salesDeadlineConfirm" parameterType="map">
|
||||
/* salesNcollectMgmt.salesDeadlineConfirm - PROJECT_MGMT의 SALES_STATUS를 '완료'로 업데이트 및 매출마감일 저장 */
|
||||
UPDATE PROJECT_MGMT
|
||||
SET
|
||||
SALES_STATUS = '완료',
|
||||
SALES_DEADLINE_DATE = #{deadlineDate}
|
||||
WHERE OBJID::VARCHAR = #{OBJID}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -49,6 +49,11 @@ function refeshAttachFileArea(){
|
||||
}
|
||||
}
|
||||
|
||||
// PDF 미리보기 - 브라우저 새 탭에서 직접 열기
|
||||
function fnc_viewPdfFile(fileObjId){
|
||||
window.open("/common/downloadFile.do?objId="+fileObjId, "_blank");
|
||||
}
|
||||
|
||||
//형상 영역을 display 한다.
|
||||
function srAreaDraw(){
|
||||
fn_fileCallback("sr","${docType}");
|
||||
@@ -113,17 +118,22 @@ function fn_fileCallback(areaId,fileType){
|
||||
appendText +=" <col width='15%'>";
|
||||
appendText +=" </colgroup>";
|
||||
*/
|
||||
appendText+= "<tr>";
|
||||
appendText+= " <td>"+[i+1]+"</td>";
|
||||
appendText+= "<tr>";
|
||||
appendText+= " <td>"+[i+1]+"</td>";
|
||||
// PDF 파일이면 뷰어로, 아니면 다운로드
|
||||
if(fileExt == 'PDF'){
|
||||
appendText+= " <td class='align_l'><a href='javascript:fnc_viewPdfFile(\""+data[i].OBJID+"\")'> "+data[i].REAL_FILE_NAME+"</a>";
|
||||
}else{
|
||||
appendText+= " <td class='align_l'><a href='javascript:fnc_downloadFile(\""+data[i].OBJID+"\")'> "+data[i].REAL_FILE_NAME+"</a>";
|
||||
if(data[i].WRITER=="${connectUserId}" || 'plm_admin'== "${connectUserId}" || DOC_TYPE.indexOf("CAD") > -1){ //240409 설계파일 권한 해제 fileExt == 'DWG' &&
|
||||
appendText+= "<a href='javascript:fileDelete(\""+data[i].OBJID+"\",\""+areaId+"\")'><div class='delete_btn'></div></a>";
|
||||
}
|
||||
|
||||
appendText+= "</td>";
|
||||
appendText+= " <td>"+data[i].REGDATE+"</td>"
|
||||
appendText+= " <td>"+data[i].FILE_SIZE+"</td>"
|
||||
appendText+= "</tr>";
|
||||
}
|
||||
if(data[i].WRITER=="${connectUserId}" || 'plm_admin'== "${connectUserId}" || DOC_TYPE.indexOf("CAD") > -1){ //240409 설계파일 권한 해제 fileExt == 'DWG' &&
|
||||
appendText+= "<a href='javascript:fileDelete(\""+data[i].OBJID+"\",\""+areaId+"\")'><div class='delete_btn'></div></a>";
|
||||
}
|
||||
|
||||
appendText+= "</td>";
|
||||
appendText+= " <td>"+data[i].REGDATE+"</td>"
|
||||
appendText+= " <td>"+data[i].FILE_SIZE+"</td>"
|
||||
appendText+= "</tr>";
|
||||
|
||||
fileList.push(fileName);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
<%@ page language="java" contentType="text/html; charset=EUC-KR" pageEncoding="EUC-KR"%>
|
||||
<%@ page import="java.util.*, java.io.*" %>
|
||||
<%@include file= "/init.jsp" %>
|
||||
<%
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ page import="java.util.*, java.io.*"%><%@include file="/init.jsp"%><%
|
||||
|
||||
HashMap map = (HashMap)request.getAttribute("FILE_MAP");
|
||||
if(map == null) map = new HashMap();
|
||||
@@ -20,10 +17,32 @@ if(!"".equals(realFileName)){
|
||||
realFileName = (java.net.URLEncoder.encode(realFileName, "UTF-8")).replaceAll("\\+", " ");
|
||||
}
|
||||
|
||||
String fullFilePath = filePath+"\\"+savedFileName;
|
||||
// 파일 경로 생성
|
||||
// savedFileName이 구분자로 시작하면 그대로 합치고, 아니면 구분자 추가
|
||||
String fullFilePath = "";
|
||||
if(savedFileName.startsWith("/") || savedFileName.startsWith("\\")){
|
||||
fullFilePath = filePath + savedFileName;
|
||||
} else {
|
||||
fullFilePath = filePath + File.separator + savedFileName;
|
||||
}
|
||||
System.out.println("fullFilePath : "+fullFilePath);
|
||||
System.out.println("filePath : "+filePath);
|
||||
System.out.println("savedFileName : "+savedFileName);
|
||||
System.out.println("realFileName : "+realFileName);
|
||||
|
||||
File f = new File(fullFilePath);
|
||||
File f = new File(fullFilePath);
|
||||
|
||||
// 파일이 없으면 기존 방식(역슬래시 포함)으로 시도
|
||||
if(!f.exists()){
|
||||
String legacyFilePath = filePath + "\\" + savedFileName;
|
||||
System.out.println("Trying legacy path : "+legacyFilePath);
|
||||
File legacyFile = new File(legacyFilePath);
|
||||
if(legacyFile.exists()){
|
||||
f = legacyFile;
|
||||
fullFilePath = legacyFilePath;
|
||||
System.out.println("Found with legacy path!");
|
||||
}
|
||||
}
|
||||
if(f.exists()){
|
||||
|
||||
int filesize = (int)f.length();
|
||||
@@ -36,8 +55,15 @@ if(f.exists()){
|
||||
|
||||
//response.setContentType("text/plain; charset=EUC_KR");
|
||||
//response.setContentType("application/x-msdownload");
|
||||
response.setContentType("application/octet-stream;charset=euc-kr");
|
||||
response.setHeader("Content-Disposition", "attachment; filename="+ realFileName);
|
||||
|
||||
// PDF 파일이면 미리보기 모드로
|
||||
if("PDF".equalsIgnoreCase(fileExt)){
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "inline; filename="+ realFileName);
|
||||
}else{
|
||||
response.setContentType("application/octet-stream;charset=utf-8");
|
||||
response.setHeader("Content-Disposition", "attachment; filename="+ realFileName);
|
||||
}
|
||||
FileInputStream fin = new java.io.FileInputStream(f);
|
||||
BufferedInputStream bis = new BufferedInputStream(fin);
|
||||
ServletOutputStream fout = response.getOutputStream();
|
||||
@@ -62,13 +88,11 @@ if(f.exists()){
|
||||
//file download log 2015-12-22 jmpark end
|
||||
|
||||
} catch( IOException e){
|
||||
response.setContentType("text/html; charset=EUC_KR");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
out.println("Error : "+e.getMessage());
|
||||
}
|
||||
}else{
|
||||
response.setContentType("text/html; charset=EUC_KR");
|
||||
response.setContentType("text/html; charset=UTF-8");
|
||||
out.println("File Not Found : " + fullFilePath);
|
||||
}
|
||||
|
||||
|
||||
%>
|
||||
}
|
||||
%>
|
||||
@@ -217,22 +217,37 @@ function addComma(num) {
|
||||
}
|
||||
|
||||
var columns = [
|
||||
{title:'EST_OBJID' ,field:'EST_OBJID' ,visible:false, frozen:true},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_projectConceptDetail(objid);
|
||||
{title:'EST_OBJID' ,field:'EST_OBJID' ,visible:false, frozen:true},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_projectConceptDetail(objid);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var dueDate = fnc_checkNull(cell.getValue());
|
||||
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
|
||||
|
||||
if(dueDate === '') return '';
|
||||
|
||||
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
|
||||
if(otherCount && parseInt(otherCount) > 0){
|
||||
return dueDate + ' 외 ' + otherCount + '건';
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '88', title : '국내/해외', field : 'AREA_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
|
||||
|
||||
return dueDate;
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '88', title : '국내/해외', field : 'AREA_NAME' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
|
||||
// formatter: function(cell, formatterParams, onRendered){
|
||||
// var value = fnc_checkNull(cell.getValue());
|
||||
@@ -241,11 +256,11 @@ var columns = [
|
||||
// // 쉼표로 구분된 S/N 개수 계산
|
||||
// var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
|
||||
// var count = serialNumbers.length;
|
||||
|
||||
|
||||
// if(count === 0) return '';
|
||||
// if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
|
||||
|
||||
// 2개 이상이면 "첫번째 외 N개" 형식
|
||||
|
||||
// 2개 이상이면 "첫번째 외 N개" 형식
|
||||
// var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
|
||||
// return '<a href="javascript:void(0);">' + displayText + '</a>';
|
||||
// },
|
||||
@@ -255,38 +270,41 @@ var columns = [
|
||||
// }
|
||||
// },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '수량', field : 'QUANTITY' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var dueDate = fnc_checkNull(cell.getValue());
|
||||
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
|
||||
|
||||
if(dueDate === '') return '';
|
||||
|
||||
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
|
||||
if(otherCount && parseInt(otherCount) > 0){
|
||||
return dueDate + ' 외 ' + otherCount + '건';
|
||||
}
|
||||
|
||||
return dueDate;
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '반납사유', field : 'RETURN_REASON_SUMMARY' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객요청사항', field : 'CUSTOMER_REQUEST' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '반납사유', field : 'RETURN_REASON_SUMMARY' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객요청사항', field : 'CUSTOMER_REQUEST' },
|
||||
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적현황', field : 'EST_STATUS',
|
||||
formatter:fnc_subInfoValueFormatter,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_showEstimateList(objid);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '130', title : '공급가액', field : 'EST_TOTAL_AMOUNT',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var value = fnc_checkNull(cell.getValue());
|
||||
if(value === '' || value === '0') return '';
|
||||
// 통화 기호 제거 후 콤마 추가
|
||||
var numericValue = String(value).replace(/[^0-9.]/g, '');
|
||||
return addComma(numericValue);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '150', title : '원화환산공급가액', field : 'EST_TOTAL_AMOUNT_KRW',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var value = fnc_checkNull(cell.getValue());
|
||||
if(value === '' || value === '0') return '';
|
||||
// 통화 기호 제거 후 콤마 추가
|
||||
var numericValue = String(value).replace(/[^0-9.]/g, '');
|
||||
return addComma(numericValue);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적현황', field : 'EST_STATUS',
|
||||
formatter:fnc_subInfoValueFormatter,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_showEstimateList(objid);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '결재상태', field : 'APPR_STATUS',
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var APPROVAL_OBJID = fnc_checkNull(cell.getData().APPROVAL_OBJID);
|
||||
var ROUTE_OBJID = fnc_checkNull(cell.getData().ROUTE_OBJID);
|
||||
approval_form(APPROVAL_OBJID,ROUTE_OBJID);
|
||||
}
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var APPROVAL_OBJID = fnc_checkNull(cell.getData().APPROVAL_OBJID);
|
||||
var ROUTE_OBJID = fnc_checkNull(cell.getData().ROUTE_OBJID);
|
||||
approval_form(APPROVAL_OBJID,ROUTE_OBJID);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '메일발송', field : 'MAIL_SEND_STATUS',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
@@ -309,27 +327,31 @@ var columns = [
|
||||
// }
|
||||
}
|
||||
},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '견적단가', field : 'EST_PRICE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '130', title : '견적공급가액', field : 'EST_TOTAL_AMOUNT',
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'CONTRACT_CURRENCY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환율', field : 'EXCHANGE_RATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var value = fnc_checkNull(cell.getValue());
|
||||
if(value === '' || value === '0') return '';
|
||||
// 통화 기호 제거 후 콤마 추가
|
||||
var numericValue = String(value).replace(/[^0-9.]/g, '');
|
||||
return addComma(numericValue);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '150', title : '견적원화환산공급가액', field : 'EST_TOTAL_AMOUNT_KRW',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var value = fnc_checkNull(cell.getValue());
|
||||
if(value === '' || value === '0') return '';
|
||||
// 통화 기호 제거 후 콤마 추가
|
||||
var numericValue = String(value).replace(/[^0-9.]/g, '');
|
||||
return addComma(numericValue);
|
||||
if(value === '') return '';
|
||||
|
||||
// 쉼표로 구분된 S/N 개수 계산
|
||||
var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
|
||||
var count = serialNumbers.length;
|
||||
|
||||
if(count === 0) return '';
|
||||
if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
|
||||
|
||||
// 2개 이상이면 "첫번째 외 N개" 형식
|
||||
var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
|
||||
return '<a href="javascript:void(0);">' + displayText + '</a>';
|
||||
},
|
||||
cellClick:function(e, cell){
|
||||
var serialNo = fnc_checkNull(cell.getData().SERIAL_NO);
|
||||
fn_showSerialNoPopup(serialNo);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환종', field : 'CONTRACT_CURRENCY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환율', field : 'EXCHANGE_RATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '견적단가', field : 'EST_PRICE' },
|
||||
|
||||
// {title:"영업정보(상세)", headerHozAlign:'center', //고객정보
|
||||
// columns:[
|
||||
@@ -1111,106 +1133,112 @@ function openProjectFormPopUp(objId){
|
||||
</div>
|
||||
</div>
|
||||
<div id="plmSearchZon">
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="category_cd">주문유형</label></td>
|
||||
<td>
|
||||
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.category_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="product">제품구분</label></td>
|
||||
<td>
|
||||
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.product_cd}
|
||||
</select>
|
||||
</td>
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="category_cd">주문유형</label></td>
|
||||
<td>
|
||||
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.category_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<%--
|
||||
<td><label for="product">제품구분</label></td>
|
||||
<td>
|
||||
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.product_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="area_cd">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="area_cd" id="area_cd" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="0001220">국내</option>
|
||||
<option value="0001221">해외</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.customer_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="paid_type">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="paid">유상</option>
|
||||
<option value="free">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
<td><label for="area_cd">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="area_cd" id="area_cd" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="0001220">국내</option>
|
||||
<option value="0001221">해외</option>
|
||||
</select>
|
||||
</td>
|
||||
--%>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.customer_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<%--
|
||||
<td><label for="paid_type">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="paid">유상</option>
|
||||
<option value="free">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
--%>
|
||||
|
||||
<td class="align_r">
|
||||
<label for="" class="">품번</label>
|
||||
<td class="align_r">
|
||||
<label for="" class="">품번</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
|
||||
<option value="">품번 선택</option>
|
||||
</select>
|
||||
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
|
||||
</td>
|
||||
<td class="align_r">
|
||||
<label for="" class="">품명</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
|
||||
<option value="">품명 선택</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="">
|
||||
<label for="" class="">S/N</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
|
||||
<option value="">품번 선택</option>
|
||||
</select>
|
||||
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
|
||||
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
|
||||
</td>
|
||||
<td class="align_r">
|
||||
<label for="" class="">품명</label>
|
||||
|
||||
<td><label for="">결재상태</label></td>
|
||||
<td>
|
||||
<select name="appr_status" id="appr_status" class="select2" autocomplete="off" style="width:130px">
|
||||
<option value="">선택</option>
|
||||
<%-- ${code_map.appr_status} --%>
|
||||
<option value="작성중">작성중</option>
|
||||
<option value="결재중">결재중</option>
|
||||
<option value="반려">반려</option>
|
||||
<option value="결재완료">결재완료</option>
|
||||
<option value="취소">취소</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label>접수일</label>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
|
||||
<option value="">품명 선택</option>
|
||||
</select>
|
||||
<input type="text" name="receipt_start_date" id="receipt_start_date" style="width:90px;" autocomplete="off" value="${param.receipt_start_date}" class="date_icon">~
|
||||
<input type="text" name="receipt_end_date" id="receipt_end_date" style="width:90px;" autocomplete="off" value="${param.receipt_end_date}" class="date_icon">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="">
|
||||
<label for="" class="">S/N</label>
|
||||
</td>
|
||||
<td colspan="">
|
||||
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
|
||||
</td>
|
||||
|
||||
<td><label for="">결재상태</label></td>
|
||||
<td>
|
||||
<select name="appr_status" id="appr_status" class="select2" autocomplete="off" style="width:130px">
|
||||
<option value="">선택</option>
|
||||
<%-- ${code_map.appr_status} --%>
|
||||
<option value="작성중">작성중</option>
|
||||
<option value="결재중">결재중</option>
|
||||
<option value="반려">반려</option>
|
||||
<option value="결재완료">결재완료</option>
|
||||
<option value="취소">취소</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label>접수일</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="receipt_start_date" id="receipt_start_date" style="width:90px;" autocomplete="off" value="${param.receipt_start_date}" class="date_icon">~
|
||||
<input type="text" name="receipt_end_date" id="receipt_end_date" style="width:90px;" autocomplete="off" value="${param.receipt_end_date}" class="date_icon">
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label>요청납기</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
|
||||
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
|
||||
</td>
|
||||
</tr>
|
||||
<%--
|
||||
<td class="">
|
||||
<label>요청납기</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
|
||||
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
|
||||
</td>
|
||||
--%>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -96,98 +96,150 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_projectConceptDetail(objid);
|
||||
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, width:40, frozen:true},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '영업번호', field : 'CONTRACT_NO', frozen:true,
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_projectConceptDetail(objid);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주번호', field : 'PO_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var dueDate = fnc_checkNull(cell.getValue());
|
||||
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
|
||||
|
||||
if(dueDate === '') return '';
|
||||
|
||||
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
|
||||
if(otherCount && parseInt(otherCount) > 0){
|
||||
return dueDate + ' 외 ' + otherCount + '건';
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '주문유형', field : 'CATEGORY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '85', title : '국내/해외', field : 'AREA_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
|
||||
//품번, 품명 추가 시 사용
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품명', field : 'PART_NAME' },
|
||||
|
||||
//S/N 추가 시 사용
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
|
||||
// formatter: function(cell, formatterParams, onRendered){
|
||||
// var value = fnc_checkNull(cell.getValue());
|
||||
// if(value === '') return '';
|
||||
//
|
||||
// // 쉼표로 구분된 S/N 개수 계산
|
||||
// var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
|
||||
// var count = serialNumbers.length;
|
||||
//
|
||||
// if(count === 0) return '';
|
||||
// if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
|
||||
//
|
||||
// // 2개 이상이면 "첫번째 외 N개" 형식
|
||||
// var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
|
||||
// return '<a href="javascript:void(0);">' + displayText + '</a>';
|
||||
// },
|
||||
// cellClick:function(e, cell){
|
||||
// var serialNo = fnc_checkNull(cell.getData().SERIAL_NO);
|
||||
// fn_showSerialNoPopup(serialNo);
|
||||
// }
|
||||
// },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '요청납기', field : 'EARLIEST_DUE_DATE',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var dueDate = fnc_checkNull(cell.getValue());
|
||||
var otherCount = fnc_checkNull(cell.getData().OTHER_DUE_DATE_COUNT);
|
||||
|
||||
if(dueDate === '') return '';
|
||||
|
||||
// 다른 납기가 있으면 "날짜 외 N건" 형식으로 표시
|
||||
if(otherCount && parseInt(otherCount) > 0){
|
||||
return dueDate + ' 외 ' + otherCount + '건';
|
||||
}
|
||||
|
||||
return dueDate;
|
||||
}
|
||||
},
|
||||
|
||||
return dueDate;
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'ITEM_SUMMARY' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAID_TYPE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '수주상태', field : 'CONTRACT_RESULT_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '공급가액', field : 'ORDER_SUPPLY_PRICE_SUM',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '부가세', field : 'ORDER_VAT_SUM',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '총액', field : 'ORDER_TOTAL_AMOUNT_SUM',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '원화총액', field : 'ORDER_TOTAL_AMOUNT_KRW',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'CU01_CNT' ,
|
||||
formatter:fnc_subInfoValueFormatter,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_FileRegist(objid,"ORDER_DOC","ORDER_DOC");
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '결재상태', field : 'APPR_STATUS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'CONTRACT_CURRENCY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환율', field : 'EXCHANGE_RATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'S/N', field : 'SERIAL_NO',
|
||||
formatter: function(cell, formatterParams, onRendered){
|
||||
var value = fnc_checkNull(cell.getValue());
|
||||
if(value === '') return '';
|
||||
|
||||
// 쉼표로 구분된 S/N 개수 계산
|
||||
var serialNumbers = value.split(',').map(function(s){ return s.trim(); }).filter(function(s){ return s !== ''; });
|
||||
var count = serialNumbers.length;
|
||||
|
||||
if(count === 0) return '';
|
||||
if(count === 1) return '<a href="javascript:void(0);">' + serialNumbers[0] + '</a>';
|
||||
|
||||
// 2개 이상이면 "첫번째 외 N개" 형식
|
||||
var displayText = serialNumbers[0] + ' 외 ' + (count - 1) + '개';
|
||||
return '<a href="javascript:void(0);">' + displayText + '</a>';
|
||||
},
|
||||
cellClick:function(e, cell){
|
||||
var serialNo = fnc_checkNull(cell.getData().SERIAL_NO);
|
||||
fn_showSerialNoPopup(serialNo);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '100', title : '품번', field : 'PART_NO' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '제품구분', field : 'PRODUCT_NAME' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '85', title : '국내/해외', field : 'AREA_NAME' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '수량', field : 'QUANTITY' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'DUE_DATE' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객요청사항', field : 'CUSTOMER_REQUEST' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '수주상태', field : 'CONTRACT_RESULT_NAME' },
|
||||
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주번호', field : 'PO_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'CU01_CNT' ,
|
||||
formatter:fnc_subInfoValueFormatter,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
fn_FileRegist(objid,"ORDER_DOC","ORDER_DOC");
|
||||
}
|
||||
},
|
||||
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '단가', field : 'ORDER_UNIT_PRICE',
|
||||
// formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
// },
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '수주공급가액', field : 'ORDER_SUPPLY_PRICE_SUM',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주부가세', field : 'ORDER_VAT_SUM',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주총액', field : 'ORDER_TOTAL_AMOUNT_SUM',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '수주원화총액', field : 'ORDER_TOTAL_AMOUNT_KRW',
|
||||
formatter:"money", formatterParams:{thousand:",", symbolAfter:"", precision:false,},
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환종', field : 'CONTRACT_CURRENCY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '견적환율', field : 'EXCHANGE_RATE' },
|
||||
];
|
||||
|
||||
//var grid;
|
||||
function fn_search(){
|
||||
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/contractMgmt/contractGridList.do", columns, true);
|
||||
// 그리드 조회 및 Total 합계 업데이트를 위한 커스텀 AJAX
|
||||
$.ajax({
|
||||
url: "/contractMgmt/contractGridList.do",
|
||||
type: "POST",
|
||||
data: $("#form1").serializeObject(),
|
||||
dataType: "json",
|
||||
beforeSend: function(){
|
||||
_startLoading("Loading...");
|
||||
},
|
||||
complete: function(){
|
||||
_endLoading();
|
||||
},
|
||||
success: function(response) {
|
||||
// 그리드 데이터 설정
|
||||
if(_tabulGrid){
|
||||
_tabulGrid.setData(response.RESULTLIST || []);
|
||||
} else {
|
||||
// 그리드 초기화
|
||||
_tabulGrid = new Tabulator("#mainGrid", {
|
||||
layout: _tabul_layout_fitColumns,
|
||||
columns: columns,
|
||||
data: response.RESULTLIST || [],
|
||||
selectable: true
|
||||
});
|
||||
}
|
||||
|
||||
// 조회된 전체 데이터의 합계 계산
|
||||
var totalSupplyPrice = 0;
|
||||
var totalVat = 0;
|
||||
var totalAmount = 0;
|
||||
|
||||
if(response.RESULTLIST && response.RESULTLIST.length > 0) {
|
||||
response.RESULTLIST.forEach(function(row) {
|
||||
var supplyPrice = parseFloat(row.ORDER_SUPPLY_PRICE_SUM || 0);
|
||||
var vat = parseFloat(row.ORDER_VAT_SUM || 0);
|
||||
var amount = parseFloat(row.ORDER_TOTAL_AMOUNT_SUM || 0);
|
||||
|
||||
totalSupplyPrice += supplyPrice;
|
||||
totalVat += vat;
|
||||
totalAmount += amount;
|
||||
});
|
||||
}
|
||||
|
||||
// 합계 표시
|
||||
$("#totalSupplyPrice").text(Number(totalSupplyPrice).toLocaleString());
|
||||
$("#totalVat").text(Number(totalVat).toLocaleString());
|
||||
$("#totalAmount").text(Number(totalAmount).toLocaleString());
|
||||
|
||||
// 페이징 HTML 업데이트
|
||||
if(response.PAGE_HTML){
|
||||
$(".table_paging_wrap").html(response.PAGE_HTML);
|
||||
}
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
console.error(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _fnc_datepick(){
|
||||
@@ -560,111 +612,126 @@ function openProjectFormPopUp(objId){
|
||||
</div>
|
||||
</div>
|
||||
<div id="plmSearchZon">
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="category_cd">주문유형</label></td>
|
||||
<td>
|
||||
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.category_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="product">제품구분</label></td>
|
||||
<td>
|
||||
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.product_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="area_cd">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="area_cd" id="area_cd" style="" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="0001220">국내</option>
|
||||
<option value="0001221">해외</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.customer_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="paid_type">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="paid">유상</option>
|
||||
<option value="free">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="align_r">
|
||||
<label for="" class="">품번</label>
|
||||
<table>
|
||||
<tr>
|
||||
<td><label for="category_cd">주문유형</label></td>
|
||||
<td>
|
||||
<select name="category_cd" id="category_cd" style="width:150px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.category_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label for="" class="">발주번호</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
|
||||
<option value="">품번 선택</option>
|
||||
</select>
|
||||
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
|
||||
<input type="text" name="search_poNo" id="search_poNo" value="${param.search_poNo}"/>
|
||||
</td>
|
||||
<td class="align_r">
|
||||
<label for="" class="">품명</label>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
<select name="customer_objid" id="customer_objid" style="width:190px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.customer_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<%--
|
||||
<td><label for="product">제품구분</label></td>
|
||||
<td>
|
||||
<select name="product" id="product" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.product_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="area_cd">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="area_cd" id="area_cd" style="" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="0001220">국내</option>
|
||||
<option value="0001221">해외</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="paid_type">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paid_type" id="paid_type" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
<option value="paid">유상</option>
|
||||
<option value="free">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
--%>
|
||||
|
||||
<td class="align_r">
|
||||
<label for="" class="">품번</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="search_partNo" id="search_partNo" class="select2-part" style="width: 100%;">
|
||||
<option value="">품번 선택</option>
|
||||
</select>
|
||||
<input type="hidden" name="search_partObjId" id="search_partObjId" value=""/>
|
||||
</td>
|
||||
<td class="align_r">
|
||||
<label for="" class="">품명</label>
|
||||
</td>
|
||||
<td>
|
||||
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
|
||||
<option value="">품명 선택</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="">
|
||||
<label for="" class="">S/N</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
|
||||
</td>
|
||||
|
||||
<td><label for="contract_result">수주상태</label></td>
|
||||
<td>
|
||||
<select name="contract_result" id="contract_result" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.result_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label>발주일</label>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
|
||||
<option value="">품명 선택</option>
|
||||
</select>
|
||||
<input type="text" name="order_start_date" id="order_start_date" style="width:90px;" autocomplete="off" value="${param.order_start_date}" class="date_icon">~
|
||||
<input type="text" name="order_end_date" id="order_end_date" style="width:90px;" autocomplete="off" value="${param.order_end_date}" class="date_icon">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="">
|
||||
<label for="" class="">S/N</label>
|
||||
</td>
|
||||
<td colspan="">
|
||||
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
|
||||
</td>
|
||||
|
||||
<td><label for="contract_result">수주상태</label></td>
|
||||
<td>
|
||||
<select name="contract_result" id="contract_result" style="width:130px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.result_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label for="" class="">발주번호</label>
|
||||
</td>
|
||||
<td colspan="">
|
||||
<input type="text" name="search_serialNo" id="search_serialNo" value="${param.search_serialNo}"/>
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label>요청납기</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
|
||||
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
|
||||
</td>
|
||||
|
||||
<td class="">
|
||||
<label>발주일</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" name="order_start_date" id="order_start_date" style="width:90px;" autocomplete="off" value="${param.order_start_date}" class="date_icon">~
|
||||
<input type="text" name="order_end_date" id="order_end_date" style="width:90px;" autocomplete="off" value="${param.order_end_date}" class="date_icon">
|
||||
<td class="">
|
||||
<label>요청납기</label>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<input type="text" name="due_start_date" id="due_start_date" style="width:90px;" autocomplete="off" value="${param.due_start_date}" class="date_icon">~
|
||||
<input type="text" name="due_end_date" id="due_end_date" style="width:90px;" autocomplete="off" value="${param.due_end_date}" class="date_icon">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Total 합계 표시 영역 -->
|
||||
<div style="padding: 3px 10px; background: #f5f5f5; border-radius: 3px; margin: 10px 0;">
|
||||
<span style="font-weight: bold; font-size: 12px; margin-right: 20px;">
|
||||
Total 공급가액: <span id="totalSupplyPrice" style="color: #2196F3;">0</span> 원
|
||||
</span>
|
||||
<span style="font-weight: bold; font-size: 12px; margin-right: 20px;">
|
||||
Total 부가세: <span id="totalVat" style="color: #FF9800;">0</span> 원
|
||||
</span>
|
||||
<span style="font-weight: bold; font-size: 12px;">
|
||||
Total 총액: <span id="totalAmount" style="color: #4CAF50;">0</span> 원
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,16 +48,23 @@
|
||||
var itemList = [];
|
||||
|
||||
$(function() {
|
||||
// console.log("===== 수주등록 팝업 로드됨 =====");
|
||||
// console.log("useEstimateTemplate 값:", "${useEstimateTemplate}");
|
||||
|
||||
// 숫자 입력 필드에 콤마 자동 추가 및 금액 계산
|
||||
$(document).on("keyup", "input:text[numberOnly]", function() {
|
||||
$(this).val(addComma($(this).val().replace(/[^0-9]/g, "")));
|
||||
|
||||
// 수주수량 또는 수주단가가 변경되면 자동 계산
|
||||
if($(this).hasClass("item-quantity") || $(this).hasClass("item-unit-price")) {
|
||||
var itemId = $(this).closest("tr").attr("id");
|
||||
if(itemId) {
|
||||
var itemId = $(this).closest("tr").attr("id");
|
||||
if(itemId) {
|
||||
// 수주수량 또는 수주단가가 변경되면 공급가액, 부가세, 총액 모두 재계산
|
||||
if($(this).hasClass("item-quantity") || $(this).hasClass("item-unit-price")) {
|
||||
fn_calculateItemAmount(itemId);
|
||||
}
|
||||
// 수주부가세만 변경되면 총액만 재계산
|
||||
else if($(this).hasClass("item-vat")) {
|
||||
fn_calculateTotalFromVat(itemId);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -136,33 +143,60 @@
|
||||
});
|
||||
}
|
||||
|
||||
// 품목별 금액 계산 (수량 × 단가 = 공급가액, 공급가액 × 10% = 부가세, 공급가액 + 부가세 = 총액)
|
||||
// 품목별 금액 계산
|
||||
// 수량 × 단가 = 공급가액 (자동)
|
||||
// 부가세 입력 가능 (기본값: 공급가액 × 10%)
|
||||
// 공급가액 + 부가세 = 총액 (자동)
|
||||
function fn_calculateItemAmount(itemId) {
|
||||
var quantity = parseInt(removeComma($("#" + itemId + " .item-quantity").val())) || 0;
|
||||
var unitPrice = parseInt(removeComma($("#" + itemId + " .item-unit-price").val())) || 0;
|
||||
|
||||
// 공급가액 계산
|
||||
var supplyPrice = quantity * unitPrice;
|
||||
var vat = Math.round(supplyPrice * 0.1);
|
||||
var totalAmount = supplyPrice + vat;
|
||||
|
||||
$("#" + itemId + " .item-supply-price").val(addComma(supplyPrice));
|
||||
|
||||
// 부가세 자동 계산 (공급가액의 10%)
|
||||
var vat = Math.round(supplyPrice * 0.1);
|
||||
$("#" + itemId + " .item-vat").val(addComma(vat));
|
||||
|
||||
// 총액 계산
|
||||
var totalAmount = supplyPrice + vat;
|
||||
$("#" + itemId + " .item-total-amount").val(addComma(totalAmount));
|
||||
}
|
||||
|
||||
// 부가세 직접 입력 시 총액만 재계산
|
||||
function fn_calculateTotalFromVat(itemId) {
|
||||
var supplyPrice = parseInt(removeComma($("#" + itemId + " .item-supply-price").val())) || 0;
|
||||
var vat = parseInt(removeComma($("#" + itemId + " .item-vat").val())) || 0;
|
||||
|
||||
// 총액 계산
|
||||
var totalAmount = supplyPrice + vat;
|
||||
$("#" + itemId + " .item-total-amount").val(addComma(totalAmount));
|
||||
}
|
||||
|
||||
// 기존 품목 데이터 로드 (CONTRACT_ITEM 테이블에서)
|
||||
// 기존 품목 데이터 로드 (결재완료 시 ESTIMATE_TEMPLATE_ITEM, 아니면 CONTRACT_ITEM)
|
||||
function fn_loadContractItems() {
|
||||
var contractObjId = $("#contractObjId").val();
|
||||
if(!contractObjId || contractObjId === '') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 결재완료 상태인지 확인
|
||||
var useEstimateTemplate = "${useEstimateTemplate}";
|
||||
// console.log("=== 품목 로드 디버깅 ===");
|
||||
// console.log("contractObjId:", contractObjId);
|
||||
// console.log("useEstimateTemplate:", useEstimateTemplate);
|
||||
|
||||
$.ajax({
|
||||
url: "/contractMgmt/getContractItems.do",
|
||||
type: "POST",
|
||||
data: { contractObjId: contractObjId },
|
||||
data: {
|
||||
contractObjId: contractObjId,
|
||||
useEstimateTemplate: useEstimateTemplate
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data) {
|
||||
// console.log("품목 데이터:", data);
|
||||
if(data && data.items && data.items.length > 0) {
|
||||
$("#noItemRow").remove();
|
||||
|
||||
@@ -180,22 +214,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
var html = '<tr id="' + itemId + '" class="item-row">';
|
||||
html += '<td>' + (i + 1) + '</td>';
|
||||
html += '<td><input type="text" class="item-part-no" value="' + (item.PART_NO || '') + '" readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-part-name" value="' + (item.PART_NAME || '') + '" readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-serial-no" value="' + serialNoDisplay + '" readonly style="background:#f5f5f5;" title="' + serialNo + '" /></td>';
|
||||
html += '<td><input type="text" class="item-quantity" value="' + (item.ORDER_QUANTITY || item.QUANTITY || '') + '" numberOnly required /></td>';
|
||||
html += '<td><input type="text" class="item-unit-price" value="' + (item.ORDER_UNIT_PRICE || '') + '" numberOnly required /></td>';
|
||||
html += '<td><input type="text" class="item-supply-price" value="' + (item.ORDER_SUPPLY_PRICE || '') + '" numberOnly readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-vat" value="' + (item.ORDER_VAT || '') + '" numberOnly readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-total-amount" value="' + (item.ORDER_TOTAL_AMOUNT || '') + '" numberOnly readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td style="text-align:center;">-</td>'; // 삭제 불가
|
||||
html += '<input type="hidden" class="item-objid" value="' + (item.OBJID || '') + '" />';
|
||||
html += '<input type="hidden" class="item-contract-item-objid" value="' + (item.OBJID || '') + '" />'; // CONTRACT_ITEM의 OBJID
|
||||
html += '<input type="hidden" class="item-part-objid" value="' + (item.PART_OBJID || '') + '" />';
|
||||
html += '<input type="hidden" class="item-serial-no-full" value="' + serialNo + '" />'; // 전체 S/N
|
||||
html += '</tr>';
|
||||
var html = '<tr id="' + itemId + '" class="item-row">';
|
||||
html += '<td>' + (i + 1) + '</td>';
|
||||
html += '<td><input type="text" class="item-part-no" value="' + (item.PART_NO || '') + '" readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-part-name" value="' + (item.PART_NAME || '') + '" readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-serial-no" value="' + serialNoDisplay + '" readonly style="background:#f5f5f5;" title="' + serialNo + '" /></td>';
|
||||
html += '<td><input type="text" class="item-quantity" value="' + (item.ORDER_QUANTITY || item.QUANTITY || '') + '" numberOnly required /></td>';
|
||||
html += '<td><input type="text" class="item-unit-price" value="' + (item.ORDER_UNIT_PRICE || '') + '" numberOnly required /></td>';
|
||||
html += '<td><input type="text" class="item-supply-price" value="' + (item.ORDER_SUPPLY_PRICE || '') + '" numberOnly readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td><input type="text" class="item-vat" value="' + (item.ORDER_VAT || '') + '" numberOnly /></td>'; // readonly 제거
|
||||
html += '<td><input type="text" class="item-total-amount" value="' + (item.ORDER_TOTAL_AMOUNT || '') + '" numberOnly readonly style="background:#f5f5f5;" /></td>';
|
||||
html += '<td style="text-align:center;">-</td>'; // 삭제 불가
|
||||
html += '<input type="hidden" class="item-objid" value="' + (item.OBJID || '') + '" />';
|
||||
html += '<input type="hidden" class="item-contract-item-objid" value="' + (item.OBJID || '') + '" />'; // CONTRACT_ITEM의 OBJID
|
||||
html += '<input type="hidden" class="item-part-objid" value="' + (item.PART_OBJID || '') + '" />';
|
||||
html += '<input type="hidden" class="item-serial-no-full" value="' + serialNo + '" />'; // 전체 S/N
|
||||
html += '</tr>';
|
||||
|
||||
$("#itemListBody").append(html);
|
||||
|
||||
@@ -208,9 +242,14 @@
|
||||
|
||||
// 이벤트 바인딩 (클로저 문제 해결)
|
||||
(function(id) {
|
||||
// 수량, 단가 변경 시 → 전체 재계산
|
||||
$("#" + id + " .item-quantity, #" + id + " .item-unit-price").on("change keyup", function() {
|
||||
fn_calculateItemAmount(id);
|
||||
});
|
||||
// 부가세 변경 시 → 총액만 재계산
|
||||
$("#" + id + " .item-vat").on("change keyup", function() {
|
||||
fn_calculateTotalFromVat(id);
|
||||
});
|
||||
})(itemId);
|
||||
|
||||
// S/N 클릭 시 전체 S/N 보기
|
||||
@@ -366,10 +405,10 @@
|
||||
${code_map.contract_result}
|
||||
</select>
|
||||
</td>
|
||||
<td class="input_title"><label for="">발주번호 <span style="color:red;">*</span></label></td>
|
||||
<td>
|
||||
<input type="text" name="po_no" id="po_no" required reqTitle="발주번호" value="${info.PO_NO}" />
|
||||
</td>
|
||||
<td class="input_title"><label for="">발주번호</label></td>
|
||||
<td>
|
||||
<input type="text" name="po_no" id="po_no" value="${info.PO_NO}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 두번째 행: 발주일, 견적환종 -->
|
||||
|
||||
@@ -55,24 +55,35 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
var columns = [
|
||||
{title:'OBJID', field:'OBJID' ,visible:false },
|
||||
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '고객번호', field : 'CUS_NO',
|
||||
formatter : fnc_createGridAnchorTag,
|
||||
cellClick : function(e, cell) {
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
openOEMPopUp(objid);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '고객구분', field : 'SUPPLY_CODE_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '110', title : '지역', field : 'AREA_CD_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left ', width : '200', title : '고객사', field : 'SUPPLY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '대표자명', field : 'CHARGE_USER_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '130', title : '사업자등록번호', field : 'BUS_REG_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', /* width : '300', */ title : '주소', field : 'SUPPLY_ADDRESS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '연락처', field : 'SUPPLY_TEL_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '240', title : 'E-MAIL', field : 'EMAIL' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '등록일', field : 'REGDATE' }
|
||||
{title:'OBJID', field:'OBJID' ,visible:false },
|
||||
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '고객번호', field : 'CUS_NO',
|
||||
formatter : fnc_createGridAnchorTag,
|
||||
cellClick : function(e, cell) {
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
openOEMPopUp(objid);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '등록일', field : 'REGDATE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left ', width : '200', title : '고객사', field : 'SUPPLY_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '130', title : '사업자등록번호', field : 'BUS_REG_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '담당자명', field : 'MANAGER1_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '110', title : '연락처', field : 'SUPPLY_TEL_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '240', title : '이메일', field : 'EMAIL' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', /* width : '300', */ title : '주소', field : 'SUPPLY_ADDRESS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '120', title : '대표자명', field : 'CHARGE_USER_NAME' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '사업자등록증', field : 'BUS_REG_FILE_CNT',
|
||||
formatter: function(cell, formatterParams){
|
||||
var objid = cell.getData().OBJID;
|
||||
var fileCnt = cell.getData().BUS_REG_FILE_CNT || 0;
|
||||
var imgSrc = fileCnt > 0 ? '/images/folder_blue.png' : '/images/file_empty.png';
|
||||
var title = fileCnt > 0 ? '사업자등록증 보기 ('+fileCnt+'개)' : '등록된 파일 없음';
|
||||
return "<a href='javascript:viewBusRegCert(\""+objid+"\")'><img src='"+imgSrc+"' height='25px' width='25px' style='cursor:pointer;' title='"+title+"'></a>";
|
||||
}
|
||||
}
|
||||
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '고객구분', field : 'SUPPLY_CODE_NAME' },
|
||||
//{headerHozAlign : 'center', hozAlign : 'left', width : '110', title : '지역', field : 'AREA_CD_NAME' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '담당자 이메일', field : 'MANAGER1_EMAIL' },
|
||||
];
|
||||
|
||||
//var grid;
|
||||
@@ -134,8 +145,8 @@ function fn_excel() {
|
||||
form.submit();
|
||||
}
|
||||
function openOEMPopUp(objid){
|
||||
var popup_width = 850;
|
||||
var popup_height = 330;
|
||||
var popup_width = 900;
|
||||
var popup_height = 700;
|
||||
var target = "openOEMPopUp";
|
||||
|
||||
fn_centerPopup(popup_width, popup_height, url, target);
|
||||
@@ -175,6 +186,67 @@ function fn_excel() {
|
||||
}
|
||||
}
|
||||
|
||||
// 사업자등록증 보기
|
||||
function viewBusRegCert(supplyObjId){
|
||||
// 파일 목록 가져오기
|
||||
$.ajax({
|
||||
url: "/common/getFileList.do",
|
||||
type: "POST",
|
||||
data: {
|
||||
targetObjId: supplyObjId,
|
||||
docType: "BUS_REG_CERT"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(data && data.length > 0){
|
||||
// 파일이 1개면 바로 새 탭에서 열기
|
||||
if(data.length === 1){
|
||||
window.open("/common/downloadFile.do?objId="+data[0].OBJID, "_blank");
|
||||
} else {
|
||||
// 파일이 여러 개면 선택 팝업 표시
|
||||
showFileSelectPopup(data);
|
||||
}
|
||||
} else {
|
||||
Swal.fire("등록된 사업자등록증이 없습니다.");
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
Swal.fire("파일 목록을 불러오는데 실패했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 여러 파일 선택 팝업
|
||||
function showFileSelectPopup(files){
|
||||
var fileListHtml = "<div style='max-height:400px; overflow-y:auto;'>";
|
||||
fileListHtml += "<table style='width:100%; border-collapse:collapse;'>";
|
||||
fileListHtml += "<thead><tr style='background-color:#f8f9fa;'>";
|
||||
fileListHtml += "<th style='padding:10px; border:1px solid #dee2e6;'>파일명</th>";
|
||||
fileListHtml += "<th style='padding:10px; border:1px solid #dee2e6; width:100px;'>등록일</th>";
|
||||
fileListHtml += "<th style='padding:10px; border:1px solid #dee2e6; width:80px;'>보기</th>";
|
||||
fileListHtml += "</tr></thead><tbody>";
|
||||
|
||||
$.each(files, function(i, file){
|
||||
fileListHtml += "<tr>";
|
||||
fileListHtml += "<td style='padding:8px; border:1px solid #dee2e6;'>"+file.REAL_FILE_NAME+"</td>";
|
||||
fileListHtml += "<td style='padding:8px; border:1px solid #dee2e6; text-align:center;'>"+file.REGDATE+"</td>";
|
||||
fileListHtml += "<td style='padding:8px; border:1px solid #dee2e6; text-align:center;'>";
|
||||
fileListHtml += "<button onclick='window.open(\"/common/downloadFile.do?objId="+file.OBJID+"\", \"_blank\"); return false;' style='padding:5px 10px; cursor:pointer;'>보기</button>";
|
||||
fileListHtml += "</td>";
|
||||
fileListHtml += "</tr>";
|
||||
});
|
||||
|
||||
fileListHtml += "</tbody></table></div>";
|
||||
|
||||
Swal.fire({
|
||||
title: '사업자등록증 ('+files.length+'개)',
|
||||
html: fileListHtml,
|
||||
width: '700px',
|
||||
showCloseButton: true,
|
||||
showConfirmButton: false
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@@ -206,7 +278,10 @@ function fn_excel() {
|
||||
<td class="label"><label for="">고객사명</label></td>
|
||||
<td><input type="text" name="supply_name" id="supply_name" value="<%=supply_name%>"></td>
|
||||
|
||||
<td class="label"><label for="">담당자명</label></td>
|
||||
<td><input type="text" name="manager_name" id="manager_name" value=""></td>
|
||||
|
||||
<%--
|
||||
<td class="label"><label for="">고객구분</label></td>
|
||||
<td>
|
||||
<select name="supply_code" id="supply_code" type="select" class="select2" autocomplete="off">
|
||||
@@ -222,6 +297,7 @@ function fn_excel() {
|
||||
${code_map.area_cd}
|
||||
</select>
|
||||
</td>
|
||||
--%>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -121,8 +121,8 @@ function fn_delete(){
|
||||
|
||||
}
|
||||
function openOEMPopUp(objid){
|
||||
var popup_width = 850;
|
||||
var popup_height = 330;
|
||||
var popup_width = 900;
|
||||
var popup_height = 700;
|
||||
var target = "openOEMPopUp";
|
||||
|
||||
fn_centerPopup(popup_width, popup_height, url, target);
|
||||
@@ -163,6 +163,67 @@ function fn_delete(){
|
||||
}
|
||||
}
|
||||
|
||||
// 사업자등록증 보기
|
||||
function viewBusRegCert(supplyObjId){
|
||||
// 파일 목록 가져오기
|
||||
$.ajax({
|
||||
url: "/common/getFileList.do",
|
||||
type: "POST",
|
||||
data: {
|
||||
targetObjId: supplyObjId,
|
||||
docType: "BUS_REG_CERT"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
if(data && data.length > 0){
|
||||
// 파일이 1개면 바로 새 탭에서 열기
|
||||
if(data.length === 1){
|
||||
window.open("/common/downloadFile.do?objId="+data[0].OBJID, "_blank");
|
||||
} else {
|
||||
// 파일이 여러 개면 선택 팝업 표시
|
||||
showFileSelectPopup(data);
|
||||
}
|
||||
} else {
|
||||
Swal.fire("등록된 사업자등록증이 없습니다.");
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
Swal.fire("파일 목록을 불러오는데 실패했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 여러 파일 선택 팝업
|
||||
function showFileSelectPopup(files){
|
||||
var fileListHtml = "<div style='max-height:400px; overflow-y:auto;'>";
|
||||
fileListHtml += "<table style='width:100%; border-collapse:collapse;'>";
|
||||
fileListHtml += "<thead><tr style='background-color:#f8f9fa;'>";
|
||||
fileListHtml += "<th style='padding:10px; border:1px solid #dee2e6;'>파일명</th>";
|
||||
fileListHtml += "<th style='padding:10px; border:1px solid #dee2e6; width:100px;'>등록일</th>";
|
||||
fileListHtml += "<th style='padding:10px; border:1px solid #dee2e6; width:80px;'>보기</th>";
|
||||
fileListHtml += "</tr></thead><tbody>";
|
||||
|
||||
$.each(files, function(i, file){
|
||||
fileListHtml += "<tr>";
|
||||
fileListHtml += "<td style='padding:8px; border:1px solid #dee2e6;'>"+file.REAL_FILE_NAME+"</td>";
|
||||
fileListHtml += "<td style='padding:8px; border:1px solid #dee2e6; text-align:center;'>"+file.REGDATE+"</td>";
|
||||
fileListHtml += "<td style='padding:8px; border:1px solid #dee2e6; text-align:center;'>";
|
||||
fileListHtml += "<button onclick='window.open(\"/common/downloadFile.do?objId="+file.OBJID+"\", \"_blank\"); return false;' style='padding:5px 10px; cursor:pointer;'>보기</button>";
|
||||
fileListHtml += "</td>";
|
||||
fileListHtml += "</tr>";
|
||||
});
|
||||
|
||||
fileListHtml += "</tbody></table></div>";
|
||||
|
||||
Swal.fire({
|
||||
title: '사업자등록증 ('+files.length+'개)',
|
||||
html: fileListHtml,
|
||||
width: '700px',
|
||||
showCloseButton: true,
|
||||
showConfirmButton: false
|
||||
});
|
||||
}
|
||||
|
||||
function fn_search(){
|
||||
var form = document.form1;
|
||||
form.action="/contractMgmt/supplyMngPagingList.do";
|
||||
@@ -190,23 +251,23 @@ function fn_delete(){
|
||||
<tr>
|
||||
<td class="label"><label for="">고객사명</label></td>
|
||||
<td><input type="text" name="supply_name" id="supply_name" value="<%=supply_name%>"></td>
|
||||
|
||||
|
||||
<td class="label"><label for="">고객구분</label></td>
|
||||
<td>
|
||||
<select name="supply_code" id="supply_code" type="select" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.supply_code}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="label"><label for="">지역</label></td>
|
||||
<td>
|
||||
<select name="area_cd" id="area_cd" type="select" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.area_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
|
||||
<!-- <td class="label"><label for="">고객구분</label></td> -->
|
||||
<!-- <td> -->
|
||||
<!-- <select name="supply_code" id="supply_code" type="select" class="select2" autocomplete="off"> -->
|
||||
<!-- <option value="">선택</option> -->
|
||||
<%-- ${code_map.supply_code} --%>
|
||||
<!-- </select> -->
|
||||
<!-- </td> -->
|
||||
|
||||
<!-- <td class="label"><label for="">지역</label></td> -->
|
||||
<!-- <td> -->
|
||||
<!-- <select name="area_cd" id="area_cd" type="select" class="select2" autocomplete="off"> -->
|
||||
<!-- <option value="">선택</option> -->
|
||||
<%-- ${code_map.area_cd} --%>
|
||||
<!-- </select> -->
|
||||
<!-- </td> -->
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@@ -238,19 +299,22 @@ function fn_delete(){
|
||||
<col width="7%" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr class="plm_thead">
|
||||
<td><input type="checkbox" id="allCheck"></td>
|
||||
<td>고객번호</td>
|
||||
<td>고객구분</td>
|
||||
<td>지역</td>
|
||||
<td>고객사</td>
|
||||
<td>대표자명</td>
|
||||
<td>사업자등록번호</td>
|
||||
<td>주소</td>
|
||||
<td>연락처</td>
|
||||
<td>E-MAIL</td>
|
||||
<td>등록일</td>
|
||||
</tr>
|
||||
<tr class="plm_thead">
|
||||
<td><input type="checkbox" id="allCheck"></td>
|
||||
<td>고객번호</td>
|
||||
<!-- <td>고객구분</td> -->
|
||||
<!-- <td>지역</td> -->
|
||||
<td>고객사</td>
|
||||
<td>대표자명</td>
|
||||
<td>담당자</td>
|
||||
<!-- <td>담당자 이메일</td> -->
|
||||
<td>사업자등록번호</td>
|
||||
<td>주소</td>
|
||||
<td>연락처</td>
|
||||
<td>E-MAIL</td>
|
||||
<td>등록일</td>
|
||||
<td>사업자등록증</td>
|
||||
</tr>
|
||||
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -258,17 +322,33 @@ function fn_delete(){
|
||||
<c:when test="${0 < supplyInfoList.size()}">
|
||||
<c:forEach var="oemInfo" items="${supplyInfoList}">
|
||||
<tr>
|
||||
<td><input type="checkbox" name="oemCheck" value="${oemInfo.OBJID}"></td>
|
||||
<td><a href="#" onclick="javascript:openOEMPopUp('${oemInfo.OBJID}')">${oemInfo.CUS_NO}</a></td>
|
||||
<td>${oemInfo.SUPPLY_CODE_NAME}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.AREA_CD_NAME}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.SUPPLY_NAME}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.CHARGE_USER_NAME}</td>
|
||||
<td>${oemInfo.BUS_REG_NO}</td>
|
||||
<td><input type="checkbox" name="oemCheck" value="${oemInfo.OBJID}"></td>
|
||||
<td><a href="#" onclick="javascript:openOEMPopUp('${oemInfo.OBJID}')">${oemInfo.CUS_NO}</a></td>
|
||||
<%-- <td>${oemInfo.SUPPLY_CODE_NAME}</td> --%>
|
||||
<%-- <td style="text-align:left; padding-left: 10px;">${oemInfo.AREA_CD_NAME}</td> --%>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.SUPPLY_NAME}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.CHARGE_USER_NAME}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.MANAGER1_NAME}</td>
|
||||
<%-- <td style="text-align:left; padding-left: 10px;">${oemInfo.MANAGER1_EMAIL}</td> --%>
|
||||
<td>${oemInfo.BUS_REG_NO}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.SUPPLY_ADDRESS}</td>
|
||||
<td>${oemInfo.SUPPLY_TEL_NO}</td>
|
||||
<td style="text-align:left; padding-left: 10px;">${oemInfo.EMAIL}</td>
|
||||
<td>${oemInfo.REGDATE}</td>
|
||||
<td>
|
||||
<c:choose>
|
||||
<c:when test="${not empty oemInfo.BUS_REG_FILE_CNT and oemInfo.BUS_REG_FILE_CNT > 0}">
|
||||
<a href="javascript:viewBusRegCert('${oemInfo.OBJID}')">
|
||||
<img src="/images/folder_blue.png" height="25px" width="25px" style="cursor:pointer;" title="사업자등록증 보기 (${oemInfo.BUS_REG_FILE_CNT}개)">
|
||||
</a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<a href="javascript:viewBusRegCert('${oemInfo.OBJID}')">
|
||||
<img src="/images/file_empty.png" height="25px" width="25px" style="cursor:pointer;" title="등록된 파일 없음">
|
||||
</a>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
|
||||
@@ -16,7 +16,265 @@
|
||||
self.close();
|
||||
opener.fn_search();
|
||||
});
|
||||
|
||||
// 사업자등록증 파일 목록 로드
|
||||
loadBusRegFile();
|
||||
|
||||
// 파일 선택 시 즉시 업로드 및 뷰어 열기
|
||||
$("#bus_reg_file").change(function(){
|
||||
var fileInput = this;
|
||||
if(fileInput.files.length > 0){
|
||||
// 1개만 허용
|
||||
if(fileInput.files.length > 1){
|
||||
Swal.fire("사업자등록증은 1개만 업로드 가능합니다.");
|
||||
$(this).val("");
|
||||
return;
|
||||
}
|
||||
|
||||
// PDF 파일만 허용
|
||||
var file = fileInput.files[0];
|
||||
if(file.type !== "application/pdf"){
|
||||
Swal.fire("PDF 파일만 업로드 가능합니다.");
|
||||
$(this).val("");
|
||||
return;
|
||||
}
|
||||
|
||||
// 즉시 업로드
|
||||
uploadBusRegFileInstant(file);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// 선택된 파일 미리보기
|
||||
function showSelectedFiles(){
|
||||
var fileInput = $("#bus_reg_file")[0];
|
||||
var files = fileInput.files;
|
||||
|
||||
if(files.length > 0){
|
||||
var selectedHtml = "<div style='color:#495057; font-size:13px; margin-bottom:5px;'><strong>선택된 파일 ("+files.length+"개)</strong> <span style='color:#dc3545; font-size:12px;'>* 저장 버튼을 눌러야 업로드됩니다</span></div>";
|
||||
for(var i = 0; i < files.length; i++){
|
||||
selectedHtml += "<div style='padding:8px; background-color:#fff3cd; border:1px solid #ffc107; border-radius:3px; margin-bottom:5px;'>";
|
||||
selectedHtml += "<span style='color:#856404; font-size:12px; margin-right:8px;'>📄</span>";
|
||||
selectedHtml += "<span style='color:#856404;'>"+files[i].name+"</span>";
|
||||
selectedHtml += "</div>";
|
||||
}
|
||||
|
||||
// 기존 등록된 파일도 함께 표시
|
||||
var targetObjId = $("#objid").val();
|
||||
if(targetObjId){
|
||||
$.ajax({
|
||||
url: "/common/getFileList.do",
|
||||
type: "POST",
|
||||
data: {
|
||||
targetObjId: targetObjId,
|
||||
docType: "BUS_REG_CERT"
|
||||
},
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function(data){
|
||||
if(data && data.length > 0){
|
||||
selectedHtml += "<div style='color:#495057; font-size:13px; margin-top:15px; margin-bottom:5px;'><strong>기존 등록된 파일 ("+data.length+"개)</strong></div>";
|
||||
$.each(data, function(i, file){
|
||||
selectedHtml += "<div style='padding:8px; background-color:#fff; border:1px solid #dee2e6; border-radius:3px; margin-bottom:5px; display:flex; justify-content:space-between; align-items:center;'>";
|
||||
selectedHtml += "<div style='flex:1;'>";
|
||||
selectedHtml += "<span style='color:#6c757d; font-size:12px; margin-right:8px;'>📄</span>";
|
||||
selectedHtml += "<a href='javascript:viewBusRegFile(\""+file.OBJID+"\")' style='color:#0066cc; text-decoration:none;'>"+file.REAL_FILE_NAME+"</a>";
|
||||
selectedHtml += "</div>";
|
||||
selectedHtml += "<a href='javascript:deleteBusRegFile(\""+file.OBJID+"\")' style='color:#dc3545; text-decoration:none; font-size:12px; padding:4px 8px; border:1px solid #dc3545; border-radius:3px;'>삭제</a>";
|
||||
selectedHtml += "</div>";
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$("#busRegFileArea").html(selectedHtml);
|
||||
}else{
|
||||
loadBusRegFile();
|
||||
}
|
||||
}
|
||||
|
||||
// 사업자등록증 즉시 업로드 및 뷰어 열기
|
||||
function uploadBusRegFileInstant(file){
|
||||
var targetObjId = $("#objid").val();
|
||||
if(!targetObjId){
|
||||
Swal.fire("고객 정보를 먼저 저장해주세요.");
|
||||
$("#bus_reg_file").val("");
|
||||
return;
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
title: '업로드 중...',
|
||||
text: '파일을 업로드하고 있습니다.',
|
||||
allowOutsideClick: false,
|
||||
didOpen: () => {
|
||||
Swal.showLoading();
|
||||
}
|
||||
});
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("file1", file);
|
||||
formData.append("targetObjId", targetObjId);
|
||||
formData.append("docType", "BUS_REG_CERT");
|
||||
formData.append("docTypeName", "사업자등록증");
|
||||
|
||||
$.ajax({
|
||||
url: "/common/fileUploadProc.do",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(response){
|
||||
Swal.close();
|
||||
$("#bus_reg_file").val("");
|
||||
|
||||
// 파일 목록 새로고침
|
||||
loadBusRegFile();
|
||||
|
||||
// 업로드 완료 메시지 (자동으로 새 탭 열지 않음)
|
||||
Swal.fire({
|
||||
icon: 'success',
|
||||
title: '업로드 완료',
|
||||
text: '파일이 업로드되었습니다. 파일명을 클릭하면 미리보기할 수 있습니다.',
|
||||
timer: 2000,
|
||||
showConfirmButton: false
|
||||
});
|
||||
|
||||
// 부모 창 새로고침
|
||||
if(opener && typeof opener.fn_search == "function"){
|
||||
opener.fn_search();
|
||||
}
|
||||
if(opener && opener._tabulGrid){
|
||||
opener._tabulGrid.replaceData();
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
Swal.fire("파일 업로드에 실패했습니다.");
|
||||
$("#bus_reg_file").val("");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 사업자등록증 파일 업로드 (저장 시 호출) - 여러 파일 지원
|
||||
function uploadBusRegFile(callback){
|
||||
var fileInput = $("#bus_reg_file")[0];
|
||||
|
||||
// 파일이 선택되지 않았으면 콜백만 실행
|
||||
if(fileInput.files.length == 0){
|
||||
if(callback) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
var files = fileInput.files;
|
||||
var uploadCount = 0;
|
||||
var totalFiles = files.length;
|
||||
|
||||
// 모든 파일이 PDF인지 확인
|
||||
for(var i = 0; i < files.length; i++){
|
||||
var fileName = files[i].name;
|
||||
var fileExt = fileName.substring(fileName.lastIndexOf('.')+1).toLowerCase();
|
||||
if(fileExt != 'pdf'){
|
||||
Swal.fire("PDF 파일만 업로드 가능합니다: " + fileName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 각 파일을 순차적으로 업로드
|
||||
function uploadNext(index){
|
||||
if(index >= totalFiles){
|
||||
// 모든 파일 업로드 완료
|
||||
$("#bus_reg_file").val("");
|
||||
loadBusRegFile();
|
||||
if(callback) callback();
|
||||
return;
|
||||
}
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append("file", files[index]);
|
||||
formData.append("targetObjId", $("#objid").val());
|
||||
formData.append("docType", "BUS_REG_CERT");
|
||||
formData.append("docTypeName", "사업자등록증");
|
||||
|
||||
$.ajax({
|
||||
url: "/common/fileUploadProc.do",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(data){
|
||||
uploadCount++;
|
||||
uploadNext(index + 1); // 다음 파일 업로드
|
||||
},
|
||||
error: function(){
|
||||
Swal.fire("파일 업로드 중 오류가 발생했습니다: " + files[index].name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 첫 번째 파일부터 업로드 시작
|
||||
uploadNext(0);
|
||||
}
|
||||
|
||||
// 사업자등록증 파일 목록 로드
|
||||
function loadBusRegFile(){
|
||||
var targetObjId = $("#objid").val();
|
||||
if(!targetObjId) return;
|
||||
|
||||
$.ajax({
|
||||
url: "/common/getFileList.do",
|
||||
type: "POST",
|
||||
data: {
|
||||
targetObjId: targetObjId,
|
||||
docType: "BUS_REG_CERT"
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
$("#busRegFileArea").empty();
|
||||
if(data && data.length > 0){
|
||||
var fileListHtml = "<div style='color:#495057; font-size:13px; margin-bottom:5px;'><strong>등록된 파일 ("+data.length+"개)</strong> <span style='color:#6c757d; font-size:11px;'>* 파일명 클릭 시 미리보기</span></div>";
|
||||
$.each(data, function(i, file){
|
||||
fileListHtml += "<div style='padding:8px; background-color:#fff; border:1px solid #dee2e6; border-radius:3px; margin-bottom:5px; display:flex; justify-content:space-between; align-items:center;'>";
|
||||
fileListHtml += "<div style='flex:1;'>";
|
||||
fileListHtml += "<span style='color:#6c757d; font-size:12px; margin-right:8px;'>📄</span>";
|
||||
fileListHtml += "<a href='javascript:viewBusRegFile(\""+file.OBJID+"\")' style='color:#0066cc; text-decoration:none; font-weight:500;'>"+file.REAL_FILE_NAME+"</a>";
|
||||
fileListHtml += "<span style='color:#6c757d; font-size:11px; margin-left:8px;'>("+file.REGDATE+")</span>";
|
||||
fileListHtml += "</div>";
|
||||
fileListHtml += "<a href='javascript:deleteBusRegFile(\""+file.OBJID+"\")' style='color:#dc3545; text-decoration:none; font-size:12px; padding:4px 8px; border:1px solid #dc3545; border-radius:3px;'>삭제</a>";
|
||||
fileListHtml += "</div>";
|
||||
});
|
||||
$("#busRegFileArea").html(fileListHtml);
|
||||
}else{
|
||||
$("#busRegFileArea").html("<div style='color:#6c757d; font-size:13px; text-align:center; padding:15px;'>등록된 파일이 없습니다.</div>");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 사업자등록증 파일 보기
|
||||
function viewBusRegFile(fileObjId){
|
||||
window.open("/common/downloadFile.do?objId="+fileObjId, "_blank");
|
||||
}
|
||||
|
||||
// 사업자등록증 파일 삭제
|
||||
function deleteBusRegFile(fileObjId){
|
||||
if(!confirm("파일을 삭제하시겠습니까?")){
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "/common/deleteFile.do",
|
||||
type: "POST",
|
||||
data: {objId: fileObjId},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
Swal.fire("삭제되었습니다.");
|
||||
loadBusRegFile();
|
||||
},
|
||||
error: function(){
|
||||
Swal.fire("삭제 중 오류가 발생했습니다.");
|
||||
}
|
||||
});
|
||||
}
|
||||
function saveOEMInfo(){
|
||||
if(fnc_valitate("oemForm")){
|
||||
|
||||
@@ -36,22 +294,25 @@
|
||||
// 만약 Promise리턴을 받으면,
|
||||
if (result.isConfirmed) { // 만약 모달창에서 confirm 버튼을 눌렀다면
|
||||
|
||||
$.ajax({
|
||||
url:"/contractMgmt/saveSupMgmtInfo.do",
|
||||
type:"POST",
|
||||
data:$("#oemForm").serialize(),
|
||||
dataType:"json",
|
||||
async:true,
|
||||
success:function(data){
|
||||
if(data.result!=''){
|
||||
alert('저장되었습니다');
|
||||
}
|
||||
opener.fn_search();
|
||||
self.close();
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
}
|
||||
});
|
||||
// 먼저 사업자등록증 파일 업로드 후 저장
|
||||
uploadBusRegFile(function(){
|
||||
$.ajax({
|
||||
url:"/contractMgmt/saveSupMgmtInfo.do",
|
||||
type:"POST",
|
||||
data:$("#oemForm").serialize(),
|
||||
dataType:"json",
|
||||
async:true,
|
||||
success:function(data){
|
||||
if(data.result!=''){
|
||||
alert('저장되었습니다');
|
||||
}
|
||||
opener.fn_search();
|
||||
self.close();
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
@@ -148,40 +409,18 @@
|
||||
<col width="35%">
|
||||
</colgroup>
|
||||
<tr>
|
||||
<td class="input_title"><label for="">구분</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="supply_code" id="supply_code" style="" required reqTitle="구분" type="select" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.supply_code}
|
||||
</select>
|
||||
</td>
|
||||
<!-- <td class="input_title"><label for="">구분</label></td> -->
|
||||
<!-- <td class="input_sub_title"> -->
|
||||
<!-- <select name="supply_code" id="supply_code" style="" required reqTitle="구분" type="select" class="select2" autocomplete="off"> -->
|
||||
<!-- <option value="">선택</option> -->
|
||||
<%-- ${code_map.supply_code} --%>
|
||||
<!-- </select> -->
|
||||
<!-- </td> -->
|
||||
|
||||
<td class="input_title"><label for="">고객사명</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="supply_name" id="supply_name" value="${Info.SUPPLY_NAME}" required reqTitle="상호명" maxlength="100">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title"><label for="">지역</label></td>
|
||||
<td class="input_sub_title">
|
||||
<select name="area_cd" id="area_cd" style="" class="select2" required reqTitle="지역" type="select" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${code_map.area_cd}
|
||||
</select>
|
||||
</td>
|
||||
<td class="input_title"><label for="">대표자명</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="charge_user_name" id="charge_user_name" value="${Info.CHARGE_USER_NAME}" required reqTitle="대표자명" maxlength="100">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="input_title"><label for="">실사용자명</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="reg_id" id="reg_id" value="${Info.REG_ID}" required reqTitle="실사용자명" maxlength="100">
|
||||
</td>
|
||||
|
||||
<td class="input_title"><label for="">사업자등록번호</label></td>
|
||||
<td class="input_sub_title">
|
||||
@@ -189,6 +428,25 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<!-- <td class="input_title"><label for="">지역</label></td> -->
|
||||
<!-- <td class="input_sub_title"> -->
|
||||
<!-- <select name="area_cd" id="area_cd" style="" class="select2" required reqTitle="지역" type="select" autocomplete="off"> -->
|
||||
<!-- <option value="">선택</option> -->
|
||||
<%-- ${code_map.area_cd} --%>
|
||||
<!-- </select> -->
|
||||
<!-- </td> -->
|
||||
<td class="input_title"><label for="">대표자명</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="charge_user_name" id="charge_user_name" value="${Info.CHARGE_USER_NAME}" required reqTitle="대표자명" maxlength="100">
|
||||
</td>
|
||||
|
||||
<td class="input_title"><label for="">실사용자명</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="reg_id" id="reg_id" value="${Info.REG_ID}" required reqTitle="실사용자명" maxlength="100">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="input_title"><label for="">법인/주민번호</label></td>
|
||||
@@ -237,6 +495,91 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 담당자 정보 섹션 -->
|
||||
<tr>
|
||||
<td colspan="4" style="padding: 10px 0; background-color: #f5f5f5;">
|
||||
<h4 style="margin: 0; padding-left: 10px;">담당자 정보</h4>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title"><label for="">담당자1</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager1_name" id="manager1_name" value="${Info.MANAGER1_NAME}" maxlength="100" placeholder="이름">
|
||||
</td>
|
||||
<td class="input_title"><label for="">이메일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager1_email" id="manager1_email" value="${Info.MANAGER1_EMAIL}" maxlength="100" placeholder="이메일">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title"><label for="">담당자2</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager2_name" id="manager2_name" value="${Info.MANAGER2_NAME}" maxlength="100" placeholder="이름">
|
||||
</td>
|
||||
<td class="input_title"><label for="">이메일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager2_email" id="manager2_email" value="${Info.MANAGER2_EMAIL}" maxlength="100" placeholder="이메일">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title"><label for="">담당자3</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager3_name" id="manager3_name" value="${Info.MANAGER3_NAME}" maxlength="100" placeholder="이름">
|
||||
</td>
|
||||
<td class="input_title"><label for="">이메일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager3_email" id="manager3_email" value="${Info.MANAGER3_EMAIL}" maxlength="100" placeholder="이메일">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title"><label for="">담당자4</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager4_name" id="manager4_name" value="${Info.MANAGER4_NAME}" maxlength="100" placeholder="이름">
|
||||
</td>
|
||||
<td class="input_title"><label for="">이메일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager4_email" id="manager4_email" value="${Info.MANAGER4_EMAIL}" maxlength="100" placeholder="이메일">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title"><label for="">담당자5</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager5_name" id="manager5_name" value="${Info.MANAGER5_NAME}" maxlength="100" placeholder="이름">
|
||||
</td>
|
||||
<td class="input_title"><label for="">이메일</label></td>
|
||||
<td class="input_sub_title">
|
||||
<input type="text" name="manager5_email" id="manager5_email" value="${Info.MANAGER5_EMAIL}" maxlength="100" placeholder="이메일">
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<!-- 사업자등록증 첨부 섹션 -->
|
||||
<tr>
|
||||
<td colspan="4" style="padding: 10px; background-color: #f8f9fa; border-top: 2px solid #dee2e6;">
|
||||
<strong style="font-size: 14px;">📎 사업자등록증</strong>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="input_title" style="vertical-align: top; padding-top: 15px;"><label for="">파일 선택</label></td>
|
||||
<td colspan="3" class="input_sub_title">
|
||||
<div style="margin-bottom: 8px;">
|
||||
<input type="file" name="bus_reg_file" id="bus_reg_file" accept=".pdf" style="width:100%; max-width:500px;">
|
||||
</div>
|
||||
<div style="color:#6c757d; font-size:12px; margin-bottom: 10px;">
|
||||
💡 PDF 파일 1개만 가능 | 선택 시 자동 업로드 및 미리보기
|
||||
</div>
|
||||
<input type="hidden" name="bus_reg_file_objid" id="bus_reg_file_objid" value="${Info.BUS_REG_FILE_OBJID}">
|
||||
<div id="busRegFileArea" style="margin-top:10px; padding:10px; background-color:#f8f9fa; border-radius:4px; min-height:50px;">
|
||||
<!-- 업로드된 파일 목록 표시 영역 -->
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- <tr>
|
||||
<td><label for="">상태(활성화 여부)</label></td>
|
||||
<td>
|
||||
|
||||
@@ -149,7 +149,7 @@ String connector = person.getUserId();
|
||||
},
|
||||
*/
|
||||
//{headerHozAlign : 'center', hozAlign : 'left', width : '125', title : '모품번', field : 'PARENT_PART_INFO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '200', title : '품번', field : 'PART_NO',
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '250', title : '품번', field : 'PART_NO',
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
@@ -185,11 +185,11 @@ String connector = person.getUserId();
|
||||
fnc_fileDetailPopup(objid, docType, docTypeName);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '재료', field : 'MATERIAL' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '열처리경도', field : 'HEAT_TREATMENT_HARDNESS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '열처리방법', field : 'HEAT_TREATMENT_METHOD' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '표면처리', field : 'SURFACE_TREATMENT' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : '공급업체', field : 'MAKER' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '재료', field : 'MATERIAL' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '열처리경도', field : 'HEAT_TREATMENT_HARDNESS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '열처리방법', field : 'HEAT_TREATMENT_METHOD' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '표면처리', field : 'SURFACE_TREATMENT' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : '메이커', field : 'MAKER' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '범주 이름', field : 'PART_TYPE_TITLE' },
|
||||
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '재질', field : 'MATERIAL' },
|
||||
@@ -198,11 +198,11 @@ String connector = person.getUserId();
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : 'MAKER', field : 'MAKER' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '대분류', field : 'MAJOR_CATEGORY' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '중분류', field : 'SUB_CATEGORY' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'Revision', field : 'REVISION' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO No', field : 'EO_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : 'EO Date', field : 'EO_DATE' },
|
||||
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'Revision', field : 'REVISION' },
|
||||
//{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO No', field : 'EO_NO' },
|
||||
//{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : 'EO Date', field : 'EO_DATE' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '88', title : 'PART구분', field : 'PART_TYPE_TITLE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '비고', field : 'REMARK' }
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '비고', field : 'REMARK' }
|
||||
];
|
||||
|
||||
//var grid;
|
||||
@@ -325,7 +325,7 @@ String connector = person.getUserId();
|
||||
// 파일 분류 및 처리
|
||||
var filesByType = {
|
||||
'3D': [], // stp 파일
|
||||
'2D': [], // dwg 파일
|
||||
'2D': [], // dwg, dxf 파일
|
||||
'PDF': [] // pdf 파일
|
||||
};
|
||||
|
||||
@@ -343,7 +343,7 @@ String connector = person.getUserId();
|
||||
|
||||
if(ext === 'stp' || ext === 'step') {
|
||||
filesByType['3D'].push(file);
|
||||
} else if(ext === 'dwg') {
|
||||
} else if(ext === 'dwg' || ext === 'dxf') {
|
||||
filesByType['2D'].push(file);
|
||||
} else if(ext === 'pdf') {
|
||||
filesByType['PDF'].push(file);
|
||||
@@ -353,14 +353,14 @@ String connector = person.getUserId();
|
||||
// 업로드할 파일이 있는지 확인
|
||||
var totalFiles = filesByType['3D'].length + filesByType['2D'].length + filesByType['PDF'].length;
|
||||
if(totalFiles === 0) {
|
||||
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, pdf만 가능)');
|
||||
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, dxf, pdf만 가능)');
|
||||
return;
|
||||
}
|
||||
|
||||
// 확인 메시지
|
||||
var msg = '총 ' + totalFiles + '개의 파일을 업로드하시겠습니까?\n';
|
||||
msg += '- 3D (STP): ' + filesByType['3D'].length + '개\n';
|
||||
msg += '- 2D (DWG): ' + filesByType['2D'].length + '개\n';
|
||||
msg += '- 2D (DWG/DXF): ' + filesByType['2D'].length + '개\n';
|
||||
msg += '- PDF: ' + filesByType['PDF'].length + '개';
|
||||
|
||||
Swal.fire({
|
||||
@@ -495,7 +495,7 @@ String connector = person.getUserId();
|
||||
<input type="button" value="도면 다중 업로드" class="plm_btns" id="btnDrawingUpload">
|
||||
<input type="button" value="조회" class="plm_btns" id="btnSearch">
|
||||
<input type="button" value="Excel Download" class="plm_btns" id="btnExcel">
|
||||
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.pdf">
|
||||
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.dxf,.pdf">
|
||||
</div>
|
||||
</div>
|
||||
<div id="plmSearchZon">
|
||||
|
||||
@@ -141,7 +141,7 @@ ui-jqgrid tr.jqgrow td {
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '60', title : '순', field : 'RNUM' ,frozen:true},
|
||||
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '125', title : '모품번', field : 'PARENT_PART_INFO' ,frozen:true},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '200', title : '품번', field : 'PART_NO',frozen:true,
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '250', title : '품번', field : 'PART_NO',frozen:true,
|
||||
formatter:fnc_createGridAnchorTag,
|
||||
cellClick:function(e, cell){
|
||||
var objid = fnc_checkNull(cell.getData().OBJID);
|
||||
@@ -177,11 +177,11 @@ ui-jqgrid tr.jqgrow td {
|
||||
fn_FileRegist(objid, docType, docTypeName);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '재료', field : 'MATERIAL' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '열처리경도', field : 'HEAT_TREATMENT_HARDNESS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '열처리방법', field : 'HEAT_TREATMENT_METHOD' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '표면처리', field : 'SURFACE_TREATMENT' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : '공급업체', field : 'MAKER' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '재료', field : 'MATERIAL' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '열처리경도', field : 'HEAT_TREATMENT_HARDNESS' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '열처리방법', field : 'HEAT_TREATMENT_METHOD' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '표면처리', field : 'SURFACE_TREATMENT' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : '메이커', field : 'MAKER' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '범주 이름', field : 'PART_TYPE_TITLE' },
|
||||
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '190', title : '사양(규격)', field : 'SPEC' },
|
||||
@@ -189,11 +189,11 @@ ui-jqgrid tr.jqgrow td {
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'MAKER', field : 'MAKER' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '대분류', field : 'MAJOR_CATEGORY' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '중분류', field : 'SUB_CATEGORY' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'Revision', field : 'REVISION' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO No', field : 'EO_NO' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO Date', field : 'EO_DATE' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'Revision', field : 'REVISION' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO No', field : 'EO_NO' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'EO Date', field : 'EO_DATE' },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '90', title : 'PART 구분', field : 'PART_TYPE_TITLE' },
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '90', title : '비고', field : 'REMARK' }
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '비고', field : 'REMARK' }
|
||||
];
|
||||
|
||||
// 중복 요청 방지 플래그
|
||||
@@ -430,7 +430,7 @@ ui-jqgrid tr.jqgrow td {
|
||||
// 파일 분류 및 처리
|
||||
var filesByType = {
|
||||
'3D': [], // stp 파일
|
||||
'2D': [], // dwg 파일
|
||||
'2D': [], // dwg, dxf 파일
|
||||
'PDF': [] // pdf 파일
|
||||
};
|
||||
|
||||
@@ -448,7 +448,7 @@ ui-jqgrid tr.jqgrow td {
|
||||
|
||||
if(ext === 'stp' || ext === 'step') {
|
||||
filesByType['3D'].push(file);
|
||||
} else if(ext === 'dwg') {
|
||||
} else if(ext === 'dwg' || ext === 'dxf') {
|
||||
filesByType['2D'].push(file);
|
||||
} else if(ext === 'pdf') {
|
||||
filesByType['PDF'].push(file);
|
||||
@@ -458,14 +458,14 @@ ui-jqgrid tr.jqgrow td {
|
||||
// 업로드할 파일이 있는지 확인
|
||||
var totalFiles = filesByType['3D'].length + filesByType['2D'].length + filesByType['PDF'].length;
|
||||
if(totalFiles === 0) {
|
||||
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, pdf만 가능)');
|
||||
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, dxf, pdf만 가능)');
|
||||
return;
|
||||
}
|
||||
|
||||
// 확인 메시지
|
||||
var msg = '총 ' + totalFiles + '개의 파일을 업로드하시겠습니까?\n';
|
||||
msg += '- 3D (STP): ' + filesByType['3D'].length + '개\n';
|
||||
msg += '- 2D (DWG): ' + filesByType['2D'].length + '개\n';
|
||||
msg += '- 2D (DWG/DXF): ' + filesByType['2D'].length + '개\n';
|
||||
msg += '- PDF: ' + filesByType['PDF'].length + '개';
|
||||
|
||||
Swal.fire({
|
||||
@@ -615,7 +615,7 @@ ui-jqgrid tr.jqgrow td {
|
||||
<input type="button" value="등록(Excel Upload)" class="plm_btns" onclick="openExcelPopup();">
|
||||
<input type="button" value="도면 다중 업로드" class="plm_btns" id="btnDrawingUpload">
|
||||
<input type="button" value="조회" class="plm_btns" id="btnSearch">
|
||||
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.pdf">
|
||||
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.dxf,.pdf">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,7 +2,27 @@
|
||||
<%@ page import="com.pms.common.utils.*"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
|
||||
<%@ page import="java.util.*" %>
|
||||
<%@include file= "/init.jsp" %>
|
||||
<%@include file= "/init.jsp" %>
|
||||
<%
|
||||
// 권한 체크: AUTHORITY_MASTER의 OBJID가 41000668인 그룹에 속한 사용자인지 확인
|
||||
boolean hasStatusChangeAuth = false;
|
||||
try {
|
||||
org.apache.ibatis.session.SqlSession sqlSession = com.pms.common.SqlMapConfig.getInstance().getSqlSession();
|
||||
java.util.Map<String, Object> authParam = new java.util.HashMap<String, Object>();
|
||||
authParam.put("userId", connectUserId);
|
||||
authParam.put("masterObjid", "41000668");
|
||||
|
||||
Integer authCount = (Integer)sqlSession.selectOne("common.checkUserAuthority", authParam);
|
||||
hasStatusChangeAuth = (authCount != null && authCount > 0);
|
||||
|
||||
sqlSession.close();
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
%>
|
||||
<script>
|
||||
var hasStatusChangeAuth = <%=hasStatusChangeAuth%>;
|
||||
</script>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
@@ -165,8 +185,8 @@ var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '150', title : 'E-BOM', field : 'BOM_CNT',
|
||||
formatter: fnc_subInfoValueFormatter,
|
||||
cellClick:function(e, cell){
|
||||
var objId = fnc_checkNull(cell.getData().OBJID);
|
||||
//var bomReportObjId = fnc_checkNull(cell.getData().BOM_REPORMECHANICAL_TYPET_OBJID);
|
||||
var objId = fnc_checkNull(cell.getData().OBJID);
|
||||
// 바로 팝업 열기 (팝업창 내부에서 경고 처리)
|
||||
fn_openSetStructure(objId);
|
||||
}
|
||||
},
|
||||
@@ -498,6 +518,16 @@ function fn_openChangeDesignNote(objId){
|
||||
* 상태변경 팝업
|
||||
*/
|
||||
function fn_openStatusChange() {
|
||||
// 권한 체크
|
||||
if(!hasStatusChangeAuth) {
|
||||
Swal.fire({
|
||||
title: '권한 없음',
|
||||
text: '상태변경 권한이 없습니다.',
|
||||
icon: 'error'
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
var selectedStructure = _tabulGrid.getSelectedData();
|
||||
|
||||
if(selectedStructure.length == 0){
|
||||
@@ -512,8 +542,33 @@ function fn_openStatusChange() {
|
||||
|
||||
var selectedData = selectedStructure[0];
|
||||
var objId = fnc_checkNull(selectedData.OBJID);
|
||||
var partNo = fnc_checkNull(selectedData.PART_NO);
|
||||
var partName = fnc_checkNull(selectedData.PART_NAME);
|
||||
var currentStatus = fnc_checkNull(selectedData.STATUS);
|
||||
|
||||
window.open("/partMng/structureStatusChangePopup.do?objId=" + objId, "structureStatusChangePopup", "width=500, height=300, resizable=no");
|
||||
// 현재 상태 표시용 텍스트 (Y/N만 존재)
|
||||
var statusText = (currentStatus === 'Y') ? 'Y' : 'N';
|
||||
|
||||
// 상태변경 확인 경고
|
||||
Swal.fire({
|
||||
title: 'E-BOM 상태 변경',
|
||||
html: 'E-BOM의 상태변경을 진행하시겠습니까?<br><br>' +
|
||||
'<strong>품번:</strong> ' + partNo + '<br>' +
|
||||
'<strong>품명:</strong> ' + partName + '<br>' +
|
||||
'<strong>현재 상태:</strong> ' + statusText + '<br><br>' +
|
||||
'상태를 변경하시겠습니까?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '상태변경',
|
||||
cancelButtonText: '취소',
|
||||
reverseButtons: false
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
window.open("/partMng/structureStatusChangePopup.do?objId=" + objId, "structureStatusChangePopup", "width=500, height=300, resizable=no");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveexcelpop() {
|
||||
@@ -552,21 +607,40 @@ function saveexcelpop() {
|
||||
BOM_VERSION = fnc_checkNull(selectedStructure[i].REVISION);
|
||||
}
|
||||
|
||||
// hiddenForm을 사용하여 POST 방식으로 팝업 열기 (한글 인코딩 문제 해결)
|
||||
var hiddenForm = document.hiddenForm;
|
||||
var url = "/partMng/openBomReportExcelImportPopUp.do";
|
||||
var target = "openBomReportExcelImportPopUp";
|
||||
|
||||
hiddenForm.PRODUCT_CD.value = BOM_PRODUCT_CD;
|
||||
hiddenForm.BOM_PART_NAME.value = BOM_PART_NAME;
|
||||
hiddenForm.BOM_PART_NO.value = BOM_PART_NO;
|
||||
hiddenForm.BOM_REPORT_OBJID.value = BOM_REPORT_OBJID;
|
||||
hiddenForm.BOM_VERSION.value = BOM_VERSION;
|
||||
|
||||
window.open('', target, 'width=1920, height=860, menubars=no, scrollbars=yes, resizable=yes');
|
||||
hiddenForm.action = url;
|
||||
hiddenForm.target = target;
|
||||
hiddenForm.submit();
|
||||
// CSV 업로드 확인 경고
|
||||
Swal.fire({
|
||||
title: 'E-BOM CSV 업로드',
|
||||
html: 'CSV 파일을 통해 E-BOM 데이터를 새로 등록합니다.<br><br>' +
|
||||
'<strong>품번:</strong> ' + BOM_PART_NO + '<br>' +
|
||||
'<strong>품명:</strong> ' + BOM_PART_NAME + '<br>' +
|
||||
'<strong>버전:</strong> ' + BOM_VERSION + '<br><br>' +
|
||||
'계속하시겠습니까?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '계속',
|
||||
cancelButtonText: '취소',
|
||||
reverseButtons: false
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
// hiddenForm을 사용하여 POST 방식으로 팝업 열기 (한글 인코딩 문제 해결)
|
||||
var hiddenForm = document.hiddenForm;
|
||||
var url = "/partMng/openBomReportExcelImportPopUp.do";
|
||||
var target = "openBomReportExcelImportPopUp";
|
||||
|
||||
hiddenForm.PRODUCT_CD.value = BOM_PRODUCT_CD;
|
||||
hiddenForm.BOM_PART_NAME.value = BOM_PART_NAME;
|
||||
hiddenForm.BOM_PART_NO.value = BOM_PART_NO;
|
||||
hiddenForm.BOM_REPORT_OBJID.value = BOM_REPORT_OBJID;
|
||||
hiddenForm.BOM_VERSION.value = BOM_VERSION;
|
||||
|
||||
window.open('', target, 'width=1920, height=860, menubars=no, scrollbars=yes, resizable=yes');
|
||||
hiddenForm.action = url;
|
||||
hiddenForm.target = target;
|
||||
hiddenForm.submit();
|
||||
}
|
||||
});
|
||||
}
|
||||
}else{
|
||||
if($("#customer_cd").val()==""){
|
||||
|
||||
@@ -6,8 +6,34 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<title><%=Constants.SYSTEM_NAME%></title>
|
||||
<title><%=Constants.SYSTEM_NAME%></title>
|
||||
|
||||
<script>
|
||||
// confirm/alert 헬퍼 함수
|
||||
function showConfirm(options) {
|
||||
if(typeof options === 'string') {
|
||||
alert(options);
|
||||
return Promise.resolve({isConfirmed: true});
|
||||
}
|
||||
|
||||
var message = '';
|
||||
if(options.title) message += options.title + '\n\n';
|
||||
if(options.html) {
|
||||
// HTML 태그 제거
|
||||
message += options.html.replace(/<br\s*\/?>/gi, '\n').replace(/<[^>]+>/g, '');
|
||||
} else if(options.text) {
|
||||
message += options.text;
|
||||
}
|
||||
|
||||
if(options.showCancelButton !== false && (options.icon === 'warning' || options.icon === 'question')) {
|
||||
var result = confirm(message);
|
||||
return Promise.resolve({isConfirmed: result});
|
||||
} else {
|
||||
alert(message);
|
||||
return Promise.resolve({isConfirmed: true});
|
||||
}
|
||||
}
|
||||
|
||||
$(function(){
|
||||
|
||||
$('.select2').select2();
|
||||
@@ -19,7 +45,7 @@ $(function(){
|
||||
var rightSelectedRows = rightFrame.getSelectedRows ? rightFrame.getSelectedRows() : [];
|
||||
|
||||
if(rightSelectedRows.length === 0) {
|
||||
alert("선택된 파트가 없습니다.");
|
||||
showConfirm("선택된 파트가 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -50,7 +76,11 @@ $(function(){
|
||||
var rowData = rightSelectedRows[i].getData();
|
||||
var rightPartNo = rowData.PART_NO;
|
||||
if(rightPartNo == leftPartNo){
|
||||
alert("오류 Part No : ["+rightPartNo+"]\n같은 Part No끼리 연결할 수 없습니다.");
|
||||
showConfirm({
|
||||
title: '연결 불가',
|
||||
html: '오류 Part No : <strong>['+rightPartNo+']</strong><br>같은 Part No끼리 연결할 수 없습니다.',
|
||||
icon: 'error'
|
||||
});
|
||||
isSamePart = true;
|
||||
break;
|
||||
}
|
||||
@@ -73,7 +103,11 @@ $(function(){
|
||||
if("unique" == rightPartType){
|
||||
for(var j = 0 ; j < deniedPartArr.length ; j++){
|
||||
if(rightPartNo == deniedPartArr[j]){
|
||||
alert("오류 Part No : "+"["+rightPartNo+"]\n이미 상위에 등록된 Part No 입니다.");
|
||||
showConfirm({
|
||||
title: '연결 불가',
|
||||
html: '오류 Part No : <strong>['+rightPartNo+']</strong><br>이미 상위에 등록된 Part No 입니다.',
|
||||
icon: 'error'
|
||||
});
|
||||
isDeniedPart = true;
|
||||
break;
|
||||
}
|
||||
@@ -94,12 +128,31 @@ $(function(){
|
||||
if(fnc_checkNull(leftPartNo) == ""){
|
||||
var flag = fn_checkSameTopPartNo(rightCheckedArr);
|
||||
if(flag == "true"){
|
||||
alert("1레벨에 같은 Part No가 중복 등록될 수 없습니다.");
|
||||
showConfirm({
|
||||
title: '중복 등록 불가',
|
||||
text: '1레벨에 같은 Part No가 중복 등록될 수 없습니다.',
|
||||
icon: 'error'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fn_relatePartInfo(leftPartChildObjId, rightCheckedArr, leftPartNoQty, leftPartLastObjId, leftPartChildObjId, leftQtyParObjId);
|
||||
// Part 연결 확인
|
||||
showConfirm({
|
||||
title: 'Part 연결',
|
||||
text: '선택한 Part를 연결하시겠습니까?',
|
||||
icon: 'question',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '연결',
|
||||
cancelButtonText: '취소',
|
||||
reverseButtons: false
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
fn_relatePartInfo(leftPartChildObjId, rightCheckedArr, leftPartNoQty, leftPartLastObjId, leftPartChildObjId, leftQtyParObjId);
|
||||
}
|
||||
});
|
||||
});
|
||||
//end of Part 연결
|
||||
|
||||
@@ -121,12 +174,12 @@ $(function(){
|
||||
var leftPartNoList = $("input[name=checkedPartNo]:checked", parent.frames['leftFrame'].document);
|
||||
|
||||
if(leftPartNoList.length === 0){
|
||||
alert("선택된 파트가 없습니다.");
|
||||
showConfirm("선택된 파트가 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(leftPartNoList.length > 1){
|
||||
alert("한번에 1개의 파트만 변경가능합니다.");
|
||||
showConfirm("한번에 1개의 파트만 변경가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -141,12 +194,12 @@ $(function(){
|
||||
var rightSelectedRows = rightFrame.getSelectedRows ? rightFrame.getSelectedRows() : [];
|
||||
|
||||
if(rightSelectedRows.length === 0){
|
||||
alert("선택된 파트가 없습니다.");
|
||||
showConfirm("선택된 파트가 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(rightSelectedRows.length > 1){
|
||||
alert("한번에 1개의 파트만 변경가능합니다.");
|
||||
showConfirm("한번에 1개의 파트만 변경가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -155,7 +208,24 @@ $(function(){
|
||||
var rightPartRev = rightRowData.REVISION || "";
|
||||
var rightObjId = rightRowData.OBJID;
|
||||
|
||||
fn_changeRelatePartInfo(leftPartBomQtyObjId, rightObjId, leftPartChildObjId, leftParentPartObjid, leftPartChildObjId, leftPartObjid, rightPartNo, rightPartRev);
|
||||
// Part 변경 확인
|
||||
showConfirm({
|
||||
title: 'Part 변경',
|
||||
html: '선택한 Part를 변경하시겠습니까?<br><br>' +
|
||||
'<strong>기존:</strong> ' + leftPartNo + '<br>' +
|
||||
'<strong>변경:</strong> ' + rightPartNo,
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '변경',
|
||||
cancelButtonText: '취소',
|
||||
reverseButtons: false
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
fn_changeRelatePartInfo(leftPartBomQtyObjId, rightObjId, leftPartChildObjId, leftParentPartObjid, leftPartChildObjId, leftPartObjid, rightPartNo, rightPartRev);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -187,11 +257,29 @@ function fn_checkSameTopPartNo(rightCheckedArr){
|
||||
//구조 연결 해제
|
||||
function fn_deletePartRelateInfo(leftObjId, leftPartLastObjId, leftParentPartNo, leftParentObjId, leftPartChildObjId){
|
||||
if(leftObjId == null){
|
||||
alert("연결 해제할 Part를 선택해 주시기 바랍니다.")
|
||||
showConfirm("연결 해제할 Part를 선택해 주시기 바랍니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(!confirm("연결 해제하시겠습니까?")) return;
|
||||
showConfirm({
|
||||
title: 'Part 연결 해제',
|
||||
text: '선택한 Part의 연결을 해제하시겠습니까?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '연결 해제',
|
||||
cancelButtonText: '취소',
|
||||
reverseButtons: false
|
||||
}).then(result => {
|
||||
if (!result.isConfirmed) return;
|
||||
|
||||
fn_executeDeletePartRelateInfo(leftObjId, leftPartLastObjId, leftParentPartNo, leftParentObjId, leftPartChildObjId);
|
||||
});
|
||||
}
|
||||
|
||||
// 실제 Part 연결 해제 실행 함수
|
||||
function fn_executeDeletePartRelateInfo(leftObjId, leftPartLastObjId, leftParentPartNo, leftParentObjId, leftPartChildObjId){
|
||||
|
||||
$.ajax({
|
||||
url: "/partMng/deleteStatusPartRelateInfo.do",
|
||||
@@ -222,16 +310,35 @@ function fn_deletePartRelateInfo(leftObjId, leftPartLastObjId, leftParentPartNo,
|
||||
//구조 연결
|
||||
function fn_relatePartInfo(leftObjId, rightCheckedArr, leftPartNoQty, leftPartLastObjId, leftPartChildObjId, leftQtyParObjId){
|
||||
if(typeof rightCheckedArr != "undefined" && rightCheckedArr.length == 0){
|
||||
alert("선택된 Part가 없습니다.");
|
||||
showConfirm("선택된 Part가 없습니다.");
|
||||
return;
|
||||
}
|
||||
|
||||
if(leftObjId == null){
|
||||
if(!confirm("좌측에 선택된 Part정보가 없습니다.\n이대로 연결하면 1레벨로 등록됩니다.\n진행하시겠습니까?")){
|
||||
return;
|
||||
}
|
||||
showConfirm({
|
||||
title: '1레벨 등록 확인',
|
||||
html: '좌측에 선택된 Part정보가 없습니다.<br>이대로 연결하면 1레벨로 등록됩니다.<br><br>진행하시겠습니까?',
|
||||
icon: 'warning',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '진행',
|
||||
cancelButtonText: '취소',
|
||||
reverseButtons: false
|
||||
}).then(result => {
|
||||
if (result.isConfirmed) {
|
||||
fn_executeRelatePartInfo(leftObjId, rightCheckedArr, leftPartNoQty, leftPartLastObjId, leftPartChildObjId, leftQtyParObjId);
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
fn_executeRelatePartInfo(leftObjId, rightCheckedArr, leftPartNoQty, leftPartLastObjId, leftPartChildObjId, leftQtyParObjId);
|
||||
}
|
||||
|
||||
// 실제 Part 연결 실행 함수
|
||||
function fn_executeRelatePartInfo(leftObjId, rightCheckedArr, leftPartNoQty, leftPartLastObjId, leftPartChildObjId, leftQtyParObjId){
|
||||
|
||||
$.ajax({
|
||||
url: "/partMng/relatePartInfo.do",
|
||||
method: 'post',
|
||||
|
||||
@@ -438,7 +438,7 @@ function fn_uploadDrawingFiles(files) {
|
||||
// 파일 분류 및 처리
|
||||
var filesByType = {
|
||||
'3D': [], // stp 파일
|
||||
'2D': [], // dwg 파일
|
||||
'2D': [], // dwg, dxf 파일
|
||||
'PDF': [] // pdf 파일
|
||||
};
|
||||
|
||||
@@ -458,24 +458,24 @@ function fn_uploadDrawingFiles(files) {
|
||||
|
||||
if(ext === 'stp' || ext === 'step') {
|
||||
filesByType['3D'].push(file);
|
||||
} else if(ext === 'dwg') {
|
||||
} else if(ext === 'dwg' || ext === 'dxf') {
|
||||
filesByType['2D'].push(file);
|
||||
} else if(ext === 'pdf') {
|
||||
filesByType['PDF'].push(file);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 업로드할 파일이 있는지 확인
|
||||
var totalFiles = filesByType['3D'].length + filesByType['2D'].length + filesByType['PDF'].length;
|
||||
if(totalFiles === 0) {
|
||||
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, pdf만 가능)');
|
||||
Swal.fire('업로드 가능한 파일 형식이 없습니다. (stp, dwg, dxf, pdf만 가능)');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// 확인 메시지
|
||||
var msg = '총 ' + totalFiles + '개의 파일을 업로드하시겠습니까?\n';
|
||||
msg += '- 3D (STP): ' + filesByType['3D'].length + '개\n';
|
||||
msg += '- 2D (DWG): ' + filesByType['2D'].length + '개\n';
|
||||
msg += '- 2D (DWG/DXF): ' + filesByType['2D'].length + '개\n';
|
||||
msg += '- PDF: ' + filesByType['PDF'].length + '개';
|
||||
|
||||
Swal.fire({
|
||||
@@ -597,7 +597,7 @@ function fn_processDrawingUpload(bomObjId, filesByType) {
|
||||
</span>
|
||||
<input type="button" value="Excel Download" class="plm_btns structure_btn" id="btnExcel" style="float:right;">
|
||||
<input type="button" value="도면 다중 업로드" class="plm_btns structure_btn" id="btnDrawingUpload" style="float:right; margin-right:5px;">
|
||||
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.pdf">
|
||||
<input type="file" id="drawingFiles" multiple style="display:none;" accept=".stp,.step,.dwg,.dxf,.pdf">
|
||||
</div>
|
||||
<div id="structureGrid"></div>
|
||||
</div>
|
||||
|
||||
@@ -53,61 +53,129 @@
|
||||
fn_search();
|
||||
});
|
||||
|
||||
$("#btnDeadline").click(function(){
|
||||
var targetObj = _tabulGrid.getSelectedData();
|
||||
|
||||
if(1 == targetObj.length){
|
||||
var OBJID = fnc_checkNull(targetObj[0].OBJID);
|
||||
var status = fnc_checkNull(targetObj[0].SALES_STATUS);
|
||||
//var settleAmount = fnc_checkNull(targetObj[0].SETTLE_AMOUNT);
|
||||
$("#btnDeadline").click(function(){
|
||||
var targetObj = _tabulGrid.getSelectedData();
|
||||
|
||||
if(0 == targetObj.length){
|
||||
Swal.fire("선택된 내용이 없습니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(status == '' || status == null || status == '매출마감'){
|
||||
Swal.fire({
|
||||
title: '선택된 데이터를 매출마감 처리하시겠습니까?',
|
||||
text: '',
|
||||
icon: 'warning',
|
||||
|
||||
showCancelButton: true, // cancel버튼 보이기. 기본은 원래 없음
|
||||
confirmButtonColor: '#3085d6', // confrim 버튼 색깔 지정
|
||||
cancelButtonColor: '#d33', // cancel 버튼 색깔 지정
|
||||
confirmButtonText: '확인', // confirm 버튼 텍스트 지정
|
||||
cancelButtonText: '취소', // cancel 버튼 텍스트 지정
|
||||
reverseButtons: false, // 버튼 순서 거꾸로
|
||||
|
||||
}).then(result => {
|
||||
// 만약 Promise리턴을 받으면,
|
||||
if (result.isConfirmed) { // 만약 모달창에서 confirm 버튼을 눌렀다면
|
||||
$.ajax({
|
||||
url:"/salesNcollectMgmt/salesDeadlineConfirm.do",
|
||||
type:"POST",
|
||||
data: {"OBJID" : OBJID},
|
||||
dataType:"json",
|
||||
success:function(data){
|
||||
Swal.fire(data.msg);
|
||||
fn_search();
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}else{
|
||||
alert("매출마감 전 데이터만 매출마감 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
//var productGroup = fnc_checkNull(targetObj[0].PRODUCT_GROUP);
|
||||
//var product = fnc_checkNull(targetObj[0].PRODUCT);
|
||||
//var releaseObjId = fnc_checkNull(targetObj[0].RELEASE_OBJID);
|
||||
}else if(0 == targetObj.length){
|
||||
Swal.fire("선택된 내용이 없습니다.");
|
||||
return false;
|
||||
}else if(1 < targetObj.length){
|
||||
Swal.fire("한번에 1개의 내용만 등록 가능합니다. ");
|
||||
// 선택된 항목 중 이미 매출마감된 항목이 있는지 체크
|
||||
var hasCompletedItem = false;
|
||||
for(var i = 0; i < targetObj.length; i++){
|
||||
var status = fnc_checkNull(targetObj[i].SALES_STATUS);
|
||||
if(status == '완료'){
|
||||
hasCompletedItem = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(hasCompletedItem){
|
||||
Swal.fire("매출마감 전 데이터만 매출마감 가능합니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 매출마감일 입력 팝업
|
||||
Swal.fire({
|
||||
title: '매출마감 처리',
|
||||
html:
|
||||
'<div style="text-align:left; padding:10px;">' +
|
||||
'<label style="display:block; margin-bottom:5px;">세금계산서 발행일 (매출마감일)</label>' +
|
||||
'<input type="text" id="deadlineDate" class="swal2-input" placeholder="YYYY-MM-DD" style="width:90%; margin:0;">' +
|
||||
'<div style="margin-top:10px; color:#666; font-size:12px;">선택된 ' + targetObj.length + '건의 데이터를 매출마감 처리합니다.</div>' +
|
||||
'</div>',
|
||||
icon: 'info',
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: '#3085d6',
|
||||
cancelButtonColor: '#d33',
|
||||
confirmButtonText: '확인',
|
||||
cancelButtonText: '취소',
|
||||
onOpen: function() {
|
||||
// datepicker 초기화
|
||||
$('#deadlineDate').datepicker({
|
||||
dateFormat: 'yy-mm-dd',
|
||||
changeMonth: true,
|
||||
changeYear: true
|
||||
});
|
||||
// 오늘 날짜를 기본값으로 설정
|
||||
var today = new Date();
|
||||
var dateStr = today.getFullYear() + '-' +
|
||||
String(today.getMonth() + 1).padStart(2, '0') + '-' +
|
||||
String(today.getDate()).padStart(2, '0');
|
||||
$('#deadlineDate').val(dateStr);
|
||||
},
|
||||
preConfirm: function() {
|
||||
const deadlineDate = $('#deadlineDate').val();
|
||||
if (!deadlineDate) {
|
||||
Swal.showValidationMessage('매출마감일을 입력해주세요.');
|
||||
return false;
|
||||
}
|
||||
//fn_confirm();
|
||||
// 날짜 형식 검증 (YYYY-MM-DD)
|
||||
var datePattern = /^\d{4}-\d{2}-\d{2}$/;
|
||||
if (!datePattern.test(deadlineDate)) {
|
||||
Swal.showValidationMessage('날짜 형식이 올바르지 않습니다. (YYYY-MM-DD)');
|
||||
return false;
|
||||
}
|
||||
return deadlineDate;
|
||||
}
|
||||
}).then(function(result) {
|
||||
if (result.isConfirmed) {
|
||||
var deadlineDate = result.value;
|
||||
var objIdList = [];
|
||||
|
||||
// 선택된 항목들의 OBJID 수집
|
||||
for(var i = 0; i < targetObj.length; i++){
|
||||
objIdList.push(fnc_checkNull(targetObj[i].OBJID));
|
||||
}
|
||||
|
||||
// AJAX 요청
|
||||
console.log('매출마감 요청 - objIdList:', objIdList);
|
||||
console.log('매출마감 요청 - deadlineDate:', deadlineDate);
|
||||
console.log('매출마감 요청 - 전송 데이터:', {
|
||||
objIdList: objIdList.join(','),
|
||||
deadlineDate: deadlineDate
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: "/salesNcollectMgmt/salesDeadlineConfirm.do",
|
||||
type: "POST",
|
||||
data: {
|
||||
"objIdList": objIdList.join(','),
|
||||
"deadlineDate": deadlineDate
|
||||
},
|
||||
dataType: "json",
|
||||
success: function(data){
|
||||
console.log('매출마감 응답 - result:', data.result);
|
||||
console.log('매출마감 응답 - msg:', data.msg);
|
||||
console.log('매출마감 응답 - 전체:', JSON.stringify(data));
|
||||
|
||||
Swal.fire({
|
||||
title: data.msg || '처리되었습니다.',
|
||||
icon: data.result ? 'success' : 'error'
|
||||
}).then(() => {
|
||||
if(data.result) {
|
||||
fn_search();
|
||||
}
|
||||
});
|
||||
},
|
||||
error: function(jqxhr, status, error){
|
||||
console.error('매출마감 AJAX 에러 - status:', status);
|
||||
console.error('매출마감 AJAX 에러 - error:', error);
|
||||
console.error('매출마감 AJAX 에러 - responseText:', jqxhr.responseText);
|
||||
console.error('매출마감 AJAX 에러 - statusText:', jqxhr.statusText);
|
||||
|
||||
Swal.fire({
|
||||
title: '매출마감 처리 중 오류가 발생했습니다.',
|
||||
text: error || jqxhr.statusText || '서버 오류',
|
||||
icon: 'error'
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
fn_search();
|
||||
});
|
||||
</script>
|
||||
@@ -115,69 +183,53 @@
|
||||
<script type="text/javascript">
|
||||
|
||||
var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true
|
||||
// formatter: fnc_createGridAnchorTag,
|
||||
// cellClick: function(e, cell){
|
||||
// var rowData = cell.getData();
|
||||
// var popup_width = 600;
|
||||
// var popup_height = 400;
|
||||
// var url = "/salesMgmt/salesRegForm.do?orderNo=" + rowData.PROJECT_NO + "&saleNo=" + (rowData.SALE_NO || '');
|
||||
// fn_centerPopup(popup_width, popup_height, url);
|
||||
// }
|
||||
},
|
||||
{formatter:"rowSelection", titleFormatter:"rowSelection", hozAlign:"center", headerSort:false, width:40, frozen:true},
|
||||
// 요청된 열 순서: 프로젝트번호, 주문유형, 매출 마감, 발주일, 발주번호, 고객사, 제품구분, 품명, 수량, 단가, 공급가액, 부가세, 총액, 원화총액, 출고일, 국내/해외, 환종, 환율, S/N, 품번
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문유형', field : 'ORDER_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '제품구분', field : 'PRODUCT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '국내/해외', field : 'NATION'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PRODUCT_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주수량', field : 'ORDER_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '매출마감', field : 'SALES_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH',
|
||||
formatter: fnc_subInfoValueFormatter,
|
||||
cellClick: function(e, cell){
|
||||
var objid = cell.getData().PROJECT_NO || cell.getData().SALE_NO;
|
||||
if(objid){
|
||||
fn_FileRegist(objid, "ORDER_DOC", "주문서");
|
||||
}
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매수량', field : 'SALES_QUANTITY',
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '제품구분', field : 'PRODUCT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PRODUCT_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수량', field : 'SALES_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매단가', field : 'SALES_UNIT_PRICE',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '단가', field : 'SALES_UNIT_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매공급가액', field : 'SALES_SUPPLY_PRICE',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '공급가액', field : 'SALES_SUPPLY_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매부가세', field : 'SALES_VAT',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '부가세', field : 'SALES_VAT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매총액', field : 'SALES_TOTAL_AMOUNT',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '총액', field : 'SALES_TOTAL_AMOUNT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매원화총액', field : 'SALES_TOTAL_AMOUNT_KRW',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '원화총액', field : 'SALES_TOTAL_AMOUNT_KRW',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '판매환종', field : 'SALES_CURRENCY_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매환율', field : 'SALES_EXCHANGE_RATE',
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출고일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '국내/해외', field : 'NATION'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'SALES_CURRENCY_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '환율', field : 'SALES_EXCHANGE_RATE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: 2}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하방법', field : 'SHIPPING_METHOD'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '담당자', field : 'MANAGER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '매출마감현황', field : 'SALES_STATUS'}
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'}
|
||||
// 주석처리된 컬럼들 (필요없는 항목)
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주수량', field : 'ORDER_QUANTITY'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하방법', field : 'SHIPPING_METHOD'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '담당자', field : 'MANAGER'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'}
|
||||
];
|
||||
|
||||
function fn_search(){
|
||||
@@ -197,16 +249,37 @@ function fn_search(){
|
||||
// 그리드 데이터 설정
|
||||
if(_tabulGrid){
|
||||
_tabulGrid.setData(response.RESULTLIST || []);
|
||||
} else {
|
||||
// 그리드 초기화
|
||||
_tabulGrid = new Tabulator("#mainGrid", {
|
||||
layout: _tabul_layout_fitColumns,
|
||||
columns: columns,
|
||||
data: response.RESULTLIST || []
|
||||
});
|
||||
// 그리드 초기화 후 Excel 버튼 이벤트 등록
|
||||
fn_bindExcelButton();
|
||||
}
|
||||
} else {
|
||||
// 그리드 초기화
|
||||
_tabulGrid = new Tabulator("#mainGrid", {
|
||||
layout: _tabul_layout_fitColumns,
|
||||
columns: columns,
|
||||
data: response.RESULTLIST || [],
|
||||
selectable: "highlight" // 다중 선택 가능하도록 설정
|
||||
});
|
||||
|
||||
// 행 클릭으로 다중 선택
|
||||
_tabulGrid.on("rowClick", function(e, row){
|
||||
// 체크박스나 체크박스 셀을 클릭한 경우는 제외
|
||||
if($(e.target).hasClass('tabulator-row-handle') ||
|
||||
$(e.target).closest('.tabulator-row-handle').length > 0 ||
|
||||
e.target.type === 'checkbox') {
|
||||
return;
|
||||
}
|
||||
|
||||
// 이미 선택된 행인지 확인
|
||||
if(row.isSelected()){
|
||||
// 선택된 행 클릭 시 해제
|
||||
row.deselect();
|
||||
} else {
|
||||
// 선택되지 않은 행 클릭 시 선택 (기존 선택 유지)
|
||||
row.select();
|
||||
}
|
||||
});
|
||||
|
||||
// 그리드 초기화 후 Excel 버튼 이벤트 등록
|
||||
fn_bindExcelButton();
|
||||
}
|
||||
|
||||
// Total 합계 업데이트
|
||||
if(response && response.TOTALS){
|
||||
@@ -356,30 +429,13 @@ function fn_FileRegist(objId, docType, docTypeName){
|
||||
</div>
|
||||
<div id="plmSearchZon">
|
||||
<table>
|
||||
|
||||
<!-- 요청된 검색필터: 주문유형, 발주번호, 고객사, 제품구분, 품번, 품명, 국내/해외, S/N, 매출마감(기간), 발주일(기간), 출고일(기간) -->
|
||||
<tr>
|
||||
<td class="label"><label for="">주문유형</label></td>
|
||||
<td><select name="orderType" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.orderTypeList}</select></td>
|
||||
|
||||
<td class="label"><label for="">제품구분</label></td>
|
||||
<td><select name="productType" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.productTypeList}</select></td>
|
||||
|
||||
<td class="label"><label for="">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="nation" class="select2" style="width:150px;">
|
||||
<option value="">선택</option>
|
||||
${codeMap.nationList}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="label"><label for="">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paymentType" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="N">유상</option>
|
||||
<option value="Y">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
<td class="label"><label for="">발주번호</label></td>
|
||||
<td><input type="text" name="poNo" /></td>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
@@ -389,6 +445,9 @@ function fn_FileRegist(objId, docType, docTypeName){
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="label"><label for="">제품구분</label></td>
|
||||
<td><select name="productType" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.productTypeList}</select></td>
|
||||
|
||||
<td class="align_r">
|
||||
<label for="" class="">품번</label>
|
||||
</td>
|
||||
@@ -408,15 +467,44 @@ function fn_FileRegist(objId, docType, docTypeName){
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="label"><label for="">국내/해외</label></td>
|
||||
<td>
|
||||
<select name="nation" class="select2" style="width:150px;">
|
||||
<option value="">전체</option>
|
||||
${codeMap.nationList}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="label"><label for="">S/N</label></td>
|
||||
<td><input type="text" name="serialNo" /></td>
|
||||
|
||||
<td class="label"><label for="">매출마감</label></td>
|
||||
<td colspan="3"><input type="text" name="salesDeadlineFrom" class="date_icon" placeholder="시작일"/> ~ <input type="text" name="salesDeadlineTo" class="date_icon" placeholder="종료일"/></td>
|
||||
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="11"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
|
||||
</tr>
|
||||
|
||||
<!-- 주석처리된 필터들 (필요없는 항목) -->
|
||||
<!--
|
||||
<tr>
|
||||
<td class="label"><label for="">유/무상</label></td>
|
||||
<td>
|
||||
<select name="paymentType" class="select2" style="width:120px;">
|
||||
<option value="">전체</option>
|
||||
<option value="N">유상</option>
|
||||
<option value="Y">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="label"><label for="">수주상태</label></td>
|
||||
<td><select name="orderStatus" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.orderStatusList}</select></td>
|
||||
|
||||
<td class="label"><label for="">발주번호</label></td>
|
||||
<td><input type="text" name="poNo" /></td>
|
||||
|
||||
<td class="label"><label for="">담당자</label></td>
|
||||
<td><select name="manager" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.managerList}</select></td>
|
||||
@@ -434,6 +522,7 @@ function fn_FileRegist(objId, docType, docTypeName){
|
||||
|
||||
<td class="label"><label for="">출하대기 상태</label></td>
|
||||
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
|
||||
|
||||
<td class="label"><label for="">출고방법</label></td>
|
||||
<td>
|
||||
<select name="shippingMethod" class="select2" style="width:150px;">
|
||||
@@ -442,18 +531,11 @@ function fn_FileRegist(objId, docType, docTypeName){
|
||||
<option value="PARCEL">택배</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="label"><label for="">요청납기</label></td>
|
||||
<td colspan="3"><input type="text" name="requestDateFrom" class="date_icon"/> ~ <input type="text" name="requestDateTo" class="date_icon"/></td>
|
||||
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="3"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
|
||||
</tr>
|
||||
-->
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -14,10 +14,27 @@
|
||||
<title><%=Constants.SYSTEM_NAME%></title>
|
||||
|
||||
<script>
|
||||
// Excel 버튼 이벤트 등록 함수
|
||||
function fn_bindExcelButton() {
|
||||
setTimeout(function() {
|
||||
$('.excelBtn').off('click').on('click', function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
fn_excel();
|
||||
return false;
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
_fnc_datepick(); // 날짜 선택기 초기화
|
||||
$('.select2').select2(); // select2 초기화
|
||||
|
||||
// 품번/품명 Select2 AJAX 초기화
|
||||
initPartSelect2Ajax("#search_partNo", "#search_partName", "#search_partObjId", {
|
||||
debug: true
|
||||
});
|
||||
|
||||
// 엔터키로 조회
|
||||
$("input").keyup(function(e){
|
||||
if(e.keyCode == 13){
|
||||
@@ -49,6 +66,56 @@
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// 엑셀 다운로드 실행 중 플래그
|
||||
var isExcelDownloading = false;
|
||||
|
||||
function fn_excel() {
|
||||
// 중복 실행 방지
|
||||
if(isExcelDownloading) {
|
||||
console.log("엑셀 다운로드가 이미 진행 중입니다.");
|
||||
return false;
|
||||
}
|
||||
|
||||
isExcelDownloading = true;
|
||||
|
||||
try {
|
||||
// 현재 그리드 데이터 백업
|
||||
var currentData = _tabulGrid.getData();
|
||||
|
||||
// 엑셀용 데이터 가공: 출하일을 분할출하 정보 포함하여 표시
|
||||
var excelData = currentData.map(function(row) {
|
||||
var excelRow = Object.assign({}, row);
|
||||
|
||||
// 출하일 가공: SHIPPING_DATE_WITH_COUNT 값을 SHIPPING_DATE에 덮어쓰기
|
||||
// 예: "2025-10-20외1" 형식
|
||||
if(excelRow.SHIPPING_DATE_WITH_COUNT) {
|
||||
excelRow.SHIPPING_DATE = excelRow.SHIPPING_DATE_WITH_COUNT;
|
||||
}
|
||||
|
||||
return excelRow;
|
||||
});
|
||||
|
||||
// 엑셀용 데이터로 임시 설정
|
||||
_tabulGrid.setData(excelData);
|
||||
|
||||
// 엑셀 다운로드
|
||||
_tabulGrid.download("xlsx", "판매관리_" + new Date().toISOString().slice(0,10) + ".xlsx", {
|
||||
sheetName: "판매관리"
|
||||
});
|
||||
|
||||
// 다운로드 후 원래 데이터로 복원
|
||||
setTimeout(function() {
|
||||
_tabulGrid.setData(currentData);
|
||||
isExcelDownloading = false;
|
||||
}, 500);
|
||||
} catch(e) {
|
||||
console.error("엑셀 다운로드 오류:", e);
|
||||
isExcelDownloading = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function fn_openSaleRegPopup(orderNo, saleNo){
|
||||
var popup_width = 850;
|
||||
@@ -72,45 +139,49 @@
|
||||
<script type="text/javascript">
|
||||
// 새로운 테이블 구조에 맞게 컬럼 정의 수정
|
||||
var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true},
|
||||
{
|
||||
formatter: "rowSelection",
|
||||
titleFormatter: "rowSelection",
|
||||
headerHozAlign: 'center',
|
||||
hozAlign: 'center',
|
||||
width: 50,
|
||||
frozen: true,
|
||||
headerSort: false,
|
||||
cellClick: function(e, cell){
|
||||
e.stopPropagation();
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '프로젝트번호', field : 'PROJECT_NO', frozen : true,
|
||||
formatter: fnc_createGridAnchorTag,
|
||||
cellClick: function(e, cell){
|
||||
var orderNo = cell.getData().PROJECT_NO;
|
||||
var saleNo = cell.getData().SALE_NO;
|
||||
fn_openSaleRegPopup(orderNo, saleNo);
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문유형', field : 'ORDER_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '제품구분', field : 'PRODUCT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '국내/해외', field : 'NATION'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사', field : 'CUSTOMER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '180', title : '품명', field : 'PRODUCT_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '수주수량', field : 'ORDER_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '요청납기', field : 'REQUEST_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '발주번호', field : 'PO_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '발주일', field : 'ORDER_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH',
|
||||
formatter: fnc_subInfoValueFormatter,
|
||||
cellClick: function(e, cell){
|
||||
var objid = cell.getData().CONTRACT_OBJID || cell.getData().SALE_NO;
|
||||
if(objid){
|
||||
fn_FileRegist(objid, "ORDER_DOC", "주문서");
|
||||
}
|
||||
}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '생산 상태', field : 'PRODUCTION_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하지시 상태', field : 'SHIPPING_ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매수량', field : 'SALES_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '잔량', field : 'REMAINING_QUANTITY',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매단가', field : 'SALES_UNIT_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매공급가액', field : 'SALES_SUPPLY_PRICE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매부가세', field : 'SALES_VAT',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '부가세', field : 'SALES_VAT',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매총액', field : 'SALES_TOTAL_AMOUNT',
|
||||
@@ -119,19 +190,108 @@ var columns = [
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '판매원화총액', field : 'SALES_TOTAL_AMOUNT_KRW',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '판매환종', field : 'SALES_CURRENCY_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '판매환율', field : 'SALES_EXCHANGE_RATE',
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '120', title : '잔량원화총액', field : 'REMAINING_AMOUNT_KRW',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: false}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '수주상태', field : 'ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '생산상태', field : 'PRODUCTION_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '출하지시상태', field : 'SHIPPING_ORDER_STATUS'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '유/무상', field : 'PAYMENT_TYPE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '80', title : '환종', field : 'SALES_CURRENCY_NAME'},
|
||||
{headerHozAlign : 'center', hozAlign : 'right', width : '100', title : '환율', field : 'SALES_EXCHANGE_RATE',
|
||||
formatter: "money", formatterParams: {thousand: ",", symbolAfter: "", precision: 2}
|
||||
},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하일', field : 'SHIPPING_DATE'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하방법', field : 'SHIPPING_METHOD'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '담당자', field : 'MANAGER'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'}
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : 'S/N', field : 'SERIAL_NO'},
|
||||
{headerHozAlign : 'center', hozAlign : 'center', width : '120', title : '품번', field : 'PRODUCT_NO'}
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '제품구분', field : 'PRODUCT_TYPE'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '국내/해외', field : 'NATION'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '접수일', field : 'RECEIPT_DATE'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'left', width : '150', title : '고객사요청사항', field : 'CUSTOMER_REQUEST'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '주문서첨부', field : 'ORDER_ATTACH',
|
||||
// formatter: fnc_subInfoValueFormatter,
|
||||
// cellClick: function(e, cell){
|
||||
// var objid = cell.getData().CONTRACT_OBJID || cell.getData().SALE_NO;
|
||||
// if(objid){
|
||||
// fn_FileRegist(objid, "ORDER_DOC", "주문서");
|
||||
// }
|
||||
// }
|
||||
// },
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '출하방법', field : 'SHIPPING_METHOD'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '담당자', field : 'MANAGER'},
|
||||
// {headerHozAlign : 'center', hozAlign : 'center', width : '100', title : '인도조건', field : 'INCOTERMS'}
|
||||
];
|
||||
|
||||
// 데이터 조회 함수
|
||||
function fn_search(){
|
||||
_tabulGrid = fnc_tabul_search(_tabul_layout_fitColumns, _tabulGrid, "/salesMgmt/salesMgmtGridList.do", columns, true);
|
||||
// 디버깅: 검색 파라미터 확인
|
||||
var formData = $("#form1").serializeObject();
|
||||
console.log("=== 판매관리 조회 파라미터 ===");
|
||||
console.log("search_partObjId:", formData.search_partObjId);
|
||||
console.log("search_partNo:", formData.search_partNo);
|
||||
console.log("search_partName:", formData.search_partName);
|
||||
console.log("전체 파라미터:", formData);
|
||||
|
||||
// 그리드 조회 및 Total 합계 업데이트를 위한 커스텀 AJAX
|
||||
$.ajax({
|
||||
url: "/salesMgmt/salesMgmtGridList.do",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
dataType: "json",
|
||||
beforeSend: function(){
|
||||
_startLoading("Loading...");
|
||||
},
|
||||
complete: function(){
|
||||
_endLoading();
|
||||
},
|
||||
success: function(response) {
|
||||
// 그리드 데이터 설정
|
||||
if(_tabulGrid){
|
||||
_tabulGrid.setData(response.RESULTLIST || []);
|
||||
} else {
|
||||
// 그리드 초기화
|
||||
_tabulGrid = new Tabulator("#mainGrid", {
|
||||
layout: _tabul_layout_fitColumns,
|
||||
columns: columns,
|
||||
data: response.RESULTLIST || [],
|
||||
selectable: true
|
||||
});
|
||||
}
|
||||
|
||||
// 조회된 전체 데이터의 판매원화총액 합계 계산
|
||||
var totalSalesAmountKRW = 0;
|
||||
var shippedAmountKRW = 0; // 출고된 금액
|
||||
var notShippedAmountKRW = 0; // 미출고 금액
|
||||
|
||||
if(response.RESULTLIST && response.RESULTLIST.length > 0) {
|
||||
response.RESULTLIST.forEach(function(row) {
|
||||
var amountKRW = parseFloat(row.SALES_TOTAL_AMOUNT_KRW || 0);
|
||||
totalSalesAmountKRW += amountKRW;
|
||||
|
||||
// 출하일이 있으면 출고, 없으면 미출고
|
||||
if(row.SHIPPING_DATE && row.SHIPPING_DATE.trim() !== '') {
|
||||
shippedAmountKRW += amountKRW;
|
||||
} else {
|
||||
notShippedAmountKRW += amountKRW;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 합계 표시
|
||||
$("#totalSalesAmountKRW").text(Number(totalSalesAmountKRW).toLocaleString());
|
||||
$("#shippedAmountKRW").text(Number(shippedAmountKRW).toLocaleString());
|
||||
$("#notShippedAmountKRW").text(Number(notShippedAmountKRW).toLocaleString());
|
||||
|
||||
// 페이징 HTML 업데이트
|
||||
if(response.PAGE_HTML){
|
||||
$("#pagingArea").html(response.PAGE_HTML);
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
_endLoading();
|
||||
alert("데이터 조회 중 오류가 발생했습니다.");
|
||||
console.error("Error:", error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 출하지시/판매등록 함수 (1건만 선택 가능)
|
||||
@@ -185,6 +345,18 @@ function fn_bulkRegister(){
|
||||
<td class="label"><label for="">주문유형</label></td>
|
||||
<td><select name="orderType" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.orderTypeList}</select></td>
|
||||
|
||||
<td class="label"><label for="">발주번호</label></td>
|
||||
<td><input type="text" name="poNo" /></td>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
<select name="customer_objid" id="customer_objid" style="width:150px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${codeMap.customer_cd}
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<%--
|
||||
<td class="label"><label for="">제품구분</label></td>
|
||||
<td><select name="productType" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.productTypeList}</select></td>
|
||||
|
||||
@@ -204,14 +376,7 @@ function fn_bulkRegister(){
|
||||
<option value="Y">무상</option>
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td><label for="customer_objid">고객사</label></td>
|
||||
<td>
|
||||
<select name="customer_objid" id="customer_objid" style="width:150px" class="select2" autocomplete="off">
|
||||
<option value="">선택</option>
|
||||
${codeMap.customer_cd}
|
||||
</select>
|
||||
</td>
|
||||
--%>
|
||||
|
||||
<td class="align_r">
|
||||
<label for="" class="">품번</label>
|
||||
@@ -225,7 +390,7 @@ function fn_bulkRegister(){
|
||||
<td class="align_r">
|
||||
<label for="" class="">품명</label>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<td>
|
||||
<select name="search_partName" id="search_partName" class="select2-part" style="width: 100%;">
|
||||
<option value="">품명 선택</option>
|
||||
</select>
|
||||
@@ -236,11 +401,18 @@ function fn_bulkRegister(){
|
||||
<td class="label"><label for="">S/N</label></td>
|
||||
<td><input type="text" name="serialNo" /></td>
|
||||
|
||||
<td class="label"><label for="">출하지시상태</label></td>
|
||||
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
|
||||
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
|
||||
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="3"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
|
||||
|
||||
<%--
|
||||
<td class="label"><label for="">수주상태</label></td>
|
||||
<td><select name="orderStatus" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.orderStatusList}</select></td>
|
||||
|
||||
<td class="label"><label for="">발주번호</label></td>
|
||||
<td><input type="text" name="poNo" /></td>
|
||||
|
||||
<td class="label"><label for="">담당자</label></td>
|
||||
<td><select name="manager" class="select2" style="width:120px;"><option value="">전체</option>${codeMap.managerList}</select></td>
|
||||
@@ -256,8 +428,6 @@ function fn_bulkRegister(){
|
||||
</select>
|
||||
</td>
|
||||
|
||||
<td class="label"><label for="">출하대기 상태</label></td>
|
||||
<td><select name="shippingStatus" class="select2" style="width:150px;"><option value="">전체</option>${codeMap.shippingStatusList}</select></td>
|
||||
<td class="label"><label for="">출하방법</label></td>
|
||||
<td>
|
||||
<select name="shippingMethod" class="select2" style="width:150px;">
|
||||
@@ -266,21 +436,25 @@ function fn_bulkRegister(){
|
||||
<option value="PARCEL">택배</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
<td class="label"><label for="">요청납기</label></td>
|
||||
<td colspan="3"><input type="text" name="requestDateFrom" class="date_icon"/> ~ <input type="text" name="requestDateTo" class="date_icon"/></td>
|
||||
|
||||
<td class="label"><label for="">발주일</label></td>
|
||||
<td colspan="3"><input type="text" name="orderDateFrom" class="date_icon"/> ~ <input type="text" name="orderDateTo" class="date_icon"/></td>
|
||||
<td class="label"><label for="">출고일</label></td>
|
||||
<td colspan="3"><input type="text" name="shippingDateFrom" class="date_icon"/> ~ <input type="text" name="shippingDateTo" class="date_icon"/></td>
|
||||
--%>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Total 합계 표시 영역 (판매원화총액 기준) -->
|
||||
<div style="padding: 5px 10px; background: #f5f5f5; border-radius: 3px; margin: 10px 0;">
|
||||
<span style="font-weight: bold; font-size: 13px;">
|
||||
발주 금액 : <span id="totalSalesAmountKRW" style="color: #4CAF50;">0</span> 원
|
||||
<span style="margin-left: 10px; font-size: 12px;">
|
||||
(출고 : <span id="shippedAmountKRW" style="color: #2196F3;">0</span> 원,
|
||||
미출고 : <span id="notShippedAmountKRW" style="color: #FF9800;">0</span> 원)
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<%@include file= "/WEB-INF/view/common/common_gridArea.jsp" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3302,7 +3302,8 @@ function initPartSelect2Ajax(partNoSelectId, partNameSelectId, partObjIdInputId,
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
return {
|
||||
searchTerm: params.term
|
||||
searchTerm: params.term,
|
||||
searchType: 'partNo' // 품번만 검색
|
||||
};
|
||||
},
|
||||
processResults: function(data) {
|
||||
@@ -3353,7 +3354,8 @@ function initPartSelect2Ajax(partNoSelectId, partNameSelectId, partObjIdInputId,
|
||||
delay: 250,
|
||||
data: function(params) {
|
||||
return {
|
||||
searchTerm: params.term
|
||||
searchTerm: params.term,
|
||||
searchType: 'partName' // 품명만 검색
|
||||
};
|
||||
},
|
||||
processResults: function(data) {
|
||||
|
||||
@@ -53,7 +53,10 @@ echo "DEBUG: Effective classpath for javac: $EFFECTIVE_CLASSPATH"
|
||||
# src 폴더 내의 모든 .java 파일 컴파일
|
||||
echo "Compiling Java files for development..."
|
||||
|
||||
find src -name "*.java" -print0 | xargs -0 javac -encoding UTF-8 -source 1.7 -target 1.7 -d WebContent/WEB-INF/classes -cp "$EFFECTIVE_CLASSPATH"
|
||||
# Java 7 호환 바이트코드 생성을 위한 추가 옵션
|
||||
# -source 1.7 -target 1.7: Java 7 문법 및 바이트코드 버전 사용
|
||||
# -Xlint:-options: 경고 메시지 억제
|
||||
find src -name "*.java" -print0 | xargs -0 javac -encoding UTF-8 -source 1.7 -target 1.7 -Xlint:-options -d WebContent/WEB-INF/classes -cp "$EFFECTIVE_CLASSPATH"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Java compilation failed. Exiting script."
|
||||
exit 1
|
||||
|
||||
24
database/add_manager_columns_to_supply_mng.sql
Normal file
24
database/add_manager_columns_to_supply_mng.sql
Normal file
@@ -0,0 +1,24 @@
|
||||
-- 공급업체 관리 테이블에 담당자 5명 정보 컬럼 추가
|
||||
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER1_NAME VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER1_EMAIL VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER2_NAME VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER2_EMAIL VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER3_NAME VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER3_EMAIL VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER4_NAME VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER4_EMAIL VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER5_NAME VARCHAR(100);
|
||||
ALTER TABLE SUPPLY_MNG ADD COLUMN IF NOT EXISTS MANAGER5_EMAIL VARCHAR(100);
|
||||
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER1_NAME IS '담당자1 이름';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER1_EMAIL IS '담당자1 이메일';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER2_NAME IS '담당자2 이름';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER2_EMAIL IS '담당자2 이메일';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER3_NAME IS '담당자3 이름';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER3_EMAIL IS '담당자3 이메일';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER4_NAME IS '담당자4 이름';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER4_EMAIL IS '담당자4 이메일';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER5_NAME IS '담당자5 이름';
|
||||
COMMENT ON COLUMN SUPPLY_MNG.MANAGER5_EMAIL IS '담당자5 이메일';
|
||||
|
||||
9
database/add_sales_deadline_date_to_project_mgmt.sql
Normal file
9
database/add_sales_deadline_date_to_project_mgmt.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- PROJECT_MGMT 테이블에 매출마감일 컬럼 추가
|
||||
-- 2025-11-10
|
||||
|
||||
-- SALES_DEADLINE_DATE 컬럼 추가 (매출마감일 - 세금계산서 발행일)
|
||||
ALTER TABLE PROJECT_MGMT ADD COLUMN IF NOT EXISTS SALES_DEADLINE_DATE VARCHAR(10);
|
||||
|
||||
-- 컬럼 코멘트 추가
|
||||
COMMENT ON COLUMN PROJECT_MGMT.SALES_DEADLINE_DATE IS '매출마감일 (세금계산서 발행일)';
|
||||
|
||||
@@ -52,21 +52,21 @@ public class FileRenameClass implements FileRenamePolicy {
|
||||
int counter = 0;
|
||||
boolean fExist = true;
|
||||
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
String fullFileName = parentDir + "\\" + fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
String savedFileName = fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
|
||||
while (fExist) {
|
||||
if (new File(fullFileName).exists()) {
|
||||
counter = counter + 1;
|
||||
// fullFileName = parentDir + "\\" + fname + "(" + counter + ")"+ fileExt;
|
||||
fullFileName = parentDir + "\\" + fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
savedFileName = fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
} else {
|
||||
fExist = false;
|
||||
}
|
||||
long currentTime = System.currentTimeMillis();
|
||||
|
||||
String fullFileName = parentDir + File.separator + fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
String savedFileName = fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
|
||||
while (fExist) {
|
||||
if (new File(fullFileName).exists()) {
|
||||
counter = counter + 1;
|
||||
// fullFileName = parentDir + File.separator + fname + "(" + counter + ")"+ fileExt;
|
||||
fullFileName = parentDir + File.separator + fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
savedFileName = fname.replaceAll(" ", "") + "_" +currentTime+""+ fileExt;
|
||||
} else {
|
||||
fExist = false;
|
||||
}
|
||||
}
|
||||
Map fileMap = new HashMap();
|
||||
fileMap.put("realFileName", fname+fileExt);
|
||||
fileMap.put("savedFileName", savedFileName);
|
||||
|
||||
@@ -2242,6 +2242,19 @@ public class PartMngController {
|
||||
String fileExt = CommonUtils.checkNull((String)fileInfo.get("fileExt"));
|
||||
long fileSize = Long.parseLong(CommonUtils.checkNull(fileInfo.get("fileSize"), "0"));
|
||||
|
||||
// 파일 크기가 0이면 실제 저장된 파일에서 다시 확인
|
||||
// if(fileSize == 0) {
|
||||
// try {
|
||||
// File savedFile = new File(storagePath + File.separator + savedFileName);
|
||||
// if(savedFile.exists()) {
|
||||
// fileSize = savedFile.length();
|
||||
// System.out.println("파일 크기 재확인: " + fileSize + " bytes");
|
||||
// }
|
||||
// } catch(Exception e) {
|
||||
// System.out.println("파일 크기 재확인 실패: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 확장자 대문자 변환 (이미 점 없이 저장됨)
|
||||
fileExt = fileExt.toUpperCase();
|
||||
|
||||
@@ -2249,6 +2262,7 @@ public class PartMngController {
|
||||
System.out.println("원본 파일명: " + originalFileName);
|
||||
System.out.println("저장 파일명: " + savedFileName);
|
||||
System.out.println("확장자: " + fileExt);
|
||||
System.out.println("파일 크기: " + fileSize + " bytes");
|
||||
System.out.println("===================================");
|
||||
|
||||
// 파일 확장자에 따른 문서 타입 결정
|
||||
@@ -2258,7 +2272,7 @@ public class PartMngController {
|
||||
if("STP".equals(fileExt) || "STEP".equals(fileExt)) {
|
||||
docType = "3D_CAD";
|
||||
docTypeName = "3D CAD 첨부파일";
|
||||
} else if("DWG".equals(fileExt)) {
|
||||
} else if("DWG".equals(fileExt) || "DXF".equals(fileExt)){
|
||||
docType = "2D_DRAWING_CAD";
|
||||
docTypeName = "2D(Drawing) CAD 첨부파일";
|
||||
} else if("PDF".equals(fileExt)) {
|
||||
@@ -2270,25 +2284,23 @@ public class PartMngController {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 파일명에서 확장자 제거하여 품번 추출
|
||||
String fileNameWithoutExt = originalFileName;
|
||||
int lastDotIndex = originalFileName.lastIndexOf('.');
|
||||
if(lastDotIndex > 0) {
|
||||
fileNameWithoutExt = originalFileName.substring(0, lastDotIndex);
|
||||
}
|
||||
// 품번 추출 (맨 마지막 확장자만 제거 후 하이픈 기준 추출)
|
||||
String extractedPartNo = extractPartNoFromFileName(originalFileName);
|
||||
|
||||
// 품번과 정확히 일치하는 경우만 매칭
|
||||
String matchedPartNo = null;
|
||||
System.out.println("품번 매칭 시작 - 파일명(확장자 제외): " + fileNameWithoutExt);
|
||||
System.out.println("품번 매칭 시작 - 추출된 품번: " + extractedPartNo);
|
||||
|
||||
// 정확한 매칭 (품번과 파일명이 정확히 일치)
|
||||
if(partNoMap.containsKey(fileNameWithoutExt)) {
|
||||
matchedPartNo = fileNameWithoutExt;
|
||||
System.out.println(" ✓ 품번 정확 매칭 성공: " + matchedPartNo);
|
||||
if(extractedPartNo != null && !extractedPartNo.isEmpty()) {
|
||||
// 정확한 매칭 (추출된 품번과 DB 품번이 정확히 일치)
|
||||
if(partNoMap.containsKey(extractedPartNo)) {
|
||||
matchedPartNo = extractedPartNo;
|
||||
System.out.println(" ✓ 품번 정확 매칭 성공: " + matchedPartNo);
|
||||
}
|
||||
}
|
||||
|
||||
if(matchedPartNo == null) {
|
||||
System.out.println(" ✗ 품번 매칭 실패 - 파일명과 일치하는 품번이 없음");
|
||||
System.out.println(" ✗ 품번 매칭 실패 - 파일명: " + originalFileName + ", 추출된 품번: " + extractedPartNo);
|
||||
notFoundCount++;
|
||||
continue;
|
||||
}
|
||||
@@ -2432,6 +2444,19 @@ public class PartMngController {
|
||||
String fileExt = CommonUtils.checkNull((String)fileInfo.get("fileExt"));
|
||||
long fileSize = Long.parseLong(CommonUtils.checkNull(fileInfo.get("fileSize"), "0"));
|
||||
|
||||
// 파일 크기가 0이면 실제 저장된 파일에서 다시 확인
|
||||
// if(fileSize == 0) {
|
||||
// try {
|
||||
// File savedFile = new File(storagePath + File.separator + savedFileName);
|
||||
// if(savedFile.exists()) {
|
||||
// fileSize = savedFile.length();
|
||||
// System.out.println("파일 크기 재확인: " + fileSize + " bytes");
|
||||
// }
|
||||
// } catch(Exception e) {
|
||||
// System.out.println("파일 크기 재확인 실패: " + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
|
||||
// 확장자 대문자 변환
|
||||
fileExt = fileExt.toUpperCase();
|
||||
|
||||
@@ -2439,6 +2464,7 @@ public class PartMngController {
|
||||
System.out.println("원본 파일명: " + originalFileName);
|
||||
System.out.println("저장 파일명: " + savedFileName);
|
||||
System.out.println("확장자: " + fileExt);
|
||||
System.out.println("파일 크기: " + fileSize + " bytes");
|
||||
System.out.println("==========================================");
|
||||
|
||||
// 파일 확장자에 따른 문서 타입 결정
|
||||
@@ -2448,7 +2474,7 @@ public class PartMngController {
|
||||
if("STP".equals(fileExt) || "STEP".equals(fileExt)) {
|
||||
docType = "3D_CAD";
|
||||
docTypeName = "3D CAD 첨부파일";
|
||||
} else if("DWG".equals(fileExt)) {
|
||||
} else if("DWG".equals(fileExt) || "DXF".equals(fileExt)) {
|
||||
docType = "2D_DRAWING_CAD";
|
||||
docTypeName = "2D(Drawing) CAD 첨부파일";
|
||||
} else if("PDF".equals(fileExt)) {
|
||||
@@ -2460,25 +2486,23 @@ public class PartMngController {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 파일명에서 확장자 제거하여 품번 추출
|
||||
String fileNameWithoutExt = originalFileName;
|
||||
int lastDotIndex = originalFileName.lastIndexOf('.');
|
||||
if(lastDotIndex > 0) {
|
||||
fileNameWithoutExt = originalFileName.substring(0, lastDotIndex);
|
||||
}
|
||||
// 품번 추출 (맨 마지막 확장자만 제거 후 하이픈 기준 추출)
|
||||
String extractedPartNo = extractPartNoFromFileName(originalFileName);
|
||||
|
||||
// 품번과 정확히 일치하는 경우만 매칭
|
||||
String matchedPartNo = null;
|
||||
System.out.println("품번 매칭 시작 - 파일명(확장자 제외): " + fileNameWithoutExt);
|
||||
System.out.println("품번 매칭 시작 - 추출된 품번: " + extractedPartNo);
|
||||
|
||||
// 정확한 매칭 (품번과 파일명이 정확히 일치)
|
||||
if(partNoMap.containsKey(fileNameWithoutExt)) {
|
||||
matchedPartNo = fileNameWithoutExt;
|
||||
System.out.println(" ✓ 품번 정확 매칭 성공: " + matchedPartNo);
|
||||
if(extractedPartNo != null && !extractedPartNo.isEmpty()) {
|
||||
// 정확한 매칭 (추출된 품번과 DB 품번이 정확히 일치)
|
||||
if(partNoMap.containsKey(extractedPartNo)) {
|
||||
matchedPartNo = extractedPartNo;
|
||||
System.out.println(" ✓ 품번 정확 매칭 성공: " + matchedPartNo);
|
||||
}
|
||||
}
|
||||
|
||||
if(matchedPartNo == null) {
|
||||
System.out.println(" ✗ 품번 매칭 실패 - 파일명과 일치하는 품번이 없음");
|
||||
System.out.println(" ✗ 품번 매칭 실패 - 파일명: " + originalFileName + ", 추출된 품번: " + extractedPartNo);
|
||||
notFoundCount++;
|
||||
continue;
|
||||
}
|
||||
@@ -2528,4 +2552,116 @@ public class PartMngController {
|
||||
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 파일명에서 품번을 추출하는 헬퍼 메서드
|
||||
*
|
||||
* 품번 추출 규칙:
|
||||
* 1. 모든 확장자 제거 (.idw.pdf → .idw도 제거)
|
||||
* 2. 확장자 제거 후 첫 번째 하이픈(-) 위치 찾기
|
||||
* 3. 하이픈 앞 자릿수에 따라 품번 길이 결정
|
||||
* - 5자리: 하이픈 포함 10자리 추출 (예: 20002-0043)
|
||||
* - 7자리: 하이픈 포함 16자리 추출 (예: 2000200-004300-01)
|
||||
*
|
||||
* @param fileName 원본 파일명 (예: "20002-0043.idw.pdf")
|
||||
* @return 추출된 품번 (예: "20002-0043") 또는 null
|
||||
*/
|
||||
private String extractPartNoFromFileName(String fileName) {
|
||||
if(fileName == null || fileName.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
// 1단계: 모든 확장자 제거 (이중/삼중 확장자 대응)
|
||||
// 알려진 CAD 확장자 목록
|
||||
String[] cadExtensions = {".idw", ".dwg", ".dxf", ".stp", ".step", ".pdf", ".chg"};
|
||||
|
||||
String fileNameWithoutExt = fileName;
|
||||
|
||||
// 반복적으로 확장자 제거 (예: file.idw.pdf → file.idw → file)
|
||||
boolean extensionRemoved = true;
|
||||
while(extensionRemoved) {
|
||||
extensionRemoved = false;
|
||||
|
||||
// 마지막 점 찾기
|
||||
int lastDotIndex = fileNameWithoutExt.lastIndexOf('.');
|
||||
if(lastDotIndex > 0) {
|
||||
String currentExt = fileNameWithoutExt.substring(lastDotIndex).toLowerCase();
|
||||
|
||||
// 알려진 CAD 확장자인 경우 제거
|
||||
for(String ext : cadExtensions) {
|
||||
if(currentExt.equals(ext)) {
|
||||
fileNameWithoutExt = fileNameWithoutExt.substring(0, lastDotIndex);
|
||||
extensionRemoved = true;
|
||||
System.out.println("[품번 추출] 확장자 제거: " + currentExt + " → " + fileNameWithoutExt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[품번 추출] 1단계 완료 - 모든 확장자 제거: " + fileNameWithoutExt);
|
||||
|
||||
// 2단계: 첫 번째 하이픈 위치 찾기
|
||||
int firstHyphenIndex = fileNameWithoutExt.indexOf('-');
|
||||
if(firstHyphenIndex == -1) {
|
||||
System.out.println("[품번 추출] 하이픈이 없음 - 추출 실패");
|
||||
return null;
|
||||
}
|
||||
|
||||
// 3단계: 하이픈 앞 자릿수 확인
|
||||
String beforeHyphen = fileNameWithoutExt.substring(0, firstHyphenIndex);
|
||||
int beforeHyphenLength = beforeHyphen.length();
|
||||
|
||||
System.out.println("[품번 추출] 2단계 - 하이픈 앞 문자열: " + beforeHyphen + " (길이: " + beforeHyphenLength + ")");
|
||||
|
||||
// 4단계: 자릿수에 따라 품번 추출
|
||||
String extractedPartNo = null;
|
||||
|
||||
if(beforeHyphenLength == 5) {
|
||||
// 스핀들 설계팀: 5자리 -> 하이픈 1개 (5-4 = 10자리)
|
||||
// 예: 20002-0043
|
||||
int targetLength = 10;
|
||||
if(fileNameWithoutExt.length() >= targetLength) {
|
||||
extractedPartNo = fileNameWithoutExt.substring(0, targetLength);
|
||||
System.out.println("[품번 추출] 3단계 - 5자리 패턴 (10자리 추출): " + extractedPartNo);
|
||||
} else {
|
||||
System.out.println("[품번 추출] 5자리 패턴이지만 총 길이가 10자리 미만 - 추출 실패");
|
||||
}
|
||||
} else if(beforeHyphenLength == 7) {
|
||||
// 장비 개발팀: 7자리 -> 하이픈이 1개 또는 2개
|
||||
// 하이픈 1개: 7-9 = 17자리 (예: 2000200-004300-0)
|
||||
// 하이픈 2개: 7-6-2 = 18자리 (예: 2000200-004300-02)
|
||||
|
||||
// 두 번째 하이픈이 있는지 확인
|
||||
int secondHyphenIndex = fileNameWithoutExt.indexOf('-', firstHyphenIndex + 1);
|
||||
|
||||
if(secondHyphenIndex != -1) {
|
||||
// 하이픈이 2개인 경우: 7-6-2 패턴 = 18자리
|
||||
// 예: 2000200-004300-02
|
||||
extractedPartNo = fileNameWithoutExt;
|
||||
System.out.println("[품번 추출] 3단계 - 7자리 패턴 (하이픈 2개, 전체 품번): " + extractedPartNo);
|
||||
} else {
|
||||
// 하이픈이 1개인 경우: 7-9 패턴 = 17자리
|
||||
// 예: 2000200-004300-0 (16자리만 추출)
|
||||
int targetLength = 16;
|
||||
if(fileNameWithoutExt.length() >= targetLength) {
|
||||
extractedPartNo = fileNameWithoutExt.substring(0, targetLength);
|
||||
System.out.println("[품번 추출] 3단계 - 7자리 패턴 (하이픈 1개, 16자리 추출): " + extractedPartNo);
|
||||
} else {
|
||||
System.out.println("[품번 추출] 7자리 패턴이지만 총 길이가 16자리 미만 - 추출 실패");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("[품번 추출] 하이픈 앞이 5자리 또는 7자리가 아님 - 추출 실패");
|
||||
}
|
||||
|
||||
return extractedPartNo;
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("[품번 추출] 예외 발생: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3197,4 +3197,12 @@ SELECT option_objid::VARCHAR AS CODE
|
||||
|
||||
ORDER BY CODE_ID
|
||||
</select>
|
||||
|
||||
<!-- 사용자 권한 체크 -->
|
||||
<select id="checkUserAuthority" parameterType="map" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM AUTHORITY_SUB_USER
|
||||
WHERE USER_ID = #{userId}
|
||||
AND MASTER_OBJID::varchar = #{masterObjid}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -2218,12 +2218,17 @@ public class ContractMgmtController {
|
||||
// 환종 코드
|
||||
code_map.put("contract_currency", commonService.bizMakeOptionList("0001533", CommonUtils.nullToEmpty((String)info.get("CONTRACT_CURRENCY")), "common.getCodeselect"));
|
||||
|
||||
// 결재상태 확인 (결재완료 시 견적서 템플릿 사용)
|
||||
String apprStatus = CommonUtils.nullToEmpty((String)info.get("APPR_STATUS"));
|
||||
boolean useEstimateTemplate = "결재완료".equals(apprStatus);
|
||||
|
||||
request.setAttribute("code_map", code_map);
|
||||
request.setAttribute("info", info);
|
||||
request.setAttribute("contractInfo", contractInfo);
|
||||
request.setAttribute("contractObjId", objId);
|
||||
request.setAttribute("objId", objId);
|
||||
request.setAttribute("actionType", actionType);
|
||||
request.setAttribute("useEstimateTemplate", useEstimateTemplate ? "Y" : "N");
|
||||
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -2262,7 +2267,18 @@ public class ContractMgmtController {
|
||||
Map resultMap = new HashMap();
|
||||
|
||||
try {
|
||||
List<Map> items = contractMgmtService.getContractItems(paramMap);
|
||||
// 결재완료 상태인 경우 최종 견적서 템플릿에서 품목 조회
|
||||
String useEstimateTemplate = CommonUtils.checkNull(paramMap.get("useEstimateTemplate"));
|
||||
List<Map> items = null;
|
||||
|
||||
if("Y".equals(useEstimateTemplate)) {
|
||||
// 최종 견적서 템플릿의 품목 조회
|
||||
items = contractMgmtService.getEstimateTemplateItemsForOrder(paramMap);
|
||||
} else {
|
||||
// 기존 방식: CONTRACT_ITEM에서 조회
|
||||
items = contractMgmtService.getContractItems(paramMap);
|
||||
}
|
||||
|
||||
resultMap.put("result", "success");
|
||||
resultMap.put("items", items);
|
||||
|
||||
|
||||
@@ -163,25 +163,38 @@ public class SalesNcollectMgmtController {
|
||||
// 코드정보 (기존 로직과 동일하게 설정 가능)
|
||||
Map<String, Object> codeMap = new HashMap<String, Object>();
|
||||
|
||||
// 주문유형
|
||||
// 주문유형 - 0000167 코드 사용 (판매, 개발, 수리, 개조)
|
||||
codeMap.put("orderTypeList",
|
||||
salesMgmtCommonService.bizMakeOptionList("GE", "", "salesMgmtCommon.getCodeList"));
|
||||
commonService.bizMakeOptionList("0000167", "", "common.getCodeselect"));
|
||||
// 제품구분
|
||||
codeMap.put("productTypeList",
|
||||
salesMgmtCommonService.bizMakeOptionList("", "", "salesMgmtCommon.getGoodsList"));
|
||||
commonService.bizMakeOptionList("0000001", "", "common.getCodeselect"));
|
||||
// 국내/해외
|
||||
codeMap.put("nationList",
|
||||
salesMgmtCommonService.bizMakeOptionList("AR", "", "salesMgmtCommon.getCodeList"));
|
||||
commonService.bizMakeOptionList("0001219", "", "common.getCodeselect"));
|
||||
// 고객사
|
||||
codeMap.put("customer_cd", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")), "common.getsupplyselect"));
|
||||
// 수주상태
|
||||
codeMap.put("orderStatusList",
|
||||
commonService.bizMakeOptionList("0000932", "", "common.getCodeselect"));
|
||||
// 출하대기 상태
|
||||
codeMap.put("shippingStatusList",
|
||||
salesMgmtCommonService.bizMakeOptionList("SH", "", "salesMgmtCommon.getCodeList"));
|
||||
// 담당자
|
||||
codeMap.put("managerList", commonService.bizMakeOptionList("", "", "common.getUserselect"));
|
||||
// 수주상태
|
||||
codeMap.put("orderStatusList",
|
||||
commonService.bizMakeOptionList("0000963", "", "common.getCodeselect"));
|
||||
// 출하지시상태 - COMM_CODE 테이블에서 조회 (PARENT_CODE_ID를 찾아서 사용)
|
||||
// 임시로 여러 코드를 시도해보거나, 직접 쿼리로 조회
|
||||
String shippingStatusList = commonService.bizMakeOptionList("SHIPPING_STATUS", "", "common.getCodeselect");
|
||||
if (shippingStatusList == null || shippingStatusList.trim().isEmpty()) {
|
||||
// SHIPPING_STATUS 코드가 없으면 다른 코드 시도
|
||||
shippingStatusList = commonService.bizMakeOptionList("0001300", "", "common.getCodeselect");
|
||||
}
|
||||
if (shippingStatusList == null || shippingStatusList.trim().isEmpty()) {
|
||||
// 그래도 없으면 하드코딩
|
||||
StringBuilder shippingStatusOptions = new StringBuilder();
|
||||
shippingStatusOptions.append("<option value='출하지시'>출하지시</option>");
|
||||
shippingStatusOptions.append("<option value='출하완료'>출하완료</option>");
|
||||
shippingStatusOptions.append("<option value='출하대기'>출하대기</option>");
|
||||
shippingStatusList = shippingStatusOptions.toString();
|
||||
}
|
||||
codeMap.put("shippingStatusList", shippingStatusList);
|
||||
// 담당자
|
||||
codeMap.put("managerList", commonService.bizMakeOptionList("", "", "common.getUserselect"));
|
||||
|
||||
request.setAttribute("codeMap", codeMap);
|
||||
} catch (Exception e) {
|
||||
@@ -258,9 +271,48 @@ public class SalesNcollectMgmtController {
|
||||
// 기존 판매 정보 조회 후 환종(통화) 공통코드 세팅
|
||||
Map<String, Object> saleInfo = null;
|
||||
String salesCurrency = "";
|
||||
if(paramMap.get("orderNo") != null && !paramMap.get("orderNo").equals("")) {
|
||||
|
||||
// contractObjId가 있으면 주문서 관리에서 넘어온 것 -> 수주 데이터 조회
|
||||
if(paramMap.get("contractObjId") != null && !paramMap.get("contractObjId").equals("")) {
|
||||
// 수주 데이터 조회 (CONTRACT_ITEM 테이블에서)
|
||||
saleInfo = salesNcollectMgmtService.getOrderDataForSale(paramMap);
|
||||
salesCurrency = CommonUtils.nullToEmpty((String)saleInfo.get("SALES_CURRENCY"));
|
||||
request.setAttribute("saleInfo", saleInfo);
|
||||
request.setAttribute("orderInfo", saleInfo);
|
||||
}
|
||||
// orderNo가 있으면 기존 판매 정보 조회
|
||||
else if(paramMap.get("orderNo") != null && !paramMap.get("orderNo").equals("")) {
|
||||
saleInfo = salesNcollectMgmtService.getSaleInfo(paramMap);
|
||||
salesCurrency = CommonUtils.nullToEmpty((String)saleInfo.get("SALES_CURRENCY"));
|
||||
|
||||
// 판매 정보가 비어있거나 금액이 0이면 수주 데이터로 채우기
|
||||
if(saleInfo == null ||
|
||||
(saleInfo.get("SALES_SUPPLY_PRICE") == null ||
|
||||
"0".equals(String.valueOf(saleInfo.get("SALES_SUPPLY_PRICE"))) ||
|
||||
Integer.parseInt(String.valueOf(saleInfo.get("SALES_SUPPLY_PRICE"))) == 0)) {
|
||||
// orderNo로 contractObjId 조회 후 수주 데이터 가져오기
|
||||
Map<String, Object> orderDataParam = new HashMap<String, Object>();
|
||||
orderDataParam.put("orderNo", paramMap.get("orderNo"));
|
||||
Map<String, Object> orderData = salesNcollectMgmtService.getOrderDataByOrderNo(orderDataParam);
|
||||
|
||||
if(orderData != null && orderData.get("SALES_SUPPLY_PRICE") != null) {
|
||||
// 수주 데이터를 saleInfo에 병합 (기존 S/N 등은 유지)
|
||||
if(saleInfo == null) saleInfo = new HashMap<String, Object>();
|
||||
saleInfo.put("SALES_QUANTITY", orderData.get("SALES_QUANTITY"));
|
||||
saleInfo.put("SALES_UNIT_PRICE", orderData.get("SALES_UNIT_PRICE"));
|
||||
saleInfo.put("SALES_SUPPLY_PRICE", orderData.get("SALES_SUPPLY_PRICE"));
|
||||
saleInfo.put("SALES_VAT", orderData.get("SALES_VAT"));
|
||||
saleInfo.put("SALES_TOTAL_AMOUNT", orderData.get("SALES_TOTAL_AMOUNT"));
|
||||
saleInfo.put("SALES_CURRENCY", orderData.get("SALES_CURRENCY"));
|
||||
saleInfo.put("SALES_CURRENCY_NAME", orderData.get("SALES_CURRENCY_NAME"));
|
||||
saleInfo.put("SALES_EXCHANGE_RATE", orderData.get("SALES_EXCHANGE_RATE"));
|
||||
if(saleInfo.get("SHIPPING_DATE") == null || "".equals(saleInfo.get("SHIPPING_DATE"))) {
|
||||
saleInfo.put("SHIPPING_DATE", orderData.get("SHIPPING_DATE"));
|
||||
}
|
||||
salesCurrency = CommonUtils.nullToEmpty((String)orderData.get("SALES_CURRENCY"));
|
||||
}
|
||||
}
|
||||
|
||||
request.setAttribute("saleInfo", saleInfo);
|
||||
|
||||
// orderInfo로 견적 정보 전달 (saleInfo가 이미 모든 필요한 정보를 포함)
|
||||
@@ -281,8 +333,28 @@ public class SalesNcollectMgmtController {
|
||||
@RequestMapping(value = "/salesMgmt/salesMgmtGridList.do", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Map<String, Object> getSalesMgmtGridList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
||||
// 디버깅: 검색 파라미터 로그 출력
|
||||
System.out.println("=== 판매관리 조회 파라미터 (백엔드) ===");
|
||||
System.out.println("search_partObjId: [" + paramMap.get("search_partObjId") + "]");
|
||||
System.out.println("search_partNo: [" + paramMap.get("search_partNo") + "]");
|
||||
System.out.println("search_partName: [" + paramMap.get("search_partName") + "]");
|
||||
System.out.println("orderType: [" + paramMap.get("orderType") + "]");
|
||||
System.out.println("poNo: [" + paramMap.get("poNo") + "]");
|
||||
System.out.println("serialNo: [" + paramMap.get("serialNo") + "]");
|
||||
|
||||
// 품명/품번 파라미터가 비어있으면 경고
|
||||
if((paramMap.get("search_partNo") == null || paramMap.get("search_partNo").toString().isEmpty()) &&
|
||||
(paramMap.get("search_partName") == null || paramMap.get("search_partName").toString().isEmpty())) {
|
||||
System.out.println("⚠️ 품번/품명 파라미터가 비어있습니다!");
|
||||
}
|
||||
|
||||
// commonService.selectListPagingNew를 사용하여 페이지네이션 HTML 생성
|
||||
commonService.selectListPagingNew("salesNcollectMgmt.getSalesMgmtGridList", request, paramMap);
|
||||
|
||||
// 디버깅: 조회 결과 개수 출력
|
||||
List<?> resultList = (List<?>) paramMap.get("RESULTLIST");
|
||||
System.out.println("✅ 조회 결과 개수: " + (resultList != null ? resultList.size() : 0));
|
||||
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
|
||||
@@ -755,35 +755,39 @@
|
||||
AND PAID_TYPE = #{paid_type}
|
||||
</if>
|
||||
|
||||
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
|
||||
<if test="search_partObjId != null and search_partObjId != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CONTRACT_ITEM CI
|
||||
WHERE CI.CONTRACT_OBJID = T.OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND CI.PART_OBJID = #{search_partObjId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
|
||||
<if test="search_partObjId != null and search_partObjId != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CONTRACT_ITEM CI
|
||||
WHERE CI.CONTRACT_OBJID = T.OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND CI.PART_OBJID = #{search_partObjId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="search_poNo != null and search_poNo != ''">
|
||||
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
|
||||
</if>
|
||||
|
||||
<if test="order_start_date != null and !''.equals(order_start_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="order_end_date != null and !''.equals(order_end_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
|
||||
<select id="contractList_bak" parameterType="map" resultType="map">
|
||||
@@ -1405,70 +1409,70 @@
|
||||
|
||||
<select id="getContractMgmtInfo" parameterType="map" resultType="map">
|
||||
SELECT
|
||||
OBJID
|
||||
,CATEGORY_CD
|
||||
,CUSTOMER_OBJID
|
||||
,PRODUCT
|
||||
,CUSTOMER_PROJECT_NAME
|
||||
,STATUS_CD
|
||||
,DUE_DATE
|
||||
,LOCATION
|
||||
,SETUP
|
||||
,FACILITY
|
||||
,FACILITY_QTY
|
||||
,FACILITY_TYPE
|
||||
,FACILITY_DEPTH
|
||||
,PRODUCTION_NO
|
||||
,BUS_CAL_CD
|
||||
,CATEGORY1_CD
|
||||
,CHG_USER_ID
|
||||
,PLAN_DATE
|
||||
,COMPLETE_DATE
|
||||
,RESULT_CD
|
||||
,PROJECT_NO
|
||||
,PM_USER_ID
|
||||
,CONTRACT_PRICE
|
||||
,CONTRACT_PRICE_CURRENCY
|
||||
,CONTRACT_CURRENCY
|
||||
,REGDATE
|
||||
,WRITER
|
||||
,CONTRACT_NO
|
||||
,CUSTOMER_EQUIP_NAME
|
||||
,REQ_DEL_DATE
|
||||
,CONTRACT_DEL_DATE
|
||||
,CONTRACT_COMPANY
|
||||
,CONTRACT_DATE
|
||||
,PO_NO
|
||||
,MANUFACTURE_PLANT
|
||||
,CONTRACT_RESULT
|
||||
,PROJECT_NAME
|
||||
,SPEC_USER_ID
|
||||
,SPEC_PLAN_DATE
|
||||
,SPEC_COMP_DATE
|
||||
,SPEC_RESULT_CD
|
||||
,EST_USER_ID
|
||||
,EST_PLAN_DATE
|
||||
,EST_COMP_DATE
|
||||
,EST_RESULT_CD
|
||||
,AREA_CD
|
||||
,TARGET_PROJECT_NO
|
||||
,TARGET_PROJECT_NO_DIRECT
|
||||
,CUSTOMER_PRODUCTION_NO
|
||||
,MECHANICAL_TYPE
|
||||
,OVERHAUL_ORDER
|
||||
,PAID_TYPE
|
||||
,RECEIPT_DATE
|
||||
,PART_NO
|
||||
,PART_NAME
|
||||
,SERIAL_NO
|
||||
,QUANTITY
|
||||
,CUSTOMER_REQUEST
|
||||
,EXCHANGE_RATE
|
||||
,ORDER_DATE
|
||||
,ORDER_UNIT_PRICE
|
||||
,ORDER_SUPPLY_PRICE
|
||||
,ORDER_VAT
|
||||
,ORDER_TOTAL_AMOUNT
|
||||
A.OBJID
|
||||
,A.CATEGORY_CD
|
||||
,A.CUSTOMER_OBJID
|
||||
,A.PRODUCT
|
||||
,A.CUSTOMER_PROJECT_NAME
|
||||
,A.STATUS_CD
|
||||
,A.DUE_DATE
|
||||
,A.LOCATION
|
||||
,A.SETUP
|
||||
,A.FACILITY
|
||||
,A.FACILITY_QTY
|
||||
,A.FACILITY_TYPE
|
||||
,A.FACILITY_DEPTH
|
||||
,A.PRODUCTION_NO
|
||||
,A.BUS_CAL_CD
|
||||
,A.CATEGORY1_CD
|
||||
,A.CHG_USER_ID
|
||||
,A.PLAN_DATE
|
||||
,A.COMPLETE_DATE
|
||||
,A.RESULT_CD
|
||||
,A.PROJECT_NO
|
||||
,A.PM_USER_ID
|
||||
,A.CONTRACT_PRICE
|
||||
,A.CONTRACT_PRICE_CURRENCY
|
||||
,A.CONTRACT_CURRENCY
|
||||
,A.REGDATE
|
||||
,A.WRITER
|
||||
,A.CONTRACT_NO
|
||||
,A.CUSTOMER_EQUIP_NAME
|
||||
,A.REQ_DEL_DATE
|
||||
,A.CONTRACT_DEL_DATE
|
||||
,A.CONTRACT_COMPANY
|
||||
,A.CONTRACT_DATE
|
||||
,A.PO_NO
|
||||
,A.MANUFACTURE_PLANT
|
||||
,A.CONTRACT_RESULT
|
||||
,A.PROJECT_NAME
|
||||
,A.SPEC_USER_ID
|
||||
,A.SPEC_PLAN_DATE
|
||||
,A.SPEC_COMP_DATE
|
||||
,A.SPEC_RESULT_CD
|
||||
,A.EST_USER_ID
|
||||
,A.EST_PLAN_DATE
|
||||
,A.EST_COMP_DATE
|
||||
,A.EST_RESULT_CD
|
||||
,A.AREA_CD
|
||||
,A.TARGET_PROJECT_NO
|
||||
,A.TARGET_PROJECT_NO_DIRECT
|
||||
,A.CUSTOMER_PRODUCTION_NO
|
||||
,A.MECHANICAL_TYPE
|
||||
,A.OVERHAUL_ORDER
|
||||
,A.PAID_TYPE
|
||||
,A.RECEIPT_DATE
|
||||
,A.PART_NO
|
||||
,A.PART_NAME
|
||||
,A.SERIAL_NO
|
||||
,A.QUANTITY
|
||||
,A.CUSTOMER_REQUEST
|
||||
,A.EXCHANGE_RATE
|
||||
,A.ORDER_DATE
|
||||
,A.ORDER_UNIT_PRICE
|
||||
,A.ORDER_SUPPLY_PRICE
|
||||
,A.ORDER_VAT
|
||||
,A.ORDER_TOTAL_AMOUNT
|
||||
,(SELECT COUNT(1) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt01' AND UPPER(STATUS) = 'ACTIVE') AS FILE_CNT1
|
||||
,(SELECT COUNT(1) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt02' AND UPPER(STATUS) = 'ACTIVE') AS FILE_CNT2
|
||||
,(SELECT COUNT(1) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt03' AND UPPER(STATUS) = 'ACTIVE') AS FILE_CNT3
|
||||
@@ -1479,6 +1483,21 @@
|
||||
,(SELECT TO_CHAR(REGDATE, 'YYYY-MM-DD' ) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt03' AND UPPER(STATUS) = 'ACTIVE' ORDER BY REGDATE desc LIMIT 1) AS FILE_DATE3
|
||||
,(SELECT TO_CHAR(REGDATE, 'YYYY-MM-DD' ) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt04' AND UPPER(STATUS) = 'ACTIVE' ORDER BY REGDATE desc LIMIT 1) AS FILE_DATE4
|
||||
,(SELECT TO_CHAR(REGDATE, 'YYYY-MM-DD' ) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID::VARCHAR = A.OBJID AND DOC_TYPE='contractMgmt05' AND UPPER(STATUS) = 'ACTIVE' ORDER BY REGDATE desc LIMIT 1) AS FILE_DATE5
|
||||
-- 결재 상태 추가
|
||||
,COALESCE(
|
||||
(SELECT CASE
|
||||
WHEN UPPER(AP.STATUS) = 'INPROCESS' THEN '결재중'
|
||||
WHEN UPPER(AP.STATUS) = 'COMPLETE' THEN '결재완료'
|
||||
WHEN UPPER(AP.STATUS) = 'REJECT' THEN '반려'
|
||||
WHEN UPPER(AP.STATUS) = 'CANCEL' THEN '취소'
|
||||
ELSE '작성중'
|
||||
END
|
||||
FROM APPROVAL AP
|
||||
WHERE AP.TARGET_OBJID::VARCHAR = (SELECT objid::VARCHAR FROM ESTIMATE_TEMPLATE WHERE CONTRACT_OBJID = A.OBJID ORDER BY REGDATE DESC LIMIT 1)
|
||||
AND AP.TARGET_TYPE = 'CONTRACT_ESTIMATE'
|
||||
LIMIT 1),
|
||||
'작성중'
|
||||
) AS APPR_STATUS
|
||||
FROM CONTRACT_MGMT A
|
||||
WHERE A.OBJID = #{objId}
|
||||
</select>
|
||||
@@ -2227,8 +2246,11 @@ SELECT
|
||||
,SUPPLY_TEL_NO
|
||||
,REG_ID
|
||||
,TO_CHAR(REG_DATE,'YYYY-MM-DD') REGDATE
|
||||
,STATUS
|
||||
,CHARGE_USER_NAME
|
||||
,STATUS
|
||||
,CHARGE_USER_NAME
|
||||
,COALESCE(NULLIF(MANAGER1_NAME, ''), NULLIF(MANAGER2_NAME, ''), NULLIF(MANAGER3_NAME, ''), NULLIF(MANAGER4_NAME, ''), MANAGER5_NAME) AS MANAGER1_NAME
|
||||
,COALESCE(NULLIF(MANAGER1_EMAIL, ''), NULLIF(MANAGER2_EMAIL, ''), NULLIF(MANAGER3_EMAIL, ''), NULLIF(MANAGER4_EMAIL, ''), MANAGER5_EMAIL) AS MANAGER1_EMAIL
|
||||
,(SELECT COUNT(*) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID = SUPPLY_MNG.OBJID::VARCHAR AND DOC_TYPE = 'BUS_REG_CERT' AND UPPER(STATUS) = 'ACTIVE') AS BUS_REG_FILE_CNT
|
||||
,case UPPER(STATUS)
|
||||
when 'ACTIVE' then '활성화'
|
||||
when 'INACTIVE' then '비활성화'
|
||||
@@ -2279,10 +2301,13 @@ SELECT
|
||||
,SUPPLY_BUSNAME
|
||||
,SUPPLY_STOCKNAME
|
||||
,SUPPLY_TEL_NO
|
||||
,REG_ID
|
||||
,TO_CHAR(REG_DATE,'YYYY-MM-DD') REGDATE
|
||||
,STATUS
|
||||
,CHARGE_USER_NAME
|
||||
,REG_ID
|
||||
,TO_CHAR(REG_DATE,'YYYY-MM-DD') REGDATE
|
||||
,STATUS
|
||||
,COALESCE(NULLIF(MANAGER1_NAME, ''), NULLIF(MANAGER2_NAME, ''), NULLIF(MANAGER3_NAME, ''), NULLIF(MANAGER4_NAME, ''), MANAGER5_NAME) AS MANAGER1_NAME
|
||||
,COALESCE(NULLIF(MANAGER1_EMAIL, ''), NULLIF(MANAGER2_EMAIL, ''), NULLIF(MANAGER3_EMAIL, ''), NULLIF(MANAGER4_EMAIL, ''), MANAGER5_EMAIL) AS MANAGER1_EMAIL
|
||||
,(SELECT COUNT(*) FROM ATTACH_FILE_INFO WHERE TARGET_OBJID = SUPPLY_MNG.OBJID::VARCHAR AND DOC_TYPE = 'BUS_REG_CERT' AND UPPER(STATUS) = 'ACTIVE') AS BUS_REG_FILE_CNT
|
||||
,CHARGE_USER_NAME
|
||||
,case UPPER(STATUS)
|
||||
when 'ACTIVE' then '활성화'
|
||||
when 'INACTIVE' then '비활성화'
|
||||
@@ -2295,6 +2320,9 @@ SELECT
|
||||
<if test="supply_name != null and supply_name != ''">
|
||||
AND UPPER(SUPPLY_NAME) LIKE UPPER('%${supply_name}%')
|
||||
</if>
|
||||
<if test="manager_name != null and manager_name != ''">
|
||||
AND UPPER(MANAGER1_NAME) LIKE UPPER('%${manager_name}%')
|
||||
</if>
|
||||
<if test="searchStatus != null and searchStatus != ''">
|
||||
AND UPPER(STATUS) LIKE UPPER('%${searchStatus}%')
|
||||
</if>
|
||||
@@ -2357,6 +2385,16 @@ SELECT
|
||||
,OFFICE_NO
|
||||
,EMAIL
|
||||
,CUS_NO
|
||||
,MANAGER1_NAME
|
||||
,MANAGER1_EMAIL
|
||||
,MANAGER2_NAME
|
||||
,MANAGER2_EMAIL
|
||||
,MANAGER3_NAME
|
||||
,MANAGER3_EMAIL
|
||||
,MANAGER4_NAME
|
||||
,MANAGER4_EMAIL
|
||||
,MANAGER5_NAME
|
||||
,MANAGER5_EMAIL
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
@@ -2379,25 +2417,45 @@ SELECT
|
||||
,#{office_no }
|
||||
,#{email }
|
||||
,(SELECT 'CUS-' || LPAD((SELECT MAX(SUBSTR(CUS_NO,5,8))::INTEGER+1 FROM SUPPLY_MNG)::VARCHAR,4,'0'))
|
||||
,#{manager1_name }
|
||||
,#{manager1_email }
|
||||
,#{manager2_name }
|
||||
,#{manager2_email }
|
||||
,#{manager3_name }
|
||||
,#{manager3_email }
|
||||
,#{manager4_name }
|
||||
,#{manager4_email }
|
||||
,#{manager5_name }
|
||||
,#{manager5_email }
|
||||
)
|
||||
ON CONFLICT (OBJID) DO
|
||||
UPDATE
|
||||
SET
|
||||
SUPPLY_CODE =#{supply_code }
|
||||
,SUPPLY_NAME =#{supply_name }
|
||||
,REG_NO =#{reg_no }
|
||||
,SUPPLY_ADDRESS =#{supply_address }
|
||||
,SUPPLY_BUSNAME =#{supply_busname }
|
||||
,SUPPLY_STOCKNAME =#{supply_stockname }
|
||||
,SUPPLY_TEL_NO =#{supply_tel_no }
|
||||
,SUPPLY_FAX_NO =#{supply_fax_no }
|
||||
,CHARGE_USER_NAME =#{charge_user_name }
|
||||
,PAYMENT_METHOD =#{payment_method }
|
||||
,REG_ID =#{reg_id }
|
||||
,AREA_CD =#{area_cd }
|
||||
,BUS_REG_NO =#{bus_reg_no }
|
||||
,OFFICE_NO =#{office_no }
|
||||
,EMAIL =#{email }
|
||||
SUPPLY_CODE =#{supply_code }
|
||||
,SUPPLY_NAME =#{supply_name }
|
||||
,REG_NO =#{reg_no }
|
||||
,SUPPLY_ADDRESS =#{supply_address }
|
||||
,SUPPLY_BUSNAME =#{supply_busname }
|
||||
,SUPPLY_STOCKNAME =#{supply_stockname }
|
||||
,SUPPLY_TEL_NO =#{supply_tel_no }
|
||||
,SUPPLY_FAX_NO =#{supply_fax_no }
|
||||
,CHARGE_USER_NAME =#{charge_user_name }
|
||||
,PAYMENT_METHOD =#{payment_method }
|
||||
,REG_ID =#{reg_id }
|
||||
,AREA_CD =#{area_cd }
|
||||
,BUS_REG_NO =#{bus_reg_no }
|
||||
,OFFICE_NO =#{office_no }
|
||||
,EMAIL =#{email }
|
||||
,MANAGER1_NAME =#{manager1_name }
|
||||
,MANAGER1_EMAIL =#{manager1_email }
|
||||
,MANAGER2_NAME =#{manager2_name }
|
||||
,MANAGER2_EMAIL =#{manager2_email }
|
||||
,MANAGER3_NAME =#{manager3_name }
|
||||
,MANAGER3_EMAIL =#{manager3_email }
|
||||
,MANAGER4_NAME =#{manager4_name }
|
||||
,MANAGER4_EMAIL =#{manager4_email }
|
||||
,MANAGER5_NAME =#{manager5_name }
|
||||
,MANAGER5_EMAIL =#{manager5_email }
|
||||
</update>
|
||||
|
||||
|
||||
@@ -4257,33 +4315,40 @@ WHERE
|
||||
AND PAID_TYPE = #{paid_type}
|
||||
</if>
|
||||
|
||||
<if test="search_partNo != null and search_partNo != ''">
|
||||
AND UPPER(PART_NO) LIKE UPPER('%${search_partNo}%')
|
||||
</if>
|
||||
|
||||
<if test="search_partName != null and search_partName != ''">
|
||||
AND UPPER(PART_NAME) LIKE UPPER('%${search_partName}%')
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="receipt_start_date != null and !''.equals(receipt_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{receipt_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="receipt_end_date != null and !''.equals(receipt_end_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{receipt_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<!-- 품번/품명 검색: PART_OBJID로 정확하게 검색 -->
|
||||
<if test="search_partObjId != null and search_partObjId != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM CONTRACT_ITEM CI
|
||||
WHERE CI.CONTRACT_OBJID = T.OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND CI.PART_OBJID = #{search_partObjId}
|
||||
)
|
||||
</if>
|
||||
|
||||
<if test="search_serialNo != null and search_serialNo != ''">
|
||||
AND UPPER(SERIAL_NO) LIKE UPPER('%${search_serialNo}%')
|
||||
</if>
|
||||
|
||||
<if test="search_poNo != null and search_poNo != ''">
|
||||
AND UPPER(PO_NO) LIKE UPPER('%${search_poNo}%')
|
||||
</if>
|
||||
|
||||
<if test="order_start_date != null and !''.equals(order_start_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{order_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="order_end_date != null and !''.equals(order_end_date)">
|
||||
AND TO_DATE(ORDER_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{order_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(RECEIPT_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
<if test="due_start_date != null and !''.equals(due_start_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ >= ]]> TO_DATE(#{due_start_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="due_end_date != null and !''.equals(due_end_date)">
|
||||
AND TO_DATE(DUE_DATE,'YYYY-MM-DD') <![CDATA[ <= ]]> TO_DATE(#{due_end_date}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
ORDER BY REGDATE DESC
|
||||
</select>
|
||||
|
||||
<!-- 영업정보 조회 (수주등록용) -->
|
||||
<select id="getContractInfo" parameterType="map" resultType="map">
|
||||
@@ -4436,10 +4501,20 @@ WHERE
|
||||
AND OBJID = #{partObjId}
|
||||
</if>
|
||||
<if test="searchTerm != null and searchTerm != ''">
|
||||
AND (
|
||||
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
)
|
||||
<choose>
|
||||
<when test="searchType == 'partNo'">
|
||||
AND UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
</when>
|
||||
<when test="searchType == 'partName'">
|
||||
AND UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (
|
||||
UPPER(PART_NO) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
OR UPPER(PART_NAME) LIKE '%' || UPPER(#{searchTerm}) || '%'
|
||||
)
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
ORDER BY
|
||||
PART_NO
|
||||
|
||||
@@ -863,28 +863,46 @@
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CI.PART_OBJID = T.PART_OBJID
|
||||
AND CI.STATUS = 'ACTIVE') AS CUSTOMER_REQUEST,
|
||||
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
|
||||
T.PO_NO,
|
||||
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
|
||||
CASE WHEN EXISTS(
|
||||
SELECT 1 FROM ATTACH_FILE_INFO
|
||||
WHERE TARGET_OBJID = T.CONTRACT_OBJID
|
||||
AND DOC_TYPE='ORDER_DOC'
|
||||
AND UPPER(STATUS) = 'ACTIVE'
|
||||
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
|
||||
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
|
||||
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
|
||||
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
|
||||
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
|
||||
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
|
||||
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
|
||||
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
|
||||
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
|
||||
CODE_NAME(T.CONTRACT_RESULT) AS ORDER_STATUS,
|
||||
(SELECT CM.PO_NO FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PO_NO,
|
||||
COALESCE(T.CONTRACT_DATE, (SELECT CM.order_date FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID)) AS ORDER_DATE,
|
||||
CASE WHEN EXISTS(
|
||||
SELECT 1 FROM ATTACH_FILE_INFO
|
||||
WHERE TARGET_OBJID = T.CONTRACT_OBJID
|
||||
AND DOC_TYPE='ORDER_DOC'
|
||||
AND UPPER(STATUS) = 'ACTIVE'
|
||||
) THEN 'Y' ELSE 'N' END AS ORDER_ATTACH,
|
||||
(SELECT CM.PRODUCTION_STATUS FROM CONTRACT_MGMT CM WHERE CM.OBJID = T.CONTRACT_OBJID) AS PRODUCTION_STATUS,
|
||||
-- 판매 관련 필드들 (sales_registration 테이블에서 한 번에 가져오기)
|
||||
COALESCE(SR.shipping_order_status, '') AS SHIPPING_ORDER_STATUS,
|
||||
COALESCE(SR.sales_quantity, 0) AS SALES_QUANTITY,
|
||||
COALESCE(SR.sales_unit_price, 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SR.sales_supply_price, 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SR.sales_vat, 0) AS SALES_VAT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT,
|
||||
COALESCE(SR.sales_total_amount, 0) AS SALES_TOTAL_AMOUNT_KRW,
|
||||
-- 잔량 계산: 수주수량 - 판매수량
|
||||
COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0) AS REMAINING_QUANTITY,
|
||||
-- 잔량원화총액 계산: (수주수량 - 판매수량) * 판매단가
|
||||
(COALESCE(T.QUANTITY::numeric, 0) - COALESCE(SR.sales_quantity, 0)) * COALESCE(SR.sales_unit_price, 0) AS REMAINING_AMOUNT_KRW,
|
||||
COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY) AS SALES_CURRENCY,
|
||||
CODE_NAME(COALESCE(SR.sales_currency, T.CONTRACT_CURRENCY)) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(SR.sales_exchange_rate, T.CONTRACT_PRICE_CURRENCY::numeric, 0) AS SALES_EXCHANGE_RATE,
|
||||
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '') AS SHIPPING_DATE,
|
||||
-- 출하일 (분할출하 포함): 엑셀 다운로드용
|
||||
COALESCE(
|
||||
(SELECT
|
||||
CASE
|
||||
WHEN COUNT(DISTINCT shipping_date) = 0 THEN ''
|
||||
WHEN COUNT(DISTINCT shipping_date) = 1 THEN TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD')
|
||||
ELSE TO_CHAR(MIN(shipping_date), 'YYYY-MM-DD') || '외' || (COUNT(DISTINCT shipping_date) - 1)::TEXT
|
||||
END
|
||||
FROM shipment_log
|
||||
WHERE target_objid = T.OBJID::VARCHAR
|
||||
AND shipping_date IS NOT NULL
|
||||
AND UPPER(COALESCE(shipping_status, '')) != 'CANCELLED'),
|
||||
COALESCE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), '')
|
||||
) AS SHIPPING_DATE_WITH_COUNT,
|
||||
COALESCE(SR.shipping_method, '') AS SHIPPING_METHOD,
|
||||
COALESCE(
|
||||
(SELECT USER_NAME FROM USER_INFO WHERE USER_ID = SR.manager_user_id),
|
||||
@@ -929,60 +947,103 @@
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
|
||||
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
|
||||
</select>
|
||||
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
|
||||
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
|
||||
AND (
|
||||
<if test="search_partNo != null and search_partNo != ''">
|
||||
T.PART_NO = #{search_partNo}
|
||||
</if>
|
||||
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
|
||||
OR
|
||||
</if>
|
||||
<if test="search_partName != null and search_partName != ''">
|
||||
T.PART_NAME = #{search_partName}
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CI.PART_OBJID = T.PART_OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
|
||||
)
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND SR.shipping_order_status = #{shippingStatus}
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="salesStatus != null and salesStatus != ''">
|
||||
<choose>
|
||||
<when test="salesStatus == 'NOT_CLOSED'">
|
||||
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND T.SALES_STATUS = #{salesStatus}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 매출마감 기간 검색 -->
|
||||
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
-- 등록일 기준 최신순 정렬 (프로젝트 번호는 보조 정렬)
|
||||
ORDER BY T.REGDATE DESC, T.PROJECT_NO DESC
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 그리드 목록 개수 - project_mgmt 테이블 기반 -->
|
||||
<select id="getSalesMgmtGridListCount" parameterType="map" resultType="map">
|
||||
@@ -1023,58 +1084,113 @@
|
||||
)
|
||||
)
|
||||
</if>
|
||||
<if test="productNo != null and productNo != ''">
|
||||
AND T.PART_NO LIKE CONCAT('%', #{productNo}, '%')
|
||||
</if>
|
||||
<if test="productName != null and productName != ''">
|
||||
AND T.PART_NAME LIKE CONCAT('%', #{productName}, '%')
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CIS.SERIAL_NO LIKE CONCAT('%', #{serialNo}, '%')
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND T.PO_NO LIKE CONCAT('%', #{poNo}, '%')
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[>=]]> #{orderDateFrom}
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND T.CONTRACT_DATE <![CDATA[<=]]> #{orderDateTo}
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
/* SALES_STATUS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
/* SHIPPING_DATE 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
</select>
|
||||
<!-- 품번/품명 검색: PART_NO 또는 PART_NAME으로 검색 (한글 포함) -->
|
||||
<if test="(search_partNo != null and search_partNo != '') or (search_partName != null and search_partName != '')">
|
||||
AND (
|
||||
<if test="search_partNo != null and search_partNo != ''">
|
||||
T.PART_NO = #{search_partNo}
|
||||
</if>
|
||||
<if test="(search_partNo != null and search_partNo != '') and (search_partName != null and search_partName != '')">
|
||||
OR
|
||||
</if>
|
||||
<if test="search_partName != null and search_partName != ''">
|
||||
T.PART_NAME = #{search_partName}
|
||||
</if>
|
||||
)
|
||||
</if>
|
||||
<if test="serialNo != null and serialNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_ITEM CI
|
||||
JOIN CONTRACT_ITEM_SERIAL CIS ON CI.OBJID = CIS.ITEM_OBJID
|
||||
WHERE CI.CONTRACT_OBJID = T.CONTRACT_OBJID
|
||||
AND CI.PART_OBJID = T.PART_OBJID
|
||||
AND CI.STATUS = 'ACTIVE'
|
||||
AND UPPER(CIS.SERIAL_NO) LIKE UPPER(CONCAT('%', #{serialNo}, '%'))
|
||||
AND UPPER(CIS.STATUS) = 'ACTIVE'
|
||||
)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">
|
||||
AND T.CONTRACT_RESULT = #{orderStatus}
|
||||
</if>
|
||||
<if test="poNo != null and poNo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND UPPER(CM.PO_NO) LIKE UPPER(CONCAT('%', #{poNo}, '%'))
|
||||
)
|
||||
</if>
|
||||
<if test="requestDateFrom != null and requestDateFrom != ''">
|
||||
AND T.DUE_DATE <![CDATA[>=]]> #{requestDateFrom}
|
||||
</if>
|
||||
<if test="requestDateTo != null and requestDateTo != ''">
|
||||
AND T.DUE_DATE <![CDATA[<=]]> #{requestDateTo}
|
||||
</if>
|
||||
<if test="orderDateFrom != null and orderDateFrom != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{orderDateFrom}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="orderDateTo != null and orderDateTo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM CONTRACT_MGMT CM
|
||||
WHERE CM.OBJID = T.CONTRACT_OBJID
|
||||
AND TO_DATE(CM.ORDER_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{orderDateTo}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingStatus != null and shippingStatus != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM sales_registration SR
|
||||
WHERE T.PROJECT_NO = SR.project_no
|
||||
AND SR.shipping_order_status = #{shippingStatus}
|
||||
)
|
||||
</if>
|
||||
<if test="shippingDateFrom != null and shippingDateFrom != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM sales_registration SR
|
||||
WHERE T.PROJECT_NO = SR.project_no
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{shippingDateFrom}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingDateTo != null and shippingDateTo != ''">
|
||||
AND EXISTS (
|
||||
SELECT 1 FROM sales_registration SR
|
||||
WHERE T.PROJECT_NO = SR.project_no
|
||||
AND SR.shipping_date IS NOT NULL
|
||||
AND TO_DATE(TO_CHAR(SR.shipping_date, 'YYYY-MM-DD'), 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{shippingDateTo}, 'YYYY-MM-DD')
|
||||
)
|
||||
</if>
|
||||
<if test="shippingMethod != null and shippingMethod != ''">
|
||||
/* SHIPPING_METHOD 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="manager != null and manager != ''">
|
||||
AND T.PM_USER_ID = #{manager}
|
||||
</if>
|
||||
<if test="incoterms != null and incoterms != ''">
|
||||
/* INCOTERMS 필드 없음 - 검색 조건 무시 */
|
||||
</if>
|
||||
<if test="salesStatus != null and salesStatus != ''">
|
||||
<choose>
|
||||
<when test="salesStatus == 'NOT_CLOSED'">
|
||||
AND (T.SALES_STATUS IS NULL OR T.SALES_STATUS = '' OR T.SALES_STATUS != '완료')
|
||||
</when>
|
||||
<otherwise>
|
||||
AND T.SALES_STATUS = #{salesStatus}
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<!-- 매출마감 기간 검색 -->
|
||||
<if test="salesDeadlineFrom != null and salesDeadlineFrom != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[>=]]> TO_DATE(#{salesDeadlineFrom}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
<if test="salesDeadlineTo != null and salesDeadlineTo != ''">
|
||||
AND T.SALES_DEADLINE_DATE IS NOT NULL
|
||||
AND TO_DATE(T.SALES_DEADLINE_DATE, 'YYYY-MM-DD') <![CDATA[<=]]> TO_DATE(#{salesDeadlineTo}, 'YYYY-MM-DD')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 매출관리 합계 조회 (Total 공급가액, 부가세, 총액) -->
|
||||
<select id="getSalesMgmtTotals" parameterType="map" resultType="map">
|
||||
@@ -1393,5 +1509,115 @@
|
||||
WHERE T.PROJECT_NO = #{orderNo}
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 주문서 관리에서 수주 데이터 조회 (판매등록용)
|
||||
* CONTRACT_ITEM 테이블에서 수주 정보를 가져와 판매등록 폼에 자동 채우기
|
||||
* @since 2025.11.10
|
||||
* @author assistant
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<select id="getOrderDataForSale" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getOrderDataForSale - 주문서 관리에서 판매등록용 수주 데이터 조회 */
|
||||
SELECT
|
||||
-- 기본 정보
|
||||
CM.CONTRACT_NO AS ORDER_NO,
|
||||
CM.OBJID AS CONTRACT_OBJID,
|
||||
|
||||
-- 수주 금액 정보 (CONTRACT_ITEM 테이블에서 합산) - VARCHAR 타입이므로 NUMERIC으로 캐스팅
|
||||
COALESCE(SUM(CI.ORDER_QUANTITY::NUMERIC), 0) AS SALES_QUANTITY,
|
||||
COALESCE(ROUND(AVG(CI.ORDER_UNIT_PRICE::NUMERIC), 2), 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_SUPPLY_PRICE::NUMERIC), 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_VAT::NUMERIC), 0) AS SALES_VAT,
|
||||
COALESCE(SUM(CI.ORDER_TOTAL_AMOUNT::NUMERIC), 0) AS SALES_TOTAL_AMOUNT,
|
||||
|
||||
-- 환종 정보
|
||||
CM.CONTRACT_CURRENCY AS SALES_CURRENCY,
|
||||
CODE_NAME(CM.CONTRACT_CURRENCY) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(CM.EXCHANGE_RATE::NUMERIC, 0) AS SALES_EXCHANGE_RATE,
|
||||
|
||||
-- 수주 날짜 - VARCHAR 타입이므로 그대로 사용
|
||||
CM.ORDER_DATE AS SHIPPING_DATE,
|
||||
|
||||
-- 담당자
|
||||
CM.PM_USER_ID AS MANAGER
|
||||
|
||||
FROM CONTRACT_MGMT CM
|
||||
LEFT JOIN CONTRACT_ITEM CI ON CM.OBJID::VARCHAR = CI.CONTRACT_OBJID AND UPPER(CI.STATUS) = 'ACTIVE'
|
||||
WHERE CM.OBJID = #{contractObjId}::NUMERIC
|
||||
GROUP BY
|
||||
CM.CONTRACT_NO,
|
||||
CM.OBJID,
|
||||
CM.CONTRACT_CURRENCY,
|
||||
CM.EXCHANGE_RATE,
|
||||
CM.ORDER_DATE,
|
||||
CM.PM_USER_ID
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* orderNo(PROJECT_NO)로 수주 데이터 조회 (판매등록용)
|
||||
* PROJECT_MGMT에서 CONTRACT_OBJID를 찾아서 수주 데이터 조회
|
||||
* @since 2025.11.10
|
||||
* @author assistant
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<select id="getOrderDataByOrderNo" parameterType="map" resultType="map">
|
||||
/* salesNcollectMgmt.getOrderDataByOrderNo - orderNo로 판매등록용 수주 데이터 조회 */
|
||||
SELECT
|
||||
-- 기본 정보
|
||||
CM.CONTRACT_NO AS ORDER_NO,
|
||||
CM.OBJID AS CONTRACT_OBJID,
|
||||
|
||||
-- 수주 금액 정보 (CONTRACT_ITEM 테이블에서 합산) - VARCHAR 타입이므로 NUMERIC으로 캐스팅
|
||||
COALESCE(SUM(CI.ORDER_QUANTITY::NUMERIC), 0) AS SALES_QUANTITY,
|
||||
COALESCE(ROUND(AVG(CI.ORDER_UNIT_PRICE::NUMERIC), 2), 0) AS SALES_UNIT_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_SUPPLY_PRICE::NUMERIC), 0) AS SALES_SUPPLY_PRICE,
|
||||
COALESCE(SUM(CI.ORDER_VAT::NUMERIC), 0) AS SALES_VAT,
|
||||
COALESCE(SUM(CI.ORDER_TOTAL_AMOUNT::NUMERIC), 0) AS SALES_TOTAL_AMOUNT,
|
||||
|
||||
-- 환종 정보
|
||||
CM.CONTRACT_CURRENCY AS SALES_CURRENCY,
|
||||
CODE_NAME(CM.CONTRACT_CURRENCY) AS SALES_CURRENCY_NAME,
|
||||
COALESCE(CM.EXCHANGE_RATE::NUMERIC, 0) AS SALES_EXCHANGE_RATE,
|
||||
|
||||
-- 수주 날짜 - VARCHAR 타입이므로 그대로 사용
|
||||
CM.ORDER_DATE AS SHIPPING_DATE,
|
||||
|
||||
-- 담당자
|
||||
CM.PM_USER_ID AS MANAGER
|
||||
|
||||
FROM PROJECT_MGMT PM
|
||||
INNER JOIN CONTRACT_MGMT CM ON PM.CONTRACT_OBJID = CM.OBJID
|
||||
LEFT JOIN CONTRACT_ITEM CI ON CM.OBJID::VARCHAR = CI.CONTRACT_OBJID AND UPPER(CI.STATUS) = 'ACTIVE'
|
||||
WHERE PM.PROJECT_NO = #{orderNo}
|
||||
GROUP BY
|
||||
CM.CONTRACT_NO,
|
||||
CM.OBJID,
|
||||
CM.CONTRACT_CURRENCY,
|
||||
CM.EXCHANGE_RATE,
|
||||
CM.ORDER_DATE,
|
||||
CM.PM_USER_ID
|
||||
</select>
|
||||
|
||||
<!--
|
||||
/**
|
||||
* 매출마감 처리
|
||||
* @since 2025.11.10
|
||||
* @author system
|
||||
* @version 1.0
|
||||
**/
|
||||
-->
|
||||
<update id="salesDeadlineConfirm" parameterType="map">
|
||||
/* salesNcollectMgmt.salesDeadlineConfirm - PROJECT_MGMT의 SALES_STATUS를 '완료'로 업데이트 및 매출마감일 저장 */
|
||||
UPDATE PROJECT_MGMT
|
||||
SET
|
||||
SALES_STATUS = '완료',
|
||||
SALES_DEADLINE_DATE = #{deadlineDate}
|
||||
WHERE OBJID::VARCHAR = #{OBJID}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
||||
@@ -2041,6 +2041,86 @@ private String encodeImageToBase64(String imagePath) {
|
||||
return items;
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 템플릿 품목 조회 (수주등록용)
|
||||
* 최종 견적서의 품목 정보를 수주등록 형식으로 변환하여 반환
|
||||
* @param paramMap - contractObjId
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public List<Map> getEstimateTemplateItemsForOrder(Map paramMap){
|
||||
SqlSession sqlSession = null;
|
||||
List<Map> items = new ArrayList<Map>();
|
||||
|
||||
try{
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
|
||||
// 1. 최종 견적서 템플릿 조회
|
||||
Map templateParam = new HashMap();
|
||||
templateParam.put("objId", paramMap.get("contractObjId"));
|
||||
Map template = sqlSession.selectOne("contractMgmt.getEstimateTemplateData", templateParam);
|
||||
|
||||
if(template != null) {
|
||||
// 2. 견적서 템플릿의 품목 조회
|
||||
Map itemParam = new HashMap();
|
||||
itemParam.put("templateObjId", template.get("objid"));
|
||||
List<Map> templateItems = sqlSession.selectList("contractMgmt.getEstimateTemplateItemsByTemplateObjId", itemParam);
|
||||
|
||||
// 3. 수주등록 형식으로 변환
|
||||
for(Map templateItem : templateItems) {
|
||||
Map orderItem = new HashMap();
|
||||
|
||||
// ESTIMATE_TEMPLATE_ITEM -> CONTRACT_ITEM 형식으로 매핑
|
||||
orderItem.put("OBJID", templateItem.get("objid")); // 템플릿 품목 OBJID (참고용)
|
||||
orderItem.put("CONTRACT_OBJID", paramMap.get("contractObjId"));
|
||||
orderItem.put("PART_OBJID", templateItem.get("part_objid"));
|
||||
orderItem.put("PART_NO", templateItem.get("description")); // 품명
|
||||
orderItem.put("PART_NAME", templateItem.get("description")); // 품명
|
||||
orderItem.put("SERIAL_NO", ""); // S/N은 비워둠
|
||||
orderItem.put("QUANTITY", templateItem.get("quantity")); // 수량
|
||||
orderItem.put("DUE_DATE", "");
|
||||
orderItem.put("CUSTOMER_REQUEST", "");
|
||||
orderItem.put("RETURN_REASON", "");
|
||||
|
||||
// 수주 정보는 견적서 값으로 초기화
|
||||
orderItem.put("ORDER_QUANTITY", templateItem.get("quantity"));
|
||||
orderItem.put("ORDER_UNIT_PRICE", templateItem.get("unit_price"));
|
||||
|
||||
// 공급가액 계산 (수량 * 단가)
|
||||
Object quantity = templateItem.get("quantity");
|
||||
Object unitPrice = templateItem.get("unit_price");
|
||||
long supplyPrice = 0;
|
||||
|
||||
if(quantity != null && unitPrice != null) {
|
||||
try {
|
||||
long qty = Long.parseLong(quantity.toString().replaceAll("[^0-9]", ""));
|
||||
long price = Long.parseLong(unitPrice.toString().replaceAll("[^0-9]", ""));
|
||||
supplyPrice = qty * price;
|
||||
} catch(Exception e) {
|
||||
// 계산 실패 시 0
|
||||
}
|
||||
}
|
||||
|
||||
orderItem.put("ORDER_SUPPLY_PRICE", supplyPrice);
|
||||
orderItem.put("ORDER_VAT", Math.round(supplyPrice * 0.1)); // 부가세 10%
|
||||
orderItem.put("ORDER_TOTAL_AMOUNT", supplyPrice + Math.round(supplyPrice * 0.1));
|
||||
|
||||
items.add(orderItem);
|
||||
}
|
||||
|
||||
// 대문자 변환
|
||||
items = CommonUtils.keyChangeUpperList(items);
|
||||
}
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
if(sqlSession != null) sqlSession.close();
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public Map saveOrderInfo(HttpServletRequest request, Map paramMap){
|
||||
Map resultMap = new HashMap();
|
||||
|
||||
@@ -259,6 +259,58 @@ public class SalesNcollectMgmtService {
|
||||
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 주문서 관리에서 수주 데이터 조회 (판매등록용)
|
||||
* CONTRACT_ITEM 테이블에서 수주 정보를 가져와 판매등록 폼에 자동 채우기
|
||||
* </pre>
|
||||
* @param paramMap - contractObjId
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public Map<String, Object> getOrderDataForSale(Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultMap = sqlSession.selectOne("salesNcollectMgmt.getOrderDataForSale", paramMap);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* orderNo(PROJECT_NO)로 수주 데이터 조회 (판매등록용)
|
||||
* PROJECT_MGMT에서 CONTRACT_OBJID를 찾아서 수주 데이터 조회
|
||||
* </pre>
|
||||
* @param paramMap - orderNo
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
public Map<String, Object> getOrderDataByOrderNo(Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
SqlSession sqlSession = null;
|
||||
|
||||
try {
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
resultMap = sqlSession.selectOne("salesNcollectMgmt.getOrderDataByOrderNo", paramMap);
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(sqlSession != null) {
|
||||
sqlSession.close();
|
||||
}
|
||||
}
|
||||
|
||||
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||||
}
|
||||
|
||||
public Map<String, Object> saveSaleRegistration(HttpServletRequest request, Map<String, Object> paramMap) {
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
SqlSession sqlSession = null;
|
||||
@@ -802,34 +854,65 @@ public class SalesNcollectMgmtService {
|
||||
Map resultMap = new HashMap();
|
||||
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||||
try{
|
||||
System.out.println("===== 매출마감 처리 시작 =====");
|
||||
System.out.println("paramMap: " + paramMap);
|
||||
|
||||
/*String checkParam = CommonUtils.checkNull(paramMap.get("checkArr"));
|
||||
String[] targetObjIdList = checkParam.split(",");
|
||||
String objIdListStr = CommonUtils.checkNull(paramMap.get("objIdList"));
|
||||
String deadlineDate = CommonUtils.checkNull(paramMap.get("deadlineDate"));
|
||||
|
||||
if(null != targetObjIdList && 0 < targetObjIdList.length){*/
|
||||
|
||||
System.out.println("objIdListStr: " + objIdListStr);
|
||||
System.out.println("deadlineDate: " + deadlineDate);
|
||||
|
||||
if(objIdListStr == null || objIdListStr.isEmpty()){
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "선택된 항목이 없습니다.");
|
||||
System.out.println("에러: 선택된 항목 없음");
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
if(deadlineDate == null || deadlineDate.isEmpty()){
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "매출마감일을 입력해주세요.");
|
||||
System.out.println("에러: 매출마감일 없음");
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
String[] targetObjIdList = objIdListStr.split(",");
|
||||
System.out.println("targetObjIdList 길이: " + targetObjIdList.length);
|
||||
|
||||
if(null != targetObjIdList && 0 < targetObjIdList.length){
|
||||
HttpSession session = request.getSession();
|
||||
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||||
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||||
|
||||
String userId = person.getUserId();
|
||||
System.out.println("userId: " + userId);
|
||||
|
||||
/*for(int i=0;i<targetObjIdList.length;i++){*/
|
||||
//String objId = CommonUtils.checkNull(targetObjIdList[i]);
|
||||
//HashMap sqlParamMap = new HashMap();
|
||||
//sqlParamMap.put("OBJID", objId);
|
||||
//paramMap.put("PAYMENT_DATE", CommonUtils.getDateTime(new Date(), "yyyy-MM-dd"));
|
||||
sqlSession.update("salesNcollectMgmt.salesDeadlineConfirm",paramMap);
|
||||
/*}*/
|
||||
for(int i=0; i<targetObjIdList.length; i++){
|
||||
String objId = CommonUtils.checkNull(targetObjIdList[i]);
|
||||
System.out.println("처리 중 OBJID[" + i + "]: " + objId);
|
||||
|
||||
HashMap sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("OBJID", objId);
|
||||
sqlParamMap.put("userId", userId);
|
||||
sqlParamMap.put("deadlineDate", deadlineDate);
|
||||
|
||||
System.out.println("SQL 실행 전 - sqlParamMap: " + sqlParamMap);
|
||||
int updateCount = sqlSession.update("salesNcollectMgmt.salesDeadlineConfirm", sqlParamMap);
|
||||
System.out.println("SQL 실행 결과 - 업데이트된 행 수: " + updateCount);
|
||||
}
|
||||
sqlSession.commit();
|
||||
System.out.println("커밋 완료");
|
||||
resultMap.put("result", true);
|
||||
resultMap.put("msg", "확인되었습니다");
|
||||
/*}*/
|
||||
resultMap.put("msg", targetObjIdList.length + "건의 매출마감이 완료되었습니다.");
|
||||
}
|
||||
System.out.println("===== 매출마감 처리 완료 =====");
|
||||
}catch(Exception e){
|
||||
resultMap.put("result", false);
|
||||
resultMap.put("msg", "확인에 실패하였습니다");
|
||||
resultMap.put("msg", "매출마감 처리 중 오류가 발생했습니다.");
|
||||
sqlSession.rollback();
|
||||
throw e;
|
||||
System.out.println("===== 매출마감 처리 중 예외 발생 =====");
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
sqlSession.close();
|
||||
}
|
||||
|
||||
@@ -3157,40 +3157,50 @@ public class PartMngService extends BaseService {
|
||||
// 시도할 인코딩 목록 (Windows Excel CSV 기본 인코딩 우선)
|
||||
String[] encodings = {"CP949", "UTF-8", "EUC-KR", "MS949"};
|
||||
|
||||
String bestEncoding = "UTF-8"; // 기본값
|
||||
int minReplacementChars = Integer.MAX_VALUE;
|
||||
|
||||
for (String encoding : encodings) {
|
||||
try (FileInputStream fis = new FileInputStream(file);
|
||||
InputStreamReader isr = new InputStreamReader(fis, encoding);
|
||||
BufferedReader br = new BufferedReader(isr)) {
|
||||
|
||||
// 처음 몇 줄을 읽어서 깨진 문자 여부 확인
|
||||
// 처음 몇 줄을 읽어서 깨진 문자 개수 확인
|
||||
String line;
|
||||
int lineCount = 0;
|
||||
boolean hasBrokenChar = false;
|
||||
int replacementCharCount = 0;
|
||||
|
||||
while ((line = br.readLine()) != null && lineCount < 10) {
|
||||
// 깨진 문자 검사 (<28> 또는 replacement character)
|
||||
if (line.contains("\uFFFD") || line.contains("?")) {
|
||||
hasBrokenChar = true;
|
||||
break;
|
||||
// replacement character (\uFFFD) 개수 세기
|
||||
for (int i = 0; i < line.length(); i++) {
|
||||
if (line.charAt(i) == '\uFFFD') {
|
||||
replacementCharCount++;
|
||||
}
|
||||
}
|
||||
lineCount++;
|
||||
}
|
||||
|
||||
// 깨진 문자가 없으면 이 인코딩이 올바른 것으로 판단
|
||||
if (!hasBrokenChar && lineCount > 0) {
|
||||
System.out.println("CSV 인코딩 감지 성공: " + encoding);
|
||||
// 깨진 문자가 없으면 바로 이 인코딩 사용
|
||||
if (replacementCharCount == 0 && lineCount > 0) {
|
||||
System.out.println("CSV 인코딩 감지 성공: " + encoding + " (깨진 문자 없음)");
|
||||
return encoding;
|
||||
}
|
||||
|
||||
// 깨진 문자가 가장 적은 인코딩 기억
|
||||
if (replacementCharCount < minReplacementChars) {
|
||||
minReplacementChars = replacementCharCount;
|
||||
bestEncoding = encoding;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
// 이 인코딩으로 읽기 실패 시 다음 인코딩 시도
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 모든 시도 실패 시 기본값 UTF-8 반환
|
||||
System.out.println("CSV 인코딩 감지 실패, 기본값 UTF-8 사용");
|
||||
return "UTF-8";
|
||||
// 가장 적은 깨진 문자를 가진 인코딩 사용
|
||||
System.out.println("CSV 인코딩 감지 완료: " + bestEncoding + " (replacement chars: " + minReplacementChars + ")");
|
||||
return bestEncoding;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3334,23 +3344,38 @@ public class PartMngService extends BaseService {
|
||||
|
||||
// PART_TYPE 코드 조회
|
||||
String partTypeCode = "";
|
||||
if(!StringUtils.isBlank(partType) && rowIndex > 2) {
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("CODE_NAME", partType);
|
||||
String partNoForCheck = CommonUtils.checkNull(partNo);
|
||||
sqlParamMap.put("partNo", partNoForCheck);
|
||||
Map partTypeMap = sqlSession.selectOne("partMng.parttypeInfo", sqlParamMap);
|
||||
if(null != partTypeMap && !StringUtils.isBlank((String)partTypeMap.get("code_id"))){
|
||||
partTypeCode = (String)partTypeMap.get("code_id");
|
||||
} else {
|
||||
noteMsg += "부품유형 확인:" + partType + ";";
|
||||
if(!StringUtils.isBlank(partType)) {
|
||||
// CSV 영문 범주명을 한글로 변환 (Unassigned→조립품, Buy→구매품, Make→부품)
|
||||
String partTypeForQuery = partType.trim();
|
||||
String partTypeUpper = partTypeForQuery.toUpperCase();
|
||||
|
||||
if("UNASSIGNED".equals(partTypeUpper)) {
|
||||
partTypeForQuery = "조립품";
|
||||
} else if("BUY".equals(partTypeUpper)) {
|
||||
partTypeForQuery = "구매품";
|
||||
} else if("MAKE".equals(partTypeUpper)) {
|
||||
partTypeForQuery = "부품";
|
||||
}
|
||||
} else if(!StringUtils.isBlank(partType) && rowIndex <= 2) {
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("CODE_NAME", partType);
|
||||
Map partTypeMap = sqlSession.selectOne("partMng.parttypeInfo", sqlParamMap);
|
||||
if(null != partTypeMap && !StringUtils.isBlank((String)partTypeMap.get("code_id"))){
|
||||
partTypeCode = (String)partTypeMap.get("code_id");
|
||||
|
||||
// 변환된 값으로 DB 조회 (기존 방식)
|
||||
if(rowIndex > 2) {
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("CODE_NAME", partTypeForQuery);
|
||||
String partNoForCheck = CommonUtils.checkNull(partNo);
|
||||
sqlParamMap.put("partNo", partNoForCheck);
|
||||
Map partTypeMap = sqlSession.selectOne("partMng.parttypeInfo", sqlParamMap);
|
||||
if(null != partTypeMap && !StringUtils.isBlank((String)partTypeMap.get("code_id"))){
|
||||
partTypeCode = (String)partTypeMap.get("code_id");
|
||||
} else {
|
||||
noteMsg += "부품유형 확인:" + partType + ";";
|
||||
}
|
||||
} else {
|
||||
Map sqlParamMap = new HashMap();
|
||||
sqlParamMap.put("CODE_NAME", partTypeForQuery);
|
||||
Map partTypeMap = sqlSession.selectOne("partMng.parttypeInfo", sqlParamMap);
|
||||
if(null != partTypeMap && !StringUtils.isBlank((String)partTypeMap.get("code_id"))){
|
||||
partTypeCode = (String)partTypeMap.get("code_id");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user