//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package nccloud.web.ic.outbound.sapplybill.action;

import nc.vo.ic.m4455.entity.SapplyBillVO;
import nccloud.dto.ic.pub.entity.TransferInfo;
import nccloud.framework.core.json.IJson;
import nccloud.framework.service.ServiceLocator;
import nccloud.framework.web.action.itf.ICommonAction;
import nccloud.framework.web.container.IRequest;
import nccloud.framework.web.json.JsonFactory;
import nccloud.framework.web.ui.pattern.billcard.BillCard;
import nccloud.framework.web.ui.pattern.billcard.BillCardOperator;
import nccloud.pubitf.ic.outbound.service.IOutboundTransferVoService1;
import nccloud.web.ic.pub.precision.ICBaseBillcardPrecisionHandler;

/**
 * 备料计划转出库申请
 * 2005适配2312
 *
 * @author mzr
 * @date 2024/12/25
 */
public class TransToSapplyBill1Action implements ICommonAction {
    public TransToSapplyBill1Action() {
    }

    public Object doAction(IRequest request) {
        String read = request.read();
        IJson json = JsonFactory.create();
        TransferInfo transInfo = (TransferInfo) json.fromJson(read, TransferInfo.class);
        SapplyBillVO[] vos = null;
        IOutboundTransferVoService1 service = (IOutboundTransferVoService1) ServiceLocator.find(IOutboundTransferVoService1.class);
        vos = service.transPickmTo4455(transInfo);
        BillCardOperator operator = new BillCardOperator(transInfo.getPagecode());
        BillCard[] cards = new BillCard[vos.length];

        for (int i = 0; i < vos.length; ++i) {
            cards[i] = operator.toCard(vos[i]);
            ICBaseBillcardPrecisionHandler handler = new SapplyBillPrecisionHandler(cards[i]);
            handler.process();
        }

        return cards;
    }
}
