fix:工单管理
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.wms.mps.rest;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -34,7 +36,6 @@ public class ProduceWorkorderController {
|
||||
@GetMapping
|
||||
@Log("查询工单管理")
|
||||
@ApiOperation("查询工单管理")
|
||||
//@PreAuthorize("@el.check('produceWorkorder:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(produceWorkorderService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
@@ -47,6 +48,14 @@ public class ProduceWorkorderController {
|
||||
produceWorkorderService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
@PostMapping("/submits")
|
||||
@Log("新增工单管理")
|
||||
@ApiOperation("新增工单管理")
|
||||
//@PreAuthorize("@el.check('produceWorkorder:add')")
|
||||
public ResponseEntity<Object> submit(@Validated @RequestBody ProduceWorkorderDto dto) {
|
||||
produceWorkorderService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改工单管理")
|
||||
@@ -57,9 +66,16 @@ public class ProduceWorkorderController {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PutMapping("/submits")
|
||||
@Log("工单下发")
|
||||
@ApiOperation("工单下发")
|
||||
public ResponseEntity<Object> submits(@RequestBody List<String> param) {
|
||||
produceWorkorderService.submits(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@Log("删除工单管理")
|
||||
@ApiOperation("删除工单管理")
|
||||
//@PreAuthorize("@el.check('produceWorkorder:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
|
||||
produceWorkorderService.deleteAll(ids);
|
||||
@@ -77,7 +93,6 @@ public class ProduceWorkorderController {
|
||||
@PostMapping("/getDtl")
|
||||
@Log("获取当前工单下的工单生产记录")
|
||||
@ApiOperation("获取当前工单下的工单生产记录")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:list')")
|
||||
public ResponseEntity<Object> getDtl(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(produceWorkorderService.getDtl(param), HttpStatus.OK);
|
||||
}
|
||||
@@ -85,7 +100,6 @@ public class ProduceWorkorderController {
|
||||
@PostMapping("/forceFinish")
|
||||
@Log("工单强制完成")
|
||||
@ApiOperation("工单强制完成")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:list')")
|
||||
public ResponseEntity<Object> forceFinish(@RequestBody JSONObject param) {
|
||||
produceWorkorderService.forceFinish(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
|
||||
@@ -28,67 +28,13 @@ import java.util.Map;
|
||||
**/
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
@Api(tags = "工单管理")
|
||||
@Api(tags = "一体机工单管理")
|
||||
@RequestMapping("/api/produceshiftorder")
|
||||
@Slf4j
|
||||
public class ProduceshiftorderController {
|
||||
|
||||
private final ProduceshiftorderService produceshiftorderService;
|
||||
|
||||
@GetMapping
|
||||
@Log("查询工单")
|
||||
@ApiOperation("查询工单")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:list')")
|
||||
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page) {
|
||||
return new ResponseEntity<>(produceshiftorderService.queryAll(whereJson, page), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
@Log("新增工单")
|
||||
@ApiOperation("新增工单")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody ProduceshiftorderDto dto) {
|
||||
produceshiftorderService.create(dto);
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PostMapping("/addRows")
|
||||
@Log("批量新增工单")
|
||||
@ApiOperation("批量新增工单")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:add')")
|
||||
public ResponseEntity<Object> create(@Validated @RequestBody List<ProduceshiftorderDto> rows) {
|
||||
for (ProduceshiftorderDto dto : rows) {
|
||||
produceshiftorderService.create(dto);
|
||||
}
|
||||
return new ResponseEntity<>(HttpStatus.CREATED);
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Log("修改工单")
|
||||
@ApiOperation("修改工单")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:edit')")
|
||||
public ResponseEntity<Object> update(@Validated @RequestBody ProduceshiftorderDto dto) {
|
||||
produceshiftorderService.update(dto);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@Log("删除工单")
|
||||
@ApiOperation("删除工单")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:del')")
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Object> delete(@RequestBody Long[] ids) {
|
||||
produceshiftorderService.deleteAll(ids);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PutMapping("/submits")
|
||||
@Log("工单下发")
|
||||
@ApiOperation("工单下发")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:edit')")
|
||||
public ResponseEntity<Object> submits(@RequestBody JSONObject param) {
|
||||
produceshiftorderService.submits(param);
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
}
|
||||
|
||||
@PostMapping("/getDevice")
|
||||
@Log("根据登录用户设备下拉")
|
||||
@@ -141,31 +87,6 @@ public class ProduceshiftorderController {
|
||||
return new ResponseEntity<>(produceshiftorderService.getReportWork(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/forceFinish")
|
||||
@Log("工单强制完成")
|
||||
@ApiOperation("工单强制完成")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:list')")
|
||||
public ResponseEntity<Object> forceFinish(@RequestBody JSONObject param) {
|
||||
produceshiftorderService.forceFinish(param);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getDtl")
|
||||
@Log("获取当前工单下的工单生产记录")
|
||||
@ApiOperation("获取当前工单下的工单生产记录")
|
||||
//@PreAuthorize("@el.check('produceshiftorder:list')")
|
||||
public ResponseEntity<Object> getDtl(@RequestBody JSONObject param) {
|
||||
return new ResponseEntity<>(produceshiftorderService.getDtl(param), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/excelImport")
|
||||
@Log("excel导入")
|
||||
@ApiOperation("excel导入")
|
||||
public ResponseEntity<Object> excelImport(@RequestParam("file") MultipartFile file, HttpServletRequest request) {
|
||||
produceshiftorderService.excelImport(file, request);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/getNotWorkDeviceByWorkproceduceId")
|
||||
@Log("根据工序查询没有工单的设备")
|
||||
@ApiOperation("根据工序查询没有工单的设备")
|
||||
|
||||
@@ -80,6 +80,13 @@ public interface ProduceWorkorderService {
|
||||
*/
|
||||
JSONArray getDtl(JSONObject param);
|
||||
|
||||
/**
|
||||
* 工单下发
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
void submits(List<String> param);
|
||||
|
||||
/**
|
||||
* 强制完成
|
||||
* @param param
|
||||
|
||||
@@ -66,11 +66,6 @@ public interface ProduceshiftorderService {
|
||||
*/
|
||||
void deleteAll(Long[] ids);
|
||||
|
||||
/**
|
||||
* 工单下发
|
||||
* @param param
|
||||
*/
|
||||
void submits(JSONObject param);
|
||||
|
||||
/**
|
||||
* 根据当前登录用户下拉
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.common.utils.MapOf;
|
||||
import org.nl.common.utils.SecurityUtils;
|
||||
import org.nl.modules.common.exception.BadRequestException;
|
||||
import org.nl.modules.system.util.CodeUtil;
|
||||
@@ -41,6 +42,8 @@ import java.io.InputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author lyd
|
||||
@@ -187,8 +190,8 @@ public class ProduceWorkorderServiceImpl implements ProduceWorkorderService {
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("workorder_id", String.valueOf(workorder_id));
|
||||
param.put("is_delete", "1");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_id", currentUserId);
|
||||
param.put("update_name", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
wo.update(param);
|
||||
}
|
||||
@@ -212,6 +215,21 @@ public class ProduceWorkorderServiceImpl implements ProduceWorkorderService {
|
||||
return resultJSONArray;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void submits(List<String> param) {
|
||||
if (param == null || param.size()==0){
|
||||
return;
|
||||
}
|
||||
String sql = param.stream().collect(Collectors.joining("','"));
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
WQLObject wo = WQLObject.getWQLObject("PDM_produce_workOrder");
|
||||
wo.update(MapOf.of("workorder_status", WorkerOrderEnum.SEND.getCode()
|
||||
,"update_id", currentUserId,"update_name"
|
||||
, nickName,"update_time", DateUtil.now())
|
||||
,"workorder_id in ('"+sql+"')");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void forceFinish(JSONObject param) {
|
||||
@@ -237,7 +255,7 @@ public class ProduceWorkorderServiceImpl implements ProduceWorkorderService {
|
||||
produceorderMap.put("update_name", nickName);
|
||||
produceorderMap.put("update_time", DateUtil.now());
|
||||
produceorderMap.put("realproduceend_date", DateUtil.now());
|
||||
wo.update(produceorderMap);
|
||||
wo.update(produceorderMap,"workorder_id = '"+workorder_id+"'");
|
||||
JSONObject jsonObject = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
|
||||
String real_qty = jsonObject.getString("real_qty");
|
||||
if (StrUtil.isEmpty(real_qty)) {
|
||||
|
||||
@@ -59,6 +59,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
@Autowired
|
||||
ISysUserService userService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> queryAll(Map whereJson, Pageable page) {
|
||||
String produceorder_code = MapUtil.getStr(whereJson, "produceorder_code");
|
||||
@@ -204,19 +206,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void submits(JSONObject param) {
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
|
||||
param.put("order_status", "01");
|
||||
param.put("update_optid", currentUserId);
|
||||
param.put("update_optname", nickName);
|
||||
param.put("update_time", DateUtil.now());
|
||||
wo.update(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONArray getDevice(JSONObject param) {
|
||||
|
||||
Binary file not shown.
@@ -369,7 +369,7 @@
|
||||
<el-table-column prop="dq_real_qty" label="电气实际数量" width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="material_name" label="物料名称" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="workprocedure_name" label="工序名称" width="120" show-overflow-tooltip />
|
||||
<el-table-column prop="material_weight" label="物料单重" width="100" :formatter="crud.formatQlNum4"/>
|
||||
<el-table-column prop="material_weight" label="物料单重" width="100" :formatter="crud.formatQlNum4" />
|
||||
<el-table-column prop="planproducestart_date" label="计划开始时间" width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="planproduceend_date" label="计划结束时间" width="100" show-overflow-tooltip />
|
||||
<el-table-column prop="realproducestart_date" label="实际开始时间" width="100" show-overflow-tooltip />
|
||||
@@ -390,7 +390,7 @@
|
||||
{{ dict.label.IS_OR_NOT[scope.row.is_needmove] }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="create_type" label="创建类型" show-overflow-tooltip >
|
||||
<el-table-column prop="create_type" label="创建类型" show-overflow-tooltip>
|
||||
<template slot-scope="scope">
|
||||
{{ dict.label.WORKORDER_CREATE_TYPE[scope.row.create_type] }}
|
||||
</template>
|
||||
@@ -703,13 +703,13 @@ export default {
|
||||
if (length > 1) {
|
||||
var flag = false
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i].order_status !== '00' || rows[i].device_id === '') {
|
||||
if (rows[i].workorder_status === '5') {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return flag
|
||||
} else if (length === 1 && rows[0].order_status === '00' && rows[0].device_id !== '') {
|
||||
} else if (length === 1 && rows[0].workorder_status !== '5') {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
@@ -722,13 +722,13 @@ export default {
|
||||
if (length > 1) {
|
||||
var flag = false
|
||||
for (let i = 0; i < rows.length; i++) {
|
||||
if (rows[i].order_status === '04') {
|
||||
if (rows[i].workorder_status === '5') {
|
||||
flag = true
|
||||
break
|
||||
}
|
||||
}
|
||||
return flag
|
||||
} else if (length === 1 && rows[0].order_status !== '04') {
|
||||
} else if (length === 1 && rows[0].workorder_status !== '5') {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
@@ -749,16 +749,16 @@ export default {
|
||||
},
|
||||
// 下发
|
||||
submits(rows) {
|
||||
var i = Number(0)
|
||||
var orders = []
|
||||
console.log(rows)
|
||||
rows.forEach((item) => {
|
||||
var produceorder_id = item.produceorder_id
|
||||
crudProduceshiftorder.submits({ produceorder_id: produceorder_id }).then(res => {
|
||||
i = i + 1
|
||||
if (i === rows.length) {
|
||||
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
}
|
||||
})
|
||||
debugger
|
||||
orders.push(item.workprocedure_id)
|
||||
})
|
||||
debugger
|
||||
crudProduceshiftorder.submits(orders).then(res => {
|
||||
this.crud.notify('下发成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
this.crud.toQuery()
|
||||
})
|
||||
},
|
||||
add() {
|
||||
|
||||
Reference in New Issue
Block a user