春风项目四线(合箱线、总装线)
cl
2024-01-15 05d42506f6eda85cc93060b1b4d6b779061bf24a
jcdm-main/src/main/java/com/jcdm/main/om/productionOrde/controller/OmProductionOrdeInfoController.java
@@ -2,9 +2,13 @@
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;
@@ -34,6 +38,9 @@
{
    @Autowired
    private IOmProductionOrdeInfoService omProductionOrdeInfoService;
    @Autowired
    private IBsOrderSchedulingService bsOrderSchedulingService;
    /**
     * 查询生产工单列表
@@ -82,6 +89,30 @@
    }
    /**
     * 新增生产工单
     */
    @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.setStatus("1");
            bsOrderSchedulingService.insertBsOrderScheduling(bsOrderScheduling);
            startCode ++;
        }
        omProductionOrdeInfo.setOrderStatus("2");//更新工单状态
        return toAjax(omProductionOrdeInfoService.updateOmProductionOrdeInfo(omProductionOrdeInfo));
    }
    /**
     * 修改生产工单
     */
    @PreAuthorize("@ss.hasPermi('om:productionOrde:edit')")