PiLotSplitAction.java

package com.mycim.webapp.actions.lot.split;

import com.fa.sesa.exception.Assert;
import com.fa.sesa.exception.Errors;
import com.mycim.valueobject.LocationNames;
import com.mycim.valueobject.MessageIdList;
import com.mycim.valueobject.ems.pilot.PiLotView;
import com.mycim.valueobject.wip.Lot;
import com.mycim.valueobject.wip.LotStatus;
import com.mycim.webapp.forms.lot.SplitMergeInfoForm;

import javax.servlet.http.HttpServletRequest;

/**
 * @author songpy
 * @version 1.0.0
 * @date 2021/9/11
 **/
public class PiLotSplitAction extends SplitLotAction {

    @Override
    protected void checkLotForSplit(Lot lot, String splitType) {
        // 永久分批flag初始化提示
        Assert.isFalse((lot == null) || (lot.getLotRrn() <= 0),
                       Errors.create().key(MessageIdList.SCRAPLOT_LOTID_ERROR).content("Lot id not find!").build());
        // Bonding临时分批卡控
        Assert.isFalse(isSapphireLot(lot) && LocationNames.TEMPORARY.equalsIgnoreCase(splitType),
                       Errors.create().key(MessageIdList.BOND_LOT_CAN_NOT_SPLIT).build());
        // check the lot status by product typess
        /*if (!lot.getLotStatus().equalsIgnoreCase(LotStatus.HOLD)) {
            throw new WebException("lot.spilt_not_hold", "This lot is not in hold");
        }*/

        Assert.isTrue(LotStatus.isWaitingOrHold(lot.getLotStatus()),
                      Errors.create().key(MessageIdList.LOT_MUST_W_H).build());

        Assert.isFalse(diffBatchQueryService.checkLotInBatch(lot.getLotRrn()),
                       Errors.create().key(MessageIdList.LOT_IN_BATCH).content("Lot in batch!").build());

        wipQueryService.checkActiveInlineOcapId(lot.getLotRrn());
        wipCheckService.checkPiLotBoundLot(lot.getLotRrn());
    }

    @Override
    protected void setActionUrl(HttpServletRequest request) {
        request.setAttribute(ACTION_URL_KEY, "piLotSplit.do");
    }

    @Override
    protected void childPiLotInfo(SplitMergeInfoForm theform, Lot lot) {
        PiLotView view = wipQueryService.getPiLotViewByLotRrn(lot.getLotRrn());
        theform.setQty1(Double.valueOf(view.getQty()));
        theform.setRouteId(view.getEndRoute());
        theform.setOperationId(view.getEndStep());
    }

}