chenlu
2024-05-21 cd017fae7b975035e5712a4568ec4bdda4190b05
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package com.example.erp.controller.pp;
 
import cn.dev33.satoken.annotation.SaCheckPermission;
import com.example.erp.common.Constants;
import com.example.erp.common.Result;
import com.example.erp.entity.sd.OrderGlassDetail;
import com.example.erp.entity.sd.OrderDetail;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.pp.WorkOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import java.sql.Date;
import java.util.Map;
 
@RestController
@Api(value="工单管理controller",tags={"工单管理操作接口"})
@RequestMapping("/workOrder")
public class WorkOrderController {
    @Autowired
    WorkOrderService workOrderService;
 
    //查询工单
    @ApiOperation("查询工单接口")
    @SaCheckPermission("SelectWorkOrder.search")
    @PostMapping  ("/orderGlassDetail/{selectTime1}/{selectTime2}/{state}")
    public Result dateWork(
            @PathVariable Date selectTime1,
            @PathVariable Date selectTime2,
            @PathVariable Integer state,
            @RequestBody OrderGlassDetail orderGlassDetail){
        return Result.seccess(workOrderService.defaultDateWork(selectTime1,selectTime2,state,orderGlassDetail));
    }
 
    //转生产订单查询
    @ApiOperation("转生产订单查询接口")
    @PostMapping  ("/addWork/{orderId}")
    public Result addWork(
            @PathVariable String orderId,
            @RequestBody OrderDetail orderDetail){
        return Result.seccess(workOrderService.addDateWork(orderId,orderDetail));
 
    }
 
 
    //添加工单
    @ApiOperation("添加工单接口")
    @SaCheckPermission("addWorkOrder.add")
    @PostMapping("/addOrderWork")
    public Result addOrderWork( @RequestBody Map<String,Object>  object){
 
//        if(workOrderService.addOrderWorkSv(object)){
//            return Result.seccess();
//        }else {
//            throw new ServiceException(Constants.Code_500,"保存失败");
//
//        }
 
        return  Result.seccess(workOrderService.addOrderWorkSv(object));
    }
 
    //删除工单
    @ApiOperation("删除工单接口")
    @SaCheckPermission("SelectWorkOrder.delete")
    @PostMapping("/deleteOrderWork/{orderId}/{productionId}")
    public Result deleteOrderWork(
            @PathVariable String orderId,
            @PathVariable String productionId
    ){
//        if(workOrderService.deleteOrderWorkSv(orderId,productionId)){
//            return Result.seccess();
//        }else {
//            throw new ServiceException(Constants.Code_500,"删除失败");
//
//        }
        return  Result.seccess(workOrderService.deleteOrderWorkSv(orderId,productionId));
    }
}