Commit c9bb04b9 authored by ppatro's avatar ppatro

changes commited


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93431 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7fe5de79
...@@ -157,6 +157,7 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -157,6 +157,7 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
ADSIShippingSoap soap = null; ADSIShippingSoap soap = null;
List arryOuterCartonNo = new ArrayList(); List arryOuterCartonNo = new ArrayList();
LinkedHashMap linkedMap = new LinkedHashMap(); LinkedHashMap linkedMap = new LinkedHashMap();
ArrayList ptcnList = new ArrayList();
try try
{ {
...@@ -181,7 +182,7 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -181,7 +182,7 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
pstmtPrintStatus = conn.prepareStatement(sqlPrintStatus); pstmtPrintStatus = conn.prepareStatement(sqlPrintStatus);
//sqlMaster = "SELECT MASTER_CARTON,TRACKING_NO,CARTON_NO,STATUS FROM CARTON_MASTER WHERE PTCN = ? AND CARTON_TYPE <> ? ORDER BY CARTON_NO,MASTER_CARTON"; //sqlMaster = "SELECT MASTER_CARTON,TRACKING_NO,CARTON_NO,STATUS FROM CARTON_MASTER WHERE PTCN = ? AND CARTON_TYPE <> ? ORDER BY CARTON_NO,MASTER_CARTON";
sqlMaster = "SELECT MASTER_CARTON,TRACKING_NO,CARTON_NO,STATUS,CHANGE_STATUS,MSN_NO,CARRIER_SYMBOL,CARRIER_FRIENDLYNAME FROM CARTON_MASTER WHERE PTCN = ? AND CARTON_TYPE <> ? ORDER BY CARTON_NO,MASTER_CARTON"; sqlMaster = "SELECT MASTER_CARTON,TRACKING_NO,CARTON_NO,STATUS,CHANGE_STATUS,MSN_NO,CARRIER_SYMBOL,CARRIER_FRIENDLYNAME,CARTON_TYPE FROM CARTON_MASTER WHERE PTCN = ? AND CARTON_TYPE <> ? ORDER BY CARTON_NO,MASTER_CARTON";
pstmtMaster = conn.prepareStatement(sqlMaster); pstmtMaster = conn.prepareStatement(sqlMaster);
sqlCrtnChg = "UPDATE CARTON_MASTER SET CHANGE_STATUS = ? WHERE PTCN = ?"; sqlCrtnChg = "UPDATE CARTON_MASTER SET CHANGE_STATUS = ? WHERE PTCN = ?";
...@@ -263,6 +264,14 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -263,6 +264,14 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
pstmt.close(); pstmt = null; */ pstmt.close(); pstmt = null; */
//This check is not required for testing.end //This check is not required for testing.end
if(ptcnList.contains(ptcn))
{
continue;
}
else
{
ptcnList.add(ptcn);
}
pstmtPrintStatus.setString(1, ptcn); pstmtPrintStatus.setString(1, ptcn);
...@@ -333,6 +342,8 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -333,6 +342,8 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
chgStatus = rsMaster.getString("CHANGE_STATUS"); chgStatus = rsMaster.getString("CHANGE_STATUS");
oldMsnNo = rsMaster.getLong("MSN_NO"); oldMsnNo = rsMaster.getLong("MSN_NO");
oldCarrierSymbol = rsMaster.getString("CARRIER_SYMBOL"); oldCarrierSymbol = rsMaster.getString("CARRIER_SYMBOL");
refType = rsMaster.getString("CARTON_TYPE");
System.out.println("parcelCartonNo ["+parcelCartonNo+"]CARRIER_SYMBOL["+oldCarrierSymbol+"]["+oldMsnNo+"]Change Status["+chgStatus+"]"); System.out.println("parcelCartonNo ["+parcelCartonNo+"]CARRIER_SYMBOL["+oldCarrierSymbol+"]["+oldMsnNo+"]Change Status["+chgStatus+"]");
if("M".equalsIgnoreCase(refType)) if("M".equalsIgnoreCase(refType))
...@@ -983,7 +994,23 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo ...@@ -983,7 +994,23 @@ public class GenerateLabelsPrc extends ProcessEJB implements GenerateLabelsPrcLo
} }
else else
{ {
return "NO";
sql = "SELECT T.TRAN_CODE,T.SERVICE_CODE FROM DESPATCH D,WAVE_TASK_DET W,TRANSPORTER T "
+" WHERE D.DESP_ID = W.REF_ID AND W.REF_SER='S-DSP'"
+" AND T.TRAN_CODE = D.TRAN_CODE AND W.PTCN = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, ptcn);
rs = pstmt.executeQuery();
if(rs.next())
{
shipTranCode = rs.getString("TRAN_CODE");
serviceCode = rs.getString("SERVICE_CODE");
}
else
{
return "NO";
}
} }
rs.close(); rs = null; rs.close(); rs = null;
pstmt.close(); pstmt = null; pstmt.close(); pstmt = null;
......
...@@ -173,8 +173,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -173,8 +173,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
CommodityInfo[] infoCom1 = null; CommodityInfo[] infoCom1 = null;
PreparedStatement pstmt2 = null; PreparedStatement pstmt2 = null;
PreparedStatement pstmt3 = null; PreparedStatement pstmt3 = null,pstmtTransetUp = null;
ResultSet rs2 = null; ResultSet rs2 = null,rsSet = null;
ResultSet rs3 = null; ResultSet rs3 = null;
//Changed by Rohan on 03-june define variables for manual shipment print lable.start //Changed by Rohan on 03-june define variables for manual shipment print lable.start
...@@ -347,7 +347,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -347,7 +347,8 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
sSQLUpdatSord = "UPDATE SORDER SET SHIP_STATUS = ? WHERE SALE_ORDER IN (SELECT SORD_NO FROM DESPATCH WHERE DESP_ID = ?)"; sSQLUpdatSord = "UPDATE SORDER SET SHIP_STATUS = ? WHERE SALE_ORDER IN (SELECT SORD_NO FROM DESPATCH WHERE DESP_ID = ?)";
pstmtSord = conn.prepareStatement(sSQLUpdatSord); pstmtSord = conn.prepareStatement(sSQLUpdatSord);
sql = " SELECT TRAN_WINDOW FROM TRANSETUP WHERE REF_SER = ? ";
pstmtTransetUp = conn.prepareStatement(sql);
//Changed by sumit on 05/10/12 added condition where ref_ser = S-DSP //Changed by sumit on 05/10/12 added condition where ref_ser = S-DSP
//sql = "SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ?"; //sql = "SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ?";
sql = "SELECT REF_ID, REF_SER FROM SHIP_DOCS WHERE SHIPMENT_ID = ? AND DESP_CONFIRMED = 'N'"; sql = "SELECT REF_ID, REF_SER FROM SHIP_DOCS WHERE SHIPMENT_ID = ? AND DESP_CONFIRMED = 'N'";
...@@ -450,25 +451,55 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -450,25 +451,55 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
//changed by sankara on 12-07-13 for confirmation of consumption issue start.... //changed by sankara on 12-07-13 for confirmation of consumption issue start....
else else
{ {
sql = " SELECT TRAN_WINDOW FROM TRANSETUP WHERE REF_SER = ? ";
pstmt = conn.prepareStatement(sql); pstmtTransetUp.setString(1, refSer.trim());
pstmt.setString(1, refSer.trim()); rsSet = pstmtTransetUp.executeQuery();
rs = pstmt.executeQuery(); if( rsSet.next() )
if( rs.next() )
{ {
winName = rs.getString("TRAN_WINDOW"); winName = rsSet.getString("TRAN_WINDOW");
} }
objName = winName.substring(2); objName = winName.substring(2);
System.out.println("OBJNAME=="+objName); System.out.println("OBJNAME=="+objName);
errString = confirmShipment( objName, refId.trim(), xtraParam, forcedFlag, conn); errString = confirmShipment( objName, refId.trim(), xtraParam, forcedFlag, conn);
System.out.println(" errString ---------------- > ["+errString); System.out.println(" errString ---------------- > ["+errString);
//or id="VTSUCC1" type="P" column_name="">
/*<message><![CDATA[Prompt : Transaction confirmed!]]></message>
<description><![CDATA[Transaction Confirmed Sucessfully.]]></description>
<trace><![CDATA[]]></trace>
<redirect>1</redirect>
</error>
</Errors>
</Root>]*/
//if(errString != "" && errString.)error string should not check as it will call for multiple times.
} }
//changed by sankara on 12-07-13 for confirmation of consumption issue end.... //changed by sankara on 12-07-13 for confirmation of consumption issue end....
} }
rs.close();
rs = null; if(pstmt != null)
pstmt.close(); {
pstmt = null; pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmtTransetUp != null)
{
pstmtTransetUp.close();
pstmtTransetUp = null;
}
if(rsSet != null)
{
rsSet.close();
rsSet = null;
}
//Changed by sumit on 05/10/12 adding condition to check whether all despatch are confirmed or not //Changed by sumit on 05/10/12 adding condition to check whether all despatch are confirmed or not
if( isCountSame(tranId, conn) || !("S-DSP".equalsIgnoreCase(refSer.trim()))) if( isCountSame(tranId, conn) || !("S-DSP".equalsIgnoreCase(refSer.trim())))
{ {
...@@ -477,833 +508,864 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -477,833 +508,864 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
if("D-ISS".equalsIgnoreCase(refSer.trim()) || "C-ISS".equalsIgnoreCase(refSer.trim()) || "P-RET".equalsIgnoreCase(refSer.trim()) || "".equalsIgnoreCase(refSer.trim())) if("D-ISS".equalsIgnoreCase(refSer.trim()) || "C-ISS".equalsIgnoreCase(refSer.trim()) || "P-RET".equalsIgnoreCase(refSer.trim()) || "".equalsIgnoreCase(refSer.trim()))
{ {
System.out.println("Enetr in manual Shipment whit shipment ID"+tranId);
adsiShippingURL = discommon.getDisparams("999999","WMS_ADSI_SOAP_URL",conn); sql = "SELECT T.SERVICE_CODE,S.PACK_SIZE FROM SHIPMENT S,TRANSPORTER T WHERE T.TRAN_CODE = S.TRAN_CODE AND"
defPh = discommon.getDisparams("999999","SHIPPER_DEFAULT_PH",conn); +" S.SHIPMENT_ID = ? ";
com.adsionline.ADSIShippingWS.Service service = new com.adsionline.ADSIShippingWS.Service(); PreparedStatement pstmtTrans = conn.prepareStatement(sql);
NameValuePair[] additionalFields = new NameValuePair[1]; pstmtTrans.setString(1, tranId);
Package2[] packgeList = null; ResultSet rsTrans = pstmtTrans.executeQuery();
ArrayList<CommodityInfo> comodityInfoList = new ArrayList<CommodityInfo>(); if(rsTrans.next())
System.out.println("After disparm value"+adsiShippingURL); {
long timeBefore = System.currentTimeMillis(); serviceCode = checkNull(rsTrans.getString("SERVICE_CODE"));
locator = new ADSIShippingLocator(); dimensionDouble = rsTrans.getDouble("PACK_SIZE");
soap = locator.getADSIShippingSoap(new URL(adsiShippingURL)); }
long timeAfter = System.currentTimeMillis();
System.out.println("Differance In Tme for connecting to ADSI Server time differance in seconds["+(timeAfter-timeBefore)/1000+"]"); if(pstmtTrans != null)
{
if(soap.testADSIServer()) pstmtTrans.close();
{ pstmtTrans = null;
}
System.out.println("---ADSI Server Connected---");
//Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of inventory manual shipment.start if(rsTrans != null)
if("D-ISS".equalsIgnoreCase(refSer.trim()) || "C-ISS".equalsIgnoreCase(refSer.trim()) || "P-RET".equalsIgnoreCase(refSer.trim())) {
{ rsTrans.close();
System.out.println("************Enter in manual shiment for inventory item ******************************"); rsTrans = null;
sql = "SELECT S.CONSIGNEE_NAME,S.ADDR1,S.ADDR2,S.ADDR3,S.CITY,S.COUNT_CODE,S.STATE_CODE,S.PIN,S.PKG_DESCR,S.UNIT_VALUE,S.ITEM_DESCR,S.FRT_LIST " }
+" FROM SHIPMENT S WHERE S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); if(serviceCode != null && serviceCode.trim().length() > 0)
rs = pstmt.executeQuery(); {
if(rs.next())
{
//custCodeDlv = checkNull(rs.getString("CUST_CODE"));
custName = checkNull(rs.getString("CONSIGNEE_NAME"));
//custShName = checkNull(rs.getString("SH_NAME"));
shipAdd1 = checkNull(rs.getString("ADDR1"));
shipAdd2 = checkNull(rs.getString("ADDR2"));
shipAdd3 = checkNull(rs.getString("ADDR3"));
shipCity = checkNull(rs.getString("CITY"));
shipCountry = checkNull(rs.getString("COUNT_CODE"));
//shipPh = checkNull(rs.getString("TELE1"));
//shipMailId = checkNull(rs.getString("EMAIL_ADDR"));
//shipFax = checkNull(rs.getString("FAX"));
stateCodeDlv = checkNull(rs.getString("STATE_CODE"));
shipPin = checkNull(rs.getString("PIN"));
pkgDescr = checkNull(rs.getString("PKG_DESCR"));
itemDescr = checkNull(rs.getString("ITEM_DESCR"));
unitValue = rs.getDouble("UNIT_VALUE");
//frtList = checkNull(rs.getString("FRT_LIST"));
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
/*
if(!"".equalsIgnoreCase(frtList) && frtList.trim().length() > 0)
{
sql = "SELECT FRT_TERM FROM FREIGHT_LIST WHERE FRT_LIST = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, frtList);
rs = pstmt.executeQuery();
if(rs.next())
{
frtTerm = checkNull(rs.getString("FRT_TERM"));
}
pstmt.close();pstmt = null;
rs.close();rs = null;
}
*/
shipment2 = new Shipment2();
recipient = new Address();//To set the Address
//Setting Shipment ID
shipment2.setID(refId);
//recipient.setID(custCodeDlv);//Customer Code
recipient.setID(custName);//Customer Code
recipient.setContact(custName);//Customer Name
recipient.setCompany(custName);//Customer Company Name
recipient.setAddress1(shipAdd1);//Customer Adress1
recipient.setAddress2(shipAdd2);//Customer Adress2
recipient.setAddress3(shipAdd3);//Customer Adress3
recipient.setCity(shipCity);//Customer Adress City
sql = "SELECT T.SERVICE_CODE,S.PACK_SIZE FROM SHIPMENT S,TRANSPORTER T WHERE T.TRAN_CODE = S.TRAN_CODE AND"
+" S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
serviceCode = checkNull(rs.getString("SERVICE_CODE"));
dimensionDouble = rs.getDouble("PACK_SIZE");
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
recipient.setState(stateCodeDlv);//Customer Adress State
Country country = soap.getCountry("ISO3", shipCountry).getResponseCountry();
recipient.setCountry(country);//Customer Adress Country
recipient.setPhone(defPh);
recipient.setEMail("");
recipient.setFax("");
recipient.setPostalCode(shipPin);
shipment2.setRecipient(recipient);
service.setFriendlyName(serviceCode);
shipment2.setService(service);
System.out.println("Service name is :"+shipment2.getService());
System.out.println("Service code is :"+serviceCode);
/*
if(!"".equalsIgnoreCase(frtTerm) && frtTerm.trim().length() > 0)
{
shipment2.setTerms(EnumTerms.fromString(frtTerm));
}
else
{
shipment2.setTerms(EnumTerms.trmSHIPPER);
}
*/
shipment2.setTerms(EnumTerms.trmSHIPPER);
//HardCoded valus needs to be change later.
shipment2.setSignatureReleaseFlag(false);//false As per Taro
shipment2.setSignatureRequiredFlag(false);//true Required As per Taro
shipment2.setSaturdayDeliveryFlag(false);// Taro Need To clerify "what is based on service level?"
java.util.Date date = new java.util.Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
shipment2.setShipDate(calendar);
shipment2.setConsigneeAccount("");//Not Required As per Taro
shipment2.setThirdPartyBillingFlag(false);//Not Required As per Taro
shipment2.setThirdPartyBillingAccount("");//Not Required As per Taro
Address addrs = new Address();//Need to capture if required
shipment2.setThirdPartyBillingAddress(addrs);//Not Required As per Taro
shipment2.setHALFlag(false);//Need clarification from Taro
shipment2.setHALAddress(addrs);//Need clarification from Taro
shipment2.setManifestAction(EnumManifestAction.maRELEASE);//As per taro by default its maRELEASE
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
//shipment2.setShipperReference(ptcn);//As per Taro use PTCN(Pick Ticket Control No)
shipment2.setShipperReference(tranId);
//need to ask
//shipment2.setConsigneeReference(custPord);//As per Taro it is sorder.cust_pord
shipment2.setConsigneeReference(refId);//As per Taro it is sorder.cust_pord
shipment2.setShipperName("Taro Fulfillment");//Needs to change after clarity
shipment2.setTimeInTransit(EnumTimeInTransit.tntFOREVER);//As per taro its tntFOREVER
shipment2.setSaturdayDeliveryFlag(false);//Need to discuss with Taro
System.out.println("Shipment setting completr"+shipment2.getID());
//Adding package to the shipment
/*
sqlSize = "SELECT LENGTH , WIDTH , HEIGHT FROM PACKING WHERE PACK_CODE = (SELECT PACK_CODE FROM CARTON_MASTER WHERE CARTON_NO = ? )";
pstmt2 = conn.prepareStatement(sqlSize);
*/
if("D-ISS".equalsIgnoreCase(refSer.trim()))
{
sqlItem = " SELECT I.HARMONIZATION_DESCR,I.HARMONIZATION_NO,I.HAZARDOUS,L.SHIPPER_SIZE,L.GROSS_WEIGHT,I.COUNT_CODE__MFG,"
+" D.ITEM_CODE FROM DISTORD_ISSDET P,ITEM I,ITEM_LOT_PACKSIZE L, DISTORDER_DET D "
+" WHERE P.TRAN_ID IN(SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) "
+" AND P.CARTON_NO = ? AND P.PALLET_NO = ? AND D.DIST_ORDER = P.DIST_ORDER AND P.LINE_NO_DIST_ORDER = D.LINE_NO "
+" AND I.ITEM_CODE = D.ITEM_CODE AND I.ITEM_CODE = L.ITEM_CODE";
}
else if("C-ISS".equalsIgnoreCase(refSer.trim()))
{
sqlItem =" SELECT I.HARMONIZATION_DESCR,I.HARMONIZATION_NO,I.HAZARDOUS,L.SHIPPER_SIZE,L.GROSS_WEIGHT,I.COUNT_CODE__MFG,P.ITEM_CODE "
+" FROM CONSUME_ISS_DET P,ITEM I,ITEM_LOT_PACKSIZE L "
+" WHERE P.CONS_ISSUE IN(SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) "
+ " AND P.CARTON_NO = ? and P.PALLET_NO = ? "
+" AND I.ITEM_CODE = P.ITEM_CODE AND I.ITEM_CODE = L.ITEM_CODE ";
}
else if("P-RET".equalsIgnoreCase(refSer.trim()))
{
sqlItem = " SELECT I.HARMONIZATION_DESCR,I.HARMONIZATION_NO,I.HAZARDOUS,L.SHIPPER_SIZE,L.GROSS_WEIGHT,I.COUNT_CODE__MFG,P.ITEM_CODE "
+" FROM PORCPDET P,ITEM I,ITEM_LOT_PACKSIZE L "
+" WHERE P.TRAN_ID IN(SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) "
+ " AND P.CARTON_NO = ? and P.PALLET_NO = ? "
+" AND I.ITEM_CODE = P.ITEM_CODE AND I.ITEM_CODE = L.ITEM_CODE ";
}
pstmt3 = conn.prepareStatement(sqlItem);
sqlNoPkg = "SELECT COUNT(*) AS NO_OF_PKG FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
pstmt2 = conn.prepareStatement(sqlNoPkg);
pstmt2.setString(1, tranId);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
noOfPkgs = rs2.getInt("NO_OF_PKG");
}
packgeList = new Package2[noOfPkgs];
infoCom1 = new CommodityInfo[noOfPkgs] ;
System.out.println("noOfPkgs"+noOfPkgs);
//sql = "SELECT COUNT(*) AS NO_OF_PACKAGE FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
sql = "SELECT C.CARTON_NO,C.PALLET_NO,D.GROSS_WEIGHT,D.NO_ART,C.LENGTH,C.WIDTH,C.HEIGHT FROM SHIPMENT_CONTENT C,SHIP_DOCS D WHERE C.SHIPMENT_ID = D.SHIPMENT_ID AND"
+" C.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
cartonNo = checkNull(rs.getString("CARTON_NO"));
palleNo = checkNull(rs.getString("PALLET_NO"));
slength = rs.getDouble("LENGTH");
width = rs.getDouble("WIDTH");;
height = rs.getDouble("HEIGHT");
noArt = rs.getDouble("NO_ART");
caseWeight = rs.getDouble("GROSS_WEIGHT");
caseWeightTotal = noArt * caseWeight;
cartonNoList.add(cartonNo);
pkg2 = new Package2();
pkg2.setID(cartonNo);
pkg2.setWeight(caseWeightTotal);
System.out.println("Case total weight"+caseWeightTotal);
strlen = Double.toString(slength);
widthStr =Double.toString(width);
heightStr = Double.toString(height);
System.out.println("strlen"+strlen+"widthStr"+widthStr+"heightStr"+heightStr);
additionalFields[0] = new NameValuePair("carton_no", cartonNo);
pkg2.setDimension(strlen+"x"+widthStr+"x"+heightStr);
System.out.println("Dimension of master package----< :"+pkg2.getDimension());
pkg2.setTrackingNumber("");//Not Required Optional
if(!"".equalsIgnoreCase(pkgDescr.trim()) && pkgDescr.trim().length() > 0)
{
pkg2.setDescription(pkgDescr);//As per Taro
}
else
{
pkg2.setDescription("Pharmaceuticals");
}
pkg2.setOversizeFlag(false);//As per Taro
pkg2.setDeclaredValueFlag(false);//As per Taro
pkg2.setDeclaredValueAmount(0.0);//As per Taro not required
pkg2.setDeclaredValueCustoms(0.0);//As per Taro not required
pkg2.setBillOfLadingComment("");//As per Taro not required
pkg2.setAdditionalHandlingFlag(false);//As per Taro false
pkg2.setPackaging(EnumPackageType.pkgCUSTOM);//As per Taro default pkgCUSTOM
pkg2.setCODFlag(false);//As per Taro false
pkg2.setCODAmount(0.0);//As per Taro not required
pkg2.setCODPaymentType(0);//As per Taro not required
Address addr = new Address();
pkg2.setCODReturnAddress(addr);//As per Taro not required
pkg2.setAdditionalFields(additionalFields);
//setting commdity information.start
pstmt3 = conn.prepareStatement(sqlItem);
pstmt3.setString(1,tranId);
pstmt3.setString(2,cartonNo);
pstmt3.setString(3,palleNo);
rs3 = pstmt3.executeQuery();
while(rs3.next())
{
harmonizDescr = checkNull(rs3.getString("HARMONIZATION_DESCR"));
harmonizCode = checkNull(rs3.getString("HARMONIZATION_NO"));
itemCode = checkNull(rs3.getString("ITEM_CODE"));
//need to check
originCountry = checkNull(rs3.getString("COUNT_CODE__MFG"));
packSizeCase = rs3.getDouble("SHIPPER_SIZE");
caseWeight = rs3.getDouble("GROSS_WEIGHT");
hazardous = checkNull(rs3.getString("HAZARDOUS"));
System.out.println("Enter in while");
if("Y".equalsIgnoreCase(hazardous))
{
pkg2.setHazmatFlag(true);
}
else
{
pkg2.setHazmatFlag(false);
}
pkg2.setCODReturnAddress(addr);//As per Taro not required
comInfo = new CommodityInfo();
//infoCom1 = new CommodityInfo[1] ;
comInfo.setDescription(harmonizDescr);//As per taro Harmonization description
comInfo.setQuantity(noArt * packSizeCase);
//comInfo.setQuantity();
comInfo.setHarmonizedCode(harmonizCode);//As per Taro Haromonization code
//unitValue = 0;//getRateStdoum(saleOrder, itemCode, conn);
if(unitValue > 0)
{
comInfo.setUnitValue(unitValue);
}
else
{
comInfo.setUnitValue(0);
}
comInfo.setUnitWeight(caseWeight);
Country originCountryMfg = soap.getCountry("ISO3", originCountry).getResponseCountry();
comInfo.setOriginCountry(originCountryMfg);
comInfo.setNaftaFlag(false);//False as Per Taro Need To change canda/Mexico as true.
//Calendar calendar1 = Calendar.getInstance();
comInfo.setExportNumberExpireDate(calendar);
comInfo.setUnitOfMeasure(EnumUnitOfMeasure.uomPCS);
System.out.println("comdity info"+comInfo.getDescription());
infoCom1[commCnt] = comInfo;
commCnt++;
System.out.println("Commodity Info List"+infoCom1.toString());
}
if(pstmt3 != null)
{
pstmt3.close();
pstmt3 = null;
}
if(rs3 != null)
{
rs3.close();
rs3 = null;
}
pkg2.setCommodityInfos(infoCom1);
packgeList[pkg]=pkg2;
pkg++;
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
if(rs2 != null)
{
rs2.close();
rs2 = null;
}
}//if close for refser
//Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of inventory manual shipment.end
//Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of non inventory manual shipment.start
else if("".equalsIgnoreCase(refSer) && refSer.trim().length() <= 0)
{
System.out.println("************Enter in manual shiment for non inventory item ******************************");
sql = "SELECT S.CONSIGNEE_NAME,S.ADDR1,S.ADDR2,S.ADDR3,S.CITY,S.COUNT_CODE,S.STATE_CODE,S.PIN,S.NO_ART,S.PKG_DESCR,S.UNIT_VALUE,S.ITEM_DESCR,S.FRT_LIST "
+" FROM SHIPMENT S WHERE S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
//custCodeDlv = checkNull(rs.getString("CUST_CODE"));
custName = checkNull(rs.getString("CONSIGNEE_NAME"));
//custShName = checkNull(rs.getString("SH_NAME"));
shipAdd1 = checkNull(rs.getString("ADDR1"));
shipAdd2 = checkNull(rs.getString("ADDR2"));
shipAdd3 = checkNull(rs.getString("ADDR3"));
shipCity = checkNull(rs.getString("CITY"));
shipCountry = checkNull(rs.getString("COUNT_CODE"));
//shipPh = checkNull(rs.getString("TELE1"));
//shipMailId = checkNull(rs.getString("EMAIL_ADDR"));
//shipFax = checkNull(rs.getString("FAX"));
stateCodeDlv = checkNull(rs.getString("STATE_CODE"));
shipPin = checkNull(rs.getString("PIN"));
pkgDescr = checkNull(rs.getString("PKG_DESCR"));
itemDescr = checkNull(rs.getString("ITEM_DESCR"));
unitValue = rs.getDouble("UNIT_VALUE");
noArt = rs.getDouble("NO_ART");
//frtList = checkNull(rs.getString("FRT_LIST"));
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
/*
if(!"".equalsIgnoreCase(frtList) && frtList.trim().length() > 0)
{
sql = "SELECT FRT_TERM FROM FREIGHT_LIST WHERE FRT_LIST = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, frtList);
rs = pstmt.executeQuery();
if(rs.next())
{
frtTerm = checkNull(rs.getString("FRT_TERM"));
}
pstmt.close();pstmt = null;
rs.close();rs = null;
}
*/
shipment2 = new Shipment2();
recipient = new Address();//To set the Address
//Setting Shipment ID
shipment2.setID(refId);
//recipient.setID(custCodeDlv);//Customer Code
recipient.setID(custName);//Customer Code
recipient.setContact(custName);//Customer Name
recipient.setCompany(custName);//Customer Company Name
recipient.setAddress1(shipAdd1);//Customer Adress1
recipient.setAddress2(shipAdd2);//Customer Adress2
recipient.setAddress3(shipAdd3);//Customer Adress3
recipient.setCity(shipCity);//Customer Adress City
sql = "SELECT T.SERVICE_CODE,S.PACK_SIZE FROM SHIPMENT S,TRANSPORTER T WHERE T.TRAN_CODE = S.TRAN_CODE AND"
+" S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{
serviceCode = checkNull(rs.getString("SERVICE_CODE"));
dimensionDouble = rs.getDouble("PACK_SIZE");
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
recipient.setState(stateCodeDlv);//Customer Adress State
Country country = soap.getCountry("ISO3", shipCountry).getResponseCountry();
recipient.setCountry(country);//Customer Adress Country
recipient.setPhone(defPh);
recipient.setEMail("");
recipient.setFax("");
recipient.setPostalCode(shipPin);
shipment2.setRecipient(recipient);
service.setFriendlyName(serviceCode);
shipment2.setService(service);
System.out.println("Service name is :"+shipment2.getService());
System.out.println("Service code is :"+serviceCode);
/*
if(!"".equalsIgnoreCase(frtTerm) && frtTerm.trim().length() > 0)
{
shipment2.setTerms(EnumTerms.fromString(frtTerm));
System.out.println("terms::::"+shipment2.getTerms()+"]");
}
else
{
shipment2.setTerms(EnumTerms.trmSHIPPER);
}
*/
shipment2.setTerms(EnumTerms.trmSHIPPER);
//HardCoded valus needs to be change later.
shipment2.setSignatureReleaseFlag(false);//false As per Taro
shipment2.setSignatureRequiredFlag(false);//true Required As per Taro
shipment2.setSaturdayDeliveryFlag(false);// Taro Need To clerify "what is based on service level?"
java.util.Date date = new java.util.Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
shipment2.setShipDate(calendar);
shipment2.setConsigneeAccount("");//Not Required As per Taro
shipment2.setThirdPartyBillingFlag(false);//Not Required As per Taro
shipment2.setThirdPartyBillingAccount("");//Not Required As per Taro
Address addrs = new Address();//Need to capture if required
shipment2.setThirdPartyBillingAddress(addrs);//Not Required As per Taro
shipment2.setHALFlag(false);//Need clarification from Taro
shipment2.setHALAddress(addrs);//Need clarification from Taro
shipment2.setManifestAction(EnumManifestAction.maRELEASE);//As per taro by default its maRELEASE
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
//shipment2.setShipperReference(ptcn);//As per Taro use PTCN(Pick Ticket Control No)
shipment2.setShipperReference(tranId);
//need to ask
//shipment2.setConsigneeReference(custPord);//As per Taro it is sorder.cust_pord
shipment2.setConsigneeReference(refId);//As per Taro it is sorder.cust_pord
shipment2.setShipperName("Taro Fulfillment");//Needs to change after clarity
shipment2.setTimeInTransit(EnumTimeInTransit.tntFOREVER);//As per taro its tntFOREVER
shipment2.setSaturdayDeliveryFlag(false);//Need to discuss with Taro
sqlNoPkg = "SELECT COUNT(*) AS NO_OF_PKG FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
pstmt2 = conn.prepareStatement(sqlNoPkg);
pstmt2.setString(1, tranId);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{
noOfPkgs = rs2.getInt("NO_OF_PKG");
}
packgeList = new Package2[noOfPkgs];
infoCom1 = new CommodityInfo[noOfPkgs] ;
//sql = "SELECT COUNT(*) AS NO_OF_PACKAGE FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
//sql = "SELECT C.CARTON_NO,C.PALLET_NO,C.GROSS_WEIGHT,S.NO_ART,C.LENGTH,C.WIDTH,C.HEIGHT,S.UNIT_VALUE,S.PKG_DESCR FROM SHIPMENT_CONTENT C,SHIPMENT S WHERE C.SHIPMENT_ID = S.SHIPMENT_ID AND"
// +" C.SHIPMENT_ID = ? ";
sql = "SELECT C.CARTON_NO,C.PALLET_NO,C.GROSS_WEIGHT,C.LENGTH,C.WIDTH,C.HEIGHT FROM SHIPMENT_CONTENT C WHERE C.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{
cartonNo = checkNull(rs.getString("CARTON_NO"));
palleNo = checkNull(rs.getString("PALLET_NO"));
slength = rs.getDouble("LENGTH");
width = rs.getDouble("WIDTH");;
height = rs.getDouble("HEIGHT");
//noArt = rs.getDouble("NO_ART");
caseWeight = rs.getDouble("GROSS_WEIGHT");
caseWeightTotal = noArt * caseWeight;
//unitValue = rs.getDouble("UNIT_VALUE");
cartonNoList.add(cartonNo);
//pkgDescr = checkNull(rs.getString("PKG_DESCR"));
pkg2 = new Package2();
pkg2.setID(cartonNo);
pkg2.setWeight(caseWeightTotal);
System.out.println("Case total weight"+caseWeightTotal);
strlen = Double.toString(slength);
widthStr =Double.toString(width);
heightStr = Double.toString(height);
System.out.println("strlen"+strlen+"widthStr"+widthStr+"heightStr"+heightStr);
additionalFields[0] = new NameValuePair("carton_no", cartonNo);
pkg2.setDimension(strlen+"x"+widthStr+"x"+heightStr);
System.out.println("Dimension of master package----< :"+pkg2.getDimension());
pkg2.setTrackingNumber("");//Not Required Optional
if(!"".equalsIgnoreCase(pkgDescr.trim()) && pkgDescr.trim().length() > 0)
{
pkg2.setDescription(pkgDescr);//As per Taro
}
else
{
pkg2.setDescription("Pharmaceuticals");
}
pkg2.setOversizeFlag(false);//As per Taro
pkg2.setDeclaredValueFlag(false);//As per Taro
pkg2.setDeclaredValueAmount(0.0);//As per Taro not required
pkg2.setDeclaredValueCustoms(0.0);//As per Taro not required
pkg2.setBillOfLadingComment("");//As per Taro not required
pkg2.setAdditionalHandlingFlag(false);//As per Taro false
pkg2.setPackaging(EnumPackageType.pkgCUSTOM);//As per Taro default pkgCUSTOM
pkg2.setCODFlag(false);//As per Taro false
pkg2.setCODAmount(0.0);//As per Taro not required
pkg2.setCODPaymentType(0);//As per Taro not required
Address addr = new Address();
pkg2.setCODReturnAddress(addr);//As per Taro not required
pkg2.setAdditionalFields(additionalFields);
//originCountry = checkNull(rs3.getString("COUNT_CODE__MFG"));
pkg2.setHazmatFlag(false);
pkg2.setCODReturnAddress(addr);//As per Taro not required
comInfo = new CommodityInfo();
comInfo.setDescription("");//As per taro Harmonization description
comInfo.setQuantity(noArt);
comInfo.setHarmonizedCode("");//As per Taro Haromonization code
if(unitValue > 0)
{
comInfo.setUnitValue(unitValue);
}
else
{
comInfo.setUnitValue(0);
}
comInfo.setUnitWeight(caseWeight);
Country originCountryMfg = soap.getCountry("ISO3", shipCountry).getResponseCountry();
comInfo.setOriginCountry(originCountryMfg);
comInfo.setNaftaFlag(false);//False as Per Taro Need To change canda/Mexico as true.
//Calendar calendar1 = Calendar.getInstance();
comInfo.setExportNumberExpireDate(calendar);
comInfo.setUnitOfMeasure(EnumUnitOfMeasure.uomPCS);
infoCom1[commCnt] = comInfo;
commCnt++;
pkg2.setCommodityInfos(infoCom1);
packgeList[pkg]=pkg2;
pkg++;
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if(pstmt2 != null)
{
pstmt2.close();
pstmt2 = null;
}
if(rs2 != null)
{
rs2.close();
rs2 = null;
}
}
//Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of non inventory manual shipment.end
if(packgeList.length != 0 || packgeList.length > 0)
{
Timestamp currDate = new Timestamp(System.currentTimeMillis()); System.out.println("Enetr in manual Shipment whit shipment ID"+tranId);
shipment2.setPackages2(packgeList); adsiShippingURL = discommon.getDisparams("999999","WMS_ADSI_SOAP_URL",conn);
ShipmentResultReturn2 objReturn2=soap.shipWithLabel(shipment2, ShipWithLabelType.PNG, ImageRotation.Rotation_180); defPh = discommon.getDisparams("999999","SHIPPER_DEFAULT_PH",conn);
System.out.println("Is successfully Executed ["+objReturn2.isSuccess()+"]"); com.adsionline.ADSIShippingWS.Service service = new com.adsionline.ADSIShippingWS.Service();
System.out.println("Message String ["+objReturn2.getMessage()+"]"); NameValuePair[] additionalFields = new NameValuePair[1];
Package2[] packgeList = null;
ArrayList<CommodityInfo> comodityInfoList = new ArrayList<CommodityInfo>();
System.out.println("After disparm value"+adsiShippingURL);
long timeBefore = System.currentTimeMillis();
locator = new ADSIShippingLocator();
soap = locator.getADSIShippingSoap(new URL(adsiShippingURL));
long timeAfter = System.currentTimeMillis();
System.out.println("Differance In Tme for connecting to ADSI Server time differance in seconds["+(timeAfter-timeBefore)/1000+"]");
if(!objReturn2.isSuccess()) if(soap.testADSIServer())
{ {
//errString = getError(saleOrder + "[" + objReturn2.getMessage() +"]", "ADSISRVERR", conn);
errString = itmDBAccessLocal.getErrorString("","ADSISRVERR",""); System.out.println("---ADSI Server Connected---");
return errString; //Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of inventory manual shipment.start
} if("D-ISS".equalsIgnoreCase(refSer.trim()) || "C-ISS".equalsIgnoreCase(refSer.trim()) || "P-RET".equalsIgnoreCase(refSer.trim()))
else {
{ System.out.println("************Enter in manual shiment for inventory item ******************************");
//Updating ADSI getting the images.start sql = "SELECT S.CONSIGNEE_NAME,S.ADDR1,S.ADDR2,S.ADDR3,S.CITY,S.COUNT_CODE,S.STATE_CODE,S.PIN,S.PKG_DESCR,S.UNIT_VALUE,S.ITEM_DESCR,S.FRT_LIST "
ShipmentResult2 objShipResult = objReturn2.getShipmentResultResponse2(); +" FROM SHIPMENT S WHERE S.SHIPMENT_ID = ? ";
int lenPacakges = objShipResult.getPackageResults2().length; pstmt = conn.prepareStatement(sql);
String value = ""; pstmt.setString(1, tranId);
String pckgId = ""; rs = pstmt.executeQuery();
String trackNo=""; if(rs.next())
double msnNo=0.0;
String imagePath =null;
imagePath = discommon.getDisparams("999999","SHIP_WITH_PATH",conn);
for(int pCtr = 0;pCtr < lenPacakges;pCtr++)
{
PackageResult2 pkg2frm = (PackageResult2)objShipResult.getPackageResults2()[pCtr];
value = pkg2frm.getBase64Label();
pckgId = pkg2frm.getPackageID();
//change by rekha on 23-05-13.start
pkg2frm.getAdditionalFields();
trackNo=pkg2frm.getTrackingNumber();
cartonNo = cartonNoList.get(pCtr);
System.out.println("cnumber is :"+cartonNo);
System.out.println("Package ID["+pckgId+"]");
System.out.println("Tracking No ["+pkg2frm.getTrackingNumber()+"]");
System.out.println("BASE64lABEL Length["+value.length()+"]");
BASE64Decoder decoder = new BASE64Decoder();
System.out.println("Package id for carton no is :[" +decoder.decodeBuffer(pckgId) +"]");
msnNo = pkg2frm.getMSN();
System.out.println("MSN NO IN EACH PACKAGE IS :" +msnNo);
byte[] imgBytes = decoder.decodeBuffer(value);
System.out.println("IMAGE Byte Length ["+imgBytes.length+"]");
BufferedImage bufImg = ImageIO.read(new ByteArrayInputStream(imgBytes));
File imgOutFile = new File(imagePath+ File.separator+"Manual_Ship_Label"+File.separator+ tranId + File.separator + tranId+"_"+cartonNo +".png");
String path = imgOutFile.getPath();
System.out.println("Get Path ["+path+"]");
File createFolder = new File(path);
if(!createFolder.exists())
{
createFolder.mkdirs();
}
sql = "UPDATE CARTON_MASTER SET TRACKING_NO = ? , SHIP_LABEL= ? , MSN_NO = ? ,STATUS = 'U' "
+ " WHERE CARTON_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, trackNo);
pstmt.setString(2, path );
pstmt.setDouble(3, msnNo);
pstmt.setString(4, cartonNo);
System.out.println("carton number in for loop: "+cartonNo);
System.out.println("msn no for pkg result is :" +msnNo);
int updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{ {
System.out.println("carton master update succesfully");
//custCodeDlv = checkNull(rs.getString("CUST_CODE"));
custName = checkNull(rs.getString("CONSIGNEE_NAME"));
//custShName = checkNull(rs.getString("SH_NAME"));
shipAdd1 = checkNull(rs.getString("ADDR1"));
shipAdd2 = checkNull(rs.getString("ADDR2"));
shipAdd3 = checkNull(rs.getString("ADDR3"));
shipCity = checkNull(rs.getString("CITY"));
shipCountry = checkNull(rs.getString("COUNT_CODE"));
//shipPh = checkNull(rs.getString("TELE1"));
//shipMailId = checkNull(rs.getString("EMAIL_ADDR"));
//shipFax = checkNull(rs.getString("FAX"));
stateCodeDlv = checkNull(rs.getString("STATE_CODE"));
shipPin = checkNull(rs.getString("PIN"));
pkgDescr = checkNull(rs.getString("PKG_DESCR"));
itemDescr = checkNull(rs.getString("ITEM_DESCR"));
unitValue = rs.getDouble("UNIT_VALUE");
//frtList = checkNull(rs.getString("FRT_LIST"));
} }
else pstmt.close();
pstmt = null;
rs.close();
rs = null;
/*
if(!"".equalsIgnoreCase(frtList) && frtList.trim().length() > 0)
{
sql = "SELECT FRT_TERM FROM FREIGHT_LIST WHERE FRT_LIST = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, frtList);
rs = pstmt.executeQuery();
if(rs.next())
{
frtTerm = checkNull(rs.getString("FRT_TERM"));
}
pstmt.close();pstmt = null;
rs.close();rs = null;
}
*/
shipment2 = new Shipment2();
recipient = new Address();//To set the Address
//Setting Shipment ID
shipment2.setID(refId);
//recipient.setID(custCodeDlv);//Customer Code
recipient.setID(custName);//Customer Code
recipient.setContact(custName);//Customer Name
recipient.setCompany(custName);//Customer Company Name
recipient.setAddress1(shipAdd1);//Customer Adress1
recipient.setAddress2(shipAdd2);//Customer Adress2
recipient.setAddress3(shipAdd3);//Customer Adress3
recipient.setCity(shipCity);//Customer Adress City
/*sql = "SELECT T.SERVICE_CODE,S.PACK_SIZE FROM SHIPMENT S,TRANSPORTER T WHERE T.TRAN_CODE = S.TRAN_CODE AND"
+" S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{ {
System.out.println("Error in carton master updation"); serviceCode = checkNull(rs.getString("SERVICE_CODE"));
dimensionDouble = rs.getDouble("PACK_SIZE");
} }
//update tracking number in shipment contents.start
if(pstmt != null) pstmt.close();
pstmt = null;
rs.close();
rs = null;
*/
recipient.setState(stateCodeDlv);//Customer Adress State
Country country = soap.getCountry("ISO3", shipCountry).getResponseCountry();
recipient.setCountry(country);//Customer Adress Country
recipient.setPhone(defPh);
recipient.setEMail("");
recipient.setFax("");
recipient.setPostalCode(shipPin);
shipment2.setRecipient(recipient);
service.setFriendlyName(serviceCode);
shipment2.setService(service);
System.out.println("Service name is :"+shipment2.getService());
System.out.println("Service code is :"+serviceCode);
/*
if(!"".equalsIgnoreCase(frtTerm) && frtTerm.trim().length() > 0)
{
shipment2.setTerms(EnumTerms.fromString(frtTerm));
}
else
{
shipment2.setTerms(EnumTerms.trmSHIPPER);
}
*/
shipment2.setTerms(EnumTerms.trmSHIPPER);
//HardCoded valus needs to be change later.
shipment2.setSignatureReleaseFlag(false);//false As per Taro
shipment2.setSignatureRequiredFlag(false);//true Required As per Taro
shipment2.setSaturdayDeliveryFlag(false);// Taro Need To clerify "what is based on service level?"
java.util.Date date = new java.util.Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
shipment2.setShipDate(calendar);
shipment2.setConsigneeAccount("");//Not Required As per Taro
shipment2.setThirdPartyBillingFlag(false);//Not Required As per Taro
shipment2.setThirdPartyBillingAccount("");//Not Required As per Taro
Address addrs = new Address();//Need to capture if required
shipment2.setThirdPartyBillingAddress(addrs);//Not Required As per Taro
shipment2.setHALFlag(false);//Need clarification from Taro
shipment2.setHALAddress(addrs);//Need clarification from Taro
shipment2.setManifestAction(EnumManifestAction.maRELEASE);//As per taro by default its maRELEASE
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
//shipment2.setShipperReference(ptcn);//As per Taro use PTCN(Pick Ticket Control No)
shipment2.setShipperReference(tranId);
//need to ask
//shipment2.setConsigneeReference(custPord);//As per Taro it is sorder.cust_pord
shipment2.setConsigneeReference(refId);//As per Taro it is sorder.cust_pord
shipment2.setShipperName("Taro Fulfillment");//Needs to change after clarity
shipment2.setTimeInTransit(EnumTimeInTransit.tntFOREVER);//As per taro its tntFOREVER
shipment2.setSaturdayDeliveryFlag(false);//Need to discuss with Taro
System.out.println("Shipment setting completr"+shipment2.getID());
//Adding package to the shipment
/*
sqlSize = "SELECT LENGTH , WIDTH , HEIGHT FROM PACKING WHERE PACK_CODE = (SELECT PACK_CODE FROM CARTON_MASTER WHERE CARTON_NO = ? )";
pstmt2 = conn.prepareStatement(sqlSize);
*/
if("D-ISS".equalsIgnoreCase(refSer.trim()))
{
sqlItem = " SELECT I.HARMONIZATION_DESCR,I.HARMONIZATION_NO,I.HAZARDOUS,L.SHIPPER_SIZE,L.GROSS_WEIGHT,I.COUNT_CODE__MFG,"
+" D.ITEM_CODE FROM DISTORD_ISSDET P,ITEM I,ITEM_LOT_PACKSIZE L, DISTORDER_DET D "
+" WHERE P.TRAN_ID IN(SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) "
+" AND P.CARTON_NO = ? AND P.PALLET_NO = ? AND D.DIST_ORDER = P.DIST_ORDER AND P.LINE_NO_DIST_ORDER = D.LINE_NO "
+" AND I.ITEM_CODE = D.ITEM_CODE AND I.ITEM_CODE = L.ITEM_CODE";
}
else if("C-ISS".equalsIgnoreCase(refSer.trim()))
{
sqlItem =" SELECT I.HARMONIZATION_DESCR,I.HARMONIZATION_NO,I.HAZARDOUS,L.SHIPPER_SIZE,L.GROSS_WEIGHT,I.COUNT_CODE__MFG,P.ITEM_CODE "
+" FROM CONSUME_ISS_DET P,ITEM I,ITEM_LOT_PACKSIZE L "
+" WHERE P.CONS_ISSUE IN(SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) "
+ " AND P.CARTON_NO = ? and P.PALLET_NO = ? "
+" AND I.ITEM_CODE = P.ITEM_CODE AND I.ITEM_CODE = L.ITEM_CODE ";
}
else if("P-RET".equalsIgnoreCase(refSer.trim()))
{
sqlItem = " SELECT I.HARMONIZATION_DESCR,I.HARMONIZATION_NO,I.HAZARDOUS,L.SHIPPER_SIZE,L.GROSS_WEIGHT,I.COUNT_CODE__MFG,P.ITEM_CODE "
+" FROM PORCPDET P,ITEM I,ITEM_LOT_PACKSIZE L "
+" WHERE P.TRAN_ID IN(SELECT REF_ID FROM SHIP_DOCS WHERE SHIPMENT_ID = ? ) "
+ " AND P.CARTON_NO = ? and P.PALLET_NO = ? "
+" AND I.ITEM_CODE = P.ITEM_CODE AND I.ITEM_CODE = L.ITEM_CODE ";
}
pstmt3 = conn.prepareStatement(sqlItem);
sqlNoPkg = "SELECT COUNT(*) AS NO_OF_PKG FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
pstmt2 = conn.prepareStatement(sqlNoPkg);
pstmt2.setString(1, tranId);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{ {
pstmt.close(); noOfPkgs = rs2.getInt("NO_OF_PKG");
pstmt = null;
} }
sql = " UPDATE SHIPMENT_CONTENT SET TRACKING_NO = ? WHERE SHIPMENT_ID = ? AND LINE_NO = ? "; packgeList = new Package2[noOfPkgs];
pstmt = conn.prepareStatement(sql); infoCom1 = new CommodityInfo[noOfPkgs] ;
pstmt.setString(1, trackNo); System.out.println("noOfPkgs"+noOfPkgs);
pstmt.setString(2,tranId); //sql = "SELECT COUNT(*) AS NO_OF_PACKAGE FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
pstmt.setInt(3, (pCtr+1)); sql = "SELECT C.CARTON_NO,C.PALLET_NO,D.GROSS_WEIGHT,D.NO_ART,C.LENGTH,C.WIDTH,C.HEIGHT FROM SHIPMENT_CONTENT C,SHIP_DOCS D WHERE C.SHIPMENT_ID = D.SHIPMENT_ID AND"
updateCnt = pstmt.executeUpdate(); +" C.SHIPMENT_ID = ? ";
System.out.println("update statement is :"+updateCnt); pstmt = conn.prepareStatement(sql);
if(updateCnt > 0) pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while(rs.next())
{ {
System.out.println("SHIPMENT_CONTENT update succesfully");
cartonNo = checkNull(rs.getString("CARTON_NO"));
palleNo = checkNull(rs.getString("PALLET_NO"));
slength = rs.getDouble("LENGTH");
width = rs.getDouble("WIDTH");;
height = rs.getDouble("HEIGHT");
noArt = rs.getDouble("NO_ART");
caseWeight = rs.getDouble("GROSS_WEIGHT");
caseWeightTotal = noArt * caseWeight;
cartonNoList.add(cartonNo);
pkg2 = new Package2();
pkg2.setID(cartonNo);
pkg2.setWeight(caseWeightTotal);
System.out.println("Case total weight"+caseWeightTotal);
strlen = Double.toString(slength);
widthStr =Double.toString(width);
heightStr = Double.toString(height);
System.out.println("strlen"+strlen+"widthStr"+widthStr+"heightStr"+heightStr);
additionalFields[0] = new NameValuePair("carton_no", cartonNo);
pkg2.setDimension(strlen+"x"+widthStr+"x"+heightStr);
System.out.println("Dimension of master package----< :"+pkg2.getDimension());
pkg2.setTrackingNumber("");//Not Required Optional
if(!"".equalsIgnoreCase(pkgDescr.trim()) && pkgDescr.trim().length() > 0)
{
pkg2.setDescription(pkgDescr);//As per Taro
}
else
{
pkg2.setDescription("Pharmaceuticals");
}
pkg2.setOversizeFlag(false);//As per Taro
pkg2.setDeclaredValueFlag(false);//As per Taro
pkg2.setDeclaredValueAmount(0.0);//As per Taro not required
pkg2.setDeclaredValueCustoms(0.0);//As per Taro not required
pkg2.setBillOfLadingComment("");//As per Taro not required
pkg2.setAdditionalHandlingFlag(false);//As per Taro false
pkg2.setPackaging(EnumPackageType.pkgCUSTOM);//As per Taro default pkgCUSTOM
pkg2.setCODFlag(false);//As per Taro false
pkg2.setCODAmount(0.0);//As per Taro not required
pkg2.setCODPaymentType(0);//As per Taro not required
Address addr = new Address();
pkg2.setCODReturnAddress(addr);//As per Taro not required
pkg2.setAdditionalFields(additionalFields);
//setting commdity information.start
pstmt3 = conn.prepareStatement(sqlItem);
pstmt3.setString(1,tranId);
pstmt3.setString(2,cartonNo);
pstmt3.setString(3,palleNo);
rs3 = pstmt3.executeQuery();
while(rs3.next())
{
harmonizDescr = checkNull(rs3.getString("HARMONIZATION_DESCR"));
harmonizCode = checkNull(rs3.getString("HARMONIZATION_NO"));
itemCode = checkNull(rs3.getString("ITEM_CODE"));
//need to check
originCountry = checkNull(rs3.getString("COUNT_CODE__MFG"));
packSizeCase = rs3.getDouble("SHIPPER_SIZE");
caseWeight = rs3.getDouble("GROSS_WEIGHT");
hazardous = checkNull(rs3.getString("HAZARDOUS"));
System.out.println("Enter in while");
if("Y".equalsIgnoreCase(hazardous))
{
pkg2.setHazmatFlag(true);
}
else
{
pkg2.setHazmatFlag(false);
}
pkg2.setCODReturnAddress(addr);//As per Taro not required
comInfo = new CommodityInfo();
//infoCom1 = new CommodityInfo[1] ;
comInfo.setDescription(harmonizDescr);//As per taro Harmonization description
comInfo.setQuantity(noArt * packSizeCase);
//comInfo.setQuantity();
comInfo.setHarmonizedCode(harmonizCode);//As per Taro Haromonization code
//unitValue = 0;//getRateStdoum(saleOrder, itemCode, conn);
if(unitValue > 0)
{
comInfo.setUnitValue(unitValue);
}
else
{
comInfo.setUnitValue(0);
}
comInfo.setUnitWeight(caseWeight);
Country originCountryMfg = soap.getCountry("ISO3", originCountry).getResponseCountry();
comInfo.setOriginCountry(originCountryMfg);
comInfo.setNaftaFlag(false);//False as Per Taro Need To change canda/Mexico as true.
//Calendar calendar1 = Calendar.getInstance();
comInfo.setExportNumberExpireDate(calendar);
comInfo.setUnitOfMeasure(EnumUnitOfMeasure.uomPCS);
System.out.println("comdity info"+comInfo.getDescription());
infoCom1[commCnt] = comInfo;
commCnt++;
System.out.println("Commodity Info List"+infoCom1.toString());
}
if(pstmt3 != null)
{
pstmt3.close();
pstmt3 = null;
}
if(rs3 != null)
{
rs3.close();
rs3 = null;
}
pkg2.setCommodityInfos(infoCom1);
packgeList[pkg]=pkg2;
pkg++;
} }
else
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if(pstmt2 != null)
{ {
System.out.println("Error in SHIPMENT_CONTENTr updation"); pstmt2.close();
pstmt2 = null;
} }
//update tracking number in shipment contents.end
//update tracking number in pallet number stauas.start if(rs2 != null)
if(pstmt != null)
{ {
pstmt.close(); rs2.close();
pstmt = null; rs2 = null;
} }
}//if close for refser
sql = " UPDATE PALLET_NO SET STATUS = 'U' WHERE PALLET_NO IN (SELECT PALLET_NO FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? AND LINE_NO = ? )"; //Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of inventory manual shipment.end
pstmt = conn.prepareStatement(sql); //Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of non inventory manual shipment.start
else if("".equalsIgnoreCase(refSer) && refSer.trim().length() <= 0)
{
System.out.println("************Enter in manual shiment for non inventory item ******************************");
sql = "SELECT S.CONSIGNEE_NAME,S.ADDR1,S.ADDR2,S.ADDR3,S.CITY,S.COUNT_CODE,S.STATE_CODE,S.PIN,S.NO_ART,S.PKG_DESCR,S.UNIT_VALUE,S.ITEM_DESCR,S.FRT_LIST "
+" FROM SHIPMENT S WHERE S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
pstmt.setInt(2, (pCtr+1)); rs = pstmt.executeQuery();
if(rs.next())
updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{ {
System.out.println("PALLET_NO update succesfully");
//custCodeDlv = checkNull(rs.getString("CUST_CODE"));
custName = checkNull(rs.getString("CONSIGNEE_NAME"));
//custShName = checkNull(rs.getString("SH_NAME"));
shipAdd1 = checkNull(rs.getString("ADDR1"));
shipAdd2 = checkNull(rs.getString("ADDR2"));
shipAdd3 = checkNull(rs.getString("ADDR3"));
shipCity = checkNull(rs.getString("CITY"));
shipCountry = checkNull(rs.getString("COUNT_CODE"));
//shipPh = checkNull(rs.getString("TELE1"));
//shipMailId = checkNull(rs.getString("EMAIL_ADDR"));
//shipFax = checkNull(rs.getString("FAX"));
stateCodeDlv = checkNull(rs.getString("STATE_CODE"));
shipPin = checkNull(rs.getString("PIN"));
pkgDescr = checkNull(rs.getString("PKG_DESCR"));
itemDescr = checkNull(rs.getString("ITEM_DESCR"));
unitValue = rs.getDouble("UNIT_VALUE");
noArt = rs.getDouble("NO_ART");
//frtList = checkNull(rs.getString("FRT_LIST"));
}
pstmt.close();
pstmt = null;
rs.close();
rs = null;
/*
if(!"".equalsIgnoreCase(frtList) && frtList.trim().length() > 0)
{
sql = "SELECT FRT_TERM FROM FREIGHT_LIST WHERE FRT_LIST = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, frtList);
rs = pstmt.executeQuery();
if(rs.next())
{
frtTerm = checkNull(rs.getString("FRT_TERM"));
}
pstmt.close();pstmt = null;
rs.close();rs = null;
} }
else */
shipment2 = new Shipment2();
recipient = new Address();//To set the Address
//Setting Shipment ID
shipment2.setID(refId);
//recipient.setID(custCodeDlv);//Customer Code
recipient.setID(custName);//Customer Code
recipient.setContact(custName);//Customer Name
recipient.setCompany(custName);//Customer Company Name
recipient.setAddress1(shipAdd1);//Customer Adress1
recipient.setAddress2(shipAdd2);//Customer Adress2
recipient.setAddress3(shipAdd3);//Customer Adress3
recipient.setCity(shipCity);//Customer Adress City
sql = "SELECT T.SERVICE_CODE,S.PACK_SIZE FROM SHIPMENT S,TRANSPORTER T WHERE T.TRAN_CODE = S.TRAN_CODE AND"
+" S.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
if(rs.next())
{ {
System.out.println("Error in PALLET_NO updation"); serviceCode = checkNull(rs.getString("SERVICE_CODE"));
dimensionDouble = rs.getDouble("PACK_SIZE");
} }
if(pstmt != null)
pstmt.close();
pstmt = null;
rs.close();
rs = null;
recipient.setState(stateCodeDlv);//Customer Adress State
Country country = soap.getCountry("ISO3", shipCountry).getResponseCountry();
recipient.setCountry(country);//Customer Adress Country
recipient.setPhone(defPh);
recipient.setEMail("");
recipient.setFax("");
recipient.setPostalCode(shipPin);
shipment2.setRecipient(recipient);
service.setFriendlyName(serviceCode);
shipment2.setService(service);
System.out.println("Service name is :"+shipment2.getService());
System.out.println("Service code is :"+serviceCode);
/*
if(!"".equalsIgnoreCase(frtTerm) && frtTerm.trim().length() > 0)
{
shipment2.setTerms(EnumTerms.fromString(frtTerm));
System.out.println("terms::::"+shipment2.getTerms()+"]");
}
else
{
shipment2.setTerms(EnumTerms.trmSHIPPER);
}
*/
shipment2.setTerms(EnumTerms.trmSHIPPER);
//HardCoded valus needs to be change later.
shipment2.setSignatureReleaseFlag(false);//false As per Taro
shipment2.setSignatureRequiredFlag(false);//true Required As per Taro
shipment2.setSaturdayDeliveryFlag(false);// Taro Need To clerify "what is based on service level?"
java.util.Date date = new java.util.Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
shipment2.setShipDate(calendar);
shipment2.setConsigneeAccount("");//Not Required As per Taro
shipment2.setThirdPartyBillingFlag(false);//Not Required As per Taro
shipment2.setThirdPartyBillingAccount("");//Not Required As per Taro
Address addrs = new Address();//Need to capture if required
shipment2.setThirdPartyBillingAddress(addrs);//Not Required As per Taro
shipment2.setHALFlag(false);//Need clarification from Taro
shipment2.setHALAddress(addrs);//Need clarification from Taro
shipment2.setManifestAction(EnumManifestAction.maRELEASE);//As per taro by default its maRELEASE
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
shipment2.setConsigneeBillingFlag(false);//As per Taro Not Required
//shipment2.setShipperReference(ptcn);//As per Taro use PTCN(Pick Ticket Control No)
shipment2.setShipperReference(tranId);
//need to ask
//shipment2.setConsigneeReference(custPord);//As per Taro it is sorder.cust_pord
shipment2.setConsigneeReference(refId);//As per Taro it is sorder.cust_pord
shipment2.setShipperName("Taro Fulfillment");//Needs to change after clarity
shipment2.setTimeInTransit(EnumTimeInTransit.tntFOREVER);//As per taro its tntFOREVER
shipment2.setSaturdayDeliveryFlag(false);//Need to discuss with Taro
sqlNoPkg = "SELECT COUNT(*) AS NO_OF_PKG FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
pstmt2 = conn.prepareStatement(sqlNoPkg);
pstmt2.setString(1, tranId);
rs2 = pstmt2.executeQuery();
if(rs2.next())
{ {
pstmt.close(); noOfPkgs = rs2.getInt("NO_OF_PKG");
pstmt = null;
} }
///update tracking number in pallet number stauas.end packgeList = new Package2[noOfPkgs];
infoCom1 = new CommodityInfo[noOfPkgs] ;
///update carton no status in carton no.start //sql = "SELECT COUNT(*) AS NO_OF_PACKAGE FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? ";
/* //sql = "SELECT C.CARTON_NO,C.PALLET_NO,C.GROSS_WEIGHT,S.NO_ART,C.LENGTH,C.WIDTH,C.HEIGHT,S.UNIT_VALUE,S.PKG_DESCR FROM SHIPMENT_CONTENT C,SHIPMENT S WHERE C.SHIPMENT_ID = S.SHIPMENT_ID AND"
sql = " UPDATE CARTON_MASTER SET STATUS = 'U' WHERE CARTON_NO IN (SELECT CARTON_NO FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? AND LINE_NO = ? )"; // +" C.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
sql = "SELECT C.CARTON_NO,C.PALLET_NO,C.GROSS_WEIGHT,C.LENGTH,C.WIDTH,C.HEIGHT FROM SHIPMENT_CONTENT C WHERE C.SHIPMENT_ID = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId); pstmt.setString(1, tranId);
pstmt.setInt(2, (pCtr+1)); rs = pstmt.executeQuery();
while(rs.next())
updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{ {
System.out.println("CARTON_NO update succesfully");
cartonNo = checkNull(rs.getString("CARTON_NO"));
palleNo = checkNull(rs.getString("PALLET_NO"));
slength = rs.getDouble("LENGTH");
width = rs.getDouble("WIDTH");;
height = rs.getDouble("HEIGHT");
//noArt = rs.getDouble("NO_ART");
caseWeight = rs.getDouble("GROSS_WEIGHT");
caseWeightTotal = noArt * caseWeight;
//unitValue = rs.getDouble("UNIT_VALUE");
cartonNoList.add(cartonNo);
//pkgDescr = checkNull(rs.getString("PKG_DESCR"));
pkg2 = new Package2();
pkg2.setID(cartonNo);
pkg2.setWeight(caseWeightTotal);
System.out.println("Case total weight"+caseWeightTotal);
strlen = Double.toString(slength);
widthStr =Double.toString(width);
heightStr = Double.toString(height);
System.out.println("strlen"+strlen+"widthStr"+widthStr+"heightStr"+heightStr);
additionalFields[0] = new NameValuePair("carton_no", cartonNo);
pkg2.setDimension(strlen+"x"+widthStr+"x"+heightStr);
System.out.println("Dimension of master package----< :"+pkg2.getDimension());
pkg2.setTrackingNumber("");//Not Required Optional
if(!"".equalsIgnoreCase(pkgDescr.trim()) && pkgDescr.trim().length() > 0)
{
pkg2.setDescription(pkgDescr);//As per Taro
}
else
{
pkg2.setDescription("Pharmaceuticals");
}
pkg2.setOversizeFlag(false);//As per Taro
pkg2.setDeclaredValueFlag(false);//As per Taro
pkg2.setDeclaredValueAmount(0.0);//As per Taro not required
pkg2.setDeclaredValueCustoms(0.0);//As per Taro not required
pkg2.setBillOfLadingComment("");//As per Taro not required
pkg2.setAdditionalHandlingFlag(false);//As per Taro false
pkg2.setPackaging(EnumPackageType.pkgCUSTOM);//As per Taro default pkgCUSTOM
pkg2.setCODFlag(false);//As per Taro false
pkg2.setCODAmount(0.0);//As per Taro not required
pkg2.setCODPaymentType(0);//As per Taro not required
Address addr = new Address();
pkg2.setCODReturnAddress(addr);//As per Taro not required
pkg2.setAdditionalFields(additionalFields);
//originCountry = checkNull(rs3.getString("COUNT_CODE__MFG"));
pkg2.setHazmatFlag(false);
pkg2.setCODReturnAddress(addr);//As per Taro not required
comInfo = new CommodityInfo();
comInfo.setDescription("");//As per taro Harmonization description
comInfo.setQuantity(noArt);
comInfo.setHarmonizedCode("");//As per Taro Haromonization code
if(unitValue > 0)
{
comInfo.setUnitValue(unitValue);
}
else
{
comInfo.setUnitValue(0);
}
comInfo.setUnitWeight(caseWeight);
Country originCountryMfg = soap.getCountry("ISO3", shipCountry).getResponseCountry();
comInfo.setOriginCountry(originCountryMfg);
comInfo.setNaftaFlag(false);//False as Per Taro Need To change canda/Mexico as true.
//Calendar calendar1 = Calendar.getInstance();
comInfo.setExportNumberExpireDate(calendar);
comInfo.setUnitOfMeasure(EnumUnitOfMeasure.uomPCS);
infoCom1[commCnt] = comInfo;
commCnt++;
pkg2.setCommodityInfos(infoCom1);
packgeList[pkg]=pkg2;
pkg++;
} }
else
pstmt.close();
pstmt = null;
rs.close();
rs = null;
if(pstmt2 != null)
{ {
System.out.println("Error in CARTON_NO updation"); pstmt2.close();
pstmt2 = null;
} }
if(pstmt != null)
if(rs2 != null)
{ {
pstmt.close(); rs2.close();
pstmt = null; rs2 = null;
} }
///update carton no status in carton no.end
*/ }
String n = pkg2frm.getTrackingNumber(); //Changed by Rohan on 30-07-13 for generating UPS/FEDEX lable in case of non inventory manual shipment.end
System.out.println("new tracking no of master package :"+n);
double n1 = pkg2.getWeight(); if(packgeList.length != 0 || packgeList.length > 0)
{
System.out.println("new weight of master package :"+n1); Timestamp currDate = new Timestamp(System.currentTimeMillis());
shipment2.setPackages2(packgeList);
imgOutFile.createNewFile(); ShipmentResultReturn2 objReturn2=soap.shipWithLabel(shipment2, ShipWithLabelType.PNG, ImageRotation.Rotation_180);
ImageIO.write(bufImg, "png", imgOutFile); System.out.println("Is successfully Executed ["+objReturn2.isSuccess()+"]");
System.out.println("Write File Complete----"); System.out.println("Message String ["+objReturn2.getMessage()+"]");
if(!objReturn2.isSuccess())
{
//errString = getError(saleOrder + "[" + objReturn2.getMessage() +"]", "ADSISRVERR", conn);
errString = getError(saleOrder + "[" + objReturn2.getMessage() +"]", "ADSISRVERR", conn);
return errString;
}
else
{
//Updating ADSI getting the images.start
ShipmentResult2 objShipResult = objReturn2.getShipmentResultResponse2();
int lenPacakges = objShipResult.getPackageResults2().length;
String value = "";
String pckgId = "";
String trackNo="";
double msnNo=0.0;
String imagePath =null;
imagePath = discommon.getDisparams("999999","SHIP_WITH_PATH",conn);
for(int pCtr = 0;pCtr < lenPacakges;pCtr++)
{
PackageResult2 pkg2frm = (PackageResult2)objShipResult.getPackageResults2()[pCtr];
value = pkg2frm.getBase64Label();
pckgId = pkg2frm.getPackageID();
//change by rekha on 23-05-13.start
pkg2frm.getAdditionalFields();
trackNo=pkg2frm.getTrackingNumber();
cartonNo = cartonNoList.get(pCtr);
System.out.println("cnumber is :"+cartonNo);
System.out.println("Package ID["+pckgId+"]");
System.out.println("Tracking No ["+pkg2frm.getTrackingNumber()+"]");
System.out.println("BASE64lABEL Length["+value.length()+"]");
BASE64Decoder decoder = new BASE64Decoder();
System.out.println("Package id for carton no is :[" +decoder.decodeBuffer(pckgId) +"]");
msnNo = pkg2frm.getMSN();
System.out.println("MSN NO IN EACH PACKAGE IS :" +msnNo);
byte[] imgBytes = decoder.decodeBuffer(value);
System.out.println("IMAGE Byte Length ["+imgBytes.length+"]");
BufferedImage bufImg = ImageIO.read(new ByteArrayInputStream(imgBytes));
File imgOutFile = new File(imagePath+ File.separator+"Manual_Ship_Label"+File.separator+ tranId + File.separator + tranId+"_"+cartonNo +".png");
String path = imgOutFile.getPath();
System.out.println("Get Path ["+path+"]");
File createFolder = new File(path);
if(!createFolder.exists())
{
createFolder.mkdirs();
}
sql = "UPDATE CARTON_MASTER SET TRACKING_NO = ? , SHIP_LABEL= ? , MSN_NO = ? ,STATUS = 'U' "
+ " WHERE CARTON_NO = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, trackNo);
pstmt.setString(2, path );
pstmt.setDouble(3, msnNo);
pstmt.setString(4, cartonNo);
System.out.println("carton number in for loop: "+cartonNo);
System.out.println("msn no for pkg result is :" +msnNo);
int updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{
System.out.println("carton master update succesfully");
}
else
{
System.out.println("Error in carton master updation");
}
//update tracking number in shipment contents.start
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
sql = " UPDATE SHIPMENT_CONTENT SET TRACKING_NO = ? WHERE SHIPMENT_ID = ? AND LINE_NO = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, trackNo);
pstmt.setString(2,tranId);
pstmt.setInt(3, (pCtr+1));
updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{
System.out.println("SHIPMENT_CONTENT update succesfully");
}
else
{
System.out.println("Error in SHIPMENT_CONTENTr updation");
}
//update tracking number in shipment contents.end
//update tracking number in pallet number stauas.start
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
sql = " UPDATE PALLET_NO SET STATUS = 'U' WHERE PALLET_NO IN (SELECT PALLET_NO FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? AND LINE_NO = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setInt(2, (pCtr+1));
updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{
System.out.println("PALLET_NO update succesfully");
}
else
{
System.out.println("Error in PALLET_NO updation");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
///update tracking number in pallet number stauas.end
///update carton no status in carton no.start
/*
sql = " UPDATE CARTON_MASTER SET STATUS = 'U' WHERE CARTON_NO IN (SELECT CARTON_NO FROM SHIPMENT_CONTENT WHERE SHIPMENT_ID = ? AND LINE_NO = ? )";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
pstmt.setInt(2, (pCtr+1));
updateCnt = pstmt.executeUpdate();
System.out.println("update statement is :"+updateCnt);
if(updateCnt > 0)
{
System.out.println("CARTON_NO update succesfully");
}
else
{
System.out.println("Error in CARTON_NO updation");
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
///update carton no status in carton no.end
*/
String n = pkg2frm.getTrackingNumber();
System.out.println("new tracking no of master package :"+n);
double n1 = pkg2.getWeight();
System.out.println("new weight of master package :"+n1);
imgOutFile.createNewFile();
ImageIO.write(bufImg, "png", imgOutFile);
System.out.println("Write File Complete----");
}
} OutputStream file = new FileOutputStream(imagePath+ File.separator+"Manual_Ship_Label"+File.separator+ tranId + File.separator + tranId+"_"+"Ship"+".ser" );
OutputStream buffer = new BufferedOutputStream( file );
OutputStream file = new FileOutputStream(imagePath+ File.separator+"Manual_Ship_Label"+File.separator+ tranId + File.separator + tranId+"_"+"Ship"+".ser" ); ObjectOutput output = new ObjectOutputStream( buffer );
OutputStream buffer = new BufferedOutputStream( file ); output.writeObject(shipment2);
ObjectOutput output = new ObjectOutputStream( buffer ); output.flush();
output.writeObject(shipment2); output.close();
output.flush(); file = new FileOutputStream( imagePath+ File.separator+"Manual_Ship_Label"+File.separator+ tranId + File.separator + tranId+"_"+"ShipRslt"+".ser" );
output.close(); buffer = new BufferedOutputStream( file );
file = new FileOutputStream( imagePath+ File.separator+"Manual_Ship_Label"+File.separator+ tranId + File.separator + tranId+"_"+"ShipRslt"+".ser" ); output = new ObjectOutputStream( buffer );
buffer = new BufferedOutputStream( file ); output.writeObject(objReturn2);
output = new ObjectOutputStream( buffer ); output.flush();
output.writeObject(objReturn2); output.close();
output.flush(); }
output.close(); }
else
{
System.out.println("---Packages not set succesfully---");
//errString = itmDBAccessEJB.getErrorString("","ADSISRVERR","","",conn);
errString = itmDBAccessLocal.getErrorString("","VTADSIPKGE","");
return errString;
}
} }
} else
else {
{ System.out.println("---ADSI Server Not Connected throw error---");
System.out.println("---Packages not set succesfully---"); //errString = itmDBAccessEJB.getErrorString("","ADSISRVERR","","",conn);
//errString = itmDBAccessEJB.getErrorString("","ADSISRVERR","","",conn); errString = itmDBAccessLocal.getErrorString("","ADSISRVERR","");
errString = itmDBAccessLocal.getErrorString("","VTADSIPKGE",""); return errString;
return errString;
} }
} }
else //Changed by Rohna on 22-07-13 for generating UPS/FEDEX lable in case of manual shipment.end
{
System.out.println("---ADSI Server Not Connected throw error---");
//errString = itmDBAccessEJB.getErrorString("","ADSISRVERR","","",conn);
errString = itmDBAccessLocal.getErrorString("","ADSISRVERR","");
return errString;
}
}
//Changed by Rohna on 22-07-13 for generating UPS/FEDEX lable in case of manual shipment.end
}
sql = "UPDATE SHIPMENT SET CONFIRMED = ? , CONF_DATE = ? WHERE SHIPMENT_ID = ?"; sql = "UPDATE SHIPMENT SET CONFIRMED = ? , CONF_DATE = ? WHERE SHIPMENT_ID = ?";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -1315,70 +1377,6 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -1315,70 +1377,6 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmt = null; pstmt = null;
conn.commit(); conn.commit();
//For Adsi start
/*comment for further use manual shipment.start
DistCommon discommon = new DistCommon();
ITMDBAccessEJB itmDBAccessEJB = new ITMDBAccessEJB();
String adsiShippingURL = "",imagePath = "";
ADSIShippingLocator locator = null;
ADSIShippingSoap soap = null;
String PTCN = "";
String carrierFriendlyName = "";
java.util.Date date = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
SimpleDateFormat format = new SimpleDateFormat("M/d/yyyy");
String strSmple = format.format(calendar.getTime());
adsiShippingURL = discommon.getDisparams("999999","WMS_ADSI_SOAP_URL",conn);
long timeBefore = System.currentTimeMillis();
locator = new ADSIShippingLocator();
System.out.println(" Connecting ADSI server ................");
soap = locator.getADSIShippingSoap(new URL(adsiShippingURL));
long timeAfter = System.currentTimeMillis();
System.out.println(" is server active ["+soap.testADSIServer()+"]");
if(!soap.testADSIServer())
{
errString = itmDBAccessEJB.getErrorString("","ADSISRVERR","","",conn);
return errString;
}
sql = " SELECT DISTINCT S.PTCN,G.CARRIER_FRIENDLYNAME FROM SHIP_DOCS S,WAVE_STATUS_ORG G WHERE S.SHIPMENT_ID = ? AND G.PTCN = S.PTCN";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, tranId);
rs = pstmt.executeQuery();
while( rs.next())
{
PTCN = rs.getString("PTCN");
carrierFriendlyName = rs.getString("CARRIER_FRIENDLYNAME");
System.out.println("PTCN["+PTCN+"]Carrier FriendlyName["+carrierFriendlyName+"]");
StringDictionaryReturn testStr = soap.closeOutEOD("Taro Commercial", carrierFriendlyName,strSmple, false, "");
System.out.println("Message for Close Out["+testStr.getMessage()+"]");
System.out.println("isSuccess["+testStr.isSuccess()+"]");
if(testStr.isSuccess())
{
}
else
{
errString =getError(testStr.getMessage(),"ADSCLOSEOD", conn);
return errString;
}
}
rs.close();rs = null;
pstmt.close();pstmt = null;
//For Adsi end
* /*comment for further use manual shipment.end
*/
//Changed by sumit on 28/09/12 commented and written above.
//ITMDBAccessLocal itmDBAccessLocal = new ITMDBAccessEJB();
errString = itmDBAccessLocal.getErrorString("","VTCONFIRM",""); errString = itmDBAccessLocal.getErrorString("","VTCONFIRM","");
} }
} }
...@@ -1412,7 +1410,28 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal, ...@@ -1412,7 +1410,28 @@ public class ShipmentConf extends ActionHandlerEJB implements ShipmentConfLocal,
pstmtSord.close(); pstmtSord.close();
pstmtSord = null; pstmtSord = null;
} }
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmtTransetUp != null)
{
pstmtTransetUp.close();
pstmtTransetUp = null;
}
if(rsSet != null)
{
rsSet.close();
rsSet = null;
}
conn.close(); conn.close();
conn = null; conn = null;
} }
......
...@@ -2635,14 +2635,19 @@ public class WaveCancelEJB extends ActionHandlerEJB implements WaveCancelEJBLoca ...@@ -2635,14 +2635,19 @@ public class WaveCancelEJB extends ActionHandlerEJB implements WaveCancelEJBLoca
private boolean isManualAllocStock(String saleOrder,String lineNoSord,Connection conn) throws ITMException private boolean isManualAllocStock(String saleOrder,String lineNoSord,Connection conn) throws ITMException
{ {
String sql = ""; String sql = "",updateSql = "";
String sqlShipStanCode = ""; String sqlShipStanCode = "";
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null,pstmtUpd = null;
boolean isManAlloc = false; boolean isManAlloc = false;
try try
{ {
updateSql = "UPDATE SORDALLOC SET WAVE_FLAG = 'N' WHERE SALE_ORDER = ? AND LINE_NO = ? AND ALLOC_MODE ='M' ";
pstmtUpd = conn.prepareStatement(updateSql);
pstmtUpd.setString(1, saleOrder);
pstmtUpd.setString(2, lineNoSord);
sql = " SELECT * FROM SORDALLOC WHERE SALE_ORDER = ? AND LINE_NO = ? AND ALLOC_MODE ='M' "; sql = " SELECT * FROM SORDALLOC WHERE SALE_ORDER = ? AND LINE_NO = ? AND ALLOC_MODE ='M' ";
pstmt = conn.prepareStatement(sql); pstmt = conn.prepareStatement(sql);
...@@ -2653,10 +2658,42 @@ public class WaveCancelEJB extends ActionHandlerEJB implements WaveCancelEJBLoca ...@@ -2653,10 +2658,42 @@ public class WaveCancelEJB extends ActionHandlerEJB implements WaveCancelEJBLoca
if (rs.next()) if (rs.next())
{ {
isManAlloc = true; isManAlloc = true;
} }
if(isManAlloc)
{
int count = pstmtUpd.executeUpdate();
if(count > 0)
{
System.out.println("Update count["+count+"]");
}
}
if(rs != null)
{
rs.close();
rs = null;
}
if(pstmtUpd != null)
{
pstmtUpd.close();
pstmtUpd = null;
}
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
} }
catch(Exception e) catch(Exception e)
{ {
......
...@@ -10441,6 +10441,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -10441,6 +10441,11 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
} }
//Change by rekha on 21-05-13 end //Change by rekha on 21-05-13 end
if(packgeList != null && packgeList.length > 0)
{
System.out.println("Setting Packages To Shipment In Master/Parcel["+packgeList.length+"]");
shipment2.setPackages2(packgeList);
}
} }
...@@ -11771,7 +11776,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -11771,7 +11776,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
//Changed by Rohan on 24/11/12 to spilt active pick depending upon cartons.end //Changed by Rohan on 24/11/12 to spilt active pick depending upon cartons.end
} }
if(actCartonWeightMap.size() > 0 && "Y".equalsIgnoreCase(pPickAllow)) if(actCartonWeightMap.size() > 0 && ("Y".equalsIgnoreCase(pPickAllow) || "Y".equalsIgnoreCase(mPackAllow)))
{ {
CommodityInfo[] infoCom = null; CommodityInfo[] infoCom = null;
String nafFlag = discommon.getDisparams("999999","NAFTA_FLAG_COUNT",conn); String nafFlag = discommon.getDisparams("999999","NAFTA_FLAG_COUNT",conn);
...@@ -11984,15 +11989,21 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -11984,15 +11989,21 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
} }
} }
if(packgeList != null && packgeList.length > 0)
{
System.out.println("Setting Packages To Shipment In actives["+packgeList.length +"]");
shipment2.setPackages2(packgeList);
}
} }
//change by rekha on 23-05-13 start //change by rekha on 23-05-13 start
//if(packgeList.length != 0 || packgeList.length > 0) //if(packgeList.length != 0 || packgeList.length > 0)
//if("P".equalsIgnoreCase(waveMode) && packgeList != null && packgeList.length > 0) //if("P".equalsIgnoreCase(waveMode) && packgeList != null && packgeList.length > 0)
if(packgeList != null && packgeList.length > 0) //if(packgeList != null && packgeList.length > 0)
{ //{
System.out.println("Setting Packages To Shipment ["+packgeList.toString()+"]"); /*System.out.println("Setting Packages To Shipment Finally["+packgeList.toString()+"]["+packgeList.length+"]");
shipment2.setPackages2(packgeList); shipment2.setPackages2(packgeList);*/
/*BASE64Decoder decoder = new BASE64Decoder(); /*BASE64Decoder decoder = new BASE64Decoder();
Timestamp currDate = new Timestamp(System.currentTimeMillis()); Timestamp currDate = new Timestamp(System.currentTimeMillis());
...@@ -12318,7 +12329,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo ...@@ -12318,7 +12329,7 @@ public class WaveGenerationPrc extends ProcessEJB implements WaveGenerationPrcLo
}*/ }*/
} //}
//change by rekha on 23-05-13 end //change by rekha on 23-05-13 end
......
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