<?xml version="1.0" encoding="UTF-8"?>
<process xmlns:bean="http://bean.boe.com/" xmlns:bpel="http://bpel.boe.com/" targetNamespace="http://bpel.boe.com/bpelj/" name="PDAFGAssignShipRequestToPalletList.bpel">
    <partnerLinks>
        <partnerLink name="bpelj" partnerLinkType="bpel:bpelj" />
        <partnerLink name="PackingGroupServiceUtil" partnerLinkType="bean:PackingGroupServiceUtil" />
        <partnerLink name="BSShipRequestServiceUtil" partnerLinkType="bean:BSShipRequestServiceUtil" />
        <partnerLink name="EventInfoUtil" partnerLinkType="bean:EventInfoUtil" />
        <partnerLink name="PackingGroupServiceImpl" partnerLinkType="bean:PackingGroupServiceImpl" />
        <partnerLink name="BSShipRequestServiceImpl" partnerLinkType="bean:BSShipRequestServiceImpl" />
        <partnerLink name="ESBService" partnerLinkType="bean:ESBService" />
    </partnerLinks>
    <variables>
        <variable name="assignBoxQty" messageType="long">0</variable>
        <variable name="assignPalletQty" messageType="long">0</variable>
        <variable name="assignPanelQty" messageType="long">0</variable>
        <variable name="boxQty" messageType="long" expression="toLong(getXmlData('message','/Message/Body/BOXQTY'))" />
        <variable name="customException" messageType="com.cim.idm.fgwmsextend.generic.errorHandler.CustomException"></variable>
        <variable name="eventComment" messageType="java.lang.String" expression="getXmlData('message', '/Message/Header/EVENTCOMMENT')" />
        <variable name="eventInfo" messageType="com.cim.idm.framework.data.EventInfo"></variable>
        <variable name="eventUser" messageType="java.lang.String" expression="getXmlData('message', '/Message/Header/EVENTUSER')" />
        <variable name="invoiceDetailNo" messageType="java.lang.String" expression="getXmlData('message', '//Message/Body/SHIPREQUESTDETAILNAME')" />
        <variable name="invoiceNo" messageType="java.lang.String" expression="getXmlData('message', '//Message/Body/SHIPREQUESTNAME')" />
        <variable name="message" messageType="org.jdom.Document"></variable>
        <variable name="OICSender" messageType="java.lang.String"></variable>
        <variable name="palletInfo" messageType="com.cim.idm.wmspackage.productpacking.management.data.ProductPacking"></variable>
        <variable name="palletInvoiceDetailNo" messageType="java.lang.String"></variable>
        <variable name="palletName" messageType="java.lang.String"></variable>
        <variable name="palletNameList" messageType="java.util.List" expression="getXmlDataList('message','//PALLET/PALLETNAME')" />
        <variable name="palletQty" messageType="long" expression="toLong(getXmlData('message','/Message/Body/PALLETQUANTITY'))" />
        <variable name="panelQty" messageType="long" expression="toLong(getXmlData('message','/Message/Body/PANELQTY'))" />
        <variable name="replySubjectName" messageType="java.lang.String" expression="getXmlData('message', '//Message/Header/ORIGINALSOURCESUBJECTNAME')" />
        <variable name="shipRequestDetail" messageType="com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail"></variable>
        <variable name="siteName" messageType="java.lang.String" expression="getXmlData('message', '//Message/Body/SITENAME')" />
        <variable name="temBoxQty" messageType="long"></variable>
        <variable name="temPalletQty" messageType="long"></variable>
        <variable name="temPanelQty" messageType="long"></variable>
    </variables>
    <sequence>
        <receive name="PDAFGAssignShipRequestToPalletList" bounds="232,30,189,75">
            <input variable="message" type="org.jdom.Document" />
        </receive>
        <invoke name="PackingGroupServiceUtil checkExistBoxInPallet" type="invokebean" description="public static void checkExistBoxInPallet(java.lang.String SiteName, org.jdom.Document message)" bounds="256,135,140,102" partnerLink="PackingGroupServiceUtil" partnerLinkType="PackingGroupServiceUtil" operation="checkExistBoxInPallet" operationDesc="public static void checkExistBoxInPallet(java.lang.String SiteName, org.jdom.Document message)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="siteName" type="java.lang.String" />
            <input variable="message" type="org.jdom.Document" />
        </invoke>
        <invoke name="BSShipRequestServiceUtil checkInvoiceExist" type="invokebean" description="public void checkInvoiceExist(java.lang.String invoiceNo, java.lang.String siteName)" bounds="256,267,141,105" partnerLink="BSShipRequestServiceUtil" partnerLinkType="BSShipRequestServiceUtil" operation="checkInvoiceExist" operationDesc="public void checkInvoiceExist(java.lang.String invoiceNo, java.lang.String siteName)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="invoiceNo" type="java.lang.String" />
            <input variable="siteName" type="java.lang.String" />
        </invoke>
        <invoke name="BSShipRequestServiceUtil getShipRequestDetail" type="invokebean" description="public com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail getShipRequestDetail(java.lang.String invoiceNo, java.lang.String invoiceDetailNo, java.lang.String siteName)" bounds="248,402,157,102" partnerLink="BSShipRequestServiceUtil" partnerLinkType="BSShipRequestServiceUtil" operation="getShipRequestDetail" operationDesc="public com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail getShipRequestDetail(java.lang.String invoiceNo, java.lang.String invoiceDetailNo, java.lang.String siteName)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="invoiceNo" type="java.lang.String" />
            <input variable="invoiceDetailNo" type="java.lang.String" />
            <input variable="siteName" type="java.lang.String" />
            <output variable="shipRequestDetail" />
        </invoke>
        <invoke name="BSShipRequestServiceUtil checkProductQty4AssignInvoiceToPallet" type="invokebean" description="public void checkProductQty4AssignInvoiceToPallet(com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail invoiceDetail, long selectedProductQty)" bounds="203,534,246,102" partnerLink="BSShipRequestServiceUtil" partnerLinkType="BSShipRequestServiceUtil" operation="checkProductQty4AssignInvoiceToPallet" operationDesc="public void checkProductQty4AssignInvoiceToPallet(com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail invoiceDetail, long selectedProductQty)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="shipRequestDetail" type="com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail" />
            <input variable="panelQty" type="long" />
        </invoke>
        <invoke name="EventInfoUtil makeEventInfo" type="invokebean" description="public static com.cim.idm.framework.data.EventInfo makeEventInfo(java.lang.String eventName, java.lang.String eventUser, java.lang.String eventComment, java.lang.String reasonCodeType, java.lang.String reasonCode)" bounds="194,666,264,102" partnerLink="EventInfoUtil" partnerLinkType="EventInfoUtil" operation="makeEventInfo" operationDesc="public static com.cim.idm.framework.data.EventInfo makeEventInfo(java.lang.String eventName, java.lang.String eventUser, java.lang.String eventComment, java.lang.String reasonCodeType, java.lang.String reasonCode)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input constant="AssignShipRequest" type="java.lang.String" />
            <input variable="eventUser" type="java.lang.String" />
            <input variable="eventComment" type="java.lang.String" />
            <input constant="" type="java.lang.String" />
            <input constant="" type="java.lang.String" />
            <output variable="eventInfo" />
        </invoke>
        <while name="while" bounds="310,798,32,49" type="2" collection="palletNameList" element="palletName">
            <source idx="0" terminal="5,A" />
            <whilestart name="whilestart" type="whilestart" bounds="271,877,110,49">
                <source idx="0" terminal="5,A" />
            </whilestart>
            <invoke name="PackingGroupServiceUtil getPackingGroupData" type="invokebean" description="public com.cim.idm.wmspackage.productpacking.management.data.ProductPacking getPackingGroupData(java.lang.String originalPalletName, java.lang.String siteName)" bounds="256,956,141,105" partnerLink="PackingGroupServiceUtil" partnerLinkType="PackingGroupServiceUtil" operation="getPackingGroupData" operationDesc="public com.cim.idm.wmspackage.productpacking.management.data.ProductPacking getPackingGroupData(java.lang.String originalPalletName, java.lang.String siteName)" ignoreThrow="false" fork="false">
                <source idx="0" terminal="5,A" />
                <input variable="palletName" type="java.lang.String" />
                <input variable="siteName" type="java.lang.String" />
                <output variable="palletInfo" />
            </invoke>
            <expression name="expression" type="expression" bounds="256,1091,141,65">
                <source idx="0" terminal="5,A" />
                <function value="setVariable('temPanelQty',getField('palletInfo','QPanelQuantity'))" />
                <function value="setVariable('temPalletQty',1)" />
                <function value="setVariable('temBoxQty',getField('palletInfo','subPackingQuantity'))" />
                <function value="setVariable('palletInvoiceDetailNo',getField('palletInfo','shipRequestDetailName'))" />
            </expression>
            <switch name="switch" bounds="310,1186,33,33" type="switch">
                <source idx="0" terminal="5,A" />
                <switchstart name="switchstart" type="switchstart" bounds="271,1265,110,49">
                    <source idx="0" terminal="5,A" />
                </switchstart>
                <case name="case" type="case" condition="getVariable('palletInvoiceDetailNo')=''&#xA; or isNull('palletInvoiceDetailNo')='true'" bounds="134,1344,60,19">
                    <source idx="0" terminal="5,A" />
                    <expression name="expression" type="expression" bounds="84,1390,141,65">
                        <source idx="0" terminal="5,A" />
                        <function value="setVariable('assignBoxQty',sum(getVariable('assignBoxQty'),getVariable('temBoxQty')))" />
                        <function value="setVariable('assignPanelQty',sum(getVariable('assignPanelQty'),getVariable('temPanelQty')))" />
                        <function value="setVariable('assignPalletQty',sum(getVariable('assignPalletQty'),1))" />
                    </expression>
                    <invoke name="PackingGroupServiceImpl assignPalletToShipRequestDetail" type="invokebean" description="public void assignPalletToShipRequestDetail(java.lang.String SiteName, java.lang.String palletName, com.cim.idm.framework.data.EventInfo eventInfo, com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail shipRequestDetail)" bounds="49,1484,229,102" partnerLink="PackingGroupServiceImpl" partnerLinkType="PackingGroupServiceImpl" operation="assignPalletToShipRequestDetail" operationDesc="public void assignPalletToShipRequestDetail(java.lang.String SiteName, java.lang.String palletName, com.cim.idm.framework.data.EventInfo eventInfo, com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail shipRequestDetail)" ignoreThrow="false" fork="false">
                        <source idx="0" terminal="5,A" />
                        <input variable="siteName" type="java.lang.String" />
                        <input variable="palletName" type="java.lang.String" />
                        <input variable="eventInfo" type="com.cim.idm.framework.data.EventInfo" />
                        <input variable="shipRequestDetail" type="com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail" />
                    </invoke>
                </case>
                <otherwise name="otherwise" type="otherwise" bounds="444,1344,88,19">
                    <source idx="0" terminal="5,A" />
                    <invoke name="BSShipRequestServiceImpl increaseShipRequestAssignedQty" type="invokebean" description="public void increaseShipRequestAssignedQty(com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail shipRequestDetail, long selectedProductQty, long selectedBoxQty, long selectedPalletQty)" bounds="360,1393,256,102" partnerLink="BSShipRequestServiceImpl" partnerLinkType="BSShipRequestServiceImpl" operation="increaseShipRequestAssignedQty" operationDesc="public void increaseShipRequestAssignedQty(com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail shipRequestDetail, long selectedProductQty, long selectedBoxQty, long selectedPalletQty)" ignoreThrow="false" fork="false">
                        <source idx="0" terminal="5,A" />
                        <input variable="shipRequestDetail" type="com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail" />
                        <input variable="assignPanelQty" type="long" />
                        <input variable="assignBoxQty" type="long" />
                        <input variable="assignPalletQty" type="long" />
                    </invoke>
                    <throw name="throw" bounds="418,1525,141,65" faultName="catchAll" variable="customException">
                        <source idx="0" terminal="5,A" />
                        <input constant="PALLET-0001" type="java.lang.String" />
                        <input variable="palletName" type="java.lang.Object" />
                        <input variable="palletInvoiceDetailNo" type="java.lang.Object" />
                    </throw>
                </otherwise>
                <switchend name="switchend" type="switchend" bounds="271,1610,110,49">
                    <source idx="0" terminal="5,A" />
                    <source idx="1" terminal="5,A" />
                </switchend>
            </switch>
            <whileend name="whileend" type="whileend" bounds="271,1679,110,49">
                <source idx="0" terminal="5,A" />
            </whileend>
        </while>
        <invoke name="BSShipRequestServiceImpl increaseShipRequestAssignedQty" type="invokebean" description="public void increaseShipRequestAssignedQty(com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail shipRequestDetail, long selectedProductQty, long selectedBoxQty, long selectedPalletQty)" bounds="198,1758,256,102" partnerLink="BSShipRequestServiceImpl" partnerLinkType="BSShipRequestServiceImpl" operation="increaseShipRequestAssignedQty" operationDesc="public void increaseShipRequestAssignedQty(com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail shipRequestDetail, long selectedProductQty, long selectedBoxQty, long selectedPalletQty)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="shipRequestDetail" type="com.cim.idm.wmspackage.productshiprequest.management.data.ProductShipRequestDetail" />
            <input variable="panelQty" type="long" />
            <input variable="boxQty" type="long" />
            <input variable="palletQty" type="long" />
        </invoke>
        <invoke name="ESBService sendReplyBySender" type="invokebean" description="public void sendReplyBySender(String replySubject, org.jdom.Document doc, String senderName)" bounds="214,1890,224,102" partnerLink="ESBService" partnerLinkType="ESBService" operation="sendReplyBySender" operationDesc="public void sendReplyBySender(String replySubject, org.jdom.Document doc, String senderName)" ignoreThrow="false" fork="false">
            <source idx="0" terminal="5,A" />
            <input variable="replySubjectName" type="java.lang.String" />
            <input variable="message" type="org.jdom.Document" />
            <input constant="PDASender" type="java.lang.String" />
        </invoke>
    </sequence>
</process>

