This commit is contained in:
zds
2022-12-23 11:49:12 +08:00
parent 17bf4dbfeb
commit ccb73eac94
16 changed files with 771 additions and 10 deletions

View File

@@ -0,0 +1,58 @@
package org.nl.pda.st.out.rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.annotation.Log;
import org.nl.pda.st.out.service.HandPFOutIvtService;
import org.nl.pda.st.out.service.HandXCOutIvtService;
import org.nl.wql.core.content.HttpContext;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
/**
* @author ldjun
* @date 2021-07-26
**/
@RestController
@RequiredArgsConstructor
@Api(tags = "手持配粉出库")
@RequestMapping("api/pda/st/out/xcout")
@Slf4j
public class HandXCOutIvtController {
private final HandXCOutIvtService handXCOutIvtService;
@PostMapping("/queryWorkorder")
@Log("获取工令")
@ApiOperation("获取工令")
public ResponseEntity<Object> queryWorkorder(@RequestBody Map whereJson) {
HttpContext ctx = new HttpContext("11");
ctx.setPage((String)(whereJson.get("page")));
ctx.setRows((String)(whereJson.get("size")));
return new ResponseEntity<>(handXCOutIvtService.getBillDtl(whereJson,ctx),HttpStatus.OK);
}
@PostMapping("/confirmoutstore")
@Log("确认发货")
@ApiOperation("确认发货")
public ResponseEntity<Object> confirmOutStore(@RequestBody Map whereJson) {
return new ResponseEntity<>(handXCOutIvtService.confirmOutStore(whereJson), HttpStatus.OK);
}
@PostMapping("/queryStoragevehicle")
@Log("手持根据托盘查询单据")
@ApiOperation("手持根据托盘查询单据")
public ResponseEntity<Object> queryStoragevehicle(@RequestBody Map<String, String> whereJson) {
return new ResponseEntity<>(handXCOutIvtService.queryStoragevehicle(whereJson), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,31 @@
package org.nl.pda.st.out.service;
import org.nl.wql.core.content.HttpContext;
import java.util.Map;
public interface HandXCOutIvtService {
/**
* 查询收货明细
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> getBillDtl(Map<String, String> jsonObject, HttpContext ctx);
/**
*
* @param jsonObject
* @return
*/
Map<String, Object> queryStoragevehicle(Map<String, String> jsonObject);
/**
* 出库确认
*
* @param jsonObject 条件
* @return Map<String, Object>
*/
Map<String, Object> confirmOutStore(Map jsonObject);
}

View File

@@ -0,0 +1,152 @@
package org.nl.pda.st.out.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
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.modules.system.service.UserService;
import org.nl.modules.system.service.dto.UserDto;
import org.nl.modules.system.util.CodeUtil;
import org.nl.pda.exception.PdaRequestException;
import org.nl.pda.st.out.service.HandXCOutIvtService;
import org.nl.utils.SecurityUtils;
import org.nl.wms.basedata.master.constant.MaterOptTypeEnum;
import org.nl.wms.basedata.master.service.MaterialbaseService;
import org.nl.wms.st.core.service.StorPublicService;
import org.nl.wql.WQL;
import org.nl.wql.core.bean.WQLObject;
import org.nl.wql.core.content.HttpContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.TimeUnit;
@Service
@RequiredArgsConstructor
@Slf4j
public class HandXCOutIvtServiceImpl implements HandXCOutIvtService {
private final StorPublicService storPublicService;
private final MaterialbaseService materialbaseService;
private final UserService userService;
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> getBillDtl(Map<String, String> jsonObject, HttpContext ctx) {
HashMap<String, String> map = new HashMap<>();
map.put("flag", "1");
JSONObject jo = WQL.getWO("QPADST_OUT_SERVICE2").addParamMap(map).pageQuery(ctx, "workorder.send_date,mb.material_code");
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("desc", "查询成功!");
returnjo.put("rows", jo.getJSONArray("content"));
returnjo.put("size", jo.getJSONArray("content").size());
return returnjo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Map<String, Object> queryStoragevehicle(Map<String, String> jsonObject) {
JSONObject returnjo = new JSONObject();
String storagevehicle_code = jsonObject.get("storagevehicle_code");
String workorder_code = jsonObject.get("workorder_code");
if (StrUtil.isEmpty(storagevehicle_code)) {
throw new PdaRequestException("载具不能为空!");
}
if (StrUtil.isEmpty(workorder_code)) {
throw new PdaRequestException("工令不能为空!");
}
// 仓位属性表【ST_IVT_StructAttr】
WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
WQLObject pdm_bi_workorder = WQLObject.getWQLObject("pdm_bi_workorder");
JSONObject jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0);
if(jo==null){
throw new PdaRequestException("该载具"+storagevehicle_code+"无组盘记录!");
}
String is_send = jo.getString("is_send");
if("1".equals(is_send)){
throw new PdaRequestException("该载具"+storagevehicle_code+"已发货,不允许再次发货!");
}
String workorder_id = jo.getString("workorder_id");
JSONObject wo = pdm_bi_workorder.query("workorder_id='"+workorder_id+"'").uniqueResult(0);
String workorder_code2 = wo.getString("workorder_code");
if(workorder_code2.equals(workorder_code)){
throw new PdaRequestException("该载具"+storagevehicle_code+"组盘工令与所选工令不一致!");
}
//3、 通过托盘,查询【桶记录表】状态=入库,得到载具桶库存信息,无结果提示错误;
JSONArray bucketrow = WQL.getWO("QPADST_OUT_SERVICE2").addParam("flag", "2").addParam("storagevehicle_code", storagevehicle_code).process().getResultJSONArray(0);
returnjo.put("code", "1");
returnjo.put("desc", "查询成功");
returnjo.put("content", bucketrow);
return returnjo;
}
@Transactional(rollbackFor = Exception.class)
@Override
public Map<String, Object> confirmOutStore(Map jsonObject) {
Long currentUserId = SecurityUtils.getCurrentUserId();
UserDto userDto = userService.findById(currentUserId);
String storagevehicle_code = (String) jsonObject.get("storagevehicle_code");
String workorder_code = (String) jsonObject.get("workorder_code");
if (StrUtil.isEmpty(storagevehicle_code)) {
throw new PdaRequestException("载具不能为空!");
}
if (StrUtil.isEmpty(workorder_code)) {
throw new PdaRequestException("工令不能为空!");
}
// 仓位属性表【ST_IVT_StructAttr】
WQLObject PDM_BI_ProcedureOffline = WQLObject.getWQLObject("PDM_BI_ProcedureOffline");
WQLObject pdm_bi_workorder = WQLObject.getWQLObject("pdm_bi_workorder");
JSONObject jo = PDM_BI_ProcedureOffline.query("storagevehicle_code='"+storagevehicle_code+"'").uniqueResult(0);
if(jo==null){
throw new PdaRequestException("该载具"+storagevehicle_code+"无组盘记录!");
}
String is_send = jo.getString("is_send");
if("1".equals(is_send)){
throw new PdaRequestException("该载具"+storagevehicle_code+"已发货,不允许再次发货!");
}
String workorder_id = jo.getString("workorder_id");
JSONObject wo = pdm_bi_workorder.query("workorder_id='"+workorder_id+"'").uniqueResult(0);
String workorder_code2 = wo.getString("workorder_code");
if(workorder_code2.equals(workorder_code)){
throw new PdaRequestException("该载具"+storagevehicle_code+"组盘工令与所选工令不一致!");
}
JSONArray dtls = (JSONArray) jsonObject.get("dtl");
Set set = new HashSet();
for(int i=0;i<dtls.size();i++){
JSONObject dtl = dtls.getJSONObject(i);
set.add(dtl.getString("material_id"));
}
if(set.size()>=2){
throw new PdaRequestException("发货物料存在多种物料,不允许发货!");
}
for(int i=0;i<dtls.size();i++){
JSONObject dtl = dtls.getJSONObject(i);
String diskrecord_id = dtl.getString("diskrecord_id");
HashMap<String,String> map = new HashMap<String,String>();
map.put("is_send","1");
map.put("send_id",currentUserId+"");
map.put("send_name",userDto.getNickName());
map.put("send_time",DateUtil.now());
PDM_BI_ProcedureOffline.update(map,"diskrecord_id='"+diskrecord_id+"'");
}
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("desc", "操作成功!");
return returnjo;
}
}

View File

@@ -0,0 +1,100 @@
[交易说明]
交易名: 库区分页查询
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.storagevehicle_code TYPEAS s_string
输入.bucketunique TYPEAS s_string
输入.material_id TYPEAS s_string
输入.height TYPEAS s_string
输入.material_type_id TYPEAS s_string
输入.bill_type TYPEAS s_string
输入.pcsn TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
mb.material_code,
mb.material_name,
workorder.workorder_code,
workorder.send_date,
workorder.pcsn,
workorder.workorder_qty,
productdeptpcsn.org_name
FROM
pdm_bi_workorder workorder
INNER JOIN md_me_materialbase mb ON mb.material_id = workorder.material_id
INNER JOIN pdm_bi_productdeptpcsn productdeptpcsn ON productdeptpcsn.org_id = workorder.org_id
WHERE
1 = 1
AND workorder.is_out = '1'
AND workorder.workorder_id IN (
SELECT DISTINCT
( procedureoffline.workorder_id )
FROM
pdm_bi_procedureoffline procedureoffline
WHERE
1 = 1
AND procedureoffline.is_send='0')
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
QUERY
SELECT
mb.material_code,
mb.material_name,
procedureoffline.material_id,
procedureoffline.diskrecord_id,
procedureoffline.pcsn,
procedureoffline.qty,
procedureoffline.bucketunique
FROM
pdm_bi_procedureoffline procedureoffline
LEFT JOIN md_me_materialbase mb ON mb.material_id = procedureoffline.material_id
WHERE
1 = 1
OPTION 输入.storagevehicle_code <> ""
procedureoffline.storagevehicle_code = 输入.storagevehicle_code
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF

View File

@@ -25,9 +25,7 @@ import org.nl.wql.core.bean.WQLObject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
@Service
@RequiredArgsConstructor
@@ -527,6 +525,14 @@ public class EmptyVehicleServiceImpl implements EmptyVehicleService {
throw new PdaRequestException("输入的载具号有误!");
}
ArrayList<HashMap> rows = (ArrayList<HashMap>) jsonObject.get("rows");
Set set = new HashSet();
for (int i = 0; i < rows.size(); i++) {
HashMap<String, String> row = rows.get(i);
set.add(row.get("material_id"));
}
if(set.size()>=2){
throw new PdaRequestException("组盘物料存在多种物料,不允许组盘!");
}
for (int i = 0; i < rows.size(); i++) {
HashMap<String, String> row = rows.get(i);

View File

@@ -26,6 +26,13 @@ import java.util.Map;
public class StatisticalReportController {
private final StatisticalReportService statisticalReportService;
@GetMapping("/sendOutQuery")
@Log("外协发货查询")
@ApiOperation("外协发货查询")
public ResponseEntity<Object> sendOutQuery(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(statisticalReportService.sendOutQuery(whereJson, page), HttpStatus.OK);
}
@GetMapping("/productInstor")
@Log("PG粉当月入库查询")
@ApiOperation("PG粉当月入库查询")

View File

@@ -12,6 +12,14 @@ import java.util.Map;
* @date 2021-08-19
**/
public interface StatisticalReportService {
/**
* 查询数据分页
*
* @param whereJson 条件
* @param page 分页参数
* @return Map<String, Object>
*/
Map<String, Object> sendOutQuery(Map whereJson, Pageable page);
/**
* 查询数据分页
*

View File

@@ -24,16 +24,49 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Service
@RequiredArgsConstructor
@Slf4j
public class StatisticalReportServiceImpl implements StatisticalReportService {
@Override
public Map<String, Object> sendOutQuery(Map whereJson, Pageable page) {
HashMap<String, String> map = new HashMap<>(whereJson);
String begin_time = MapUtil.getStr(whereJson, "begin_time");
if (StrUtil.isNotEmpty(begin_time)) {
map.put("begin_time", begin_time.substring(0,10));
}
String end_time = MapUtil.getStr(whereJson, "end_time");
if (StrUtil.isNotEmpty(end_time)) {
map.put("end_time", end_time.substring(0,10));
}
String pcsn = MapUtil.getStr(whereJson, "pcsn");
if (!StrUtil.isEmpty(pcsn)) {
map.put("pcsn", "%" + pcsn + "%");
}
String material_code = MapUtil.getStr(whereJson, "material_code");
if (!StrUtil.isEmpty(material_code)) {
map.put("material_code", "%" + material_code + "%");
}
String workorder_code = MapUtil.getStr(whereJson, "workorder_code");
if (!StrUtil.isEmpty(workorder_code)) {
map.put("workorder_code", "%" + workorder_code + "%");
}
String send_name = MapUtil.getStr(whereJson, "send_name");
if (!StrUtil.isEmpty(send_name)) {
map.put("send_name", "%" + send_name + "%");
}
map.put("flag", "5");
JSONObject jo = WQL.getWO("statistical_report_query_02").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "material_code");
return jo;
}
@Override
public Map<String, Object> productInstorQuery(Map whereJson, Pageable page) {
String material_code = MapUtil.getStr(whereJson, "material_code");
@@ -520,5 +553,4 @@ public class StatisticalReportServiceImpl implements StatisticalReportService {
.process().getResultJSONArray(0);
return ja;
}
}

View File

@@ -30,6 +30,9 @@
输入.bill_status TYPEAS s_string
输入.material_id TYPEAS s_string
输入.org_id TYPEAS s_string
输入.workorder_code TYPEAS s_string
输入.send_name TYPEAS s_string
输入.is_send TYPEAS s_string
[临时表]
@@ -186,4 +189,58 @@
ENDQUERY
ENDIF
IF 输入.flag = "5"
PAGEQUERY
SELECT
procedureoffline.storagevehicle_code,
max(procedureoffline.is_send) as is_send,
max(procedureoffline.send_name) as send_name,
max(procedureoffline.send_time) as send_time,
max(procedureoffline.create_name) as create_name,
max(procedureoffline.status) as status,
max(procedureoffline.create_time) as create_time,
COUNT(*) AS num_bucket,
sum(procedureoffline.qty) AS total_qty,
max(procedureoffline.pcsn) as pcsn,
max(mb.material_code) AS material_code,
max(workorder.workorder_code) AS workorder_code,
max(workorder.send_date) AS send_date,
max(workorder.status) AS workorder_status,
max(workorder.workorder_qty) AS workorder_qty,
max(workorder.org_id) AS org_id
FROM
pdm_bi_procedureoffline procedureoffline
INNER JOIN pdm_bi_workorder workorder ON workorder.workorder_id = procedureoffline.workorder_id
INNER JOIN md_me_materialbase mb ON mb.material_id = procedureoffline.material_id
WHERE
1 = 1 and workorder.is_out='1'
OPTION 输入.begin_time <> ""
workorder.send_date >= 输入.begin_time
ENDOPTION
OPTION 输入.end_time <> ""
workorder.send_date <= 输入.end_time
ENDOPTION
OPTION 输入.pcsn <> ""
procedureoffline.pcsn like 输入.pcsn
ENDOPTION
OPTION 输入.material_code <> ""
(mb.material_code like 输入.material_code or mb.material_name like 输入.material_code)
ENDOPTION
OPTION 输入.workorder_code <> ""
workorder.workorder_code like 输入.workorder_code
ENDOPTION
OPTION 输入.send_name <> ""
procedureoffline.send_name like 输入.send_name
ENDOPTION
OPTION 输入.org_id <> ""
workorder.org_id = 输入.org_id
ENDOPTION
OPTION 输入.is_send <> ""
procedureoffline.is_send = 输入.is_send
ENDOPTION
group by procedureoffline.storagevehicle_code
ENDSELECT
ENDPAGEQUERY
ENDIF