chenlu
2024-06-07 2f640b1038fa331954f78ed1f4317212cf5bb34d
north-glass-erp/src/main/java/com/example/erp/service/pp/ProductionSchedulingService.java
@@ -23,22 +23,22 @@
    @Autowired
    ProductionSchedulingMapper productionSchedulingMapper;
    //带时间查询
    public Map<String, Object> SelectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, ProductionScheduling productionScheduling ) {
    //未排产查询
    public Map<String, Object> selectSchedulingSv(String selectTime1, String selectTime2, String orderId,String processes, Integer state, ProductionScheduling productionScheduling ) {
        Map<String, Object> map = new HashMap<>();
        if(orderId.equals("null")){
        if("null".equals(orderId)){
            orderId="";
        }
        if (processes.equals("null")){
        if ("null".equals(processes)){
            processes="";
        }
        if (state==2){//已排产
            map.put("data", productionSchedulingMapper.SelectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
            map.put("data", productionSchedulingMapper.selectOkSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
        }else if (state==1){//未排产
            map.put("data", productionSchedulingMapper.SelectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
            map.put("data", productionSchedulingMapper.selectNoSchedulingMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
        }
@@ -47,20 +47,28 @@
    //首次查询排产数据
    public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2,ProductionScheduling productionScheduling ) {
    public Map<String, Object> selectLastScheduling(String selectTime1, String selectTime2,String processes,String orderId,ProductionScheduling productionScheduling ) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", productionSchedulingMapper.selectLastSchedulingMp(selectTime1, selectTime2, productionScheduling));
        if("null".equals(orderId)){
            orderId="";
        }
        if ("null".equals(processes)){
            processes="";
        }
        map.put("data", productionSchedulingMapper.selectLastSchedulingMp(selectTime1, selectTime2,processes,orderId, productionScheduling));
        map.put("process", productionSchedulingMapper.selectProcess());
        return map;
    }
    //带订单号查询
    public Map<String, Object> SelectSchedulingNotSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, ProductionScheduling productionScheduling) {
    public Map<String, Object> selectSchedulingNotSv(String selectTime1, String selectTime2, String orderId, String processes, Integer state, ProductionScheduling productionScheduling) {
        Map<String, Object> map = new HashMap<>();
        map.put("data", productionSchedulingMapper.SelectSchedulingNotMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
        map.put("data", productionSchedulingMapper.selectSchedulingNotMp(selectTime1, selectTime2,orderId,processes, productionScheduling));
        return map;
    }
    public Boolean AddSchedulingSv(Map<String, Object> object) {
    public Boolean addSchedulingSv(Map<String, Object> object) {
        String userName = "";
        if (object.get("userName") != null) {
            userName = object.get("userName").toString();
@@ -82,8 +90,11 @@
        List<ProductionScheduling> schedulinglist = JSONArray.parseArray(JSONObject.toJSONString(object.get("scheduling")), ProductionScheduling.class);
        if (!schedulinglist.isEmpty()) {
            for (ProductionScheduling productionScheduling : schedulinglist) {
               productionSchedulingMapper.insertSelective(schedulingId,productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),processes,productionScheduling.getSchedulingQuantity(),productionScheduling.getScheduledStartTime(),productionScheduling.getPlanEndTime(),productionScheduling.getNotes());
               // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
                //查询已排产工序数量
             // Integer num =  productionSchedulingMapper.selectNumberMp(productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),processes);
             productionSchedulingMapper.insertSelective(schedulingId,productionScheduling.getOrderId(),productionScheduling.getOrderNumber(),productionScheduling.getTechnologyNumber(),processes,productionScheduling.getSchedulingQuantity(),productionScheduling.getScheduledStartTime(),productionScheduling.getPlanEndTime(),productionScheduling.getNotes());
                //System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getTechnologyNumber());
            }
            return true;
        }
@@ -94,14 +105,22 @@
    }
    public boolean DeleteSchedulingSv(Map<String, Object> object) throws Exception {
    public boolean deleteSchedulingSv(Map<String, Object> object) throws Exception {
        JSONObject objJson = new JSONObject(object);
        List<ProductionScheduling> Scheduling = JSONArray.parseArray(JSONObject.toJSONString(objJson.get("scheduling")), ProductionScheduling.class);
        productionSchedulingMapper.delete(new LambdaQueryWrapper<ProductionScheduling>().eq(ProductionScheduling::getSchedulingId, Scheduling.get(0).getId()));
        return true;
        if (!Scheduling.isEmpty()) {
            for (ProductionScheduling productionScheduling : Scheduling) {
                productionSchedulingMapper.deleteSchedulingMp(productionScheduling.getSchedulingId());
                // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
            }
            return true;
        }
        else {
            return false;
        }
    }
    public boolean ExamineSchedulingSv(Map<String, Object> object) {
    public boolean examineSchedulingSv(Map<String, Object> object) {
        String userName = "";
        if (object.get("userName") != null) {
            userName = object.get("userName").toString();
@@ -110,7 +129,7 @@
        if (!schedulinglist.isEmpty()) {
            for (ProductionScheduling productionScheduling : schedulinglist) {
                productionSchedulingMapper.ExamineSchedulingMp(productionScheduling.getSchedulingId(),userName);
                productionSchedulingMapper.examineSchedulingMp(productionScheduling.getSchedulingId(),userName);
                // System.out.println(productionScheduling.getOrderNumber()+"***"+productionScheduling.getOrderId());
            }
            return true;