开发生产订单功能

pull/1/head
wangziyangyang 2020-07-01 17:47:28 +08:00
parent b0c8945898
commit e80b425a12
1 changed files with 107 additions and 5 deletions

View File

@ -1,10 +1,26 @@
package com.wangziyang.mes.order.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangziyang.mes.basedata.entity.SpMaterile;
import com.wangziyang.mes.basedata.entity.SpTableManager;
import com.wangziyang.mes.basedata.request.spMaterileReq;
import com.wangziyang.mes.common.BaseController;
import com.wangziyang.mes.common.Result;
import com.wangziyang.mes.order.entity.SpOrder;
import com.wangziyang.mes.order.service.ISpOrderService;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* <p>
@ -15,7 +31,93 @@ import com.wangziyang.mes.common.BaseController;
* @since 2020-07-01
*/
@Controller
@RequestMapping("/order/sp-order")
@RequestMapping("/order/release")
public class SpOrderController extends BaseController {
@Autowired
private ISpOrderService iSpOrderService;
/**
*
*
* @param model
* @return
*/
@ApiOperation("生产订单管理界面界面UI")
@ApiImplicitParams({@ApiImplicitParam(name = "model", value = "模型", defaultValue = "模型")})
@GetMapping("/list-ui")
public String listUI(Model model) {
return "/order/production/list";
}
/**
*
*
* @param model
* @param record
* @return
*/
@ApiOperation("生产订单修改界面")
@GetMapping("/add-or-update-ui")
public String addOrUpdateUI(Model model, SpTableManager record) {
if (StringUtils.isNotEmpty(record.getId())) {
SpOrder spOrder = iSpOrderService.getById(record.getId());
model.addAttribute("result", spOrder);
}
return "/order/production/addOrUpdate";
}
/**
*
*
* @param req
* @return Result
*/
@ApiOperation("生产订单界界面分页查询")
@ApiImplicitParams({@ApiImplicitParam(name = "req", value = "请求参数", defaultValue = "请求参数")})
@PostMapping("/page")
@ResponseBody
public Result page(spMaterileReq req) {
QueryWrapper queryWrapper = new QueryWrapper();
if (StringUtils.isNotEmpty(req.getMaterielLike())) {
queryWrapper.like("materiel", req.getMaterielLike());
}
if (StringUtils.isNotEmpty(req.getMaterielDescLike())) {
queryWrapper.like("materiel_desc", req.getMaterielDescLike());
}
IPage result = iSpOrderService.page(req, queryWrapper);
return Result.success(result);
}
/**
*
*
* @param record
* @return
*/
@ApiOperation("生产订单界修改、新增")
@PostMapping("/add-or-update")
@ResponseBody
public Result addOrUpdate(SpMaterile record) {
SpOrder spOrder = iSpOrderService.getById(record.getFlowId());
iSpOrderService.saveOrUpdate(spOrder);
return Result.success();
}
/**
*
*
* @param req
* @return Result
*/
@ApiOperation("删除生产订单界")
@ApiImplicitParams({@ApiImplicitParam(name = "req", value = "物料实体", defaultValue = "物料实体")})
@PostMapping("/delete")
@ResponseBody
public Result deleteByTableNameId(SpMaterile req) throws Exception {
iSpOrderService.removeById(req.getId());
return Result.success();
}
}