package cn.ezhizao.project.business.controller;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import cn.ezhizao.common.utils.poi.ExcelUtil;
import cn.ezhizao.framework.aspectj.lang.annotation.Log;
import cn.ezhizao.framework.aspectj.lang.enums.BusinessType;
import cn.ezhizao.framework.web.controller.BaseController;
import cn.ezhizao.framework.web.domain.AjaxResult;
import cn.ezhizao.framework.web.page.TableDataInfo;
import cn.ezhizao.project.business.domain.*;
import cn.ezhizao.project.business.service.*;
import cn.ezhizao.project.system.service.ISysDeptService;
import lombok.Data;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 修改后工艺Controller
 *
 * @author ezhizao
 * @date 2024-04-07
 */
@RestController
@RequestMapping("/business/amend")
public class BizLotTechnologicalProcessController extends BaseController {
    @Resource
    private IBizLotTechnologicalProcessService bizLotTechnologicalProcessServic;

    @Resource
    private IBizTechnologicalProcessService bizTechnologicalProcessService;

    @Resource
    private IBizLotTechnologicalProcessDetailService bizLotTechnologicalProcessDetailService;

    @Resource
    private IBizTechnologicalProcessDetailService bizTechnologicalProcessDetailService;

    @Resource
    private IBizLotService bizLotService;

    @Resource
    private IBizProductionPlanDetailService bizProductionPlanDetailService;

    @Resource
    private IBizFurnaceNoInfoService bizFurnaceNoInfoService;

    @Resource
    private IBizDayworkService bizDayworkService;

    @Resource
    private IBizProcessService bizProcessService;

    @Resource
    private ISysDeptService sysDeptService;

    @Resource
    private IBizDayworkCarrierService bizDayworkCarrierService;

    @Resource
    private IBizLotWasteService bizLotWasteService;

    @Resource
    private IBizDayworkItemService bizDayworkItemService;

    // 静态内部类 RequestData
    @Data
    public static class RequestData {

        private List<BizLot> lotList;
        private List<BizTechnologicalProcessDetail> processList;

    }

    /**
     * 查询修改后工艺列表
     */
    @PreAuthorize("@ss.hasPermi('business:amend:list')")
    @GetMapping("/list")
    public TableDataInfo list(BizLotTechnologicalProcess bizLotTechnologicalProcess) throws NoSuchFieldException, IllegalAccessException {
        setTenantId(bizLotTechnologicalProcess);
        startPage();
        List<BizLotTechnologicalProcess> list = bizLotTechnologicalProcessServic.getList(bizLotTechnologicalProcess);
        return getDataTable(list);
    }

    /**
     * 查询工序数据
     */
    @GetMapping("/processList")
    public TableDataInfo processList(BizProcess process) throws NoSuchFieldException, IllegalAccessException {
        startPage();
        return getDataTable(bizProcessService.getList(process));
    }

    /**
     * 查询工序数据
     */
    @GetMapping("/standardProcess/{processId}")
    public TableDataInfo standardProcess(@PathVariable("processId") Long processId) throws NoSuchFieldException, IllegalAccessException {
        BizLotTechnologicalProcess amend = bizLotTechnologicalProcessServic.getById(processId);

        return getDataTable(bizTechnologicalProcessDetailService.getProcessDetailsByTechnicalProcessId(amend.getTechnologicalProcessId()));
    }

    /**
     * 查询批次信息
     *
     * @param lotCode
     * @return
     * @throws NoSuchFieldException
     * @throws IllegalAccessException
     */
    @GetMapping("/lotParticulars/{lotCode}")
    public AjaxResult lotParticulars(@PathVariable("lotCode") String lotCode) throws NoSuchFieldException, IllegalAccessException {
        //根据查询批次信息
        BizLot lot = new BizLot();
        lot.setLotCode(lotCode);
        try {
            lot = bizLotService.getList(lot).get(0);
        } catch (Exception e) {
            throw new RuntimeException("批次信息异常！");
        }
        //查询批废
        BizLotWaste lotWaste = bizLotWasteService.query().eq("lot_id", lot.getId()).eq("deleted", 0).one();
        lot.setLotWaste(lotWaste);
        //查询计划单信息
        lot.setProductionPlanDetail(bizProductionPlanDetailService.getById(lot.getProductionPlanDetailId()));
        //查询报工信息
        BizDaywork daywork = new BizDaywork();
        daywork.setLotId(lot.getId());
        List<BizDaywork> dayworks=  bizDayworkService.getList(daywork);
        if(dayworks.size()>0){
            daywork = bizDayworkService.getList(daywork).get(0);
            lot.setDaywork(daywork);
            //根据报工id和计划单id查询 furnaceNoInfo
            BizFurnaceNoInfo furnaceNoInfo = new BizFurnaceNoInfo();
            furnaceNoInfo.setProductionPlanDetailId(lot.getProductionPlanDetailId());
            furnaceNoInfo.setDayworkId(daywork.getId());

            //查询箱号
            BizDayworkCarrier dayworkCarrier = new BizDayworkCarrier();
            dayworkCarrier.setDayworkId(daywork.getId());
            dayworkCarrier.setIsChanged(0);
            List<BizDayworkCarrier> dayworkCarriers = bizDayworkCarrierService.getList(dayworkCarrier);
            StringBuffer carrierName = new StringBuffer();
            dayworkCarriers.forEach(item -> {
                carrierName.append(item.getCarrierCode()).append(", ");
            });
            // 删除末尾多余的逗号和空格
            if (carrierName.length() > 0) {
                carrierName.delete(carrierName.length() - 2, carrierName.length());
            }
            lot.setCarrierName(carrierName.toString());
            //设置furnaceNoInfo
            lot.setFurnaceNoInfo(bizFurnaceNoInfoService.getList(furnaceNoInfo).size() > 0 ? bizFurnaceNoInfoService.getList(furnaceNoInfo).get(0) : new BizFurnaceNoInfo());
            lot.getProductionPlanDetail().setRequisitionDepartmentName(sysDeptService.selectDeptById(daywork.getDeptId()).getDeptName());

        }else{
            lot.setFurnaceNoInfo(new BizFurnaceNoInfo());
            lot.getProductionPlanDetail().setRequisitionDepartmentName("");
        }

        //查询工序信息
        lot = selectProcess(lot);

        return success(lot);
    }

    /**
     * 查询工序信息
     */
    private BizLot selectProcess(BizLot lot) throws NoSuchFieldException, IllegalAccessException {

        BizTechnologicalProcessDetail processDetail = new BizTechnologicalProcessDetail();
        List<BizTechnologicalProcessDetail> processDetailList = new ArrayList<>();

        //是否单批单改
        if (lot.getIsAmend() == 1 || lot.getIsWasteRecycling() == 1) {
            //查询更改后的数据
            BizLotTechnologicalProcessDetail amendDetail = new BizLotTechnologicalProcessDetail();
            amendDetail.setLotTechnologicalProcessId(lot.getTechnologicalProcessId());
            List<BizLotTechnologicalProcessDetail> amendDetailList = bizLotTechnologicalProcessDetailService.getList(amendDetail);

            for (BizLotTechnologicalProcessDetail item : amendDetailList) {
                BizTechnologicalProcessDetail process = new BizTechnologicalProcessDetail();
                process.setProcessId(item.getProcessId());
                process.setProcessStepNumber(item.getProcessStepNumber());
                process.setProcessCode(item.getProcessCode());
                process.setProcessAlias(item.getProcessAlias());
                process.setProcessKey(item.getProcessKey());
                process.setProductShaftCategory(item.getProductShaftCategory());
                process.setProductShaftCategoryName(item.getProductShaftCategoryName());
                process.setTechnologicalProcessId(item.getLotTechnologicalProcessId());
                process.setProductId(item.getProductId());
                process.setProductDescription(item.getProductDescription());
                processDetailList.add(process);
            }
        }  else {
            //查询工序信息
            processDetail.setTechnologicalProcessId(lot.getTechnologicalProcessId());
            processDetailList = bizTechnologicalProcessDetailService.getProcessDetailsByTechnicalProcessId(lot.getTechnologicalProcessId());

        }
//         修改使用方式，暂时注释
//        else if (lot.getIsWasteRecycling() == 1) { //是否废品回用
//            BizTechnologicalWasteRecyclingDetail wasteRecyclingDetail = new BizTechnologicalWasteRecyclingDetail();
//            wasteRecyclingDetail.setTechnologicalWasteRecyclingId(lot.getTechnologicalProcessId());
//            List<BizTechnologicalWasteRecyclingDetail> processList = bizTechnologicalWasteRecyclingDetailService.getList(wasteRecyclingDetail);
//
//            for (BizTechnologicalWasteRecyclingDetail item : processList) {
//                BizTechnologicalProcessDetail process = new BizTechnologicalProcessDetail();
//                process.setProcessId(item.getProcessId());
//                process.setProcessStepNumber(item.getProcessStepNumber());
//                process.setProcessCode(item.getProcessCode());
//                process.setProcessAlias(item.getProcessAlias());
//                process.setProcessKey(item.getProcessKey());
//                process.setProductShaftCategory(item.getProductShaftCategory());
//                process.setProductShaftCategoryName(item.getProductShaftCategoryName());
//                process.setTechnologicalProcessId(item.getTechnologicalWasteRecyclingId());
//                process.setProductId(item.getProductId());
//                process.setProductDescription(item.getProductDescription());
//                processDetailList.add(process);
//            }
//        }

        //查询报工信息
        lot.setTechnologicalProcessDetailList(selectDayworkItem(processDetailList, lot));
        return lot;
    }

    /**
     * 查询报工信息
     *
     * @param processDetailList
     * @param lot
     */
    private List<BizTechnologicalProcessDetail> selectDayworkItem(List<BizTechnologicalProcessDetail> processDetailList, BizLot lot) {
        //查询报工信息
        BizDayworkItem item = new BizDayworkItem();
        if(lot.getDaywork()!=null){
            item.setDayworkId(lot.getDaywork().getId());
            List<BizDayworkItem> dayworkItems = bizDayworkItemService.selectList(item);

            for (BizTechnologicalProcessDetail t : processDetailList) {
                //给备料赋值，备料没有废品，默认完成
                if (processDetailList.get(0).getProcessId().equals(t.getProcessId())) {
                    t.setInvestNum(lot.getProductionQuantity());
                    t.setAbandonNum(0);
                    t.setQualifiedNum(lot.getProductionQuantity());
                    t.setStatus("2");
                }
                for (BizDayworkItem d : dayworkItems) {

                    //如果是单批单改只查询FormDayworkItemId为0的数据
                    if (lot.getIsAmend() == 1 && d.getFormDayworkItemId() == 0) {
                        continue;
                    }

                    //根据工序判断，查询每道工序的报工信息
                    if (t.getProcessId().equals(d.getProcessId())) {
                        //查询状态为完成货工序已完成的状态，计算合格量，废品，投入量
                        if (d.getStatus().equals("2") || d.getStatus().equals("3")) {
                            if (d.getRejectNum() != null) {
                                t.setAbandonNum(t.getAbandonNum() == null ? d.getRejectNum() : t.getAbandonNum() + d.getRejectNum());
                            } else {
                                t.setAbandonNum(t.getAbandonNum() == null?0:t.getAbandonNum()!=0?t.getAbandonNum():0);
                            }
                            t.setQualifiedNum(t.getQualifiedNum() == null ? d.getQualifiedNum() : t.getQualifiedNum() + d.getQualifiedNum());
                            t.setInvestNum(d.getProdNum());
                        }
                        //未开始时合格量默，废品默认为0
                        if (d.getStatus().equals("0")) {
                            t.setAbandonNum(0);
                            t.setQualifiedNum(0);
                            t.setInvestNum(d.getProdNum());
                            //设置状态为未开始
                            t.setStatus("0");
                        } else if (d.getStatus().equals("1") || d.getStatus().equals("2")) {
                            //设置状态为进行中
                            t.setInvestNum(d.getProdNum());
                            t.setStatus("1");
                        } else {
                            //设置状态为已完成
                            t.setStatus("2");
                        }
                        //设置当前批次状态，当第一道序（不包括备料）状态为未开始时批次状态为未开始
                        if (processDetailList.get(1).getProcessId().equals(t.getProcessId()) && d.getStatus().equals("0")) {
                            lot.getDaywork().setStatus(0);
                        } else if (processDetailList.get(processDetailList.size() - 1).getProcessId().equals(d.getProcessId())) {
                            //最后一道工序如果状态为不是"未开始，进行中，已完成"当前批次已完成
                            if (!d.getStatus().equals("1") && !d.getStatus().equals("2") && !d.getStatus().equals("0")) {
                                lot.getDaywork().setStatus(2);
                            }
                        } else {
                            //当前批次进行中
                            lot.getDaywork().setStatus(1);
                        }
                    }
                }
            }
        }
        return processDetailList;
    }

    /**
     * 导出修改后工艺列表
     */
    @PreAuthorize("@ss.hasPermi('business:amend:export')")
    @Log(title = "修改后工艺", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BizLotTechnologicalProcess bizLotTechnologicalProcess) throws NoSuchFieldException, IllegalAccessException {
        setTenantId(bizLotTechnologicalProcess);
        List<BizLotTechnologicalProcess> list = bizLotTechnologicalProcessServic.getList(bizLotTechnologicalProcess);
        ExcelUtil<BizLotTechnologicalProcess> util = new ExcelUtil<BizLotTechnologicalProcess>(BizLotTechnologicalProcess.class);
        util.exportExcel(response, list, "修改后工艺数据");
    }


    @Log(title = "多批单改", businessType = BusinessType.INSERT)
    @PostMapping("/addMultiAmend")
    @Transactional
    public AjaxResult addMultiAmend(@RequestBody RequestData requestData) {
        List<BizLot> lotList = requestData.getLotList();
        List<BizLot> newLotList=new ArrayList<>();
        List<BizTechnologicalProcessDetail> processDetailList = requestData.getProcessList();
        for (BizLot item : lotList) {
            BizLot lot = new BizLot();
            lot.setLotCode(item.getLotCode());
            lot = bizLotService.getList(lot).get(0);

            BizTechnologicalProcess technologicalProcess = new BizTechnologicalProcess();
            //新增修改后工艺信息
            BizLotTechnologicalProcess amend = new BizLotTechnologicalProcess();
            amend.setTenantId(lot.getTenantId());
            amend.setLotId(lot.getId());
            amend.setLotCode(lot.getLotCode());
            amend.setProductionPlanId(lot.getProductionPlanId());
            amend.setProductionPlanDetailId(lot.getProductionPlanDetailId());
            amend.setProductId(lot.getProductId());
            amend.setAmendmentVersions(1);
            amend.setTechnologicalProcessId(lot.getTechnologicalProcessId());
            amend.setTechnologyVersion(lot.getTechnologyVersion());
            amend.setProductDrawingNumber(technologicalProcess.getProductDrawingNumber());
            amend.setProductShaftCategory(technologicalProcess.getProductShaftCategory());
            amend.setProductSpecification(technologicalProcess.getProductSpecification());
            amend.setProductShaftCategoryName(technologicalProcess.getProductShaftCategoryName());
            amend.setProductCode(technologicalProcess.getProductCode());
            amend.setProductDescription(technologicalProcess.getProductDescription());
            bizLotTechnologicalProcessServic.save(amend);

            List<BizLotTechnologicalProcessDetail> amendDetailList = new ArrayList<>();

            for (BizTechnologicalProcessDetail detail : processDetailList) {
                BizLotTechnologicalProcessDetail amendDetail = new BizLotTechnologicalProcessDetail();
                amendDetail.setLotTechnologicalProcessId(amend.getId());
                amendDetail.setTenantId(amend.getTenantId());
                amendDetail.setTechnologyVersion(amend.getTechnologyVersion());
                amendDetail.setProductId(amend.getProductId());
                amendDetail.setProductCode(amend.getProductCode());
                amendDetail.setProcessStepNumber(detail.getProcessStepNumber());
                amendDetail.setLotId(lot.getId());
                amendDetail.setProcessId(detail.getProcessId());
                amendDetail.setProcessKey(detail.getProcessKey());
                amendDetail.setProcessCode(detail.getProcessCode());
                amendDetail.setProcessAlias(detail.getProcessAlias());
                amendDetail.setProductShaftCategory(amend.getProductShaftCategory());
                amendDetail.setProductShaftCategoryName(amend.getProductShaftCategoryName());
                amendDetail.setProductDescription(amend.getProductDescription());
                amendDetailList.add(amendDetail);
            }
            updateDayworkItem(item.getId(), amend.getId());

            //修改批次工艺信息
            lot.setTechnologicalProcessId(amend.getId());
            lot.setIsAmend(1);
            bizLotTechnologicalProcessDetailService.saveBatch(amendDetailList) ;
            newLotList.add(lot);
//            bizLotService.updateById(lot);
        }
        return success(bizLotService.saveOrUpdateBatch(newLotList));
    }

    /**
     * 新增修改后工艺
     */
    @Log(title = "单批单改", businessType = BusinessType.INSERT)
    @PostMapping("/addAmend/{lotId}")
    @Transactional
    public AjaxResult addAmend(@PathVariable("lotId") Long lotId, @RequestBody List<BizTechnologicalProcessDetail> detailList) {
        //根据id查询批次信息
        BizLot lot = bizLotService.getById(lotId);
        BizTechnologicalProcess technologicalProcess = new BizTechnologicalProcess();

        int num = 0;//修改过的次数

        //是否进行过单批单改
        if (lot.getIsAmend() == 1||lot.getIsWasteRecycling() == 1) {
            //查询单批单改信息
            BizLotTechnologicalProcess technologicalAmend = bizLotTechnologicalProcessServic.getById(lot.getTechnologicalProcessId());

            //先将lot的工艺id设置为原始工艺id,为了给新改的原始工艺赋值
            lot.setTechnologicalProcessId(technologicalAmend.getTechnologicalProcessId());
            //查询修改过几次
            List<BizLotTechnologicalProcess> list = bizLotTechnologicalProcessServic.selectUpdateList(lot.getId());
            num = list.size();
            //设为停用
            technologicalAmend.setIsStop(1);
            bizLotTechnologicalProcessServic.saveOrUpdate(technologicalAmend);
            //查询原始工艺信息
            technologicalProcess = bizTechnologicalProcessService.getById(technologicalAmend.getTechnologicalProcessId());
        }  else {
            technologicalProcess = bizTechnologicalProcessService.getById(lot.getTechnologicalProcessId());
        }

//        使用新方法暂时注释
//        else if (lot.getIsWasteRecycling() == 1) { //是否废品回用
//            BizTechnologicalWasteRecycling wasteRecycling = bizTechnologicalWasteRecyclingService.getById(lot.getTechnologicalProcessId());
//            technologicalProcess = bizTechnologicalProcessService.getById(wasteRecycling.getTechnologicalProcessId());
//        }

        //新增修改后工艺信息
        BizLotTechnologicalProcess amend = new BizLotTechnologicalProcess();
        amend.setTenantId(lot.getTenantId());
        amend.setLotId(lot.getId());
        amend.setLotCode(lot.getLotCode());
        amend.setProductionPlanId(lot.getProductionPlanId());
        amend.setProductionPlanDetailId(lot.getProductionPlanDetailId());
        amend.setProductId(lot.getProductId());
        amend.setAmendmentVersions(num + 1);//设置版本号为修改次数+1
        amend.setTechnologicalProcessId(lot.getTechnologicalProcessId());
        amend.setTechnologyVersion(lot.getTechnologyVersion());
        amend.setProductDrawingNumber(technologicalProcess.getProductDrawingNumber());
        amend.setProductShaftCategory(technologicalProcess.getProductShaftCategory());
        amend.setProductSpecification(technologicalProcess.getProductSpecification());
        amend.setProductShaftCategoryName(technologicalProcess.getProductShaftCategoryName());
        amend.setProductCode(technologicalProcess.getProductCode());
        amend.setProductDescription(technologicalProcess.getProductDescription());
        bizLotTechnologicalProcessServic.save(amend);

        List<BizLotTechnologicalProcessDetail> amendDetailList = new ArrayList<>();

        for (BizTechnologicalProcessDetail detail : detailList) {
            BizLotTechnologicalProcessDetail amendDetail = new BizLotTechnologicalProcessDetail();
            amendDetail.setLotTechnologicalProcessId(amend.getId());
            amendDetail.setTenantId(amend.getTenantId());
            amendDetail.setTechnologyVersion(amend.getTechnologyVersion());
            amendDetail.setProductId(amend.getProductId());
            amendDetail.setProductCode(amend.getProductCode());
            amendDetail.setProcessStepNumber(detail.getProcessStepNumber());
            amendDetail.setProcessId(detail.getProcessId());
            amendDetail.setLotId(lot.getId());
            amendDetail.setProcessKey(detail.getProcessKey());
            amendDetail.setProcessCode(detail.getProcessCode());
            amendDetail.setProcessAlias(detail.getProcessAlias());
            amendDetail.setProductShaftCategory(amend.getProductShaftCategory());
            amendDetail.setProductShaftCategoryName(amend.getProductShaftCategoryName());
            amendDetail.setProductDescription(amend.getProductDescription());
            amendDetailList.add(amendDetail);
        }
        updateDayworkItem(lotId, amend.getId());

        //修改批次工艺信息
        lot.setTechnologicalProcessId(amend.getId());
        lot.setIsAmend(1);
        return success(bizLotTechnologicalProcessDetailService.saveBatch(amendDetailList) && bizLotService.updateById(lot));
    }

    /**
     * 修改报工信息，将原先的报工信息复制出来
     *
     * @param lotId
     */
    private void updateDayworkItem(Long lotId, Long amendId) {
        //查询Daywork数据
        BizDaywork daywork = bizDayworkService.query().eq("lot_id", lotId).one();
        if (daywork != null) {
            //设置批次工艺信息
            daywork.setTechnologicalProcessId(amendId);
            //修改报工
            bizDayworkService.saveOrUpdate(daywork);
            //查询DayworkItem数据
            List<BizDayworkItem> dayworkItemList = bizDayworkItemService.getList(new BizDayworkItem().setDayworkId(daywork.getId()));
            //新增DayworkItem数据
            List<BizDayworkItem> newDayworkItemList = new ArrayList<>();
            for (BizDayworkItem dayworkItem : dayworkItemList) {
                //查询工序信息
                if (!dayworkItem.getStatus().equals("0")) {
                    BizDayworkItem newDayworkItem = dayworkItem;
                    newDayworkItem.setFormDayworkItemId(dayworkItem.getId());
                    newDayworkItem.setTechnologicalProcessId(amendId);
                    newDayworkItem.setId(null);
                    //新增报工信息
                    newDayworkItemList.add(newDayworkItem);
                }
            }
            if (newDayworkItemList.size() > 0) {
                //插入报工信息
                bizDayworkItemService.saveBatch(newDayworkItemList);
            }
        }
    }

    /**
     * 获取修改后工艺详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:amend:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(bizLotTechnologicalProcessServic.getById(id));
    }

    /**
     * 新增修改后工艺
     */
    @PreAuthorize("@ss.hasPermi('business:amend:add')")
    @Log(title = "修改后工艺", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BizLotTechnologicalProcess bizLotTechnologicalProcess) throws NoSuchFieldException, IllegalAccessException {
        setTenantId(bizLotTechnologicalProcess);
        return toAjax(bizLotTechnologicalProcessServic.save(bizLotTechnologicalProcess));
    }

    /**
     * 修改修改后工艺
     */
    @PreAuthorize("@ss.hasPermi('business:amend:edit')")
    @Log(title = "修改后工艺", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BizLotTechnologicalProcess bizLotTechnologicalProcess) throws NoSuchFieldException, IllegalAccessException {
        setTenantId(bizLotTechnologicalProcess);
        return toAjax(bizLotTechnologicalProcessServic.updateById(bizLotTechnologicalProcess));
    }

    /**
     * 删除修改后工艺
     */
    @PreAuthorize("@ss.hasPermi('business:amend:remove')")
    @Log(title = "修改后工艺", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable List<Long> ids) {
        return toAjax(bizLotTechnologicalProcessServic.removeBatchByIds(ids));
    }
}
