add:新增PC袋标签新增打印按钮

This commit is contained in:
2023-04-26 08:46:13 +08:00
parent 0112e723c7
commit f08a7c6273
6 changed files with 273 additions and 2 deletions

View File

@@ -2,6 +2,7 @@
package org.nl.wms.basedata.master.rest;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata.master.service.BagrecordService;
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
import org.springframework.data.domain.Pageable;
@@ -68,6 +69,13 @@ public class BagrecordController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("PC组袋")
@ApiOperation("PC组袋")
@PostMapping("/groupBag")
public ResponseEntity<Object> groupBag(@RequestBody JSONObject json) {
return new ResponseEntity<>(bagrecordService.groupBag(json),HttpStatus.OK);
}
@ApiOperation("导出数据")
@GetMapping(value = "/download")
public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException {

View File

@@ -1,6 +1,7 @@
package org.nl.wms.basedata.master.service;
import com.alibaba.fastjson.JSONObject;
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
import org.springframework.data.domain.Pageable;
@@ -78,4 +79,9 @@ public interface BagrecordService {
*/
void download(Map whereJson, HttpServletResponse response) throws IOException;
/**
* PC组袋
*
*/
JSONObject groupBag(JSONObject json);
}

View File

@@ -7,7 +7,10 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import lombok.RequiredArgsConstructor;
import org.nl.exception.BadRequestException;
import org.nl.pda.st.set.service.PdaBagService;
import org.nl.pda.st.set.service.impl.PdaBagServiceImpl;
import org.nl.utils.FileUtil;
import org.nl.utils.SpringContextHolder;
import org.nl.wms.basedata.master.service.BagrecordService;
import org.nl.wms.basedata.master.service.dto.BagrecordDto;
import org.nl.wql.WQL;
@@ -189,4 +192,38 @@ public class BagrecordServiceImpl implements BagrecordService {
FileUtil.downloadExcel(list, response);
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject groupBag(JSONObject json) {
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase");
HashMap<String, String> map = new HashMap<>();
map.put("material_code", json.getString("material_code"));
map.put("pcsn", json.getString("pcsn"));
map.put("return_person", json.getString("return_person"));
map.put("storage_qty", json.getString("storage_qty"));
map.put("waste_type", json.getString("waste_type"));
map.put("bag_num", json.getString("bag_num"));
// 组织数据调用pda组盘接口
JSONObject jsonMater = materTab.query("material_code = '" + json.getString("material_code") + "'").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonMater)) throw new BadRequestException("物料不存在!");
map.put("material_id",jsonMater.getString("material_id"));
PdaBagService pdaBagService = SpringContextHolder.getBean(PdaBagService.class);
Map<String, Object> result = pdaBagService.groupBag(map);
// 判断是否报错
if (!StrUtil.equals(result.get("code").toString(), "1")) {
throw new BadRequestException(result.get("desc").toString());
}
String string = result.get("result").toString();
JSONArray.parseArray(string);
JSONObject resultParam = new JSONObject();
resultParam.put("data", JSONArray.parseArray(string));
return resultParam;
}
}