2776 lines
137 KiB
Java
2776 lines
137 KiB
Java
|
|
package com.pms.service;
|
||
|
|
|
||
|
|
import java.io.File;
|
||
|
|
import java.io.FileNotFoundException;
|
||
|
|
import java.io.FileOutputStream;
|
||
|
|
import java.io.IOException;
|
||
|
|
import java.text.SimpleDateFormat;
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.Calendar;
|
||
|
|
import java.util.Collections;
|
||
|
|
import java.util.Comparator;
|
||
|
|
import java.util.HashMap;
|
||
|
|
import java.util.List;
|
||
|
|
import java.util.Map;
|
||
|
|
|
||
|
|
import javax.servlet.http.HttpServletRequest;
|
||
|
|
import javax.servlet.http.HttpSession;
|
||
|
|
|
||
|
|
import org.apache.commons.lang3.StringUtils;
|
||
|
|
import org.apache.ibatis.session.SqlSession;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.stereotype.Service;
|
||
|
|
|
||
|
|
import com.pms.common.JsonUtil;
|
||
|
|
import com.pms.common.Message;
|
||
|
|
import com.pms.common.SqlMapConfig;
|
||
|
|
import com.pms.common.bean.PersonBean;
|
||
|
|
import com.pms.common.utils.CommonUtils;
|
||
|
|
import com.pms.common.utils.Constants;
|
||
|
|
import com.pms.common.utils.MailUtil;
|
||
|
|
|
||
|
|
@Service
|
||
|
|
public class PurchaseOrderService {
|
||
|
|
|
||
|
|
CommonService commonService = null;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
ProjectService projectService;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
ProductionMngService productionMngService;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
InventoryMngService inventoryMngService;
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
public void setCommonService(CommonService commonService){
|
||
|
|
this.commonService = commonService;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 발주목록
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
@Deprecated
|
||
|
|
public List getPurchaseOrderMasterList(HttpServletRequest request,Map paramMap){
|
||
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
|
||
|
|
String countPerPage = CommonUtils.checkNull(request.getParameter("countPerPage"), Constants.ADMIN_COUNT_PER_PAGE+"");
|
||
|
|
paramMap.put("COUNT_PER_PAGE", Integer.parseInt(countPerPage));
|
||
|
|
Map pageMap = (HashMap)sqlSession.selectOne("purchaseOrder.purchaseOrderMasterListCnt", paramMap);
|
||
|
|
pageMap = (HashMap)CommonUtils.setPagingInfo(request, pageMap);
|
||
|
|
paramMap.put("PAGE_END", CommonUtils.checkNull(pageMap.get("PAGE_END")));
|
||
|
|
paramMap.put("PAGE_START", CommonUtils.checkNull(pageMap.get("PAGE_START")));
|
||
|
|
|
||
|
|
resultList = (ArrayList)sqlSession.selectList("purchaseOrder.purchaseOrderMasterList", paramMap);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 자사정보를 가져온다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map getMyCompanyInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map<String,Object> resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultMap = sqlSession.selectOne("purchaseOrder.getMyCompanyInfo", paramMap);
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 발주 Master의 정보를 가져온다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map getPurchaseOrderMasterInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map<String,Object> resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultMap = sqlSession.selectOne("purchaseOrder.getPurchaseOrderMasterInfo", paramMap);
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 거래명세표에서 발주 Master의 정보를 가져온다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map getPurchaseOrderMasterInfoInvoice(HttpServletRequest request,Map paramMap){
|
||
|
|
Map<String,Object> resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultMap = sqlSession.selectOne("purchaseOrder.getPurchaseOrderMasterInfoInvoice", paramMap);
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 구매 BOM 정의 후 구매의뢰 저장 후 Part 목록을 가져온다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List getPurchaseOrderTargetPartList(HttpServletRequest request,Map paramMap){
|
||
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultList = (ArrayList)sqlSession.selectList("purchaseOrder.getPurchaseOrderTargetPartList", paramMap);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 구매 BOM 정의 후 수입검사 등록 Part 목록을 가져온다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List getPurchaseOrderDeliveryTargetPartList(HttpServletRequest request,Map paramMap){
|
||
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultList = (ArrayList)sqlSession.selectList("purchaseOrder.getPurchaseOrderDeliveryTargetPartList", paramMap);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 구매 BOM을 통해서 지정된 발주대상 파트를 공급업체별로 발주서 생성한다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map saveSalesBOMPurchaseOrder(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
|
||
|
|
HttpSession session = request.getSession();
|
||
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||
|
|
|
||
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
||
|
|
|
||
|
|
paramMap.put("WRITER", writer);
|
||
|
|
|
||
|
|
String partObjList[] = request.getParameterValues("OBJID");
|
||
|
|
|
||
|
|
//선택된 파트너들로 리스트를 구성한다.
|
||
|
|
List<String> partnerList = new ArrayList();
|
||
|
|
|
||
|
|
//발주서는 업체기준으로 생성하므로 공급업체 목록을 만든다.
|
||
|
|
if(null != partObjList && 0 < partObjList.length){
|
||
|
|
for(String targetObjId:partObjList){
|
||
|
|
|
||
|
|
String partnerObjId = CommonUtils.checkNull(request.getParameter("PARTNER_OBJID_"+targetObjId));
|
||
|
|
|
||
|
|
if(!partnerList.contains(partnerObjId)){
|
||
|
|
partnerList.add(partnerObjId);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//구성한 공급업체 목록으로 반복문
|
||
|
|
for(String partnerObjId : partnerList){
|
||
|
|
|
||
|
|
Map masterSqlParamMep = new HashMap();
|
||
|
|
|
||
|
|
String masterObjId = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
masterSqlParamMep.put("OBJID", masterObjId);
|
||
|
|
masterSqlParamMep.put("MY_COMPANY_OBJID", Constants.COMPANY_OBJID);
|
||
|
|
masterSqlParamMep.put("PARTNER_OBJID", partnerObjId);
|
||
|
|
masterSqlParamMep.put("WRITER", writer);
|
||
|
|
masterSqlParamMep.put("STATUS", "create");
|
||
|
|
|
||
|
|
//업체별로 발주서 마스터 생성
|
||
|
|
sqlSession.update("purchaseOrder.mergePurchaseOrderMaster", masterSqlParamMep);
|
||
|
|
|
||
|
|
//동일한 공급업체일 경우 마스터 아래로 저장
|
||
|
|
for(String targetObjId:partObjList){
|
||
|
|
String targetPartnerObjId = CommonUtils.checkNull(request.getParameter("PARTNER_OBJID_"+targetObjId));
|
||
|
|
|
||
|
|
if(partnerObjId.equals(targetPartnerObjId)){
|
||
|
|
Map sqlParamMep = new HashMap();
|
||
|
|
|
||
|
|
sqlParamMep.put("OBJID", CommonUtils.createObjId());
|
||
|
|
sqlParamMep.put("PART_OBJID", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PURCHASE_ORDER_MASTER_OBJID", masterObjId);
|
||
|
|
sqlParamMep.put("ORDER_QTY", CommonUtils.checkNull(request.getParameter("QTY_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("PARTNER_PRICE", CommonUtils.checkNull(request.getParameter("PARTNER_PRICE_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("WRITER", writer);
|
||
|
|
sqlParamMep.put("STATUS", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId),"create"));
|
||
|
|
|
||
|
|
sqlSession.update("purchaseOrder.mergePurchaseOrderPartInfo", sqlParamMep);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.SAVE_SUCCESS);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.SAVE_FAILED);
|
||
|
|
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 구매의뢰 내용을 저장한다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map savePurchaseOrderInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
|
||
|
|
HttpSession session = request.getSession();
|
||
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||
|
|
|
||
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
||
|
|
|
||
|
|
paramMap.put("WRITER", writer);
|
||
|
|
|
||
|
|
System.out.println("paramMap:"+paramMap);
|
||
|
|
|
||
|
|
String PURCHASE_ORDER_MASTER_OBJID = CommonUtils.checkNull(request.getParameter("PURCHASE_ORDER_MASTER_OBJID"));
|
||
|
|
String status = CommonUtils.checkNull(request.getParameter("STATUS"));
|
||
|
|
|
||
|
|
if("".equals(PURCHASE_ORDER_MASTER_OBJID)){
|
||
|
|
PURCHASE_ORDER_MASTER_OBJID = CommonUtils.createObjId();
|
||
|
|
paramMap.put("STATUS", "create");
|
||
|
|
}
|
||
|
|
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", PURCHASE_ORDER_MASTER_OBJID);
|
||
|
|
paramMap.put("OBJID", PURCHASE_ORDER_MASTER_OBJID);
|
||
|
|
|
||
|
|
sqlSession.update("purchaseOrder.mergePurchaseOrderMaster", paramMap);
|
||
|
|
|
||
|
|
sqlSession.update("purchaseOrder.initPurchaseOrderPart", paramMap);
|
||
|
|
|
||
|
|
String partObjList[] = request.getParameterValues("OBJID");
|
||
|
|
|
||
|
|
if(null != partObjList && 0 < partObjList.length){
|
||
|
|
for(String targetObjId:partObjList){
|
||
|
|
|
||
|
|
Map sqlParamMep = new HashMap();
|
||
|
|
|
||
|
|
sqlParamMep.put("OBJID", targetObjId);
|
||
|
|
sqlParamMep.put("PART_OBJID", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PURCHASE_ORDER_MASTER_OBJID", PURCHASE_ORDER_MASTER_OBJID);
|
||
|
|
sqlParamMep.put("ORDER_QTY", CommonUtils.checkNull(request.getParameter("QTY_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("PARTNER_PRICE", CommonUtils.checkNull(request.getParameter("PARTNER_PRICE_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("WRITER", writer);
|
||
|
|
sqlParamMep.put("STATUS", "create");
|
||
|
|
sqlParamMep.put("REMARK", CommonUtils.checkNull(request.getParameter("REMARK_"+targetObjId)));
|
||
|
|
|
||
|
|
sqlSession.update("purchaseOrder.mergePurchaseOrderPartInfo", sqlParamMep);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.SAVE_SUCCESS);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.SAVE_FAILED);
|
||
|
|
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
public Map deletePurchaseOrderMaster(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
|
||
|
|
String checkArr = CommonUtils.checkNull(paramMap.get("checkArr"));
|
||
|
|
|
||
|
|
if(null != checkArr && !"".equals(checkArr)){
|
||
|
|
Map sqlParamMap = new HashMap();
|
||
|
|
|
||
|
|
sqlParamMap.put("checkArr",checkArr);
|
||
|
|
|
||
|
|
sqlSession.delete("purchaseOrder.deletePurchaseOrderMaster",sqlParamMap);
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.DELETE_SUCCESS);
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.DELETE_FAILED);
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 구매의뢰 내용을 저장한다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map saveDeliveryResultInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
|
||
|
|
HttpSession session = request.getSession();
|
||
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||
|
|
|
||
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
||
|
|
|
||
|
|
paramMap.put("WRITER", writer);
|
||
|
|
|
||
|
|
String partObjList[] = request.getParameterValues("OBJID");
|
||
|
|
|
||
|
|
if(null != partObjList && 0 < partObjList.length){
|
||
|
|
for(String targetObjId:partObjList){
|
||
|
|
Map sqlParamMep = new HashMap();
|
||
|
|
|
||
|
|
String remark = CommonUtils.checkNull(request.getParameter("REMARK_"+targetObjId));
|
||
|
|
|
||
|
|
int DELIVERY_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameter("DELIVERY_QTY_"+targetObjId),"0"));
|
||
|
|
|
||
|
|
int NON_ARRIVAL_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameter("NON_ARRIVAL_QTY_"+targetObjId),"0"));
|
||
|
|
//int NON_ARRIVAL_QTY_RESULT = (NON_ARRIVAL_QTY-DELIVERY_QTY);
|
||
|
|
|
||
|
|
//sqlParamMep.put("OBJID", CommonUtils.createObjId());
|
||
|
|
sqlParamMep.put("OBJID", CommonUtils.checkNull(request.getParameter("DH_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PART_OBJID", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("LD_PART_OBJID_", CommonUtils.checkNull(request.getParameter("LD_PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PURCHASE_ORDER_PART_OBJID", targetObjId);
|
||
|
|
sqlParamMep.put("ORDER_QTY", CommonUtils.checkNull(request.getParameter("ORDER_QTY_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("DELIVERY_QTY", DELIVERY_QTY);
|
||
|
|
sqlParamMep.put("NON_ARRIVAL_QTY", NON_ARRIVAL_QTY);
|
||
|
|
sqlParamMep.put("DELIVERY_PRICE", CommonUtils.checkNull(request.getParameter("DELIVERY_PRICE_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("DELIVERY_PLACE_CD", CommonUtils.checkNull(request.getParameter("DELIVERY_PLACE_CD_"+targetObjId)));
|
||
|
|
sqlParamMep.put("LOCATION", CommonUtils.checkNull(request.getParameter("DELIVERY_PLACE_CD_"+targetObjId)));
|
||
|
|
sqlParamMep.put("DEFECT_QTY", CommonUtils.checkNull(request.getParameter("DEFECT_QTY_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("DELIVERY_DATE", CommonUtils.checkNull(request.getParameter("DELIVERY_DATE_"+targetObjId)));
|
||
|
|
sqlParamMep.put("DELIVERY_PLAN_DATE", CommonUtils.checkNull(request.getParameter("DELIVERY_PLAN_DATE_"+targetObjId)));
|
||
|
|
sqlParamMep.put("MAKER", CommonUtils.checkNull(request.getParameter("MAKER_"+targetObjId)));
|
||
|
|
sqlParamMep.put("UNIT", CommonUtils.checkNull(request.getParameter("UNIT_"+targetObjId)));
|
||
|
|
sqlParamMep.put("REMARK", remark);
|
||
|
|
sqlParamMep.put("WRITER", writer);
|
||
|
|
sqlParamMep.put("STATUS", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId),"create"));
|
||
|
|
|
||
|
|
sqlParamMep.put("INSPECT_DATE", CommonUtils.checkNull(request.getParameter("INSPECT_DATE_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("DEFECT_REASON", CommonUtils.checkNull(request.getParameter("DEFECT_REASON_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("DEFECT_RESP", CommonUtils.checkNull(request.getParameter("DEFECT_RESP_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("RESULT", CommonUtils.checkNull(request.getParameter("RESULT_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("DEFECT_NOTE", CommonUtils.checkNull(request.getParameter("DEFECT_NOTE_"+targetObjId),""));
|
||
|
|
|
||
|
|
//입고 이력 기록
|
||
|
|
if(0 < DELIVERY_QTY){
|
||
|
|
sqlSession.update("purchaseOrder.insertDeliveryHistory", sqlParamMep); //230509 "if(0 < DELIVERY_QTY){"안쪽으로 이동
|
||
|
|
|
||
|
|
//자재가 없을 경우 자재 생성
|
||
|
|
sqlSession.update("purchaseOrder.insertResourceMasterMng", sqlParamMep);
|
||
|
|
|
||
|
|
//재고 처리 ---------------------------------------------------
|
||
|
|
//장납기품
|
||
|
|
boolean is_ldPart = !CommonUtils.checkNull(request.getParameter("LD_PART_OBJID_"+targetObjId)).equals("");
|
||
|
|
Map<String,Object> lastInventoryMap = null;
|
||
|
|
|
||
|
|
if(!is_ldPart){
|
||
|
|
//최종 재고 정보를 가져온다.
|
||
|
|
lastInventoryMap = sqlSession.selectOne("purchaseOrder.getLastInventoryInfo",sqlParamMep);
|
||
|
|
//해당구역의 재고를 초기화한다.
|
||
|
|
sqlSession.update("purchaseOrder.resetInventoryRegist",sqlParamMep);
|
||
|
|
}else{
|
||
|
|
//최종 재고 정보를 가져온다.
|
||
|
|
lastInventoryMap = sqlSession.selectOne("purchaseOrder.getLastInventoryInfoLD",sqlParamMep);
|
||
|
|
//해당구역의 재고를 초기화한다.
|
||
|
|
sqlSession.update("purchaseOrder.resetInventoryRegistLD",sqlParamMep);
|
||
|
|
}
|
||
|
|
|
||
|
|
lastInventoryMap = CommonUtils.toUpperCaseMapKey(lastInventoryMap);
|
||
|
|
|
||
|
|
String lastQty = "0";
|
||
|
|
if(null != lastInventoryMap){
|
||
|
|
lastQty = CommonUtils.checkNull(lastInventoryMap.get("QTY"),"0");
|
||
|
|
}
|
||
|
|
|
||
|
|
String deliveryQty = CommonUtils.checkNull(request.getParameter("DELIVERY_QTY_"+targetObjId),"0");
|
||
|
|
|
||
|
|
int inventoryQty = (Integer.parseInt(lastQty)+Integer.parseInt(deliveryQty));
|
||
|
|
|
||
|
|
sqlParamMep.put("OBJID",CommonUtils.createObjId());
|
||
|
|
sqlParamMep.put("QTY",inventoryQty);
|
||
|
|
sqlParamMep.put("REMARK", "(입고 자동입력) "+remark);
|
||
|
|
|
||
|
|
//해당구역의 재고를 등록한다.
|
||
|
|
if(!is_ldPart){
|
||
|
|
sqlSession.update("inventoryMng.insertDeliveryInventoryRegist",sqlParamMep);
|
||
|
|
}else{
|
||
|
|
sqlSession.update("inventoryMng.insertDeliveryInventoryRegistLD",sqlParamMep);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.SAVE_SUCCESS);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.SAVE_FAILED);
|
||
|
|
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void saveDeliveryInfo_old(HttpServletRequest request, Map<String, Object> paramMap) {
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String[] OBJIDs = request.getParameterValues("OBJID");
|
||
|
|
String[] DETAIL_GROUP = request.getParameterValues("DETAIL_GROUP");
|
||
|
|
|
||
|
|
int j=0;
|
||
|
|
if(OBJIDs != null){
|
||
|
|
for(int i=0; i<OBJIDs.length; i++){
|
||
|
|
String _SEQ = request.getParameterValues("SEQ")[i];
|
||
|
|
int SEQ = Integer.parseInt(_SEQ);
|
||
|
|
Map saveMap = new HashMap();
|
||
|
|
if(0==SEQ % (DETAIL_GROUP.length/2)){
|
||
|
|
j=(DETAIL_GROUP.length/2);
|
||
|
|
}else{
|
||
|
|
j=SEQ % (DETAIL_GROUP.length/2);
|
||
|
|
}
|
||
|
|
System.out.println("JJJJJJJJJJJJJJJJ ------->"+j);
|
||
|
|
|
||
|
|
//int DELIVERY_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("DELIVERY_QTY")[i],"0"));
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , CommonUtils.checkNull(OBJIDs[i],CommonUtils.createObjId()));
|
||
|
|
//saveMap.put("PARENT_OBJID" , CommonUtils.checkNull(paramMap.get("PARENT_OBJID")));
|
||
|
|
//saveMap.put("ORDER_PART_OBJID" , CommonUtils.checkNull(paramMap.get("ORDER_PART_OBJID_"+j)));
|
||
|
|
|
||
|
|
saveMap.put("PART_OBJID" , CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)));
|
||
|
|
saveMap.put("LD_PART_OBJID" , CommonUtils.checkNull(paramMap.get("LD_PART_OBJID_"+j)));
|
||
|
|
|
||
|
|
//saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
//saveMap.put("GROUP_SEQ" , CommonUtils.checkNull(request.getParameterValues("GROUP_SEQ")[j]));
|
||
|
|
saveMap.put("SEQ" , CommonUtils.checkNull(request.getParameterValues("SEQ")[i]));
|
||
|
|
|
||
|
|
saveMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
saveMap.put("RECEIPT_DATE" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_DATE")[i]));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
//saveMap.put("ERROR_QTY" , CommonUtils.checkNull(request.getParameterValues("ERROR_QTY")[i],"0"));
|
||
|
|
//saveMap.put("ERROR_REASON" , CommonUtils.checkNull(request.getParameterValues("ERROR_REASON")[i]));
|
||
|
|
//saveMap.put("ATTRIBUTION" , CommonUtils.checkNull(request.getParameterValues("ATTRIBUTION")[i]));
|
||
|
|
//입고 이력 기록
|
||
|
|
if(0 < Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"))){
|
||
|
|
if(!CommonUtils.checkNull(request.getParameterValues("INVENTORY_STATUS")[i]).equals("Y")){
|
||
|
|
System.out.println("saveMap ------->"+saveMap);
|
||
|
|
sqlSession.update("supplyChainMgmt.saveDeliveryInfo", saveMap);
|
||
|
|
|
||
|
|
//sqlSession.update("supplyChainMgmt.saveInventoryStatusInfo", saveMap);
|
||
|
|
|
||
|
|
//자재가 없을 경우 자재 생성
|
||
|
|
saveMap.put("CONTRACT_OBJID",CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID")));
|
||
|
|
saveMap.put("UNIT",CommonUtils.checkNull(paramMap.get("UNIT_CODE")));
|
||
|
|
saveMap.put("PART_OBJID" , CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
|
||
|
|
Map<String,Object> InventoryMap = null;
|
||
|
|
|
||
|
|
String parentobjid = "";
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap);
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID"));
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 동시발주
|
||
|
|
if(CommonUtils.checkNull(paramMap.get("MULTI_YN")).equals("Y")){
|
||
|
|
Map sqlParamMap = new HashMap();
|
||
|
|
String ORDER_OBJID = CommonUtils.checkNull(paramMap.get("ORDER_OBJID"));
|
||
|
|
String CONTRACT_MGMT_OBJID = CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID"));
|
||
|
|
sqlParamMap.put("MULTI_MASTER_OBJID", ORDER_OBJID);
|
||
|
|
sqlParamMap.put("CONTRACT_MGMT_OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
sqlParamMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
|
||
|
|
Map<String,Object> sameInventoryInMap = sqlSession.selectOne("inventoryMng.getSameInventoryInQTYInfo",sqlParamMap);
|
||
|
|
|
||
|
|
if(null!=sameInventoryInMap){
|
||
|
|
int inventoryQty = Integer.parseInt(CommonUtils.checkNull(sameInventoryInMap.get("INVENTORY_QTY"), "0"));
|
||
|
|
//List<Map<String, String>> sameInventoryInList = new ArrayList<Map<String, String>>();
|
||
|
|
//sameInventoryInList = (ArrayList)sqlSession.selectList("purchaseOrder.selectSameInventoryInList", sqlParamMap);
|
||
|
|
int RECEIPT_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(paramMap.get("ORDER_QTY_" + j), "0"));
|
||
|
|
|
||
|
|
if(inventoryQty <= ORDER_QTY){
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
|
||
|
|
int remainingReceiptQty = RECEIPT_QTY;
|
||
|
|
int insertQty = Math.min(ORDER_QTY-inventoryQty, remainingReceiptQty);
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", ORDER_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", ORDER_OBJID);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
|
||
|
|
List<Map<String, String>> sameProjectList = new ArrayList<Map<String, String>>();
|
||
|
|
//String CONTRACT_MGMT_OBJID = CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID"));
|
||
|
|
sameProjectList = (ArrayList)sqlSession.selectList("purchaseOrder.selectSameProjectMasterList", sqlParamMap);
|
||
|
|
|
||
|
|
for (Map<String, String> projectItem : sameProjectList) {
|
||
|
|
String contract_mgmt_objid = projectItem.get("contract_mgmt_objid");
|
||
|
|
String purchase_order_sub_objid = projectItem.get("objid");
|
||
|
|
String unit = projectItem.get("unit_code");
|
||
|
|
|
||
|
|
saveMap.put("CONTRACT_OBJID", contract_mgmt_objid);
|
||
|
|
saveMap.put("UNIT", unit);
|
||
|
|
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap);
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID"));
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlParamMap.put("CONTRACT_MGMT_OBJID", contract_mgmt_objid);
|
||
|
|
//sqlParamMap.put("PURCHASE_ORDER_SUB_OBJID", purchase_order_sub_objid);
|
||
|
|
sameInventoryInMap = sqlSession.selectOne("inventoryMng.getSameInventoryInQTYInfo",sqlParamMap);
|
||
|
|
if(null!=sameInventoryInMap){
|
||
|
|
inventoryQty = Integer.parseInt(CommonUtils.checkNull(sameInventoryInMap.get("INVENTORY_QTY"), "0"));
|
||
|
|
}else{
|
||
|
|
inventoryQty = 0;
|
||
|
|
}
|
||
|
|
insertQty = Math.min(ORDER_QTY-inventoryQty, remainingReceiptQty);
|
||
|
|
|
||
|
|
//Map historyMap = new HashMap();
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", contract_mgmt_objid);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", purchase_order_sub_objid);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
int RECEIPT_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(paramMap.get("ORDER_QTY_" + j), "0"));
|
||
|
|
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
|
||
|
|
int remainingReceiptQty = RECEIPT_QTY;
|
||
|
|
int insertQty = Math.min(ORDER_QTY, remainingReceiptQty);
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
// Determine the quantity to insert based on remainingReceiptQty and ORDER_QTY
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", ORDER_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", ORDER_OBJID);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
|
||
|
|
List<Map<String, String>> sameProjectList = new ArrayList<Map<String, String>>();
|
||
|
|
sameProjectList = (ArrayList)sqlSession.selectList("purchaseOrder.selectSameProjectMasterList", sqlParamMap);
|
||
|
|
|
||
|
|
// Iterate over each item in the sameProjectList
|
||
|
|
for (Map<String, String> projectItem : sameProjectList) {
|
||
|
|
String contract_mgmt_objid = projectItem.get("contract_mgmt_objid");
|
||
|
|
String purchase_order_sub_objid = projectItem.get("objid");
|
||
|
|
String unit = projectItem.get("unit_code");
|
||
|
|
|
||
|
|
saveMap.put("CONTRACT_OBJID", contract_mgmt_objid);
|
||
|
|
saveMap.put("UNIT", unit);
|
||
|
|
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap);
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID"));
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
insertQty = Math.min(ORDER_QTY, remainingReceiptQty);
|
||
|
|
|
||
|
|
//Map historyMap = new HashMap();
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
// Determine the quantity to insert based on remainingReceiptQty and ORDER_QTY
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", contract_mgmt_objid);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", purchase_order_sub_objid);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
//자재 재고 등록
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID",CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
sqlSession.commit();
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void saveDeliveryInfo(HttpServletRequest request, Map<String, Object> paramMap) {
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String[] OBJIDs = request.getParameterValues("OBJID");
|
||
|
|
String[] DETAIL_GROUP = request.getParameterValues("DETAIL_GROUP");
|
||
|
|
|
||
|
|
int j=0;
|
||
|
|
if(OBJIDs != null){
|
||
|
|
for(int i=0; i<OBJIDs.length; i++){
|
||
|
|
String _SEQ = request.getParameterValues("SEQ")[i];
|
||
|
|
int SEQ = Integer.parseInt(_SEQ);
|
||
|
|
Map saveMap = new HashMap();
|
||
|
|
if(0==SEQ % DETAIL_GROUP.length){
|
||
|
|
j=DETAIL_GROUP.length;
|
||
|
|
}else{
|
||
|
|
j=SEQ % DETAIL_GROUP.length;
|
||
|
|
}
|
||
|
|
System.out.println("JJJJJJJJJJJJJJJJ ------->"+j);
|
||
|
|
System.out.println("IIIIIIIIIIIIIIII ------->"+i);
|
||
|
|
int REAL_ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(paramMap.get("REAL_ORDER_QTY_"+j), "0"));//1
|
||
|
|
//int DELIVERY_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("DELIVERY_QTY")[i],"0"));
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , CommonUtils.checkNull(OBJIDs[i],CommonUtils.createObjId()));
|
||
|
|
saveMap.put("PARENT_OBJID" , CommonUtils.checkNull(paramMap.get("PARENT_OBJID")));
|
||
|
|
saveMap.put("ORDER_PART_OBJID" , CommonUtils.checkNull(paramMap.get("ORDER_PART_OBJID_"+j)));
|
||
|
|
saveMap.put("PART_OBJID" , CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)));
|
||
|
|
saveMap.put("LD_PART_OBJID" , CommonUtils.checkNull(paramMap.get("LD_PART_OBJID_"+j)));
|
||
|
|
//saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
saveMap.put("GROUP_SEQ" , CommonUtils.checkNull(request.getParameterValues("GROUP_SEQ")[i]));
|
||
|
|
saveMap.put("SEQ" , CommonUtils.checkNull(request.getParameterValues("SEQ")[i]));
|
||
|
|
|
||
|
|
saveMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
saveMap.put("ARRIVAL_QTY" , CommonUtils.checkNull(request.getParameterValues("ARRIVAL_QTY")[i],"0"));
|
||
|
|
saveMap.put("RECEIPT_INV_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_INV_QTY")[i],"0"));
|
||
|
|
saveMap.put("RECEIPT_DATE" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_DATE")[i]));
|
||
|
|
saveMap.put("ARRIVAL_PLAN_DATE" , CommonUtils.checkNull(request.getParameterValues("ARRIVAL_PLAN_DATE")[i]));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
saveMap.put("ORDER_QTY" , REAL_ORDER_QTY);
|
||
|
|
//saveMap.put("ERROR_QTY" , CommonUtils.checkNull(request.getParameterValues("ERROR_QTY")[i],"0"));
|
||
|
|
//saveMap.put("ERROR_REASON" , CommonUtils.checkNull(request.getParameterValues("ERROR_REASON")[i]));
|
||
|
|
//saveMap.put("ATTRIBUTION" , CommonUtils.checkNull(request.getParameterValues("ATTRIBUTION")[i]));
|
||
|
|
|
||
|
|
System.out.println("saveMap ------->"+saveMap);
|
||
|
|
sqlSession.update("supplyChainMgmt.saveDeliveryInfo", saveMap); //ARRIVAL_PLAN
|
||
|
|
|
||
|
|
int receiptQty = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
int receiptInvQty = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_INV_QTY")[i],"0"));
|
||
|
|
|
||
|
|
//입고 이력 기록
|
||
|
|
if(0 < receiptQty){
|
||
|
|
/*if(!"Y".equals(CommonUtils.checkNull(request.getParameterValues("INVENTORY_STATUS")[i]))){*/
|
||
|
|
if(0 < (receiptQty - receiptInvQty)){
|
||
|
|
|
||
|
|
sqlSession.update("supplyChainMgmt.saveInventoryStatusInfo", saveMap); //INVENTORY_STATUS = 'Y'
|
||
|
|
|
||
|
|
//자재가 없을 경우 자재 생성
|
||
|
|
saveMap.put("CONTRACT_OBJID",CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID")));
|
||
|
|
saveMap.put("UNIT",CommonUtils.checkNull(paramMap.get("UNIT_CODE")));
|
||
|
|
saveMap.put("PART_OBJID" , CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
|
||
|
|
Map<String,Object> InventoryMap = null;
|
||
|
|
|
||
|
|
String parentobjid = "";
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap); //objid=358264223
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID")); //parentobjid=358264223
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
// 동시발주
|
||
|
|
if(CommonUtils.checkNull(paramMap.get("MULTI_YN")).equals("Y")){
|
||
|
|
System.out.println("동시발주 ------->");
|
||
|
|
Map sqlParamMap = new HashMap();
|
||
|
|
String ORDER_OBJID = CommonUtils.checkNull(paramMap.get("ORDER_OBJID"));
|
||
|
|
String CONTRACT_MGMT_OBJID = CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID"));
|
||
|
|
sqlParamMap.put("MULTI_MASTER_OBJID", ORDER_OBJID);
|
||
|
|
sqlParamMap.put("CONTRACT_MGMT_OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
sqlParamMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
|
||
|
|
Map<String,Object> sameInventoryInMap = sqlSession.selectOne("inventoryMng.getSameInventoryInQTYInfo",sqlParamMap); //inventoryQty=1
|
||
|
|
|
||
|
|
if(null!=sameInventoryInMap){
|
||
|
|
int inventoryQty = Integer.parseInt(CommonUtils.checkNull(sameInventoryInMap.get("INVENTORY_QTY"), "0")); //1
|
||
|
|
//List<Map<String, String>> sameInventoryInList = new ArrayList<Map<String, String>>();
|
||
|
|
//sameInventoryInList = (ArrayList)sqlSession.selectList("purchaseOrder.selectSameInventoryInList", sqlParamMap);
|
||
|
|
int RECEIPT_QTY = receiptQty - receiptInvQty;//1
|
||
|
|
int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(paramMap.get("ORDER_QTY_"+j), "0"));//1
|
||
|
|
|
||
|
|
if(inventoryQty <= ORDER_QTY){
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
|
||
|
|
int remainingReceiptQty = RECEIPT_QTY;
|
||
|
|
int insertQty = Math.min(ORDER_QTY-inventoryQty, remainingReceiptQty);
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", ORDER_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", ORDER_OBJID);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
|
||
|
|
List<Map<String, String>> sameProjectList = new ArrayList<Map<String, String>>();
|
||
|
|
//String CONTRACT_MGMT_OBJID = CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID"));
|
||
|
|
sameProjectList = (ArrayList)sqlSession.selectList("purchaseOrder.selectSameProjectMasterList", sqlParamMap); //3개
|
||
|
|
|
||
|
|
for (Map<String, String> projectItem : sameProjectList) {
|
||
|
|
String contract_mgmt_objid = projectItem.get("contract_mgmt_objid");
|
||
|
|
String purchase_order_sub_objid = projectItem.get("objid");
|
||
|
|
String unit = projectItem.get("unit_code");
|
||
|
|
|
||
|
|
saveMap.put("CONTRACT_OBJID", contract_mgmt_objid);
|
||
|
|
saveMap.put("UNIT", unit);
|
||
|
|
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap); // objid = 1312015592
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID")); // parentobjid = 1312015592
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlParamMap.put("CONTRACT_MGMT_OBJID", contract_mgmt_objid);
|
||
|
|
sqlParamMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
//sqlParamMap.put("PURCHASE_ORDER_SUB_OBJID", purchase_order_sub_objid);
|
||
|
|
sameInventoryInMap = sqlSession.selectOne("inventoryMng.getSameInventoryInQTYInfo",sqlParamMap);
|
||
|
|
if(null!=sameInventoryInMap){
|
||
|
|
inventoryQty = Integer.parseInt(CommonUtils.checkNull(sameInventoryInMap.get("INVENTORY_QTY"), "0"));
|
||
|
|
}else{
|
||
|
|
inventoryQty = 0;
|
||
|
|
}
|
||
|
|
insertQty = Math.min(ORDER_QTY-inventoryQty, remainingReceiptQty);
|
||
|
|
|
||
|
|
//Map historyMap = new HashMap();
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", contract_mgmt_objid);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", purchase_order_sub_objid);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
int RECEIPT_QTY = receiptQty - receiptInvQty;
|
||
|
|
int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(paramMap.get("ORDER_QTY_"+j), "0"));
|
||
|
|
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
|
||
|
|
int remainingReceiptQty = RECEIPT_QTY;
|
||
|
|
int insertQty = Math.min(ORDER_QTY, remainingReceiptQty);
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
// Determine the quantity to insert based on remainingReceiptQty and ORDER_QTY
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", ORDER_OBJID);
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", ORDER_OBJID);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
|
||
|
|
List<Map<String, String>> sameProjectList = new ArrayList<Map<String, String>>();
|
||
|
|
sameProjectList = (ArrayList)sqlSession.selectList("purchaseOrder.selectSameProjectMasterList", sqlParamMap);
|
||
|
|
|
||
|
|
// Iterate over each item in the sameProjectList
|
||
|
|
for (Map<String, String> projectItem : sameProjectList) {
|
||
|
|
String contract_mgmt_objid = projectItem.get("contract_mgmt_objid");
|
||
|
|
String purchase_order_sub_objid = projectItem.get("objid");
|
||
|
|
String unit = projectItem.get("unit_code");
|
||
|
|
|
||
|
|
saveMap.put("CONTRACT_OBJID", contract_mgmt_objid);
|
||
|
|
saveMap.put("UNIT", unit);
|
||
|
|
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
System.out.println("iiiiii ------->"+i);
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap);
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID"));
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
insertQty = Math.min(ORDER_QTY, remainingReceiptQty);
|
||
|
|
|
||
|
|
//Map historyMap = new HashMap();
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
// Determine the quantity to insert based on remainingReceiptQty and ORDER_QTY
|
||
|
|
historyMap.put("RECEIPT_QTY", insertQty);
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID", contract_mgmt_objid);
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", purchase_order_sub_objid);
|
||
|
|
|
||
|
|
if (insertQty > 0) {
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
remainingReceiptQty -= insertQty;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}else{
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
//자재 재고 등록
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
historyMap.put("WRITER" , paramMap.get("WRITER"));
|
||
|
|
historyMap.put("CONTRACT_MGMT_OBJID",CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_MASTER_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
historyMap.put("PURCHASE_ORDER_SUB_OBJID", CommonUtils.checkNull(paramMap.get("ORDER_OBJID")));
|
||
|
|
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn", historyMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
/*}*/
|
||
|
|
}
|
||
|
|
}
|
||
|
|
sqlSession.commit();
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void saveDeliveryETCInfo(HttpServletRequest request, Map<String, Object> paramMap) {
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String[] OBJIDs = request.getParameterValues("OBJID");
|
||
|
|
String[] DETAIL_GROUP = request.getParameterValues("DETAIL_GROUP");
|
||
|
|
|
||
|
|
int j=0;
|
||
|
|
if(OBJIDs != null){
|
||
|
|
for(int i=0; i<OBJIDs.length; i++){
|
||
|
|
String _SEQ = request.getParameterValues("SEQ")[i];
|
||
|
|
int SEQ = Integer.parseInt(_SEQ);
|
||
|
|
Map saveMap = new HashMap();
|
||
|
|
if(0==SEQ % (DETAIL_GROUP.length)){
|
||
|
|
j=DETAIL_GROUP.length;
|
||
|
|
}else{
|
||
|
|
j=SEQ % DETAIL_GROUP.length;
|
||
|
|
}
|
||
|
|
|
||
|
|
System.out.println("JJJJJJJJJJJJJJJJ ------->"+j);
|
||
|
|
int REAL_ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(paramMap.get("REAL_ORDER_QTY_"+j), "0"));//1
|
||
|
|
saveMap.put("OBJID" , CommonUtils.checkNull(OBJIDs[i],CommonUtils.createObjId()));
|
||
|
|
saveMap.put("PARENT_OBJID" , CommonUtils.checkNull(paramMap.get("PARENT_OBJID")));
|
||
|
|
saveMap.put("ORDER_PART_OBJID" , CommonUtils.checkNull(paramMap.get("ORDER_PART_OBJID_"+(i+1))));
|
||
|
|
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
saveMap.put("GROUP_SEQ" , CommonUtils.checkNull(request.getParameterValues("GROUP_SEQ")[i]));
|
||
|
|
saveMap.put("SEQ" , CommonUtils.checkNull(request.getParameterValues("SEQ")[i]));
|
||
|
|
|
||
|
|
saveMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
saveMap.put("ARRIVAL_QTY" , CommonUtils.checkNull(request.getParameterValues("ARRIVAL_QTY")[i],"0"));
|
||
|
|
saveMap.put("RECEIPT_DATE" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_DATE")[i]));
|
||
|
|
saveMap.put("ARRIVAL_PLAN_DATE" , CommonUtils.checkNull(request.getParameterValues("ARRIVAL_PLAN_DATE")[i]));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
saveMap.put("ORDER_QTY" , REAL_ORDER_QTY);
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
System.out.println("saveMap::: ------->"+saveMap);
|
||
|
|
sqlSession.update("supplyChainMgmt.saveDeliveryETCInfo", saveMap);
|
||
|
|
|
||
|
|
int receiptQty = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
//입고 이력 기록
|
||
|
|
if(0 < receiptQty){
|
||
|
|
sqlSession.update("supplyChainMgmt.saveInventoryStatusInfo", saveMap); //INVENTORY_STATUS = 'Y'
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
sqlSession.commit();
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void saveDeliveryInvalidInfo(HttpServletRequest request, Map<String, Object> paramMap) {
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String[] OBJIDs = request.getParameterValues("OBJID");
|
||
|
|
String[] DETAIL_GROUP = request.getParameterValues("DETAIL_GROUP");
|
||
|
|
|
||
|
|
int j=0;
|
||
|
|
if(OBJIDs != null){
|
||
|
|
for(int i=0; i<OBJIDs.length; i++){
|
||
|
|
String _SEQ = request.getParameterValues("SEQ")[i];
|
||
|
|
int SEQ = Integer.parseInt(_SEQ);
|
||
|
|
Map saveMap = new HashMap();
|
||
|
|
if(0==SEQ % (DETAIL_GROUP.length/2)){
|
||
|
|
j=(DETAIL_GROUP.length/2);
|
||
|
|
}else{
|
||
|
|
j=SEQ % (DETAIL_GROUP.length/2);
|
||
|
|
}
|
||
|
|
System.out.println("JJJJJJJJJJJJJJJJ ------->"+j);
|
||
|
|
|
||
|
|
//int DELIVERY_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("DELIVERY_QTY")[i],"0"));
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , CommonUtils.checkNull(OBJIDs[i],CommonUtils.createObjId()));
|
||
|
|
//saveMap.put("PARENT_OBJID" , CommonUtils.checkNull(paramMap.get("PARENT_OBJID")));
|
||
|
|
//saveMap.put("ORDER_PART_OBJID" , CommonUtils.checkNull(paramMap.get("ORDER_PART_OBJID_"+j)));
|
||
|
|
|
||
|
|
saveMap.put("PART_OBJID" , CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)));
|
||
|
|
saveMap.put("LD_PART_OBJID" , CommonUtils.checkNull(paramMap.get("LD_PART_OBJID_"+j)));
|
||
|
|
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
//saveMap.put("GROUP_SEQ" , CommonUtils.checkNull(request.getParameterValues("GROUP_SEQ")[j]));
|
||
|
|
//saveMap.put("SEQ" , CommonUtils.checkNull(request.getParameterValues("SEQ")[i]));
|
||
|
|
|
||
|
|
//saveMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
//saveMap.put("RECEIPT_DATE" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_DATE")[i]));
|
||
|
|
//saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
//saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
saveMap.put("ERROR_QTY" , CommonUtils.checkNull(request.getParameterValues("ERROR_QTY")[i],"0"));
|
||
|
|
saveMap.put("ERROR_REASON" , CommonUtils.checkNull(request.getParameterValues("ERROR_REASON")[i]));
|
||
|
|
saveMap.put("ATTRIBUTION" , CommonUtils.checkNull(request.getParameterValues("ATTRIBUTION")[i]));
|
||
|
|
System.out.println("saveMap ------->"+saveMap);
|
||
|
|
sqlSession.update("supplyChainMgmt.saveDeliveryInvalidInfo", saveMap);
|
||
|
|
|
||
|
|
//입고 이력 기록
|
||
|
|
/*if(0 < Integer.parseInt(CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"))){
|
||
|
|
sqlSession.update("supplyChainMgmt.saveInventoryStatusInfo", saveMap);
|
||
|
|
if(!CommonUtils.checkNull(request.getParameterValues("INVENTORY_STATUS")[i]).equals("Y")){
|
||
|
|
//자재가 없을 경우 자재 생성
|
||
|
|
saveMap.put("CONTRACT_OBJID",CommonUtils.checkNull(paramMap.get("CONTRACT_MGMT_OBJID")));
|
||
|
|
saveMap.put("UNIT",CommonUtils.checkNull(paramMap.get("UNIT_CODE")));
|
||
|
|
saveMap.put("PART_OBJID" , CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
|
||
|
|
Map<String,Object> InventoryMap = null;
|
||
|
|
Map historyMap = new HashMap();
|
||
|
|
String parentobjid = "";
|
||
|
|
//파트가 비어 있지 않으면 인서트
|
||
|
|
if(!"".equals(CommonUtils.checkNull(paramMap.get("PART_OBJID_"+j)))){
|
||
|
|
InventoryMap = sqlSession.selectOne("inventoryMng.getInventoryInfo",saveMap);
|
||
|
|
|
||
|
|
if(null!=InventoryMap){
|
||
|
|
parentobjid =CommonUtils.checkNull(InventoryMap.get("OBJID"));
|
||
|
|
|
||
|
|
}else{
|
||
|
|
parentobjid = CommonUtils.createObjId();
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , parentobjid);
|
||
|
|
sqlSession.insert("inventoryMng.insertInventory",saveMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//자재 재고 등록
|
||
|
|
historyMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
historyMap.put("PARENT_OBJID", parentobjid);
|
||
|
|
historyMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
historyMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
historyMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
sqlSession.insert("inventoryMng.insertInventoryIn",historyMap);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}*/
|
||
|
|
}
|
||
|
|
sqlSession.commit();
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 입고이력 수정한다.
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map saveDeliveryResultHistoryInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
|
||
|
|
HttpSession session = request.getSession();
|
||
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||
|
|
|
||
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
||
|
|
|
||
|
|
paramMap.put("WRITER", writer);
|
||
|
|
|
||
|
|
String partObjList[] = request.getParameterValues("OBJID");
|
||
|
|
|
||
|
|
if(null != partObjList && 0 < partObjList.length){
|
||
|
|
for(String targetObjId:partObjList){
|
||
|
|
Map sqlParamMep = new HashMap();
|
||
|
|
|
||
|
|
String remark = CommonUtils.checkNull(request.getParameter("REMARK_"+targetObjId));
|
||
|
|
|
||
|
|
int DELIVERY_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameter("DELIVERY_QTY_"+targetObjId),"0"));
|
||
|
|
|
||
|
|
int NON_ARRIVAL_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameter("NON_ARRIVAL_QTY_"+targetObjId),"0"));
|
||
|
|
//int NON_ARRIVAL_QTY_RESULT = (NON_ARRIVAL_QTY-DELIVERY_QTY);
|
||
|
|
|
||
|
|
//sqlParamMep.put("OBJID", CommonUtils.createObjId());
|
||
|
|
sqlParamMep.put("OBJID", CommonUtils.checkNull(request.getParameter("DH_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PART_OBJID", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("LD_PART_OBJID_", CommonUtils.checkNull(request.getParameter("LD_PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PURCHASE_ORDER_PART_OBJID", targetObjId);
|
||
|
|
sqlParamMep.put("ORDER_QTY", CommonUtils.checkNull(request.getParameter("ORDER_QTY_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("DELIVERY_QTY", DELIVERY_QTY);
|
||
|
|
sqlParamMep.put("NON_ARRIVAL_QTY", NON_ARRIVAL_QTY);
|
||
|
|
sqlParamMep.put("DELIVERY_PRICE", CommonUtils.checkNull(request.getParameter("DELIVERY_PRICE_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("DELIVERY_PLACE_CD", CommonUtils.checkNull(request.getParameter("DELIVERY_PLACE_CD_"+targetObjId)));
|
||
|
|
sqlParamMep.put("LOCATION", CommonUtils.checkNull(request.getParameter("DELIVERY_PLACE_CD_"+targetObjId)));
|
||
|
|
sqlParamMep.put("DEFECT_QTY", CommonUtils.checkNull(request.getParameter("DEFECT_QTY_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("DELIVERY_DATE", CommonUtils.checkNull(request.getParameter("DELIVERY_DATE_"+targetObjId)));
|
||
|
|
sqlParamMep.put("DELIVERY_PLAN_DATE", CommonUtils.checkNull(request.getParameter("DELIVERY_PLAN_DATE_"+targetObjId)));
|
||
|
|
sqlParamMep.put("MAKER", CommonUtils.checkNull(request.getParameter("MAKER_"+targetObjId)));
|
||
|
|
sqlParamMep.put("UNIT", CommonUtils.checkNull(request.getParameter("UNIT_"+targetObjId)));
|
||
|
|
sqlParamMep.put("REMARK", remark);
|
||
|
|
sqlParamMep.put("WRITER", writer);
|
||
|
|
sqlParamMep.put("STATUS", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId),"create"));
|
||
|
|
|
||
|
|
sqlParamMep.put("INSPECT_DATE", CommonUtils.checkNull(request.getParameter("INSPECT_DATE_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("DEFECT_REASON", CommonUtils.checkNull(request.getParameter("DEFECT_REASON_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("DEFECT_RESP", CommonUtils.checkNull(request.getParameter("DEFECT_RESP_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("RESULT", CommonUtils.checkNull(request.getParameter("RESULT_"+targetObjId),""));
|
||
|
|
sqlParamMep.put("DEFECT_NOTE", CommonUtils.checkNull(request.getParameter("DEFECT_NOTE_"+targetObjId),""));
|
||
|
|
|
||
|
|
//입고 이력 수정
|
||
|
|
sqlSession.update("purchaseOrder.updateDeliveryHistory", sqlParamMep);
|
||
|
|
|
||
|
|
/*
|
||
|
|
if(0 < DELIVERY_QTY){
|
||
|
|
//자재가 없을 경우 자재 생성
|
||
|
|
sqlSession.update("purchaseOrder.insertResourceMasterMng", sqlParamMep);
|
||
|
|
|
||
|
|
//재고 처리 ---------------------------------------------------
|
||
|
|
//장납기품
|
||
|
|
boolean is_ldPart = !CommonUtils.checkNull(request.getParameter("LD_PART_OBJID_"+targetObjId)).equals("");
|
||
|
|
Map<String,Object> lastInventoryMap = null;
|
||
|
|
|
||
|
|
if(!is_ldPart){
|
||
|
|
//최종 재고 정보를 가져온다.
|
||
|
|
lastInventoryMap = sqlSession.selectOne("purchaseOrder.getLastInventoryInfo",sqlParamMep);
|
||
|
|
//해당구역의 재고를 초기화한다.
|
||
|
|
sqlSession.update("purchaseOrder.resetInventoryRegist",sqlParamMep);
|
||
|
|
}else{
|
||
|
|
//최종 재고 정보를 가져온다.
|
||
|
|
lastInventoryMap = sqlSession.selectOne("purchaseOrder.getLastInventoryInfoLD",sqlParamMep);
|
||
|
|
//해당구역의 재고를 초기화한다.
|
||
|
|
sqlSession.update("purchaseOrder.resetInventoryRegistLD",sqlParamMep);
|
||
|
|
}
|
||
|
|
|
||
|
|
lastInventoryMap = CommonUtils.toUpperCaseMapKey(lastInventoryMap);
|
||
|
|
|
||
|
|
String lastQty = "0";
|
||
|
|
if(null != lastInventoryMap){
|
||
|
|
lastQty = CommonUtils.checkNull(lastInventoryMap.get("QTY"),"0");
|
||
|
|
}
|
||
|
|
|
||
|
|
String deliveryQty = CommonUtils.checkNull(request.getParameter("DELIVERY_QTY_"+targetObjId),"0");
|
||
|
|
|
||
|
|
int inventoryQty = (Integer.parseInt(lastQty)+Integer.parseInt(deliveryQty));
|
||
|
|
|
||
|
|
sqlParamMep.put("OBJID",CommonUtils.createObjId());
|
||
|
|
sqlParamMep.put("QTY",inventoryQty);
|
||
|
|
sqlParamMep.put("REMARK", "(입고 자동입력) "+remark);
|
||
|
|
|
||
|
|
//해당구역의 재고를 등록한다.
|
||
|
|
if(!is_ldPart){
|
||
|
|
sqlSession.update("inventoryMng.insertDeliveryInventoryRegist",sqlParamMep);
|
||
|
|
}else{
|
||
|
|
sqlSession.update("inventoryMng.insertDeliveryInventoryRegistLD",sqlParamMep);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.SAVE_SUCCESS);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.SAVE_FAILED);
|
||
|
|
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 단가 저장
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map saveDeliveryResultCostInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
|
||
|
|
HttpSession session = request.getSession();
|
||
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
||
|
|
|
||
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
||
|
|
|
||
|
|
paramMap.put("WRITER", writer);
|
||
|
|
|
||
|
|
String partObjList[] = request.getParameterValues("OBJID");
|
||
|
|
|
||
|
|
if(null != partObjList && 0 < partObjList.length){
|
||
|
|
for(String targetObjId:partObjList){
|
||
|
|
Map sqlParamMep = new HashMap();
|
||
|
|
|
||
|
|
int DELIVERY_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameter("DELIVERY_QTY_"+targetObjId),"0"));
|
||
|
|
int NON_ARRIVAL_QTY = Integer.parseInt(CommonUtils.checkNull(request.getParameter("NON_ARRIVAL_QTY_"+targetObjId),"0"));
|
||
|
|
//int NON_ARRIVAL_QTY_RESULT = (NON_ARRIVAL_QTY-DELIVERY_QTY);
|
||
|
|
String DPP_OBJID = CommonUtils.checkNull(request.getParameter("DPP_OBJID_"+targetObjId));
|
||
|
|
|
||
|
|
if(CommonUtils.isBlank(DPP_OBJID)){
|
||
|
|
sqlParamMep.put("OBJID", CommonUtils.createObjId());
|
||
|
|
}else{
|
||
|
|
sqlParamMep.put("OBJID", DPP_OBJID);
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlParamMep.put("PART_OBJID", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("LD_PART_OBJID", CommonUtils.checkNull(request.getParameter("LD_PART_OBJID_"+targetObjId)));
|
||
|
|
sqlParamMep.put("PURCHASE_ORDER_PART_OBJID", targetObjId);
|
||
|
|
// sqlParamMep.put("ORDER_QTY", CommonUtils.checkNull(request.getParameter("ORDER_QTY_"+targetObjId),"0"));
|
||
|
|
// sqlParamMep.put("DELIVERY_QTY", DELIVERY_QTY);
|
||
|
|
// sqlParamMep.put("NON_ARRIVAL_QTY", NON_ARRIVAL_QTY);
|
||
|
|
// sqlParamMep.put("DELIVERY_PRICE", CommonUtils.checkNull(request.getParameter("DELIVERY_PRICE_"+targetObjId),"0"));
|
||
|
|
// sqlParamMep.put("DELIVERY_PLACE_CD", CommonUtils.checkNull(request.getParameter("DELIVERY_PLACE_CD_"+targetObjId)));
|
||
|
|
// sqlParamMep.put("LOCATION", CommonUtils.checkNull(request.getParameter("DELIVERY_PLACE_CD_"+targetObjId)));
|
||
|
|
// sqlParamMep.put("DEFECT_QTY", CommonUtils.checkNull(request.getParameter("DEFECT_QTY_"+targetObjId),"0"));
|
||
|
|
// sqlParamMep.put("DELIVERY_DATE", CommonUtils.checkNull(request.getParameter("DELIVERY_DATE_"+targetObjId)));
|
||
|
|
// sqlParamMep.put("DELIVERY_PLAN_DATE", CommonUtils.checkNull(request.getParameter("DELIVERY_PLAN_DATE_"+targetObjId)));
|
||
|
|
// sqlParamMep.put("MAKER", CommonUtils.checkNull(request.getParameter("MAKER_"+targetObjId)));
|
||
|
|
// sqlParamMep.put("UNIT", CommonUtils.checkNull(request.getParameter("UNIT_"+targetObjId)));
|
||
|
|
// sqlParamMep.put("REMARK", remark);
|
||
|
|
// sqlParamMep.put("WRITER", writer);
|
||
|
|
// sqlParamMep.put("STATUS", CommonUtils.checkNull(request.getParameter("PART_OBJID_"+targetObjId),"create"));
|
||
|
|
|
||
|
|
sqlParamMep.put("PRICE", CommonUtils.checkNull(request.getParameter("PARTNER_PRICE_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("PRICE1", CommonUtils.checkNull(request.getParameter("PRICE1_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("PRICE2", CommonUtils.checkNull(request.getParameter("PRICE2_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("PRICE3", CommonUtils.checkNull(request.getParameter("PRICE3_"+targetObjId),"0"));
|
||
|
|
sqlParamMep.put("PRICE_SUM", CommonUtils.checkNull(request.getParameter("PRICE_SUM_"+targetObjId),"0"));
|
||
|
|
|
||
|
|
//단가 등록/수정
|
||
|
|
sqlSession.update("purchaseOrder.mergeDeliveryPartPrice", sqlParamMep);
|
||
|
|
|
||
|
|
//구매봄 단가 수정
|
||
|
|
//sqlParamMep.put("BOM_REPORT_OBJID", paramMap.get("BOM_REPORT_OBJID"));
|
||
|
|
sqlSession.update("purchaseOrder.updateSalesBomReportPartPriceByPurchase", sqlParamMep);
|
||
|
|
|
||
|
|
//발주서 part 단가 수정(230504 단가관리 저장시 발주서 금액도 업데이트 적용)
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderPartPriceByDeliveryCost", sqlParamMep);
|
||
|
|
|
||
|
|
//입고 이력 기록
|
||
|
|
//sqlSession.update("purchaseOrder.insertDeliveryHistory", sqlParamMep);
|
||
|
|
}
|
||
|
|
|
||
|
|
//발주서 단가 수정(230510 단가관리 저장시 발주서 금액도 업데이트 적용)
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderriceByDeliveryCost", paramMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.SAVE_SUCCESS);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.SAVE_FAILED);
|
||
|
|
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 발주목록
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public List getDeliveryResultHistoryList(HttpServletRequest request,Map paramMap){
|
||
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
|
||
|
|
resultList = (ArrayList)sqlSession.selectList("purchaseOrder.getDeliveryResultHistoryList", paramMap);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
||
|
|
}
|
||
|
|
|
||
|
|
//발주서 저장(등록/수정)
|
||
|
|
public void savePurchaseOrder_new(HttpServletRequest request,Map paramMap) throws Exception{
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
String MASTER_OBJID = CommonUtils.nullToEmpty((String)paramMap.get("MASTER_OBJID"));
|
||
|
|
String delivery_date = CommonUtils.nullToEmpty((String)paramMap.get("DELIVERY_DATE"));
|
||
|
|
String CONTRACT_MGMT_OBJID = CommonUtils.nullToEmpty((String)paramMap.get("CONTRACT_MGMT_OBJID"));
|
||
|
|
String UNIT_CODE = CommonUtils.nullToEmpty((String)paramMap.get("UNIT_CODE"));
|
||
|
|
String UNIT_NAME = "";
|
||
|
|
|
||
|
|
/*
|
||
|
|
String TYPE = CommonUtils.nullToEmpty((String)paramMap.get("TYPE")); //발주부품
|
||
|
|
String TYPE_STANDARD = "0001069"; //발주구분코드:일반부품
|
||
|
|
String TYPE_LONG_DLV = "0001070"; //발주구분코드:장납기품
|
||
|
|
String TYPE_ETC = "0001538"; //발주구분코드:잡자재
|
||
|
|
String TYPE_SUBCONTRACT = "0001654";//발주구분코드:사급품
|
||
|
|
|
||
|
|
boolean isMultiCheck = false;
|
||
|
|
if(TYPE_STANDARD.equals(TYPE)) {
|
||
|
|
isMultiCheck = true;
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
//project_no 조회
|
||
|
|
String masterProjectNo = "";
|
||
|
|
Map<String, Object> projectMap = new HashMap<String, Object>();
|
||
|
|
List<Map<String, Object>> projectList = new ArrayList<Map<String, Object>>();
|
||
|
|
Map sqlParamMap = new HashMap();
|
||
|
|
if(StringUtils.isNotBlank(CONTRACT_MGMT_OBJID)) {
|
||
|
|
sqlParamMap.put("OBJID", CONTRACT_MGMT_OBJID);
|
||
|
|
projectList = (ArrayList)sqlSession.selectList("project.getProjectMngInfo", sqlParamMap);
|
||
|
|
if(projectList != null && !projectList.isEmpty()) {
|
||
|
|
projectMap = projectList.get(0);
|
||
|
|
if(projectList != null) {
|
||
|
|
masterProjectNo = (String)projectMap.get("project_no");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//마스터 등록
|
||
|
|
paramMap.put("OBJID", MASTER_OBJID);
|
||
|
|
paramMap.put("STATUS", "create");
|
||
|
|
int cnt = sqlSession.update("purchaseOrder.mergePurchaseOrderMaster", paramMap);
|
||
|
|
|
||
|
|
List<Map<String, Object>> gridDataList = JsonUtil.JsonToList(CommonUtils.checkNull(paramMap.get("jqGrid")));
|
||
|
|
//sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
cnt = sqlSession.delete("purchaseOrder.initPurchaseOrderPart", paramMap);
|
||
|
|
|
||
|
|
//파트 등록
|
||
|
|
int [] ARR_STOCK_QTY = new int[gridDataList.size()]; //실발주수량
|
||
|
|
for(int i=0; i<gridDataList.size(); i++){
|
||
|
|
Map insertMap = gridDataList.get(i);
|
||
|
|
|
||
|
|
//240404 실발주수량, 재고수량 추가(동시발주시 그에 따른 수량 자동 차감 처리위해 본 발주서의 수량 차감)
|
||
|
|
int STOCK_QTY = Integer.parseInt(CommonUtils.checkNull((String)insertMap.get("STOCK_QTY"), "0"));
|
||
|
|
//int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull((String)insertMap.get("ORDER_QTY"), "0"));
|
||
|
|
//ARR_STOCK_QTY[i] = (REAL_ORDER_QTY - ORDER_QTY) < 0 ? 0 : (REAL_ORDER_QTY - ORDER_QTY);
|
||
|
|
ARR_STOCK_QTY[i] = STOCK_QTY;
|
||
|
|
|
||
|
|
String htmlString = (String)insertMap.get("PART_NO");//"<a href='someurl'>Link Text</a>";
|
||
|
|
if(htmlString.indexOf("</a>") > -1) {
|
||
|
|
/* java 1.8이상
|
||
|
|
//<a> 태그에서 PART_NO만 추출
|
||
|
|
//class='pointer'>" + rowObject.PART_NO + "</a>
|
||
|
|
// JSoup을 사용하여 HTML 파싱
|
||
|
|
Document doc = Jsoup.parse(htmlString);
|
||
|
|
// <a> 태그를 선택
|
||
|
|
Element linkElement = doc.select("a").first();
|
||
|
|
// <a> 태그 안의 텍스트 값 가져오기
|
||
|
|
String linkText = linkElement.text();
|
||
|
|
*/
|
||
|
|
|
||
|
|
String innerTextString = htmlString.substring(htmlString.lastIndexOf("\">")+2, htmlString.lastIndexOf("</a>"));
|
||
|
|
insertMap.put("PART_NO", innerTextString);
|
||
|
|
//System.out.println("innerTextString:"+innerTextString);
|
||
|
|
}
|
||
|
|
|
||
|
|
insertMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
insertMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
sqlSession.insert("purchaseOrder.mergePurchaseOrderPartInfo", insertMap);
|
||
|
|
//구매봄 단가 수정
|
||
|
|
//sqlSession.update("purchaseOrder.updateSalesBomReportPartPriceByPurchase", insertMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
//동시발주
|
||
|
|
paramMap.put("MULTI_MASTER_YN", "N");
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
paramMap.put("MULTI_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
|
||
|
|
List APPLICATION_OBJID_LIST = new ArrayList();
|
||
|
|
List PROJECT_NO_LIST = new ArrayList();
|
||
|
|
//sqlSession.delete("purchaseOrder.delPurchaseOrderMulti", paramMap);
|
||
|
|
//sqlSession.delete("purchaseOrder.delPurchaseOrderPart", paramMap);
|
||
|
|
//sqlSession.delete("purchaseOrder.delPurchaseOrderMaster", paramMap);
|
||
|
|
|
||
|
|
sqlParamMap.clear();
|
||
|
|
sqlParamMap.put("project_objid", CONTRACT_MGMT_OBJID);
|
||
|
|
sqlParamMap.put("unitCode", UNIT_CODE);
|
||
|
|
List<Map<String, Object>> resultListUnit = (ArrayList)sqlSession.selectList("common.getUnitCodeList", sqlParamMap); //unit 조회
|
||
|
|
if(resultListUnit == null || resultListUnit.isEmpty()) {
|
||
|
|
throw new Exception("UNIT이 존재하지 않습니다.");
|
||
|
|
}{
|
||
|
|
UNIT_NAME = (String)resultListUnit.get(0).get("task_name");
|
||
|
|
}
|
||
|
|
|
||
|
|
//동시발주
|
||
|
|
boolean isMulti = false;
|
||
|
|
String UNIT_CODE2 = "";
|
||
|
|
Map insertMap = new HashMap();
|
||
|
|
List<Map<String, String>> sameProjectList = new ArrayList<Map<String, String>>(); //동시발주건
|
||
|
|
for(int j=1; j<11; j++){
|
||
|
|
Map sameProjectMap = new HashMap();
|
||
|
|
String APPLICATION_OBJID = CommonUtils.nullToEmpty((String)paramMap.get("APPLICATION_OBJID"+j));
|
||
|
|
String APPLICATION_PROJECT_NO = CommonUtils.nullToEmpty((String)paramMap.get("APPLICATION_PROJECT_NO"+j)); //프로젝트 objid
|
||
|
|
String APPLICATION_PROJECT_NUMBER = CommonUtils.nullToEmpty((String)paramMap.get("APPLICATION_PROJECT_NUMBER"+j)); //프로젝트 no
|
||
|
|
String DELIVERY_PLAN_DATE = CommonUtils.nullToEmpty((String)paramMap.get("DELIVERY_PLAN_DATE"+j));
|
||
|
|
String DELIVERY_PLAN_QTY = CommonUtils.nullToEmpty((String)paramMap.get("DELIVERY_PLAN_QTY"+j));
|
||
|
|
|
||
|
|
if(!CommonUtils.isBlank(APPLICATION_PROJECT_NO)) {
|
||
|
|
isMulti = true;
|
||
|
|
sameProjectMap.put("APPLICATION_OBJID ".trim(), APPLICATION_OBJID );
|
||
|
|
sameProjectMap.put("APPLICATION_PROJECT_NO ".trim(), APPLICATION_PROJECT_NO );
|
||
|
|
sameProjectMap.put("APPLICATION_PROJECT_NUMBER".trim(), APPLICATION_PROJECT_NUMBER);
|
||
|
|
sameProjectMap.put("DELIVERY_PLAN_DATE ".trim(), DELIVERY_PLAN_DATE );
|
||
|
|
sameProjectMap.put("DELIVERY_PLAN_QTY ".trim(), DELIVERY_PLAN_QTY );
|
||
|
|
sameProjectList.add(sameProjectMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
if(isMulti) {
|
||
|
|
Collections.sort(sameProjectList, new Comparator<Map<String, String>>() {
|
||
|
|
@Override
|
||
|
|
public int compare(Map<String, String> o1, Map<String, String> o2) {
|
||
|
|
return o1.get("APPLICATION_PROJECT_NUMBER").compareTo(o2.get("APPLICATION_PROJECT_NUMBER"));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
/*
|
||
|
|
for (Map<String, String> map : sameProjectList) {
|
||
|
|
System.out.println("APPLICATION_PROJECT_NUMBER:"+map.get("APPLICATION_PROJECT_NUMBER"));
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
for(int j=sameProjectList.size(); j>0; j--){ //거꾸로
|
||
|
|
|
||
|
|
Map sameProjectMap = sameProjectList.get(j-1);
|
||
|
|
String APPLICATION_OBJID = CommonUtils.nullToEmpty((String)sameProjectMap.get("APPLICATION_OBJID"));
|
||
|
|
String APPLICATION_PROJECT_NO = CommonUtils.nullToEmpty((String)sameProjectMap.get("APPLICATION_PROJECT_NO")); //프로젝트 objid
|
||
|
|
String APPLICATION_PROJECT_NUMBER = CommonUtils.nullToEmpty((String)sameProjectMap.get("APPLICATION_PROJECT_NUMBER")); //프로젝트 no
|
||
|
|
String DELIVERY_PLAN_DATE = CommonUtils.nullToEmpty((String)sameProjectMap.get("DELIVERY_PLAN_DATE"));
|
||
|
|
String DELIVERY_PLAN_QTY = CommonUtils.nullToEmpty((String)sameProjectMap.get("DELIVERY_PLAN_QTY"));
|
||
|
|
|
||
|
|
if(!CommonUtils.isBlank(APPLICATION_PROJECT_NO)) {
|
||
|
|
isMulti = true;
|
||
|
|
|
||
|
|
sqlParamMap.clear();
|
||
|
|
sqlParamMap.put("project_objid", APPLICATION_PROJECT_NO);
|
||
|
|
sqlParamMap.put("unitName", UNIT_NAME);
|
||
|
|
//sqlParamMap.put("unit_code", UNIT_CODE);
|
||
|
|
List<Map<String, Object>> resultListUnit2 = (ArrayList)sqlSession.selectList("common.getUnitCodeList", sqlParamMap); //unit 조회
|
||
|
|
if(resultListUnit2 == null || resultListUnit2.isEmpty()) {
|
||
|
|
throw new Exception(APPLICATION_PROJECT_NUMBER + " - " + UNIT_NAME + " UNIT이 존재하지 않습니다.");
|
||
|
|
}{
|
||
|
|
UNIT_CODE2 =(String)resultListUnit2.get(0).get("code");
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlParamMap.clear();
|
||
|
|
sqlParamMap.put("project_no", APPLICATION_PROJECT_NO);
|
||
|
|
sqlParamMap.put("unit_code", UNIT_CODE2);
|
||
|
|
List<Map<String, Object>> resultListBom = (ArrayList)sqlSession.selectList("partMng.getBOMStandardStructureList", sqlParamMap); //봄 조회
|
||
|
|
String BOM_OBJID = "";
|
||
|
|
if(resultListBom == null || resultListBom.isEmpty()) {
|
||
|
|
throw new Exception(APPLICATION_PROJECT_NUMBER + " 동시발주건 BOM이 존재하지 않습니다.");
|
||
|
|
}{
|
||
|
|
BOM_OBJID = (String)resultListBom.get(0).get("objid");
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlParamMap.clear();
|
||
|
|
sqlParamMap.put("SEARCH_PARENT_OBJID", BOM_OBJID);
|
||
|
|
List<Map<String, Object>> resultListSBom = (ArrayList)sqlSession.selectList("salesMng.salesBomReportInfo2", sqlParamMap); //구매봄 조회
|
||
|
|
if(resultListSBom == null || resultListSBom.isEmpty()) {
|
||
|
|
throw new Exception(APPLICATION_PROJECT_NUMBER + " 동시발주건 구매BOM이 존재하지 않습니다.");
|
||
|
|
}
|
||
|
|
|
||
|
|
//String newMASTER_OBJID = CommonUtils.createObjId();
|
||
|
|
APPLICATION_OBJID = CommonUtils.checkNull(APPLICATION_OBJID, CommonUtils.createObjId());
|
||
|
|
APPLICATION_OBJID_LIST.add(APPLICATION_OBJID);
|
||
|
|
PROJECT_NO_LIST.add(APPLICATION_PROJECT_NO);
|
||
|
|
paramMap.put("OBJID", APPLICATION_OBJID);
|
||
|
|
paramMap.put("CONTRACT_MGMT_OBJID", APPLICATION_PROJECT_NO);
|
||
|
|
paramMap.put("UNIT_CODE", UNIT_CODE2); //해당 프로젝트의 유닛으로 변경
|
||
|
|
paramMap.put("BOM_REPORT_OBJID", BOM_OBJID);//해당 프로젝트의 BOM_OBJID으로 변경
|
||
|
|
|
||
|
|
//PURCHASE_ORDER_NO
|
||
|
|
paramMap.put("MULTI_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", APPLICATION_OBJID);
|
||
|
|
paramMap.put("PROJECT_OBJID", APPLICATION_PROJECT_NO);
|
||
|
|
paramMap.put("DELIVERY_PLAN_DATE", DELIVERY_PLAN_DATE);
|
||
|
|
paramMap.put("DELIVERY_PLAN_QTY", DELIVERY_PLAN_QTY);
|
||
|
|
paramMap.put("MULTI_YN", "Y");
|
||
|
|
|
||
|
|
cnt = sqlSession.update("purchaseOrder.mergePurchaseOrderMaster", paramMap);
|
||
|
|
//cnt = sqlSession.update("purchaseOrder.mergePurchaseOrderMulti", paramMap);
|
||
|
|
|
||
|
|
cnt = sqlSession.delete("purchaseOrder.initPurchaseOrderPart", paramMap); //발주서 파트 삭제
|
||
|
|
|
||
|
|
boolean changeOrderQty = false;
|
||
|
|
String partObjid = "";
|
||
|
|
for(int i=0; i<gridDataList.size(); i++){
|
||
|
|
Map orgMap = gridDataList.get(i);
|
||
|
|
insertMap.clear();
|
||
|
|
insertMap.putAll(orgMap);
|
||
|
|
|
||
|
|
//insertMap.put("OBJID", newMASTER_OBJID);
|
||
|
|
partObjid = CommonUtils.createObjId();
|
||
|
|
insertMap.put("OBJID", partObjid);
|
||
|
|
insertMap.put("PURCHASE_ORDER_MASTER_OBJID", APPLICATION_OBJID);
|
||
|
|
System.out.println("insertMap:"+insertMap);
|
||
|
|
String partNo = CommonUtils.checkNull((String)insertMap.get("PART_NO"));
|
||
|
|
String partName = CommonUtils.checkNull((String)insertMap.get("PART_NAME"));
|
||
|
|
|
||
|
|
//240404 실발주수량, 재고수량 추가(동시발주시 그에 따른 수량 자동 차감 처리)
|
||
|
|
//int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull((String)insertMap.get("ORDER_QTY"), "0"));
|
||
|
|
int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(CommonUtils.checkNull((String)insertMap.get("QTY"), (String)insertMap.get("ORDER_QTY")), "0"));
|
||
|
|
if(ARR_STOCK_QTY[i] < 1) {
|
||
|
|
}else if(ARR_STOCK_QTY[i] >= ORDER_QTY) {
|
||
|
|
changeOrderQty = true;
|
||
|
|
ARR_STOCK_QTY[i] = ARR_STOCK_QTY[i] - ORDER_QTY;
|
||
|
|
insertMap.put("ORDER_QTY", "0");
|
||
|
|
}else {
|
||
|
|
changeOrderQty = true;
|
||
|
|
insertMap.put("ORDER_QTY", ORDER_QTY - ARR_STOCK_QTY[i]); //뒷프로젝트부터 계속 차감하다가 남은 거 만큼만
|
||
|
|
ARR_STOCK_QTY[i] = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
//PART_OBJID 프로젝트별 맞는 part조회
|
||
|
|
sqlParamMap.clear();
|
||
|
|
sqlParamMap.put("IS_LAST", "1");
|
||
|
|
sqlParamMap.put("SEARCH_PART_NO_EQ", partNo);
|
||
|
|
|
||
|
|
/*
|
||
|
|
if(i == 0) {
|
||
|
|
sqlParamMap.put("SEARCH_PART_NO_EQ", APPLICATION_PROJECT_NUMBER+partNo.replace(masterProjectNo, "")); //마스터 프로젝트NO 제거
|
||
|
|
}else {
|
||
|
|
sqlParamMap.put("SEARCH_PART_NO_EQ", partNo);
|
||
|
|
}
|
||
|
|
|
||
|
|
if(StringUtils.isNotBlank(partName)) {
|
||
|
|
sqlParamMap.put("SEARCH_PART_NAME_EQ", partName);
|
||
|
|
//sqlParamMap.put("SEARCH_PART_NO", APPLICATION_PROJECT_NUMBER);
|
||
|
|
//sqlParamMap.put("SEARCH_PART_NO", partNo.replace(masterProjectNo, ""));
|
||
|
|
}else {
|
||
|
|
sqlParamMap.put("SEARCH_PART_NO_EQ", APPLICATION_PROJECT_NUMBER+partNo.replace(masterProjectNo, "")); //마스터 프로젝트NO 제거
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
//sqlParamMap.put("PROJECT_NO", APPLICATION_PROJECT_NUMBER);
|
||
|
|
//sqlParamMap.put("SEARCH_PART_NO_END", partNo.replace(masterProjectNo, "")); //마스터 프로젝트NO 제거
|
||
|
|
//List<Map<String, Object>> resultList = (ArrayList)sqlSession.selectList("partMng.partMngList", sqlParamMap); //part 조회
|
||
|
|
|
||
|
|
sqlParamMap.put("parent_objId", BOM_OBJID);
|
||
|
|
List<Map<String, Object>> resultList2 = (ArrayList)sqlSession.selectList("salesMng.salesBomReportPartList", sqlParamMap); //구매봄 part 조회
|
||
|
|
//System.out.println("resultList2::"+resultList2);
|
||
|
|
if(resultList2 == null || resultList2.isEmpty()) {
|
||
|
|
throw new Exception(APPLICATION_PROJECT_NUMBER + " (" + partName + ") 동시발주건 구매BOM part가 존재하지 않습니다.(품번:"+partNo+")");
|
||
|
|
}else {
|
||
|
|
//해당 프로젝트의 파트정보로 변경
|
||
|
|
insertMap.put("PART_OBJID", resultList2.get(0).get("objid_part"));
|
||
|
|
insertMap.put("PART_NAME", resultList2.get(0).get("part_name"));
|
||
|
|
insertMap.put("PART_NO", resultList2.get(0).get("part_no"));
|
||
|
|
sqlSession.insert("purchaseOrder.mergePurchaseOrderPartInfo", insertMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
//구매봄 단가 수정
|
||
|
|
//sqlSession.update("purchaseOrder.updateSalesBomReportPartPriceByPurchase", insertMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
//금액 수정
|
||
|
|
if(changeOrderQty) {
|
||
|
|
insertMap.put("PURCHASE_ORDER_MASTER_OBJID", APPLICATION_OBJID);
|
||
|
|
//insertMap.put("OBJID", partObjid);
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderPartSumUnitPrice", insertMap); // part 공급가 금액 합산
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderMasterPriceByPart", insertMap); // master 금액 재계산
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}//end of isMulti
|
||
|
|
|
||
|
|
//미선택 삭제
|
||
|
|
/**/
|
||
|
|
//if(!CommonUtils.isEmpty(PROJECT_NO_LIST)){
|
||
|
|
paramMap.put("MULTI_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
paramMap.put("checkArr", APPLICATION_OBJID_LIST);
|
||
|
|
//paramMap.put("checkArr", PROJECT_NO_LIST);
|
||
|
|
//sqlSession.delete("purchaseOrder.delPurchaseOrderMulti", paramMap);
|
||
|
|
|
||
|
|
if(isMulti){
|
||
|
|
paramMap.put("MULTI_MASTER_YN", "Y");
|
||
|
|
paramMap.put("MULTI_YN", "Y");
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderMasterMultiInfo", paramMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
APPLICATION_OBJID_LIST.add(MASTER_OBJID);
|
||
|
|
PROJECT_NO_LIST.add(paramMap.get("CONTRACT_MGMT_OBJID"));
|
||
|
|
sqlSession.delete("purchaseOrder.delPurchaseOrderPart", paramMap);
|
||
|
|
sqlSession.delete("purchaseOrder.delPurchaseOrderMaster", paramMap);
|
||
|
|
//}
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
e.printStackTrace();
|
||
|
|
throw new Exception(e);
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void savePurchaseOrder_salesRequest(HttpServletRequest request,Map paramMap) throws Exception{
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
try{
|
||
|
|
String MASTER_OBJID = CommonUtils.createObjId();
|
||
|
|
//String SALES_REQUEST_OBJID = CommonUtils.nullToEmpty((String)paramMap.get("OBJID"));
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
//paramMap.put("OBJID", MASTER_OBJID);
|
||
|
|
List<Map<String, Object>> gridDataList = JsonUtil.JsonToList(CommonUtils.checkNull(paramMap.get("jqGrid")));
|
||
|
|
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
for(int i=0; i<gridDataList.size(); i++){
|
||
|
|
Map insertMap = gridDataList.get(i);
|
||
|
|
//cnt = sqlSession.delete("purchaseOrder.initPurchaseOrderPart", paramMap);
|
||
|
|
String SALES_REQUEST_OBJID = (String) insertMap.get("OBJID");
|
||
|
|
insertMap.put("SALES_REQUEST_OBJID", SALES_REQUEST_OBJID);
|
||
|
|
|
||
|
|
List<Map<String, Object>> resultList = (ArrayList)sqlSession.selectList("purchaseOrder.grtPartnerObjidBySalesRequestObjid", insertMap);
|
||
|
|
System.out.println("resultList::"+resultList);
|
||
|
|
for(int j=0; j<resultList.size(); j++){
|
||
|
|
Map<String, Object> resultMap = (Map<String, Object>) resultList.get(j);
|
||
|
|
String PARTNER_OBJID = (String) resultMap.get("partner_objid");
|
||
|
|
insertMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
insertMap.put("PARTNER_OBJID", PARTNER_OBJID);
|
||
|
|
int cnt = sqlSession.update("purchaseOrder.mergePurchaseOrderMasterBySalesRequest", insertMap);
|
||
|
|
//insertMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
}
|
||
|
|
//구매의뢰서 상태값 변경
|
||
|
|
//insertMap.put("STATUS", "orderComplete"); //발주완료
|
||
|
|
//sqlSession.update("purchaseOrder.salesRequestMasterStatus", insertMap);
|
||
|
|
|
||
|
|
//sqlSession.insert("purchaseOrder.mergePurchaseOrderPartInfo", insertMap);
|
||
|
|
//구매봄 단가 수정
|
||
|
|
//sqlSession.update("purchaseOrder.updateSalesBomReportPartPriceByPurchase", insertMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
e.printStackTrace();
|
||
|
|
throw new Exception(e);
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//단가저장
|
||
|
|
public void savePurchaseOrderPrice(HttpServletRequest request,Map paramMap) throws Exception{
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
try{
|
||
|
|
String MASTER_OBJID = CommonUtils.nullToEmpty((String)paramMap.get("MASTER_OBJID"));
|
||
|
|
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
paramMap.put("OBJID", MASTER_OBJID);
|
||
|
|
//int cnt = sqlSession.update("purchaseOrder.mergePurchaseOrderMasterPrice", paramMap);
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderMasterRealPrice", paramMap); //실구매가 저장
|
||
|
|
|
||
|
|
List<Map<String, Object>> gridDataList = JsonUtil.JsonToList(CommonUtils.checkNull(paramMap.get("jqGrid")));
|
||
|
|
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
//cnt = sqlSession.delete("purchaseOrder.initPurchaseOrderPart", paramMap); //240322 주석처리 delete & insert는 입고쪽에 키값 없애는 문제 발생
|
||
|
|
|
||
|
|
int [] ARR_STOCK_QTY = new int[gridDataList.size()]; //실발주수량
|
||
|
|
for(int i=0; i<gridDataList.size(); i++){
|
||
|
|
Map insertMap = gridDataList.get(i);
|
||
|
|
//insertMap.put("OBJID", CommonUtils.createObjId()); //240322 주석처리
|
||
|
|
|
||
|
|
//240426 실발주수량, 재고수량 추가(동시발주시 그에 따른 수량 자동 차감 처리위해 본 발주서의 수량 차감)
|
||
|
|
int STOCK_QTY = Integer.parseInt(CommonUtils.checkNull((String)insertMap.get("STOCK_QTY"), "0"));
|
||
|
|
//int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull((String)insertMap.get("ORDER_QTY"), "0"));
|
||
|
|
//ARR_STOCK_QTY[i] = (REAL_ORDER_QTY - ORDER_QTY) < 0 ? 0 : (REAL_ORDER_QTY - ORDER_QTY);
|
||
|
|
ARR_STOCK_QTY[i] = STOCK_QTY;
|
||
|
|
|
||
|
|
//240322 주석처리 <a>태그 제거 추가
|
||
|
|
String htmlString = (String)insertMap.get("PART_NO");//"<a href='someurl'>Link Text</a>";
|
||
|
|
if(htmlString.indexOf("</a>") > -1) {
|
||
|
|
String innerTextString = htmlString.substring(htmlString.lastIndexOf("\">")+2, htmlString.lastIndexOf("</a>"));
|
||
|
|
insertMap.put("PART_NO", innerTextString);
|
||
|
|
//System.out.println("innerTextString:"+innerTextString);
|
||
|
|
}
|
||
|
|
|
||
|
|
//240521 , 제거 추가
|
||
|
|
insertMap.put("REAL_ORDER_QTY", CommonUtils.checkNull((String)insertMap.get("REAL_ORDER_QTY"), "0").replaceAll(",", ""));
|
||
|
|
insertMap.put("TOTAL_ORDER_QTY", CommonUtils.checkNull((String)insertMap.get("TOTAL_ORDER_QTY"), "0").replaceAll(",", ""));
|
||
|
|
|
||
|
|
insertMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
|
||
|
|
sqlSession.insert("purchaseOrder.mergePurchaseOrderPartInfo", insertMap);
|
||
|
|
//구매봄 단가 수정
|
||
|
|
sqlSession.update("purchaseOrder.updateSalesBomReportPartPriceByPurchase", insertMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderMasterPriceByPart", paramMap); // master 단가 저장 240402 위에서 아래로 이동
|
||
|
|
|
||
|
|
|
||
|
|
//동시발주 단가저장 적용(구매봄까지) 20240402
|
||
|
|
paramMap.put("MULTI_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
List<Map<String, String>> multiPurchaseOrderList = sqlSession.selectList("purchaseOrder.selectPurchaseOrderMasterList", paramMap);
|
||
|
|
if(multiPurchaseOrderList != null && !multiPurchaseOrderList.isEmpty()) {
|
||
|
|
|
||
|
|
/*
|
||
|
|
Collections.sort(multiPurchaseOrderList, new Comparator<Map<String, String>>() {
|
||
|
|
@Override
|
||
|
|
public int compare(Map<String, String> o1, Map<String, String> o2) {
|
||
|
|
return o1.get("CONTRACT_NO").compareTo(o2.get("CONTRACT_NO"));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
*/
|
||
|
|
|
||
|
|
Map sqlParam = new HashMap();
|
||
|
|
Map insertMap = new HashMap();
|
||
|
|
for (Map map : multiPurchaseOrderList) { //sub master
|
||
|
|
|
||
|
|
MASTER_OBJID = (String)map.get("objid");
|
||
|
|
|
||
|
|
insertMap.clear();
|
||
|
|
insertMap.putAll(paramMap);
|
||
|
|
insertMap.put("OBJID", MASTER_OBJID);
|
||
|
|
//sqlSession.update("purchaseOrder.updatePurchaseOrderMasterPrice", insertMap); //sub master
|
||
|
|
|
||
|
|
sqlParam.clear();
|
||
|
|
sqlParam.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
//cnt = sqlSession.delete("purchaseOrder.initPurchaseOrderPart", sqlParam);
|
||
|
|
List multiPurchaseOrderPartList = sqlSession.selectList("purchaseOrder.getPURCHASE_ORDER_PART", sqlParam);
|
||
|
|
|
||
|
|
boolean changeOrderQty = false;
|
||
|
|
String partObjid = "";
|
||
|
|
for(int i=0; i<gridDataList.size(); i++){ //화면 part list
|
||
|
|
Map orgMap = gridDataList.get(i);
|
||
|
|
insertMap.clear();
|
||
|
|
insertMap.putAll(orgMap);
|
||
|
|
//insertMap.put("OBJID", CommonUtils.createObjId());
|
||
|
|
|
||
|
|
String PURCHASE_ORDER_PART_OBJID = CommonUtils.checkNull(insertMap.get("OBJID"));
|
||
|
|
String PART_NAME = CommonUtils.checkNull((String)insertMap.get("PART_NAME"));
|
||
|
|
String PART_NO = CommonUtils.checkNull((String)insertMap.get("PART_NO"));
|
||
|
|
//boolean existsPart = false;
|
||
|
|
boolean existsPartPurchaseOrder = false;
|
||
|
|
//boolean existsPartSales = false;
|
||
|
|
for(int j=0; j<multiPurchaseOrderPartList.size(); j++){ //저장된 sub part list
|
||
|
|
Map multiPurchaseOrderPartMap = (Map)multiPurchaseOrderPartList.get(j);
|
||
|
|
String purchase_order_master_objid = CommonUtils.checkNull(multiPurchaseOrderPartMap.get("purchase_order_master_objid"));
|
||
|
|
String OBJID2 = CommonUtils.checkNull(multiPurchaseOrderPartMap.get("objid"));
|
||
|
|
//String PART_OBJID2 = CommonUtils.checkNull(multiPurchaseOrderPartMap.get("part_objid"));
|
||
|
|
//String PART_NAME2 = CommonUtils.checkNull(multiPurchaseOrderPartMap.get("part_name"));
|
||
|
|
String PART_NO2 = CommonUtils.checkNull(multiPurchaseOrderPartMap.get("part_no"));
|
||
|
|
|
||
|
|
//if(PART_OBJID.equals(PART_OBJID2)) { //같은건 찾아서 merge
|
||
|
|
//if(PART_NAME.equals(PART_NAME2)) {
|
||
|
|
if(PART_NO.equals(PART_NO2)) {
|
||
|
|
if(!StringUtils.isBlank(OBJID2)) {
|
||
|
|
existsPartPurchaseOrder = true;
|
||
|
|
insertMap.put("OBJID", OBJID2);
|
||
|
|
}
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}// end of multiSalesBomPartList
|
||
|
|
|
||
|
|
if(existsPartPurchaseOrder) {
|
||
|
|
|
||
|
|
//240404 실발주수량, 재고수량 추가(동시발주시 그에 따른 수량 자동 차감 처리)
|
||
|
|
//int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull((String)insertMap.get("ORDER_QTY"), "0"));
|
||
|
|
int ORDER_QTY = Integer.parseInt(CommonUtils.checkNull(CommonUtils.checkNull((String)insertMap.get("BOM_QTY"), (String)insertMap.get("ORDER_QTY")), "0"));
|
||
|
|
if(ARR_STOCK_QTY[i] < 1) {
|
||
|
|
}else if(ARR_STOCK_QTY[i] >= ORDER_QTY) {
|
||
|
|
changeOrderQty = true;
|
||
|
|
ARR_STOCK_QTY[i] = ARR_STOCK_QTY[i] - ORDER_QTY;
|
||
|
|
insertMap.put("ORDER_QTY", "0");
|
||
|
|
}else {
|
||
|
|
changeOrderQty = true;
|
||
|
|
insertMap.put("ORDER_QTY", ORDER_QTY - ARR_STOCK_QTY[i]); //뒷프로젝트부터 계속 차감하다가 남은 거 만큼만
|
||
|
|
ARR_STOCK_QTY[i] = 0;
|
||
|
|
}
|
||
|
|
|
||
|
|
//sqlSession.insert("purchaseOrder.mergePurchaseOrderPartInfo", insertMap); // PurchaseOrderPart 수정(마스터 기준으로)
|
||
|
|
|
||
|
|
sqlSession.insert("purchaseOrder.mergePurchaseOrderPartInfo", insertMap); //240426 재고에 따른 수량 변경
|
||
|
|
|
||
|
|
insertMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderPartPrice", insertMap); //기존 재고에 맞춰진 수량에 금액만 변경)
|
||
|
|
|
||
|
|
//구매봄 단가 수정
|
||
|
|
sqlSession.update("purchaseOrder.updateSalesBomReportPartPriceByPurchase", insertMap);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
insertMap.clear();
|
||
|
|
//insertMap.putAll(paramMap);
|
||
|
|
insertMap.put("PURCHASE_ORDER_MASTER_OBJID", MASTER_OBJID);
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderPartSumUnitPrice", insertMap); //sub part 공급가 금액 합산
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderMasterPriceByPart", insertMap); //sub master 금액 재계산
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
//master 총금액 수정(240507 추가)
|
||
|
|
sqlSession.update("purchaseOrder.updatePurchaseOrderMasterPriceAll", paramMap);
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
e.printStackTrace();
|
||
|
|
throw new Exception(e);
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 네고율 저장
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map updatePurchaseOrderList(HttpServletRequest request, Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
|
||
|
|
paramMap.put("WRITER", person.getUserId());
|
||
|
|
|
||
|
|
//System.out.println("paramMap : "+paramMap);
|
||
|
|
//String OBJID = CommonUtils.checkNull(request.getParameter("OBJID"), CommonUtils.createObjId());
|
||
|
|
//String OBJID_PRODUCT = CommonUtils.checkNull(request.getParameter("OBJID_PRODUCT"));
|
||
|
|
//paramMap.put("OBJID", OBJID);
|
||
|
|
|
||
|
|
List<Map<String, Object>> dataList = JsonUtil.JsonToList(CommonUtils.checkNull(paramMap.get("dataListJson")));
|
||
|
|
//if(!"".equals(authGroupObjid) && 0 < tagetMemberList.length){ html table version
|
||
|
|
if(CommonUtils.isNotEmpty(dataList)){
|
||
|
|
for (Map<String, Object> data : dataList) {
|
||
|
|
//System.out.println(data);
|
||
|
|
//String targetMemberId = CommonUtils.checkNull(data.get("USER_ID"));
|
||
|
|
//data.putAll(paramMap);
|
||
|
|
//data.put("OBJID_PARENT", OBJID);
|
||
|
|
//data.put("PRODUCT", OBJID_PRODUCT);
|
||
|
|
//System.out.println(data);
|
||
|
|
sqlSession.insert("purchaseOrder.updatePurchaseOrderNegoPrice", data);
|
||
|
|
|
||
|
|
// String OBJID = CommonUtils.checkNull(data.get("OBJID"));
|
||
|
|
// String MULTI_YN = CommonUtils.checkNull(data.get("MULTI_YN"));
|
||
|
|
// String MULTI_MASTER_YN = CommonUtils.checkNull(data.get("MULTI_MASTER_YN"));
|
||
|
|
sqlSession.insert("purchaseOrder.updatePurchaseOrderPriceTxt", data); //250123 added
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.SAVE_SUCCESS);
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.SAVE_FAILED);
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
//발주 취소(결재까지 상태 취소로 변경)
|
||
|
|
public Map purchaseOrderCancel(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String materOrdObjId = (String)paramMap.get("materOrdObjId");
|
||
|
|
String checkBoxList[] = request.getParameter("materOrdObjId").split(",");
|
||
|
|
|
||
|
|
if(null != checkBoxList && 0 < checkBoxList.length){
|
||
|
|
|
||
|
|
//마스터 취소
|
||
|
|
sqlSession.update("purchaseOrder.cancelPurchaseOrderMasterMulti", paramMap);
|
||
|
|
|
||
|
|
paramMap.put("targetObjId", CommonUtils.checkNull(materOrdObjId));
|
||
|
|
paramMap.put("search_type", "last");
|
||
|
|
Map map = sqlSession.selectOne("approval.selectApprovalInfo", paramMap);
|
||
|
|
|
||
|
|
if(map != null) {
|
||
|
|
//결재 취소
|
||
|
|
Map approvalParamMap = new HashMap();
|
||
|
|
approvalParamMap.put("approvalObjId", CommonUtils.checkNull(map.get("objid")));
|
||
|
|
//approvalParamMap.put("targetObjId", CommonUtils.checkNull(materOrdObjId));
|
||
|
|
approvalParamMap.put("status", "cancel");
|
||
|
|
|
||
|
|
sqlSession.update("approval.changeApprovalStatus", approvalParamMap);
|
||
|
|
sqlSession.update("approval.updateRouteStatusByApprovalObjId", approvalParamMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
/*
|
||
|
|
for(int i=0;i<checkBoxList.length;i++){
|
||
|
|
String Objid = CommonUtils.checkNull(checkBoxList[i]);
|
||
|
|
HashMap sqlParamMap = new HashMap();
|
||
|
|
sqlParamMap.put("objId", Objid);
|
||
|
|
|
||
|
|
//상세 취소
|
||
|
|
sqlParamMap.put("PURCHASE_ORDER_MASTER_OBJID", Objid);
|
||
|
|
//sqlSession.delete("purchaseOrder.cancelPurchaseOrderPart",sqlParamMap);
|
||
|
|
}
|
||
|
|
*/
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.DELETE_SUCCESS);
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.DELETE_FAILED);
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
//발주서 삭제
|
||
|
|
public Map purchaseOrderDelete(HttpServletRequest request,Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String checkBoxList[] = request.getParameter("materOrdObjId").split(",");
|
||
|
|
|
||
|
|
if(null != checkBoxList && 0 < checkBoxList.length){
|
||
|
|
for(int i=0;i<checkBoxList.length;i++){
|
||
|
|
String Objid = CommonUtils.checkNull(checkBoxList[i]);
|
||
|
|
HashMap sqlParamMap = new HashMap();
|
||
|
|
sqlParamMap.put("objId", Objid);
|
||
|
|
|
||
|
|
//상세 삭제
|
||
|
|
sqlParamMap.put("PURCHASE_ORDER_MASTER_OBJID", Objid);
|
||
|
|
sqlSession.delete("purchaseOrder.initPurchaseOrderPartMulti",sqlParamMap);
|
||
|
|
|
||
|
|
//마스터삭제
|
||
|
|
sqlSession.delete("purchaseOrder.deletePURCHASE_ORDER_MASTER",sqlParamMap);
|
||
|
|
}
|
||
|
|
sqlSession.commit();
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.DELETE_SUCCESS);
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.DELETE_FAILED);
|
||
|
|
sqlSession.rollback();
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 발주서 결재완료 후처리
|
||
|
|
*/
|
||
|
|
public void afterApprovalCompleteRouteInfo(SqlSession sqlSession, Map<String, Object> routeMap, Map<String, Object> targetMap, Map sqlParamMap) {
|
||
|
|
String targetObjId = CommonUtils.checkNull(sqlParamMap.get("targetObjId"));
|
||
|
|
Map paramMap = new HashMap();
|
||
|
|
paramMap.put("objId", targetObjId);
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", targetObjId);
|
||
|
|
|
||
|
|
Map masterInfo = commonService.selectOne("purchaseOrder.getPurchaseOrderMasterInfo", null, paramMap); //master정보
|
||
|
|
String status = "";
|
||
|
|
if(masterInfo == null) {
|
||
|
|
System.out.println(targetObjId + " info null (afterApprovalCompleteRouteInfo - purchaseOrder.getPurchaseOrderMasterInfo )");
|
||
|
|
return;
|
||
|
|
}else {
|
||
|
|
status = CommonUtils.checkNull((String)masterInfo.get("STATUS"));
|
||
|
|
}
|
||
|
|
|
||
|
|
//취소건
|
||
|
|
if("cancel".equals(status)) {
|
||
|
|
System.out.println(targetObjId + " info canceled (purchaseOrder-afterApprovalCompleteRouteInfo)");
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
//1. 발주번호로 설계변경조치결과 상태변경
|
||
|
|
sqlParamMap.put("act_status", "0001065"); //발주완료
|
||
|
|
sqlSession.update("purchaseOrder.salesPartChgActStatusByPurchaseOrderId", sqlParamMap);
|
||
|
|
|
||
|
|
//2. 발주서 메일발송
|
||
|
|
try{
|
||
|
|
|
||
|
|
paramMap.put("PURCHASE_ORDER_MASTER_OBJID", targetObjId);
|
||
|
|
paramMap.put("MULTI_MASTER_OBJID", targetObjId);
|
||
|
|
List detailList = commonService.selectList("purchaseOrder.getPURCHASE_ORDER_PART", null, paramMap); //발주부품목록
|
||
|
|
List apprList = commonService.getApprovalLine(paramMap); //결재정보
|
||
|
|
List multiMasterList = commonService.selectList("purchaseOrder.selectPurchaseOrderMasterList", null, paramMap);
|
||
|
|
ArrayList partFileList= commonService.selectList("purchaseOrder.purchaseOrderPartFileListForMail", null, paramMap); //발주부품 도면목록
|
||
|
|
|
||
|
|
SimpleDateFormat frm = new SimpleDateFormat ("yyyyMMddHHmm");
|
||
|
|
SimpleDateFormat frm2= new SimpleDateFormat ("yyyy-MM-dd");
|
||
|
|
Calendar cal = Calendar.getInstance();
|
||
|
|
String todayKor = frm.format(cal.getTime());
|
||
|
|
String poNo = CommonUtils.checkNull((String)masterInfo.get("PURCHASE_ORDER_NO")); //발주서번호
|
||
|
|
String poTitle = CommonUtils.checkNull((String)masterInfo.get("TITLE")); //발주서제목
|
||
|
|
String fromUser = CommonUtils.checkNull((String)masterInfo.get("WRITER")); //발주서작성자
|
||
|
|
String fromEmail= CommonUtils.checkNull((String)masterInfo.get("WRITER_EMAIL")); //발주서작성자 이메일
|
||
|
|
String excelName= "발주서_"+poNo+"_"+ todayKor +".xls";
|
||
|
|
String zipName = "도면_"+poNo+"_"+ todayKor +".zip";
|
||
|
|
masterInfo.put("EXCELFILE_NAME", excelName);
|
||
|
|
masterInfo.put("APPR_COMPLETE_DATE", frm2.format(cal.getTime())); //최종결재일자 (아직 커밋전이라 db정보없음)
|
||
|
|
|
||
|
|
//제목
|
||
|
|
String subject = poNo + poTitle;
|
||
|
|
|
||
|
|
//내용
|
||
|
|
/*Map param = new HashMap();
|
||
|
|
param.put("SUBJECT" , subject);
|
||
|
|
param.put("CAR_CODE" , "CAR-BENZ0001");
|
||
|
|
param.put("CAR_NAME" , "G63 AMG 6x6");
|
||
|
|
param.put("PRODUCT_GROUP_NAME", "메르세데스벤츠");
|
||
|
|
param.put("PRODUCT_NAME" , "지바겐");
|
||
|
|
String contents = MailUtil.getHTMLContents("mailTemplate2", param);*/
|
||
|
|
String contents_table = this.makePoContentsTable(masterInfo, detailList, apprList, multiMasterList);
|
||
|
|
String contents = this.makeMailContents(contents_table);
|
||
|
|
|
||
|
|
//to user
|
||
|
|
ArrayList<String> toUserIdList = new ArrayList<String>();
|
||
|
|
toUserIdList.add(CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_NAME"))); //공급처 담당자명(ID없음)
|
||
|
|
|
||
|
|
//to email
|
||
|
|
ArrayList<String> toEmailList = new ArrayList<String>();
|
||
|
|
toEmailList.add(CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_EMAIL"))); //공급처 담당자 EMAIL
|
||
|
|
|
||
|
|
//cc(참조) email
|
||
|
|
ArrayList<String> ccEmailList = new ArrayList<String>();
|
||
|
|
ccEmailList.add(CommonUtils.checkNull((String)masterInfo.get("SALES_MNG_USER_EMAIL"))); //발주처 담당자 EMAIL
|
||
|
|
|
||
|
|
//attach file
|
||
|
|
ArrayList<HashMap> attachFileList = new ArrayList<HashMap>();
|
||
|
|
attachFileList.add(this.makeMailAttachFileOrderSheet(masterInfo, contents_table)); //발주서 파일생성 & 첨부
|
||
|
|
|
||
|
|
File zf = MailUtil.zipFileListMail(zipName, partFileList); //도면파일 압축 파일생성 & 첨부
|
||
|
|
HashMap hm = new HashMap();
|
||
|
|
hm.put(Constants.Db.COL_FILE_REAL_NAME , zf.getName());
|
||
|
|
hm.put(Constants.Db.COL_FILE_SAVED_NAME, zf.getName());
|
||
|
|
hm.put(Constants.Db.COL_FILE_PATH , zf.getPath().replace("\\"+zf.getName(),""));
|
||
|
|
attachFileList.add(hm);
|
||
|
|
|
||
|
|
//메일발송
|
||
|
|
boolean result2 = MailUtil.sendMailWithAttachFile(fromUser, fromEmail, toUserIdList, toEmailList, ccEmailList, null, null, subject, contents, attachFileList, "PURCHASE_ORDER");
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 발주서 내용생성 - table
|
||
|
|
* @return mail contents
|
||
|
|
*/
|
||
|
|
private String makePoContentsTable(Map masterInfo, List detailList, List apprList, List multiMasterList){
|
||
|
|
String sty_td_h = "style=\"text-align:center; background-color:#D5D5D5;\"";
|
||
|
|
String sty_paddingO = "padding:3px;";
|
||
|
|
String sty_padding = "style='padding:3px;'";
|
||
|
|
|
||
|
|
String[] arrAppr = {"","","",""}; //결재라인 4
|
||
|
|
for(int i = 0 ; i < apprList.size() ; i++){
|
||
|
|
HashMap map = (HashMap)apprList.get(i);
|
||
|
|
if(i==0){
|
||
|
|
arrAppr[0] = CommonUtils.checkNull(map.get("WRITER"))+"<br>"+CommonUtils.checkNull(map.get("REGDATE"));
|
||
|
|
}
|
||
|
|
if(i<4){
|
||
|
|
if(i == apprList.size()-1){
|
||
|
|
arrAppr[i+1] = CommonUtils.checkNull(map.get("TARGET_USER_NAME"))+"<br>"+CommonUtils.checkNull(masterInfo.get("APPR_COMPLETE_DATE"));
|
||
|
|
}else{
|
||
|
|
arrAppr[i+1] = CommonUtils.checkNull(map.get("TARGET_USER_NAME"))+"<br>"+CommonUtils.checkNull(map.get("PROC_DATE"));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
StringBuffer sb = new StringBuffer();
|
||
|
|
|
||
|
|
// sb.append("<style>");
|
||
|
|
// sb.append(" .align_l2 {text-align: left !important;padding-left: 2px;} ");
|
||
|
|
// sb.append(" .align_l4 {text-align: left !important;padding-left: 4px;} ");
|
||
|
|
// sb.append(" .align_c {text-align: center !important;} ");
|
||
|
|
// sb.append(" .align_r {text-align: right !important;} ");
|
||
|
|
// sb.append(" .align_r2 {text-align: right !important;padding-right: 2px;} ");
|
||
|
|
// sb.append(" .align_r4 {text-align: right !important;padding-right: 4px;} ");
|
||
|
|
// sb.append(" .n_table td {padding:3px;} ");
|
||
|
|
// sb.append("</style>");
|
||
|
|
// String sty_align_l4 = " class='align_l4' ";
|
||
|
|
// String sty_align_r4 = " class='align_r4' ";
|
||
|
|
|
||
|
|
sb.append("<table style='width:1530px' border='1' cellpadding='2' cellspacing='0' class='n_table'> ");
|
||
|
|
sb.append(" <colgroup> ");
|
||
|
|
sb.append(" <col style='width: 50px; height:23px'></col><!-- 발주처 --> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col><!-- 공급처 --> ");
|
||
|
|
sb.append(" <col style='width: 77px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 77px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 75px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 75px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 65px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 75px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 60px; height:23px'></col> ");
|
||
|
|
sb.append(" <col style='width: 70px; height:23px'></col> ");
|
||
|
|
sb.append(" </colgroup> ");
|
||
|
|
sb.append(" ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">발주번호 </td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("PURCHASE_ORDER_NO"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_td_h+">발주부품 </td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("TYPE_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">프로젝트번호 </td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("PROJECT_NO"))+"</td> "); //CONTRACT_MGNT_NAME
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">유닛명 </td> ");
|
||
|
|
sb.append(" <td colspan='6' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("UNIT_NAME"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td rowspan='2' colspan='11' style='text-align: center; height: 50px; font-size:15px; font-weight:700;'> ");
|
||
|
|
sb.append(" 발주서 ");
|
||
|
|
sb.append(" <br style='mso-data-placement: same-cell;'> ");
|
||
|
|
sb.append(" (Purchase Order) ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" <td colspan='2' rowspan='8'></td> ");
|
||
|
|
sb.append(" <td rowspan='2' colspan='3' style='vertical-align: middle; text-align:center; background-color:#D5D5D5;'>결 재</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">담당</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">검토</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">결재</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">대표</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:center;'>"+arrAppr[0]+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:center;'>"+arrAppr[1]+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:center;'>"+arrAppr[2]+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:center;'>"+arrAppr[3]+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" rowspan='6'>발주처</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>회사명</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" rowspan='6'>공급처</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>회사명</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("PARTNER_NAME"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>사업자번호</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_REG_NO"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>사업자번호</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_BUS_NO"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>담당자</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_MNG_USER_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>HP</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_MNG_USER_CELL_PHONE"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>대표자</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>HP</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_HP"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>전화</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_SUPPLY_OFFICE_NO"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>FAX</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_SUPPLY_FAX_NO"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>전화</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_TEL"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>FAX</td> ");
|
||
|
|
sb.append(" <td colspan='3' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_FAX"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>E-MAIL</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_EMAIL"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>E-MAIL</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_USER_EMAIL"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>주소</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SALES_SUPPLY_ADDRESS"))+"</td> ");
|
||
|
|
sb.append(" <td "+sty_td_h+" colspan='2'>주소</td> ");
|
||
|
|
sb.append(" <td colspan='8' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("SUPPLY_ADDR"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='24' style='text-align: center; height: 50px;'> ");
|
||
|
|
sb.append(" 아래의 자재를 발주하오니 기일 내 필히 납품하여 주시기 바랍니다. ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">발주구분 </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("ORDER_TYPE_CD_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">납품장소 </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("DELIVERY_PLACE_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">검수방법 </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("INSPECT_METHOD_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">결제조건 </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("PAYMENT_TERMS_NAME"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">입고요청일 </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_padding+" style='text-align:center;'>"+CommonUtils.checkNull((String)masterInfo.get("DELIVERY_DATE"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='4' "+sty_padding+"></td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">발주서 No.</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("PURCHASE_ORDER_NO_ORG_NO"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">제 목</td> ");
|
||
|
|
sb.append(" <td colspan='6' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("TITLE"))+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">부가세포함 발주금액(원) </td> "); //부가세포함 발주금액
|
||
|
|
sb.append(" <td colspan='10' "+sty_padding+">"+CommonUtils.checkNull((String)masterInfo.get("TOTAL_PRICE_TXT_ALL"))+"</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
sb.append("<tr></tr>");
|
||
|
|
|
||
|
|
sb.append(" <tr style='height: 26px;'> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">NO.</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">품명</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">품번</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">규격</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">Maker</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">단위</td> ");
|
||
|
|
//sb.append(" <td colspan='1' "+sty_td_h+">설계수량</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">수량</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">공급단가</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">레이져단가</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">용접단가</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">가공단가</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">후처리단가</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">공급가</td> ");
|
||
|
|
//sb.append(" <td colspan='2' "+sty_td_h+">부가세포함공급가</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">총발주수량</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">재고수량</td> ");
|
||
|
|
sb.append(" <td colspan='1' "+sty_td_h+">실발주수량</td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">실공급가</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
for(int i = 0 ; i < detailList.size() ; i++){
|
||
|
|
HashMap map = (HashMap)detailList.get(i);
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:center;'>"+(i+1)+"</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:left;"+sty_paddingO+"'>"+CommonUtils.checkNull(map.get("PART_NAME" ))+"</td>");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:left;"+sty_paddingO+"'>"+CommonUtils.checkNull(map.get("PART_NO" ))+"</td>");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:left;"+sty_paddingO+"'>"+CommonUtils.checkNull(map.get("SPEC" ))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:left;"+sty_paddingO+"'>"+CommonUtils.checkNull(map.get("MAKER" ))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:left;"+sty_paddingO+"'>"+CommonUtils.checkNull(map.get("UNIT_NAME" ))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("ORDER_QTY" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("PARTNER_PRICE" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("PRICE1" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("PRICE2" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("PRICE3" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("PRICE4" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("SUPPLY_UNIT_PRICE")))+"</td>");
|
||
|
|
//sb.append(" <td colspan='2' style='text-align:right;'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("SUPPLY_UNIT_VAT_SUM_PRICE")))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("TOTAL_ORDER_QTY" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("STOCK_QTY" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='1' style='text-align:right;"+sty_paddingO+"background-color:#FFD507;'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("REAL_ORDER_QTY" )))+"</td>");
|
||
|
|
sb.append(" <td colspan='2' style='text-align:right;"+sty_paddingO+"background-color:#FFD507;'>"+CommonUtils.numberFormat(CommonUtils.checkNull(map.get("REAL_SUPPLY_PRICE" )))+"</td>");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
}
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='17' "+sty_td_h+">합계(원)</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align: right; background-color:#fbead9;"+sty_paddingO+"'> ");
|
||
|
|
sb.append(" "+CommonUtils.numberFormat(CommonUtils.checkNull((String)masterInfo.get("TOTAL_SUPPLY_PRICE")))+" ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" <td colspan='3' ></td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align: right; background-color:#fbead9;"+sty_paddingO+"'> ");
|
||
|
|
//sb.append(" "+CommonUtils.numberFormat(CommonUtils.checkNull((String)masterInfo.get("TOTAL_SUPPLY_UNIT_PRICE")))+" ");
|
||
|
|
sb.append(" "+CommonUtils.numberFormat(CommonUtils.checkNull((String)masterInfo.get("TOTAL_REAL_SUPPLY_PRICE")))+" ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='12' ></td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">할인금액(원)</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align: right; background-color:#fbead9;"+sty_paddingO+"'> ");
|
||
|
|
sb.append(" "+CommonUtils.numberFormat(CommonUtils.checkNull((String)masterInfo.get("DISCOUNT_PRICE_ALL")))+" ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">네고율</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align: right; background-color:#fbead9;"+sty_paddingO+"'> ");
|
||
|
|
sb.append(" "+CommonUtils.checkNull((String)masterInfo.get("NEGO_RATE"))+" ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" <td colspan='2' "+sty_td_h+">할인공급가(원)</td> ");
|
||
|
|
sb.append(" <td colspan='2' style='text-align: right; background-color:#fbead9;"+sty_paddingO+"'> ");
|
||
|
|
sb.append(" "+CommonUtils.numberFormat(CommonUtils.checkNull((String)masterInfo.get("TOTAL_PRICE_ALL")))+" ");
|
||
|
|
sb.append(" </td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
sb.append("<tr><td colspan='24'> </td></tr>");
|
||
|
|
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='4' "+sty_td_h+">동시적용프로젝트번호</td> ");
|
||
|
|
HashMap map;
|
||
|
|
for(int i = 0 ; i < 10 ; i++){
|
||
|
|
if(multiMasterList.size()-1 >= i){
|
||
|
|
map = (HashMap)multiMasterList.get(i);
|
||
|
|
}else{
|
||
|
|
map = new HashMap();
|
||
|
|
}
|
||
|
|
sb.append(" <td colspan='2' style='text-align:center;'>"+CommonUtils.checkNull(map.get("CONTRACT_NO"))+"</td>");
|
||
|
|
}
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='4' "+sty_td_h+">입고계획일</td> ");
|
||
|
|
for(int i = 0 ; i < 10 ; i++){
|
||
|
|
if(multiMasterList.size()-1 >= i){
|
||
|
|
map = (HashMap)multiMasterList.get(i);
|
||
|
|
}else{
|
||
|
|
map = new HashMap();
|
||
|
|
}
|
||
|
|
sb.append(" <td colspan='2' style='text-align:center;'>"+CommonUtils.checkNull(map.get("DELIVERY_PLAN_DATE"))+"</td>");
|
||
|
|
}
|
||
|
|
sb.append(" </tr> "
|
||
|
|
+ " ");
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='4' "+sty_td_h+">입고계획수량</td> ");
|
||
|
|
for(int i = 0 ; i < 10 ; i++){
|
||
|
|
if(multiMasterList.size()-1 >= i){
|
||
|
|
map = (HashMap)multiMasterList.get(i);
|
||
|
|
}else{
|
||
|
|
map = new HashMap();
|
||
|
|
}
|
||
|
|
sb.append(" <td colspan='2' style='text-align:right;'>"+CommonUtils.checkNull(map.get("DELIVERY_PLAN_QTY"))+"</td>");
|
||
|
|
}
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='4' "+sty_td_h+">작업지시사항</td> ");
|
||
|
|
sb.append(" <td colspan='20' "+sty_padding+"><pre>"+CommonUtils.checkNull((String)masterInfo.get("REMARK"))+"</pre></td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
|
||
|
|
sb.append(" <tr> ");
|
||
|
|
sb.append(" <td colspan='24' style='text-align: right;'>★거래명세서 자동생성은 발주서 기준으로 입고수량 대비 정품수량 동일시 구매팀 확인후 발주서 기준으로 자동생성 된다.</td> ");
|
||
|
|
sb.append(" </tr> ");
|
||
|
|
sb.append("</table> ");
|
||
|
|
|
||
|
|
return sb.toString();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 발주서 내용생성 (메일발송 내용)
|
||
|
|
* @return mail contents
|
||
|
|
*/
|
||
|
|
private String makeMailContents(String poContentsTable) {
|
||
|
|
|
||
|
|
StringBuffer sb = new StringBuffer();
|
||
|
|
sb.append("<!DOCTYPE html><html lang='ko' dir='ltr'>");
|
||
|
|
sb.append("<head> ");
|
||
|
|
sb.append(" <meta http-equiv='Content-Type' content='text/html; charset=euc-kr'> ");
|
||
|
|
sb.append(" <style> ");
|
||
|
|
sb.append(" @import url(http://fonts.googleapis.com/earlyaccess/notosanskr.css); ");
|
||
|
|
sb.append(" @import url(https://fonts.googleapis.com/css?family=Roboto:100,300,500,500,700,900); ");
|
||
|
|
sb.append(" body {font-family: 'Noto Sans KR', sans-serif; background: #fff; width: 100%; position:relative;} ");
|
||
|
|
sb.append(" ");
|
||
|
|
sb.append(" .table {border-collapse: collapse; border-top:2px solid rgb(72, 155, 191); margin-top: 10px;} ");
|
||
|
|
sb.append(" .table td {border: 1px solid #ccc; border-radius: 5px; font-size: 13px; padding: 5px; border-bottom:1px solid #000;} ");
|
||
|
|
sb.append(" </style> ");
|
||
|
|
sb.append("</head> ");
|
||
|
|
sb.append("<body style='margin:0; padding:0;'>");
|
||
|
|
sb.append(poContentsTable);
|
||
|
|
sb.append("<div>※발신전용 메일입니다.<span> ");
|
||
|
|
sb.append("</body> ");
|
||
|
|
sb.append("</html> ");
|
||
|
|
|
||
|
|
return sb.toString();
|
||
|
|
}
|
||
|
|
/**
|
||
|
|
* 발주서 엑셀파일생성(메일첨부용)
|
||
|
|
* ※참고 : /purchaseOrder/purchaseOrderFormPopup_newDOWN.jsp
|
||
|
|
* @return 파일정보 HashMap
|
||
|
|
*/
|
||
|
|
private HashMap makeMailAttachFileOrderSheet(Map masterInfo, String poContentsTable) {
|
||
|
|
HashMap resultMap = null;
|
||
|
|
|
||
|
|
String excelName = CommonUtils.checkNull((String)masterInfo.get("EXCELFILE_NAME"));
|
||
|
|
|
||
|
|
|
||
|
|
StringBuffer sb = new StringBuffer();
|
||
|
|
sb.append("<html xmlns:v='urn:schemas-microsoft-com:vml' xmlns:o='urn:schemas-microsoft-com:office:office' xmlns:x='urn:schemas-microsoft-com:office:excel' xmlns='http://www.w3.org/TR/REC-html40'>");
|
||
|
|
sb.append("<head> ");
|
||
|
|
sb.append(" <meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>");
|
||
|
|
sb.append("</head>");
|
||
|
|
sb.append("<body> ");
|
||
|
|
sb.append(poContentsTable);
|
||
|
|
sb.append("</body>");
|
||
|
|
sb.append("</html>");
|
||
|
|
|
||
|
|
FileOutputStream fos = null;
|
||
|
|
try {
|
||
|
|
File fpath = new File(Constants.Mail.FILE_PATH);
|
||
|
|
if(!fpath.exists()){
|
||
|
|
//System.out.println("폴더없음 ["+fpath.getAbsolutePath()+"]");
|
||
|
|
if(fpath.mkdirs()){ //생성할 폴더가 없으면 생성
|
||
|
|
//System.out.println("폴더생성완료");
|
||
|
|
}else{
|
||
|
|
System.out.println("PurchaseOrderService.makeMailAttachFileOrderSheet ###폴더생성실패["+Constants.Mail.FILE_PATH+"]");
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
File file = new File(Constants.Mail.FILE_PATH, excelName);
|
||
|
|
fos = new FileOutputStream(file);
|
||
|
|
fos.write(sb.toString().getBytes());
|
||
|
|
fos.close();
|
||
|
|
|
||
|
|
//결과
|
||
|
|
resultMap = new HashMap();
|
||
|
|
resultMap.put(Constants.Db.COL_FILE_REAL_NAME , excelName);
|
||
|
|
resultMap.put(Constants.Db.COL_FILE_SAVED_NAME, excelName);
|
||
|
|
resultMap.put(Constants.Db.COL_FILE_PATH , Constants.Mail.FILE_PATH);
|
||
|
|
} catch (FileNotFoundException e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
} catch (IOException e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
} finally {
|
||
|
|
if(fos != null){
|
||
|
|
try {
|
||
|
|
fos.close();
|
||
|
|
} catch (IOException e) {
|
||
|
|
e.printStackTrace();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 부적합이재현 리스트
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public ArrayList<HashMap<String,Object>> getdeliveryMngInvalidList(HttpServletRequest request,Map<String,Object> paramMap){
|
||
|
|
ArrayList<HashMap<String,Object>> oemInfoList = new ArrayList();
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
try{
|
||
|
|
|
||
|
|
String countPerPage = CommonUtils.checkNull(request.getParameter("countPerPage"), Constants.ADMIN_COUNT_PER_PAGE+"");
|
||
|
|
paramMap.put("COUNT_PER_PAGE", Integer.parseInt(countPerPage));
|
||
|
|
Map pageMap = (HashMap)sqlSession.selectOne("purchaseOrder.getdeliveryMngInvalidListCnt", paramMap);
|
||
|
|
|
||
|
|
pageMap = (HashMap)CommonUtils.setPagingInfo(request, pageMap);
|
||
|
|
|
||
|
|
paramMap.put("PAGE_END", pageMap.get("PAGE_END"));
|
||
|
|
paramMap.put("PAGE_START", pageMap.get("PAGE_START"));
|
||
|
|
|
||
|
|
oemInfoList = (ArrayList)sqlSession.selectList("purchaseOrder.getdeliveryMngInvalidList", paramMap);
|
||
|
|
|
||
|
|
}catch(Exception e){
|
||
|
|
throw e;
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(oemInfoList);
|
||
|
|
}
|
||
|
|
|
||
|
|
public Map getDeliveryMngInvalidInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map<String,Object> resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultMap = sqlSession.selectOne("purchaseOrder.getdeliveryMngInvalidInfo", paramMap);
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 부적합내용등록
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map invalidAction(HttpServletRequest request, Map paramMap){
|
||
|
|
Map resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
|
||
|
|
|
||
|
|
String checkArr[] = (CommonUtils.checkNull(paramMap.get("checkArr"))).split(",");
|
||
|
|
|
||
|
|
if(0 == checkArr.length){
|
||
|
|
checkArr[0] = CommonUtils.checkNull(paramMap.get("checkArr"));
|
||
|
|
}
|
||
|
|
|
||
|
|
if(null != checkArr && 0 < checkArr.length){
|
||
|
|
paramMap.put("checkArr",checkArr);
|
||
|
|
sqlSession.update("purchaseOrder.updateinvalidAction", paramMap);
|
||
|
|
|
||
|
|
sqlSession.commit();
|
||
|
|
resultMap.put("result", true);
|
||
|
|
resultMap.put("msg", Message.DELETE_SUCCESS);
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
resultMap.put("result", false);
|
||
|
|
resultMap.put("msg", Message.DELETE_FAILED);
|
||
|
|
sqlSession.rollback();
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return resultMap;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 바코드 프린트할 장납기품 정보 조회
|
||
|
|
* @param request
|
||
|
|
* @param paramMap
|
||
|
|
* @return
|
||
|
|
*/
|
||
|
|
public Map bacodePrintInfo(HttpServletRequest request,Map paramMap){
|
||
|
|
Map<String,Object> resultMap = new HashMap();
|
||
|
|
SqlSession sqlSession = null;
|
||
|
|
|
||
|
|
try{
|
||
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
||
|
|
resultMap = sqlSession.selectOne("purchaseOrder.bacodePrintInfo", paramMap);
|
||
|
|
}catch(Exception e){
|
||
|
|
e.printStackTrace();
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
|
||
|
|
return CommonUtils.toUpperCaseMapKey(resultMap);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void saveLocation(HttpServletRequest request,Map paramMap) throws Exception{
|
||
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
|
||
|
|
try{
|
||
|
|
String[] OBJIDs = request.getParameterValues("OBJID");
|
||
|
|
String[] DETAIL_GROUP = request.getParameterValues("DETAIL_GROUP");
|
||
|
|
|
||
|
|
int j=0;
|
||
|
|
if(OBJIDs != null){
|
||
|
|
for(int i=0; i<OBJIDs.length; i++){
|
||
|
|
String _SEQ = request.getParameterValues("SEQ")[i];
|
||
|
|
int SEQ = Integer.parseInt(_SEQ);
|
||
|
|
Map saveMap = new HashMap();
|
||
|
|
if(0==SEQ % (DETAIL_GROUP.length)){
|
||
|
|
j=DETAIL_GROUP.length;
|
||
|
|
}else{
|
||
|
|
j=SEQ % DETAIL_GROUP.length;
|
||
|
|
}
|
||
|
|
|
||
|
|
System.out.println("JJJJJJJJJJJJJJJJ ------->"+j);
|
||
|
|
|
||
|
|
saveMap.put("OBJID" , CommonUtils.checkNull(OBJIDs[i],CommonUtils.createObjId()));
|
||
|
|
saveMap.put("PARENT_OBJID" , CommonUtils.checkNull(paramMap.get("PARENT_OBJID")));
|
||
|
|
saveMap.put("ORDER_PART_OBJID" , CommonUtils.checkNull(paramMap.get("ORDER_PART_OBJID_"+(i+1))));
|
||
|
|
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
saveMap.put("GROUP_SEQ" , CommonUtils.checkNull(request.getParameterValues("GROUP_SEQ")[i]));
|
||
|
|
saveMap.put("SEQ" , CommonUtils.checkNull(request.getParameterValues("SEQ")[i]));
|
||
|
|
|
||
|
|
saveMap.put("RECEIPT_QTY" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_QTY")[i],"0"));
|
||
|
|
saveMap.put("RECEIPT_DATE" , CommonUtils.checkNull(request.getParameterValues("RECEIPT_DATE")[i]));
|
||
|
|
saveMap.put("LOCATION" , CommonUtils.checkNull(request.getParameterValues("LOCATION")[i]));
|
||
|
|
saveMap.put("SUB_LOCATION" , CommonUtils.checkNull(request.getParameterValues("SUB_LOCATION")[i]));
|
||
|
|
saveMap.put("WRITER" , CommonUtils.checkNull(paramMap.get("WRITER")));
|
||
|
|
System.out.println("saveMap::: ------->"+saveMap);
|
||
|
|
sqlSession.update("supplyChainMgmt.saveLocationInfo", saveMap);
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
sqlSession.commit();
|
||
|
|
}
|
||
|
|
}catch(Exception e){
|
||
|
|
sqlSession.rollback();
|
||
|
|
e.printStackTrace();
|
||
|
|
throw new Exception(e);
|
||
|
|
}finally{
|
||
|
|
sqlSession.close();
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|