BankEditAction.java
package com.mycim.webapp.actions.lot.bankinandbankout;
import com.fa.sesa.exception.Assert;
import com.fa.sesa.exception.Errors;
import com.fa.sesa.exception.SystemIllegalArgumentException;
import com.fa.sesa.threadlocal.LocalContext;
import com.mycim.framework.utils.lang.StringUtils;
import com.mycim.framework.utils.lang.collections.MapUtils;
import com.mycim.framework.utils.lang.math.NumberUtils;
import com.mycim.valueobject.MessageIdList;
import com.mycim.valueobject.ObjectList;
import com.mycim.valueobject.bas.NamedObject;
import com.mycim.valueobject.consts.CarrierType;
import com.mycim.valueobject.consts.EenActionType;
import com.mycim.valueobject.consts.ReferenceDetailNames;
import com.mycim.valueobject.consts.TransactionNames;
import com.mycim.valueobject.context.dto.QueryContextValueDTO;
import com.mycim.valueobject.ems.Carrier;
import com.mycim.valueobject.inv.Order;
import com.mycim.valueobject.prp.Operation;
import com.mycim.valueobject.wip.BatchLotStore;
import com.mycim.valueobject.wip.Lot;
import com.mycim.valueobject.wip.LotStatus;
import com.mycim.valueobject.wip.TransReason;
import com.mycim.webapp.Constants;
import com.mycim.webapp.WebUtils;
import com.mycim.webapp.actions.WipSetupAction;
import com.mycim.webapp.forms.lot.BankInfoForm;
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.sql.Timestamp;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author liuji.li
* @version 6.0.0
* @date 2019/10/8
**/
public class BankEditAction extends WipSetupAction {
private static final String IS_BANK_IN = "IS_BANK_IN";
private static final String YES = "1";
@Override
public ActionForward init(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) throws Exception {
BankInfoForm theform = (BankInfoForm) form;
long facilityRrn = LocalContext.getFacilityRrn();
String isBankIn = (String) request.getAttribute(IS_BANK_IN);
boolean isBankInFlag = WebUtils.getParameter("bankin", request) != null || YES.equals(isBankIn);
if (isBankInFlag) {
theform.setTransId("bankin");
request.setAttribute("TransId", "BANKINOPERATION");
} else {
theform.setTransId("bankout");
request.setAttribute("TransId", "BANKOUTOPERATION");
}
theform.setOperationId("WAFER START BANK");
String id = theform.getOperationId().trim().toUpperCase();
long operationRrn = getInstanceRrn(id, facilityRrn, ObjectList.OPERATION_KEY);
long sessionOperRrn = 0;
Operation operation = prpService.getOperation(operationRrn);
Assert.isFalse(operation == null || operation.getStoreFlag() == null ||
operation.getStoreFlag().trim().equalsIgnoreCase("0"),
Errors.create().key(MessageIdList.BANK_NOT_STEP)
.content("Not found step or step not store step!").build());
NamedObject namedObject = baseService.isExisted(operationRrn);
String operationSubType = namedObject.getObjectSubtype();
Assert.isFalse(operationSubType == null || !"LOT_BANK".equalsIgnoreCase(operationSubType),
Errors.create().key(MessageIdList.BANK_HOUSE_NOT_BANK)
.content("This warehouse is not a lot bank!").build());
request.setAttribute("operationRrn", StringUtils.toString(operation.getInstanceRrn()));
sessionOperRrn = operation.getInstanceRrn();
request.setAttribute("lots", new ArrayList());
theform.setOldOperationId(id);
theform.setBankName(id);
String transId = isBankInFlag ? "bankin" : "bankout";
String sessionTransId = isBankInFlag ? "BANKINOPERATION" : "BANKOUTOPERATION";
theform.setTransId(transId);
request.setAttribute("TransId", sessionTransId);
theform.setTransComments(StringUtils.EMPTY);
List lots = new ArrayList();
String lotId = request.getParameter("lotId");
Lot lot = lotQueryService.getLot(lotId, facilityRrn);
Carrier carrier = carrierService.getCarrier(lot.getCarrierRrn());
//卡控post future hold被hold住的lot
checkPostFutureHold(lot.getLotRrn());
Assert.isFalse(carrier == null || carrier.getInstanceRrn() <= 0,
Errors.create().key(MessageIdList.BANK_NOT_CARRIER)
.content("Can not find this carrier of " + "Lot!").build());
Assert.isFalse(StringUtils.equalsIgnoreCase(carrier.getObjectSubtype(), CarrierType.DUMMY),
Errors.create().key(MessageIdList.BANK_CARRIER_REMOVED)
.content("This carrier of Lot is already removed!").build());
//check sortJob
checkWaitJobs(lot.getCarrierRrn(), 0L, 0L, null);
checkBankFlag(lot);
validateLot(sessionOperRrn, theform, lot);
lots.add(lot);
Assert.isFalse(diffBatchQueryService.checkLotInBatch(lot.getLotRrn()),
Errors.create().key(MessageIdList.BANK_LOT_BATCH).content("Lot in batch!").build());
//卡控post future hold被hold住的lot
checkPostFutureHold(lot.getLotRrn());
theform.setLots(lots);
request.setAttribute("lots", lots);
request.setAttribute("lotId", lotId);
theform.setLotId(lotId);
return mapping.getInputForward();
}
/*
public ActionForward bankCheck(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
BankInfoForm theform = (BankInfoForm) form;
long facilityRrn = LocalContext.getFacilityRrn();
if (WebUtils.getParameter("bankin", request) != null) {
theform.setTransId("bankin");
request.setAttribute("TransId", "BANKINOPERATION");
} else {
theform.setTransId("bankout");
request.setAttribute("TransId", "BANKOUTOPERATION");
}
theform.setOperationId("WAFER START BANK");
String id = theform.getOperationId().trim().toUpperCase();
long operationRrn = getInstanceRrn(id, facilityRrn, ObjectList.OPERATION_KEY);
long sessionOperRrn = 0;
Operation operation = prpService.getOperation(operationRrn);
if ((operation == null) || (operation.getStoreFlag() == null)
|| operation.getStoreFlag().trim().equalsIgnoreCase("0")) {
throw new WebException("bank.not_step", "not found step or step not store step!");
} else {
NamedObject namedObject = baseService.isExisted(operationRrn);
String operationSubType = namedObject.getObjectSubtype();
if ((operationSubType == null) || (!"LOT_BANK".equalsIgnoreCase(operationSubType))) {
throw new WebException("bank.house_not_bank", "This warehouse is not a lot bank!");
}
request.setAttribute("operationRrn", StringUtils.toString(operation.getInstanceRrn()));
sessionOperRrn = operation.getInstanceRrn();
request.setAttribute("lots", new ArrayList());
theform.setOldOperationId(id);
theform.setBankName(id);
}
String transId = request.getParameter("bankin") != null ? "bankin" : "bankout";
String sessionTransId = request.getParameter("bankin") != null ? "BANKINOPERATION"
: "BANKOUTOPERATION";
theform.setTransId(transId);
request.setAttribute("TransId", sessionTransId);
theform.setTransComments(StringUtils.EMPTY);
List lots = new ArrayList();
String lotId = request.getParameter("lotId");
Lot lot = lotQueryService.getLot(lotId, facilityRrn);
Carrier carrier = carrierService.getCarrier(lot.getCarrierRrn());
if (carrier == null || carrier.getInstanceRrn() <= 0) {
throw new WebException("bank.not_carrier", "Can not find this carrier of Lot!");
}
if (StringUtils.equalsIgnoreCase(carrier.getObjectSubtype(), CarrierType.DUMMY)) {
throw new WebException("bank.carrier_removed", "This carrier of Lot is already removed!");
}
validateLot(sessionOperRrn, theform, lot);
lots.add(lot);
List<BatchLotStore> list = lotQueryService.getLotInBatch(lot.getLotRrn());
if (list.size() > 0) {
throw new WebException("bank.lot_batch", "Lot in batch!");
}
theform.setLots(lots);
request.setAttribute("lots", lots);
request.setAttribute("lotId", lotId);
theform.setLotId(lotId);
return mapping.getInputForward();
}
*/
public ActionForward bankIn(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
request.setAttribute(IS_BANK_IN, YES);
long facilityRrn = LocalContext.getFacilityRrn();
BankInfoForm theform = (BankInfoForm) form;
Lot lot = lotQueryService.getLot(theform.getLotId(), facilityRrn);
Assert.isTrue(StringUtils.equalsIgnoreCase(lot.getLotStatus(), LotStatus.HOLD),
Errors.create().key(MessageIdList.BANK_STATUS_NOT_HOLD)
.content("The lot " + "is not" + " hold " + "and " + "can " + "not be" + " bank " + "in!")
.build());
Map transInfo = bankInfo(theform, request, lot);
transInfo.put("transId", TransactionNames.BANKIN_KEY);
// List<Lot> lockLots = new ArrayList<Lot>();
// lockLots.add(lot);
// checkAndCreateLotsTransLock(LocalContext.getUserRrn(), TransactionNames.LOCK_BANKIN_LOT, lockLots,
// "The lot bank in, in BankEditAction by: " + LocalContext.getUserId());
List<String> lotRrns = null;
if (transInfo.containsKey("lots") && transInfo.get("lots") instanceof ArrayList) {
lotRrns = ((ArrayList<Object>) transInfo.get("lots")).stream().map(StringUtils::toString)
.collect(Collectors.toList());
}
Assert.isFalse(lotRrns == null,
Errors.create().key(MessageIdList.LOT_LOTRRN_NOT_FOUND).content("Lots is Empty!").build());
try {
lotService.bankIn(transInfo, lotRrns);
} catch (Exception e) {
// removeLotLockWhenTransError(LocalContext.getUserRrn(), lockLots, TransactionNames.LOCK_BANKIN_LOT,
// "The lot bank in fail, in BankEditAction by: " + LocalContext.getUserId());
throw new SystemIllegalArgumentException(Errors.create().content("The lot bank in fail").build());
}
theform.setOperationId("");
return mapping.findForward(Constants.LOTLOCATION_KEY);
}
public ActionForward bankOut(ActionMapping mapping, ActionForm form, HttpServletRequest request,
HttpServletResponse response) {
long facilityRrn = LocalContext.getFacilityRrn();
BankInfoForm theform = (BankInfoForm) form;
Lot lot = lotQueryService.getLot(theform.getLotId(), facilityRrn);
Assert.isTrue(StringUtils.equalsIgnoreCase(lot.getLotStatus(), LotStatus.BANKED),
Errors.create().key(MessageIdList.BANK_NOT_BANKED)
.content("The lot is not banked, and can not be bank out!").build());
Map transInfo = bankInfo(theform, request, lot);
String changePartFlag = theform.getChangePartFlag();
if (changePartFlag != null) {
if (changePartFlag.equalsIgnoreCase("on")) {
Assert.isFalse(request.getParameter("productId") == null ||
request.getParameter("productId").trim().equals("") ||
request.getParameter("technologyId") == null ||
request.getParameter("technologyId").trim().equals(""),
Errors.create().key(MessageIdList.BANK_PROCESS_SPCEIFIED)
.content("Process flow must be specified!").build());
}
}
List<Map> opertionSubTtypeList = baseService.getOpertionSubTypeList("LOT_BANK");
String bank_name = theform.getBankName().toString().trim().toUpperCase();
boolean needSetupActul_order = false;
for (Map bankMap : opertionSubTtypeList) {
String actul_flg = bankMap.get("instance_id").toString();
if (actul_flg.equalsIgnoreCase(bank_name)) {
needSetupActul_order = true;
break;
}
}
if (needSetupActul_order == true) {
if (changePartFlag != null) {
if (changePartFlag.equalsIgnoreCase("on")) {
Assert.isFalse(theform.getOrder_Id() == null || theform.getOrder_Id().length() == 0,
Errors.create().key(MessageIdList.BANK_ORDER_SPCEIFIED)
.content("Actul order id must be specified!").build());
}
}
}
theform.setOperationId("");
transInfo.put("transId", TransactionNames.BANKOUT_KEY);
List<String> lotRrns = null;
if (transInfo.containsKey("lots") && transInfo.get("lots") instanceof ArrayList) {
lotRrns = ((ArrayList<Object>) transInfo.get("lots")).stream().map(StringUtils::toString)
.collect(Collectors.toList());
}
Assert.isFalse(lotRrns == null,
Errors.create().key(MessageIdList.LOT_LOTRRN_NOT_FOUND).content("Lots is Empty!").build());
try {
lotService.bankOut(transInfo, lotRrns);
} catch (Exception e) {
// removeLotLockWhenTransError(LocalContext.getUserRrn(), lockLots, TransactionNames.LOCK_BANKOUT_LOT,
// "The lot bank out, in BankEditAction by: " + LocalContext.getUserId());
throw new SystemIllegalArgumentException(Errors.create().content("The lot bank out fail").build());
}
Order ordinfo = new Order();
if (changePartFlag != null) {
if (changePartFlag.equalsIgnoreCase("on")) {
String duedate = null;
Timestamp due_date = null;
/* TODO: old order programer
if (theform.getOrder_Id() != null && theform.getOrder_Id().length() > 0
&& needSetupActul_order == true) {
ordinfo = baseService.getOrder(theform.getOrder_Id().trim(), "ORDERACTUL_BANK");
// holly add at 20080702
String orderproductiondate = ordinfo.getProductionDate();
Timestamp lotduedate = DateUtils.stringToTimestamp(orderproductiondate);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
duedate = formatter.format(lotduedate);
due_date = DateUtils.stringToTimestamp(duedate);
int remain = 0;
int total = 0;
int runing = 0;
int reg_qty = 0;
total = Integer.parseInt(ordinfo.getOrder_Qty().toString().trim());
remain = Integer.parseInt(ordinfo.getRemain_Qty().toString().trim());
reg_qty = lot.getQty1().intValue();
if (reg_qty > remain) {
throw new WebException("", "Regist Lot Qty(" + StringUtils.toString(reg_qty)
+ ")> actul Order Remain Qty(" + StringUtils.toString(
remain) + "),Acutl Order Id:" + theform.getOrder_Id().trim());
}
if (orderproductiondate == null || "".equalsIgnoreCase(orderproductiondate)) {
throw new WebException("",
"order: " + ordinfo.getOrder_Id() + " request_date is empty!",
ordinfo.getOrder_Id());
}
}*/
Map tempInfo = new HashMap();
Map changeProcessInfo = null;
changeProcessInfo = new HashMap();
changeProcessInfo.put("ordrequest_date", due_date);
changeProcessInfo.put("lotRrn", new Long(lot.getLotRrn()));
changeProcessInfo.put("lotId", lot.getLotId());
changeProcessInfo.put("lotStatus", lot.getLotStatus());
changeProcessInfo.put("qty", "" + lot.getQty1());
changeProcessInfo.put("lotOwner", lot.getLotOwner());
changeProcessInfo.put("currOperation", lot.getOperationId());
changeProcessInfo.put("transPerformedBy", MapUtils.getString(transInfo, "user"));
changeProcessInfo.put("productRrn", new Long(getInstanceRrn(request.getParameter("productId"),
getNamedSpace(ObjectList.PRODUCT_KEY,
facilityRrn),
ObjectList.PRODUCT_KEY)));
if (request.getParameter("productId") != null) {
changeProcessInfo.put("productId", request.getParameter("productId").toUpperCase());
}
changeProcessInfo.put("processRrn", new Long(getInstanceRrn(request.getParameter("technologyId"),
getNamedSpace(ObjectList.WFL_KEY,
facilityRrn),
ObjectList.WFL_KEY)));
Assert.isTrue(isTechnologyValid4Product(MapUtils.getLong(changeProcessInfo, "productRrn"),
MapUtils.getLong(changeProcessInfo, "processRrn")),
Errors.create().key(MessageIdList.BANK_INVALID_TECHNOLOGY).content("Invalid technology!")
.build());
tempInfo = getStepsInfoByLot(lot, (Long) changeProcessInfo.get("processRrn"),
request.getParameter("stepNumber"));
changeProcessInfo.put("stageId", tempInfo.get("stageId"));
changeProcessInfo.put("layerId", tempInfo.get("layerId"));
changeProcessInfo.put("executionRrn", tempInfo.get("executionRrn"));
changeProcessInfo.put("operationRrn", tempInfo.get("operationRrn"));
Long operationRrn = (Long) tempInfo.get("operationRrn");
Assert.isTrue(checkOperationInFacility(operationRrn, facilityRrn),
Errors.create().key(MessageIdList.BANK_NOT_FACILITY).content(
"The new " + "route" + "/operation " + "is not in " + "current " +
"facility!")
.build());
changeProcessInfo.put("operationId", getInstanceId((MapUtils.getLongValue(tempInfo, "operationRrn"))));
changeProcessInfo.put("operationVer", tempInfo.get("operationVer"));
changeProcessInfo.put("processStepVersion", tempInfo.get("processStepVersion"));
changeProcessInfo.put("processVersion", tempInfo.get("processVersion"));
changeProcessInfo.put("processStepIdVersion", tempInfo.get("processStepIdVersion"));
changeProcessInfo.put("processStepVersion4wfl", tempInfo.get("processStepVersion4wfl"));
changeProcessInfo.put("nextoperationRrn1", tempInfo.get("nextoperationRrn1"));
changeProcessInfo.put("nextoperationRrn2", tempInfo.get("nextoperationRrn2"));
changeProcessInfo.put("nextprocessStepVersion1", tempInfo.get("nextprocessStepVersion1"));
changeProcessInfo.put("nextprocessStepIdVersion1", tempInfo.get("nextprocessStepIdVersion1"));
changeProcessInfo.put("nextprocessStepVersion2", tempInfo.get("nextprocessStepVersion2"));
changeProcessInfo.put("nextprocessStepIdVersion2", tempInfo.get("nextprocessStepIdVersion2"));
String temp = (String) tempInfo.get("processStepVersion");
String route = "";
if (temp != null) {
int i = 0;
int j = 0;
i = temp.indexOf("|");
// find first '|'
if (i != -1) {
j = temp.indexOf("|", i + 1);
// find se '|'
if (j > 0) {
route = temp.substring(i + 1, j);
} else if (i > 0) { // aaa|bbb
route = temp.substring(0, i);
}
}
}
route = route.replace(',', '.');
changeProcessInfo.put("route", route);
tempInfo = prpService.getOperationInfo((Long) tempInfo.get("operationRrn"),
(Integer) tempInfo.get("operationVer"));
changeProcessInfo.put("trackUnitFlag", tempInfo.get("trackUnitFlag"));
changeProcessInfo.put("keepUnitHistoryFlag", tempInfo.get("keepUnitHistoryFlag"));
// get Context info
tempInfo = new HashMap();
tempInfo.put("productRrn", changeProcessInfo.get("productRrn"));
tempInfo.put("routeRrn", parseRouteRrn(MapUtils.getString(changeProcessInfo, "processStepVersion")));
tempInfo.put("recipeRrn", null);
tempInfo.put("operationRrn", changeProcessInfo.get("operationRrn"));
tempInfo.put("technologyRrn", changeProcessInfo.get("processRrn"));
tempInfo.put("lotRrn", changeProcessInfo.get("lotRrn"));
// new method to get bor context
changeProcessInfo.put("borRrn", ctxExecService.getBomRrn(tempInfo));
changeProcessInfo.put("reticleRrn", tempInfo.get("reticleRrn"));
changeProcessInfo.put("transPerformedBy", MapUtils.getString(transInfo, "user"));
changeProcessInfo.put("transComments", request.getParameter("comments"));
changeProcessInfo.put("transReason", MapUtils.getString(transInfo, "transReason"));
// lockLots = new ArrayList<>();
// lockLots.add(lot);
// checkAndCreateLotsTransLock(LocalContext.getUserRrn(), TransactionNames.LOCK_CHANGE_PROCESS,
// lockLots,
// "The lot chang process after bankOut, in BankEditAction by: ");
try {
lotService.changeLotProcess(changeProcessInfo);
lotService.updateLotStatus(lot.getLotRrn(), LotStatus.HOLD);
} catch (Exception e) {
// removeLotLockWhenTransError(LocalContext.getUserRrn(), lockLots,
// TransactionNames.LOCK_CHANGE_PROCESS,
// "The lot chang process after bankOut fail, in " + "BankEditAction
// by:" +
// " " + LocalContext.getUserId());
throw new SystemIllegalArgumentException(
Errors.create().content("The lot chang process after bankOut fail").build());
}
// Regist Lot's order info ,and update order qty
//TODO: old order programer
// if (theform.getOrder_Id() != null && theform.getOrder_Id().length() > 0
// && needSetupActul_order == true) {
// Map lotordinfo = new HashMap();
// lotordinfo.put("lot_rrn", StringUtils.toString(lot.getLotRrn()));
// lotordinfo.put("lot_id", lot.getLotId());
// int lotqty = lot.getQty1().intValue();
// String lotqty2 = String.valueOf(lotqty);
// lotordinfo.put("lot_qty", lotqty2);
// lotordinfo.put("order_id", ordinfo.getOrder_Id());
// lotordinfo.put("order_id_market", ordinfo.getMarket_order_Id()
// .toString().trim());
// lotordinfo.put("order_rrn", ordinfo.getOrder_RRN());
// lotordinfo.put("order_id_type", ordinfo.getOrder_id_type());
// Map lottrans = new HashMap();
// lottrans = (Map) baseService.getLotTransInfo(StringUtils.toString(lot
// .getLotRrn()));
// lotordinfo.put("lot_trnasname", lottrans.get("trans_rrn"));
// lotordinfo.put("trans_sequence", lottrans.get("TRANS_SEQUENCE"));
//
// String ordertype = lotordinfo.get("order_id_type").toString().trim();
// this.getInvManager().RegLotOrdInfo(lotordinfo, ordertype);
// }
}
}
return mapping.findForward(Constants.LOTLOCATION_KEY);
}
private Map bankInfo(BankInfoForm theform, HttpServletRequest request, Lot lot) {
String user = LocalContext.getUserId();
Long sessionOperRrn = NumberUtils.toLong(request.getParameter("operationRrn"));
Map transInfo = new HashMap();
transInfo.put("user", user);
transInfo.put("referenceDocument", theform.getReferenceDocument());
transInfo.put("comments", theform.getTransComments());
transInfo.put("warehouseRrn", sessionOperRrn);
TransReason transReason = new TransReason();
transInfo.put("transReason", transReason);
List listLots = new ArrayList();
listLots.add(new Long(lot.getLotRrn()));
if (request.getParameter("bankout") != null) {
Set productSet = new TreeSet();
Set processSet = new TreeSet();
String changePartFlag = theform.getChangePartFlag();
if (changePartFlag != null) {
if (changePartFlag.equalsIgnoreCase("on")) {
productSet.add(lot.getProductRrn());
processSet.add(lot.getProcessStepVersion());
}
}
Assert.isFalse(productSet.size() > 1, Errors.create().key(MessageIdList.BANK_NOT_SAME_PRODUCT)
.content("Not being the same product,can not be bank out!")
.build());
Assert.isFalse(processSet.size() > 1, Errors.create().key(MessageIdList.BANK_NOT_SAME_PROCESS)
.content("Not being the same process,can not be bank out!")
.build());
}
transInfo.put("lots", listLots);
return transInfo;
}
private void validateLot(Long sessionOperRrn, BankInfoForm theform, Lot lot) {
Assert.isTrue(lot.getLotRrn() != 0,
Errors.create().key(MessageIdList.BANK_INVALID_LOT).content("Invalid lot Id!").build());
theform.setLotId("");
theform.setOrder_Id("");
if (StringUtils.equalsIgnoreCase(theform.getTransId(), "bankin")) {
Assert.isTrue(StringUtils.equalsIgnoreCase(lot.getLotStatus(), LotStatus.HOLD),
Errors.create().key(MessageIdList.BANK_STATUS_NOT_HOLD)
.content("The lot is not hold and can not be bank in!").build());
} else {
Assert.isTrue(StringUtils.equalsIgnoreCase(lot.getLotStatus(), LotStatus.BANKED),
Errors.create().key(MessageIdList.BANK_NOT_BANKED)
.content("The lot is not banked, and can not be bank out!").build());
/**
* 增加判断该LOT是否属于这个operation下的,不属于不能bank out。
*/
Assert.isTrue(lot.getOperationRrn().equals(sessionOperRrn),
Errors.create().key(MessageIdList.BANK_NOT_BANK).content("The lot is not in the lot bank!")
.build());
}
}
private void checkBankFlag(Lot lot) {
QueryContextValueDTO dto = new QueryContextValueDTO();
dto.setFacilityRrn(lot.getFacilityRrn());
dto.setProductRrn(lot.getProductRrn());
dto.setProcessRrn(lot.getProcessRrn());
dto.setProcessVersion(lot.getProcessVersion());
dto.setRouteRrn(lot.getRouteRrn());
if (StringUtils.equalsIgnoreCase(lot.getLotStatus(), LotStatus.BANKED)) {
//dto.setOperationRrn(lot.getPrevOperationRrn());
// bankOut不做卡控 37512
return;
} else {
dto.setOperationRrn(lot.getOperationRrn());
}
if (sysService.getRefFileValues(ReferenceDetailNames.ALLOW_BANK_LOT_TYPE, LocalContext.getFacilityRrn())
.stream().filter(p -> p.getKey1Value().equals(lot.getLotType())).count() > 0L) {
return;
}
String bankinFlag = prpService.getBankInFlagByProcessInfo(dto);
Assert.isFalse(StringUtils.isEmpty(bankinFlag) || "N".equalsIgnoreCase(bankinFlag),
Errors.create().content("The BankFlag is N or empty can not bank!").build());
}
}