汪菘 3 years ago
parent
commit
9a50a38495
  1. 4
      nladmin-system/src/main/java/org/nl/acs/config/AcsConfig.java
  2. 87
      nladmin-system/src/main/java/org/nl/acs/order/rest/LabelingTemplateController.java
  3. 6
      nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java
  4. 82
      nladmin-system/src/main/java/org/nl/acs/order/service/LabelingTemplateService.java
  5. 8
      nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java
  6. 46
      nladmin-system/src/main/java/org/nl/acs/order/service/dto/LabelingTemplateDto.java
  7. 156
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/LabelingTemplateServiceImpl.java
  8. 51
      nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java
  9. 21
      nladmin-system/src/main/java/org/nl/acs/order/service/wql/QPRODUCESHIFTORDER.wql

4
nladmin-system/src/main/java/org/nl/acs/config/AcsConfig.java

@ -22,6 +22,10 @@ public interface AcsConfig {
String WMSURL = "wmsurl"; String WMSURL = "wmsurl";
//WCS系统接口地址 //WCS系统接口地址
String WCSURL = "wcsurl"; String WCSURL = "wcsurl";
//打印机名称
String PRINTNAME = "printName";
//打印机地址
String PRINTURL = "printurl";
String HASOTHERSYSTEM = "hasOtherSystem"; String HASOTHERSYSTEM = "hasOtherSystem";

87
nladmin-system/src/main/java/org/nl/acs/order/rest/LabelingTemplateController.java

@ -0,0 +1,87 @@
package org.nl.acs.order.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.order.service.LabelingTemplateService;
import org.nl.acs.order.service.dto.LabelingTemplateDto;
import org.nl.annotation.Log;
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 javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.Map;
/**
* @author loujf
* @date 2022-06-01
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "贴标模板管理")
@RequestMapping("/api/labelingTemplate")
@Slf4j
public class LabelingTemplateController {
private final LabelingTemplateService labelingTemplateService;
@GetMapping
@Log("查询贴标模板")
@ApiOperation("查询贴标模板")
//@PreAuthorize("@el.check('labelingTemplate:list')")
public ResponseEntity<Object> query(@RequestParam Map whereJson, Pageable page){
return new ResponseEntity<>(labelingTemplateService.queryAll(whereJson,page),HttpStatus.OK);
}
@PostMapping
@Log("新增贴标模板")
@ApiOperation("新增贴标模板")
//@PreAuthorize("@el.check('labelingTemplate:add')")
public ResponseEntity<Object> create(@Validated @RequestBody LabelingTemplateDto dto){
labelingTemplateService.create(dto);
return new ResponseEntity<>(HttpStatus.CREATED);
}
@PutMapping
@Log("修改贴标模板")
@ApiOperation("修改贴标模板")
//@PreAuthorize("@el.check('labelingTemplate:edit')")
public ResponseEntity<Object> update(@Validated @RequestBody LabelingTemplateDto dto){
labelingTemplateService.update(dto);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
@Log("删除贴标模板")
@ApiOperation("删除贴标模板")
//@PreAuthorize("@el.check('labelingTemplate:del')")
@DeleteMapping
public ResponseEntity<Object> delete(@RequestBody String[] ids) {
labelingTemplateService.deleteAll(ids);
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("导出贴标模板")
@ApiOperation("导出贴标模板")
@GetMapping(value = "/download")
//@PreAuthorize("@el.check('labelingTemplate:list')")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {
labelingTemplateService.download(labelingTemplateService.queryAll(whereJson), response);
}
@PutMapping("/enabled")
@Log("启用禁用路由路线")
@ApiOperation("启用禁用路由路线")
//@PreAuthorize("@el.check('routeLine:edit')")
public ResponseEntity<Object> enabled(@Validated @RequestBody LabelingTemplateDto dto) throws SQLException {
labelingTemplateService.enabled(dto.getTemplate_id(), dto.getIs_used());
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
}

6
nladmin-system/src/main/java/org/nl/acs/order/rest/ProduceshiftorderController.java

@ -172,6 +172,12 @@ public class ProduceshiftorderController {
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);
} }
@Log("查询贴标模板下拉列表")
@ApiOperation("查询贴标模板下拉列表")
@GetMapping("/selectTemplateList")
public ResponseEntity<Object> selectTemplateList() {
return new ResponseEntity<>(produceshiftorderService.selectTemplateList(),HttpStatus.OK);
}

82
nladmin-system/src/main/java/org/nl/acs/order/service/LabelingTemplateService.java

@ -0,0 +1,82 @@
package org.nl.acs.order.service;
import org.nl.acs.order.service.dto.LabelingTemplateDto;
import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
* @description 服务接口
* @author loujf
* @date 2022-06-01
**/
public interface LabelingTemplateService {
/**
* 查询数据分页
* @param whereJson 条件
* @param page 分页参数
* @return Map<String,Object>
*/
Map<String,Object> queryAll(Map whereJson, Pageable page);
/**
* 查询所有数据不分页
* @param whereJson 条件参数
* @return List<LabelingTemplateDto>
*/
List<LabelingTemplateDto> queryAll(Map whereJson);
/**
* 根据ID查询
* @param template_id ID
* @return LabelingTemplate
*/
LabelingTemplateDto findById(String template_id);
/**
* 根据编码查询
* @param code code
* @return LabelingTemplate
*/
LabelingTemplateDto findByCode(String code);
/**
* 创建
* @param dto /
*/
void create(LabelingTemplateDto dto);
/**
* 编辑
* @param dto /
*/
void update(LabelingTemplateDto dto);
/**
* 多选删除
* @param ids /
*/
void deleteAll(String[] ids);
/**
* 导出数据
* @param dtos 待导出的数据
* @param response /
* @throws IOException /
*/
void download(List<LabelingTemplateDto> dtos, HttpServletResponse response) throws IOException;
/**
* 启用或停用
*
* @param is_used 1 启用0 禁用
*/
void enabled(String template_id, String is_used) throws SQLException;
}

8
nladmin-system/src/main/java/org/nl/acs/order/service/ProduceshiftorderService.java

@ -3,7 +3,6 @@ package org.nl.acs.order.service;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import org.nl.acs.order.service.dto.ProduceshiftorderDto; import org.nl.acs.order.service.dto.ProduceshiftorderDto;
import org.nl.acs.order.service.dto.ProduceshiftorderdetailDto;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -209,4 +208,11 @@ public interface ProduceshiftorderService {
List<ProduceshiftorderDto> findOrderByOrderStatusFromCache(String order_status); List<ProduceshiftorderDto> findOrderByOrderStatusFromCache(String order_status);
/**
* 贴标模板下拉选列表
*
* @return
*/
JSONArray selectTemplateList();
} }

46
nladmin-system/src/main/java/org/nl/acs/order/service/dto/LabelingTemplateDto.java

@ -0,0 +1,46 @@
package org.nl.acs.order.service.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @description /
* @author loujf
* @date 2022-06-01
**/
@Data
public class LabelingTemplateDto implements Serializable {
/** 模板标识 */
private String template_id;
/** 模板编码 */
private String template_code;
/** 模板名称 */
private String template_name;
/** 模板地址 */
private String template_address;
/** 创建者 */
private String create_by;
/** 创建时间 */
private String create_time;
/** 修改者 */
private String update_by;
/** 修改时间 */
private String update_time;
/** 启用时间 */
private String is_used_time;
/** 是否启用 1-启用 0-禁用 */
private String is_used;
/** 是否删除 */
private String is_delete;
}

156
nladmin-system/src/main/java/org/nl/acs/order/service/impl/LabelingTemplateServiceImpl.java

@ -0,0 +1,156 @@
package org.nl.acs.order.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.order.service.LabelingTemplateService;
import org.nl.acs.order.service.dto.LabelingTemplateDto;
import org.nl.exception.BadRequestException;
import org.nl.utils.FileUtil;
import org.nl.utils.SecurityUtils;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.util.WqlUtil;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.util.*;
/**
* @description 服务实现
* @author loujf
* @date 2022-06-01
**/
@Service
@RequiredArgsConstructor
@Slf4j
public class LabelingTemplateServiceImpl implements LabelingTemplateService {
@Override
public Map<String,Object> queryAll(Map whereJson, Pageable page){
HashMap<String, String> map = new HashMap<>();
map.put("flag", "2");
String template_code = (String) whereJson.get("template_code");
String template_address = (String) whereJson.get("template_address");
if (!StrUtil.isEmpty(template_code)) {
map.put("template_code", template_code);
}
if (!StrUtil.isEmpty(template_address)) {
map.put("template_address", template_address);
}
JSONObject jo = WQL.getWO("QPRODUCESHIFTORDER").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "update_time desc");
return jo;
}
@Override
public List<LabelingTemplateDto> queryAll(Map whereJson){
WQLObject wo = WQLObject.getWQLObject("acs_labeling_template");
JSONArray arr = wo.query().getResultJSONArray(0);
List<LabelingTemplateDto> list = arr.toJavaList(LabelingTemplateDto.class);
return list;
}
@Override
public LabelingTemplateDto findById(String template_id) {
WQLObject wo = WQLObject.getWQLObject("acs_labeling_template");
JSONObject json = wo.query("template_id ='" + template_id + "'").uniqueResult(0);
final LabelingTemplateDto obj = (LabelingTemplateDto) JSONObject.toJavaObject(json, LabelingTemplateDto.class);
return obj;
}
@Override
public LabelingTemplateDto findByCode(String code) {
WQLObject wo = WQLObject.getWQLObject("acs_labeling_template");
JSONObject json = wo.query("template_code ='" + code + "'").uniqueResult(0);
final LabelingTemplateDto obj = (LabelingTemplateDto) JSONObject.toJavaObject(json, LabelingTemplateDto.class);
return obj;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void create(LabelingTemplateDto dto) {
String template_code = dto.getTemplate_code();
LabelingTemplateDto templateDto = this.findByCode(template_code);
if (templateDto != null && templateDto.getIs_delete().equals("0")) {
throw new BadRequestException("存在相同的设备编码");
}
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setTemplate_id(IdUtil.simpleUUID());
dto.setCreate_by(currentUsername);
dto.setUpdate_by(currentUsername);
dto.setUpdate_time(now);
dto.setCreate_time(now);
dto.setIs_used("1");
WQLObject wo = WQLObject.getWQLObject("acs_labeling_template");
JSONObject json= (JSONObject) JSONObject.toJSON(dto);
wo.insert(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(LabelingTemplateDto dto) {
LabelingTemplateDto entity = this.findById(dto.getTemplate_id());
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
String currentUsername = SecurityUtils.getCurrentUsername();
String now = DateUtil.now();
dto.setUpdate_time(now);
dto.setUpdate_by(currentUsername);
WQLObject wo = WQLObject.getWQLObject("acs_labeling_template");
JSONObject json= (JSONObject) JSONObject.toJSON(dto);
wo.update(json);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(String[] ids) {
WQLObject wo = WQLObject.getWQLObject("acs_labeling_template");
for (String template_id: ids) {
wo.delete("template_id = '" + template_id + "'");
}
}
@Override
public void download(List<LabelingTemplateDto> all, HttpServletResponse response) throws IOException {
List<Map<String, Object>> list = new ArrayList<>();
for (LabelingTemplateDto labelingTemplate : all) {
Map<String,Object> map = new LinkedHashMap<>();
map.put("模板编码", labelingTemplate.getTemplate_code());
map.put("模板名称 ", labelingTemplate.getTemplate_name());
map.put("模板地址", labelingTemplate.getTemplate_address());
map.put("创建者", labelingTemplate.getCreate_by());
map.put("创建时间", labelingTemplate.getCreate_time());
map.put("修改者", labelingTemplate.getUpdate_by());
map.put("修改时间", labelingTemplate.getUpdate_time());
map.put("启用时间", labelingTemplate.getIs_used_time());
map.put("是否启用", labelingTemplate.getIs_used());
map.put("是否删除", labelingTemplate.getIs_delete());
list.add(map);
}
FileUtil.downloadExcel(list, response);
}
@Override
public void enabled(String template_id, String is_used) throws SQLException {
//贴标精度表
WQLObject.getWQLObject("acs_labeling_template");
LabelingTemplateDto dto = this.findById(template_id);
dto.setIs_used(is_used);
this.update(dto);
}
}

51
nladmin-system/src/main/java/org/nl/acs/order/service/impl/ProduceshiftorderServiceImpl.java

@ -668,29 +668,38 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
for (int i = 0; i < listMap.size(); i++) { for (int i = 0; i < listMap.size(); i++) {
Map<String, Object> map = listMap.get(i); Map<String, Object> map = listMap.get(i);
String order_code = String.valueOf(map.get(0)); String material_code = String.valueOf(map.get(0));
String order_status = String.valueOf(map.get(1)); String material_name = String.valueOf(map.get(1));
String material_code = String.valueOf(map.get(2)); String material_spec = String.valueOf(map.get(2));
String material_name = String.valueOf(map.get(3)); String outer_diameter = String.valueOf(map.get(3));
String outer_diameter = String.valueOf(map.get(4)); String wall_thickness = String.valueOf(map.get(4));
String wall_thickness = String.valueOf(map.get(5)); String length = String.valueOf(map.get(5));
String length = String.valueOf(map.get(6)); String qty = String.valueOf(map.get(6));
String qty = String.valueOf(map.get(7));
//月生产计划接口处理表数据
ProduceshiftorderDto dto = new ProduceshiftorderDto(); ProduceshiftorderDto dto = new ProduceshiftorderDto();
dto.setOrder_id(IdUtil.simpleUUID()); dto.setOrder_id(IdUtil.simpleUUID());
dto.setOrder_code(order_code);
dto.setOrder_status(order_status);
dto.setMaterial_uuid(IdUtil.simpleUUID()); dto.setMaterial_uuid(IdUtil.simpleUUID());
dto.setOrder_code("022");
dto.setMaterial_code(material_code); dto.setMaterial_code(material_code);
dto.setMaterial_name(material_name); dto.setMaterial_name(material_name);
dto.setMaterial_spec(material_spec);
dto.setOuter_diameter(outer_diameter); dto.setOuter_diameter(outer_diameter);
dto.setWall_thickness(wall_thickness); dto.setWall_thickness(wall_thickness);
dto.setQty(qty); dto.setQty(qty);
dto.setLength(length); dto.setLength(length);
orderTab.insert(JSONObject.parseObject(JSON.toJSONString(dto))); orderTab.insert(JSONObject.parseObject(JSON.toJSONString(dto)));
// Map<String, Object> map2 = new HashMap<>();
// map2.put("material_id",IdUtil.simpleUUID());
// map2.put("material_code",material_code);
// map2.put("material_name",material_name);
// map2.put("material_spec",material_spec);
// map2.put("outer_diameter",outer_diameter);
// map2.put("wall_thickness",wall_thickness);
// map2.put("length",length);
// map2.put("qty",qty);
//
// create(map2);
} }
} }
@ -814,4 +823,20 @@ public class ProduceshiftorderServiceImpl implements ProduceshiftorderService, A
return json; return json;
} }
@Override
public JSONArray selectTemplateList() {
//贴标模板表【acs_labeling_template】
JSONArray arr = WQLObject.getWQLObject("acs_labeling_template").query("is_delete= '0' AND is_used= '1'","template_code asc").getResultJSONArray(0);
JSONArray result = new JSONArray();
for (int i = 0; i < arr.size(); i++) {
JSONObject obj = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("template_id", obj.getString("template_id"));
json.put("template_code", obj.getString("template_code"));
json.put("template_name", obj.getString("template_name"));
result.add(json);
}
return result;
}
} }

21
nladmin-system/src/main/java/org/nl/acs/order/service/wql/QPRODUCESHIFTORDER.wql

@ -14,7 +14,8 @@
## 表字段对应输入参数 ## 表字段对应输入参数
################################################# #################################################
输入.flag TYPEAS s_string 输入.flag TYPEAS s_string
输入.template_code TYPEAS s_string
输入.template_address TYPEAS s_string
[临时表] [临时表]
--这边列出来的临时表就会在运行期动态创建 --这边列出来的临时表就会在运行期动态创建
@ -49,4 +50,22 @@
ENDQUERY ENDQUERY
ENDIF ENDIF
IF 输入.flag = "2"
PAGEQUERY
SELECT
*
FROM
acs_labeling_template template
WHERE
1=1
OPTION 输入.template_code <> ""
template.template_code = 输入.template_code
ENDOPTION
OPTION 输入.template_address <> ""
template.template_address = 输入.template_address
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF

Loading…
Cancel
Save