Commit 7a381212 authored by smestry's avatar smestry

W15FSUN008, Updated class file Palletization.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98879 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 4e2c430f
......@@ -366,7 +366,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
rs1 = null;
// InvStat
if(holdQuantity >= 0)
if(holdQuantity > 0)
{
//System.out.println("inside hold quantity greater than zero :::::::::::::::::: ");
nexpLoc = distComm.getDisparams("999999","NEAR_EXP_LOCK",conn1);
......@@ -488,7 +488,9 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
HashMap hm2 = new HashMap();
hm2 = commonWmsUtility.getPalletizedAttributes(rs.getString("item_code"), siteCode, conn1);
procMth = (String) hm2.get("PROC_MTH");
int procMth1 = Integer.parseInt(procMth);
//= parse procMth;
System.out.println("qcReqd ::::::::::::: " + qcReqd);
System.out.println("procMth ::::::::::::: " + procMth);
......@@ -496,7 +498,7 @@ public class PalletizationConf extends ValidatorEJB implements PalletizationConf
{
qcType = "N";
}
else if(qcReqd.length() > 0 && "Y".equalsIgnoreCase(qcReqd))
else if(procMth1 > 0 && "Y".equalsIgnoreCase(qcReqd))
{
qcType = "F";
}
......
......@@ -169,6 +169,13 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
{
System.out.println("Inside loc_code ::::::::::: ");
if(locationCode.length() <= 0)
{
System.out.println("Blank for Location Code :::::::::: ");
errCode = "VTINVLPNO";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
if(!locStockList.contains(locationCode) && locationCode.length() > 0)
{
System.out.println("Location Code does not exist in stock table :::::::::: ");
......@@ -177,7 +184,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errFields.add(childNodeName.toLowerCase());
}
}
if("pallet_no__source".equalsIgnoreCase(childNodeName))
/*if("pallet_no__source".equalsIgnoreCase(childNodeName))
{
System.out.println("Inside pallet_no__source ::::::::::: ");
......@@ -191,7 +198,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
else if(locationCode.length() > 0 && palletNoSource.length() > 0)
{
System.out.println(" value found for Location Code and pallet No Source :::::::::: ");
errCode = "VTINVLPNO";
errCode = "VTPNOLOC";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
......@@ -202,7 +209,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}
}*/
if("pallet_no".equalsIgnoreCase(childNodeName))
{
if(palletNo.length() <= 0)
......@@ -219,13 +226,20 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
if(locationCode.equals(palletNo) || palletNoSource.equals(palletNo))
if(locationCode.equals(palletNo))
{
System.out.println("Location Code or Pallet No Source and Pallet No is same :::::::::: ");
errCode = "VTLOCPLT";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
/*if(locationCode.equals(palletNo) || palletNoSource.equals(palletNo))
{
System.out.println("Location Code or Pallet No Source and Pallet No is same :::::::::: ");
errCode = "VTLOCPLT";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}*/
}
}
break;
......@@ -236,7 +250,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("DOM1----->>["+genericUtility.serializeDom(dom1).toString()+"]");
System.out.println("DOM2----->>["+genericUtility.serializeDom(dom2).toString()+"]");
String tranType = "", palletType = "";
String tranType = "", palletType = "", remarks = "";
parentNodeList = dom2.getElementsByTagName("Detail2");
parentNode = parentNodeList.item(0);
......@@ -245,6 +259,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
tranType = checkNullAndTrim(genericUtility.getColumnValue("tran_type",dom));
palletType = checkNullAndTrim(genericUtility.getColumnValue("pallet_type",dom));
remarks = checkNullAndTrim(genericUtility.getColumnValue("remarks",dom));
for(ctr = 0; ctr < childNodeListLength; ctr++)
{
......@@ -259,6 +274,13 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
else if(tranType.length() > 3)
{
System.out.println(" Blank Transcation Type :::::::::: ");
errCode = "VMTTYPELEN";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
if("".equalsIgnoreCase(palletType))
{
System.out.println("Blank Pallet Type :::::::::: ");
......@@ -266,6 +288,13 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
if(remarks.length() > 60)
{
System.out.println(" Remarks cannot be greater than 60 :::::::::: ");
errCode = "VTREMLEN";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
} //end detail2 for loop
break;
......@@ -321,7 +350,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
if(rs != null){rs.close();rs = null;}
//System.out.println("itemCodeDB ------->>["+itemCodeDB+"]");
parseQuantity = Double.parseDouble(quantity);
//parseQuantity = Double.parseDouble(quantity);
//System.out.println("parseQuantity ------->>["+parseQuantity+"]");
sql = "select (quantity - (alloc_qty + hold_qty)) as quantity from stock where loc_code in (?,?) "
......@@ -347,11 +376,11 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
childNodeName = childNode.getNodeName();
System.out.println("childNodeName ------->>["+childNodeName+"]");
if("quantity".equalsIgnoreCase(childNodeName))
if("lot_sl".equalsIgnoreCase(childNodeName))
{
//System.out.println("Inside quantity ::::::::::: ");
if(parseQuantity <= 0)
/*if(parseQuantity <= 0)
{
System.out.println("quantity less than zero :::::::::: ");
errCode = "VTISS1";
......@@ -364,7 +393,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
errCode = "VTSTKQTY";
errList.add( errCode );
errFields.add(childNodeName.toLowerCase());
}
}*/
if( itemCodeDB != null && itemCodeDB.trim().length() > 0 )
{
......@@ -387,7 +416,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("qcTypeDB :::::::::: " + qcTypeDB);
System.out.println("stroPrefDB :::::::::: " + stroPrefDB);
if(!familyGrpDB.equals(familyGrp) || !qcTypeDB.equals(qcType) || !stroPrefDB.equals(stroPref))
if(!familyGrpDB.equals(familyGrp) && !qcTypeDB.equals(qcType) && !stroPrefDB.equals(stroPref))
{
System.out.println(" item code is not of same analysis grp :::::::::: ");
errCode = "VTINVAC";
......@@ -731,23 +760,23 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
Date chgDateEdit = null, tranDateEdit = null, confirmDateEdit = null;
locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", hdrDataDom));
palletNoSource = checkNullAndTrim(genericUtility.getColumnValue("pallet_no__source", hdrDataDom));
//palletNoSource = checkNullAndTrim(genericUtility.getColumnValue("pallet_no__source", hdrDataDom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom));
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
System.out.println(" Inside if details 2 for itm_default ::::::::::::::::: ");
sql = "select tran_id, tran_date, site_code, tran_type, loc_code, pallet_type, inv_stat, pallet_no, pallet_no__source, remarks, "
+ "confirmed, conf_date, chg_user, chg_date, chg_term from pallet_hdr "
+ "where (loc_code = ? or pallet_no__source = ?) and pallet_no = ? "
sql = "select tran_id, tran_date, site_code, tran_type, loc_code, pallet_type, inv_stat, pallet_no, remarks, "
+ " chg_user, chg_date, chg_term from pallet_hdr "
+ "where loc_code = ? and pallet_no = ? "
+ "and site_code = ? and add_user = ? and case when confirmed is null then 'N' else confirmed end = 'N' ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode);
pstmt.setString(2, palletNoSource);
pstmt.setString(3, palletNo);
pstmt.setString(4, loginSite);
pstmt.setString(5, chgUser);
//pstmt.setString(2, palletNoSource);
pstmt.setString(2, palletNo);
pstmt.setString(3, loginSite);
pstmt.setString(4, chgUser);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -759,10 +788,10 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
palletTypeEdit = checkNullAndTrim(rs.getString("pallet_type"));
invStatEdit = checkNullAndTrim(rs.getString("inv_stat"));
palletNoEdit = checkNullAndTrim(rs.getString("pallet_no"));
palletNoSourceEdit = checkNullAndTrim(rs.getString("pallet_no__source"));
//palletNoSourceEdit = checkNullAndTrim(rs.getString("pallet_no__source"));
remarksEdit = checkNullAndTrim(rs.getString("remarks"));
confirmEdit = checkNullAndTrim(rs.getString("confirmed"));
confirmDateEdit = rs.getDate("conf_date");
//confirmEdit = checkNullAndTrim(rs.getString("confirmed"));
//confirmDateEdit = rs.getDate("conf_date");
chgUserEdit = checkNullAndTrim(rs.getString("chg_user"));
chgDateEdit = rs.getDate("chg_date");
chgTermEdit = checkNullAndTrim(rs.getString("chg_term"));
......@@ -781,7 +810,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<pallet_type><![CDATA[" ).append( palletTypeEdit ).append( "]]></pallet_type>\r\n" );
valueXmlString.append( "<inv_stat><![CDATA[" ).append( invStatEdit ).append( "]]></inv_stat>\r\n" );
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNoEdit ).append( "]]></pallet_no>\r\n" );
valueXmlString.append( "<pallet_no__source><![CDATA[" ).append( palletNoSourceEdit ).append( "]]></pallet_no__source>\r\n" );
//valueXmlString.append( "<pallet_no__source><![CDATA[" ).append( palletNoSourceEdit ).append( "]]></pallet_no__source>\r\n" );
valueXmlString.append( "<remarks><![CDATA[" ).append( remarksEdit ).append( "]]></remarks>\r\n" );
valueXmlString.append( "<confirmed><![CDATA[" ).append( "N" ).append( "]]></confirmed>\r\n" );
valueXmlString.append( "<conf_date><![CDATA[" ).append( "" ).append( "]]></conf_date>\r\n" );
......@@ -800,10 +829,10 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("in itm_default@@@@@.........." + tranId);
System.out.println("-------------- itemchanged Add mode in Details 2 ----------------------");
sql = "select inv_stat from location where loc_code in (?, ?) ";
sql = "select inv_stat from location where loc_code = ? ";
pstmt1 = conn.prepareStatement(sql);
pstmt1.setString(1, locationCode);
pstmt1.setString(2, palletNoSource);
//pstmt1.setString(2, palletNoSource);
rs1 = pstmt1.executeQuery();
if(rs1.next())
{
......@@ -818,20 +847,21 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
valueXmlString.append( "<tran_date><![CDATA[" ).append( currDate ).append( "]]></tran_date>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<tran_type><![CDATA[" ).append( "" ).append( "]]></tran_type>\r\n" );
valueXmlString.append( "<loc_code><![CDATA[" ).append( locationCode ).append( "]]></loc_code>\r\n" );
if("".equalsIgnoreCase(locationCode) && locationCode.length() <= 0 )
/*if("".equalsIgnoreCase(locationCode) && locationCode.length() <= 0 )
{
valueXmlString.append( "<loc_code><![CDATA[" ).append( palletNoSource ).append( "]]></loc_code>\r\n" );
}
else
{
valueXmlString.append( "<loc_code><![CDATA[" ).append( locationCode ).append( "]]></loc_code>\r\n" );
}
}*/
valueXmlString.append( "<pallet_type><![CDATA[" ).append( "" ).append( "]]></pallet_type>\r\n" );
valueXmlString.append( "<inv_stat><![CDATA[" ).append( invStat ).append( "]]></inv_stat>\r\n" );
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" );
/*
if("".equalsIgnoreCase(palletNoSource) && palletNoSource.length() <= 0 )
{
valueXmlString.append( "<pallet_no__source><![CDATA[" ).append( locationCode ).append( "]]></pallet_no__source>\r\n" );
......@@ -839,7 +869,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
else
{
valueXmlString.append( "<pallet_no__source><![CDATA[" ).append( palletNoSource ).append( "]]></pallet_no__source>\r\n" );
}
}*/
valueXmlString.append( "<remarks><![CDATA[" ).append( "" ).append( "]]></remarks>\r\n" );
valueXmlString.append( "<confirmed><![CDATA[" ).append( "N" ).append( "]]></confirmed>\r\n" );
valueXmlString.append( "<conf_date><![CDATA[" ).append( "" ).append( "]]></conf_date>\r\n" );
......@@ -868,20 +898,74 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
System.out.println("allFormDataDom------>>["+genericUtility.serializeDom(allFormDataDom)+"]");
double quantity = 0;
String itemCode = "", lotNo = "", lotSl = "", locationCode ="", palletNo = "", palletNoSource = "", scanTranId = "";
String itemCode = "", lotNo = "", lotSl = "", locationCode ="", palletNo = "", palletNoSource = "", scanTranId = "", tableName = "";
int noArt = 0;
tranId = checkNull(genericUtility.getColumnValue("tran_id", allFormDataDom, "2" ));
System.out.println("Tran_id----------->>["+tranId+"]");
locationCode = checkNullAndTrim(genericUtility.getColumnValue("loc_code", hdrDataDom));
palletNoSource = checkNullAndTrim(genericUtility.getColumnValue("pallet_no__source", hdrDataDom));
palletNo = checkNullAndTrim(genericUtility.getColumnValue("pallet_no", hdrDataDom));
if( currentColumn.trim().equalsIgnoreCase( "itm_default" ) )
{
//System.out.println(" Inside if details 3 for itm_default :::::::::::::::::: ");
sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, no_art, '' as tran_id from stock where loc_code in (?,?) "
sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, no_art "
+ "from stock where loc_code = ? "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "
+ "union all "
+ "select d.item_code, d.lot_no, d.lot_sl, d.quantity, d.no_art "
+ "from pallet_det d, pallet_hdr h where d.loc_code = ? "
+ "and d.pallet_no = ? and h.confirmed = ? and d.site_code = ? and d.tran_id = ? "
+ "and d.tran_id = h.tran_id ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, locationCode);
pstmt.setString(2, loginSite);
pstmt.setString(3, locationCode);
pstmt.setString(4, palletNo);
pstmt.setString(5, "N");
pstmt.setString(6, loginSite);
pstmt.setString(7, tranId);
rs = pstmt.executeQuery();
if( tranId != null && tranId.trim().length() > 0 )
{
System.out.println("-------------- itemchanged Edit mode in Details 3 ----------------------");
while(rs.next())
{
itemCode = checkNullAndTrim(rs.getString("item_code"));
lotNo = checkNullAndTrim(rs.getString("lot_no"));
lotSl = checkNullAndTrim(rs.getString("lot_sl"));
quantity = rs.getDouble("quantity");
noArt = rs.getInt("no_art");
domId++;
if(isScanningDone(tranId, itemCode, loginSite, locationCode, lotNo, lotSl, palletNo, conn))
{
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"Y\">\r\n");
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\" />\r\n");
}
else
{
valueXmlString.append("<Detail3 domID='"+domId+"' selected=\"N\">\r\n");
valueXmlString.append("<attribute selected=\"N\" updateFlag=\"A\" status=\"N\" pkNames=\"\" />\r\n");
}
valueXmlString.append( "<tran_id><![CDATA[" ).append( tranId ).append( "]]></tran_id>\r\n" );
valueXmlString.append( "<line_no><![CDATA[" ).append( domId ).append( "]]></line_no>\r\n" );
valueXmlString.append( "<item_code><![CDATA[" ).append( itemCode ).append( "]]></item_code>\r\n" );
valueXmlString.append( "<site_code><![CDATA[" ).append( loginSite ).append( "]]></site_code>\r\n" );
valueXmlString.append( "<loc_code><![CDATA[" ).append( locationCode ).append( "]]></loc_code>\r\n" );
valueXmlString.append( "<lot_no><![CDATA[" ).append( lotNo ).append( "]]></lot_no>\r\n" );
valueXmlString.append( "<lot_sl><![CDATA[" ).append( lotSl ).append( "]]></lot_sl>\r\n" );
valueXmlString.append( "<pallet_no><![CDATA[" ).append( palletNo ).append( "]]></pallet_no>\r\n" );
valueXmlString.append( "<quantity><![CDATA[" ).append( quantity ).append( "]]></quantity>\r\n" );
valueXmlString.append( "<no_art><![CDATA[" ).append( noArt ).append( "]]></no_art>\r\n" );
valueXmlString.append("</Detail3>\r\n");
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
}
/*sql = "select item_code, lot_no, lot_sl, (quantity - (alloc_qty + hold_qty)) as quantity, no_art, '' as tran_id from stock where loc_code in (?,?) "
+ "and (quantity - (alloc_qty + hold_qty)) > 0 and site_code = ? "
+ "union all "
+ "select d.item_code, d.lot_no, d.lot_sl, d.quantity, no_art, d.tran_id from pallet_det d, pallet_hdr h where d.loc_code = ? "
......@@ -937,7 +1021,7 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
}
}*/
else
{
System.out.println("-------------- itemchanged Add mode in Details 3 ----------------------");
......@@ -1031,6 +1115,44 @@ public class PalletizationIC extends ValidatorEJB implements PalletizationICLoca
return inputVal;
}
private boolean isScanningDone(String tranId, String itemCode, String loginSite, String locationCode, String lotNo, String lotSl, String palletNo, Connection conn) throws ITMException,Exception
{
ResultSet rs = null;
PreparedStatement pstmt = null;
String sql = "";
int count = 0;
tranId = tranId == null ? "" : tranId.trim();
System.out.println("in isScanningDone--------->" + tranId);
sql = "select count(*) from pallet_det where tran_id = ? and item_code = ? and site_code = ? and loc_code = ? and lot_no = ? and lot_sl = ? "
+ " and pallet_no = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,tranId);
pstmt.setString(2,itemCode);
pstmt.setString(3,loginSite);
pstmt.setString(4,locationCode);
pstmt.setString(5,lotNo);
pstmt.setString(6,lotSl);
pstmt.setString(7,palletNo);
//pstmt.setDouble(8,quantity);
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt(1);
//quantity = rs.getDouble(1);
}
if(pstmt != null) { pstmt.close(); pstmt = null; }
if(rs != null) { rs.close(); rs = null; }
System.out.println("count in isScanningDone@@----->>["+count+"]");
if(count > 0)
{
return true;
}
return false;
}
}
......
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