AND SR.shipping_method = #{shippingMethod}
diff --git a/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp b/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp
index e85da48..8d371ef 100644
--- a/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp
+++ b/WebContent/WEB-INF/view/quality/semiProductInspectionFormPopUp.jsp
@@ -158,6 +158,20 @@ String loginUserId = CommonUtils.checkNull(person.getUserId());
background: #2b6cb0;
}
+ .btn_edit {
+ padding: 6px 20px;
+ background: #e67e22;
+ color: white;
+ border: none;
+ border-radius: 3px;
+ cursor: pointer;
+ font-size: 12px;
+ }
+
+ .btn_edit:hover {
+ background: #d35400;
+ }
+
.btn_close {
padding: 6px 20px;
background: #718096;
@@ -232,7 +246,8 @@ String loginUserId = CommonUtils.checkNull(person.getUserId());
-
+
+
@@ -247,7 +262,9 @@ String loginUserId = CommonUtils.checkNull(person.getUserId());
+
@@ -314,8 +331,9 @@ $(document).ready(function(){
// 버튼 이벤트
$("#btnSave").click(fn_save); // 하단 저장: 전체 DB 저장
- $("#btnSaveLeft").click(fn_saveSelectedLeft); // 좌측 저장: UI 잠금만 (DB 저장 X)
- $("#btnSaveRight").click(fn_saveSelectedRight); // 우측 저장: UI 잠금만 (DB 저장 X)
+ $("#btnSaveLeft").click(fn_saveSelectedLeft); // 좌측 행저장: 락 처리
+ $("#btnEditLeft").click(fn_editSelectedLeft); // 좌측 행수정: 락 해제
+ // $("#btnSaveRight").click(fn_saveSelectedRight); // 우측 저장: 주석처리
$("#btnClose").click(function(){ window.close(); });
$("#btnAddLeft").click(fn_addLeftRow);
$("#btnDelLeft").click(fn_delLeftRow);
@@ -478,9 +496,13 @@ function fn_initLeftGrid(){
selectable: 1, // 단일 선택
// 저장된 행 시각적 표시
rowFormatter: function(row){
- if(row.getData().IS_SAVED){
+ var data = row.getData();
+ if(data.IS_SAVED || data.IS_LOCKED === 'Y'){
row.getElement().style.backgroundColor = "#e8f5e9"; // 연한 초록색
row.getElement().style.color = "#555";
+ } else {
+ row.getElement().style.backgroundColor = ""; // 원래 색상
+ row.getElement().style.color = "";
}
}
});
@@ -594,9 +616,13 @@ function fn_initRightGrid(){
selectable: true,
// 저장된 행 시각적 표시
rowFormatter: function(row){
- if(row.getData().IS_SAVED){
+ var data = row.getData();
+ if(data.IS_SAVED || data.IS_LOCKED === 'Y'){
row.getElement().style.backgroundColor = "#e8f5e9"; // 연한 초록색
row.getElement().style.color = "#555";
+ } else {
+ row.getElement().style.backgroundColor = ""; // 원래 색상
+ row.getElement().style.color = "";
}
}
});
@@ -998,6 +1024,68 @@ function fn_loadData(objid, inspectionGroupId){
});
}
+// =====================================================
+// 좌측 행수정: 락이 걸린 행을 수정 가능하도록 해제
+// =====================================================
+function fn_editSelectedLeft(){
+ console.log("===== fn_editSelectedLeft 호출됨 =====");
+
+ if(!selectedLeftRowId){
+ Swal.fire({ icon: 'warning', title: '알림', text: '수정할 양품 정보를 선택해주세요.' });
+ return;
+ }
+
+ var selectedRow = leftGrid.getSelectedRows()[0];
+ if(!selectedRow){
+ Swal.fire({ icon: 'warning', title: '알림', text: '수정할 양품 정보를 선택해주세요.' });
+ return;
+ }
+
+ var rowData = selectedRow.getData();
+
+ // 락이 걸려있지 않으면 이미 수정 가능 상태
+ if(rowData.IS_LOCKED !== 'Y' && !rowData.IS_SAVED){
+ Swal.fire({ icon: 'info', title: '알림', text: '이미 수정 가능한 상태입니다.' });
+ return;
+ }
+
+ Swal.fire({
+ icon: 'question',
+ title: '행수정',
+ text: '선택한 행의 잠금을 해제하고 수정 가능하게 하시겠습니까?',
+ showCancelButton: true,
+ confirmButtonText: '확인',
+ cancelButtonText: '취소'
+ }).then((result) => {
+ if(result.isConfirmed){
+ var objId = rowData.OBJID;
+
+ // DB에 잠금 해제 요청
+ $.ajax({
+ url: "/quality/unlockSemiProductInspection.do",
+ type: "POST",
+ data: { objIds: JSON.stringify([objId]) },
+ dataType: "json",
+ success: function(result){
+ if(result.result){
+ // UI에서 잠금 해제
+ selectedRow.update({ IS_SAVED: false, IS_LOCKED: 'N' });
+ // 행 스타일 원래대로 (초록색 -> 기본색)
+ selectedRow.getElement().style.backgroundColor = "";
+ selectedRow.getElement().style.color = "";
+ Swal.fire({ icon: 'success', title: '완료', text: '잠금이 해제되어 수정 가능합니다.' });
+ } else {
+ Swal.fire({ icon: 'error', title: '오류', text: result.msg || '잠금 해제에 실패했습니다.' });
+ }
+ },
+ error: function(xhr, status, error){
+ Swal.fire({ icon: 'error', title: '오류', text: '잠금 해제 중 오류가 발생했습니다.' });
+ }
+ });
+ }
+ });
+}
+
// =====================================================
// 좌측 행 저장+잠금: 선택된 양품 행을 DB에 저장하고 수정 불가로 변경
// =====================================================
diff --git a/src/com/pms/controller/QualityController.java b/src/com/pms/controller/QualityController.java
index 820a172..aa2e6b2 100644
--- a/src/com/pms/controller/QualityController.java
+++ b/src/com/pms/controller/QualityController.java
@@ -696,6 +696,15 @@ public class QualityController {
return service.lockSemiProductInspection(paramMap);
}
+ /**
+ * 반제품검사 잠금 해제
+ */
+ @ResponseBody
+ @RequestMapping("/quality/unlockSemiProductInspection.do")
+ public Map unlockSemiProductInspection(HttpServletRequest request, @RequestParam Map paramMap){
+ return service.unlockSemiProductInspection(paramMap);
+ }
+
/**
* 반제품검사 엑셀 다운로드 (JSP 방식)
*/
diff --git a/src/com/pms/mapper/quality.xml b/src/com/pms/mapper/quality.xml
index 62f9569..a448a55 100644
--- a/src/com/pms/mapper/quality.xml
+++ b/src/com/pms/mapper/quality.xml
@@ -1802,6 +1802,13 @@
WHERE OBJID = #{OBJID}
+
+
+ UPDATE PMS_QUALITY_SEMI_PRODUCT_INSPECTION
+ SET IS_LOCKED = 'N'
+ WHERE OBJID = #{OBJID}
+
+
DELETE FROM PMS_QUALITY_SEMI_PRODUCT_INSPECTION
diff --git a/src/com/pms/service/QualityService.java b/src/com/pms/service/QualityService.java
index 6bd95bc..e600ebd 100644
--- a/src/com/pms/service/QualityService.java
+++ b/src/com/pms/service/QualityService.java
@@ -1086,6 +1086,46 @@ public class QualityService extends BaseService{
return resultMap;
}
+ /**
+ * 반제품검사 행 잠금 해제 (IS_LOCKED = 'N')
+ */
+ public Map unlockSemiProductInspection(Map paramMap){
+ Map resultMap = new HashMap();
+ SqlSession sqlSession = null;
+ try{
+ sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
+
+ String objIdsJson = CommonUtils.checkNull(paramMap.get("objIds"));
+
+ if(!objIdsJson.equals("") && !objIdsJson.equals("[]")){
+ org.json.simple.parser.JSONParser parser = new org.json.simple.parser.JSONParser();
+ org.json.simple.JSONArray objIdArr = (org.json.simple.JSONArray) parser.parse(objIdsJson);
+
+ for(int i = 0; i < objIdArr.size(); i++){
+ String objId = CommonUtils.checkNull(objIdArr.get(i));
+ if(!objId.equals("")){
+ Map unlockParam = new HashMap();
+ unlockParam.put("OBJID", objId);
+ sqlSession.update("quality.unlockSemiProductInspection", unlockParam);
+ }
+ }
+ }
+
+ sqlSession.commit();
+ resultMap.put("result", true);
+ resultMap.put("msg", "잠금 해제되었습니다.");
+
+ }catch(Exception e){
+ resultMap.put("result", false);
+ resultMap.put("msg", "잠금 해제에 실패했습니다.");
+ if(sqlSession != null) sqlSession.rollback();
+ e.printStackTrace();
+ }finally{
+ if(sqlSession != null) sqlSession.close();
+ }
+ return resultMap;
+ }
+
/**
* 반제품검사 삭제 (OBJID 목록으로 삭제)
*/