|
|
|
|
@ -1,8 +1,11 @@
|
|
|
|
|
package com.aucma.base.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.aucma.common.annotation.Log;
|
|
|
|
|
import com.aucma.common.enums.BusinessType;
|
|
|
|
|
import com.aucma.common.utils.DateUtils;
|
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
@ -150,9 +153,106 @@ public class BaseOrderInfoController extends BaseController {
|
|
|
|
|
* 获取正在执行的工单列表
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('base:orderInfo:list')")
|
|
|
|
|
@GetMapping("/running")
|
|
|
|
|
@GetMapping("/getRunningOrders")
|
|
|
|
|
public AjaxResult getRunningOrders() {
|
|
|
|
|
return success(baseOrderInfoService.getRunningOrders());
|
|
|
|
|
List<BaseOrderInfo> orders = baseOrderInfoService.getRunningOrders();
|
|
|
|
|
return AjaxResult.success(orders);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量开始生产
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('base:orderInfo:edit')")
|
|
|
|
|
@Log(title = "工单信息", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping("/batchStart")
|
|
|
|
|
public AjaxResult batchStartProduction(@RequestBody Map<String, Object> params) {
|
|
|
|
|
Long[] objIds = parseObjIds(params.get("objIds"));
|
|
|
|
|
String operator = (String) params.get("operator");
|
|
|
|
|
|
|
|
|
|
if (objIds == null || objIds.length == 0) {
|
|
|
|
|
return AjaxResult.error("请选择要操作的工单");
|
|
|
|
|
}
|
|
|
|
|
if (operator == null || operator.isEmpty()) {
|
|
|
|
|
return AjaxResult.error("请输入操作员");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toAjax(baseOrderInfoService.batchStartProduction(objIds, operator));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量更新完工数量
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('base:orderInfo:edit')")
|
|
|
|
|
@Log(title = "工单信息", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping("/batchUpdateQty")
|
|
|
|
|
public AjaxResult batchUpdateQuantity(@RequestBody Map<String, Object> params) {
|
|
|
|
|
Long[] objIds = parseObjIds(params.get("objIds"));
|
|
|
|
|
Long completeQty = parseLong(params.get("completeQty"));
|
|
|
|
|
Long defectQty = parseLong(params.get("defectQty"));
|
|
|
|
|
|
|
|
|
|
if (objIds == null || objIds.length == 0) {
|
|
|
|
|
return AjaxResult.error("请选择要操作的工单");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toAjax(baseOrderInfoService.batchUpdateQuantity(objIds, completeQty, defectQty));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 批量完工提报
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasPermi('base:orderInfo:edit')")
|
|
|
|
|
@Log(title = "工单信息", businessType = BusinessType.UPDATE)
|
|
|
|
|
@PutMapping("/batchComplete")
|
|
|
|
|
public AjaxResult batchCompleteProduction(@RequestBody Map<String, Object> params) {
|
|
|
|
|
Long[] objIds = parseObjIds(params.get("objIds"));
|
|
|
|
|
Long completeQty = parseLong(params.get("completeQty"));
|
|
|
|
|
Long defectQty = parseLong(params.get("defectQty"));
|
|
|
|
|
|
|
|
|
|
if (objIds == null || objIds.length == 0) {
|
|
|
|
|
return AjaxResult.error("请选择要操作的工单");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return toAjax(baseOrderInfoService.batchCompleteProduction(objIds, completeQty, defectQty));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解析objIds参数
|
|
|
|
|
*/
|
|
|
|
|
private Long[] parseObjIds(Object obj) {
|
|
|
|
|
if (obj == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (obj instanceof List) {
|
|
|
|
|
List<?> list = (List<?>) obj;
|
|
|
|
|
Long[] result = new Long[list.size()];
|
|
|
|
|
for (int i = 0; i < list.size(); i++) {
|
|
|
|
|
Object item = list.get(i);
|
|
|
|
|
if (item instanceof Number) {
|
|
|
|
|
result[i] = ((Number) item).longValue();
|
|
|
|
|
} else {
|
|
|
|
|
result[i] = Long.parseLong(item.toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 解析Long类型参数
|
|
|
|
|
*/
|
|
|
|
|
private Long parseLong(Object obj) {
|
|
|
|
|
if (obj == null) {
|
|
|
|
|
return 0L;
|
|
|
|
|
}
|
|
|
|
|
if (obj instanceof Number) {
|
|
|
|
|
return ((Number) obj).longValue();
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
return Long.parseLong(obj.toString());
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
return 0L;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|