Commit 7a51b0b7 authored by wansari's avatar wansari

merged in head for firm plan release ibase3-webitm-mfg5-7-8-1


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@102713 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 609a9913
...@@ -8,7 +8,7 @@ import java.util.HashMap; ...@@ -8,7 +8,7 @@ import java.util.HashMap;
public class SiteItemSummaryBean public class SiteItemSummaryBean
{ {
private String siteCode = "",itemCode = "",workOrder = "",siteCodeShip = "",transTran = "", private String siteCode = "",itemCode = "",workOrder = "",siteCodeShip = "",transTran = "",
locCode = "",lotSl="",lotNo=""; locCode = "",lotSl="",lotNo="",lineNoOrder = "";
private double otherSiteQty = 0; private double otherSiteQty = 0;
ArrayList stockList = new ArrayList(); ArrayList stockList = new ArrayList();
...@@ -157,4 +157,13 @@ public class SiteItemSummaryBean ...@@ -157,4 +157,13 @@ public class SiteItemSummaryBean
//Changed by wasim on on 11-04-2016 for get set method for stock update [START] //Changed by wasim on on 11-04-2016 for get set method for stock update [START]
//Changed by wasim on on 13-07-2016 for get set method for line number order [START]
public String getLineNoOrder() {
return lineNoOrder;
}
public void setLineNoOrder(String lineNoOrder) {
this.lineNoOrder = lineNoOrder;
}
//Changed by wasim on on 11-04-2016 for get set method for line number order [END]
} }
...@@ -864,7 +864,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -864,7 +864,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("Current Stock return map : "+stockReturnMap); System.out.println("Current Stock return map : "+stockReturnMap);
balanceQty = Double.parseDouble(stockReturnMap.get("BALANCE_QTY")); balanceQty = Double.parseDouble(stockReturnMap.get("BALANCE_QTY"));
balanceQty = Double.parseDouble(df.format(balanceQty));
errorCodeRet = stockReturnMap.get("ERROR_CODE"); errorCodeRet = stockReturnMap.get("ERROR_CODE");
detailMap.put("BALANCE_QTY",String.valueOf(balanceQty)); /// 19-Jul-16 manoharan update the balance for alternate
//if ("Y".equalsIgnoreCase(tempWorderObj.getCritItem())) //if ("Y".equalsIgnoreCase(tempWorderObj.getCritItem()))
//{ //{
...@@ -891,6 +893,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -891,6 +893,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if(!"O".equalsIgnoreCase(detailMap.get("ALLOCATE_TYPE")) && !isSufficient) if(!"O".equalsIgnoreCase(detailMap.get("ALLOCATE_TYPE")) && !isSufficient)
{ {
System.out.println("worderExpLevSufficient before checkForAlternateItem ["+worderExpLevSufficient+"]"); System.out.println("worderExpLevSufficient before checkForAlternateItem ["+worderExpLevSufficient+"]");
System.out.println("before checkForAlternateItem detailMap ["+detailMap+"]");
stockReturnMap = checkForAlternateItem(detailMap, conn); stockReturnMap = checkForAlternateItem(detailMap, conn);
System.out.println("worderExpLevSufficient after checkForAlternateItem ["+worderExpLevSufficient+"]"); System.out.println("worderExpLevSufficient after checkForAlternateItem ["+worderExpLevSufficient+"]");
System.out.println("Other site alternate Map return=="+stockReturnMap); System.out.println("Other site alternate Map return=="+stockReturnMap);
...@@ -918,6 +921,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -918,6 +921,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
{ {
detailMap.put("ITEM_CODE",tempWorderObj.getItemCode()); detailMap.put("ITEM_CODE",tempWorderObj.getItemCode());
detailMap.put("QUANTITY",String.valueOf(tempWorderObj.getQuantity())); detailMap.put("QUANTITY",String.valueOf(tempWorderObj.getQuantity()));
detailMap.put("BALANCE_QTY",String.valueOf(balanceQty)); /// 19-Jul-16 manoharan update the balance for alternate
} }
} }
//} //}
...@@ -1478,9 +1482,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -1478,9 +1482,9 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
//lotSl = checkNull(rs.getString("SITE_CODE")); //lotSl = checkNull(rs.getString("SITE_CODE"));
stkQuantity = rs.getDouble("QUANTITY"); stkQuantity = rs.getDouble("QUANTITY");
expDateT = rs.getTimestamp("EXP_DATE"); expDateT = rs.getTimestamp("EXP_DATE");
System.out.println("in checkCurrentSiteStock ["+count1+"] balanceQty [" + balanceQty + "] stkQuantity [" + stkQuantity+ "] For item code ["+detailMap.get("ITEM_CODE") + "]");
//Changed by wasim on 29-01-2016 to continue if min_req_qty greater than stock qty [START] //Changed by wasim on 29-01-2016 to continue if min_req_qty greater than stock qty [START]
if(stkQuantity < minQtyReq) if(stkQuantity < minQtyReq || stkQuantity <= 0)
{ {
System.out.println("in checkCurrentSiteStock Stock quantity is less than min quantity required so continue loop"); System.out.println("in checkCurrentSiteStock Stock quantity is less than min quantity required so continue loop");
continue; continue;
...@@ -3527,9 +3531,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -3527,9 +3531,10 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
pstmt1.close(); pstmt1.close();
rs1 = null; rs1 = null;
pstmt1 = null; pstmt1 = null;
System.out.println("qtyPerBom A2M : "+qtyPerBom);
propotinateAltQty = (balanceQty * altQuantity) / qtyPerBom ;//(4 * 15)/10 = 6 propotinateAltQty = (balanceQty * altQuantity) / qtyPerBom ;//(4 * 15)/10 = 6
System.out.println("propotinateAltQty A2M : "+propotinateAltQty); System.out.println("in checkForAlternateItem qtyPerBom A2M ["+qtyPerBom + "] balanceQty [" + balanceQty + "] altQuantity [" + altQuantity+ "] propotinateAltQty [" + propotinateAltQty+ "]" );
// System.out.println("propotinateAltQty A2M : "+propotinateAltQty);
//propotinateQty = getProportionateQty(altItemDetailMap,"A2M",conn); //propotinateQty = getProportionateQty(altItemDetailMap,"A2M",conn);
//now check in stock alternate item sufficient or not (propotinateQty) //now check in stock alternate item sufficient or not (propotinateQty)
...@@ -4109,7 +4114,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4109,7 +4114,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
else else
{ {
stockSqlBuf.append("select nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) as QUANTITY, stock.loc_code as LOC_CODE,"); stockSqlBuf.append("select nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) as QUANTITY, stock.loc_code as LOC_CODE,");
stockSqlBuf.append("stock.lot_no as LOT_NO, stock.lot_sl as LOT_SL, nvl(stock.potency_perc,0) as POTENCY_PERC, stock.crea_date , " ); stockSqlBuf.append("stock.lot_no as LOT_NO, stock.lot_sl as LOT_SL, nvl(stock.potency_perc,0) as POTENCY_PERC, stock.crea_date, " );
stockSqlBuf.append(" stock.dimension, stock.SITE_CODE__MFG, stock.EXP_DATE as EXP_DATE, stock.UNIT, stock.ITEM_SER, stock.MFG_DATE, stock.ALLOC_QTY, stock.PACK_CODE "); stockSqlBuf.append(" stock.dimension, stock.SITE_CODE__MFG, stock.EXP_DATE as EXP_DATE, stock.UNIT, stock.ITEM_SER, stock.MFG_DATE, stock.ALLOC_QTY, stock.PACK_CODE ");
} }
...@@ -4156,22 +4161,22 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4156,22 +4161,22 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
System.out.println("locType------>>["+locType+"]"); System.out.println("locType------>>["+locType+"]");
stockSqlBuf.append(" from stock,location,invstat where stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat "); stockSqlBuf.append(" from stock,location,invstat where stock.loc_code = location.loc_code and location.inv_stat = invstat.inv_stat ");
stockSqlBuf.append(" and stock.site_code = '"+siteCode+"'"); stockSqlBuf.append(" and stock.site_code = '"+siteCode+"' ");
stockSqlBuf.append(" and stock.item_code = '"+itemCode+"'"); stockSqlBuf.append(" and stock.item_code = '"+itemCode+"' ");
stockSqlBuf.append(" and location.loc_type = '"+locType+"'"); stockSqlBuf.append(" and location.loc_type = '"+locType+"' ");
stockSqlBuf.append(" and case when stock.alloc_qty is null then 0 else stock.alloc_qty end >= 0 "); //stockSqlBuf.append(" and case when stock.alloc_qty is null then 0 else stock.alloc_qty end >= 0 ");
stockSqlBuf.append(" and (case when stock.quantity is null then 0 else stock.quantity end) - (case when stock.alloc_qty is null then 0 else stock.alloc_qty end) - (case when stock.hold_qty is null then 0 else stock.hold_qty end) > 0 "); stockSqlBuf.append(" and (case when stock.quantity is null then 0 else stock.quantity end) - (case when stock.alloc_qty is null then 0 else stock.alloc_qty end) - (case when stock.hold_qty is null then 0 else stock.hold_qty end) > 0 ");
stockSqlBuf.append(" and invstat.available = 'Y' "); stockSqlBuf.append(" and invstat.available = 'Y' ");
//stockSqlBuf.append(" and (case when stock.consider_allocate is null then 'Y' else stock.consider_allocate end = 'Y' "); //stockSqlBuf.append(" and (case when stock.consider_allocate is null then 'Y' else stock.consider_allocate end = 'Y' ");
if(!"I".equalsIgnoreCase(detailSum)) if(!"I".equalsIgnoreCase(detailSum))
{ {
stockSqlBuf.append("and nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) >= "+minQtyPerLot); stockSqlBuf.append(" and nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) >= "+minQtyPerLot + " ");
} }
// 13-jun-16 manoharan in case of other site quantity available should be atleast 1 article i.e. availabe should be >= qty_per_art // 13-jun-16 manoharan in case of other site quantity available should be atleast 1 article i.e. availabe should be >= qty_per_art
if("Y".equalsIgnoreCase(otherSite)) if("Y".equalsIgnoreCase(otherSite))
{ {
stockSqlBuf.append("and nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) >= stock.qty_per_art "); stockSqlBuf.append(" and nvl(stock.quantity,0) - nvl(stock.alloc_qty,0) >= stock.qty_per_art ");
} }
// end 13-jun-16 manoharan in case of other site quantity available should be atleast 1 article i.e. availabe should be >= qty_per_art // end 13-jun-16 manoharan in case of other site quantity available should be atleast 1 article i.e. availabe should be >= qty_per_art
if(suppCodeMfg.length() > 0 && ! "null".equalsIgnoreCase(suppCodeMfg)) if(suppCodeMfg.length() > 0 && ! "null".equalsIgnoreCase(suppCodeMfg))
...@@ -4192,7 +4197,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4192,7 +4197,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if(isCompareDimension) if(isCompareDimension)
{ {
stockSqlBuf.append(" and ddf_compare_dimension(stock.dimension, '" + dimension + "'," + trimWidth + ") = 'Y' "); stockSqlBuf.append(" and ddf_compare_dimension(stock.dimension, '" + dimension + "'," + trimWidth + ") = 'Y' ");
stockSqlBuf.append(" and stock.quantity - stock.alloc_qty - (case when stock.hold_qty is null then 0 else stock.hold_qty end) >= " + qtyPer+")"); stockSqlBuf.append(" and stock.quantity - stock.alloc_qty - (case when stock.hold_qty is null then 0 else stock.hold_qty end) >= " + qtyPer+") ");
} }
stockSqlBuf.append(" and invstat.stat_type <> 'S' "); stockSqlBuf.append(" and invstat.stat_type <> 'S' ");
...@@ -4200,7 +4205,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4200,7 +4205,7 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if ("Y".equalsIgnoreCase(trackShelfLife)) if ("Y".equalsIgnoreCase(trackShelfLife))
{ {
//stockSqlBuf.append( " and ( stock.exp_date > "+genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) +" or stock.exp_date is null )" ); //stockSqlBuf.append( " and ( stock.exp_date > "+genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) +" or stock.exp_date is null )" );
stockSqlBuf.append(" and ( stock.exp_date > to_date('"+ genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + "', 'yyyy-mm-dd' ) or stock.exp_date is null )" ); stockSqlBuf.append(" and ( stock.exp_date > to_date('"+ genericUtility.getValidDateString(effDate, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + "', 'yyyy-mm-dd' ) or stock.exp_date is null ) " );
} }
if("U".equalsIgnoreCase(useInvStatus)) if("U".equalsIgnoreCase(useInvStatus))
...@@ -4214,12 +4219,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi ...@@ -4214,12 +4219,12 @@ public class WoFirmplanPrc extends ProcessEJB implements WoFirmplanPrcLocal,WoFi
if("I".equalsIgnoreCase(detailSum)) if("I".equalsIgnoreCase(detailSum))
{ {
stockSqlBuf.append(" group by supp_code__mfg"); stockSqlBuf.append(" group by supp_code__mfg ");
stockSqlBuf.append(" order by sum( (case when quantity is null then 0 else quantity end) - (case when alloc_qty is null then 0 else alloc_qty end) )"); stockSqlBuf.append(" order by sum( (case when quantity is null then 0 else quantity end) - (case when alloc_qty is null then 0 else alloc_qty end) ) ");
} }
else if(! "S".equalsIgnoreCase(detailSum)) else if(! "S".equalsIgnoreCase(detailSum))
{ {
stockSqlBuf.append(" order by (case when '" + locUsageType + "' = 'P' then (case when rtrim(location.loc_group) = rtrim('" + locGroup + "') Then 'A' else 'B' end) else '0' end),"); stockSqlBuf.append(" order by (case when '" + locUsageType + "' = 'P' then (case when rtrim(location.loc_group) = rtrim('" + locGroup + "') Then 'A' else 'B' end) else '0' end), ");
if(isCompareDimension) if(isCompareDimension)
{ {
stockSqlBuf.append(" stock.dimension, "); stockSqlBuf.append(" stock.dimension, ");
...@@ -4720,7 +4725,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4720,7 +4725,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
pstmt.setString(8,chgUser); pstmt.setString(8,chgUser);
pstmt.setString(9,termId); pstmt.setString(9,termId);
pstmt.setString(10,"Auto Reserve from firmplan");//remarks pstmt.setString(10,"Auto Reserve from firmplan");//remarks
pstmt.setString(11,"N");//confirmed pstmt.setString(11,"Y");//confirmed
pstmt.setTimestamp(12, getCurrtDate()); pstmt.setTimestamp(12, getCurrtDate());
pstmt.setString(13,"O");//status pstmt.setString(13,"O");//status
...@@ -4813,7 +4818,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4813,7 +4818,8 @@ public String populateWorkOrderBill(Connection conn) throws Exception
return ""; return "";
} }
//public String InsertCrossDockAlloc(Map<String,String> sorderDetailMap, Connection conn) throws Exception, ITMException //public String InsertCrossDockAlloc(Map<String,String> sorderDetailMap, Connection conn) throws Exception, ITMException
public String InsertCrossDockAlloc(String transTran,String siteCodeShip,String siteCodeDlv,Connection conn) throws Exception, ITMException //public String InsertCrossDockAlloc(String transTran,String siteCodeShip,String siteCodeDlv,Connection conn) throws Exception, ITMException
public String InsertCrossDockAlloc(String transTran,String siteCodeShip,String siteCodeDlv,String orderNo,Connection conn) throws Exception, ITMException
{ {
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
String sql = "",tranId = ""; String sql = "",tranId = "";
...@@ -4823,11 +4829,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4823,11 +4829,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception
SiteItemSummaryBean siteItemSummaryObj = null; SiteItemSummaryBean siteItemSummaryObj = null;
ArrayList stkList = null; ArrayList stkList = null;
HashMap siteItemMap = null; HashMap siteItemMap = null;
String itemCode = "",lotNo = "",lotSl = "",locCode = "",siteCode = ""; String itemCode = "",lotNo = "",lotSl = "",locCode = "",siteCode = "",lineNoOrder = "";
double allocQty = 0; double allocQty = 0;
try try
{ {
System.out.println("Trans Tran["+transTran+"] Site code Ship["+siteCodeShip+"] Site Code Dlv ["+siteCodeDlv+"]"); System.out.println("Trans Tran["+transTran+"] Site code Ship["+siteCodeShip+"] Site Code Dlv ["+siteCodeDlv+"] OrderNo["+orderNo+"]");
tranId = generateTranTd("w_cross_dock_alloc","",siteCodeShip,conn); tranId = generateTranTd("w_cross_dock_alloc","",siteCodeShip,conn);
//for(SiteItemSummaryBean siteItemSummaryObj : siteItemReqQtyList) //for(SiteItemSummaryBean siteItemSummaryObj : siteItemReqQtyList)
...@@ -4851,7 +4857,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4851,7 +4857,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
lotSl = (String) siteItemMap.get("LOT_SL"); lotSl = (String) siteItemMap.get("LOT_SL");
siteCode = (String) siteItemMap.get("SITE_CODE"); siteCode = (String) siteItemMap.get("SITE_CODE");
allocQty = Double.parseDouble((siteItemMap.get("QUANTITY").toString())); allocQty = Double.parseDouble((siteItemMap.get("QUANTITY").toString()));
lineNoOrder = siteItemSummaryObj.getLineNoOrder();
System.out.println("Line Number order ["+lineNoOrder+"]");
System.out.println("TransTran["+transTran+"]=["+siteItemSummaryObj.getTransTran()+"]"); System.out.println("TransTran["+transTran+"]=["+siteItemSummaryObj.getTransTran()+"]");
System.out.println("SiteCodeShip["+siteCodeShip+"]=["+siteItemSummaryObj.getSiteCodeShip()+"]"); System.out.println("SiteCodeShip["+siteCodeShip+"]=["+siteItemSummaryObj.getSiteCodeShip()+"]");
System.out.println("SiteCodeDlv["+siteCodeDlv+"]=["+siteItemSummaryObj.getSiteCode()+"]"); System.out.println("SiteCodeDlv["+siteCodeDlv+"]=["+siteItemSummaryObj.getSiteCode()+"]");
...@@ -4890,14 +4898,15 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4890,14 +4898,15 @@ public String populateWorkOrderBill(Connection conn) throws Exception
) )
{ {
lineNo++; lineNo++;
//sql = "Insert into cross_dock_alloc_det ( TRAN_ID,LINE_NO,ORDER_NO,EXP_LEV,ITEM_CODE,"
sql = "Insert into cross_dock_alloc_det ( TRAN_ID,LINE_NO,ORDER_NO,EXP_LEV,ITEM_CODE," sql = "Insert into cross_dock_alloc_det ( TRAN_ID,LINE_NO,ORDER_NO,EXP_LEV,ITEM_CODE,"
+ "SITE_CODE,LOC_CODE,LOT_NO,LOT_SL,QUANTITY,REQ_QTY,POTENCY_ADJ ) " + "SITE_CODE,LOC_CODE,LOT_NO,LOT_SL,QUANTITY,REQ_QTY,POTENCY_ADJ,ORDER_REF,LINE_NO__ORD) "
+ "values (?,?,?,?,?, ?,?,?,?,?, ?,? )"; + "values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); //generate tran id pstmt.setString(1, tranId); //generate tran id
pstmt.setInt(2, lineNo); pstmt.setInt(2, lineNo);
pstmt.setString(3, WorderStkBeanObj.getWorkOrder()); pstmt.setString(3, orderNo);
pstmt.setString(4, WorderStkBeanObj.getExpLevel()); pstmt.setString(4, WorderStkBeanObj.getExpLevel());
pstmt.setString(5, WorderStkBeanObj.getItemCode()); pstmt.setString(5, WorderStkBeanObj.getItemCode());
pstmt.setString(6, WorderStkBeanObj.getSiteCode()); pstmt.setString(6, WorderStkBeanObj.getSiteCode());
...@@ -4905,8 +4914,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -4905,8 +4914,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception
pstmt.setString(8, WorderStkBeanObj.getLotNo()); pstmt.setString(8, WorderStkBeanObj.getLotNo());
pstmt.setString(9, WorderStkBeanObj.getLotSl()); pstmt.setString(9, WorderStkBeanObj.getLotSl());
pstmt.setDouble(10,allocQty ); pstmt.setDouble(10,allocQty );
pstmt.setDouble(11,WorderStkBeanObj.getAllocQty() ); //pstmt.setDouble(11,WorderStkBeanObj.getAllocQty() );
pstmt.setDouble(11, (WorderStkBeanObj.getAllocQty() - WorderStkBeanObj.getQtyAdj()) );
pstmt.setDouble(12,WorderStkBeanObj.getQtyAdj() ); pstmt.setDouble(12,WorderStkBeanObj.getQtyAdj() );
pstmt.setString(13, WorderStkBeanObj.getWorkOrder());
pstmt.setString(14,lineNoOrder);
pstmt.executeUpdate(); pstmt.executeUpdate();
pstmt.close();pstmt = null; pstmt.close();pstmt = null;
} }
...@@ -5459,6 +5471,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -5459,6 +5471,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception
valueXmlString.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />"); valueXmlString.append("<attribute pkNames=\"\" selected=\"N\" updateFlag=\"A\" status=\"N\" />");
valueXmlString.append("<dist_order/>"); valueXmlString.append("<dist_order/>");
valueXmlString.append("<line_no><![CDATA["+count+"]]></line_no>"); valueXmlString.append("<line_no><![CDATA["+count+"]]></line_no>");
//Changed by wasim on 13-07-2016 to set line number order [START]
tempObj.setLineNoOrder(String.valueOf(count));
//Changed by wasim on 13-07-2016 to set line number order [END]
valueXmlString.append("<tran_id__demand><![CDATA[]]></tran_id__demand>"); valueXmlString.append("<tran_id__demand><![CDATA[]]></tran_id__demand>");
valueXmlString.append("<item_code><![CDATA[").append(tempObj.getItemCode()).append("]]></item_code>"); valueXmlString.append("<item_code><![CDATA[").append(tempObj.getItemCode()).append("]]></item_code>");
valueXmlString.append("<qty_order><![CDATA["+tempObj.getOtherSiteQty()+"]]></qty_order>"); valueXmlString.append("<qty_order><![CDATA["+tempObj.getOtherSiteQty()+"]]></qty_order>");
...@@ -5729,6 +5746,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -5729,6 +5746,11 @@ public String populateWorkOrderBill(Connection conn) throws Exception
valueXmlString.append("<sale_order/>"); valueXmlString.append("<sale_order/>");
valueXmlString.append( "<line_no><![CDATA[" ).append(count).append( "]]></line_no>\r\n" ); valueXmlString.append( "<line_no><![CDATA[" ).append(count).append( "]]></line_no>\r\n" );
//Changed by wasim on 13-07-2016 to set line number order [START]
tempObj.setLineNoOrder(String.valueOf(count));
//Changed by wasim on 13-07-2016 to set line number order [END]
valueXmlString.append( "<site_code><![CDATA[" ).append( tempObj.getSiteCode() ).append( "]]></site_code>\r\n" ); valueXmlString.append( "<site_code><![CDATA[" ).append( tempObj.getSiteCode() ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<item_flg><![CDATA[" ).append( "I" ).append( "]]></item_flg>\r\n" ); valueXmlString.append( "<item_flg><![CDATA[" ).append( "I" ).append( "]]></item_flg>\r\n" );
valueXmlString.append( "<quantity><![CDATA[" ).append( tempObj.getOtherSiteQty() ).append( "]]></quantity>\r\n" ); valueXmlString.append( "<quantity><![CDATA[" ).append( tempObj.getOtherSiteQty() ).append( "]]></quantity>\r\n" );
...@@ -5803,7 +5825,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -5803,7 +5825,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
System.out.println("KESET--->"+me); System.out.println("KESET--->"+me);
InsertCrossDockAlloc(siteCodeSave[0],siteCodeSave[1],siteCodeSave[2],conn); //InsertCrossDockAlloc(siteCodeSave[0],siteCodeSave[1],siteCodeSave[2],conn);
Document dom = genericUtility.parseString(me.getValue().toString()+last); Document dom = genericUtility.parseString(me.getValue().toString()+last);
objName = genericUtility.getColumnValue("objName", dom).trim(); objName = genericUtility.getColumnValue("objName", dom).trim();
...@@ -5840,6 +5862,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -5840,6 +5862,9 @@ public String populateWorkOrderBill(Connection conn) throws Exception
System.out.println("@@After retString DO/SO------>>["+returnString+"]"); System.out.println("@@After retString DO/SO------>>["+returnString+"]");
if(returnString != null && ((returnString.indexOf("VTSUCC1") > -1) || (returnString.indexOf("PRCSTATUS") > -1))) if(returnString != null && ((returnString.indexOf("VTSUCC1") > -1) || (returnString.indexOf("PRCSTATUS") > -1)))
{ {
InsertCrossDockAlloc(siteCodeSave[0],siteCodeSave[1],siteCodeSave[2],orderNo,conn);
returnString = CreateDistSorderAllocation(orderNo,transKey,conn); returnString = CreateDistSorderAllocation(orderNo,transKey,conn);
//int lineNoCnt = 0; //int lineNoCnt = 0;
/*if("D".equalsIgnoreCase(transKey)) /*if("D".equalsIgnoreCase(transKey))
...@@ -6334,7 +6359,6 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6334,7 +6359,6 @@ public String populateWorkOrderBill(Connection conn) throws Exception
return retString; return retString;
} }
//private String CreateDistSorderAllocation(Map<String,String>detailMap,Connection conn) throws Exception
private String CreateDistSorderAllocation(String orderNo,String transKey,Connection conn) throws Exception private String CreateDistSorderAllocation(String orderNo,String transKey,Connection conn) throws Exception
{ {
PreparedStatement pstmt = null,pstmtSiteitem = null,pstmtOrder = null,pstmtInsert = null; PreparedStatement pstmt = null,pstmtSiteitem = null,pstmtOrder = null,pstmtInsert = null;
...@@ -6355,9 +6379,191 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6355,9 +6379,191 @@ public String populateWorkOrderBill(Connection conn) throws Exception
ResultSet rsOrder = null; ResultSet rsOrder = null;
try try
{ {
/*itemCode = detailMap.get("ITEM_CODE"); System.out.println("Order Number["+orderNo+"] and trans key["+transKey+"]");
if("P".equalsIgnoreCase(transKey))
{
sqlInsert = " INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,ITEM_CODE,SITE_CODE,LOT_NO,LOT_SL,LOC_CODE,QTY_ALLOC,"//8
+" UNIT,EXP_DATE,SITE_CODE__MFG,MFG_DATE,QUANTITY,"//13
+" DATE_ALLOC,STATUS,ALLOC_MODE,CONV__QTY_STDUOM,UNIT__STD,QUANTITY__STDUOM,EXP_LEV,ITEM_CODE__ORD)"//21
+" VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,"
+" ?, ?, ?, ?, ?, ?, ?, ?, ? ) " ;
sqlOrder = "SELECT ITEM_CODE,SITE_CODE,LINE_NO,QUANTITY,EXP_LEV FROM SORDITEM WHERE SALE_ORDER = ? AND LINE_TYPE = 'I'";
}
else if("D".equalsIgnoreCase(transKey))
{
sqlInsert = "INSERT INTO DISTORDER_ALLOC (DIST_ORDER,LINE_NO,ITEM_CODE,SITE_CODE__SHIP,LOT_NO,LOT_SL,LOC_CODE,QTY_ALLOC,UNIT,"
+ " EXP_DATE,SITE_CODE__MFG,MFG_DATE,QUANTITY) "
+ "values (?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?)";//13
/*sqlOrder = "SELECT D.ITEM_CODE,H.SITE_CODE__SHIP AS SITE_CODE,D.LINE_NO,D.QTY_CONFIRM AS QUANTITY,' ' AS EXP_LEV FROM DISTORDER H,DISTORDER_DET D WHERE H.DIST_ORDER = D.DIST_ORDER "
+ "AND H.DIST_ORDER = ?";*/
sqlOrder = " SELECT S.ITEM_CODE,S.LOC_CODE,S.SITE_CODE,S.LOT_NO,S.LOT_SL,D.LINE_NO__ORD AS LINE_NO,D.QUANTITY,"
+ " S.EXP_DATE,S.SITE_CODE__MFG,S.MFG_DATE,S.UNIT,D.EXP_LEV "
+ " FROM CROSS_DOCK_ALLOC_DET D,STOCK S "
+ " WHERE D.ITEM_CODE = S.ITEM_CODE AND D.LOC_CODE = S.LOC_CODE AND D.SITE_CODE = S.SITE_CODE "
+ " AND D.LOT_NO = S.LOT_NO AND D.LOT_SL = S.LOT_SL "
+ " AND D.ORDER_NO = ?";
}
pstmtInsert = conn.prepareStatement(sqlInsert);
pstmtOrder = conn.prepareStatement(sqlOrder);
pstmtOrder.setString(1, orderNo);
rsOrder = pstmtOrder.executeQuery();
while(rsOrder.next())
{
deallocMap = new HashMap();
strAllocate = new HashMap();
OrderItemCode = rsOrder.getString("ITEM_CODE");
locCode = rsOrder.getString("LOC_CODE");
orderSiteCode = rsOrder.getString("SITE_CODE");
lotNo = rsOrder.getString("LOT_NO");
lotSl = rsOrder.getString("LOT_SL");
lineNo = rsOrder.getString("LINE_NO");
balanceQty = rsOrder.getDouble("QUANTITY");
expLev = rsOrder.getString("EXP_LEV");
expDate = rsOrder.getTimestamp("EXP_DATE");
siteCodeMfg = rsOrder.getString("SITE_CODE__MFG");
mfgDate = rsOrder.getTimestamp("MFG_DATE");
unit = rsOrder.getString("UNIT");
System.out.println("Main Order quantity="+balanceQty);
pstmtInsert.setString(1, orderNo);
pstmtInsert.setString(2, lineNo);
pstmtInsert.setString(3, OrderItemCode);
pstmtInsert.setString(4, orderSiteCode);
pstmtInsert.setString(5, lotNo);
pstmtInsert.setString(6, lotSl);
pstmtInsert.setString(7, locCode);
pstmtInsert.setDouble(8, balanceQty);
pstmtInsert.setString(9, unit);
pstmtInsert.setTimestamp(10, expDate);
pstmtInsert.setString(11, siteCodeMfg);
pstmtInsert.setTimestamp(12, mfgDate);
pstmtInsert.setDouble(13, balanceQty);
if("P".equalsIgnoreCase(transKey))
{
pstmtInsert.setTimestamp(14, getCurrtDate());
pstmtInsert.setString(15, "P");
pstmtInsert.setString(16, "A");
pstmtInsert.setDouble(17, 1);
pstmtInsert.setString(18, unit);
pstmtInsert.setString(19, "1.");
pstmtInsert.setDouble(20, balanceQty);
pstmtInsert.setString(21, OrderItemCode);
strAllocate.put("ref_ser","S-ORD");
}
else if("D".equalsIgnoreCase(transKey))
{
strAllocate.put("ref_ser","D-ORD");
}
pstmtInsert.addBatch();
deallocMap.put("ALLOC_QTY",""+(-1 * balanceQty));
deallocMap.put("LOC_CODE", locCode);
deallocMap.put("ITEM_CODE",itemCode);
deallocMap.put("SITE_CODE",siteCode);
deallocMap.put("LOT_NO",lotNo);
deallocMap.put("LOT_SL",lotSl);
errorString = updateStockAllocQty(deallocMap, conn);
System.out.println("errorString after deallocate Stock update["+errorString+"]");
strAllocate.put("tran_date",getCurrdateAppFormat());
strAllocate.put("ref_id",orderNo);
strAllocate.put("ref_line", "" + lineNo);
strAllocate.put("site_code",siteCode);
strAllocate.put("item_code",itemCode);
strAllocate.put("loc_code", locCode);
strAllocate.put("lot_no",lotNo);
strAllocate.put("lot_sl",lotSl);
strAllocate.put("alloc_qty", balanceQty);
strAllocate.put("chg_user",chgUser);
strAllocate.put("chg_term",termId);
strAllocate.put("chg_win","w_wo_firmplan");
if (allocQty != 0)
{
errorString = invAllocTrace.updateInvallocTrace(strAllocate, conn);
System.out.println("errorString after updateInvallocTrace allocate----->2["+errorString+"]");
}
strAllocate = null;
deallocMap = null;
}
pstmtInsert.executeBatch();
pstmtInsert.close();pstmtInsert = null;
rsOrder.close();rsOrder = null;
pstmtOrder.close();pstmtOrder = null;
}
catch(Exception e)
{
e.printStackTrace();
throw new Exception(e);
}
finally
{
try
{
if(rs!=null)
{
rs.close();rs = null;
}
if(pstmt!=null)
{
pstmt.close();pstmt = null;
}
if(rsOrder!=null)
{
rsOrder.close();rsOrder = null;
}
if(pstmtOrder!=null)
{
pstmtOrder.close();pstmtOrder = null;
}
if(pstmtInsert!=null)
{
pstmtInsert.close();pstmtInsert = null;
}
}
catch(Exception ex)
{
throw new Exception(ex);
}
}
return "";
}
//private String CreateDistSorderAllocation(Map<String,String>detailMap,Connection conn) throws Exception
/*private String CreateDistSorderAllocation(String orderNo,String transKey,Connection conn) throws Exception
{
PreparedStatement pstmt = null,pstmtSiteitem = null,pstmtOrder = null,pstmtInsert = null;
String sql = "",itemCode = "",siteCode = "",errorString = "",locCode = "",lotNo = "",lotSl = "",sqlSiteitem = "",expLev = "",
siteCodeMfg = "",unit = "",sqlInsert = "",sqlOrder = "",OrderItemCode = "", orderSiteCode = "";
String lineNo = "";
HashMap strAllocate = null;
Map deallocMap = null;
InvAllocTraceBean invAllocTrace = new InvAllocTraceBean();
ArrayList stkList = null;
ResultSet rs = null;
double allocQty =0,quantity = 0,balanceQty = 0;
WorderStkBean worderStkBeanObj = null;
SiteItemSummaryBean SiteItemSummaryBeanObj = null;
HashMap siteItemMap = null;
Timestamp expDate = null,mfgDate = null;
ResultSet rsOrder = null;
try
{
itemCode = detailMap.get("ITEM_CODE");
siteCode = detailMap.get("SITE_CODE"); siteCode = detailMap.get("SITE_CODE");
lineNo = Integer.parseInt(detailMap.get("LINE_NO"));*///Changed by wasim on 03-03-2016 to get the lineNO lineNo = Integer.parseInt(detailMap.get("LINE_NO"));//Changed by wasim on 03-03-2016 to get the lineNO
System.out.println("Order Number["+orderNo+"] and trans key["+transKey+"]"); System.out.println("Order Number["+orderNo+"] and trans key["+transKey+"]");
//for(WorderStkBean tempStkObj : ) //for(WorderStkBean tempStkObj : )
...@@ -6365,13 +6571,13 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6365,13 +6571,13 @@ public String populateWorkOrderBill(Connection conn) throws Exception
if("P".equalsIgnoreCase(transKey)) if("P".equalsIgnoreCase(transKey))
{ {
/*sqlInsert ="INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,EXP_LEV,ITEM_CODE__ORD,SITE_CODE ," sqlInsert ="INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,EXP_LEV,ITEM_CODE__ORD,SITE_CODE ,"
+"ITEM_CODE,QUANTITY ,LOT_NO, LOT_SL, LOC_CODE, UNIT, QTY_ALLOC," +"ITEM_CODE,QUANTITY ,LOT_NO, LOT_SL, LOC_CODE, UNIT, QTY_ALLOC,"
+" DATE_ALLOC, STATUS, EXP_DATE, ALLOC_MODE, " +" DATE_ALLOC, STATUS, EXP_DATE, ALLOC_MODE, "
+" CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, " +" CONV__QTY_STDUOM, UNIT__STD, QUANTITY__STDUOM, "
+"MFG_DATE, SITE_CODE__MFG ) " +"MFG_DATE, SITE_CODE__MFG ) "
+"VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ," +"VALUES ( ?, ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? ,"
+" ?, ?, ?, ?, ?, ?, ?, ?, ? ) " ;*/ +" ?, ?, ?, ?, ?, ?, ?, ?, ? ) " ;
sqlInsert = " INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,ITEM_CODE,SITE_CODE,LOT_NO,LOT_SL,LOC_CODE,QTY_ALLOC,"//8 sqlInsert = " INSERT INTO SORDALLOC (SALE_ORDER,LINE_NO,ITEM_CODE,SITE_CODE,LOT_NO,LOT_SL,LOC_CODE,QTY_ALLOC,"//8
+" UNIT,EXP_DATE,SITE_CODE__MFG,MFG_DATE,QUANTITY,"//13 +" UNIT,EXP_DATE,SITE_CODE__MFG,MFG_DATE,QUANTITY,"//13
+" DATE_ALLOC,STATUS,ALLOC_MODE,CONV__QTY_STDUOM,UNIT__STD,QUANTITY__STDUOM,EXP_LEV,ITEM_CODE__ORD)"//21 +" DATE_ALLOC,STATUS,ALLOC_MODE,CONV__QTY_STDUOM,UNIT__STD,QUANTITY__STDUOM,EXP_LEV,ITEM_CODE__ORD)"//21
...@@ -6546,7 +6752,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception ...@@ -6546,7 +6752,7 @@ public String populateWorkOrderBill(Connection conn) throws Exception
} }
return ""; return "";
} }*/
//get Current date in timestamp format //get Current date in timestamp format
private java.sql.Timestamp getCurrtDate() throws RemoteException,ITMException private java.sql.Timestamp getCurrtDate() throws RemoteException,ITMException
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment