|
|
@ -0,0 +1,218 @@
|
|
|
|
|
|
|
|
package com.op.plan.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.op.common.core.exception.ServiceException;
|
|
|
|
|
|
|
|
import com.op.common.core.utils.poi.ExcelUtil;
|
|
|
|
|
|
|
|
import com.op.common.core.web.controller.BaseController;
|
|
|
|
|
|
|
|
import com.op.common.core.web.domain.AjaxResult;
|
|
|
|
|
|
|
|
import com.op.common.core.web.page.TableDataInfo;
|
|
|
|
|
|
|
|
import com.op.common.log.annotation.Log;
|
|
|
|
|
|
|
|
import com.op.common.log.enums.BusinessType;
|
|
|
|
|
|
|
|
import com.op.common.security.annotation.RequiresPermissions;
|
|
|
|
|
|
|
|
import com.op.plan.domain.ProOrderWorkorder;
|
|
|
|
|
|
|
|
import com.op.plan.domain.dto.SplitOrderDTO;
|
|
|
|
|
|
|
|
import com.op.plan.service.IProOrderWorkorderService;
|
|
|
|
|
|
|
|
import com.op.plan.service.IProWetMaterialPlanDetailService;
|
|
|
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 白坯生产工单Controller
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @author Open Platform
|
|
|
|
|
|
|
|
* @date 2023-07-26
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
|
|
|
@RequestMapping("/bppro/workorder")
|
|
|
|
|
|
|
|
public class ProBPOrderWorkorderController extends BaseController {
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private IProOrderWorkorderService proOrderWorkorderService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过子工单code查询并返回所有级联工单
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param code
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/getWorkOrders/{code}")
|
|
|
|
|
|
|
|
public AjaxResult getWorkOrders(@PathVariable("code") String code) {
|
|
|
|
|
|
|
|
return proOrderWorkorderService.getWorkOrders(code);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 校验工单是否可以修改
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@GetMapping("/checkWorkOrder/{id}")
|
|
|
|
|
|
|
|
public AjaxResult checkWorkOrder(@PathVariable("id") String id) {
|
|
|
|
|
|
|
|
return proOrderWorkorderService.checkWorkOrder(id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 提交修改工单接口
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param splitOrderDTO
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/subChangeWorkOrder")
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:edit")
|
|
|
|
|
|
|
|
@Log(title = "修改工单", businessType = BusinessType.UPDATE)
|
|
|
|
|
|
|
|
public AjaxResult subChangeWorkOrder(@RequestBody SplitOrderDTO splitOrderDTO) {
|
|
|
|
|
|
|
|
return proOrderWorkorderService.subChangeWorkOrder(splitOrderDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 提交修改工单-设备变更接口
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param splitOrderDTO
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/subChangeWorkOrderM")
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:edit")
|
|
|
|
|
|
|
|
public AjaxResult subChangeWorkOrderM(@RequestBody SplitOrderDTO splitOrderDTO) {
|
|
|
|
|
|
|
|
return proOrderWorkorderService.subChangeWorkOrderM(splitOrderDTO);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过子工单获取批次信息list(父工单批次信息)
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param proOrderWorkorder
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/getWorkBatchList")
|
|
|
|
|
|
|
|
public AjaxResult getWorkBatchList(@RequestBody ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
return proOrderWorkorderService.getWorkBatchList(proOrderWorkorder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 通过子工单信息查询订单信息和工单信息
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param proOrderWorkorder
|
|
|
|
|
|
|
|
* @return
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@PostMapping("/getOrderAndWorkInfo")
|
|
|
|
|
|
|
|
public AjaxResult getOrderAndWorkInfo(@RequestBody ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
return proOrderWorkorderService.getOrderAndWorkInfo(proOrderWorkorder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 查询生产工单列表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:proworkorder:list")
|
|
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
|
|
|
public TableDataInfo list(ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
startPage();
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder);
|
|
|
|
|
|
|
|
return getDataTable(list);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 导出生产工单列表
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:export")
|
|
|
|
|
|
|
|
@Log(title = "生产工单", businessType = BusinessType.EXPORT)
|
|
|
|
|
|
|
|
@PostMapping("/export")
|
|
|
|
|
|
|
|
public void export(HttpServletResponse response, ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> list = proOrderWorkorderService.selectProOrderWorkorderList(proOrderWorkorder);
|
|
|
|
|
|
|
|
ExcelUtil<ProOrderWorkorder> util = new ExcelUtil<ProOrderWorkorder>(ProOrderWorkorder.class);
|
|
|
|
|
|
|
|
util.exportExcel(response, list, "生产工单数据");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 获取生产工单详细信息
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:query")
|
|
|
|
|
|
|
|
@GetMapping(value = "/{workorderId}")
|
|
|
|
|
|
|
|
public AjaxResult getInfo(@PathVariable("workorderId") String workorderId) {
|
|
|
|
|
|
|
|
return success(proOrderWorkorderService.selectProOrderWorkorderByWorkorderId(workorderId));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 新增生产工单
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:add")
|
|
|
|
|
|
|
|
@Log(title = "生产工单", businessType = BusinessType.INSERT)
|
|
|
|
|
|
|
|
@PostMapping
|
|
|
|
|
|
|
|
public AjaxResult add(@RequestBody ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
return toAjax(proOrderWorkorderService.insertProOrderWorkorder(proOrderWorkorder));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 修改生产工单
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:edit")
|
|
|
|
|
|
|
|
@Log(title = "生产工单", businessType = BusinessType.UPDATE)
|
|
|
|
|
|
|
|
@PutMapping
|
|
|
|
|
|
|
|
public AjaxResult edit(@RequestBody ProOrderWorkorder proOrderWorkorder) {
|
|
|
|
|
|
|
|
return toAjax(proOrderWorkorderService.updateProOrderWorkorder(proOrderWorkorder));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 删除生产工单
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:remove")
|
|
|
|
|
|
|
|
@Log(title = "生产工单", businessType = BusinessType.DELETE)
|
|
|
|
|
|
|
|
@DeleteMapping("/{workorderIds}")
|
|
|
|
|
|
|
|
public AjaxResult remove(@PathVariable String[] workorderIds) {
|
|
|
|
|
|
|
|
//没进入生产之前都可以删除
|
|
|
|
|
|
|
|
// 根据工单的ids查工单的信息
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> proOrderWorkorders = proOrderWorkorderService.selectProOrderWorkorderByWorkIds(workorderIds);
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(proOrderWorkorders)) {
|
|
|
|
|
|
|
|
throw new ServiceException("所查询的工单为空!!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 划分工单
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> whiteWorkOrder = new ArrayList<>();
|
|
|
|
|
|
|
|
List<ProOrderWorkorder> proWorkOrder = new ArrayList<>();
|
|
|
|
|
|
|
|
for (ProOrderWorkorder data : proOrderWorkorders) {
|
|
|
|
|
|
|
|
if (data.getProdType().equals("white")) {
|
|
|
|
|
|
|
|
whiteWorkOrder.add(data);
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
|
|
|
proWorkOrder.add(data);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 白坯检验逻辑
|
|
|
|
|
|
|
|
for (ProOrderWorkorder white : whiteWorkOrder) {
|
|
|
|
|
|
|
|
if (!(white.getStatus().equals("w0") || white.getStatus().equals("w1"))) {
|
|
|
|
|
|
|
|
throw new ServiceException("工单已进行生产,不允许删除!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (whiteWorkOrder.size() > 0) {
|
|
|
|
|
|
|
|
proOrderWorkorderService.deleteWhiteWorkorderByWorkOrder(whiteWorkOrder);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 成品检验逻辑
|
|
|
|
|
|
|
|
ArrayList<String> strings = new ArrayList<>();
|
|
|
|
|
|
|
|
for (ProOrderWorkorder proOrderWorkorder : proWorkOrder) {
|
|
|
|
|
|
|
|
String status = proOrderWorkorder.getStatus();
|
|
|
|
|
|
|
|
if (status.equals("w0") || status.equals("w1")) {
|
|
|
|
|
|
|
|
strings.add(proOrderWorkorder.getWorkorderId());
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
throw new ServiceException("工单已进行生产,不允许删除!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
String[] orderWorkerIds = strings.toArray(new String[0]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 删除成品工单
|
|
|
|
|
|
|
|
if (orderWorkerIds.length > 0) {
|
|
|
|
|
|
|
|
proOrderWorkorderService.deleteProOrderWorkorderByWorkorderIds(orderWorkerIds);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return toAjax(1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 下发生产工单
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@RequiresPermissions("mes:bppro:workorder:edit")
|
|
|
|
|
|
|
|
@Log(title = "下发生产工单", businessType = BusinessType.OTHER)
|
|
|
|
|
|
|
|
@PostMapping("/downWorkorder/{workorderIds}")
|
|
|
|
|
|
|
|
public AjaxResult downWorkorder(@PathVariable String[] workorderIds) {
|
|
|
|
|
|
|
|
return toAjax(proOrderWorkorderService.downProOrderWorkorderByWorkorderIds(workorderIds));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|