fix: 混料退料、取样计数手持接口,虚拟库、退料报表开发

This commit is contained in:
2024-05-17 13:22:24 +08:00
parent 496993f082
commit 5d8920d913
11 changed files with 422 additions and 2 deletions

View File

@@ -0,0 +1,45 @@
package org.nl.wms.cockpit.rest;
import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.nl.modules.logging.annotation.Log;
import org.nl.wms.cockpit.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
/**
* @Author: lyd
* @Description: 报表管理
* @Date: 2024/5/16
*/
@RestController
@Api(tags = "报表管理")
@RequestMapping("/api/report")
public class ReportController {
@Autowired
private ReportService reportService;
@GetMapping("/queryXN")
@Log("查询出窑虚拟库、货架、木托虚拟库库存")
@ApiOperation("查询出窑虚拟库、货架、木托虚拟库库存")
//@SaCheckPermission("point:list")
public ResponseEntity<Object> queryXN(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(reportService.queryXN(whereJson, page), HttpStatus.OK);
}
@GetMapping("/mudMaterialReport")
@Log("泥料退料报表")
@ApiOperation("泥料退料报表")
//@SaCheckPermission("point:list")
public ResponseEntity<Object> mudMaterialReport(@RequestParam Map whereJson, Pageable page) {
return new ResponseEntity<>(reportService.mudMaterialReport(whereJson, page), HttpStatus.OK);
}
}

View File

@@ -0,0 +1,17 @@
package org.nl.wms.cockpit.service;
import com.alibaba.fastjson.JSONObject;
import org.springframework.data.domain.Pageable;
import java.util.Map;
/**
* @Author: lyd
* @Description:
* @Date: 2024/5/16
*/
public interface ReportService {
Map<String,Object> queryXN(Map whereJson, Pageable page);
Map<String,Object> mudMaterialReport(Map whereJson, Pageable page);
}

View File

@@ -0,0 +1,29 @@
package org.nl.wms.cockpit.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.nl.modules.wql.WQL;
import org.nl.modules.wql.util.WqlUtil;
import org.nl.wms.cockpit.service.ReportService;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import java.util.Map;
/**
* @Author: lyd
* @Description:
* @Date: 2024/5/16
*/
@Service
public class ReportServiceImpl implements ReportService {
@Override
public Map<String, Object> queryXN(Map whereJson, Pageable page) {
return WQL.getWO("REPORT").addParam("flag", "1").addParam("point_code", whereJson.get("point_code")).pageQuery(WqlUtil.getHttpContext(page), "sd.create_time desc");
}
@Override
public Map<String, Object> mudMaterialReport(Map whereJson, Pageable page) {
return WQL.getWO("REPORT").addParam("flag", "2").pageQuery(WqlUtil.getHttpContext(page), "sd.create_time desc, m.order_code");
}
}

View File

@@ -0,0 +1,76 @@
[交易说明]
交易名: 车间情况
所属模块:
功能简述:
版权所有:
表引用:
版本经历:
[数据库]
--指定数据库为空采用默认值默认为db.properties中列出的第一个库
[IO定义]
#################################################
## 表字段对应输入参数
#################################################
输入.flag TYPEAS s_string
输入.point_code TYPEAS s_string
[临时表]
--这边列出来的临时表就会在运行期动态创建
[临时变量]
--所有中间过程变量均可在此处定义
[业务过程]
##########################################
# 1、输入输出检查 #
##########################################
##########################################
# 2、主过程前处理 #
##########################################
##########################################
# 3、业务主过程 #
##########################################
IF 输入.flag = "1"
PAGEQUERY
SELECT
sd.*,
p.point_name,
m.material_code,
m.order_code
FROM
`st_ivt_vehicle_detail` sd
LEFT JOIN sch_base_point p ON p.point_code = sd.point_code
LEFT JOIN md_me_materialbase m ON m.material_id = sd.material_id
WHERE p.region_code = 'XN' AND sd.is_delete = '0'
OPTION 输入.point_code <> ""
sd.point_code = 输入.point_code
ENDOPTION
ENDSELECT
ENDPAGEQUERY
ENDIF
IF 输入.flag = "2"
PAGEQUERY
SELECT
sd.*,
p.point_name,
m.material_code,
m.order_code
FROM
`st_ivt_vehicle_detail` sd
LEFT JOIN sch_base_point p ON p.point_code = sd.point_code
LEFT JOIN md_me_materialbase m ON m.material_id = sd.material_id
WHERE sd.is_back = '1'
ENDSELECT
ENDPAGEQUERY
ENDIF

View File

@@ -425,4 +425,24 @@ public class PdaController {
public JSONObject kilnMovePointList() {
return PdaUtils.buildSuccessResultJSON(pdaService.kilnMovePointList());
}
// ====================================================================
@PostMapping("/manual/materialReturn")
@Log("泥料退料")
@ApiOperation("泥料退料")
@PdaAnnotation
public JSONObject MaterialReturn(@RequestBody JSONObject param) {
pdaService.MaterialReturn(param);
return PdaUtils.buildSuccessResultJSON(null);
}
// ====================================================================
@PostMapping("/manual/samplingCountNum")
@Log("取样计数")
@ApiOperation("取样计数")
@PdaAnnotation
public JSONObject samplingCountNum(@RequestBody JSONObject param) {
pdaService.samplingCountNum(param);
return PdaUtils.buildSuccessResultJSON(null);
}
}

View File

@@ -232,4 +232,16 @@ public interface PdaService {
* @return /
*/
JSONArray suppressTaskShow();
/**
* 退料
* @param param /
*/
void MaterialReturn(JSONObject param);
/**
* 取样计数
* @param param /
*/
void samplingCountNum(JSONObject param);
}

View File

@@ -36,6 +36,8 @@ import org.nl.wms.sch.task.util.TaskUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
/**
* @author 张江玮
* @date 2022/12/02 10:04
@@ -1107,4 +1109,44 @@ public class PdaServiceImpl implements PdaService {
public JSONArray suppressTaskShow() {
return this.getMixingTaskList();
}
@Override
@Transactional(rollbackFor = Exception.class)
public void MaterialReturn(JSONObject param) {
log.info("请求参数:{}", param);
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
WQLObject orderTab = WQLObject.getWQLObject("pdm_bd_workorder");
// param: vehicle_code
String vehicleCode = param.getString("vehicle_code");
JSONObject groupObj = vd_table.query("vehicle_code = '" + vehicleCode + "' AND vehicle_type = '1'", "create_time desc").uniqueResult(0);
if (ObjectUtil.isEmpty(groupObj)) {
throw new BadRequestException("料盅[" + vehicleCode + "]组盘信息不存在!");
}
// 查找工单
JSONObject orderObj = orderTab.query("workorder_id = '" + groupObj.getString("workorder_id") + "'").uniqueResult(0);
orderObj.put("unqualified_qty", orderObj.getBigDecimal("unqualified_qty").add(groupObj.getBigDecimal("weight")));
TaskUtils.addCurrentUpdateColum(orderObj);
orderTab.update(orderObj);
// 组盘修改
groupObj.put("is_back", "1");
TaskUtils.addCurrentUpdateColum(groupObj);
vd_table.update(groupObj);
}
@Override
public void samplingCountNum(JSONObject param) {
log.info("请求参数:{}", param);
WQLObject vd_table = WQLObject.getWQLObject("st_ivt_vehicle_detail");
// param: vehicle_code, number
String vehicleCode = param.getString("vehicle_code");
BigDecimal number = param.getBigDecimal("number");
JSONObject groupObj = vd_table.query("vehicle_code = '" + vehicleCode + "' AND vehicle_type = '2'", "create_time desc").uniqueResult(0);
if (ObjectUtil.isEmpty(groupObj)) {
throw new BadRequestException("托盘[" + vehicleCode + "]组盘信息不存在!");
}
BigDecimal bigDecimal = ObjectUtil.isNotEmpty(groupObj.getBigDecimal("count_num")) ? groupObj.getBigDecimal("count_num") : new BigDecimal("0");
groupObj.put("count_num", bigDecimal.add(number));
TaskUtils.addCurrentUpdateColum(groupObj);
vd_table.update(groupObj);
}
}

View File

@@ -215,8 +215,8 @@ public class PointServiceImpl implements PointService {
@Override
public JSONArray getPoint(Map wherJson) {
String area_type = (String) wherJson.get("area_type");
JSONArray point_rows = WQLObject.getWQLObject("sch_base_point").query("area_type IN (" + area_type + ") AND is_used = '1' AND is_delete = '0' order by point_code").getResultJSONArray(0);
String area_type = (String) wherJson.get("region_Code");
JSONArray point_rows = WQLObject.getWQLObject("sch_base_point").query("region_Code IN ('" + area_type + "') order by point_code").getResultJSONArray(0);
return point_rows;
}