DeleteQTimeAction.java
package com.mycim.webapp.actions.lot.deleteqtime;
import com.fa.sesa.exception.Assert;
import com.fa.sesa.exception.Errors;
import com.fa.sesa.threadlocal.LocalContext;
import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.valueobject.MessageIdList;
import com.mycim.valueobject.wip.Lot;
import com.mycim.webapp.Constants;
import com.mycim.webapp.WebUtils;
import com.mycim.webapp.actions.WipSetupAction;
import com.mycim.webapp.forms.lot.HoldReleaseLotInfoForm;
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.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author fei.zeng
* @Description
* @date 2021/2/26
**/
public class DeleteQTimeAction extends WipSetupAction {
@Override
public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
Lot lot = initLotBaseInfoForJsp(request, true, null, null);
if (lot != null && lot.getLotRrn() > 0) {
List<Map<String, String>> timelimits = wipCheckService.getLotTimeLimitInfo(lot.getLotRrn());
String rcFlag = WebUtils.getParameter("rcFlag", request);
request.setAttribute("rcFlag", rcFlag);
request.setAttribute("lotId", lot.getLotId());
request.setAttribute("TIMELIMITS", timelimits);
}
return mapping.findForward(Constants.INIT_KEY);
}
public ActionForward deleteQtime(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
HoldReleaseLotInfoForm theform = (HoldReleaseLotInfoForm) form;
String lotId = theform.getLotId();
Lot lot = lotQueryService.getLot(lotId, LocalContext.getFacilityRrn());
String rcFlag = WebUtils.getParameter("rcFlag", request);
Assert.isFalse(lot.getLotRrn() <= 0,
Errors.create().key(MessageIdList.LOT_LOTRRN_NOT_FOUND).content("批次不存在!").build());
//卡控post future hold被hold住的lot
checkPostFutureHold(lot.getLotRrn());
String timelimitIds = request.getParameter("timelimitIds");
Assert.isFalse(StringUtils.isBlank(timelimitIds),
Errors.create().content("Please select the one you want to " + "delete timelimitId!").build());
HashMap<String, Object> param = new HashMap<>();
param.put("user", LocalContext.getUserId());
param.put("lotRrn", lot.getLotRrn());
param.put("timelimitIds", timelimitIds);
param.put("reason", theform.getReason());
lotService.deleteLotTimeLimitStatus(param);
if (StringUtils.isNotEmpty(rcFlag)) {
request.getRequestDispatcher("/splitRunCardLotInfo.do?action=init&lotId=" + lotId)
.forward(request, response);
return null;
} else {
return mapping.findForward(Constants.LOTLOCATION_KEY);
}
}
}