春风项目四线(合箱线、总装线)
懒羊羊
2024-01-15 f119894e61a56d584c140b40baa6a4420dc8e8d6
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -1,10 +1,15 @@
package com.jcdm.main.om.productionOrde.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.jcdm.main.bs.orderScheduling.domain.BsOrderScheduling;
import com.jcdm.main.bs.orderScheduling.service.IBsOrderSchedulingService;
import com.jcdm.main.om.productionOrde.domain.OmProductionOrdeInfo;
import com.jcdm.main.om.productionOrde.service.IOmProductionOrdeInfoService;
import com.jcdm.main.webservice.service.ReceivingServices;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -22,6 +27,8 @@
import com.jcdm.common.utils.poi.ExcelUtil;
import com.jcdm.common.core.page.TableDataInfo;
import static org.apache.commons.lang3.SystemUtils.getUserName;
/**
 * 生产工单Controller
 * 
@@ -34,6 +41,9 @@
{
    @Autowired
    private IOmProductionOrdeInfoService omProductionOrdeInfoService;
    @Autowired
    private IBsOrderSchedulingService bsOrderSchedulingService;
    /**
     * 查询生产工单列表
@@ -82,6 +92,32 @@
    }
    /**
     * 新增生产工单
     */
    @PostMapping("/orderSchedulingForBoxCode")
    public AjaxResult addOrderSchedulingForBoxCode(@RequestBody OmProductionOrdeInfo omProductionOrdeInfo)
    {
        Integer startCode = Integer.parseInt(omProductionOrdeInfo.getStartCode());//开始编号
        Integer planQty = Math.toIntExact(omProductionOrdeInfo.getPlanQty());//计划数量
        String dateTimeRule = omProductionOrdeInfo.getDateTimeRule();
        for(int i=0;i<planQty;i++){
            BsOrderScheduling bsOrderScheduling = new BsOrderScheduling();
            bsOrderScheduling.setOrderNo(omProductionOrdeInfo.getWorkOrderNo());
            bsOrderScheduling.setModel(omProductionOrdeInfo.getTypeZ());
            bsOrderScheduling.setEngineNo(omProductionOrdeInfo.getTypeZ() + " "+dateTimeRule+ StringUtils.leftPad(String.valueOf(startCode),3, "0"));
            bsOrderScheduling.setProductionStatus("1");
            bsOrderScheduling.setOperator(getUserName());
//            bsOrderScheduling.setOperateTime(String.valueOf(new Date()));
            bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling);
            startCode ++;
        }
        omProductionOrdeInfo.setOrderStatus("2");//更新工单状态
        return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo));
    }
    /**
     * 修改生产工单
     */
    @PreAuthorize("@ss.hasPermi('om:productionOrde:edit')")