add:增加一体机设备,工单,操作接口;

This commit is contained in:
2023-04-10 16:00:41 +08:00
parent 3dcbb17f75
commit f7acb14776
9 changed files with 1161 additions and 843 deletions

View File

@@ -76,8 +76,8 @@ public enum AcsTaskEnum {
JSONArray res = new JSONArray();
task.forEach(t -> {
JSONObject taskEnum = new JSONObject();
taskEnum.put("name", t.getDesc());
taskEnum.put("code", t.getCode());
taskEnum.put("text", t.getDesc());
taskEnum.put("value", t.getCode());
res.add(taskEnum);
});
return res;

View File

@@ -1,24 +1,21 @@
package org.nl.wms.mps.rest;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import cn.dev33.satoken.annotation.SaIgnore;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.common.anno.Log;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.utils.api.ResultCode;
import org.nl.modules.common.exception.BizCoreException;
import org.nl.wms.mps.service.ProduceshiftorderService;
import org.nl.wms.mps.service.dto.ProduceshiftorderDto;
import org.nl.wms.mps.service.dto.DeviceDto;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
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;
@@ -30,16 +27,14 @@ import java.util.Map;
@RequiredArgsConstructor
@Api(tags = "一体机工单管理")
@RequestMapping("/api/produceshiftorder")
@SaIgnore
@Slf4j
public class ProduceshiftorderController{
private final ProduceshiftorderService produceshiftorderService;
@PostMapping("/getDevice")
@Log("根据登录用户设备下拉")
@ApiOperation("根据登录用户设备下拉")
//@PreAuthorize("@el.check('produceshiftorder:list')")
public ResponseEntity<Object> getDevice(@RequestBody JSONObject param) {
return new ResponseEntity<>(produceshiftorderService.getDevice(param), HttpStatus.OK);
}
@@ -52,29 +47,44 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(produceshiftorderService.getTable(param), HttpStatus.OK);
}
@PostMapping("/getDeviceList")
@Log("一体机-根据登录人信息获取设备列表")
@ApiOperation("一体机-根据登录人信息获取设备列表")
public ResponseEntity<List<DeviceDto>> getDeviceList(@RequestBody JSONObject form) {
log.info("海亮一体机服务 [根据登录人信息获取设备列表] 接口被请求");
return new ResponseEntity<>(produceshiftorderService.getDeviceList(form.getString("search_bar")), HttpStatus.OK);
}
@PostMapping("/getOrderList")
@Log("一体机-工单管理列表")
@ApiOperation("一体机-工单管理列表")
public ResponseEntity<Object> getOrderList(@RequestBody Map<String,String> param, Pageable page) {
log.info("海亮一体机服务 [工单管理列表] 接口被请求, 请求参数-{}", param);
if(null == param) {
throw new BizCoreException(ResultCode.VALIDATE_FAILED);
}
return new ResponseEntity<>(produceshiftorderService.getOrderList(param, page), HttpStatus.OK);
}
@PostMapping("/openStart")
@Log("看板开工")
@ApiOperation("看板开工")
//@PreAuthorize("@el.check('produceshiftorder:list')")
public ResponseEntity<Object> openStart(@RequestBody JSONObject param) {
produceshiftorderService.openStart(param);
return new ResponseEntity<>(HttpStatus.OK);
return new ResponseEntity<>(produceshiftorderService.openStart(param), HttpStatus.OK);
}
@PostMapping("/saveReport")
@Log("看板报工")
@ApiOperation("看板报工")
public ResponseEntity<Object> saveReport(@RequestBody JSONObject param) {
produceshiftorderService.saveReport(param);
return new ResponseEntity<>(HttpStatus.OK);
return new ResponseEntity<>(produceshiftorderService.saveReport(param), HttpStatus.OK);
}
@PostMapping("/finish")
@Log("看板强制完成")
@ApiOperation("看板强制完成")
public ResponseEntity<Object> finish(@RequestBody JSONObject param) {
produceshiftorderService.finish(param);
return new ResponseEntity<>(HttpStatus.OK);
return new ResponseEntity<>(produceshiftorderService.finish(param), HttpStatus.OK);
}
@PostMapping("/getReportWork")

View File

@@ -2,7 +2,9 @@ package org.nl.wms.mps.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.common.utils.api.CommonResult;
import org.nl.system.service.user.dao.SysUser;
import org.nl.wms.mps.service.dto.DeviceDto;
import org.nl.wms.mps.service.dto.ProduceshiftorderDto;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;
@@ -12,14 +14,14 @@ import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author qinx
* @description 服务接口
* @date 2022-05-24
**/
public interface ProduceshiftorderService{
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
@@ -28,6 +30,7 @@ public interface ProduceshiftorderService {
/**
* 查询所有数据不分页
*
* @param whereJson 条件参数
* @return List<ProduceshiftorderDto>
*/
@@ -35,6 +38,7 @@ public interface ProduceshiftorderService {
/**
* 根据ID查询
*
* @param produceorder_id ID
* @return Produceshiftorder
*/
@@ -42,79 +46,108 @@ public interface ProduceshiftorderService {
/**
* 根据编码查询
*
* @param code code
* @return Produceshiftorder
*/
ProduceshiftorderDto findByCode(String code);
/**
* 创建
*
* @param dto /
*/
void create(ProduceshiftorderDto dto);
/**
* 编辑
*
* @param dto /
*/
void update(ProduceshiftorderDto dto);
/**
* 多选删除
*
* @param ids /
*/
void deleteAll(Long[] ids);
/**
* 根据当前登录用户下拉
*
* @param param
* @return
*/
JSONArray getDevice(JSONObject param);
/**
* 一体机获取设备列表
*
* @Param: form 请求参数
* @return: 设备列表
* @author gbx
* @date 2023/4/7
*/
List<DeviceDto> getDeviceList(String param);
/**
* 一体机-工单管理列表
*
* @return 工单列表
* @Param form 请求参数
* @author gbx
* @date 2023/04/7
*/
Map<String,Object> getOrderList(Map<String,String> param, Pageable page);
/**
* 获取工单生产记录
*
* @param param
* @return
*/
JSONArray getTable(JSONObject param);
/**
* 看板开工
* @param param
* 开工操作
*
* @param param 请求参数
*/
void openStart(JSONObject param);
CommonResult<Map<String,Object>> openStart(JSONObject param);
/**
* 看板报工
* @param param
* 报工操作
*
* @param param 请求参数
*/
void saveReport(JSONObject param);
CommonResult<Map<String,Object>> saveReport(JSONObject param);
/**
* 看板强制完成
* @param param
* 完工操作
*
* @param param 请求参数
*/
void finish(JSONObject param);
CommonResult<Map<String,Object>> finish(JSONObject param);
/**
* 获取当前报工记录
*
* @param param
* @return
*/
JSONObject getReportWork(JSONObject param);
/**
* 工单强制完成
*
* @param param
*/
void forceFinish(JSONObject param);
/**
* 获取当前工单下的工单生产记录
*
* @param param
* @return
*/
@@ -122,6 +155,7 @@ public interface ProduceshiftorderService {
/**
* excel工单批量导入
*
* @param file
* @param request
*/
@@ -129,6 +163,7 @@ public interface ProduceshiftorderService {
/**
* 更换设备时根据工单所属工序 查询所有工单中没有生产的设备
*
* @param param
* @return
*/
@@ -136,6 +171,7 @@ public interface ProduceshiftorderService {
/**
* 更换设备
*
* @param param
*/
void replaceDevice(JSONObject param);

View File

@@ -0,0 +1,58 @@
package org.nl.wms.mps.service.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* 设备信息
*
* @author gbx
* @since 2023-04-10
*/
@Data
@SuppressWarnings("serial")
public class DeviceDto{
/**
* 设备编码
*/
@ApiModelProperty(value = "/**设备编码*/")
private String deviceCode;
/**
* 设备名称
*/
@ApiModelProperty(value = "/**设备名称*/")
private String deviceName;
/**
* 设备名称
*/
@ApiModelProperty(value = "/**设备名称*/")
private String device_status_name;
/**
* 工单编号
*/
@ApiModelProperty(value = "/**工单编号*/")
private String workorderCode;
/**
* 工单数
*/
@ApiModelProperty(value = "/**工单数*/")
private String job_count;
/**
* 设备状态
*/
@ApiModelProperty(value = "/**设备状态*/")
private String device_status;
/**
* 设备图标路径
*/
@ApiModelProperty(value = "/**设备图标路径*/")
private String device_icon;
/**
* 运行状态
*/
@ApiModelProperty(value = "/**运行状态*/")
private String is_run;
}

View File

@@ -1,7 +1,5 @@
package org.nl.wms.mps.service.impl;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.map.MapUtil;
@@ -15,12 +13,12 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.RequiredArgsConstructor;
import org.nl.common.anno.Log;
import lombok.extern.slf4j.Slf4j;
import org.nl.common.enums.WorkerOrderEnum;
import org.nl.common.utils.MapOf;
import org.nl.common.utils.api.CommonResult;
import org.nl.common.utils.api.RestBusinessTemplate;
import org.nl.modules.common.exception.BadRequestException;
import org.nl.modules.system.util.CodeUtil;
import org.nl.common.utils.SecurityUtils;
import org.nl.modules.wql.WQL;
@@ -33,8 +31,8 @@ import org.nl.wms.basedata.master.service.ClassstandardService;
import org.nl.wms.ext.acs.service.WmsToAcsService;
import org.nl.wms.mps.service.ProduceshiftorderService;
import org.nl.wms.mps.service.WorkOrderImportEnum;
import org.nl.wms.mps.service.dto.DeviceDto;
import org.nl.wms.mps.service.dto.ProduceshiftorderDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -54,15 +52,11 @@ import java.util.*;
@RequiredArgsConstructor
@Slf4j
public class ProduceshiftorderServiceImpl implements ProduceshiftorderService{
private final ClassstandardService classstandardService;
private final WmsToAcsService wmsToAcsService;
@Autowired
ISysUserService userService;
@Override
public Map<String,Object> queryAll(Map whereJson, Pageable page) {
String produceorder_code = MapUtil.getStr(whereJson, "produceorder_code");
@@ -148,7 +142,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
for(Integer i = 0; i < orderNum; i++) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
CurrentUser currentUser = SecurityUtils.getCurrentUser();
String newCode = CodeUtil.getNewCode("PDM_SHIFTORDER");
dto.setProduce_date(dto.getProduce_date().substring(0, 10));
@@ -175,15 +168,11 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(entity == null) {
throw new BadRequestException("被删除或无权限,操作失败!");
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
dto.setUpdate_time(DateUtil.now());
dto.setUpdate_id(currentUserId);
dto.setUpdate_name(nickName);
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
wo.update(json);
@@ -194,8 +183,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
public void deleteAll(Long[] ids) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
WQLObject wo = WQLObject.getWQLObject("mps_bd_produceshiftorder");
for(Long produceorder_id : ids) {
JSONObject param = new JSONObject();
@@ -208,7 +195,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
}
}
@Override
public JSONArray getDevice(JSONObject param) {
final String workprocedure_id = param.getString("workprocedure_id");
@@ -221,6 +207,84 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
return resultJSONArray;
}
/**
* 一体机获取设备列表
* 设备状态枚举1-关机、2-开机、3-生产中、4-待机、5-故障
*
* @author gbx
* @since 2023/4/7
*/
@Override
public List<DeviceDto> getDeviceList(String param) {
List<DeviceDto> list = WQL.getWO("ONEPART_QUERY").addParam("flag", "1").addParam("condition", param).process().getResultJSONArray(0).toJavaList(DeviceDto.class);
list.forEach(r -> {
//状态为为关机
if(StrUtil.isEmpty(r.getDevice_status())) {
r.setDevice_status("1");
r.setDevice_status_name("关机");
}
else{
//不是关机与故障状态则为运行
if(!Objects.equals(r.getDevice_status(), "1") && !Objects.equals(r.getDevice_status(), "5")) {
r.setIs_run("1");
}
else{
r.setIs_run("0");
}
}
//todo 当前工单数
r.setJob_count("1");
});
return list;
}
/**
* 一体机获取工单列表
*
* @author gbx
* @since 2023/4/7
*/
@Override
public Map<String,Object> getOrderList(Map<String,String> param, Pageable page) {
HashMap<String,String> map = new HashMap<>();
map.put("flag", "2");
Integer pageNumber = 0;
Integer pageSize = 20;
JSONObject whereJson = JSONObject.parseObject(JSON.toJSONString(param));
//设备编号
if(StrUtil.isNotEmpty(whereJson.getString("device_code"))) {
map.put("device_code", "%" + whereJson.getString("device_code") + "%");
}
//搜索条件
if(StrUtil.isNotEmpty(whereJson.getString("key_value"))) {
map.put("key_value", "%" + whereJson.getString("key_value") + "%");
}
//开始时间
if(StrUtil.isNotEmpty(whereJson.getString("realproducestart_date"))) {
map.put("realproducestart_date", whereJson.getString("realproducestart_date"));
}
//结束时间
if(StrUtil.isNotEmpty(whereJson.getString("realproduceend_date"))) {
map.put("realproduceend_date", whereJson.getString("realproduceend_date"));
}
//分页参数
if(StrUtil.isNotEmpty(whereJson.getString("page")) && StrUtil.isNotEmpty(whereJson.getString("size"))) {
pageNumber = whereJson.getInteger("page");
pageSize = whereJson.getInteger("size");
//暂时无分页
if(pageNumber == 1) {
pageNumber = 0;
pageSize = 100;
}
}
JSONObject jsonObject = WQL.getWO("ONEPART_QUERY").addParamMap(map).pageQuery(WqlUtil.getHttpContext(pageNumber, pageSize), "workorder.create_time desc");
String size = jsonObject.getString("totalElements");
jsonObject.put("size", size);
//适配前端分页条件
jsonObject.remove("totalElements");
return jsonObject;
}
@Override
public JSONArray getTable(JSONObject param) {
//获取当前登录用户下的所有设备
@@ -239,96 +303,115 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
return resultJSONArray;
}
/**
* 开工操作
*
* @author gbx
* @since 2023/4/7
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void openStart(JSONObject param) {
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
public CommonResult<Map<String,Object>> openStart(JSONObject param) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
//获取前台传入的开工的工单信息
String workorder_id = param.getString("workorder_id");
String device_code = param.getString("device_code");
//1-创建、2-下发、3-生产中、4-暂停、5-完成
JSONObject result = wo.query("current_device_code = '" + device_code + "' and workorder_status in ('2','3','4') and workorder_id != '" + workorder_id + "'").uniqueResult(0);
//判断该工单状态
if(ObjectUtil.isNotEmpty(result)) {
throw new BadRequestException("已有工单选择该设备开工,请更换开工设备!");
}
//TODO:开工时修改生产班次工单表 生产设备、以及工单状态
wo.update(MapOf.of("workorder_id", workorder_id, "workorder_status", WorkerOrderEnum.SEND.getCode(), "update_id", currentUserId, "update_name", nickName, "update_time", DateUtil.now()));
JSONArray array = new JSONArray();
JSONObject order = new JSONObject(MapOf.of("workorder_id", workorder_id, "type", WorkerOrderEnum.SEND.getCode()));
array.add(order);
Map<String, Object> resp = wmsToAcsService.orderStatusUpdate(array);
String status = String.valueOf(resp.get("status"));
String message = (String) resp.get("message");
if (!status.equals("200")) {
throw new BadRequestException(message);
}
//下发acs
// Map<String,Object> resp = wmsToAcsService.orderStatusUpdate(array);
// return RestBusinessTemplate.execute(() -> resp);
return RestBusinessTemplate.execute(() -> new JSONObject());
}
/**
* 报工操作
*
* @author gbx
* @since 2023/4/7
*/
@Override
public void saveReport(JSONObject param) {
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
public CommonResult<Map<String,Object>> saveReport(JSONObject param) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
String report_qty = param.getString("report_qty");
String workorder_id = param.getString("workorder_id");
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
//1.更新工单表报工数量
wo.update(MapOf.of("workorder_status", WorkerOrderEnum.STOP.getCode(), "real_qty", report_qty, "update_id", currentUserId, "update_name", nickName), "workorder_id = '" + workorder_id + "'");
//下发acs暂时
//2.下发acs更新暂停状态
JSONArray arr = new JSONArray();
arr.add(MapOf.of("workorder_id", workorder_id, "status", WorkerOrderEnum.STOP.getCode()));
wmsToAcsService.orderStatusUpdate(arr);
// Map<String,Object> resp = wmsToAcsService.orderStatusUpdate(arr);
//return RestBusinessTemplate.execute(() -> resp);
return RestBusinessTemplate.execute(() -> new JSONObject());
}
/**
* 完工操作
* 设备状态枚举1-关机、2-开机、3-生产中、4-待机、5-故障
*
* @author gbx
* @since 2023/4/7
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void finish(JSONObject param) {
public CommonResult<Map<String,Object>> finish(JSONObject param) {
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
//选中的工单信息
JSONObject row = param.getJSONObject("row");
//强制完成时修改工单状态
String produceorder_id = row.getString("produceorder_id");
WQLObject wo = WQLObject.getWQLObject("MPS_BD_ProduceShiftOrder");
ProduceshiftorderDto produceshiftorderDto = this.findById(Long.parseLong(produceorder_id));
JSONObject produceorderMap = new JSONObject();
produceorderMap.put("produceorder_id", produceorder_id);
produceorderMap.put("order_status", "04");
produceorderMap.put("update_optid", currentUserId);
produceorderMap.put("device_id", null);
produceorderMap.put("update_optname", nickName);
produceorderMap.put("update_time", DateUtil.now());
produceorderMap.put("realproduceend_date", DateUtil.now());
wo.update(produceorderMap);
JSONObject jsonObject = wo.query("produceorder_id = '" + produceorder_id + "'").uniqueResult(0);
//1.强制完成时修改工单状态
String workorder_id = row.getString("workorder_id");
WQLObject wo = WQLObject.getWQLObject("pdm_produce_workorder");
JSONObject map = new JSONObject();
map.put("produceorder_id", workorder_id);
map.put("workorder_status", "4");
map.put("current_device_code", null);
map.put("update_id", currentUserId);
map.put("update_name", nickName);
map.put("update_time", DateUtil.now());
map.put("realproduceend_date", DateUtil.now());
wo.update(map, "workorder_id = '" + workorder_id + "'");
//2.设置实际数量
JSONObject jsonObject = wo.query("workorder_id = '" + workorder_id + "'").uniqueResult(0);
String real_qty = jsonObject.getString("real_qty");
if(StrUtil.isEmpty(real_qty)) {
real_qty = "0";
}
//同时修改工单记录表中的期末数量及完成数量
WQLObject wo_record = WQLObject.getWQLObject("MPS_BD_MacOperateRecord");
JSONObject result = wo_record.query("produceorder_id = '" + produceorder_id + "' and (operatetime_end = '' or operatetime_end is null) ").uniqueResult(0);
//3.修改工单记录表中的期末数量及完成数量
WQLObject wo_record = WQLObject.getWQLObject("pdm_produce_workorderrecord");
JSONObject result = wo_record.query("workorder_id = '" + workorder_id + "' and (operatetime_end = '' or operatetime_end is null) ").uniqueResult(0);
if(ObjectUtil.isNotEmpty(result)) {
result.put("finish_qty", real_qty);
result.put("finishproduct_qty", real_qty);
result.put("dq_finish_qty", real_qty);
result.put("person_finish_qty", real_qty);
result.put("operatetime_end", DateUtil.now());
wo_record.update(result);
}
//工单开工以后需要向acs强制完成 wms向acs发送请求 工单强制完成
// TODO
String order_status = produceshiftorderDto.getOrder_status();
if (!order_status.equals("00") && !order_status.equals("01")) {
//4.工单开工以后需要向acs强制完成,wms向acs发送请求,工单强制完成
String workorder_status = jsonObject.getString("workorder_status");
if(!workorder_status.equals("0") && !workorder_status.equals("1")) {
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("ext_order_id", produceorder_id);
map.put("type", "3");
array.add(map);
wmsToAcsService.orderStatusUpdate(array);
JSONObject acs = new JSONObject();
acs.put("ext_order_id", workorder_id);
acs.put("type", "3");
array.add(acs);
//Map<String,Object> resp = wmsToAcsService.orderStatusUpdate(array);
// return RestBusinessTemplate.execute(() -> resp);
return RestBusinessTemplate.execute(() -> new JSONObject());
}
return RestBusinessTemplate.execute(() -> new JSONObject());
}
@Override
@@ -370,12 +453,12 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
}
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
// 1.获取上传文件输入流
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (Exception e) {
}
catch(Exception e) {
e.printStackTrace();
}
//工单表
@@ -388,7 +471,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
WQLObject wo_workprocedure = WQLObject.getWQLObject("pdm_bi_workprocedure");
//人员表
//WQLObject wo_user = WQLObject.getWQLObject("sys_user");
// 调用用 hutool 方法读取数据 调用第一个sheet白班数据
ExcelReader excelReader = ExcelUtil.getReader(inputStream, 0);
// 从第1行开始获取数据 excelReader.read的结果是一个2纬的list外层是行内层是行对应的所有列
@@ -416,7 +498,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
//循环每一行
col:
for(int j = 0; j < list.size(); j++) {
String col = String.valueOf(list.get(j));
//如果是第一行 为生产日期
if(i == 0 && j == 0) {
@@ -437,7 +518,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(ObjectUtil.isEmpty(json_material)) {
is_error = "1";
error_message = error_message + "物料规格对应物料信息不存在,";
}else {
}
else{
param.put("material_id", json_material.getString("material_id"));
}
}
@@ -450,7 +532,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(ObjectUtil.isEmpty(idByName)) {
is_error = "1";
error_message = error_message + "工序名称是否正确,";
}else {
}
else{
param.put("workprocedure_id", idByName.getId());
}
}
@@ -462,7 +545,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(StrUtil.isEmpty(col)) {
is_error = "1";
error_message = error_message + "工单计划数量为空,";
}else {
}
else{
param.put("plan_qty", col);
}
}
@@ -476,7 +560,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(!workprocedure_id.equals(json_device.getString("workprocedure_id"))) {
is_error = "1";
error_message = error_message + "设备与所属工序不匹配,";
}else {
}
else{
param.put("device_id", json_device.getString("device_id"));
}
}
@@ -485,7 +570,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(ObjectUtil.isEmpty(jsonUser)) {
is_error = "1";
error_message = error_message + "生产人员编码不存在!";
}else {
}
else{
param.put("jockey_id", jsonUser.getUserId());
}
}
@@ -515,12 +601,12 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
param.put("create_time", DateUtil.now());
wo_order.insert(param);
}
// 1.获取上传文件输入流
inputStream = null;
try {
inputStream = file.getInputStream();
} catch (Exception e) {
}
catch(Exception e) {
e.printStackTrace();
}
//读取夜班工单数据
@@ -545,7 +631,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
//循环每一行
col:
for(int j = 0; j < list.size(); j++) {
String col = String.valueOf(list.get(j));
//如果是第一行 为生产日期
if(i == 0 && j == 0) {
@@ -566,7 +651,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(ObjectUtil.isEmpty(json_material)) {
is_error = "1";
error_message = error_message + "物料规格对应物料信息不存在,";
}else {
}
else{
param.put("material_id", json_material.getString("material_id"));
}
}
@@ -579,7 +665,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(ObjectUtil.isEmpty(idByName)) {
is_error = "1";
error_message = error_message + "工序名称是否正确,";
}else {
}
else{
param.put("workprocedure_id", idByName.getId());
}
}
@@ -591,7 +678,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(StrUtil.isEmpty(col)) {
is_error = "1";
error_message = error_message + "工单计划数量为空,";
}else {
}
else{
param.put("plan_qty", col);
}
}
@@ -613,7 +701,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(!workprocedure_id.equals(json_device.getString("workprocedure_id"))) {
is_error = "1";
error_message = error_message + "设备与所属工序不匹配,";
}else {
}
else{
param.put("device_id", json_device.getString("device_id"));
}
}
@@ -622,7 +711,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
if(ObjectUtil.isEmpty(jsonUser)) {
is_error = "1";
error_message = error_message + "生产人员编码不存在!";
}else {
}
else{
param.put("jockey_id", jsonUser.getUserId());
}
}
@@ -653,7 +743,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
param.put("create_time", DateUtil.now());
wo_order.insert(param);
}
}
@Override
@@ -677,7 +766,8 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
}
}
param.put("device_ids", sb.toString());
} else {
}
else{
param.put("device_ids", "('-1')");
}
param.put("flag", "7");
@@ -694,7 +784,6 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
String device_code = param.getString("device_code");
String currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getCurrentNickName();
ProduceshiftorderDto produceshiftorderDto = this.findByCode(produceorder_code);
produceshiftorderDto.setDevice_id(Long.parseLong(device_id));
produceshiftorderDto.setUpdate_id(currentUserId);
@@ -721,5 +810,4 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService {
public List<SysUser> getUser() {
return userService.list(new QueryWrapper<SysUser>().select("user_id,person_name"));
}
}

View File

@@ -0,0 +1,126 @@
[交易说明]
交易名: pda手持服务查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.device_code TYPEAS s_string
输入.key_value TYPEAS s_string
输入.realproducestart_date TYPEAS s_string
输入.realproduceend_date TYPEAS s_string
输入.flag TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
QUERY
SELECT
s.label device_status_name,
r.status_type device_status,
d.device_code,
d.device_name,
d.device_icon,
d.workorder_code
FROM
pdm_bi_device d
LEFT JOIN (
SELECT
device_code,
status_type,
max( order_num ) AS num
FROM
( SELECT order_num, device_code, status_type FROM pdm_bi_devicerunstatusrecord ORDER BY device_code, order_num DESC ) c
GROUP BY
c.device_code
) r ON d.device_code = r.device_code
LEFT JOIN sys_dict s ON s.`value` = r.status_type
AND s.`code` = 'PDM_BI_DEVICERUNSTATUS'
ORDER BY
device_code
LIMIT 10
ENDSELECT
ENDQUERY
ENDIF
IF 输入.flag = "2"
PAGEQUERY
SELECT
dict1.label shift_type_scode_name,
dict2.label order_status_name,
mater.material_name,
workorder.shift_type_scode,
workprocedure.workprocedure_name,
workorder.workorder_status order_status,
workorder.workorder_id,
workorder.workorder_code,
workorder.current_device_code device_code,
workorder.material_id,
workorder.workprocedure_id,
workorder.plan_qty,
workorder.real_qty,
workorder.report_qty,
workorder.realproducestart_date,
workorder.realproduceend_date
FROM
pdm_produce_workorder workorder
LEFT JOIN md_me_materialbase mater ON workorder.material_id = mater.material_id
LEFT JOIN pdm_bi_workprocedure workprocedure ON workorder.workprocedure_id = workprocedure.workprocedure_id
LEFT JOIN sys_dict dict1 ON dict1.`value` = workorder.shift_type_scode
AND dict1.`code` = 'PDM_BI_SHIFTTYPE'
LEFT JOIN sys_dict dict2 ON dict2.`value` = workorder.workorder_status
AND dict2.`code` = 'MPS_BD_ORDERSTATUS'
WHERE
workorder.is_delete = '0'
OPTION 输入.device_code <> ""
(workorder.current_device_code like CONCAT ('%', 输入.device_code, '%'))
ENDOPTION
OPTION 输入.key_value <> ""
(
(workorder.workorder_code like CONCAT ('%', 输入.key_value, '%')) or
(mater.material_name like CONCAT ('%', 输入.key_value, '%')) or
(mater.material_code like CONCAT ('%', 输入.key_value, '%'))
)
ENDOPTION
OPTION 输入.realproducestart_date <> ""
workorder.realproducestart_date >= 输入.realproducestart_date
ENDOPTION
OPTION 输入.realproduceend_date <> ""
workorder.realproduceend_date <= 输入.realproduceend_date
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -163,8 +163,8 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
map.put("product_area", whereJson.getString("product_area"));
}
//任务类型
if(StrUtil.isNotEmpty(whereJson.getString("task_type"))) {
map.put("task_type", whereJson.getString("task_type"));
if(StrUtil.isNotEmpty(whereJson.getString("code"))) {
map.put("task_type", whereJson.getString("code"));
}
if(StrUtil.isNotEmpty(task_status)) {
task_status = task_status.replace("[\"", "").replace("\"]", "").replace("\"", "");

View File

@@ -82,7 +82,7 @@ public class TaskController {
.eq(Dict::getCode, "task_status")), HttpStatus.OK);
}
@GetMapping("/taskType")
@PostMapping("/taskType")
@Log("获取任务类型列表")
@ApiOperation("获取任务类型列表")
public ResponseEntity<Object> getTaskType() {