CdwLotReleaseAction.java
package com.mycim.webapp.actions.lot.lotholdrelease;
import com.fa.sesa.exception.Assert;
import com.fa.sesa.exception.Errors;
import com.fa.sesa.exception.SystemIllegalArgumentException;
import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.framework.utils.lang.math.NumberUtils;
import com.mycim.valueobject.MessageIdList;
import com.mycim.valueobject.consts.LotInfoConstants;
import com.mycim.valueobject.wip.Lot;
import com.mycim.valueobject.wip.LotStatus;
import com.mycim.webapp.Constants;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author can.yang
* @date 2021/6/9
**/
public class CdwLotReleaseAction extends LotReleaseAction {
@Override
public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
Lot lot = initLotBaseInfoForJsp(request, true, null, null);
List<Map> holdInfos = new ArrayList<>();
if (lot != null && lot.getLotRrn() > NumberUtils.INTEGER_ZERO) {
holdInfos = wipQueryService.getHoldReasons(lot.getLotRrn());
request.setAttribute("lotId", lot.getLotId());
}
request.setAttribute("collection", holdInfos);
//卡控post future hold被hold住的lot
checkPostFutureHold(lot.getLotRrn());
Assert.isTrue((LotInfoConstants.isCategoryC(lot.getCreateCategory())),
Errors.create().key(MessageIdList.CDW_INVALID_CATEGORY).content("Current lot category is not allowed!").build());
if (StringUtils.equals(lot.getLotStatus(), LotStatus.HOLD)) {
//check sortJob
checkWaitJobs(lot.getCarrierRrn(), 0L, 0L,
Errors.create().key(MessageIdList.CARRIER_BE_OCCUPIED).args(lot.getCarrierId()).build());
return mapping.findForward(Constants.RELEASE_KEY);
} else if (StringUtils.equals(lot.getLotStatus(), LotStatus.RUNNINGHOLD)) {
return mapping.findForward(Constants.RUNNING_RELEASE_KEY);
} else {
throw new SystemIllegalArgumentException(
Errors.create().key(MessageIdList.LOT_STATUS_NOT_ALLOW).content("Lot status not allow").build());
}
}
}